From b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1 Mon Sep 17 00:00:00 2001
From: Tom Tromey This is the original SAX1 interface for reporting an element's
- * attributes. Unlike the new {@link org.xml.sax.Attributes Attributes}
- * interface, it does not support Namespace-related information. When an attribute list is supplied as part of a
- * {@link org.xml.sax.DocumentHandler#startElement startElement}
- * event, the list will return valid results only during the
- * scope of the event; once the event handler returns control
- * to the parser, the attribute list is invalid. To save a
- * persistent copy of the attribute list, use the SAX1
- * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
- * helper class. An attribute list includes only attributes that have been
- * specified or defaulted: #IMPLIED attributes will not be included. There are two ways for the SAX application to obtain information
- * from the AttributeList. First, it can iterate through the entire
- * list: (Note that the result of getLength() will be zero if there
- * are no attributes.)
- *
- * As an alternative, the application can request the value or
- * type of specific attributes: The SAX parser may provide attributes in any
- * arbitrary order, regardless of the order in which they were
- * declared or specified. The number of attributes may be
- * zero. The names must be unique: the SAX parser shall not include the
- * same attribute twice. Attributes without values (those declared
- * #IMPLIED without a value specified in the start tag) will be
- * omitted from the list. If the attribute name has a namespace prefix, the prefix
- * will still be attached. The attribute type is one of the strings "CDATA", "ID",
- * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
- * or "NOTATION" (always in upper case). If the parser has not read a declaration for the attribute,
- * or if the parser does not report attribute types, then it must
- * return the value "CDATA" as stated in the XML 1.0 Recommentation
- * (clause 3.3.3, "Attribute-Value Normalization"). For an enumerated attribute that is not a notation, the
- * parser will report the type as "NMTOKEN". If the attribute value is a list of tokens (IDREFS,
- * ENTITIES, or NMTOKENS), the tokens will be concatenated
- * into a single string separated by whitespace. The return value is the same as the return value for
- * getType(int). If the attribute name has a namespace prefix in the document,
- * the application must include the prefix here. The return value is the same as the return value for
- * getValue(int). If the attribute name has a namespace prefix in the document,
- * the application must include the prefix here. This interface allows access to a list of attributes in
- * three different ways: The list will not contain attributes that were declared
- * #IMPLIED but not specified in the start tag. It will also not
- * contain attributes used as Namespace declarations (xmlns*) unless
- * the Some SAX2 parsers may support using an optional feature flag
- * ( If the namespace-prefixes feature (see above) is
- * false, access by qualified name may not be available; if
- * the This interface replaces the now-deprecated SAX1 {@link
- * org.xml.sax.AttributeList AttributeList} interface, which does not
- * contain Namespace support. In addition to Namespace support, it
- * adds the getIndex methods (below). The order of attributes in the list is unspecified, and will
- * vary from implementation to implementation. Once you know the number of attributes, you can iterate
- * through the list. The attribute type is one of the strings "CDATA", "ID",
- * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
- * or "NOTATION" (always in upper case). If the parser has not read a declaration for the attribute,
- * or if the parser does not report attribute types, then it must
- * return the value "CDATA" as stated in the XML 1.0 Recommendation
- * (clause 3.3.3, "Attribute-Value Normalization"). For an enumerated attribute that is not a notation, the
- * parser will report the type as "NMTOKEN". If the attribute value is a list of tokens (IDREFS,
- * ENTITIES, or NMTOKENS), the tokens will be concatenated
- * into a single string with each token separated by a
- * single space. See {@link #getType(int) getType(int)} for a description
- * of the possible types. See {@link #getType(int) getType(int)} for a description
- * of the possible types. See {@link #getValue(int) getValue(int)} for a description
- * of the possible values. See {@link #getValue(int) getValue(int)} for a description
- * of the possible values. This is the main interface that most SAX applications
- * implement: if the application needs to be informed of basic parsing
- * events, it implements this interface and registers an instance with
- * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler
- * setContentHandler} method. The parser uses the instance to report
- * basic document-related events like the start and end of elements
- * and character data. The order of events in this interface is very important, and
- * mirrors the order of information in the document itself. For
- * example, all of an element's content (character data, processing
- * instructions, and/or subelements) will appear, in order, between
- * the startElement event and the corresponding endElement event. This interface is similar to the now-deprecated SAX 1.0
- * DocumentHandler interface, but it adds support for Namespaces
- * and for reporting skipped entities (in non-validating XML
- * processors). Implementors should note that there is also a
- * In fact, "import ...*" is usually a sign of sloppy programming
- * anyway, so the user should consider this a feature rather than a
- * bug. SAX parsers are strongly encouraged (though not absolutely
- * required) to supply a locator: if it does so, it must supply
- * the locator to the application by invoking this method before
- * invoking any of the other methods in the ContentHandler
- * interface. The locator allows the application to determine the end
- * position of any document-related event, even if the parser is
- * not reporting an error. Typically, the application will
- * use this information for reporting its own errors (such as
- * character content that does not match an application's
- * business rules). The information returned by the locator
- * is probably not sufficient for use with a search engine. Note that the locator will return correct information only
- * during the invocation SAX event callbacks after
- * {@link #startDocument startDocument} returns and before
- * {@link #endDocument endDocument} is called. The
- * application should not attempt to use it at any other time. The SAX parser will invoke this method only once, before any
- * other event callbacks (except for {@link #setDocumentLocator
- * setDocumentLocator}). There is an apparent contradiction between the
- * documentation for this method and the documentation for {@link
- * org.xml.sax.ErrorHandler#fatalError}. Until this ambiguity is
- * resolved in a future major release, clients should make no
- * assumptions about whether endDocument() will or will not be
- * invoked when the parser has reported a fatalError() or thrown
- * an exception. The SAX parser will invoke this method only once, and it will
- * be the last method invoked during the parse. The parser shall
- * not invoke this method until it has either abandoned parsing
- * (because of an unrecoverable error) or reached the end of
- * input. The information from this event is not necessary for
- * normal Namespace processing: the SAX XML reader will
- * automatically replace prefixes for element and attribute
- * names when the There are cases, however, when applications need to
- * use prefixes in character data or in attribute values,
- * where they cannot safely be expanded automatically; the
- * start/endPrefixMapping event supplies the information
- * to the application to expand prefixes in those contexts
- * itself, if necessary. Note that start/endPrefixMapping events are not
- * guaranteed to be properly nested relative to each other:
- * all startPrefixMapping events will occur immediately before the
- * corresponding {@link #startElement startElement} event,
- * and all {@link #endPrefixMapping endPrefixMapping}
- * events will occur immediately after the corresponding
- * {@link #endElement endElement} event,
- * but their order is not otherwise
- * guaranteed. There should never be start/endPrefixMapping events for the
- * "xml" prefix, since it is predeclared and immutable. See {@link #startPrefixMapping startPrefixMapping} for
- * details. These events will always occur immediately after the
- * corresponding {@link #endElement endElement} event, but the order of
- * {@link #endPrefixMapping endPrefixMapping} events is not otherwise
- * guaranteed. The Parser will invoke this method at the beginning of every
- * element in the XML document; there will be a corresponding
- * {@link #endElement endElement} event for every startElement event
- * (even when the element is empty). All of the element's content will be
- * reported, in order, before the corresponding endElement
- * event. This event allows up to three name components for each
- * element: Any or all of these may be provided, depending on the
- * values of the http://xml.org/sax/features/namespaces
- * and the http://xml.org/sax/features/namespace-prefixes
- * properties: Note that the attribute list provided will contain only
- * attributes with explicit values (specified or defaulted):
- * #IMPLIED attributes will be omitted. The attribute list
- * will contain attributes used for Namespace declarations
- * (xmlns* attributes) only if the
- * Like {@link #characters characters()}, attribute values may have
- * characters that need more than one The SAX parser will invoke this method at the end of every
- * element in the XML document; there will be a corresponding
- * {@link #startElement startElement} event for every endElement
- * event (even when the element is empty). For information on the names, see startElement. The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
- * data in a single chunk, or they may split it into several
- * chunks; however, all of the characters in any single event
- * must come from the same external entity so that the Locator
- * provides useful information. The application must not attempt to read from the array
- * outside of the specified range. Individual characters may consist of more than one Java
- * Your code should not assume that algorithms using
- * Note that some parsers will report whitespace in element
- * content using the {@link #ignorableWhitespace ignorableWhitespace}
- * method rather than this one (validating parsers must
- * do so). Validating Parsers must use this method to report each chunk
- * of whitespace in element content (see the W3C XML 1.0
- * recommendation, section 2.10): non-validating parsers may also
- * use this method if they are capable of parsing and using
- * content models. SAX parsers may return all contiguous whitespace in a single
- * chunk, or they may split it into several chunks; however, all of
- * the characters in any single event must come from the same
- * external entity, so that the Locator provides useful
- * information. The application must not attempt to read from the array
- * outside of the specified range. The Parser will invoke this method once for each processing
- * instruction found: note that processing instructions may occur
- * before or after the main document element. A SAX parser must never report an XML declaration (XML 1.0,
- * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
- * using this method. Like {@link #characters characters()}, processing instruction
- * data may have characters that need more than one The Parser will invoke this method each time the entity is
- * skipped. Non-validating processors may skip entities if they
- * have not seen the declarations (because, for example, the
- * entity was declared in an external DTD subset). All processors
- * may skip external entities, depending on the values of the
- * If a SAX application needs information about notations and
- * unparsed entities, then the application implements this
- * interface and registers an instance with the SAX parser using
- * the parser's setDTDHandler method. The parser uses the
- * instance to report notation and unparsed entity declarations to
- * the application. Note that this interface includes only those DTD events that
- * the XML recommendation requires processors to report:
- * notation and unparsed entity declarations. The SAX parser may report these events in any order, regardless
- * of the order in which the notations and unparsed entities were
- * declared; however, all DTD events must be reported after the
- * document handler's startDocument event, and before the first
- * startElement event.
- * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
- * used, these events must also be reported before the endDTD event.)
- * It is up to the application to store the information for
- * future use (perhaps in a hash table or object tree).
- * If the application encounters attributes of type "NOTATION",
- * "ENTITY", or "ENTITIES", it can use the information that it
- * obtained through this interface to find the entity and/or
- * notation corresponding with the attribute value. It is up to the application to record the notation for later
- * reference, if necessary;
- * notations may appear as attribute values and in unparsed entity
- * declarations, and are sometime used with processing instruction
- * target names. At least one of publicId and systemId must be non-null.
- * If a system identifier is present, and it is a URL, the SAX
- * parser must resolve it fully before passing it to the
- * application through this event. There is no guarantee that the notation declaration will be
- * reported before any unparsed entities that use it. Note that the notation name corresponds to a notation
- * reported by the {@link #notationDecl notationDecl} event.
- * It is up to the application to record the entity for later
- * reference, if necessary;
- * unparsed entities may appear as attribute values.
- * If the system identifier is a URL, the parser must resolve it
- * fully before passing it to the application. This was the main event-handling interface for SAX1; in
- * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler
- * ContentHandler}, which provides Namespace support and reporting
- * of skipped entities. This interface is included in SAX2 only
- * to support legacy SAX1 applications. The order of events in this interface is very important, and
- * mirrors the order of information in the document itself. For
- * example, all of an element's content (character data, processing
- * instructions, and/or subelements) will appear, in order, between
- * the startElement event and the corresponding endElement event. Application writers who do not want to implement the entire
- * interface can derive a class from HandlerBase, which implements
- * the default functionality; parser writers can instantiate
- * HandlerBase to obtain a default handler. The application can find
- * the location of any document event using the Locator interface
- * supplied by the Parser through the setDocumentLocator method. SAX parsers are strongly encouraged (though not absolutely
- * required) to supply a locator: if it does so, it must supply
- * the locator to the application by invoking this method before
- * invoking any of the other methods in the DocumentHandler
- * interface. The locator allows the application to determine the end
- * position of any document-related event, even if the parser is
- * not reporting an error. Typically, the application will
- * use this information for reporting its own errors (such as
- * character content that does not match an application's
- * business rules). The information returned by the locator
- * is probably not sufficient for use with a search engine. Note that the locator will return correct information only
- * during the invocation of the events in this interface. The
- * application should not attempt to use it at any other time. The SAX parser will invoke this method only once, before any
- * other methods in this interface or in DTDHandler (except for
- * setDocumentLocator). The SAX parser will invoke this method only once, and it will
- * be the last method invoked during the parse. The parser shall
- * not invoke this method until it has either abandoned parsing
- * (because of an unrecoverable error) or reached the end of
- * input. The Parser will invoke this method at the beginning of every
- * element in the XML document; there will be a corresponding
- * endElement() event for every startElement() event (even when the
- * element is empty). All of the element's content will be
- * reported, in order, before the corresponding endElement()
- * event. If the element name has a namespace prefix, the prefix will
- * still be attached. Note that the attribute list provided will
- * contain only attributes with explicit values (specified or
- * defaulted): #IMPLIED attributes will be omitted. The SAX parser will invoke this method at the end of every
- * element in the XML document; there will be a corresponding
- * startElement() event for every endElement() event (even when the
- * element is empty). If the element name has a namespace prefix, the prefix will
- * still be attached to the name. The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
- * data in a single chunk, or they may split it into several
- * chunks; however, all of the characters in any single event
- * must come from the same external entity, so that the Locator
- * provides useful information. The application must not attempt to read from the array
- * outside of the specified range. Note that some parsers will report whitespace using the
- * ignorableWhitespace() method rather than this one (validating
- * parsers must do so). Validating Parsers must use this method to report each chunk
- * of ignorable whitespace (see the W3C XML 1.0 recommendation,
- * section 2.10): non-validating parsers may also use this method
- * if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single
- * chunk, or they may split it into several chunks; however, all of
- * the characters in any single event must come from the same
- * external entity, so that the Locator provides useful
- * information. The application must not attempt to read from the array
- * outside of the specified range. The Parser will invoke this method once for each processing
- * instruction found: note that processing instructions may occur
- * before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0,
- * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
- * using this method. If a SAX application needs to implement customized handling
- * for external entities, it must implement this interface and
- * register an instance with the SAX driver using the
- * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver}
- * method. The XML reader will then allow the application to intercept any
- * external entities (including the external DTD subset and external
- * parameter entities, if any) before including them. Many SAX applications will not need to implement this interface,
- * but it will be especially useful for applications that build
- * XML documents from databases or other specialised input sources,
- * or for applications that use URI types other than URLs. The following resolver would provide the application
- * with a special character stream for the entity with the system
- * identifier "http://www.myhost.com/today": The application can also use this interface to redirect system
- * identifiers to local URIs or to look up replacements in a catalog
- * (possibly by using the public identifier). The parser will call this method before opening any external
- * entity except the top-level document entity. Such entities include
- * the external DTD subset and external parameter entities referenced
- * within the DTD (in either case, only if the parser reads external
- * parameter entities), and external general entities referenced
- * within the document element (if the parser reads external general
- * entities). The application may request that the parser locate
- * the entity itself, that it use an alternative URI, or that it
- * use data provided by the application (as a character or byte
- * input stream). Application writers can use this method to redirect external
- * system identifiers to secure and/or local URIs, to look up
- * public identifiers in a catalogue, or to read an entity from a
- * database or other input source (including, for example, a dialog
- * box). Neither XML nor SAX specifies a preferred policy for using
- * public or system IDs to resolve resources. However, SAX specifies
- * how to interpret any InputSource returned by this method, and that
- * if none is returned, then the system ID will be dereferenced as
- * a URL. If the system identifier is a URL, the SAX parser must
- * resolve it fully before reporting it to the application. If a SAX application needs to implement customized error
- * handling, it must implement this interface and then register an
- * instance with the XML reader using the
- * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}
- * method. The parser will then report all errors and warnings
- * through this interface. WARNING: If an application does not
- * register an ErrorHandler, XML parsing errors will go unreported,
- * except that SAXParseExceptions will be thrown for fatal errors.
- * In order to detect validity errors, an ErrorHandler that does something
- * with {@link #error error()} calls must be registered. For XML processing errors, a SAX driver must use this interface
- * in preference to throwing an exception: it is up to the application
- * to decide whether to throw an exception for different types of
- * errors and warnings. Note, however, that there is no requirement that
- * the parser continue to report additional errors after a call to
- * {@link #fatalError fatalError}. In other words, a SAX driver class
- * may throw an exception after reporting any fatalError.
- * Also parsers may throw appropriate exceptions for non-XML errors.
- * For example, {@link XMLReader#parse XMLReader.parse()} would throw
- * an IOException for errors accessing entities or the document. SAX parsers will use this method to report conditions that
- * are not errors or fatal errors as defined by the XML
- * recommendation. The default behaviour is to take no
- * action. The SAX parser must continue to provide normal parsing events
- * after invoking this method: it should still be possible for the
- * application to process the document through to the end. Filters may use this method to report other, non-XML warnings
- * as well. This corresponds to the definition of "error" in section 1.2
- * of the W3C XML 1.0 Recommendation. For example, a validating
- * parser would use this callback to report the violation of a
- * validity constraint. The default behaviour is to take no
- * action. The SAX parser must continue to provide normal parsing
- * events after invoking this method: it should still be possible
- * for the application to process the document through to the end.
- * If the application cannot do so, then the parser should report
- * a fatal error even if the XML recommendation does not require
- * it to do so. Filters may use this method to report other, non-XML errors
- * as well. There is an apparent contradiction between the
- * documentation for this method and the documentation for {@link
- * org.xml.sax.ContentHandler#endDocument}. Until this ambiguity
- * is resolved in a future major release, clients should make no
- * assumptions about whether endDocument() will or will not be
- * invoked when the parser has reported a fatalError() or thrown
- * an exception. This corresponds to the definition of "fatal error" in
- * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
- * parser would use this callback to report the violation of a
- * well-formedness constraint. The application must assume that the document is unusable
- * after the parser has invoked this method, and should continue
- * (if at all) only for the sake of collecting additional error
- * messages: in fact, SAX parsers are free to stop reporting any
- * other events once this method has been invoked. This class implements the default behaviour for four SAX1
- * interfaces: EntityResolver, DTDHandler, DocumentHandler,
- * and ErrorHandler. It is now obsolete, but is included in SAX2 to
- * support legacy SAX1 applications. SAX2 applications should use
- * the {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
- * class instead. Application writers can extend this class when they need to
- * implement only part of an interface; parser writers can
- * instantiate this class to provide default handlers when the
- * application has not supplied its own. Note that the use of this class is optional. Always return null, so that the parser will use the system
- * identifier provided in the XML document. This method implements
- * the SAX default behaviour: application writers can override it
- * in a subclass to do special translations such as catalog lookups
- * or URI redirection. By default, do nothing. Application writers may override this
- * method in a subclass if they wish to keep track of the notations
- * declared in a document. By default, do nothing. Application writers may override this
- * method in a subclass to keep track of the unparsed entities
- * declared in a document. By default, do nothing. Application writers may override this
- * method in a subclass if they wish to store the locator for use
- * with other document events. By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as allocating the root node of a tree or
- * creating an output file). By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as finalising a tree or closing an output
- * file). By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the start of
- * each element (such as allocating a new tree node or writing
- * output to a file). By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end of
- * each element (such as finalising a tree node or writing
- * output to a file). By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of character data
- * (such as adding the data to a node or buffer, or printing it to
- * a file). By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of ignorable
- * whitespace (such as adding data to a node or buffer, or printing
- * it to a file). By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions for each
- * processing instruction, such as setting status variables or
- * invoking other methods. The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each warning, such as inserting the message in a log file or
- * printing it to the console. The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each error, such as inserting the message in a log file or
- * printing it to the console. The default implementation throws a SAXParseException.
- * Application writers may override this method in a subclass if
- * they need to take specific actions for each fatal error (such as
- * collecting all of the errors into a single report): in any case,
- * the application must stop all regular processing when this
- * method is invoked, since the document is no longer reliable, and
- * the parser may no longer report parsing events. This class allows a SAX application to encapsulate information
- * about an input source in a single object, which may include
- * a public identifier, a system identifier, a byte stream (possibly
- * with a specified encoding), and/or a character stream. There are two places that the application can deliver an
- * input source to the parser: as the argument to the Parser.parse
- * method, or as the return value of the EntityResolver.resolveEntity
- * method. The SAX parser will use the InputSource object to determine how
- * to read XML input. If there is a character stream available, the
- * parser will read that stream directly, disregarding any text
- * encoding declaration found in that stream.
- * If there is no character stream, but there is
- * a byte stream, the parser will use that byte stream, using the
- * encoding specified in the InputSource or else (if no encoding is
- * specified) autodetecting the character encoding using an algorithm
- * such as the one in the XML specification. If neither a character
- * stream nor a
- * byte stream is available, the parser will attempt to open a URI
- * connection to the resource identified by the system
- * identifier. An InputSource object belongs to the application: the SAX parser
- * shall never modify it in any way (it may modify a copy if
- * necessary). However, standard processing of both byte and
- * character streams is to close them on as part of end-of-parse cleanup,
- * so applications should not attempt to re-use such streams after they
- * have been handed to a parser. Applications may use setPublicId to include a
- * public identifier as well, or setEncoding to specify
- * the character encoding, if known. If the system identifier is a URL, it must be fully
- * resolved (it may not be a relative URL). Application writers should use setSystemId() to provide a base
- * for resolving relative URIs, may use setPublicId to include a
- * public identifier, and may use setEncoding to specify the object's
- * character encoding. Application writers should use setSystemId() to provide a base
- * for resolving relative URIs, and may use setPublicId to include a
- * public identifier. The character stream shall not include a byte order mark. The public identifier is always optional: if the application
- * writer includes one, it will be provided as part of the
- * location information. The system identifier is optional if there is a byte stream
- * or a character stream, but it is still useful to provide one,
- * since the application can use it to resolve relative URIs
- * and can include it in error messages and warnings (the parser
- * will attempt to open a connection to the URI only if
- * there is no byte stream or character stream specified). If the application knows the character encoding of the
- * object pointed to by the system identifier, it can register
- * the encoding using the setEncoding method. If the system identifier is a URL, it must be fully
- * resolved (it may not be a relative URL). The getEncoding method will return the character encoding
- * of the object pointed to, or null if unknown. If the system ID is a URL, it will be fully resolved. The SAX parser will ignore this if there is also a character
- * stream specified, but it will use a byte stream in preference
- * to opening a URI connection itself. If the application knows the character encoding of the
- * byte stream, it should set it with the setEncoding method. The getEncoding method will return the character
- * encoding for this byte stream, or null if unknown. The encoding must be a string acceptable for an
- * XML encoding declaration (see section 4.3.3 of the XML 1.0
- * recommendation). This method has no effect when the application provides a
- * character stream. If there is a character stream specified, the SAX parser
- * will ignore any byte stream and will not attempt to open
- * a URI connection to the system identifier. If a SAX parser provides location information to the SAX
- * application, it does so by implementing this interface and then
- * passing an instance to the application using the content
- * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator
- * setDocumentLocator} method. The application can use the
- * object to obtain the location of any other SAX event
- * in the XML source document. Note that the results returned by the object will be valid only
- * during the scope of each callback method: the application
- * will receive unpredictable results if it attempts to use the
- * locator at any other time, or after parsing completes. SAX parsers are not required to supply a locator, but they are
- * very strongly encouraged to do so. If the parser supplies a
- * locator, it must do so before reporting any other document events.
- * If no locator has been set by the time the application receives
- * the {@link org.xml.sax.ContentHandler#startDocument startDocument}
- * event, the application should assume that a locator is not
- * available. The return value is the public identifier of the document
- * entity or of the external parsed entity in which the markup
- * triggering the event appears. The return value is the system identifier of the document
- * entity or of the external parsed entity in which the markup
- * triggering the event appears. If the system identifier is a URL, the parser must resolve it
- * fully before passing it to the application. For example, a file
- * name must always be provided as a file:... URL, and other
- * kinds of relative URI are also resolved against their bases. Warning: The return value from the method
- * is intended only as an approximation for the sake of diagnostics;
- * it is not intended to provide sufficient information
- * to edit the character content of the original XML document.
- * In some cases, these "line" numbers match what would be displayed
- * as columns, and in others they may not match the source text
- * due to internal entity expansion. The return value is an approximation of the line number
- * in the document entity or external parsed entity where the
- * markup triggering the event appears. If possible, the SAX driver should provide the line position
- * of the first character after the text associated with the document
- * event. The first line is line 1. Warning: The return value from the method
- * is intended only as an approximation for the sake of diagnostics;
- * it is not intended to provide sufficient information
- * to edit the character content of the original XML document.
- * For example, when lines contain combining character sequences, wide
- * characters, surrogate pairs, or bi-directional text, the value may
- * not correspond to the column in a text editor's display. The return value is an approximation of the column number
- * in the document entity or external parsed entity where the
- * markup triggering the event appears. If possible, the SAX driver should provide the line position
- * of the first character after the text associated with the document
- * event. The first column in each line is column 1. This was the main event supplier interface for SAX1; it has
- * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},
- * which includes Namespace support and sophisticated configurability
- * and extensibility. All SAX1 parsers must implement this basic interface: it allows
- * applications to register handlers for different types of events
- * and to initiate a parse from a URI, or a character stream. All SAX1 parsers must also implement a zero-argument constructor
- * (though other constructors are also allowed). SAX1 parsers are reusable but not re-entrant: the application
- * may reuse a parser object (possibly with a different input source)
- * once the first parse has completed successfully, but it may not
- * invoke the parse() methods recursively within a parse. SAX parsers are not required to provide localisation for errors
- * and warnings; if they cannot support the requested locale,
- * however, they must throw a SAX exception. Applications may
- * not request a locale change in the middle of a parse. If the application does not register an entity resolver, the
- * SAX parser will resolve system identifiers and open connections
- * to entities itself (this is the default behaviour implemented in
- * HandlerBase). Applications may register a new or different entity resolver
- * in the middle of a parse, and the SAX parser must begin using
- * the new resolver immediately. If the application does not register a DTD handler, all DTD
- * events reported by the SAX parser will be silently
- * ignored (this is the default behaviour implemented by
- * HandlerBase). Applications may register a new or different
- * handler in the middle of a parse, and the SAX parser must
- * begin using the new handler immediately. If the application does not register a document handler, all
- * document events reported by the SAX parser will be silently
- * ignored (this is the default behaviour implemented by
- * HandlerBase). Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately. If the application does not register an error event handler,
- * all error events reported by the SAX parser will be silently
- * ignored, except for fatalError, which will throw a SAXException
- * (this is the default behaviour implemented by HandlerBase). Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately. The application can use this method to instruct the SAX parser
- * to begin parsing an XML document from any valid input
- * source (a character stream, a byte stream, or a URI). Applications may not invoke this method while a parse is in
- * progress (they should create a new Parser instead for each
- * additional XML document). Once a parse is complete, an
- * application may reuse the same Parser object, possibly with a
- * different input source. This method is a shortcut for the common case of reading a
- * document from a system identifier. It is the exact
- * equivalent of the following: If the system identifier is a URL, it must be fully resolved
- * by the application before it is passed to the parser. This class can contain basic error or warning information from
- * either the XML parser or the application: a parser writer or
- * application writer can subclass it to provide additional
- * functionality. SAX handlers may throw this exception or
- * any exception subclassed from it. If the application needs to pass through other types of
- * exceptions, it must wrap those exceptions in a SAXException
- * or an exception derived from a SAXException. If the parser or application needs to include information about a
- * specific location in an XML document, it should use the
- * {@link org.xml.sax.SAXParseException SAXParseException} subclass. The existing exception will be embedded in the new
- * one, and its message will become the default message for
- * the SAXException. The existing exception will be embedded in the new
- * one, but the new exception will have its own message. If there is an embedded exception, and if the SAXException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception. An XMLReader will throw this exception when it finds an
- * unrecognized feature or property identifier; SAX applications and
- * extensions may use this class for other, similar purposes. An XMLReader will throw this exception when it recognizes a
- * feature or property identifier, but cannot perform the requested
- * operation (setting a state or value). Other SAX2 applications and
- * extensions may use this class for similar purposes. This exception may include information for locating the error
- * in the original XML document, as if it came from a {@link Locator}
- * object. Note that although the application
- * will receive a SAXParseException as the argument to the handlers
- * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface,
- * the application is not actually required to throw the exception;
- * instead, it can simply read the information in it and take a
- * different action. Since this exception is a subclass of {@link org.xml.sax.SAXException
- * SAXException}, it inherits the ability to wrap another exception. This constructor is especially useful when an application is
- * creating its own exception from within a {@link org.xml.sax.ContentHandler
- * ContentHandler} callback. This constructor is especially useful when an application is
- * creating its own exception from within a {@link org.xml.sax.ContentHandler
- * ContentHandler} callback, and needs to wrap an existing exception that is not a
- * subclass of {@link org.xml.sax.SAXException SAXException}. This constructor is most useful for parser writers. All parameters except the message are as if
- * they were provided by a {@link Locator}. For example, if the
- * system identifier is a URL (including relative filename), the
- * caller must resolve it fully before creating the exception. This constructor is most useful for parser writers who
- * need to wrap an exception that is not a subclass of
- * {@link org.xml.sax.SAXException SAXException}. All parameters except the message and exception are as if
- * they were provided by a {@link Locator}. For example, if the
- * system identifier is a URL (including relative filename), the
- * caller must resolve it fully before creating the exception. If the system identifier is a URL, it will have been resolved
- * fully. The first line is line 1. The first column in a line is position 1. An XML filter is like an XML reader, except that it obtains its
- * events from another XML reader rather than a primary source like
- * an XML document or database. Filters can modify a stream of
- * events as they pass on to the final application. The XMLFilterImpl helper class provides a convenient base
- * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver
- * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},
- * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler
- * ErrorHandler} events automatically. This method allows the application to link the filter to
- * a parent reader (which may be another filter). The argument
- * may not be null. This method allows the application to query the parent
- * reader (which may be another filter). It is generally a
- * bad idea to perform any operations on the parent reader
- * directly: they should all pass through this filter. Note: despite its name, this interface does
- * not extend the standard Java {@link java.io.Reader Reader}
- * interface, because reading XML is a fundamentally different activity
- * than reading character data. XMLReader is the interface that an XML parser's SAX2 driver must
- * implement. This interface allows an application to set and
- * query features and properties in the parser, to register
- * event handlers for document processing, and to initiate
- * a document parse. All SAX interfaces are assumed to be synchronous: the
- * {@link #parse parse} methods must not return until parsing
- * is complete, and readers must wait for an event-handler callback
- * to return before reporting the next event. This interface replaces the (now deprecated) SAX 1.0 {@link
- * org.xml.sax.Parser Parser} interface. The XMLReader interface
- * contains two important enhancements over the old Parser
- * interface (as well as some minor ones): There are adapters available to convert a SAX1 Parser to
- * a SAX2 XMLReader and vice-versa. The feature name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a feature name but
- * temporarily be unable to return its value.
- * Some feature values may be available only in specific
- * contexts, such as before, during, or after a parse.
- * Also, some feature values may not be programmatically accessible.
- * (In the case of an adapter for SAX1 {@link Parser}, there is no
- * implementation-independent way to expose whether the underlying
- * parser is performing validation, expanding external entities,
- * and so forth.) All XMLReaders are required to recognize the
- * http://xml.org/sax/features/namespaces and the
- * http://xml.org/sax/features/namespace-prefixes feature names. Typical usage is something like this: Implementors are free (and encouraged) to invent their own features,
- * using names built on their own URIs. The feature name is any fully-qualified URI. It is
- * possible for an XMLReader to expose a feature value but
- * to be unable to change the current value.
- * Some feature values may be immutable or mutable only
- * in specific contexts, such as before, during, or after
- * a parse. All XMLReaders are required to support setting
- * http://xml.org/sax/features/namespaces to true and
- * http://xml.org/sax/features/namespace-prefixes to false. The property name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a property name but
- * temporarily be unable to return its value.
- * Some property values may be available only in specific
- * contexts, such as before, during, or after a parse. XMLReaders are not required to recognize any specific
- * property names, though an initial core set is documented for
- * SAX2. Implementors are free (and encouraged) to invent their own properties,
- * using names built on their own URIs. The property name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a property name but
- * to be unable to change the current value.
- * Some property values may be immutable or mutable only
- * in specific contexts, such as before, during, or after
- * a parse. XMLReaders are not required to recognize setting
- * any specific property names, though a core set is defined by
- * SAX2. This method is also the standard mechanism for setting
- * extended handlers. If the application does not register an entity resolver,
- * the XMLReader will perform its own default resolution. Applications may register a new or different resolver in the
- * middle of a parse, and the SAX parser must begin using the new
- * resolver immediately. If the application does not register a DTD handler, all DTD
- * events reported by the SAX parser will be silently ignored. Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately. If the application does not register a content handler, all
- * content events reported by the SAX parser will be silently
- * ignored. Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately. If the application does not register an error handler, all
- * error events reported by the SAX parser will be silently
- * ignored; however, normal processing may not continue. It is
- * highly recommended that all SAX applications implement an
- * error handler to avoid unexpected bugs. Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately. The application can use this method to instruct the XML
- * reader to begin parsing an XML document from any valid input
- * source (a character stream, a byte stream, or a URI). Applications may not invoke this method while a parse is in
- * progress (they should create a new XMLReader instead for each
- * nested XML document). Once a parse is complete, an
- * application may reuse the same XMLReader object, possibly with a
- * different input source.
- * Configuration of the XMLReader object (such as handler bindings and
- * values established for feature flags and properties) is unchanged
- * by completion of a parse, unless the definition of that aspect of
- * the configuration explicitly specifies other behavior.
- * (For example, feature flags or properties exposing
- * characteristics of the document being parsed.)
- * During the parse, the XMLReader will provide information
- * about the XML document through the registered event
- * handlers. This method is synchronous: it will not return until parsing
- * has ended. If a client application wants to terminate
- * parsing early, it should throw an exception. This method is a shortcut for the common case of reading a
- * document from a system identifier. It is the exact
- * equivalent of the following: If the system identifier is a URL, it must be fully resolved
- * by the application before it is passed to the parser. XMLReader implementations are not required to support this
- * information, and it is not part of core-only SAX2 distributions. Note that if an attribute was defaulted (!isSpecified())
- * it will of necessity also have been declared (isDeclared())
- * in the DTD.
- * Similarly if an attribute's type is anything except CDATA, then it
- * must have been declared.
- * Remember that since DTDs do not "understand" namespaces, the
- * namespace URI associated with an attribute may not have come from
- * the DTD. The declaration will have applied to the attribute's
- * qName.
- *
- * @param uri The Namespace URI, or the empty string if
- * the name has no Namespace URI.
- * @param localName The attribute's local name.
- * @return true if the attribute was declared in the DTD,
- * false otherwise.
- * @exception java.lang.IllegalArgumentException When the
- * supplied names do not identify an attribute.
- */
- public boolean isDeclared (String uri, String localName);
-
- /**
- * Returns true unless the attribute value was provided
- * by DTD defaulting.
- *
- * @param index The attribute index (zero-based).
- * @return true if the value was found in the XML text,
- * false if the value was provided by DTD defaulting.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not identify an attribute.
- */
- public boolean isSpecified (int index);
-
- /**
- * Returns true unless the attribute value was provided
- * by DTD defaulting.
- *
- * Remember that since DTDs do not "understand" namespaces, the
- * namespace URI associated with an attribute may not have come from
- * the DTD. The declaration will have applied to the attribute's
- * qName.
- *
- * @param uri The Namespace URI, or the empty string if
- * the name has no Namespace URI.
- * @param localName The attribute's local name.
- * @return true if the value was found in the XML text,
- * false if the value was provided by DTD defaulting.
- * @exception java.lang.IllegalArgumentException When the
- * supplied names do not identify an attribute.
- */
- public boolean isSpecified (String uri, String localName);
-
- /**
- * Returns true unless the attribute value was provided
- * by DTD defaulting.
- *
- * @param qName The XML qualified (prefixed) name.
- * @return true if the value was found in the XML text,
- * false if the value was provided by DTD defaulting.
- * @exception java.lang.IllegalArgumentException When the
- * supplied name does not identify an attribute.
- */
- public boolean isSpecified (String qName);
-}
diff --git a/libjava/external/sax/org/xml/sax/ext/Attributes2Impl.java b/libjava/external/sax/org/xml/sax/ext/Attributes2Impl.java
deleted file mode 100644
index 485a5d6ac44..00000000000
--- a/libjava/external/sax/org/xml/sax/ext/Attributes2Impl.java
+++ /dev/null
@@ -1,301 +0,0 @@
-// Attributes2Impl.java - extended AttributesImpl
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: Attributes2Impl.java,v 1.1 2004/12/23 22:38:42 mark Exp $
-
-package org.xml.sax.ext;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.AttributesImpl;
-
-
-/**
- * SAX2 extension helper for additional Attributes information,
- * implementing the {@link Attributes2} interface.
- *
- * This is not part of core-only SAX2 distributions. The specified flag for each attribute will always
- * be true, unless it has been set to false in the copy constructor
- * or using {@link #setSpecified}.
- * Similarly, the declared flag for each attribute will
- * always be false, except for defaulted attributes (specified
- * is false), non-CDATA attributes, or when it is set to true using
- * {@link #setDeclared}.
- * If you change an attribute's type by hand, you may need to modify
- * its declared flag to match.
- * This constructor is especially useful inside a
- * {@link org.xml.sax.ContentHandler#startElement startElement} event. Unless the attribute type is CDATA, this attribute
- * is marked as being declared in the DTD. To set that flag's value
- * to true for CDATA attributes, use {@link #setDeclared}.
- *
- * @see AttributesImpl#addAttribute
- */
- public void addAttribute (String uri, String localName, String qName,
- String type, String value)
- {
- super.addAttribute (uri, localName, qName, type, value);
-
- int length = getLength ();
-
- if (length < specified.length) {
- boolean newFlags [];
-
- newFlags = new boolean [length];
- System.arraycopy (declared, 0, newFlags, 0, declared.length);
- declared = newFlags;
-
- newFlags = new boolean [length];
- System.arraycopy (specified, 0, newFlags, 0, specified.length);
- specified = newFlags;
- }
-
- specified [length - 1] = true;
- declared [length - 1] = !"CDATA".equals (type);
- }
-
-
- // javadoc entirely from superclass
- public void removeAttribute (int index)
- {
- int origMax = getLength () - 1;
-
- super.removeAttribute (index);
- if (index != origMax) {
- System.arraycopy (declared, index + 1, declared, index,
- origMax - index);
- System.arraycopy (specified, index + 1, specified, index,
- origMax - index);
- }
- }
-
-
- /**
- * Assign a value to the "declared" flag of a specific attribute.
- * This is normally needed only for attributes of type CDATA,
- * including attributes whose type is changed to or from CDATA.
- *
- * @param index The index of the attribute (zero-based).
- * @param value The desired flag value.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not identify an attribute.
- * @see #setType
- */
- public void setDeclared (int index, boolean value)
- {
- if (index < 0 || index >= getLength ())
- throw new ArrayIndexOutOfBoundsException (
- "No attribute at index: " + index);
- declared [index] = value;
- }
-
-
- /**
- * Assign a value to the "specified" flag of a specific attribute.
- * This is the only way this flag can be cleared, except clearing
- * by initialization with the copy constructor.
- *
- * @param index The index of the attribute (zero-based).
- * @param value The desired flag value.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not identify an attribute.
- */
- public void setSpecified (int index, boolean value)
- {
- if (index < 0 || index >= getLength ())
- throw new ArrayIndexOutOfBoundsException (
- "No attribute at index: " + index);
- specified [index] = value;
- }
-}
diff --git a/libjava/external/sax/org/xml/sax/ext/DeclHandler.java b/libjava/external/sax/org/xml/sax/ext/DeclHandler.java
deleted file mode 100644
index 1bb4dea4a41..00000000000
--- a/libjava/external/sax/org/xml/sax/ext/DeclHandler.java
+++ /dev/null
@@ -1,146 +0,0 @@
-// DeclHandler.java - Optional handler for DTD declaration events.
-// http://www.saxproject.org
-// Public Domain: no warranty.
-// $Id: DeclHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
-
-package org.xml.sax.ext;
-
-import org.xml.sax.SAXException;
-
-
-/**
- * SAX2 extension handler for DTD declaration events.
- *
- * This is an optional extension handler for SAX2 to provide more
- * complete information about DTD declarations in an XML document.
- * XML readers are not required to recognize this handler, and it
- * is not part of core-only SAX2 distributions. Note that data-related DTD declarations (unparsed entities and
- * notations) are already reported through the {@link
- * org.xml.sax.DTDHandler DTDHandler} interface. If you are using the declaration handler together with a lexical
- * handler, all of the events will occur between the
- * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the
- * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events. To set the DeclHandler for an XML reader, use the
- * {@link org.xml.sax.XMLReader#setProperty setProperty} method
- * with the property name
- * The content model will consist of the string "EMPTY", the
- * string "ANY", or a parenthesised group, optionally followed
- * by an occurrence indicator. The model will be normalized so
- * that all parameter entities are fully resolved and all whitespace
- * is removed,and will include the enclosing parentheses. Other
- * normalization (such as removing redundant parentheses or
- * simplifying occurrence indicators) is at the discretion of the
- * parser. Only the effective (first) declaration for an attribute will
- * be reported. The type will be one of the strings "CDATA",
- * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
- * "ENTITIES", a parenthesized token group with
- * the separator "|" and all whitespace removed, or the word
- * "NOTATION" followed by a space followed by a parenthesized
- * token group with all whitespace removed. The value will be the value as reported to applications,
- * appropriately normalized and with entity and character
- * references expanded. Only the effective (first) declaration for each entity
- * will be reported. All parameter entities in the value
- * will be expanded, but general entities will not. Only the effective (first) declaration for each entity
- * will be reported. If the system identifier is a URL, the parser must resolve it
- * fully before passing it to the application. Note: this class might yet learn that the
- * ContentHandler.setDocumentLocator() call might be passed a
- * {@link Locator2} object, and that the
- * ContentHandler.startElement() call might be passed a
- * {@link Attributes2} object.
- *
- * @since SAX 2.0 (extensions 1.1 alpha)
- * @author David Brownell
- * @version TBS
- */
-public class DefaultHandler2 extends DefaultHandler
- implements LexicalHandler, DeclHandler, EntityResolver2
-{
- /** Constructs a handler which ignores all parsing events. */
- public DefaultHandler2 () { }
-
-
- // SAX2 ext-1.0 LexicalHandler
-
- public void startCDATA ()
- throws SAXException
- {}
-
- public void endCDATA ()
- throws SAXException
- {}
-
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {}
-
- public void endDTD ()
- throws SAXException
- {}
-
- public void startEntity (String name)
- throws SAXException
- {}
-
- public void endEntity (String name)
- throws SAXException
- {}
-
- public void comment (char ch [], int start, int length)
- throws SAXException
- { }
-
-
- // SAX2 ext-1.0 DeclHandler
-
- public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
- throws SAXException
- {}
-
- public void elementDecl (String name, String model)
- throws SAXException
- {}
-
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {}
-
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {}
-
- // SAX2 ext-1.1 EntityResolver2
-
- /**
- * Tells the parser that if no external subset has been declared
- * in the document text, none should be used.
- */
- public InputSource getExternalSubset (String name, String baseURI)
- throws SAXException, IOException
- { return null; }
-
- /**
- * Tells the parser to resolve the systemId against the baseURI
- * and read the entity text from that resulting absolute URI.
- * Note that because the older
- * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()},
- * method is overridden to call this one, this method may sometimes
- * be invoked with null name and baseURI, and
- * with the systemId already absolutized.
- */
- public InputSource resolveEntity (String name, String publicId,
- String baseURI, String systemId)
- throws SAXException, IOException
- { return null; }
-
- // SAX1 EntityResolver
-
- /**
- * Invokes
- * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
- * with null entity name and base URI.
- * You only need to override that method to use this class.
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException, IOException
- { return resolveEntity (null, publicId, null, systemId); }
-}
diff --git a/libjava/external/sax/org/xml/sax/ext/EntityResolver2.java b/libjava/external/sax/org/xml/sax/ext/EntityResolver2.java
deleted file mode 100644
index 57b0d83e852..00000000000
--- a/libjava/external/sax/org/xml/sax/ext/EntityResolver2.java
+++ /dev/null
@@ -1,197 +0,0 @@
-// EntityResolver2.java - Extended SAX entity resolver.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-// $Id: EntityResolver2.java,v 1.1 2004/12/23 22:38:42 mark Exp $
-
-package org.xml.sax.ext;
-
-import java.io.IOException;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-
-
-/**
- * Extended interface for mapping external entity references to input
- * sources, or providing a missing external subset. The
- * {@link XMLReader#setEntityResolver XMLReader.setEntityResolver()} method
- * is used to provide implementations of this interface to parsers.
- * When a parser uses the methods in this interface, the
- * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
- * method (in this interface) is used instead of the older (SAX 1.0)
- * {@link EntityResolver#resolveEntity EntityResolver.resolveEntity()} method.
- *
- * If a SAX application requires the customized handling which this
- * interface defines for external entities, it must ensure that it uses
- * an XMLReader with the
- * http://xml.org/sax/features/use-entity-resolver2 feature flag
- * set to true (which is its default value when the feature is
- * recognized). If that flag is unrecognized, or its value is false,
- * or the resolver does not implement this interface, then only the
- * {@link EntityResolver} method will be used.
- * That supports three categories of application that modify entity
- * resolution. Old Style applications won't know about this interface;
- * they will provide an EntityResolver.
- * Transitional Mode provide an EntityResolver2 and automatically
- * get the benefit of its methods in any systems (parsers or other tools)
- * supporting it, due to polymorphism.
- * Both Old Style and Transitional Mode applications will
- * work with any SAX2 parser.
- * New style applications will fail to run except on SAX2 parsers
- * that support this particular feature.
- * They will insist that feature flag have a value of "true", and the
- * EntityResolver2 implementation they provide might throw an exception
- * if the original SAX 1.0 style entity resolution method is invoked.
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * public void startElement (String name, AttributeList atts) {
- * for (int i = 0; i < atts.getLength(); i++) {
- * String name = atts.getName(i);
- * String type = atts.getType(i);
- * String value = atts.getValue(i);
- * [...]
- * }
- * }
- *
- *
- *
- * public void startElement (String name, AttributeList atts) {
- * String identifier = atts.getValue("id");
- * String label = atts.getValue("label");
- * [...]
- * }
- *
- *
- * @deprecated This interface has been replaced by the SAX2
- * {@link org.xml.sax.Attributes Attributes}
- * interface, which includes Namespace support.
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.DocumentHandler#startElement startElement
- * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
- */
-public interface AttributeList {
-
-
- ////////////////////////////////////////////////////////////////////
- // Iteration methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in this list.
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- *
- *
- * http://xml.org/sax/features/namespace-prefixes
- * feature is set to true (it is false by
- * default).
- * Because SAX2 conforms to the original "Namespaces in XML"
- * recommendation, it normally does not
- * give namespace declaration attributes a namespace URI.
- * http://xml.org/sax/features/xmlns-uris
) to request
- * that those attributes be given URIs, conforming to a later
- * backwards-incompatible revision of that recommendation. (The
- * attribute's "local name" will be the prefix, or "xmlns" when
- * defining a default element namespace.) For portability, handler
- * code should always resolve that conflict, rather than requiring
- * parsers that can change the setting of that feature flag. http://xml.org/sax/features/namespaces
feature is
- * false, access by Namespace-qualified names may not be
- * available.
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- * ContentHandler
class in the java.net
- * package; that means that it's probably a bad idea to doimport java.net.*;
- * import org.xml.sax.*;
- *
- *
- * http://xml.org/sax/features/namespaces
- * feature is true (the default).
- *
- *
- *
- *
- *
- * http://xml.org/sax/features/namespace-prefixes
- * property is true (it is false by default, and support for a
- * true value is optional).char
value. char
value. There are two important cases where this
- * happens, because characters can't be represented in just sixteen bits.
- * In one case, characters are represented in a Surrogate Pair,
- * using two special Unicode values. Such characters are in the so-called
- * "Astral Planes", with a code point above U+FFFF. A second case involves
- * composite characters, such as a base character combining with one or
- * more accent characters. char
-at-a-time idioms will be working in character
- * units; in some cases they will split characters. This is relevant
- * wherever XML permits arbitrary characters, such as attribute values,
- * processing instruction data, and comments as well as in data reported
- * from this method. It's also generally relevant whenever Java code
- * manipulates internationalized text; the issue isn't unique to XML.char
- * value. http://xml.org/sax/features/external-general-entities
- * and the
- * http://xml.org/sax/features/external-parameter-entities
- * properties.
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * import org.xml.sax.EntityResolver;
- * import org.xml.sax.InputSource;
- *
- * public class MyResolver implements EntityResolver {
- * public InputSource resolveEntity (String publicId, String systemId)
- * {
- * if (systemId.equals("http://www.myhost.com/today")) {
- * // return a special input source
- * MyReader reader = new MyReader();
- * return new InputSource(reader);
- * } else {
- * // use the default behaviour
- * return null;
- * }
- * }
- * }
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- * char
values since
- * the last line end.
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * parse(new InputSource(systemId));
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- *
- *
- *
- *
- * XMLReader r = new MySAXDriver();
- *
- * // try to activate validation
- * try {
- * r.setFeature("http://xml.org/sax/features/validation", true);
- * } catch (SAXException e) {
- * System.err.println("Cannot activate validation.");
- * }
- *
- * // register event handlers
- * r.setContentHandler(new MyContentHandler());
- * r.setErrorHandler(new MyErrorHandler());
- *
- * // parse the first document
- * try {
- * r.parse("http://www.foo.com/mydoc.xml");
- * } catch (IOException e) {
- * System.err.println("I/O exception reading XML document");
- * } catch (SAXException e) {
- * System.err.println("XML exception reading document.");
- * }
- *
- *
- *
- * parse(new InputSource(systemId));
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- * See http://www.saxproject.org
- * for further information.
- *
- *
- * http://xml.org/sax/properties/declaration-handler
- * and an object implementing this interface (or null) as the value.
- * If the reader does not report declaration events, it will throw a
- * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
- * when you attempt to register the handler.
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- *
- *
- *
- * This module, both source code and documentation, is in the
- * Public Domain, and comes with NO WARRANTY.
- *
- *
- *
This method can also be used with documents that have no DOCTYPE - * declaration. When the root element is encountered, - * but no DOCTYPE declaration has been seen, this method is - * invoked. If it returns a value for the external subset, that root - * element is declared to be the root element, giving the effect of - * splicing a DOCTYPE declaration at the end the prolog of a document - * that could not otherwise be valid. The sequence of parser callbacks - * in that case logically resembles this:
- * - *- * ... comments and PIs from the prolog (as usual) - * startDTD ("rootName", source.getPublicId (), source.getSystemId ()); - * startEntity ("[dtd]"); - * ... declarations, comments, and PIs from the external subset - * endEntity ("[dtd]"); - * endDTD (); - * ... then the rest of the document (as usual) - * startElement (..., "rootName", ...); - *- * - *
Note that the InputSource gets no further resolution. - * Implementations of this method may wish to invoke - * {@link #resolveEntity resolveEntity()} to gain benefits such as use - * of local caches of DTD entities. Also, this method will never be - * used by a (non-validating) processor that is not including external - * parameter entities.
- * - *Uses for this method include facilitating data validation when - * interoperating with XML processors that would always require - * undesirable network accesses for external entities, or which for - * other reasons adopt a "no DTDs" policy. - * Non-validation motives include forcing documents to include DTDs so - * that attributes are handled consistently. - * For example, an XPath processor needs to know which attibutes have - * type "ID" before it can process a widely used type of reference.
- * - *Warning: Returning an external subset modifies - * the input document. By providing definitions for general entities, - * it can make a malformed document appear to be well formed. - *
- * - * @param name Identifies the document root element. This name comes - * from a DOCTYPE declaration (where available) or from the actual - * root element. - * @param baseURI The document's base URI, serving as an additional - * hint for selecting the external subset. This is always an absolute - * URI, unless it is null because the XMLReader was given an InputSource - * without one. - * - * @return An InputSource object describing the new external subset - * to be used by the parser, or null to indicate that no external - * subset is provided. - * - * @exception SAXException Any SAX exception, possibly wrapping - * another exception. - * @exception IOException Probably indicating a failure to create - * a new InputStream or Reader, or an illegal URL. - */ - public InputSource getExternalSubset (String name, String baseURI) - throws SAXException, IOException; - - /** - * Allows applications to map references to external entities into input - * sources, or tell the parser it should use conventional URI resolution. - * This method is only called for external entities which have been - * properly declared. - * This method provides more flexibility than the {@link EntityResolver} - * interface, supporting implementations of more complex catalogue - * schemes such as the one defined by the OASIS XML Catalogs specification. - * - *Parsers configured to use this resolver method will call it - * to determine the input source to use for any external entity - * being included because of a reference in the XML text. - * That excludes the document entity, and any external entity returned - * by {@link #getExternalSubset getExternalSubset()}. - * When a (non-validating) processor is configured not to include - * a class of entities (parameter or general) through use of feature - * flags, this method is not invoked for such entities.
- * - *Note that the entity naming scheme used here is the same one - * used in the {@link LexicalHandler}, or in the {@link - org.xml.sax.ContentHandler#skippedEntity - ContentHandler.skippedEntity()} - * method.
- * - * @param name Identifies the external entity being resolved. - * Either "[dtd]" for the external subset, or a name starting - * with "%" to indicate a parameter entity, or else the name of - * a general entity. This is never null when invoked by a SAX2 - * parser. - * @param publicId The public identifier of the external entity being - * referenced (normalized as required by the XML specification), or - * null if none was supplied. - * @param baseURI The URI with respect to which relative systemIDs - * are interpreted. This is always an absolute URI, unless it is - * null (likely because the XMLReader was given an InputSource without - * one). This URI is defined by the XML specification to be the one - * associated with the "<" starting the relevant declaration. - * @param systemId The system identifier of the external entity - * being referenced; either a relative or absolute URI. - * This is never null when invoked by a SAX2 parser; only declared - * entities, and any external subset, are resolved by such parsers. - * - * @return An InputSource object describing the new input source to - * be used by the parser. Returning null directs the parser to - * resolve the system ID against the base URI and open a connection - * to resulting URI. - * - * @exception SAXException Any SAX exception, possibly wrapping - * another exception. - * @exception IOException Probably indicating a failure to create - * a new InputStream or Reader, or an illegal URL. - */ - public InputSource resolveEntity ( - String name, - String publicId, - String baseURI, - String systemId - ) throws SAXException, IOException; -} diff --git a/libjava/external/sax/org/xml/sax/ext/LexicalHandler.java b/libjava/external/sax/org/xml/sax/ext/LexicalHandler.java deleted file mode 100644 index 076bdf857c2..00000000000 --- a/libjava/external/sax/org/xml/sax/ext/LexicalHandler.java +++ /dev/null @@ -1,212 +0,0 @@ -// LexicalHandler.java - optional handler for lexical parse events. -// http://www.saxproject.org -// Public Domain: no warranty. -// $Id: LexicalHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.ext; - -import org.xml.sax.SAXException; - -/** - * SAX2 extension handler for lexical events. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This is an optional extension handler for SAX2 to provide - * lexical information about an XML document, such as comments - * and CDATA section boundaries. - * XML readers are not required to recognize this handler, and it - * is not part of core-only SAX2 distributions.
- * - *The events in the lexical handler apply to the entire document, - * not just to the document element, and all lexical handler events - * must appear between the content handler's startDocument and - * endDocument events.
- * - *To set the LexicalHandler for an XML reader, use the
- * {@link org.xml.sax.XMLReader#setProperty setProperty} method
- * with the property name
- * http://xml.org/sax/properties/lexical-handler
- * and an object implementing this interface (or null) as the value.
- * If the reader does not report lexical events, it will throw a
- * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
- * when you attempt to register the handler.
This method is intended to report the beginning of the - * DOCTYPE declaration; if the document has no DOCTYPE declaration, - * this method will not be invoked.
- * - *All declarations reported through - * {@link org.xml.sax.DTDHandler DTDHandler} or - * {@link org.xml.sax.ext.DeclHandler DeclHandler} events must appear - * between the startDTD and {@link #endDTD endDTD} events. - * Declarations are assumed to belong to the internal DTD subset - * unless they appear between {@link #startEntity startEntity} - * and {@link #endEntity endEntity} events. Comments and - * processing instructions from the DTD should also be reported - * between the startDTD and endDTD events, in their original - * order of (logical) occurrence; they are not required to - * appear in their correct locations relative to DTDHandler - * or DeclHandler events, however.
- * - *Note that the start/endDTD events will appear within - * the start/endDocument events from ContentHandler and - * before the first - * {@link org.xml.sax.ContentHandler#startElement startElement} - * event.
- * - * @param name The document type name. - * @param publicId The declared public identifier for the - * external DTD subset, or null if none was declared. - * @param systemId The declared system identifier for the - * external DTD subset, or null if none was declared. - * (Note that this is not resolved against the document - * base URI.) - * @exception SAXException The application may raise an - * exception. - * @see #endDTD - * @see #startEntity - */ - public abstract void startDTD (String name, String publicId, - String systemId) - throws SAXException; - - - /** - * Report the end of DTD declarations. - * - *This method is intended to report the end of the - * DOCTYPE declaration; if the document has no DOCTYPE declaration, - * this method will not be invoked.
- * - * @exception SAXException The application may raise an exception. - * @see #startDTD - */ - public abstract void endDTD () - throws SAXException; - - - /** - * Report the beginning of some internal and external XML entities. - * - *The reporting of parameter entities (including
- * the external DTD subset) is optional, and SAX2 drivers that
- * report LexicalHandler events may not implement it; you can use the
- * http://xml.org/sax/features/lexical-handler/parameter-entities
- * feature to query or control the reporting of parameter entities.
General entities are reported with their regular names, - * parameter entities have '%' prepended to their names, and - * the external DTD subset has the pseudo-entity name "[dtd]".
- * - *When a SAX2 driver is providing these events, all other - * events must be properly nested within start/end entity - * events. There is no additional requirement that events from - * {@link org.xml.sax.ext.DeclHandler DeclHandler} or - * {@link org.xml.sax.DTDHandler DTDHandler} be properly ordered.
- * - *Note that skipped entities will be reported through the - * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity} - * event, which is part of the ContentHandler interface.
- * - *Because of the streaming event model that SAX uses, some - * entity boundaries cannot be reported under any - * circumstances:
- * - *These will be silently expanded, with no indication of where - * the original entity boundaries were.
- * - *Note also that the boundaries of character references (which - * are not really entities anyway) are not reported.
- * - *All start/endEntity events must be properly nested. - * - * @param name The name of the entity. If it is a parameter - * entity, the name will begin with '%', and if it is the - * external DTD subset, it will be "[dtd]". - * @exception SAXException The application may raise an exception. - * @see #endEntity - * @see org.xml.sax.ext.DeclHandler#internalEntityDecl - * @see org.xml.sax.ext.DeclHandler#externalEntityDecl - */ - public abstract void startEntity (String name) - throws SAXException; - - - /** - * Report the end of an entity. - * - * @param name The name of the entity that is ending. - * @exception SAXException The application may raise an exception. - * @see #startEntity - */ - public abstract void endEntity (String name) - throws SAXException; - - - /** - * Report the start of a CDATA section. - * - *
The contents of the CDATA section will be reported through - * the regular {@link org.xml.sax.ContentHandler#characters - * characters} event; this event is intended only to report - * the boundary.
- * - * @exception SAXException The application may raise an exception. - * @see #endCDATA - */ - public abstract void startCDATA () - throws SAXException; - - - /** - * Report the end of a CDATA section. - * - * @exception SAXException The application may raise an exception. - * @see #startCDATA - */ - public abstract void endCDATA () - throws SAXException; - - - /** - * Report an XML comment anywhere in the document. - * - *This callback will be used for comments inside or outside the - * document element, including comments in the external DTD - * subset (if read). Comments in the DTD must be properly - * nested inside start/endDTD and start/endEntity events (if - * used).
- * - * @param ch An array holding the characters in the comment. - * @param start The starting position in the array. - * @param length The number of characters to use from the array. - * @exception SAXException The application may raise an exception. - */ - public abstract void comment (char ch[], int start, int length) - throws SAXException; - -} - -// end of LexicalHandler.java diff --git a/libjava/external/sax/org/xml/sax/ext/Locator2.java b/libjava/external/sax/org/xml/sax/ext/Locator2.java deleted file mode 100644 index 5fe3ba7706a..00000000000 --- a/libjava/external/sax/org/xml/sax/ext/Locator2.java +++ /dev/null @@ -1,75 +0,0 @@ -// Locator2.java - extended Locator -// http://www.saxproject.org -// Public Domain: no warranty. -// $Id: Locator2.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.ext; - -import org.xml.sax.Locator; - - -/** - * SAX2 extension to augment the entity information provided - * though a {@link Locator}. - * If an implementation supports this extension, the Locator - * provided in {@link org.xml.sax.ContentHandler#setDocumentLocator - * ContentHandler.setDocumentLocator() } will implement this - * interface, and the - * http://xml.org/sax/features/use-locator2 feature - * flag will have the value true. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - *- * - *
XMLReader implementations are not required to support this - * information, and it is not part of core-only SAX2 distributions.
- * - * @since SAX 2.0 (extensions 1.1 alpha) - * @author David Brownell - * @version TBS - */ -public interface Locator2 extends Locator -{ - /** - * Returns the version of XML used for the entity. This will - * normally be the identifier from the current entity's - * <?xml version='...' ...?> declaration, - * or be defaulted by the parser. - * - * @return Identifier for the XML version being used to interpret - * the entity's text, or null if that information is not yet - * available in the current parsing state. - */ - public String getXMLVersion (); - - /** - * Returns the name of the character encoding for the entity. - * If the encoding was declared externally (for example, in a MIME - * Content-Type header), that will be the name returned. Else if there - * was an <?xml ...encoding='...'?> declaration at - * the start of the document, that encoding name will be returned. - * Otherwise the encoding will been inferred (normally to be UTF-8, or - * some UTF-16 variant), and that inferred name will be returned. - * - *When an {@link org.xml.sax.InputSource InputSource} is used - * to provide an entity's character stream, this method returns the - * encoding provided in that input stream. - * - *
Note that some recent W3C specifications require that text - * in some encodings be normalized, using Unicode Normalization - * Form C, before processing. Such normalization must be performed - * by applications, and would normally be triggered based on the - * value returned by this method. - * - *
Encoding names may be those used by the underlying JVM, - * and comparisons should be case-insensitive. - * - * @return Name of the character encoding being used to interpret - * * the entity's text, or null if this was not provided for a * - * character stream passed through an InputSource or is otherwise - * not yet available in the current parsing state. - */ - public String getEncoding (); -} diff --git a/libjava/external/sax/org/xml/sax/ext/Locator2Impl.java b/libjava/external/sax/org/xml/sax/ext/Locator2Impl.java deleted file mode 100644 index 52f6331b5ab..00000000000 --- a/libjava/external/sax/org/xml/sax/ext/Locator2Impl.java +++ /dev/null @@ -1,101 +0,0 @@ -// Locator2Impl.java - extended LocatorImpl -// http://www.saxproject.org -// Public Domain: no warranty. -// $Id: Locator2Impl.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.ext; - -import org.xml.sax.Locator; -import org.xml.sax.helpers.LocatorImpl; - - -/** - * SAX2 extension helper for holding additional Entity information, - * implementing the {@link Locator2} interface. - * - *
- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - *- * - *
This is not part of core-only SAX2 distributions.
- * - * @since SAX 2.0.2 - * @author David Brownell - * @version TBS - */ -public class Locator2Impl extends LocatorImpl implements Locator2 -{ - private String encoding; - private String version; - - - /** - * Construct a new, empty Locator2Impl object. - * This will not normally be useful, since the main purpose - * of this class is to make a snapshot of an existing Locator. - */ - public Locator2Impl () { } - - /** - * Copy an existing Locator or Locator2 object. - * If the object implements Locator2, values of the - * encoding and versionstrings are copied, - * otherwise they set to null. - * - * @param locator The existing Locator object. - */ - public Locator2Impl (Locator locator) - { - super (locator); - if (locator instanceof Locator2) { - Locator2 l2 = (Locator2) locator; - - version = l2.getXMLVersion (); - encoding = l2.getEncoding (); - } - } - - //////////////////////////////////////////////////////////////////// - // Locator2 method implementations - //////////////////////////////////////////////////////////////////// - - /** - * Returns the current value of the version property. - * - * @see #setXMLVersion - */ - public String getXMLVersion () - { return version; } - - /** - * Returns the current value of the encoding property. - * - * @see #setEncoding - */ - public String getEncoding () - { return encoding; } - - - //////////////////////////////////////////////////////////////////// - // Setters - //////////////////////////////////////////////////////////////////// - - /** - * Assigns the current value of the version property. - * - * @param version the new "version" value - * @see #getXMLVersion - */ - public void setXMLVersion (String version) - { this.version = version; } - - /** - * Assigns the current value of the encoding property. - * - * @param encoding the new "encoding" value - * @see #getEncoding - */ - public void setEncoding (String encoding) - { this.encoding = encoding; } -} diff --git a/libjava/external/sax/org/xml/sax/ext/package.html b/libjava/external/sax/org/xml/sax/ext/package.html deleted file mode 100644 index 0b744800108..00000000000 --- a/libjava/external/sax/org/xml/sax/ext/package.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - --This package contains interfaces to SAX2 facilities that -conformant SAX drivers won't necessarily support. - -
See http://www.saxproject.org -for more information about SAX.
- -This package is independent of the SAX2 core, though the functionality -exposed generally needs to be implemented within a parser core. -That independence has several consequences:
- -org.xml.sax.helpers.DefaultHandler
or
-org.xml.sax.helpers.XMLFilterImpl
classes.
-You can subclass these if you need such behavior, or
-use the helper classes found here.This package, SAX2-ext, is a standardized extension to SAX2. It is -designed both to allow SAX parsers to pass certain types of information -to applications, and to serve as a simple model for other SAX2 parser -extension packages. Not all such extension packages should need to -be recognized directly by parsers, however. -As an example, most validation systems can be cleanly layered on top -of parsers supporting the standardized SAX2 interfaces.
- - diff --git a/libjava/external/sax/org/xml/sax/helpers/AttributeListImpl.java b/libjava/external/sax/org/xml/sax/helpers/AttributeListImpl.java deleted file mode 100644 index ca859fb1450..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/AttributeListImpl.java +++ /dev/null @@ -1,312 +0,0 @@ -// SAX default implementation for AttributeList. -// http://www.saxproject.org -// No warranty; no copyright -- use this as you will. -// $Id: AttributeListImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import org.xml.sax.AttributeList; - -import java.util.Vector; - - -/** - * Default implementation for AttributeList. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
AttributeList implements the deprecated SAX1 {@link - * org.xml.sax.AttributeList AttributeList} interface, and has been - * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl - * AttributesImpl} interface.
- * - *This class provides a convenience implementation of the SAX - * {@link org.xml.sax.AttributeList AttributeList} interface. This - * implementation is useful both for SAX parser writers, who can use - * it to provide attributes to the application, and for SAX application - * writers, who can use it to create a persistent copy of an element's - * attribute specifications:
- * - *- * private AttributeList myatts; - * - * public void startElement (String name, AttributeList atts) - * { - * // create a persistent copy of the attribute list - * // for use outside this method - * myatts = new AttributeListImpl(atts); - * [...] - * } - *- * - *
Please note that SAX parsers are not required to use this - * class to provide an implementation of AttributeList; it is - * supplied only as an optional convenience. In particular, - * parser writers are encouraged to invent more efficient - * implementations.
- * - * @deprecated This class implements a deprecated interface, - * {@link org.xml.sax.AttributeList AttributeList}; - * that interface has been replaced by - * {@link org.xml.sax.Attributes Attributes}, - * which is implemented in the - * {@link org.xml.sax.helpers.AttributesImpl - * AttributesImpl} helper class. - * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.AttributeList - * @see org.xml.sax.DocumentHandler#startElement - */ -public class AttributeListImpl implements AttributeList -{ - - /** - * Create an empty attribute list. - * - *This constructor is most useful for parser writers, who - * will use it to create a single, reusable attribute list that - * can be reset with the clear method between elements.
- * - * @see #addAttribute - * @see #clear - */ - public AttributeListImpl () - { - } - - - /** - * Construct a persistent copy of an existing attribute list. - * - *This constructor is most useful for application writers, - * who will use it to create a persistent copy of an existing - * attribute list.
- * - * @param atts The attribute list to copy - * @see org.xml.sax.DocumentHandler#startElement - */ - public AttributeListImpl (AttributeList atts) - { - setAttributeList(atts); - } - - - - //////////////////////////////////////////////////////////////////// - // Methods specific to this class. - //////////////////////////////////////////////////////////////////// - - - /** - * Set the attribute list, discarding previous contents. - * - *This method allows an application writer to reuse an - * attribute list easily.
- * - * @param atts The attribute list to copy. - */ - public void setAttributeList (AttributeList atts) - { - int count = atts.getLength(); - - clear(); - - for (int i = 0; i < count; i++) { - addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i)); - } - } - - - /** - * Add an attribute to an attribute list. - * - *This method is provided for SAX parser writers, to allow them - * to build up an attribute list incrementally before delivering - * it to the application.
- * - * @param name The attribute name. - * @param type The attribute type ("NMTOKEN" for an enumeration). - * @param value The attribute value (must not be null). - * @see #removeAttribute - * @see org.xml.sax.DocumentHandler#startElement - */ - public void addAttribute (String name, String type, String value) - { - names.addElement(name); - types.addElement(type); - values.addElement(value); - } - - - /** - * Remove an attribute from the list. - * - *SAX application writers can use this method to filter an - * attribute out of an AttributeList. Note that invoking this - * method will change the length of the attribute list and - * some of the attribute's indices.
- * - *If the requested attribute is not in the list, this is - * a no-op.
- * - * @param name The attribute name. - * @see #addAttribute - */ - public void removeAttribute (String name) - { - int i = names.indexOf(name); - - if (i >= 0) { - names.removeElementAt(i); - types.removeElementAt(i); - values.removeElementAt(i); - } - } - - - /** - * Clear the attribute list. - * - *SAX parser writers can use this method to reset the attribute - * list between DocumentHandler.startElement events. Normally, - * it will make sense to reuse the same AttributeListImpl object - * rather than allocating a new one each time.
- * - * @see org.xml.sax.DocumentHandler#startElement - */ - public void clear () - { - names.removeAllElements(); - types.removeAllElements(); - values.removeAllElements(); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.AttributeList - //////////////////////////////////////////////////////////////////// - - - /** - * Return the number of attributes in the list. - * - * @return The number of attributes in the list. - * @see org.xml.sax.AttributeList#getLength - */ - public int getLength () - { - return names.size(); - } - - - /** - * Get the name of an attribute (by position). - * - * @param i The position of the attribute in the list. - * @return The attribute name as a string, or null if there - * is no attribute at that position. - * @see org.xml.sax.AttributeList#getName(int) - */ - public String getName (int i) - { - if (i < 0) { - return null; - } - try { - return (String)names.elementAt(i); - } catch (ArrayIndexOutOfBoundsException e) { - return null; - } - } - - - /** - * Get the type of an attribute (by position). - * - * @param i The position of the attribute in the list. - * @return The attribute type as a string ("NMTOKEN" for an - * enumeration, and "CDATA" if no declaration was - * read), or null if there is no attribute at - * that position. - * @see org.xml.sax.AttributeList#getType(int) - */ - public String getType (int i) - { - if (i < 0) { - return null; - } - try { - return (String)types.elementAt(i); - } catch (ArrayIndexOutOfBoundsException e) { - return null; - } - } - - - /** - * Get the value of an attribute (by position). - * - * @param i The position of the attribute in the list. - * @return The attribute value as a string, or null if - * there is no attribute at that position. - * @see org.xml.sax.AttributeList#getValue(int) - */ - public String getValue (int i) - { - if (i < 0) { - return null; - } - try { - return (String)values.elementAt(i); - } catch (ArrayIndexOutOfBoundsException e) { - return null; - } - } - - - /** - * Get the type of an attribute (by name). - * - * @param name The attribute name. - * @return The attribute type as a string ("NMTOKEN" for an - * enumeration, and "CDATA" if no declaration was - * read). - * @see org.xml.sax.AttributeList#getType(java.lang.String) - */ - public String getType (String name) - { - return getType(names.indexOf(name)); - } - - - /** - * Get the value of an attribute (by name). - * - * @param name The attribute name. - * @see org.xml.sax.AttributeList#getValue(java.lang.String) - */ - public String getValue (String name) - { - return getValue(names.indexOf(name)); - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - Vector names = new Vector(); - Vector types = new Vector(); - Vector values = new Vector(); - -} - -// end of AttributeListImpl.java diff --git a/libjava/external/sax/org/xml/sax/helpers/AttributesImpl.java b/libjava/external/sax/org/xml/sax/helpers/AttributesImpl.java deleted file mode 100644 index 8753968ba0a..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/AttributesImpl.java +++ /dev/null @@ -1,618 +0,0 @@ -// AttributesImpl.java - default implementation of Attributes. -// http://www.saxproject.org -// Written by David Megginson -// NO WARRANTY! This class is in the public domain. -// $Id: AttributesImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import org.xml.sax.Attributes; - - -/** - * Default implementation of the Attributes interface. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class provides a default implementation of the SAX2 - * {@link org.xml.sax.Attributes Attributes} interface, with the - * addition of manipulators so that the list can be modified or - * reused.
- * - *There are two typical uses of this class:
- * - *This class replaces the now-deprecated SAX1 {@link - * org.xml.sax.helpers.AttributeListImpl AttributeListImpl} - * class; in addition to supporting the updated Attributes - * interface rather than the deprecated {@link org.xml.sax.AttributeList - * AttributeList} interface, it also includes a much more efficient - * implementation using a single array rather than a set of Vectors.
- * - * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - */ -public class AttributesImpl implements Attributes -{ - - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - /** - * Construct a new, empty AttributesImpl object. - */ - public AttributesImpl () - { - length = 0; - data = null; - } - - - /** - * Copy an existing Attributes object. - * - *This constructor is especially useful inside a - * {@link org.xml.sax.ContentHandler#startElement startElement} event.
- * - * @param atts The existing Attributes object. - */ - public AttributesImpl (Attributes atts) - { - setAttributes(atts); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.Attributes. - //////////////////////////////////////////////////////////////////// - - - /** - * Return the number of attributes in the list. - * - * @return The number of attributes in the list. - * @see org.xml.sax.Attributes#getLength - */ - public int getLength () - { - return length; - } - - - /** - * Return an attribute's Namespace URI. - * - * @param index The attribute's index (zero-based). - * @return The Namespace URI, the empty string if none is - * available, or null if the index is out of range. - * @see org.xml.sax.Attributes#getURI - */ - public String getURI (int index) - { - if (index >= 0 && index < length) { - return data[index*5]; - } else { - return null; - } - } - - - /** - * Return an attribute's local name. - * - * @param index The attribute's index (zero-based). - * @return The attribute's local name, the empty string if - * none is available, or null if the index if out of range. - * @see org.xml.sax.Attributes#getLocalName - */ - public String getLocalName (int index) - { - if (index >= 0 && index < length) { - return data[index*5+1]; - } else { - return null; - } - } - - - /** - * Return an attribute's qualified (prefixed) name. - * - * @param index The attribute's index (zero-based). - * @return The attribute's qualified name, the empty string if - * none is available, or null if the index is out of bounds. - * @see org.xml.sax.Attributes#getQName - */ - public String getQName (int index) - { - if (index >= 0 && index < length) { - return data[index*5+2]; - } else { - return null; - } - } - - - /** - * Return an attribute's type by index. - * - * @param index The attribute's index (zero-based). - * @return The attribute's type, "CDATA" if the type is unknown, or null - * if the index is out of bounds. - * @see org.xml.sax.Attributes#getType(int) - */ - public String getType (int index) - { - if (index >= 0 && index < length) { - return data[index*5+3]; - } else { - return null; - } - } - - - /** - * Return an attribute's value by index. - * - * @param index The attribute's index (zero-based). - * @return The attribute's value or null if the index is out of bounds. - * @see org.xml.sax.Attributes#getValue(int) - */ - public String getValue (int index) - { - if (index >= 0 && index < length) { - return data[index*5+4]; - } else { - return null; - } - } - - - /** - * Look up an attribute's index by Namespace name. - * - *In many cases, it will be more efficient to look up the name once and - * use the index query methods rather than using the name query methods - * repeatedly.
- * - * @param uri The attribute's Namespace URI, or the empty - * string if none is available. - * @param localName The attribute's local name. - * @return The attribute's index, or -1 if none matches. - * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) - */ - public int getIndex (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return i / 5; - } - } - return -1; - } - - - /** - * Look up an attribute's index by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's index, or -1 if none matches. - * @see org.xml.sax.Attributes#getIndex(java.lang.String) - */ - public int getIndex (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return i / 5; - } - } - return -1; - } - - - /** - * Look up an attribute's type by Namespace-qualified name. - * - * @param uri The Namespace URI, or the empty string for a name - * with no explicit Namespace URI. - * @param localName The local name. - * @return The attribute's type, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) - */ - public String getType (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return data[i+3]; - } - } - return null; - } - - - /** - * Look up an attribute's type by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's type, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getType(java.lang.String) - */ - public String getType (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return data[i+3]; - } - } - return null; - } - - - /** - * Look up an attribute's value by Namespace-qualified name. - * - * @param uri The Namespace URI, or the empty string for a name - * with no explicit Namespace URI. - * @param localName The local name. - * @return The attribute's value, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String) - */ - public String getValue (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return data[i+4]; - } - } - return null; - } - - - /** - * Look up an attribute's value by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's value, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getValue(java.lang.String) - */ - public String getValue (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return data[i+4]; - } - } - return null; - } - - - - //////////////////////////////////////////////////////////////////// - // Manipulators. - //////////////////////////////////////////////////////////////////// - - - /** - * Clear the attribute list for reuse. - * - *Note that little memory is freed by this call: - * the current array is kept so it can be - * reused.
- */ - public void clear () - { - if (data != null) { - for (int i = 0; i < (length * 5); i++) - data [i] = null; - } - length = 0; - } - - - /** - * Copy an entire Attributes object. - * - *It may be more efficient to reuse an existing object - * rather than constantly allocating new ones.
- * - * @param atts The attributes to copy. - */ - public void setAttributes (Attributes atts) - { - clear(); - length = atts.getLength(); - if (length > 0) { - data = new String[length*5]; - for (int i = 0; i < length; i++) { - data[i*5] = atts.getURI(i); - data[i*5+1] = atts.getLocalName(i); - data[i*5+2] = atts.getQName(i); - data[i*5+3] = atts.getType(i); - data[i*5+4] = atts.getValue(i); - } - } - } - - - /** - * Add an attribute to the end of the list. - * - *For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.
- * - * @param uri The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified (prefixed) name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - */ - public void addAttribute (String uri, String localName, String qName, - String type, String value) - { - ensureCapacity(length+1); - data[length*5] = uri; - data[length*5+1] = localName; - data[length*5+2] = qName; - data[length*5+3] = type; - data[length*5+4] = value; - length++; - } - - - /** - * Set an attribute in the list. - * - *For the sake of speed, this method does no checking - * for name conflicts or well-formedness: such checks are the - * responsibility of the application.
- * - * @param index The index of the attribute (zero-based). - * @param uri The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setAttribute (int index, String uri, String localName, - String qName, String type, String value) - { - if (index >= 0 && index < length) { - data[index*5] = uri; - data[index*5+1] = localName; - data[index*5+2] = qName; - data[index*5+3] = type; - data[index*5+4] = value; - } else { - badIndex(index); - } - } - - - /** - * Remove an attribute from the list. - * - * @param index The index of the attribute (zero-based). - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void removeAttribute (int index) - { - if (index >= 0 && index < length) { - if (index < length - 1) { - System.arraycopy(data, (index+1)*5, data, index*5, - (length-index-1)*5); - } - index = (length - 1) * 5; - data [index++] = null; - data [index++] = null; - data [index++] = null; - data [index++] = null; - data [index] = null; - length--; - } else { - badIndex(index); - } - } - - - /** - * Set the Namespace URI of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param uri The attribute's Namespace URI, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setURI (int index, String uri) - { - if (index >= 0 && index < length) { - data[index*5] = uri; - } else { - badIndex(index); - } - } - - - /** - * Set the local name of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param localName The attribute's local name, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setLocalName (int index, String localName) - { - if (index >= 0 && index < length) { - data[index*5+1] = localName; - } else { - badIndex(index); - } - } - - - /** - * Set the qualified name of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param qName The attribute's qualified name, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setQName (int index, String qName) - { - if (index >= 0 && index < length) { - data[index*5+2] = qName; - } else { - badIndex(index); - } - } - - - /** - * Set the type of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param type The attribute's type. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setType (int index, String type) - { - if (index >= 0 && index < length) { - data[index*5+3] = type; - } else { - badIndex(index); - } - } - - - /** - * Set the value of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param value The attribute's value. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setValue (int index, String value) - { - if (index >= 0 && index < length) { - data[index*5+4] = value; - } else { - badIndex(index); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Ensure the internal array's capacity. - * - * @param n The minimum number of attributes that the array must - * be able to hold. - */ - private void ensureCapacity (int n) { - if (n <= 0) { - return; - } - int max; - if (data == null || data.length == 0) { - max = 25; - } - else if (data.length >= n * 5) { - return; - } - else { - max = data.length; - } - while (max < n * 5) { - max *= 2; - } - - String newData[] = new String[max]; - if (length > 0) { - System.arraycopy(data, 0, newData, 0, length*5); - } - data = newData; - } - - - /** - * Report a bad array index in a manipulator. - * - * @param index The index to report. - * @exception java.lang.ArrayIndexOutOfBoundsException Always. - */ - private void badIndex (int index) - throws ArrayIndexOutOfBoundsException - { - String msg = - "Attempt to modify attribute at illegal index: " + index; - throw new ArrayIndexOutOfBoundsException(msg); - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - int length; - String data []; - -} - -// end of AttributesImpl.java - diff --git a/libjava/external/sax/org/xml/sax/helpers/DefaultHandler.java b/libjava/external/sax/org/xml/sax/helpers/DefaultHandler.java deleted file mode 100644 index e01c3be403d..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/DefaultHandler.java +++ /dev/null @@ -1,467 +0,0 @@ -// DefaultHandler.java - default implementation of the core handlers. -// http://www.saxproject.org -// Written by David Megginson -// NO WARRANTY! This class is in the public domain. -// $Id: DefaultHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import java.io.IOException; - -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.Attributes; -import org.xml.sax.EntityResolver; -import org.xml.sax.DTDHandler; -import org.xml.sax.ContentHandler; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - - -/** - * Default base class for SAX2 event handlers. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class is available as a convenience base class for SAX2 - * applications: it provides default implementations for all of the - * callbacks in the four core SAX2 handler classes:
- * - *Application writers can extend this class when they need to - * implement only part of an interface; parser writers can - * instantiate this class to provide default handlers when the - * application has not supplied its own.
- * - *This class replaces the deprecated SAX1 - * {@link org.xml.sax.HandlerBase HandlerBase} class.
- * - * @since SAX 2.0 - * @author David Megginson, - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.EntityResolver - * @see org.xml.sax.DTDHandler - * @see org.xml.sax.ContentHandler - * @see org.xml.sax.ErrorHandler - */ -public class DefaultHandler - implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler -{ - - - //////////////////////////////////////////////////////////////////// - // Default implementation of the EntityResolver interface. - //////////////////////////////////////////////////////////////////// - - /** - * Resolve an external entity. - * - *Always return null, so that the parser will use the system - * identifier provided in the XML document. This method implements - * the SAX default behaviour: application writers can override it - * in a subclass to do special translations such as catalog lookups - * or URI redirection.
- * - * @param publicId The public identifer, or null if none is - * available. - * @param systemId The system identifier provided in the XML - * document. - * @return The new input source, or null to require the - * default behaviour. - * @exception java.io.IOException If there is an error setting - * up the new input source. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.EntityResolver#resolveEntity - */ - public InputSource resolveEntity (String publicId, String systemId) - throws IOException, SAXException - { - return null; - } - - - - //////////////////////////////////////////////////////////////////// - // Default implementation of DTDHandler interface. - //////////////////////////////////////////////////////////////////// - - - /** - * Receive notification of a notation declaration. - * - *By default, do nothing. Application writers may override this - * method in a subclass if they wish to keep track of the notations - * declared in a document.
- * - * @param name The notation name. - * @param publicId The notation public identifier, or null if not - * available. - * @param systemId The notation system identifier. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.DTDHandler#notationDecl - */ - public void notationDecl (String name, String publicId, String systemId) - throws SAXException - { - // no op - } - - - /** - * Receive notification of an unparsed entity declaration. - * - *By default, do nothing. Application writers may override this - * method in a subclass to keep track of the unparsed entities - * declared in a document.
- * - * @param name The entity name. - * @param publicId The entity public identifier, or null if not - * available. - * @param systemId The entity system identifier. - * @param notationName The name of the associated notation. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.DTDHandler#unparsedEntityDecl - */ - public void unparsedEntityDecl (String name, String publicId, - String systemId, String notationName) - throws SAXException - { - // no op - } - - - - //////////////////////////////////////////////////////////////////// - // Default implementation of ContentHandler interface. - //////////////////////////////////////////////////////////////////// - - - /** - * Receive a Locator object for document events. - * - *By default, do nothing. Application writers may override this - * method in a subclass if they wish to store the locator for use - * with other document events.
- * - * @param locator A locator for all SAX document events. - * @see org.xml.sax.ContentHandler#setDocumentLocator - * @see org.xml.sax.Locator - */ - public void setDocumentLocator (Locator locator) - { - // no op - } - - - /** - * Receive notification of the beginning of the document. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions at the beginning - * of a document (such as allocating the root node of a tree or - * creating an output file).
- * - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#startDocument - */ - public void startDocument () - throws SAXException - { - // no op - } - - - /** - * Receive notification of the end of the document. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions at the end - * of a document (such as finalising a tree or closing an output - * file).
- * - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#endDocument - */ - public void endDocument () - throws SAXException - { - // no op - } - - - /** - * Receive notification of the start of a Namespace mapping. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions at the start of - * each Namespace prefix scope (such as storing the prefix mapping).
- * - * @param prefix The Namespace prefix being declared. - * @param uri The Namespace URI mapped to the prefix. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#startPrefixMapping - */ - public void startPrefixMapping (String prefix, String uri) - throws SAXException - { - // no op - } - - - /** - * Receive notification of the end of a Namespace mapping. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions at the end of - * each prefix mapping.
- * - * @param prefix The Namespace prefix being declared. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#endPrefixMapping - */ - public void endPrefixMapping (String prefix) - throws SAXException - { - // no op - } - - - /** - * Receive notification of the start of an element. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions at the start of - * each element (such as allocating a new tree node or writing - * output to a file).
- * - * @param uri The Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed. - * @param localName The local name (without prefix), or the - * empty string if Namespace processing is not being - * performed. - * @param qName The qualified name (with prefix), or the - * empty string if qualified names are not available. - * @param attributes The attributes attached to the element. If - * there are no attributes, it shall be an empty - * Attributes object. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#startElement - */ - public void startElement (String uri, String localName, - String qName, Attributes attributes) - throws SAXException - { - // no op - } - - - /** - * Receive notification of the end of an element. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions at the end of - * each element (such as finalising a tree node or writing - * output to a file).
- * - * @param uri The Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed. - * @param localName The local name (without prefix), or the - * empty string if Namespace processing is not being - * performed. - * @param qName The qualified name (with prefix), or the - * empty string if qualified names are not available. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#endElement - */ - public void endElement (String uri, String localName, String qName) - throws SAXException - { - // no op - } - - - /** - * Receive notification of character data inside an element. - * - *By default, do nothing. Application writers may override this - * method to take specific actions for each chunk of character data - * (such as adding the data to a node or buffer, or printing it to - * a file).
- * - * @param ch The characters. - * @param start The start position in the character array. - * @param length The number of characters to use from the - * character array. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#characters - */ - public void characters (char ch[], int start, int length) - throws SAXException - { - // no op - } - - - /** - * Receive notification of ignorable whitespace in element content. - * - *By default, do nothing. Application writers may override this - * method to take specific actions for each chunk of ignorable - * whitespace (such as adding data to a node or buffer, or printing - * it to a file).
- * - * @param ch The whitespace characters. - * @param start The start position in the character array. - * @param length The number of characters to use from the - * character array. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#ignorableWhitespace - */ - public void ignorableWhitespace (char ch[], int start, int length) - throws SAXException - { - // no op - } - - - /** - * Receive notification of a processing instruction. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions for each - * processing instruction, such as setting status variables or - * invoking other methods.
- * - * @param target The processing instruction target. - * @param data The processing instruction data, or null if - * none is supplied. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#processingInstruction - */ - public void processingInstruction (String target, String data) - throws SAXException - { - // no op - } - - - /** - * Receive notification of a skipped entity. - * - *By default, do nothing. Application writers may override this - * method in a subclass to take specific actions for each - * processing instruction, such as setting status variables or - * invoking other methods.
- * - * @param name The name of the skipped entity. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ContentHandler#processingInstruction - */ - public void skippedEntity (String name) - throws SAXException - { - // no op - } - - - - //////////////////////////////////////////////////////////////////// - // Default implementation of the ErrorHandler interface. - //////////////////////////////////////////////////////////////////// - - - /** - * Receive notification of a parser warning. - * - *The default implementation does nothing. Application writers - * may override this method in a subclass to take specific actions - * for each warning, such as inserting the message in a log file or - * printing it to the console.
- * - * @param e The warning information encoded as an exception. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ErrorHandler#warning - * @see org.xml.sax.SAXParseException - */ - public void warning (SAXParseException e) - throws SAXException - { - // no op - } - - - /** - * Receive notification of a recoverable parser error. - * - *The default implementation does nothing. Application writers - * may override this method in a subclass to take specific actions - * for each error, such as inserting the message in a log file or - * printing it to the console.
- * - * @param e The warning information encoded as an exception. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ErrorHandler#warning - * @see org.xml.sax.SAXParseException - */ - public void error (SAXParseException e) - throws SAXException - { - // no op - } - - - /** - * Report a fatal XML parsing error. - * - *The default implementation throws a SAXParseException. - * Application writers may override this method in a subclass if - * they need to take specific actions for each fatal error (such as - * collecting all of the errors into a single report): in any case, - * the application must stop all regular processing when this - * method is invoked, since the document is no longer reliable, and - * the parser may no longer report parsing events.
- * - * @param e The error information encoded as an exception. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @see org.xml.sax.ErrorHandler#fatalError - * @see org.xml.sax.SAXParseException - */ - public void fatalError (SAXParseException e) - throws SAXException - { - throw e; - } - -} - -// end of DefaultHandler.java diff --git a/libjava/external/sax/org/xml/sax/helpers/LocatorImpl.java b/libjava/external/sax/org/xml/sax/helpers/LocatorImpl.java deleted file mode 100644 index 6fa4857277c..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/LocatorImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// SAX default implementation for Locator. -// http://www.saxproject.org -// No warranty; no copyright -- use this as you will. -// $Id: LocatorImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import org.xml.sax.Locator; - - -/** - * Provide an optional convenience implementation of Locator. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class is available mainly for application writers, who - * can use it to make a persistent snapshot of a locator at any - * point during a document parse:
- * - *- * Locator locator; - * Locator startloc; - * - * public void setLocator (Locator locator) - * { - * // note the locator - * this.locator = locator; - * } - * - * public void startDocument () - * { - * // save the location of the start of the document - * // for future use. - * Locator startloc = new LocatorImpl(locator); - * } - *- * - *
Normally, parser writers will not use this class, since it - * is more efficient to provide location information only when - * requested, rather than constantly updating a Locator object.
- * - * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.Locator Locator - */ -public class LocatorImpl implements Locator -{ - - - /** - * Zero-argument constructor. - * - *This will not normally be useful, since the main purpose - * of this class is to make a snapshot of an existing Locator.
- */ - public LocatorImpl () - { - } - - - /** - * Copy constructor. - * - *Create a persistent copy of the current state of a locator. - * When the original locator changes, this copy will still keep - * the original values (and it can be used outside the scope of - * DocumentHandler methods).
- * - * @param locator The locator to copy. - */ - public LocatorImpl (Locator locator) - { - setPublicId(locator.getPublicId()); - setSystemId(locator.getSystemId()); - setLineNumber(locator.getLineNumber()); - setColumnNumber(locator.getColumnNumber()); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.Locator - //////////////////////////////////////////////////////////////////// - - - /** - * Return the saved public identifier. - * - * @return The public identifier as a string, or null if none - * is available. - * @see org.xml.sax.Locator#getPublicId - * @see #setPublicId - */ - public String getPublicId () - { - return publicId; - } - - - /** - * Return the saved system identifier. - * - * @return The system identifier as a string, or null if none - * is available. - * @see org.xml.sax.Locator#getSystemId - * @see #setSystemId - */ - public String getSystemId () - { - return systemId; - } - - - /** - * Return the saved line number (1-based). - * - * @return The line number as an integer, or -1 if none is available. - * @see org.xml.sax.Locator#getLineNumber - * @see #setLineNumber - */ - public int getLineNumber () - { - return lineNumber; - } - - - /** - * Return the saved column number (1-based). - * - * @return The column number as an integer, or -1 if none is available. - * @see org.xml.sax.Locator#getColumnNumber - * @see #setColumnNumber - */ - public int getColumnNumber () - { - return columnNumber; - } - - - - //////////////////////////////////////////////////////////////////// - // Setters for the properties (not in org.xml.sax.Locator) - //////////////////////////////////////////////////////////////////// - - - /** - * Set the public identifier for this locator. - * - * @param publicId The new public identifier, or null - * if none is available. - * @see #getPublicId - */ - public void setPublicId (String publicId) - { - this.publicId = publicId; - } - - - /** - * Set the system identifier for this locator. - * - * @param systemId The new system identifier, or null - * if none is available. - * @see #getSystemId - */ - public void setSystemId (String systemId) - { - this.systemId = systemId; - } - - - /** - * Set the line number for this locator (1-based). - * - * @param lineNumber The line number, or -1 if none is available. - * @see #getLineNumber - */ - public void setLineNumber (int lineNumber) - { - this.lineNumber = lineNumber; - } - - - /** - * Set the column number for this locator (1-based). - * - * @param columnNumber The column number, or -1 if none is available. - * @see #getColumnNumber - */ - public void setColumnNumber (int columnNumber) - { - this.columnNumber = columnNumber; - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - private String publicId; - private String systemId; - private int lineNumber; - private int columnNumber; - -} - -// end of LocatorImpl.java diff --git a/libjava/external/sax/org/xml/sax/helpers/NamespaceSupport.java b/libjava/external/sax/org/xml/sax/helpers/NamespaceSupport.java deleted file mode 100644 index 52472fa6e03..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/NamespaceSupport.java +++ /dev/null @@ -1,836 +0,0 @@ -// NamespaceSupport.java - generic Namespace support for SAX. -// http://www.saxproject.org -// Written by David Megginson -// This class is in the Public Domain. NO WARRANTY! -// $Id: NamespaceSupport.java,v 1.1 2005/02/02 00:41:54 tromey Exp $ - -package org.xml.sax.helpers; - -import java.util.EmptyStackException; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - - -/** - * Encapsulate Namespace logic for use by applications using SAX, - * or internally by SAX drivers. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class encapsulates the logic of Namespace processing: it - * tracks the declarations currently in force for each context and - * automatically processes qualified XML names into their Namespace - * parts; it can also be used in reverse for generating XML qnames - * from Namespaces.
- * - *Namespace support objects are reusable, but the reset method - * must be invoked between each session.
- * - *Here is a simple session:
- * - *- * String parts[] = new String[3]; - * NamespaceSupport support = new NamespaceSupport(); - * - * support.pushContext(); - * support.declarePrefix("", "http://www.w3.org/1999/xhtml"); - * support.declarePrefix("dc", "http://www.purl.org/dc#"); - * - * parts = support.processName("p", parts, false); - * System.out.println("Namespace URI: " + parts[0]); - * System.out.println("Local name: " + parts[1]); - * System.out.println("Raw name: " + parts[2]); - * - * parts = support.processName("dc:title", parts, false); - * System.out.println("Namespace URI: " + parts[0]); - * System.out.println("Local name: " + parts[1]); - * System.out.println("Raw name: " + parts[2]); - * - * support.popContext(); - *- * - *
Note that this class is optimized for the use case where most - * elements do not contain Namespace declarations: if the same - * prefix/URI mapping is repeated for each context (for example), this - * class will be somewhat less efficient.
- * - *Although SAX drivers (parsers) may choose to use this class to
- * implement namespace handling, they are not required to do so.
- * Applications must track namespace information themselves if they
- * want to use namespace information.
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- */
-public class NamespaceSupport
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constants.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * The XML Namespace URI as a constant.
- * The value is http://www.w3.org/XML/1998/namespace
- * as defined in the "Namespaces in XML" * recommendation.
- *
- *
This is the Namespace URI that is automatically mapped - * to the "xml" prefix.
- */ - public final static String XMLNS = - "http://www.w3.org/XML/1998/namespace"; - - - /** - * The namespace declaration URI as a constant. - * The value ishttp://www.w3.org/xmlns/2000/
, as defined
- * in a backwards-incompatible erratum to the "Namespaces in XML"
- * recommendation. Because that erratum postdated SAX2, SAX2 defaults
- * to the original recommendation, and does not normally use this URI.
- *
- *
- * This is the Namespace URI that is optionally applied to - * xmlns and xmlns:* attributes, which are used to - * declare namespaces.
- * - * @since SAX 2.1alpha - * @see #setNamespaceDeclUris - * @see #isNamespaceDeclUris - */ - public final static String NSDECL = - "http://www.w3.org/xmlns/2000/"; - - - /** - * An empty enumeration. - */ - // GCJ LOCAL: work around gcj bug by making this package-private - final static Enumeration EMPTY_ENUMERATION = - new Vector().elements(); - - - //////////////////////////////////////////////////////////////////// - // Constructor. - //////////////////////////////////////////////////////////////////// - - - /** - * Create a new Namespace support object. - */ - public NamespaceSupport () - { - reset(); - } - - - - //////////////////////////////////////////////////////////////////// - // Context management. - //////////////////////////////////////////////////////////////////// - - - /** - * Reset this Namespace support object for reuse. - * - *It is necessary to invoke this method before reusing the - * Namespace support object for a new session. If namespace - * declaration URIs are to be supported, that flag must also - * be set to a non-default value. - *
- * - * @see #setNamespaceDeclUris - */ - public void reset () - { - contexts = new Context[32]; - namespaceDeclUris = false; - contextPos = 0; - contexts[contextPos] = currentContext = new Context(); - currentContext.declarePrefix("xml", XMLNS); - } - - - /** - * Start a new Namespace context. - * The new context will automatically inherit - * the declarations of its parent context, but it will also keep - * track of which declarations were made within this context. - * - *Event callback code should start a new context once per element. - * This means being ready to call this in either of two places. - * For elements that don't include namespace declarations, the - * ContentHandler.startElement() callback is the right place. - * For elements with such a declaration, it'd done in the first - * ContentHandler.startPrefixMapping() callback. - * A boolean flag can be used to - * track whether a context has been started yet. When either of - * those methods is called, it checks the flag to see if a new context - * needs to be started. If so, it starts the context and sets the - * flag. After ContentHandler.startElement() - * does that, it always clears the flag. - * - *
Normally, SAX drivers would push a new context at the beginning - * of each XML element. Then they perform a first pass over the - * attributes to process all namespace declarations, making - * ContentHandler.startPrefixMapping() callbacks. - * Then a second pass is made, to determine the namespace-qualified - * names for all attributes and for the element name. - * Finally all the information for the - * ContentHandler.startElement() callback is available, - * so it can then be made. - * - *
The Namespace support object always starts with a base context - * already in force: in this context, only the "xml" prefix is - * declared.
- * - * @see org.xml.sax.ContentHandler - * @see #popContext - */ - public void pushContext () - { - int max = contexts.length; - - contexts [contextPos].declsOK = false; - contextPos++; - - // Extend the array if necessary - if (contextPos >= max) { - Context newContexts[] = new Context[max*2]; - System.arraycopy(contexts, 0, newContexts, 0, max); - max *= 2; - contexts = newContexts; - } - - // Allocate the context if necessary. - currentContext = contexts[contextPos]; - if (currentContext == null) { - contexts[contextPos] = currentContext = new Context(); - } - - // Set the parent, if any. - if (contextPos > 0) { - currentContext.setParent(contexts[contextPos - 1]); - } - } - - - /** - * Revert to the previous Namespace context. - * - *Normally, you should pop the context at the end of each - * XML element. After popping the context, all Namespace prefix - * mappings that were previously in force are restored.
- * - *You must not attempt to declare additional Namespace - * prefixes after popping a context, unless you push another - * context first.
- * - * @see #pushContext - */ - public void popContext () - { - contexts[contextPos].clear(); - contextPos--; - if (contextPos < 0) { - throw new EmptyStackException(); - } - currentContext = contexts[contextPos]; - } - - - - //////////////////////////////////////////////////////////////////// - // Operations within a context. - //////////////////////////////////////////////////////////////////// - - - /** - * Declare a Namespace prefix. All prefixes must be declared - * before they are referenced. For example, a SAX driver (parser) - * would scan an element's attributes - * in two passes: first for namespace declarations, - * then a second pass using {@link #processName processName()} to - * interpret prefixes against (potentially redefined) prefixes. - * - *This method declares a prefix in the current Namespace - * context; the prefix will remain in force until this context - * is popped, unless it is shadowed in a descendant context.
- * - *To declare the default element Namespace, use the empty string as - * the prefix.
- * - *Note that you must not declare a prefix after - * you've pushed and popped another Namespace context, or - * treated the declarations phase as complete by processing - * a prefixed name.
- * - *Note that there is an asymmetry in this library: {@link - * #getPrefix getPrefix} will not return the "" prefix, - * even if you have declared a default element namespace. - * To check for a default namespace, - * you have to look it up explicitly using {@link #getURI getURI}. - * This asymmetry exists to make it easier to look up prefixes - * for attribute names, where the default prefix is not allowed.
- * - * @param prefix The prefix to declare, or the empty string to - * indicate the default element namespace. This may never have - * the value "xml" or "xmlns". - * @param uri The Namespace URI to associate with the prefix. - * @return true if the prefix was legal, false otherwise - * - * @see #processName - * @see #getURI - * @see #getPrefix - */ - public boolean declarePrefix (String prefix, String uri) - { - if (prefix.equals("xml") || prefix.equals("xmlns")) { - return false; - } else { - currentContext.declarePrefix(prefix, uri); - return true; - } - } - - - /** - * Process a raw XML qualified name, after all declarations in the - * current context have been handled by {@link #declarePrefix - * declarePrefix()}. - * - *This method processes a raw XML qualified name in the - * current context by removing the prefix and looking it up among - * the prefixes currently declared. The return value will be the - * array supplied by the caller, filled in as follows:
- * - *All of the strings in the array will be internalized. If - * the raw name has a prefix that has not been declared, then - * the return value will be null.
- * - *Note that attribute names are processed differently than - * element names: an unprefixed element name will receive the - * default Namespace (if any), while an unprefixed attribute name - * will not.
- * - * @param qName The XML qualified name to be processed. - * @param parts An array supplied by the caller, capable of - * holding at least three members. - * @param isAttribute A flag indicating whether this is an - * attribute name (true) or an element name (false). - * @return The supplied array holding three internalized strings - * representing the Namespace URI (or empty string), the - * local name, and the XML qualified name; or null if there - * is an undeclared prefix. - * @see #declarePrefix - * @see java.lang.String#intern */ - public String [] processName (String qName, String parts[], - boolean isAttribute) - { - String myParts[] = currentContext.processName(qName, isAttribute); - if (myParts == null) { - return null; - } else { - parts[0] = myParts[0]; - parts[1] = myParts[1]; - parts[2] = myParts[2]; - return parts; - } - } - - - /** - * Look up a prefix and get the currently-mapped Namespace URI. - * - *This method looks up the prefix in the current context. - * Use the empty string ("") for the default Namespace.
- * - * @param prefix The prefix to look up. - * @return The associated Namespace URI, or null if the prefix - * is undeclared in this context. - * @see #getPrefix - * @see #getPrefixes - */ - public String getURI (String prefix) - { - return currentContext.getURI(prefix); - } - - - /** - * Return an enumeration of all prefixes whose declarations are - * active in the current context. - * This includes declarations from parent contexts that have - * not been overridden. - * - *Note: if there is a default prefix, it will not be - * returned in this enumeration; check for the default prefix - * using the {@link #getURI getURI} with an argument of "".
- * - * @return An enumeration of prefixes (never empty). - * @see #getDeclaredPrefixes - * @see #getURI - */ - public Enumeration getPrefixes () - { - return currentContext.getPrefixes(); - } - - - /** - * Return one of the prefixes mapped to a Namespace URI. - * - *If more than one prefix is currently mapped to the same - * URI, this method will make an arbitrary selection; if you - * want all of the prefixes, use the {@link #getPrefixes} - * method instead.
- * - *Note: this will never return the empty (default) prefix; - * to check for a default prefix, use the {@link #getURI getURI} - * method with an argument of "".
- * - * @param uri the namespace URI - * @return one of the prefixes currently mapped to the URI supplied, - * or null if none is mapped or if the URI is assigned to - * the default namespace - * @see #getPrefixes(java.lang.String) - * @see #getURI - */ - public String getPrefix (String uri) - { - return currentContext.getPrefix(uri); - } - - - /** - * Return an enumeration of all prefixes for a given URI whose - * declarations are active in the current context. - * This includes declarations from parent contexts that have - * not been overridden. - * - *This method returns prefixes mapped to a specific Namespace - * URI. The xml: prefix will be included. If you want only one - * prefix that's mapped to the Namespace URI, and you don't care - * which one you get, use the {@link #getPrefix getPrefix} - * method instead.
- * - *Note: the empty (default) prefix is never included - * in this enumeration; to check for the presence of a default - * Namespace, use the {@link #getURI getURI} method with an - * argument of "".
- * - * @param uri The Namespace URI. - * @return An enumeration of prefixes (never empty). - * @see #getPrefix - * @see #getDeclaredPrefixes - * @see #getURI - */ - public Enumeration getPrefixes (String uri) - { - Vector prefixes = new Vector(); - Enumeration allPrefixes = getPrefixes(); - while (allPrefixes.hasMoreElements()) { - String prefix = (String)allPrefixes.nextElement(); - if (uri.equals(getURI(prefix))) { - prefixes.addElement(prefix); - } - } - return prefixes.elements(); - } - - - /** - * Return an enumeration of all prefixes declared in this context. - * - *The empty (default) prefix will be included in this - * enumeration; note that this behaviour differs from that of - * {@link #getPrefix} and {@link #getPrefixes}.
- * - * @return An enumeration of all prefixes declared in this - * context. - * @see #getPrefixes - * @see #getURI - */ - public Enumeration getDeclaredPrefixes () - { - return currentContext.getDeclaredPrefixes(); - } - - /** - * Controls whether namespace declaration attributes are placed - * into the {@link #NSDECL NSDECL} namespace - * by {@link #processName processName()}. This may only be - * changed before any contexts have been pushed. - * - * @since SAX 2.1alpha - * - * @exception IllegalStateException when attempting to set this - * after any context has been pushed. - */ - public void setNamespaceDeclUris (boolean value) - { - if (contextPos != 0) - throw new IllegalStateException (); - if (value == namespaceDeclUris) - return; - namespaceDeclUris = value; - if (value) - currentContext.declarePrefix ("xmlns", NSDECL); - else { - contexts[contextPos] = currentContext = new Context(); - currentContext.declarePrefix("xml", XMLNS); - } - } - - /** - * Returns true if namespace declaration attributes are placed into - * a namespace. This behavior is not the default. - * - * @since SAX 2.1alpha - */ - public boolean isNamespaceDeclUris () - { return namespaceDeclUris; } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - private Context contexts[]; - private Context currentContext; - private int contextPos; - private boolean namespaceDeclUris; - - - //////////////////////////////////////////////////////////////////// - // Internal classes. - //////////////////////////////////////////////////////////////////// - - /** - * Internal class for a single Namespace context. - * - *This module caches and reuses Namespace contexts, - * so the number allocated - * will be equal to the element depth of the document, not to the total - * number of elements (i.e. 5-10 rather than tens of thousands). - * Also, data structures used to represent contexts are shared when - * possible (child contexts without declarations) to further reduce - * the amount of memory that's consumed. - *
- */ - final class Context { - - /** - * Create the root-level Namespace context. - */ - Context () - { - copyTables(); - } - - - /** - * (Re)set the parent of this Namespace context. - * The context must either have been freshly constructed, - * or must have been cleared. - * - * @param context The parent Namespace context object. - */ - void setParent (Context parent) - { - this.parent = parent; - declarations = null; - prefixTable = parent.prefixTable; - uriTable = parent.uriTable; - elementNameTable = parent.elementNameTable; - attributeNameTable = parent.attributeNameTable; - defaultNS = parent.defaultNS; - declSeen = false; - declsOK = true; - } - - /** - * Makes associated state become collectible, - * invalidating this context. - * {@link #setParent} must be called before - * this context may be used again. - */ - void clear () - { - parent = null; - prefixTable = null; - uriTable = null; - elementNameTable = null; - attributeNameTable = null; - defaultNS = null; - } - - - /** - * Declare a Namespace prefix for this context. - * - * @param prefix The prefix to declare. - * @param uri The associated Namespace URI. - * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix - */ - void declarePrefix (String prefix, String uri) - { - // Lazy processing... - if (!declsOK) - throw new IllegalStateException ( - "can't declare any more prefixes in this context"); - if (!declSeen) { - copyTables(); - } - if (declarations == null) { - declarations = new Vector(); - } - - prefix = prefix.intern(); - uri = uri.intern(); - if ("".equals(prefix)) { - if ("".equals(uri)) { - defaultNS = null; - } else { - defaultNS = uri; - } - } else { - prefixTable.put(prefix, uri); - uriTable.put(uri, prefix); // may wipe out another prefix - } - declarations.addElement(prefix); - } - - - /** - * Process an XML qualified name in this context. - * - * @param qName The XML qualified name. - * @param isAttribute true if this is an attribute name. - * @return An array of three strings containing the - * URI part (or empty string), the local part, - * and the raw name, all internalized, or null - * if there is an undeclared prefix. - * @see org.xml.sax.helpers.NamespaceSupport#processName - */ - String [] processName (String qName, boolean isAttribute) - { - String name[]; - Hashtable table; - - // detect errors in call sequence - declsOK = false; - - // Select the appropriate table. - if (isAttribute) { - table = attributeNameTable; - } else { - table = elementNameTable; - } - - // Start by looking in the cache, and - // return immediately if the name - // is already known in this content - name = (String[])table.get(qName); - if (name != null) { - return name; - } - - // We haven't seen this name in this - // context before. Maybe in the parent - // context, but we can't assume prefix - // bindings are the same. - name = new String[3]; - name[2] = qName.intern(); - int index = qName.indexOf(':'); - - - // No prefix. - if (index == -1) { - if (isAttribute) { - if (qName == "xmlns" && namespaceDeclUris) - name[0] = NSDECL; - else - name[0] = ""; - } else if (defaultNS == null) { - name[0] = ""; - } else { - name[0] = defaultNS; - } - name[1] = name[2]; - } - - // Prefix - else { - String prefix = qName.substring(0, index); - String local = qName.substring(index+1); - String uri; - if ("".equals(prefix)) { - uri = defaultNS; - } else { - uri = (String)prefixTable.get(prefix); - } - if (uri == null - || (!isAttribute && "xmlns".equals (prefix))) { - return null; - } - name[0] = uri; - name[1] = local.intern(); - } - - // Save in the cache for future use. - // (Could be shared with parent context...) - table.put(name[2], name); - return name; - } - - - /** - * Look up the URI associated with a prefix in this context. - * - * @param prefix The prefix to look up. - * @return The associated Namespace URI, or null if none is - * declared. - * @see org.xml.sax.helpers.NamespaceSupport#getURI - */ - String getURI (String prefix) - { - if ("".equals(prefix)) { - return defaultNS; - } else if (prefixTable == null) { - return null; - } else { - return (String)prefixTable.get(prefix); - } - } - - - /** - * Look up one of the prefixes associated with a URI in this context. - * - *Since many prefixes may be mapped to the same URI, - * the return value may be unreliable.
- * - * @param uri The URI to look up. - * @return The associated prefix, or null if none is declared. - * @see org.xml.sax.helpers.NamespaceSupport#getPrefix - */ - String getPrefix (String uri) - { - if (uriTable == null) { - return null; - } else { - return (String)uriTable.get(uri); - } - } - - - /** - * Return an enumeration of prefixes declared in this context. - * - * @return An enumeration of prefixes (possibly empty). - * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes - */ - Enumeration getDeclaredPrefixes () - { - if (declarations == null) { - return EMPTY_ENUMERATION; - } else { - return declarations.elements(); - } - } - - - /** - * Return an enumeration of all prefixes currently in force. - * - *The default prefix, if in force, is not - * returned, and will have to be checked for separately.
- * - * @return An enumeration of prefixes (never empty). - * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes - */ - Enumeration getPrefixes () - { - if (prefixTable == null) { - return EMPTY_ENUMERATION; - } else { - return prefixTable.keys(); - } - } - - - - //////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////// - - - /** - * Copy on write for the internal tables in this context. - * - *This class is optimized for the normal case where most - * elements do not contain Namespace declarations.
- */ - private void copyTables () - { - if (prefixTable != null) { - prefixTable = (Hashtable)prefixTable.clone(); - } else { - prefixTable = new Hashtable(); - } - if (uriTable != null) { - uriTable = (Hashtable)uriTable.clone(); - } else { - uriTable = new Hashtable(); - } - elementNameTable = new Hashtable(); - attributeNameTable = new Hashtable(); - declSeen = true; - } - - - - //////////////////////////////////////////////////////////////// - // Protected state. - //////////////////////////////////////////////////////////////// - - Hashtable prefixTable; - Hashtable uriTable; - Hashtable elementNameTable; - Hashtable attributeNameTable; - String defaultNS = null; - boolean declsOK = true; - - - - //////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////// - - private Vector declarations = null; - private boolean declSeen = false; - private Context parent = null; - } -} - -// end of NamespaceSupport.java diff --git a/libjava/external/sax/org/xml/sax/helpers/NewInstance.java b/libjava/external/sax/org/xml/sax/helpers/NewInstance.java deleted file mode 100644 index 70c043eb42f..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/NewInstance.java +++ /dev/null @@ -1,79 +0,0 @@ -// NewInstance.java - create a new instance of a class by name. -// http://www.saxproject.org -// Written by Edwin Goei, edwingo@apache.org -// and by David Brownell, dbrownell@users.sourceforge.net -// NO WARRANTY! This class is in the Public Domain. -// $Id: NewInstance.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; - -/** - * Create a new instance of a class by name. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class contains a static method for creating an instance of a - * class from an explicit class name. It tries to use the thread's context - * ClassLoader if possible and falls back to using - * Class.forName(String).
- * - *This code is designed to compile and run on JDK version 1.1 and later - * including versions of Java 2.
- * - * @author Edwin Goei, David Brownell - * @version 2.0.1 (sax2r2) - */ -class NewInstance { - - /** - * Creates a new instance of the specified class name - * - * Package private so this code is not exposed at the API level. - */ - static Object newInstance (ClassLoader classLoader, String className) - throws ClassNotFoundException, IllegalAccessException, - InstantiationException - { - Class driverClass; - if (classLoader == null) { - driverClass = Class.forName(className); - } else { - driverClass = classLoader.loadClass(className); - } - return driverClass.newInstance(); - } - - /** - * Figure out which ClassLoader to use. For JDK 1.2 and later use - * the context ClassLoader. - */ - static ClassLoader getClassLoader () - { - Method m = null; - - try { - m = Thread.class.getMethod("getContextClassLoader", null); - } catch (NoSuchMethodException e) { - // Assume that we are running JDK 1.1, use the current ClassLoader - return NewInstance.class.getClassLoader(); - } - - try { - return (ClassLoader) m.invoke(Thread.currentThread(), null); - } catch (IllegalAccessException e) { - // assert(false) - throw new UnknownError(e.getMessage()); - } catch (InvocationTargetException e) { - // assert(e.getTargetException() instanceof SecurityException) - throw new UnknownError(e.getMessage()); - } - } -} diff --git a/libjava/external/sax/org/xml/sax/helpers/ParserAdapter.java b/libjava/external/sax/org/xml/sax/helpers/ParserAdapter.java deleted file mode 100644 index 748ad1c8499..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/ParserAdapter.java +++ /dev/null @@ -1,1046 +0,0 @@ -// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader. -// http://www.saxproject.org -// Written by David Megginson -// NO WARRANTY! This class is in the public domain. -// $Id: ParserAdapter.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Vector; - -import org.xml.sax.Parser; // deprecated -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.AttributeList; // deprecated -import org.xml.sax.EntityResolver; -import org.xml.sax.DTDHandler; -import org.xml.sax.DocumentHandler; // deprecated -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import org.xml.sax.XMLReader; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; - - -/** - * Adapt a SAX1 Parser as a SAX2 XMLReader. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class wraps a SAX1 {@link org.xml.sax.Parser Parser} - * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader}, - * with feature, property, and Namespace support. Note - * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity - * skippedEntity} events, since SAX1 does not make that information available.
- * - *This adapter does not test for duplicate Namespace-qualified - * attribute names.
- * - * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.helpers.XMLReaderAdapter - * @see org.xml.sax.XMLReader - * @see org.xml.sax.Parser - */ -public class ParserAdapter implements XMLReader, DocumentHandler -{ - - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - /** - * Construct a new parser adapter. - * - *Use the "org.xml.sax.parser" property to locate the - * embedded SAX1 driver.
- * - * @exception SAXException If the embedded driver - * cannot be instantiated or if the - * org.xml.sax.parser property is not specified. - */ - public ParserAdapter () - throws SAXException - { - super(); - - String driver = System.getProperty("org.xml.sax.parser"); - - try { - setup(ParserFactory.makeParser()); - } catch (ClassNotFoundException e1) { - throw new - SAXException("Cannot find SAX1 driver class " + - driver, e1); - } catch (IllegalAccessException e2) { - throw new - SAXException("SAX1 driver class " + - driver + - " found but cannot be loaded", e2); - } catch (InstantiationException e3) { - throw new - SAXException("SAX1 driver class " + - driver + - " loaded but cannot be instantiated", e3); - } catch (ClassCastException e4) { - throw new - SAXException("SAX1 driver class " + - driver + - " does not implement org.xml.sax.Parser"); - } catch (NullPointerException e5) { - throw new - SAXException("System property org.xml.sax.parser not specified"); - } - } - - - /** - * Construct a new parser adapter. - * - *Note that the embedded parser cannot be changed once the - * adapter is created; to embed a different parser, allocate - * a new ParserAdapter.
- * - * @param parser The SAX1 parser to embed. - * @exception java.lang.NullPointerException If the parser parameter - * is null. - */ - public ParserAdapter (Parser parser) - { - super(); - setup(parser); - } - - - /** - * Internal setup method. - * - * @param parser The embedded parser. - * @exception java.lang.NullPointerException If the parser parameter - * is null. - */ - private void setup (Parser parser) - { - if (parser == null) { - throw new - NullPointerException("Parser argument must not be null"); - } - this.parser = parser; - atts = new AttributesImpl(); - nsSupport = new NamespaceSupport(); - attAdapter = new AttributeListAdapter(); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.XMLReader. - //////////////////////////////////////////////////////////////////// - - - // - // Internal constants for the sake of convenience. - // - private final static String FEATURES = "http://xml.org/sax/features/"; - private final static String NAMESPACES = FEATURES + "namespaces"; - private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes"; - private final static String XMLNS_URIs = FEATURES + "xmlns-uris"; - - - /** - * Set a feature flag for the parser. - * - *The only features recognized are namespaces and - * namespace-prefixes.
- * - * @param name The feature name, as a complete URI. - * @param value The requested feature value. - * @exception SAXNotRecognizedException If the feature - * can't be assigned or retrieved. - * @exception SAXNotSupportedException If the feature - * can't be assigned that value. - * @see org.xml.sax.XMLReader#setFeature - */ - public void setFeature (String name, boolean value) - throws SAXNotRecognizedException, SAXNotSupportedException - { - if (name.equals(NAMESPACES)) { - checkNotParsing("feature", name); - namespaces = value; - if (!namespaces && !prefixes) { - prefixes = true; - } - } else if (name.equals(NAMESPACE_PREFIXES)) { - checkNotParsing("feature", name); - prefixes = value; - if (!prefixes && !namespaces) { - namespaces = true; - } - } else if (name.equals(XMLNS_URIs)) { - checkNotParsing("feature", name); - uris = value; - } else { - throw new SAXNotRecognizedException("Feature: " + name); - } - } - - - /** - * Check a parser feature flag. - * - *The only features recognized are namespaces and - * namespace-prefixes.
- * - * @param name The feature name, as a complete URI. - * @return The current feature value. - * @exception SAXNotRecognizedException If the feature - * value can't be assigned or retrieved. - * @exception SAXNotSupportedException If the - * feature is not currently readable. - * @see org.xml.sax.XMLReader#setFeature - */ - public boolean getFeature (String name) - throws SAXNotRecognizedException, SAXNotSupportedException - { - if (name.equals(NAMESPACES)) { - return namespaces; - } else if (name.equals(NAMESPACE_PREFIXES)) { - return prefixes; - } else if (name.equals(XMLNS_URIs)) { - return uris; - } else { - throw new SAXNotRecognizedException("Feature: " + name); - } - } - - - /** - * Set a parser property. - * - *No properties are currently recognized.
- * - * @param name The property name. - * @param value The property value. - * @exception SAXNotRecognizedException If the property - * value can't be assigned or retrieved. - * @exception SAXNotSupportedException If the property - * can't be assigned that value. - * @see org.xml.sax.XMLReader#setProperty - */ - public void setProperty (String name, Object value) - throws SAXNotRecognizedException, SAXNotSupportedException - { - throw new SAXNotRecognizedException("Property: " + name); - } - - - /** - * Get a parser property. - * - *No properties are currently recognized.
- * - * @param name The property name. - * @return The property value. - * @exception SAXNotRecognizedException If the property - * value can't be assigned or retrieved. - * @exception SAXNotSupportedException If the property - * value is not currently readable. - * @see org.xml.sax.XMLReader#getProperty - */ - public Object getProperty (String name) - throws SAXNotRecognizedException, SAXNotSupportedException - { - throw new SAXNotRecognizedException("Property: " + name); - } - - - /** - * Set the entity resolver. - * - * @param resolver The new entity resolver. - * @see org.xml.sax.XMLReader#setEntityResolver - */ - public void setEntityResolver (EntityResolver resolver) - { - entityResolver = resolver; - } - - - /** - * Return the current entity resolver. - * - * @return The current entity resolver, or null if none was supplied. - * @see org.xml.sax.XMLReader#getEntityResolver - */ - public EntityResolver getEntityResolver () - { - return entityResolver; - } - - - /** - * Set the DTD handler. - * - * @param handler the new DTD handler - * @see org.xml.sax.XMLReader#setEntityResolver - */ - public void setDTDHandler (DTDHandler handler) - { - dtdHandler = handler; - } - - - /** - * Return the current DTD handler. - * - * @return the current DTD handler, or null if none was supplied - * @see org.xml.sax.XMLReader#getEntityResolver - */ - public DTDHandler getDTDHandler () - { - return dtdHandler; - } - - - /** - * Set the content handler. - * - * @param handler the new content handler - * @see org.xml.sax.XMLReader#setEntityResolver - */ - public void setContentHandler (ContentHandler handler) - { - contentHandler = handler; - } - - - /** - * Return the current content handler. - * - * @return The current content handler, or null if none was supplied. - * @see org.xml.sax.XMLReader#getEntityResolver - */ - public ContentHandler getContentHandler () - { - return contentHandler; - } - - - /** - * Set the error handler. - * - * @param handler The new error handler. - * @see org.xml.sax.XMLReader#setEntityResolver - */ - public void setErrorHandler (ErrorHandler handler) - { - errorHandler = handler; - } - - - /** - * Return the current error handler. - * - * @return The current error handler, or null if none was supplied. - * @see org.xml.sax.XMLReader#getEntityResolver - */ - public ErrorHandler getErrorHandler () - { - return errorHandler; - } - - - /** - * Parse an XML document. - * - * @param systemId The absolute URL of the document. - * @exception java.io.IOException If there is a problem reading - * the raw content of the document. - * @exception SAXException If there is a problem - * processing the document. - * @see #parse(org.xml.sax.InputSource) - * @see org.xml.sax.Parser#parse(java.lang.String) - */ - public void parse (String systemId) - throws IOException, SAXException - { - parse(new InputSource(systemId)); - } - - - /** - * Parse an XML document. - * - * @param input An input source for the document. - * @exception java.io.IOException If there is a problem reading - * the raw content of the document. - * @exception SAXException If there is a problem - * processing the document. - * @see #parse(java.lang.String) - * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource) - */ - public void parse (InputSource input) - throws IOException, SAXException - { - if (parsing) { - throw new SAXException("Parser is already in use"); - } - setupParser(); - parsing = true; - try { - parser.parse(input); - } finally { - parsing = false; - } - parsing = false; - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.DocumentHandler. - //////////////////////////////////////////////////////////////////// - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 document locator event. - * - * @param locator A document locator. - * @see org.xml.sax.ContentHandler#setDocumentLocator - */ - public void setDocumentLocator (Locator locator) - { - this.locator = locator; - if (contentHandler != null) { - contentHandler.setDocumentLocator(locator); - } - } - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 start document event. - * - * @exception SAXException The client may raise a - * processing exception. - * @see org.xml.sax.DocumentHandler#startDocument - */ - public void startDocument () - throws SAXException - { - if (contentHandler != null) { - contentHandler.startDocument(); - } - } - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 end document event. - * - * @exception SAXException The client may raise a - * processing exception. - * @see org.xml.sax.DocumentHandler#endDocument - */ - public void endDocument () - throws SAXException - { - if (contentHandler != null) { - contentHandler.endDocument(); - } - } - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 startElement event. - * - *If necessary, perform Namespace processing.
- * - * @param qName The qualified (prefixed) name. - * @param qAtts The XML attribute list (with qnames). - * @exception SAXException The client may raise a - * processing exception. - */ - public void startElement (String qName, AttributeList qAtts) - throws SAXException - { - // These are exceptions from the - // first pass; they should be - // ignored if there's a second pass, - // but reported otherwise. - Vector exceptions = null; - - // If we're not doing Namespace - // processing, dispatch this quickly. - if (!namespaces) { - if (contentHandler != null) { - attAdapter.setAttributeList(qAtts); - contentHandler.startElement("", "", qName.intern(), - attAdapter); - } - return; - } - - - // OK, we're doing Namespace processing. - nsSupport.pushContext(); - int length = qAtts.getLength(); - - // First pass: handle NS decls - for (int i = 0; i < length; i++) { - String attQName = qAtts.getName(i); - - if (!attQName.startsWith("xmlns")) - continue; - // Could be a declaration... - String prefix; - int n = attQName.indexOf(':'); - - // xmlns=... - if (n == -1 && attQName.length () == 5) { - prefix = ""; - } else if (n != 5) { - // XML namespaces spec doesn't discuss "xmlnsf:oo" - // (and similarly named) attributes ... at most, warn - continue; - } else // xmlns:foo=... - prefix = attQName.substring(n+1); - - String value = qAtts.getValue(i); - if (!nsSupport.declarePrefix(prefix, value)) { - reportError("Illegal Namespace prefix: " + prefix); - continue; - } - if (contentHandler != null) - contentHandler.startPrefixMapping(prefix, value); - } - - // Second pass: copy all relevant - // attributes into the SAX2 AttributeList - // using updated prefix bindings - atts.clear(); - for (int i = 0; i < length; i++) { - String attQName = qAtts.getName(i); - String type = qAtts.getType(i); - String value = qAtts.getValue(i); - - // Declaration? - if (attQName.startsWith("xmlns")) { - String prefix; - int n = attQName.indexOf(':'); - - if (n == -1 && attQName.length () == 5) { - prefix = ""; - } else if (n != 5) { - // XML namespaces spec doesn't discuss "xmlnsf:oo" - // (and similarly named) attributes ... ignore - prefix = null; - } else { - prefix = attQName.substring(6); - } - // Yes, decl: report or prune - if (prefix != null) { - if (prefixes) { - if (uris) - // note funky case: localname can be null - // when declaring the default prefix, and - // yet the uri isn't null. - atts.addAttribute (nsSupport.XMLNS, prefix, - attQName.intern(), type, value); - else - atts.addAttribute ("", "", - attQName.intern(), type, value); - } - continue; - } - } - - // Not a declaration -- report - try { - String attName[] = processName(attQName, true, true); - atts.addAttribute(attName[0], attName[1], attName[2], - type, value); - } catch (SAXException e) { - if (exceptions == null) - exceptions = new Vector(); - exceptions.addElement(e); - atts.addAttribute("", attQName, attQName, type, value); - } - } - - // now handle the deferred exception reports - if (exceptions != null && errorHandler != null) { - for (int i = 0; i < exceptions.size(); i++) - errorHandler.error((SAXParseException) - (exceptions.elementAt(i))); - } - - // OK, finally report the event. - if (contentHandler != null) { - String name[] = processName(qName, false, false); - contentHandler.startElement(name[0], name[1], name[2], atts); - } - } - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 end element event. - * - * @param qName The qualified (prefixed) name. - * @exception SAXException The client may raise a - * processing exception. - * @see org.xml.sax.DocumentHandler#endElement - */ - public void endElement (String qName) - throws SAXException - { - // If we're not doing Namespace - // processing, dispatch this quickly. - if (!namespaces) { - if (contentHandler != null) { - contentHandler.endElement("", "", qName.intern()); - } - return; - } - - // Split the name. - String names[] = processName(qName, false, false); - if (contentHandler != null) { - contentHandler.endElement(names[0], names[1], names[2]); - Enumeration prefixes = nsSupport.getDeclaredPrefixes(); - while (prefixes.hasMoreElements()) { - String prefix = (String)prefixes.nextElement(); - contentHandler.endPrefixMapping(prefix); - } - } - nsSupport.popContext(); - } - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 characters event. - * - * @param ch An array of characters. - * @param start The starting position in the array. - * @param length The number of characters to use. - * @exception SAXException The client may raise a - * processing exception. - * @see org.xml.sax.DocumentHandler#characters - */ - public void characters (char ch[], int start, int length) - throws SAXException - { - if (contentHandler != null) { - contentHandler.characters(ch, start, length); - } - } - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 ignorable whitespace event. - * - * @param ch An array of characters. - * @param start The starting position in the array. - * @param length The number of characters to use. - * @exception SAXException The client may raise a - * processing exception. - * @see org.xml.sax.DocumentHandler#ignorableWhitespace - */ - public void ignorableWhitespace (char ch[], int start, int length) - throws SAXException - { - if (contentHandler != null) { - contentHandler.ignorableWhitespace(ch, start, length); - } - } - - - /** - * Adapter implementation method; do not call. - * Adapt a SAX1 processing instruction event. - * - * @param target The processing instruction target. - * @param data The remainder of the processing instruction - * @exception SAXException The client may raise a - * processing exception. - * @see org.xml.sax.DocumentHandler#processingInstruction - */ - public void processingInstruction (String target, String data) - throws SAXException - { - if (contentHandler != null) { - contentHandler.processingInstruction(target, data); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal utility methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Initialize the parser before each run. - */ - private void setupParser () - { - // catch an illegal "nonsense" state. - if (!prefixes && !namespaces) - throw new IllegalStateException (); - - nsSupport.reset(); - if (uris) - nsSupport.setNamespaceDeclUris (true); - - if (entityResolver != null) { - parser.setEntityResolver(entityResolver); - } - if (dtdHandler != null) { - parser.setDTDHandler(dtdHandler); - } - if (errorHandler != null) { - parser.setErrorHandler(errorHandler); - } - parser.setDocumentHandler(this); - locator = null; - } - - - /** - * Process a qualified (prefixed) name. - * - *If the name has an undeclared prefix, use only the qname - * and make an ErrorHandler.error callback in case the app is - * interested.
- * - * @param qName The qualified (prefixed) name. - * @param isAttribute true if this is an attribute name. - * @return The name split into three parts. - * @exception SAXException The client may throw - * an exception if there is an error callback. - */ - private String [] processName (String qName, boolean isAttribute, - boolean useException) - throws SAXException - { - String parts[] = nsSupport.processName(qName, nameParts, - isAttribute); - if (parts == null) { - if (useException) - throw makeException("Undeclared prefix: " + qName); - reportError("Undeclared prefix: " + qName); - parts = new String[3]; - parts[0] = parts[1] = ""; - parts[2] = qName.intern(); - } - return parts; - } - - - /** - * Report a non-fatal error. - * - * @param message The error message. - * @exception SAXException The client may throw - * an exception. - */ - void reportError (String message) - throws SAXException - { - if (errorHandler != null) - errorHandler.error(makeException(message)); - } - - - /** - * Construct an exception for the current context. - * - * @param message The error message. - */ - private SAXParseException makeException (String message) - { - if (locator != null) { - return new SAXParseException(message, locator); - } else { - return new SAXParseException(message, null, null, -1, -1); - } - } - - - /** - * Throw an exception if we are parsing. - * - *Use this method to detect illegal feature or - * property changes.
- * - * @param type The type of thing (feature or property). - * @param name The feature or property name. - * @exception SAXNotSupportedException If a - * document is currently being parsed. - */ - private void checkNotParsing (String type, String name) - throws SAXNotSupportedException - { - if (parsing) { - throw new SAXNotSupportedException("Cannot change " + - type + ' ' + - name + " while parsing"); - - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - private NamespaceSupport nsSupport; - private AttributeListAdapter attAdapter; - - private boolean parsing = false; - private String nameParts[] = new String[3]; - - private Parser parser = null; - - private AttributesImpl atts = null; - - // Features - private boolean namespaces = true; - private boolean prefixes = false; - private boolean uris = false; - - // Properties - - // Handlers - Locator locator; - - EntityResolver entityResolver = null; - DTDHandler dtdHandler = null; - ContentHandler contentHandler = null; - ErrorHandler errorHandler = null; - - - - //////////////////////////////////////////////////////////////////// - // Inner class to wrap an AttributeList when not doing NS proc. - //////////////////////////////////////////////////////////////////// - - - /** - * Adapt a SAX1 AttributeList as a SAX2 Attributes object. - * - *This class is in the Public Domain, and comes with NO - * WARRANTY of any kind.
- * - *This wrapper class is used only when Namespace support - * is disabled -- it provides pretty much a direct mapping - * from SAX1 to SAX2, except that names and types are - * interned whenever requested.
- */ - final class AttributeListAdapter implements Attributes - { - - /** - * Construct a new adapter. - */ - AttributeListAdapter () - { - } - - - /** - * Set the embedded AttributeList. - * - *This method must be invoked before any of the others - * can be used.
- * - * @param The SAX1 attribute list (with qnames). - */ - void setAttributeList (AttributeList qAtts) - { - this.qAtts = qAtts; - } - - - /** - * Return the length of the attribute list. - * - * @return The number of attributes in the list. - * @see org.xml.sax.Attributes#getLength - */ - public int getLength () - { - return qAtts.getLength(); - } - - - /** - * Return the Namespace URI of the specified attribute. - * - * @param The attribute's index. - * @return Always the empty string. - * @see org.xml.sax.Attributes#getURI - */ - public String getURI (int i) - { - return ""; - } - - - /** - * Return the local name of the specified attribute. - * - * @param The attribute's index. - * @return Always the empty string. - * @see org.xml.sax.Attributes#getLocalName - */ - public String getLocalName (int i) - { - return ""; - } - - - /** - * Return the qualified (prefixed) name of the specified attribute. - * - * @param The attribute's index. - * @return The attribute's qualified name, internalized. - */ - public String getQName (int i) - { - return qAtts.getName(i).intern(); - } - - - /** - * Return the type of the specified attribute. - * - * @param The attribute's index. - * @return The attribute's type as an internalized string. - */ - public String getType (int i) - { - return qAtts.getType(i).intern(); - } - - - /** - * Return the value of the specified attribute. - * - * @param The attribute's index. - * @return The attribute's value. - */ - public String getValue (int i) - { - return qAtts.getValue(i); - } - - - /** - * Look up an attribute index by Namespace name. - * - * @param uri The Namespace URI or the empty string. - * @param localName The local name. - * @return The attributes index, or -1 if none was found. - * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) - */ - public int getIndex (String uri, String localName) - { - return -1; - } - - - /** - * Look up an attribute index by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attributes index, or -1 if none was found. - * @see org.xml.sax.Attributes#getIndex(java.lang.String) - */ - public int getIndex (String qName) - { - int max = atts.getLength(); - for (int i = 0; i < max; i++) { - if (qAtts.getName(i).equals(qName)) { - return i; - } - } - return -1; - } - - - /** - * Look up the type of an attribute by Namespace name. - * - * @param uri The Namespace URI - * @param localName The local name. - * @return The attribute's type as an internalized string. - */ - public String getType (String uri, String localName) - { - return null; - } - - - /** - * Look up the type of an attribute by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's type as an internalized string. - */ - public String getType (String qName) - { - return qAtts.getType(qName).intern(); - } - - - /** - * Look up the value of an attribute by Namespace name. - * - * @param uri The Namespace URI - * @param localName The local name. - * @return The attribute's value. - */ - public String getValue (String uri, String localName) - { - return null; - } - - - /** - * Look up the value of an attribute by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's value. - */ - public String getValue (String qName) - { - return qAtts.getValue(qName); - } - - private AttributeList qAtts; - } -} - -// end of ParserAdapter.java diff --git a/libjava/external/sax/org/xml/sax/helpers/ParserFactory.java b/libjava/external/sax/org/xml/sax/helpers/ParserFactory.java deleted file mode 100644 index 23139981088..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/ParserFactory.java +++ /dev/null @@ -1,129 +0,0 @@ -// SAX parser factory. -// http://www.saxproject.org -// No warranty; no copyright -- use this as you will. -// $Id: ParserFactory.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import java.lang.ClassNotFoundException; -import java.lang.IllegalAccessException; -import java.lang.InstantiationException; -import java.lang.SecurityException; -import java.lang.ClassCastException; - -import org.xml.sax.Parser; - - -/** - * Java-specific class for dynamically loading SAX parsers. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
Note: This class is designed to work with the now-deprecated - * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use - * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.
- * - *ParserFactory is not part of the platform-independent definition - * of SAX; it is an additional convenience class designed - * specifically for Java XML application writers. SAX applications - * can use the static methods in this class to allocate a SAX parser - * dynamically at run-time based either on the value of the - * `org.xml.sax.parser' system property or on a string containing the class - * name.
- * - *Note that the application still requires an XML parser that - * implements SAX1.
- * - * @deprecated This class works with the deprecated - * {@link org.xml.sax.Parser Parser} - * interface. - * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - */ -public class ParserFactory { - - - /** - * Private null constructor. - */ - private ParserFactory () - { - } - - - /** - * Create a new SAX parser using the `org.xml.sax.parser' system property. - * - *The named class must exist and must implement the - * {@link org.xml.sax.Parser Parser} interface.
- * - * @exception java.lang.NullPointerException There is no value - * for the `org.xml.sax.parser' system property. - * @exception java.lang.ClassNotFoundException The SAX parser - * class was not found (check your CLASSPATH). - * @exception IllegalAccessException The SAX parser class was - * found, but you do not have permission to load - * it. - * @exception InstantiationException The SAX parser class was - * found but could not be instantiated. - * @exception java.lang.ClassCastException The SAX parser class - * was found and instantiated, but does not implement - * org.xml.sax.Parser. - * @see #makeParser(java.lang.String) - * @see org.xml.sax.Parser - */ - public static Parser makeParser () - throws ClassNotFoundException, - IllegalAccessException, - InstantiationException, - NullPointerException, - ClassCastException - { - String className = System.getProperty("org.xml.sax.parser"); - if (className == null) { - throw new NullPointerException("No value for sax.parser property"); - } else { - return makeParser(className); - } - } - - - /** - * Create a new SAX parser object using the class name provided. - * - *The named class must exist and must implement the - * {@link org.xml.sax.Parser Parser} interface.
- * - * @param className A string containing the name of the - * SAX parser class. - * @exception java.lang.ClassNotFoundException The SAX parser - * class was not found (check your CLASSPATH). - * @exception IllegalAccessException The SAX parser class was - * found, but you do not have permission to load - * it. - * @exception InstantiationException The SAX parser class was - * found but could not be instantiated. - * @exception java.lang.ClassCastException The SAX parser class - * was found and instantiated, but does not implement - * org.xml.sax.Parser. - * @see #makeParser() - * @see org.xml.sax.Parser - */ - public static Parser makeParser (String className) - throws ClassNotFoundException, - IllegalAccessException, - InstantiationException, - ClassCastException - { - return (Parser) NewInstance.newInstance ( - NewInstance.getClassLoader (), className); - } - -} - diff --git a/libjava/external/sax/org/xml/sax/helpers/XMLFilterImpl.java b/libjava/external/sax/org/xml/sax/helpers/XMLFilterImpl.java deleted file mode 100644 index 64ff0a4cf88..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/XMLFilterImpl.java +++ /dev/null @@ -1,713 +0,0 @@ -// XMLFilterImpl.java - base SAX2 filter implementation. -// http://www.saxproject.org -// Written by David Megginson -// NO WARRANTY! This class is in the Public Domain. -// $Id: XMLFilterImpl.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import java.io.IOException; - -import org.xml.sax.XMLReader; -import org.xml.sax.XMLFilter; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.Attributes; -import org.xml.sax.EntityResolver; -import org.xml.sax.DTDHandler; -import org.xml.sax.ContentHandler; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.SAXNotRecognizedException; - - -/** - * Base class for deriving an XML filter. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class is designed to sit between an {@link org.xml.sax.XMLReader - * XMLReader} and the client application's event handlers. By default, it - * does nothing but pass requests up to the reader and events - * on to the handlers unmodified, but subclasses can override - * specific methods to modify the event stream or the configuration - * requests as they pass through.
- * - * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.XMLFilter - * @see org.xml.sax.XMLReader - * @see org.xml.sax.EntityResolver - * @see org.xml.sax.DTDHandler - * @see org.xml.sax.ContentHandler - * @see org.xml.sax.ErrorHandler - */ -public class XMLFilterImpl - implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler -{ - - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - /** - * Construct an empty XML filter, with no parent. - * - *This filter will have no parent: you must assign a parent - * before you start a parse or do any configuration with - * setFeature or setProperty, unless you use this as a pure event - * consumer rather than as an {@link XMLReader}.
- * - * @see org.xml.sax.XMLReader#setFeature - * @see org.xml.sax.XMLReader#setProperty - * @see #setParent - */ - public XMLFilterImpl () - { - super(); - } - - - /** - * Construct an XML filter with the specified parent. - * - * @see #setParent - * @see #getParent - */ - public XMLFilterImpl (XMLReader parent) - { - super(); - setParent(parent); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.XMLFilter. - //////////////////////////////////////////////////////////////////// - - - /** - * Set the parent reader. - * - *This is the {@link org.xml.sax.XMLReader XMLReader} from which - * this filter will obtain its events and to which it will pass its - * configuration requests. The parent may itself be another filter.
- * - *If there is no parent reader set, any attempt to parse - * or to set or get a feature or property will fail.
- * - * @param parent The parent XML reader. - * @see #getParent - */ - public void setParent (XMLReader parent) - { - this.parent = parent; - } - - - /** - * Get the parent reader. - * - * @return The parent XML reader, or null if none is set. - * @see #setParent - */ - public XMLReader getParent () - { - return parent; - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.XMLReader. - //////////////////////////////////////////////////////////////////// - - - /** - * Set the value of a feature. - * - *This will always fail if the parent is null.
- * - * @param name The feature name. - * @param value The requested feature value. - * @exception org.xml.sax.SAXNotRecognizedException If the feature - * value can't be assigned or retrieved from the parent. - * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the feature name but - * cannot set the requested value. - */ - public void setFeature (String name, boolean value) - throws SAXNotRecognizedException, SAXNotSupportedException - { - if (parent != null) { - parent.setFeature(name, value); - } else { - throw new SAXNotRecognizedException("Feature: " + name); - } - } - - - /** - * Look up the value of a feature. - * - *This will always fail if the parent is null.
- * - * @param name The feature name. - * @return The current value of the feature. - * @exception org.xml.sax.SAXNotRecognizedException If the feature - * value can't be assigned or retrieved from the parent. - * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the feature name but - * cannot determine its value at this time. - */ - public boolean getFeature (String name) - throws SAXNotRecognizedException, SAXNotSupportedException - { - if (parent != null) { - return parent.getFeature(name); - } else { - throw new SAXNotRecognizedException("Feature: " + name); - } - } - - - /** - * Set the value of a property. - * - *This will always fail if the parent is null.
- * - * @param name The property name. - * @param value The requested property value. - * @exception org.xml.sax.SAXNotRecognizedException If the property - * value can't be assigned or retrieved from the parent. - * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the property name but - * cannot set the requested value. - */ - public void setProperty (String name, Object value) - throws SAXNotRecognizedException, SAXNotSupportedException - { - if (parent != null) { - parent.setProperty(name, value); - } else { - throw new SAXNotRecognizedException("Property: " + name); - } - } - - - /** - * Look up the value of a property. - * - * @param name The property name. - * @return The current value of the property. - * @exception org.xml.sax.SAXNotRecognizedException If the property - * value can't be assigned or retrieved from the parent. - * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the property name but - * cannot determine its value at this time. - */ - public Object getProperty (String name) - throws SAXNotRecognizedException, SAXNotSupportedException - { - if (parent != null) { - return parent.getProperty(name); - } else { - throw new SAXNotRecognizedException("Property: " + name); - } - } - - - /** - * Set the entity resolver. - * - * @param resolver The new entity resolver. - */ - public void setEntityResolver (EntityResolver resolver) - { - entityResolver = resolver; - } - - - /** - * Get the current entity resolver. - * - * @return The current entity resolver, or null if none was set. - */ - public EntityResolver getEntityResolver () - { - return entityResolver; - } - - - /** - * Set the DTD event handler. - * - * @param handler the new DTD handler - */ - public void setDTDHandler (DTDHandler handler) - { - dtdHandler = handler; - } - - - /** - * Get the current DTD event handler. - * - * @return The current DTD handler, or null if none was set. - */ - public DTDHandler getDTDHandler () - { - return dtdHandler; - } - - - /** - * Set the content event handler. - * - * @param handler the new content handler - */ - public void setContentHandler (ContentHandler handler) - { - contentHandler = handler; - } - - - /** - * Get the content event handler. - * - * @return The current content handler, or null if none was set. - */ - public ContentHandler getContentHandler () - { - return contentHandler; - } - - - /** - * Set the error event handler. - * - * @param handler the new error handler - */ - public void setErrorHandler (ErrorHandler handler) - { - errorHandler = handler; - } - - - /** - * Get the current error event handler. - * - * @return The current error handler, or null if none was set. - */ - public ErrorHandler getErrorHandler () - { - return errorHandler; - } - - - /** - * Parse a document. - * - * @param input The input source for the document entity. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception java.io.IOException An IO exception from the parser, - * possibly from a byte stream or character stream - * supplied by the application. - */ - public void parse (InputSource input) - throws SAXException, IOException - { - setupParse(); - parent.parse(input); - } - - - /** - * Parse a document. - * - * @param systemId The system identifier as a fully-qualified URI. - * @exception org.xml.sax.SAXException Any SAX exception, possibly - * wrapping another exception. - * @exception java.io.IOException An IO exception from the parser, - * possibly from a byte stream or character stream - * supplied by the application. - */ - public void parse (String systemId) - throws SAXException, IOException - { - parse(new InputSource(systemId)); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.EntityResolver. - //////////////////////////////////////////////////////////////////// - - - /** - * Filter an external entity resolution. - * - * @param publicId The entity's public identifier, or null. - * @param systemId The entity's system identifier. - * @return A new InputSource or null for the default. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - * @exception java.io.IOException The client may throw an - * I/O-related exception while obtaining the - * new InputSource. - */ - public InputSource resolveEntity (String publicId, String systemId) - throws SAXException, IOException - { - if (entityResolver != null) { - return entityResolver.resolveEntity(publicId, systemId); - } else { - return null; - } - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.DTDHandler. - //////////////////////////////////////////////////////////////////// - - - /** - * Filter a notation declaration event. - * - * @param name The notation name. - * @param publicId The notation's public identifier, or null. - * @param systemId The notation's system identifier, or null. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void notationDecl (String name, String publicId, String systemId) - throws SAXException - { - if (dtdHandler != null) { - dtdHandler.notationDecl(name, publicId, systemId); - } - } - - - /** - * Filter an unparsed entity declaration event. - * - * @param name The entity name. - * @param publicId The entity's public identifier, or null. - * @param systemId The entity's system identifier, or null. - * @param notationName The name of the associated notation. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void unparsedEntityDecl (String name, String publicId, - String systemId, String notationName) - throws SAXException - { - if (dtdHandler != null) { - dtdHandler.unparsedEntityDecl(name, publicId, systemId, - notationName); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.ContentHandler. - //////////////////////////////////////////////////////////////////// - - - /** - * Filter a new document locator event. - * - * @param locator The document locator. - */ - public void setDocumentLocator (Locator locator) - { - this.locator = locator; - if (contentHandler != null) { - contentHandler.setDocumentLocator(locator); - } - } - - - /** - * Filter a start document event. - * - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void startDocument () - throws SAXException - { - if (contentHandler != null) { - contentHandler.startDocument(); - } - } - - - /** - * Filter an end document event. - * - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void endDocument () - throws SAXException - { - if (contentHandler != null) { - contentHandler.endDocument(); - } - } - - - /** - * Filter a start Namespace prefix mapping event. - * - * @param prefix The Namespace prefix. - * @param uri The Namespace URI. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void startPrefixMapping (String prefix, String uri) - throws SAXException - { - if (contentHandler != null) { - contentHandler.startPrefixMapping(prefix, uri); - } - } - - - /** - * Filter an end Namespace prefix mapping event. - * - * @param prefix The Namespace prefix. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void endPrefixMapping (String prefix) - throws SAXException - { - if (contentHandler != null) { - contentHandler.endPrefixMapping(prefix); - } - } - - - /** - * Filter a start element event. - * - * @param uri The element's Namespace URI, or the empty string. - * @param localName The element's local name, or the empty string. - * @param qName The element's qualified (prefixed) name, or the empty - * string. - * @param atts The element's attributes. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void startElement (String uri, String localName, String qName, - Attributes atts) - throws SAXException - { - if (contentHandler != null) { - contentHandler.startElement(uri, localName, qName, atts); - } - } - - - /** - * Filter an end element event. - * - * @param uri The element's Namespace URI, or the empty string. - * @param localName The element's local name, or the empty string. - * @param qName The element's qualified (prefixed) name, or the empty - * string. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void endElement (String uri, String localName, String qName) - throws SAXException - { - if (contentHandler != null) { - contentHandler.endElement(uri, localName, qName); - } - } - - - /** - * Filter a character data event. - * - * @param ch An array of characters. - * @param start The starting position in the array. - * @param length The number of characters to use from the array. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void characters (char ch[], int start, int length) - throws SAXException - { - if (contentHandler != null) { - contentHandler.characters(ch, start, length); - } - } - - - /** - * Filter an ignorable whitespace event. - * - * @param ch An array of characters. - * @param start The starting position in the array. - * @param length The number of characters to use from the array. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void ignorableWhitespace (char ch[], int start, int length) - throws SAXException - { - if (contentHandler != null) { - contentHandler.ignorableWhitespace(ch, start, length); - } - } - - - /** - * Filter a processing instruction event. - * - * @param target The processing instruction target. - * @param data The text following the target. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void processingInstruction (String target, String data) - throws SAXException - { - if (contentHandler != null) { - contentHandler.processingInstruction(target, data); - } - } - - - /** - * Filter a skipped entity event. - * - * @param name The name of the skipped entity. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void skippedEntity (String name) - throws SAXException - { - if (contentHandler != null) { - contentHandler.skippedEntity(name); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.ErrorHandler. - //////////////////////////////////////////////////////////////////// - - - /** - * Filter a warning event. - * - * @param e The warning as an exception. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void warning (SAXParseException e) - throws SAXException - { - if (errorHandler != null) { - errorHandler.warning(e); - } - } - - - /** - * Filter an error event. - * - * @param e The error as an exception. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void error (SAXParseException e) - throws SAXException - { - if (errorHandler != null) { - errorHandler.error(e); - } - } - - - /** - * Filter a fatal error event. - * - * @param e The error as an exception. - * @exception org.xml.sax.SAXException The client may throw - * an exception during processing. - */ - public void fatalError (SAXParseException e) - throws SAXException - { - if (errorHandler != null) { - errorHandler.fatalError(e); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Set up before a parse. - * - *Before every parse, check whether the parent is - * non-null, and re-register the filter for all of the - * events.
- */ - private void setupParse () - { - if (parent == null) { - throw new NullPointerException("No parent for filter"); - } - parent.setEntityResolver(this); - parent.setDTDHandler(this); - parent.setContentHandler(this); - parent.setErrorHandler(this); - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - private XMLReader parent = null; - private Locator locator = null; - private EntityResolver entityResolver = null; - private DTDHandler dtdHandler = null; - private ContentHandler contentHandler = null; - private ErrorHandler errorHandler = null; - -} - -// end of XMLFilterImpl.java diff --git a/libjava/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java b/libjava/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java deleted file mode 100644 index 566e69b8d7b..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java +++ /dev/null @@ -1,538 +0,0 @@ -// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser -// http://www.saxproject.org -// Written by David Megginson -// NO WARRANTY! This class is in the public domain. -// $Id: XMLReaderAdapter.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; - -import java.io.IOException; -import java.util.Locale; - -import org.xml.sax.Parser; // deprecated -import org.xml.sax.Locator; -import org.xml.sax.InputSource; -import org.xml.sax.AttributeList; // deprecated -import org.xml.sax.EntityResolver; -import org.xml.sax.DTDHandler; -import org.xml.sax.DocumentHandler; // deprecated -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; - -import org.xml.sax.XMLReader; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXNotSupportedException; - - -/** - * Adapt a SAX2 XMLReader as a SAX1 Parser. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader} - * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader - * must support a true value for the - * http://xml.org/sax/features/namespace-prefixes property or parsing will fail - * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader - * supports a false value for the http://xml.org/sax/features/namespaces - * property, that will also be used to improve efficiency.
- * - * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.Parser - * @see org.xml.sax.XMLReader - */ -public class XMLReaderAdapter implements Parser, ContentHandler -{ - - - //////////////////////////////////////////////////////////////////// - // Constructor. - //////////////////////////////////////////////////////////////////// - - - /** - * Create a new adapter. - * - *Use the "org.xml.sax.driver" property to locate the SAX2 - * driver to embed.
- * - * @exception org.xml.sax.SAXException If the embedded driver - * cannot be instantiated or if the - * org.xml.sax.driver property is not specified. - */ - public XMLReaderAdapter () - throws SAXException - { - setup(XMLReaderFactory.createXMLReader()); - } - - - /** - * Create a new adapter. - * - *Create a new adapter, wrapped around a SAX2 XMLReader. - * The adapter will make the XMLReader act like a SAX1 - * Parser.
- * - * @param xmlReader The SAX2 XMLReader to wrap. - * @exception java.lang.NullPointerException If the argument is null. - */ - public XMLReaderAdapter (XMLReader xmlReader) - { - setup(xmlReader); - } - - - - /** - * Internal setup. - * - * @param xmlReader The embedded XMLReader. - */ - private void setup (XMLReader xmlReader) - { - if (xmlReader == null) { - throw new NullPointerException("XMLReader must not be null"); - } - this.xmlReader = xmlReader; - qAtts = new AttributesAdapter(); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.Parser. - //////////////////////////////////////////////////////////////////// - - - /** - * Set the locale for error reporting. - * - *This is not supported in SAX2, and will always throw - * an exception.
- * - * @param locale the locale for error reporting. - * @see org.xml.sax.Parser#setLocale - * @exception org.xml.sax.SAXException Thrown unless overridden. - */ - public void setLocale (Locale locale) - throws SAXException - { - throw new SAXNotSupportedException("setLocale not supported"); - } - - - /** - * Register the entity resolver. - * - * @param resolver The new resolver. - * @see org.xml.sax.Parser#setEntityResolver - */ - public void setEntityResolver (EntityResolver resolver) - { - xmlReader.setEntityResolver(resolver); - } - - - /** - * Register the DTD event handler. - * - * @param handler The new DTD event handler. - * @see org.xml.sax.Parser#setDTDHandler - */ - public void setDTDHandler (DTDHandler handler) - { - xmlReader.setDTDHandler(handler); - } - - - /** - * Register the SAX1 document event handler. - * - *Note that the SAX1 document handler has no Namespace - * support.
- * - * @param handler The new SAX1 document event handler. - * @see org.xml.sax.Parser#setDocumentHandler - */ - public void setDocumentHandler (DocumentHandler handler) - { - documentHandler = handler; - } - - - /** - * Register the error event handler. - * - * @param handler The new error event handler. - * @see org.xml.sax.Parser#setErrorHandler - */ - public void setErrorHandler (ErrorHandler handler) - { - xmlReader.setErrorHandler(handler); - } - - - /** - * Parse the document. - * - *This method will throw an exception if the embedded - * XMLReader does not support the - * http://xml.org/sax/features/namespace-prefixes property.
- * - * @param systemId The absolute URL of the document. - * @exception java.io.IOException If there is a problem reading - * the raw content of the document. - * @exception org.xml.sax.SAXException If there is a problem - * processing the document. - * @see #parse(org.xml.sax.InputSource) - * @see org.xml.sax.Parser#parse(java.lang.String) - */ - public void parse (String systemId) - throws IOException, SAXException - { - parse(new InputSource(systemId)); - } - - - /** - * Parse the document. - * - *This method will throw an exception if the embedded - * XMLReader does not support the - * http://xml.org/sax/features/namespace-prefixes property.
- * - * @param input An input source for the document. - * @exception java.io.IOException If there is a problem reading - * the raw content of the document. - * @exception org.xml.sax.SAXException If there is a problem - * processing the document. - * @see #parse(java.lang.String) - * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource) - */ - public void parse (InputSource input) - throws IOException, SAXException - { - setupXMLReader(); - xmlReader.parse(input); - } - - - /** - * Set up the XML reader. - */ - private void setupXMLReader () - throws SAXException - { - xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); - try { - xmlReader.setFeature("http://xml.org/sax/features/namespaces", - false); - } catch (SAXException e) { - // NO OP: it's just extra information, and we can ignore it - } - xmlReader.setContentHandler(this); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.ContentHandler. - //////////////////////////////////////////////////////////////////// - - - /** - * Set a document locator. - * - * @param locator The document locator. - * @see org.xml.sax.ContentHandler#setDocumentLocator - */ - public void setDocumentLocator (Locator locator) - { - if (documentHandler != null) - documentHandler.setDocumentLocator(locator); - } - - - /** - * Start document event. - * - * @exception org.xml.sax.SAXException The client may raise a - * processing exception. - * @see org.xml.sax.ContentHandler#startDocument - */ - public void startDocument () - throws SAXException - { - if (documentHandler != null) - documentHandler.startDocument(); - } - - - /** - * End document event. - * - * @exception org.xml.sax.SAXException The client may raise a - * processing exception. - * @see org.xml.sax.ContentHandler#endDocument - */ - public void endDocument () - throws SAXException - { - if (documentHandler != null) - documentHandler.endDocument(); - } - - - /** - * Adapt a SAX2 start prefix mapping event. - * - * @param prefix The prefix being mapped. - * @param uri The Namespace URI being mapped to. - * @see org.xml.sax.ContentHandler#startPrefixMapping - */ - public void startPrefixMapping (String prefix, String uri) - { - } - - - /** - * Adapt a SAX2 end prefix mapping event. - * - * @param prefix The prefix being mapped. - * @see org.xml.sax.ContentHandler#endPrefixMapping - */ - public void endPrefixMapping (String prefix) - { - } - - - /** - * Adapt a SAX2 start element event. - * - * @param uri The Namespace URI. - * @param localName The Namespace local name. - * @param qName The qualified (prefixed) name. - * @param atts The SAX2 attributes. - * @exception org.xml.sax.SAXException The client may raise a - * processing exception. - * @see org.xml.sax.ContentHandler#endDocument - */ - public void startElement (String uri, String localName, - String qName, Attributes atts) - throws SAXException - { - if (documentHandler != null) { - qAtts.setAttributes(atts); - documentHandler.startElement(qName, qAtts); - } - } - - - /** - * Adapt a SAX2 end element event. - * - * @param uri The Namespace URI. - * @param localName The Namespace local name. - * @param qName The qualified (prefixed) name. - * @exception org.xml.sax.SAXException The client may raise a - * processing exception. - * @see org.xml.sax.ContentHandler#endElement - */ - public void endElement (String uri, String localName, - String qName) - throws SAXException - { - if (documentHandler != null) - documentHandler.endElement(qName); - } - - - /** - * Adapt a SAX2 characters event. - * - * @param ch An array of characters. - * @param start The starting position in the array. - * @param length The number of characters to use. - * @exception org.xml.sax.SAXException The client may raise a - * processing exception. - * @see org.xml.sax.ContentHandler#characters - */ - public void characters (char ch[], int start, int length) - throws SAXException - { - if (documentHandler != null) - documentHandler.characters(ch, start, length); - } - - - /** - * Adapt a SAX2 ignorable whitespace event. - * - * @param ch An array of characters. - * @param start The starting position in the array. - * @param length The number of characters to use. - * @exception org.xml.sax.SAXException The client may raise a - * processing exception. - * @see org.xml.sax.ContentHandler#ignorableWhitespace - */ - public void ignorableWhitespace (char ch[], int start, int length) - throws SAXException - { - if (documentHandler != null) - documentHandler.ignorableWhitespace(ch, start, length); - } - - - /** - * Adapt a SAX2 processing instruction event. - * - * @param target The processing instruction target. - * @param data The remainder of the processing instruction - * @exception org.xml.sax.SAXException The client may raise a - * processing exception. - * @see org.xml.sax.ContentHandler#processingInstruction - */ - public void processingInstruction (String target, String data) - throws SAXException - { - if (documentHandler != null) - documentHandler.processingInstruction(target, data); - } - - - /** - * Adapt a SAX2 skipped entity event. - * - * @param name The name of the skipped entity. - * @see org.xml.sax.ContentHandler#skippedEntity - * @exception org.xml.sax.SAXException Throwable by subclasses. - */ - public void skippedEntity (String name) - throws SAXException - { - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - XMLReader xmlReader; - DocumentHandler documentHandler; - AttributesAdapter qAtts; - - - - //////////////////////////////////////////////////////////////////// - // Internal class. - //////////////////////////////////////////////////////////////////// - - - /** - * Internal class to wrap a SAX2 Attributes object for SAX1. - */ - final class AttributesAdapter implements AttributeList - { - AttributesAdapter () - { - } - - - /** - * Set the embedded Attributes object. - * - * @param The embedded SAX2 Attributes. - */ - void setAttributes (Attributes attributes) - { - this.attributes = attributes; - } - - - /** - * Return the number of attributes. - * - * @return The length of the attribute list. - * @see org.xml.sax.AttributeList#getLength - */ - public int getLength () - { - return attributes.getLength(); - } - - - /** - * Return the qualified (prefixed) name of an attribute by position. - * - * @return The qualified name. - * @see org.xml.sax.AttributeList#getName - */ - public String getName (int i) - { - return attributes.getQName(i); - } - - - /** - * Return the type of an attribute by position. - * - * @return The type. - * @see org.xml.sax.AttributeList#getType(int) - */ - public String getType (int i) - { - return attributes.getType(i); - } - - - /** - * Return the value of an attribute by position. - * - * @return The value. - * @see org.xml.sax.AttributeList#getValue(int) - */ - public String getValue (int i) - { - return attributes.getValue(i); - } - - - /** - * Return the type of an attribute by qualified (prefixed) name. - * - * @return The type. - * @see org.xml.sax.AttributeList#getType(java.lang.String) - */ - public String getType (String qName) - { - return attributes.getType(qName); - } - - - /** - * Return the value of an attribute by qualified (prefixed) name. - * - * @return The value. - * @see org.xml.sax.AttributeList#getValue(java.lang.String) - */ - public String getValue (String qName) - { - return attributes.getValue(qName); - } - - private Attributes attributes; - } - -} - -// end of XMLReaderAdapter.java diff --git a/libjava/external/sax/org/xml/sax/helpers/XMLReaderFactory.java b/libjava/external/sax/org/xml/sax/helpers/XMLReaderFactory.java deleted file mode 100644 index 0516ff24e71..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/XMLReaderFactory.java +++ /dev/null @@ -1,202 +0,0 @@ -// XMLReaderFactory.java - factory for creating a new reader. -// http://www.saxproject.org -// Written by David Megginson -// and by David Brownell -// NO WARRANTY! This class is in the Public Domain. -// $Id: XMLReaderFactory.java,v 1.1 2004/12/23 22:38:42 mark Exp $ - -package org.xml.sax.helpers; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import org.xml.sax.XMLReader; -import org.xml.sax.SAXException; - - -/** - * Factory for creating an XML reader. - * - *- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *- * - *
This class contains static methods for creating an XML reader - * from an explicit class name, or based on runtime defaults:
- * - *- * try { - * XMLReader myReader = XMLReaderFactory.createXMLReader(); - * } catch (SAXException e) { - * System.err.println(e.getMessage()); - * } - *- * - *
Note to Distributions bundled with parsers:
- * You should modify the implementation of the no-arguments
- * createXMLReader to handle cases where the external
- * configuration mechanisms aren't set up. That method should do its
- * best to return a parser when one is in the class path, even when
- * nothing bound its class name to org.xml.sax.driver
so
- * those configuration mechanisms would see it.
This constructor prevents the class from being instantiated.
- */ - private XMLReaderFactory () - { - } - - private static final String property = "org.xml.sax.driver"; - - /** - * Attempt to create an XMLReader from system defaults. - * In environments which can support it, the name of the XMLReader - * class is determined by trying each these options in order, and - * using the first one which succeeds:org.xml.sax.driver
- * has a value, that is used as an XMLReader class name. org.xml.sax.parser
system
- * property will often be usable.) In environments such as small embedded systems, which can not - * support that flexibility, other mechanisms to determine the default - * may be used.
- * - *Note that many Java environments allow system properties to be - * initialized on a command line. This means that in most cases - * setting a good value for that property ensures that calls to this - * method will succeed, except when security policies intervene. - * This will also maximize application portability to older SAX - * environments, with less robust implementations of this method. - *
- * - * @return A new XMLReader. - * @exception org.xml.sax.SAXException If no default XMLReader class - * can be identified and instantiated. - * @see #createXMLReader(java.lang.String) - */ - public static XMLReader createXMLReader () - throws SAXException - { - String className = null; - ClassLoader loader = NewInstance.getClassLoader (); - - // 1. try the JVM-instance-wide system property - try { className = System.getProperty (property); } - catch (RuntimeException e) { /* normally fails for applets */ } - - // 2. if that fails, try META-INF/services/ - if (className == null) { - try { - String service = "META-INF/services/" + property; - InputStream in; - BufferedReader reader; - - if (loader == null) - in = ClassLoader.getSystemResourceAsStream (service); - else - in = loader.getResourceAsStream (service); - - if (in != null) { - reader = new BufferedReader ( - new InputStreamReader (in, "UTF8")); - className = reader.readLine (); - in.close (); - } - } catch (Exception e) { - } - } - - // 3. Distro-specific fallback - if (className == null) { -// BEGIN DISTRIBUTION-SPECIFIC - - // EXAMPLE: - // className = "com.example.sax.XmlReader"; - // or a $JAVA_HOME/jre/lib/*properties setting... - -// END DISTRIBUTION-SPECIFIC - } - - // do we know the XMLReader implementation class yet? - if (className != null) - return loadClass (loader, className); - - // 4. panic -- adapt any SAX1 parser - try { - return new ParserAdapter (ParserFactory.makeParser ()); - } catch (Exception e) { - throw new SAXException ("Can't create default XMLReader; " - + "is system property org.xml.sax.driver set?"); - } - } - - - /** - * Attempt to create an XML reader from a class name. - * - *Given a class name, this method attempts to load - * and instantiate the class as an XML reader.
- * - *Note that this method will not be usable in environments where - * the caller (perhaps an applet) is not permitted to load classes - * dynamically.
- * - * @return A new XML reader. - * @exception org.xml.sax.SAXException If the class cannot be - * loaded, instantiated, and cast to XMLReader. - * @see #createXMLReader() - */ - public static XMLReader createXMLReader (String className) - throws SAXException - { - return loadClass (NewInstance.getClassLoader (), className); - } - - private static XMLReader loadClass (ClassLoader loader, String className) - throws SAXException - { - try { - return (XMLReader) NewInstance.newInstance (loader, className); - } catch (ClassNotFoundException e1) { - throw new SAXException("SAX2 driver class " + className + - " not found", e1); - } catch (IllegalAccessException e2) { - throw new SAXException("SAX2 driver class " + className + - " found but cannot be loaded", e2); - } catch (InstantiationException e3) { - throw new SAXException("SAX2 driver class " + className + - " loaded but cannot be instantiated (no empty public constructor?)", - e3); - } catch (ClassCastException e4) { - throw new SAXException("SAX2 driver class " + className + - " does not implement XMLReader", e4); - } - } -} diff --git a/libjava/external/sax/org/xml/sax/helpers/package.html b/libjava/external/sax/org/xml/sax/helpers/package.html deleted file mode 100644 index 06d4a30a63c..00000000000 --- a/libjava/external/sax/org/xml/sax/helpers/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - -This package contains "helper" classes, including -support for bootstrapping SAX-based applications. - -
See http://www.saxproject.org -for more information about SAX.
- - diff --git a/libjava/external/sax/org/xml/sax/package.html b/libjava/external/sax/org/xml/sax/package.html deleted file mode 100644 index b71f67fdda7..00000000000 --- a/libjava/external/sax/org/xml/sax/package.html +++ /dev/null @@ -1,297 +0,0 @@ - - - - -This package provides the core SAX APIs. -Some SAX1 APIs are deprecated to encourage integration of -namespace-awareness into designs of new applications -and into maintenance of existing infrastructure.
- -See http://www.saxproject.org -for more information about SAX.
- - - One of the essential characteristics of SAX2 is that it added
-feature flags which can be used to examine and perhaps modify
-parser modes, in particular modes such as validation.
-Since features are identified by (absolute) URIs, anyone
-can define such features.
-Currently defined standard feature URIs have the prefix
-http://xml.org/sax/features/
before an identifier such as
-validation
. Turn features on or off using
-setFeature. Those standard identifiers are:
Feature ID | -Access | -Default | -Description | -
---|---|---|---|
external-general-entities | -read/write | -unspecified | -Reports whether this parser processes external - general entities; always true if validating. - | -
external-parameter-entities | -read/write | -unspecified | -Reports whether this parser processes external - parameter entities; always true if validating. - | -
is-standalone | -(parsing) read-only, (not parsing) none | -not applicable | -May be examined only during a parse, after the - startDocument() callback has been completed; read-only. - The value is true if the document specified standalone="yes" in - its XML declaration, and otherwise is false. - | -
lexical-handler/parameter-entities | -read/write | -unspecified | -A value of "true" indicates that the LexicalHandler will report - the beginning and end of parameter entities. - | -
namespaces | -read/write | -true | -A value of "true" indicates namespace URIs and unprefixed local names - for element and attribute names will be available. - | -
namespace-prefixes | -read/write | -false | -A value of "true" indicates that XML qualified names (with prefixes) and - attributes (including xmlns* attributes) will be available. - | -
resolve-dtd-uris | -read/write | -true | - A value of "true" indicates that system IDs in declarations will
- be absolutized (relative to their base URIs) before reporting.
- (That is the default behavior for all SAX2 XML parsers.)
- A value of "false" indicates those IDs will not be absolutized;
- parsers will provide the base URI from
- Locator.getSystemId().
- This applies to system IDs passed in
|
-
string-interning | -read/write | -unspecified | -Has a value of "true" if all XML names (for elements, prefixes, - attributes, entities, notations, and local names), - as well as Namespace URIs, will have been interned - using java.lang.String.intern. This supports fast - testing of equality/inequality against string constants, - rather than forcing slower calls to String.equals(). - | -
unicode-normalization-checking | -read/write | -false | -Controls whether the parser reports Unicode normalization - errors as described in section 2.13 and Appendix B of the - XML 1.1 Recommendation. If true, Unicode normalization - errors are reported using the ErrorHandler.error() callback. - Such errors are not fatal in themselves (though, obviously, - other Unicode-related encoding errors may be). - | -
use-attributes2 | -read-only | -not applicable | -Returns "true" if the Attributes objects passed by - this parser in ContentHandler.startElement() - implement the org.xml.sax.ext.Attributes2 interface. - That interface exposes additional DTD-related information, - such as whether the attribute was specified in the - source text rather than defaulted. - | -
use-locator2 | -read-only | -not applicable | -Returns "true" if the Locator objects passed by - this parser in ContentHandler.setDocumentLocator() - implement the org.xml.sax.ext.Locator2 interface. - That interface exposes additional entity information, - such as the character encoding and XML version used. - | -
use-entity-resolver2 | -read/write | -true | -Returns "true" if, when setEntityResolver is given - an object implementing the org.xml.sax.ext.EntityResolver2 interface, - those new methods will be used. - Returns "false" to indicate that those methods will not be used. - | -
validation | -read/write | -unspecified | -Controls whether the parser is reporting all validity - errors; if true, all external entities will be read. - | -
xmlns-uris | -read/write | -false | -Controls whether, when the namespace-prefixes feature - is set, the parser treats namespace declaration attributes as - being in the http://www.w3.org/2000/xmlns/ namespace. - By default, SAX2 conforms to the original "Namespaces in XML" - Recommendation, which explicitly states that such attributes are - not in any namespace. - Setting this optional flag to "true" makes the SAX2 events conform to - a later backwards-incompatible revision of that recommendation, - placing those attributes in a namespace. - | -
xml-1.1 | -read-only | -not applicable | -Returns "true" if the parser supports both XML 1.1 and XML 1.0. - Returns "false" if the parser supports only XML 1.0. - | -
Support for the default values of the -namespaces and namespace-prefixes -properties is required. -Support for any other feature flags is entirely optional. -
- -For default values not specified by SAX2, -each XMLReader implementation specifies its default, -or may choose not to expose the feature flag. -Unless otherwise specified here, -implementations may support changing current values -of these standard feature flags, but not while parsing. -
- - For parser interface characteristics that are described
-as objects, a separate namespace is defined. The
-objects in this namespace are again identified by URI, and
-the standard property URIs have the prefix
-http://xml.org/sax/properties/
before an identifier such as
-lexical-handler
or
-dom-node
. Manage those properties using
-setProperty(). Those identifiers are:
Property ID | -Description | -
---|---|
declaration-handler | -Used to see most DTD declarations except those treated - as lexical ("document element name is ...") or which are - mandatory for all SAX parsers (DTDHandler). - The Object must implement org.xml.sax.ext.DeclHandler. - | -
document-xml-version | -May be examined only during a parse, after the startDocument() - callback has been completed; read-only. This property is a - literal string describing the actual XML version of the document, - such as "1.0" or "1.1". - | -
dom-node | -For "DOM Walker" style parsers, which ignore their - parser.parse() parameters, this is used to - specify the DOM (sub)tree being walked by the parser. - The Object must implement the - org.w3c.dom.Node interface. - | -
lexical-handler | -Used to see some syntax events that are essential in some - applications: comments, CDATA delimiters, selected general - entity inclusions, and the start and end of the DTD - (and declaration of document element name). - The Object must implement org.xml.sax.ext.LexicalHandler. - | -
xml-string | -Readable only during a parser callback, this exposes a TBS - chunk of characters responsible for the current event. | -
All of these standard properties are optional; -XMLReader implementations need not support them. -
- - \ No newline at end of file diff --git a/libjava/external/w3c_dom/COPYRIGHT.html b/libjava/external/w3c_dom/COPYRIGHT.html deleted file mode 100644 index c7e0e497a5f..00000000000 --- a/libjava/external/w3c_dom/COPYRIGHT.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - -- The DOM bindings are published under the W3C Software Copyright Notice - and License. The software license requires "Notice of any changes or - modifications to the W3C files, including the date changes were made." - Consequently, modified versions of the DOM bindings must document that - they do not conform to the W3C standard; in the case of the IDL - definitions, the pragma prefix can no longer be 'w3c.org'; in the case of - the Java language binding, the package names can no longer be in the - 'org.w3c' package. -
-- Note: The original version of the W3C Software Copyright Notice - and License could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720 -
-- This W3C work (including software, documents, or other related items) is - being provided by the copyright holders under the following license. By - obtaining, using and/or copying this work, you (the licensee) agree that - you have read, understood, and will comply with the following terms and - conditions: -
-- Permission to use, copy, and modify this software and its documentation, - with or without modification, for any purpose and without fee or - royalty is hereby granted, provided that you include the following on ALL - copies of the software and documentation or portions thereof, including - modifications, that you make: -
-- THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT - HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS - FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR - DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, - TRADEMARKS OR OTHER RIGHTS. -
-- COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR - CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR - DOCUMENTATION. -
-- The name and trademarks of copyright holders may NOT be used in - advertising or publicity pertaining to the software without specific, - written prior permission. Title to copyright in this software and any - associated documentation will at all times remain with copyright - holders. -
- - diff --git a/libjava/external/w3c_dom/Makefile.am b/libjava/external/w3c_dom/Makefile.am deleted file mode 100644 index 82f6b76a0b2..00000000000 --- a/libjava/external/w3c_dom/Makefile.am +++ /dev/null @@ -1,186 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -AUTOMAKE_OPTIONS = foreign subdir-objects - -# May be used by various substitution variables. -gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) - -## The compiler with whatever flags we want for both -c and -C -## compiles. -GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated -fclasspath= -fbootclasspath=$(BOOTCLASSPATH) - -BOOTCLASSPATH = $(here)'$(CLASSPATH_SEPARATOR)'$(srcdir)'$(CLASSPATH_SEPARATOR)'$(top_srcdir)'$(CLASSPATH_SEPARATOR)'$(top_builddir) - -AM_GCJFLAGS = \ - -B$(top_builddir) \ - @LIBGCJ_JAVAFLAGS@ \ - -fclasspath= -fbootclasspath=$(BOOTCLASSPATH) \ - --encoding=UTF-8 \ - -Wno-deprecated - -BUILT_SOURCES = classes.stamp - -w3c.jar: classes.stamp - find org -name '*.class' -print | $(ZIP) -cfME@ $@ - -classes.stamp: $(source_files) - here=`pwd`; cd $(srcdir); \ - $(GCJ_WITH_FLAGS) -C -d $$here $(source_files) - echo > classes.stamp - -mostlyclean-local: - -find . -name '*.class' | xargs rm - -rm classes.stamp w3c.jar - -noinst_LTLIBRARIES = libw3c-gcj.la - -libw3c_gcj_la_SOURCES = w3c.jar -libw3c_gcj_la_GCJFLAGS = -findirect-dispatch -fbootstrap-classes $(AM_GCJFLAGS) - -source_files = \ -org/w3c/dom/xpath/XPathNamespace.java \ -org/w3c/dom/xpath/XPathResult.java \ -org/w3c/dom/xpath/XPathException.java \ -org/w3c/dom/xpath/XPathExpression.java \ -org/w3c/dom/xpath/XPathNSResolver.java \ -org/w3c/dom/xpath/XPathEvaluator.java \ -org/w3c/dom/DOMException.java \ -org/w3c/dom/Comment.java \ -org/w3c/dom/stylesheets/DocumentStyle.java \ -org/w3c/dom/stylesheets/MediaList.java \ -org/w3c/dom/stylesheets/LinkStyle.java \ -org/w3c/dom/stylesheets/StyleSheet.java \ -org/w3c/dom/stylesheets/StyleSheetList.java \ -org/w3c/dom/Attr.java \ -org/w3c/dom/Notation.java \ -org/w3c/dom/TypeInfo.java \ -org/w3c/dom/html2/HTMLIsIndexElement.java \ -org/w3c/dom/html2/HTMLTableColElement.java \ -org/w3c/dom/html2/HTMLLinkElement.java \ -org/w3c/dom/html2/HTMLTitleElement.java \ -org/w3c/dom/html2/HTMLBRElement.java \ -org/w3c/dom/html2/HTMLHeadElement.java \ -org/w3c/dom/html2/HTMLHtmlElement.java \ -org/w3c/dom/html2/HTMLScriptElement.java \ -org/w3c/dom/html2/HTMLTableRowElement.java \ -org/w3c/dom/html2/HTMLOptionsCollection.java \ -org/w3c/dom/html2/HTMLTableCellElement.java \ -org/w3c/dom/html2/HTMLDListElement.java \ -org/w3c/dom/html2/HTMLFieldSetElement.java \ -org/w3c/dom/html2/HTMLImageElement.java \ -org/w3c/dom/html2/HTMLHRElement.java \ -org/w3c/dom/html2/HTMLModElement.java \ -org/w3c/dom/html2/HTMLHeadingElement.java \ -org/w3c/dom/html2/HTMLTableElement.java \ -org/w3c/dom/html2/HTMLAreaElement.java \ -org/w3c/dom/html2/HTMLOptGroupElement.java \ -org/w3c/dom/html2/HTMLIFrameElement.java \ -org/w3c/dom/html2/HTMLDirectoryElement.java \ -org/w3c/dom/html2/HTMLParamElement.java \ -org/w3c/dom/html2/HTMLLegendElement.java \ -org/w3c/dom/html2/HTMLFrameElement.java \ -org/w3c/dom/html2/HTMLFormElement.java \ -org/w3c/dom/html2/HTMLStyleElement.java \ -org/w3c/dom/html2/HTMLFrameSetElement.java \ -org/w3c/dom/html2/HTMLCollection.java \ -org/w3c/dom/html2/HTMLAnchorElement.java \ -org/w3c/dom/html2/HTMLLabelElement.java \ -org/w3c/dom/html2/HTMLBodyElement.java \ -org/w3c/dom/html2/HTMLOptionElement.java \ -org/w3c/dom/html2/HTMLTableSectionElement.java \ -org/w3c/dom/html2/HTMLAppletElement.java \ -org/w3c/dom/html2/HTMLSelectElement.java \ -org/w3c/dom/html2/HTMLMetaElement.java \ -org/w3c/dom/html2/HTMLMenuElement.java \ -org/w3c/dom/html2/HTMLDivElement.java \ -org/w3c/dom/html2/HTMLLIElement.java \ -org/w3c/dom/html2/HTMLFontElement.java \ -org/w3c/dom/html2/HTMLOListElement.java \ -org/w3c/dom/html2/HTMLBaseFontElement.java \ -org/w3c/dom/html2/HTMLElement.java \ -org/w3c/dom/html2/HTMLTableCaptionElement.java \ -org/w3c/dom/html2/HTMLTextAreaElement.java \ -org/w3c/dom/html2/HTMLPreElement.java \ -org/w3c/dom/html2/HTMLObjectElement.java \ -org/w3c/dom/html2/HTMLBaseElement.java \ -org/w3c/dom/html2/HTMLUListElement.java \ -org/w3c/dom/html2/HTMLMapElement.java \ -org/w3c/dom/html2/HTMLParagraphElement.java \ -org/w3c/dom/html2/HTMLButtonElement.java \ -org/w3c/dom/html2/HTMLQuoteElement.java \ -org/w3c/dom/html2/HTMLInputElement.java \ -org/w3c/dom/html2/HTMLDocument.java \ -org/w3c/dom/ls/LSParser.java \ -org/w3c/dom/ls/LSSerializerFilter.java \ -org/w3c/dom/ls/LSLoadEvent.java \ -org/w3c/dom/ls/DOMImplementationLS.java \ -org/w3c/dom/ls/LSException.java \ -org/w3c/dom/ls/LSSerializer.java \ -org/w3c/dom/ls/LSResourceResolver.java \ -org/w3c/dom/ls/LSOutput.java \ -org/w3c/dom/ls/LSInput.java \ -org/w3c/dom/ls/LSProgressEvent.java \ -org/w3c/dom/ls/LSParserFilter.java \ -org/w3c/dom/DOMLocator.java \ -org/w3c/dom/DOMStringList.java \ -org/w3c/dom/DocumentFragment.java \ -org/w3c/dom/events/MutationEvent.java \ -org/w3c/dom/events/UIEvent.java \ -org/w3c/dom/events/EventListener.java \ -org/w3c/dom/events/Event.java \ -org/w3c/dom/events/MouseEvent.java \ -org/w3c/dom/events/EventTarget.java \ -org/w3c/dom/events/DocumentEvent.java \ -org/w3c/dom/events/EventException.java \ -org/w3c/dom/EntityReference.java \ -org/w3c/dom/DOMErrorHandler.java \ -org/w3c/dom/views/AbstractView.java \ -org/w3c/dom/views/DocumentView.java \ -org/w3c/dom/DOMError.java \ -org/w3c/dom/bootstrap/DOMImplementationRegistry.java \ -org/w3c/dom/traversal/TreeWalker.java \ -org/w3c/dom/traversal/NodeFilter.java \ -org/w3c/dom/traversal/DocumentTraversal.java \ -org/w3c/dom/traversal/NodeIterator.java \ -org/w3c/dom/CharacterData.java \ -org/w3c/dom/DOMConfiguration.java \ -org/w3c/dom/css/CSSRule.java \ -org/w3c/dom/css/Rect.java \ -org/w3c/dom/css/CSSStyleSheet.java \ -org/w3c/dom/css/CSSFontFaceRule.java \ -org/w3c/dom/css/CSSPrimitiveValue.java \ -org/w3c/dom/css/CSSRuleList.java \ -org/w3c/dom/css/ViewCSS.java \ -org/w3c/dom/css/CSSStyleRule.java \ -org/w3c/dom/css/CSSUnknownRule.java \ -org/w3c/dom/css/RGBColor.java \ -org/w3c/dom/css/ElementCSSInlineStyle.java \ -org/w3c/dom/css/CSSMediaRule.java \ -org/w3c/dom/css/CSS2Properties.java \ -org/w3c/dom/css/CSSValue.java \ -org/w3c/dom/css/CSSStyleDeclaration.java \ -org/w3c/dom/css/DOMImplementationCSS.java \ -org/w3c/dom/css/CSSCharsetRule.java \ -org/w3c/dom/css/Counter.java \ -org/w3c/dom/css/CSSPageRule.java \ -org/w3c/dom/css/DocumentCSS.java \ -org/w3c/dom/css/CSSValueList.java \ -org/w3c/dom/css/CSSImportRule.java \ -org/w3c/dom/NameList.java \ -org/w3c/dom/Element.java \ -org/w3c/dom/Document.java \ -org/w3c/dom/ranges/Range.java \ -org/w3c/dom/ranges/RangeException.java \ -org/w3c/dom/ranges/DocumentRange.java \ -org/w3c/dom/DOMImplementationList.java \ -org/w3c/dom/Entity.java \ -org/w3c/dom/UserDataHandler.java \ -org/w3c/dom/DOMImplementation.java \ -org/w3c/dom/CDATASection.java \ -org/w3c/dom/ProcessingInstruction.java \ -org/w3c/dom/Node.java \ -org/w3c/dom/NamedNodeMap.java \ -org/w3c/dom/NodeList.java \ -org/w3c/dom/Text.java \ -org/w3c/dom/DocumentType.java \ -org/w3c/dom/DOMImplementationSource.java diff --git a/libjava/external/w3c_dom/Makefile.in b/libjava/external/w3c_dom/Makefile.in deleted file mode 100644 index 13968d84772..00000000000 --- a/libjava/external/w3c_dom/Makefile.in +++ /dev/null @@ -1,741 +0,0 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -SOURCES = $(libw3c_gcj_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = external/w3c_dom -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ - $(top_srcdir)/../config/depstand.m4 \ - $(top_srcdir)/../config/gxx-include-dir.m4 \ - $(top_srcdir)/../config/iconv.m4 \ - $(top_srcdir)/../config/lcmessage.m4 \ - $(top_srcdir)/../config/lead-dot.m4 \ - $(top_srcdir)/../config/lib-ld.m4 \ - $(top_srcdir)/../config/lib-link.m4 \ - $(top_srcdir)/../config/lib-prefix.m4 $(top_srcdir)/pkg.m4 \ - $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/../config/no-executables.m4 \ - $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -CONFIG_HEADER = $(top_builddir)/include/config.h \ - $(top_builddir)/gcj/libgcj-config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libw3c_gcj_la_LIBADD = -am_libw3c_gcj_la_OBJECTS = libw3c_gcj_la-w3c.lo -libw3c_gcj_la_OBJECTS = $(am_libw3c_gcj_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/gcj -depcomp = $(SHELL) $(top_srcdir)/../depcomp -am__depfiles_maybe = depfiles -GCJCOMPILE = $(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS) -LTGCJCOMPILE = $(LIBTOOL) --mode=compile $(GCJ) $(AM_GCJFLAGS) \ - $(GCJFLAGS) -GCJLD = $(GCJ) -GCJLINK = $(LIBTOOL) --mode=link $(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libw3c_gcj_la_SOURCES) -DIST_SOURCES = $(libw3c_gcj_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BACKTRACESPEC = @BACKTRACESPEC@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECKREFSPEC = @CHECKREFSPEC@ -CLASSPATH_SEPARATOR = @CLASSPATH_SEPARATOR@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DIRLTDL = @DIRLTDL@ -DIVIDESPEC = @DIVIDESPEC@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXCEPTIONSPEC = @EXCEPTIONSPEC@ -EXEEXT = @EXEEXT@ -GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@ -GCDEPS = @GCDEPS@ -GCINCS = @GCINCS@ -GCJ = @GCJ@ -GCJDEPMODE = @GCJDEPMODE@ -GCJFLAGS = @GCJFLAGS@ -GCJH = @GCJH@ -GCJVERSION = @GCJVERSION@ -GCLIBS = @GCLIBS@ -GCSPEC = @GCSPEC@ -GCTESTSPEC = @GCTESTSPEC@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_LIBS = @GLIB_LIBS@ -GTK_AWT_FALSE = @GTK_AWT_FALSE@ -GTK_AWT_TRUE = @GTK_AWT_TRUE@ -GTK_CAIRO_FALSE = @GTK_CAIRO_FALSE@ -GTK_CAIRO_TRUE = @GTK_CAIRO_TRUE@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HASH_SYNC_SPEC = @HASH_SYNC_SPEC@ -IEEESPEC = @IEEESPEC@ -INCLTDL = @INCLTDL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTERPRETER = @INTERPRETER@ -JAVA_HOME = @JAVA_HOME@ -JAVA_HOME_SET_FALSE = @JAVA_HOME_SET_FALSE@ -JAVA_HOME_SET_TRUE = @JAVA_HOME_SET_TRUE@ -JC1GCSPEC = @JC1GCSPEC@ -LDFLAGS = @LDFLAGS@ -LIBART_CFLAGS = @LIBART_CFLAGS@ -LIBART_LIBS = @LIBART_LIBS@ -LIBFFI = @LIBFFI@ -LIBFFIINCS = @LIBFFIINCS@ -LIBGCJDEBUG = @LIBGCJDEBUG@ -LIBGCJTESTSPEC = @LIBGCJTESTSPEC@ -LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@ -LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@ -LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@ -LIBGCJ_LD_SYMBOLIC = @LIBGCJ_LD_SYMBOLIC@ -LIBICONV = @LIBICONV@ -LIBLTDL = @LIBLTDL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -NATIVE_FALSE = @NATIVE_FALSE@ -NATIVE_TRUE = @NATIVE_TRUE@ -NEEDS_DATA_START_FALSE = @NEEDS_DATA_START_FALSE@ -NEEDS_DATA_START_TRUE = @NEEDS_DATA_START_TRUE@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@ -PANGOFT2_LIBS = @PANGOFT2_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PLATFORM_INNER_NAT_HDRS = @PLATFORM_INNER_NAT_HDRS@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SUPPLY_BACKTRACE_FALSE = @SUPPLY_BACKTRACE_FALSE@ -SUPPLY_BACKTRACE_TRUE = @SUPPLY_BACKTRACE_TRUE@ -SYSDEP_SOURCES = @SYSDEP_SOURCES@ -SYSTEMSPEC = @SYSTEMSPEC@ -SYS_ZLIBS = @SYS_ZLIBS@ -TESTSUBDIR_FALSE = @TESTSUBDIR_FALSE@ -TESTSUBDIR_TRUE = @TESTSUBDIR_TRUE@ -THREADCXXFLAGS = @THREADCXXFLAGS@ -THREADDEPS = @THREADDEPS@ -THREADINCS = @THREADINCS@ -THREADLDFLAGS = @THREADLDFLAGS@ -THREADLIBS = @THREADLIBS@ -THREADSPEC = @THREADSPEC@ -TOOLKIT = @TOOLKIT@ -USING_BOEHMGC_FALSE = @USING_BOEHMGC_FALSE@ -USING_BOEHMGC_TRUE = @USING_BOEHMGC_TRUE@ -USING_DARWIN_CRT_FALSE = @USING_DARWIN_CRT_FALSE@ -USING_DARWIN_CRT_TRUE = @USING_DARWIN_CRT_TRUE@ -USING_GCC_FALSE = @USING_GCC_FALSE@ -USING_GCC_TRUE = @USING_GCC_TRUE@ -USING_NOGC_FALSE = @USING_NOGC_FALSE@ -USING_NOGC_TRUE = @USING_NOGC_TRUE@ -USING_NO_THREADS_FALSE = @USING_NO_THREADS_FALSE@ -USING_NO_THREADS_TRUE = @USING_NO_THREADS_TRUE@ -USING_POSIX_PLATFORM_FALSE = @USING_POSIX_PLATFORM_FALSE@ -USING_POSIX_PLATFORM_TRUE = @USING_POSIX_PLATFORM_TRUE@ -USING_POSIX_THREADS_FALSE = @USING_POSIX_THREADS_FALSE@ -USING_POSIX_THREADS_TRUE = @USING_POSIX_THREADS_TRUE@ -USING_WIN32_PLATFORM_FALSE = @USING_WIN32_PLATFORM_FALSE@ -USING_WIN32_PLATFORM_TRUE = @USING_WIN32_PLATFORM_TRUE@ -USING_WIN32_THREADS_FALSE = @USING_WIN32_THREADS_FALSE@ -USING_WIN32_THREADS_TRUE = @USING_WIN32_THREADS_TRUE@ -VERSION = @VERSION@ -XLIB_AWT_FALSE = @XLIB_AWT_FALSE@ -XLIB_AWT_TRUE = @XLIB_AWT_TRUE@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZINCS = @ZINCS@ -ZIP = @ZIP@ -ZLIBS = @ZLIBS@ -ZLIBSPEC = @ZLIBSPEC@ -ZLIBTESTSPEC = @ZLIBTESTSPEC@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_AS = @ac_ct_AS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_GCJ = @ac_ct_GCJ@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__fastdepGCJ_FALSE = @am__fastdepGCJ_FALSE@ -am__fastdepGCJ_TRUE = @am__fastdepGCJ_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_subdir = @build_subdir@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -gxx_include_dir = @gxx_include_dir@ -here = @here@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_subdir = @host_subdir@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libgcj_basedir = @libgcj_basedir@ -libstdcxx_incdir = @libstdcxx_incdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mkinstalldirs = @mkinstalldirs@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_noncanonical = @target_noncanonical@ -target_os = @target_os@ -target_subdir = @target_subdir@ -target_vendor = @target_vendor@ -toolexecdir = @toolexecdir@ -toolexeclibdir = @toolexeclibdir@ -toolexecmainlibdir = @toolexecmainlibdir@ -AUTOMAKE_OPTIONS = foreign subdir-objects - -# May be used by various substitution variables. -gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) -GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated -fclasspath= -fbootclasspath=$(BOOTCLASSPATH) -BOOTCLASSPATH = $(here)'$(CLASSPATH_SEPARATOR)'$(srcdir)'$(CLASSPATH_SEPARATOR)'$(top_srcdir)'$(CLASSPATH_SEPARATOR)'$(top_builddir) -AM_GCJFLAGS = \ - -B$(top_builddir) \ - @LIBGCJ_JAVAFLAGS@ \ - -fclasspath= -fbootclasspath=$(BOOTCLASSPATH) \ - --encoding=UTF-8 \ - -Wno-deprecated - -BUILT_SOURCES = classes.stamp -noinst_LTLIBRARIES = libw3c-gcj.la -libw3c_gcj_la_SOURCES = w3c.jar -libw3c_gcj_la_GCJFLAGS = -findirect-dispatch -fbootstrap-classes $(AM_GCJFLAGS) -source_files = \ -org/w3c/dom/xpath/XPathNamespace.java \ -org/w3c/dom/xpath/XPathResult.java \ -org/w3c/dom/xpath/XPathException.java \ -org/w3c/dom/xpath/XPathExpression.java \ -org/w3c/dom/xpath/XPathNSResolver.java \ -org/w3c/dom/xpath/XPathEvaluator.java \ -org/w3c/dom/DOMException.java \ -org/w3c/dom/Comment.java \ -org/w3c/dom/stylesheets/DocumentStyle.java \ -org/w3c/dom/stylesheets/MediaList.java \ -org/w3c/dom/stylesheets/LinkStyle.java \ -org/w3c/dom/stylesheets/StyleSheet.java \ -org/w3c/dom/stylesheets/StyleSheetList.java \ -org/w3c/dom/Attr.java \ -org/w3c/dom/Notation.java \ -org/w3c/dom/TypeInfo.java \ -org/w3c/dom/html2/HTMLIsIndexElement.java \ -org/w3c/dom/html2/HTMLTableColElement.java \ -org/w3c/dom/html2/HTMLLinkElement.java \ -org/w3c/dom/html2/HTMLTitleElement.java \ -org/w3c/dom/html2/HTMLBRElement.java \ -org/w3c/dom/html2/HTMLHeadElement.java \ -org/w3c/dom/html2/HTMLHtmlElement.java \ -org/w3c/dom/html2/HTMLScriptElement.java \ -org/w3c/dom/html2/HTMLTableRowElement.java \ -org/w3c/dom/html2/HTMLOptionsCollection.java \ -org/w3c/dom/html2/HTMLTableCellElement.java \ -org/w3c/dom/html2/HTMLDListElement.java \ -org/w3c/dom/html2/HTMLFieldSetElement.java \ -org/w3c/dom/html2/HTMLImageElement.java \ -org/w3c/dom/html2/HTMLHRElement.java \ -org/w3c/dom/html2/HTMLModElement.java \ -org/w3c/dom/html2/HTMLHeadingElement.java \ -org/w3c/dom/html2/HTMLTableElement.java \ -org/w3c/dom/html2/HTMLAreaElement.java \ -org/w3c/dom/html2/HTMLOptGroupElement.java \ -org/w3c/dom/html2/HTMLIFrameElement.java \ -org/w3c/dom/html2/HTMLDirectoryElement.java \ -org/w3c/dom/html2/HTMLParamElement.java \ -org/w3c/dom/html2/HTMLLegendElement.java \ -org/w3c/dom/html2/HTMLFrameElement.java \ -org/w3c/dom/html2/HTMLFormElement.java \ -org/w3c/dom/html2/HTMLStyleElement.java \ -org/w3c/dom/html2/HTMLFrameSetElement.java \ -org/w3c/dom/html2/HTMLCollection.java \ -org/w3c/dom/html2/HTMLAnchorElement.java \ -org/w3c/dom/html2/HTMLLabelElement.java \ -org/w3c/dom/html2/HTMLBodyElement.java \ -org/w3c/dom/html2/HTMLOptionElement.java \ -org/w3c/dom/html2/HTMLTableSectionElement.java \ -org/w3c/dom/html2/HTMLAppletElement.java \ -org/w3c/dom/html2/HTMLSelectElement.java \ -org/w3c/dom/html2/HTMLMetaElement.java \ -org/w3c/dom/html2/HTMLMenuElement.java \ -org/w3c/dom/html2/HTMLDivElement.java \ -org/w3c/dom/html2/HTMLLIElement.java \ -org/w3c/dom/html2/HTMLFontElement.java \ -org/w3c/dom/html2/HTMLOListElement.java \ -org/w3c/dom/html2/HTMLBaseFontElement.java \ -org/w3c/dom/html2/HTMLElement.java \ -org/w3c/dom/html2/HTMLTableCaptionElement.java \ -org/w3c/dom/html2/HTMLTextAreaElement.java \ -org/w3c/dom/html2/HTMLPreElement.java \ -org/w3c/dom/html2/HTMLObjectElement.java \ -org/w3c/dom/html2/HTMLBaseElement.java \ -org/w3c/dom/html2/HTMLUListElement.java \ -org/w3c/dom/html2/HTMLMapElement.java \ -org/w3c/dom/html2/HTMLParagraphElement.java \ -org/w3c/dom/html2/HTMLButtonElement.java \ -org/w3c/dom/html2/HTMLQuoteElement.java \ -org/w3c/dom/html2/HTMLInputElement.java \ -org/w3c/dom/html2/HTMLDocument.java \ -org/w3c/dom/ls/LSParser.java \ -org/w3c/dom/ls/LSSerializerFilter.java \ -org/w3c/dom/ls/LSLoadEvent.java \ -org/w3c/dom/ls/DOMImplementationLS.java \ -org/w3c/dom/ls/LSException.java \ -org/w3c/dom/ls/LSSerializer.java \ -org/w3c/dom/ls/LSResourceResolver.java \ -org/w3c/dom/ls/LSOutput.java \ -org/w3c/dom/ls/LSInput.java \ -org/w3c/dom/ls/LSProgressEvent.java \ -org/w3c/dom/ls/LSParserFilter.java \ -org/w3c/dom/DOMLocator.java \ -org/w3c/dom/DOMStringList.java \ -org/w3c/dom/DocumentFragment.java \ -org/w3c/dom/events/MutationEvent.java \ -org/w3c/dom/events/UIEvent.java \ -org/w3c/dom/events/EventListener.java \ -org/w3c/dom/events/Event.java \ -org/w3c/dom/events/MouseEvent.java \ -org/w3c/dom/events/EventTarget.java \ -org/w3c/dom/events/DocumentEvent.java \ -org/w3c/dom/events/EventException.java \ -org/w3c/dom/EntityReference.java \ -org/w3c/dom/DOMErrorHandler.java \ -org/w3c/dom/views/AbstractView.java \ -org/w3c/dom/views/DocumentView.java \ -org/w3c/dom/DOMError.java \ -org/w3c/dom/bootstrap/DOMImplementationRegistry.java \ -org/w3c/dom/traversal/TreeWalker.java \ -org/w3c/dom/traversal/NodeFilter.java \ -org/w3c/dom/traversal/DocumentTraversal.java \ -org/w3c/dom/traversal/NodeIterator.java \ -org/w3c/dom/CharacterData.java \ -org/w3c/dom/DOMConfiguration.java \ -org/w3c/dom/css/CSSRule.java \ -org/w3c/dom/css/Rect.java \ -org/w3c/dom/css/CSSStyleSheet.java \ -org/w3c/dom/css/CSSFontFaceRule.java \ -org/w3c/dom/css/CSSPrimitiveValue.java \ -org/w3c/dom/css/CSSRuleList.java \ -org/w3c/dom/css/ViewCSS.java \ -org/w3c/dom/css/CSSStyleRule.java \ -org/w3c/dom/css/CSSUnknownRule.java \ -org/w3c/dom/css/RGBColor.java \ -org/w3c/dom/css/ElementCSSInlineStyle.java \ -org/w3c/dom/css/CSSMediaRule.java \ -org/w3c/dom/css/CSS2Properties.java \ -org/w3c/dom/css/CSSValue.java \ -org/w3c/dom/css/CSSStyleDeclaration.java \ -org/w3c/dom/css/DOMImplementationCSS.java \ -org/w3c/dom/css/CSSCharsetRule.java \ -org/w3c/dom/css/Counter.java \ -org/w3c/dom/css/CSSPageRule.java \ -org/w3c/dom/css/DocumentCSS.java \ -org/w3c/dom/css/CSSValueList.java \ -org/w3c/dom/css/CSSImportRule.java \ -org/w3c/dom/NameList.java \ -org/w3c/dom/Element.java \ -org/w3c/dom/Document.java \ -org/w3c/dom/ranges/Range.java \ -org/w3c/dom/ranges/RangeException.java \ -org/w3c/dom/ranges/DocumentRange.java \ -org/w3c/dom/DOMImplementationList.java \ -org/w3c/dom/Entity.java \ -org/w3c/dom/UserDataHandler.java \ -org/w3c/dom/DOMImplementation.java \ -org/w3c/dom/CDATASection.java \ -org/w3c/dom/ProcessingInstruction.java \ -org/w3c/dom/Node.java \ -org/w3c/dom/NamedNodeMap.java \ -org/w3c/dom/NodeList.java \ -org/w3c/dom/Text.java \ -org/w3c/dom/DocumentType.java \ -org/w3c/dom/DOMImplementationSource.java - -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .jar .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign external/w3c_dom/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign external/w3c_dom/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libw3c-gcj.la: $(libw3c_gcj_la_OBJECTS) $(libw3c_gcj_la_DEPENDENCIES) - $(GCJLINK) $(libw3c_gcj_la_LDFLAGS) $(libw3c_gcj_la_OBJECTS) $(libw3c_gcj_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libw3c_gcj_la-w3c.Plo@am__quote@ - -.jar.o: -@am__fastdepGCJ_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`; \ -@am__fastdepGCJ_TRUE@ if $(GCJCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ -@am__fastdepGCJ_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepGCJ_FALSE@ $(GCJCOMPILE) -c -o $@ $< - -.jar.obj: -@am__fastdepGCJ_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`; \ -@am__fastdepGCJ_TRUE@ if $(GCJCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepGCJ_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepGCJ_FALSE@ $(GCJCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.jar.lo: -@am__fastdepGCJ_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ -@am__fastdepGCJ_TRUE@ if $(LTGCJCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ -@am__fastdepGCJ_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepGCJ_FALSE@ $(LTGCJCOMPILE) -c -o $@ $< - -libw3c_gcj_la-w3c.lo: w3c.jar -@am__fastdepGCJ_TRUE@ if $(LIBTOOL) --mode=compile $(GCJ) $(libw3c_gcj_la_GCJFLAGS) $(GCJFLAGS) -MT libw3c_gcj_la-w3c.lo -MD -MP -MF "$(DEPDIR)/libw3c_gcj_la-w3c.Tpo" -c -o libw3c_gcj_la-w3c.lo `test -f 'w3c.jar' || echo '$(srcdir)/'`w3c.jar; \ -@am__fastdepGCJ_TRUE@ then mv -f "$(DEPDIR)/libw3c_gcj_la-w3c.Tpo" "$(DEPDIR)/libw3c_gcj_la-w3c.Plo"; else rm -f "$(DEPDIR)/libw3c_gcj_la-w3c.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ source='w3c.jar' object='libw3c_gcj_la-w3c.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepGCJ_FALSE@ DEPDIR=$(DEPDIR) $(GCJDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepGCJ_FALSE@ $(LIBTOOL) --mode=compile $(GCJ) $(libw3c_gcj_la_GCJFLAGS) $(GCJFLAGS) -c -o libw3c_gcj_la-w3c.lo `test -f 'w3c.jar' || echo '$(srcdir)/'`w3c.jar - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-local - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - mostlyclean-local pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - - -w3c.jar: classes.stamp - find org -name '*.class' -print | $(ZIP) -cfME@ $@ - -classes.stamp: $(source_files) - here=`pwd`; cd $(srcdir); \ - $(GCJ_WITH_FLAGS) -C -d $$here $(source_files) - echo > classes.stamp - -mostlyclean-local: - -find . -name '*.class' | xargs rm - -rm classes.stamp w3c.jar -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libjava/external/w3c_dom/README b/libjava/external/w3c_dom/README deleted file mode 100644 index 6670651efc9..00000000000 --- a/libjava/external/w3c_dom/README +++ /dev/null @@ -1,97 +0,0 @@ -Bindings for the Document Object Model (DOM). -DOM is not maintained as part of GNU Classpath, but is used with GNU Classpath. - -The packages includes are: - -Document Object Model (DOM) Level 3 Core Specification -http://www.w3.org/TR/DOM-Level-3-Core/ -(07 April 2004) - -Document Object Model (DOM) Level 3 Load and Save Specification -http://www.w3.org/TR/DOM-Level-3-LS/ -(07 April 2004) - -Document Object Model (DOM) Level 2 Events Specification -http://www.w3.org/TR/DOM-Level-2-Events/ -(13 November 2000) -Latest errata: 20021016 - -Document Object Model (DOM) Level 2 Views Specification -http://www.w3.org/TR/DOM-Level-2-Views/ -(13 November 2000) -Latest errata: 20021016 - -Document Object Model (DOM) Level 2 Style Specification -http://www.w3.org/TR/DOM-Level-2-Style/ -(13 November 2000) -Latest errata: 20021016 - -Document Object Model (DOM) Level 2 Traversal and Range Specification -http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ -(13 November 2000) -Latest errata: 20021016 - -Document Object Model (DOM) Level 2 HTML Specification -http://www.w3.org/TR/DOM-Level-2-HTML/ -(09 January 2003) - -Document Object Model (DOM) Level 3 XPath Specification -http://www.w3.org/TR/DOM-Level-3-XPath/ -(26 February 2004) - -Errata can be found at: -http://www.w3.org/2000/11/DOM-Level-2-errata -http://www.w3.org/2004/01/DOM-Level-3-errata - -The only change to the sources is setting the additional fallback for -org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance() to -gnu.xml.dom.ImplementationSource. - -When importing new versions don't forget to update the Makefile.am -to list any new files (or to remove old ones). - -All files are distributed under the following -W3C Software Short Notice: - - Copyright (c) 2004 World Wide Web Consortium, - - (Massachusetts Institute of Technology, European Research Consortium for - Informatics and Mathematics, Keio University). All Rights Reserved. This - work is distributed under the W3C(r) Software License [1] in the hope that - it will be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 - - Permission to copy, modify, and distribute this software and its - documentation, with or without modification, for any purpose and - without fee or royalty is hereby granted, provided that you include - the following on ALL copies of the software and documentation or - portions thereof, including modifications: - - 1. The full text of this NOTICE in a location viewable to users of - the redistributed or derivative work. - 2. Any pre-existing intellectual property disclaimers, notices, or - terms and conditions. If none exist, the W3C Software Short Notice - should be included (hypertext is preferred, text is permitted) within - the body of any redistributed or derivative code. - 3. Notice of any changes or modifications to the files, including - the date changes were made. (We recommend you provide URIs to the - location from which the code is derived.) - - THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT - HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, - INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS - FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR - DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, - TRADEMARKS OR OTHER RIGHTS. - - COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL - OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR - DOCUMENTATION. - - The name and trademarks of copyright holders may NOT be used in - advertising or publicity pertaining to the software without specific, - written prior permission. Title to copyright in this software and any - associated documentation will at all times remain with copyright - holders. diff --git a/libjava/external/w3c_dom/org/w3c/dom/Attr.java b/libjava/external/w3c_dom/org/w3c/dom/Attr.java deleted file mode 100644 index d9ed6ffe128..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/Attr.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2004 World Wide Web Consortium, - * - * (Massachusetts Institute of Technology, European Research Consortium for - * Informatics and Mathematics, Keio University). All Rights Reserved. This - * work is distributed under the W3C(r) Software License [1] in the hope that - * it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 - */ - -package org.w3c.dom; - -/** - * TheAttr
interface represents an attribute in an
- * Element
object. Typically the allowable values for the
- * attribute are defined in a schema associated with the document.
- * Attr
objects inherit the Node
interface, but
- * since they are not actually child nodes of the element they describe, the
- * DOM does not consider them part of the document tree. Thus, the
- * Node
attributes parentNode
,
- * previousSibling
, and nextSibling
have a
- * null
value for Attr
objects. The DOM takes the
- * view that attributes are properties of elements rather than having a
- * separate identity from the elements they are associated with; this should
- * make it more efficient to implement such features as default attributes
- * associated with all elements of a given type. Furthermore,
- * Attr
nodes may not be immediate children of a
- * DocumentFragment
. However, they can be associated with
- * Element
nodes contained within a
- * DocumentFragment
. In short, users and implementors of the
- * DOM need to be aware that Attr
nodes have some things in
- * common with other objects inheriting the Node
interface, but
- * they also are quite distinct.
- *
The attribute's effective value is determined as follows: if this
- * attribute has been explicitly assigned any value, that value is the
- * attribute's effective value; otherwise, if there is a declaration for
- * this attribute, and that declaration includes a default value, then that
- * default value is the attribute's effective value; otherwise, the
- * attribute does not exist on this element in the structure model until it
- * has been explicitly added. Note that the Node.nodeValue
- * attribute on the Attr
instance can also be used to retrieve
- * the string version of the attribute's value(s).
- *
If the attribute was not explicitly given a value in the instance
- * document but has a default value provided by the schema associated with
- * the document, an attribute node will be created with
- * specified
set to false
. Removing attribute
- * nodes for which a default value is defined in the schema generates a new
- * attribute node with the default value and specified
set to
- * false
. If validation occurred while invoking
- * Document.normalizeDocument()
, attribute nodes with
- * specified
equals to false
are recomputed
- * according to the default attribute values provided by the schema. If no
- * default value is associate with this attribute in the schema, the
- * attribute node is discarded.
- *
In XML, where the value of an attribute can contain entity references,
- * the child nodes of the Attr
node may be either
- * Text
or EntityReference
nodes (when these are
- * in use; see the description of EntityReference
for
- * discussion).
- *
The DOM Core represents all attribute values as simple strings, even if - * the DTD or schema associated with the document declares them of some - * specific type such as tokenized. - *
The way attribute value normalization is performed by the DOM
- * implementation depends on how much the implementation knows about the
- * schema in use. Typically, the value
and
- * nodeValue
attributes of an Attr
node initially
- * returns the normalized value given by the parser. It is also the case
- * after Document.normalizeDocument()
is called (assuming the
- * right options have been set). But this may not be the case after
- * mutation, independently of whether the mutation is performed by setting
- * the string value directly or by changing the Attr
child
- * nodes. In particular, this is true when character
- * references are involved, given that they are not represented in the DOM and they
- * impact attribute value normalization. On the other hand, if the
- * implementation knows about the schema in use when the attribute value is
- * changed, and it is of a different type than CDATA, it may normalize it
- * again at that time. This is especially true of specialized DOM
- * implementations, such as SVG DOM implementations, which store attribute
- * values in an internal form different from a string.
- *
The following table gives some examples of the relations between the - * attribute value in the original document (parsed attribute), the value as - * exposed in the DOM, and the serialization of the value: - *
Examples | - *Parsed - * attribute value | - *Initial Attr.value |
- * Serialized attribute value | - *
---|---|---|---|
- * Character reference | - *
- * "x²=5"- * |
- *
- * "x\u00b2=5"- * |
- *
- * "x²=5"- * |
- *
Built-in - * character entity | - *
- * "y<6"- * |
- *
- * "y<6"- * |
- *
- * "y<6"- * |
- *
Literal newline between | - *
- * - * "x=5 y=6"- * |
- *
- * "x=5 y=6"- * |
- *
- * "x=5 y=6"- * |
- *
Normalized newline between | - *
- * "x=5 - * y=6"- * |
- *
- * "x=5 y=6"- * |
- *
- * "x=5 y=6"- * |
- *
Entity e with literal newline |
- *
- * - * <!ENTITY e '... ...'> [...]> "x=5&e;y=6"- * |
- * Dependent on Implementation and Load Options | - *Dependent on Implementation and Load/Save Options | - *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Attr extends Node {
- /**
- * Returns the name of this attribute. If Node.localName
is
- * different from null
, this attribute is a qualified name.
- */
- public String getName();
-
- /**
- * True
if this attribute was explicitly given a value in
- * the instance document, false
otherwise. If the
- * application changed the value of this attribute node (even if it ends
- * up having the same value as the default value) then it is set to
- * true
. The implementation may handle attributes with
- * default values from other schemas similarly but applications should
- * use Document.normalizeDocument()
to guarantee this
- * information is up-to-date.
- */
- public boolean getSpecified();
-
- /**
- * On retrieval, the value of the attribute is returned as a string.
- * Character and general entity references are replaced with their
- * values. See also the method getAttribute
on the
- * Element
interface.
- *
On setting, this creates a Text
node with the unparsed
- * contents of the string, i.e. any characters that an XML processor
- * would recognize as markup are instead treated as literal text. See
- * also the method Element.setAttribute()
.
- *
Some specialized implementations, such as some [SVG 1.1]
- * implementations, may do normalization automatically, even after
- * mutation; in such case, the value on retrieval may differ from the
- * value on setting.
- */
- public String getValue();
- /**
- * On retrieval, the value of the attribute is returned as a string.
- * Character and general entity references are replaced with their
- * values. See also the method getAttribute
on the
- * Element
interface.
- *
On setting, this creates a Text
node with the unparsed
- * contents of the string, i.e. any characters that an XML processor
- * would recognize as markup are instead treated as literal text. See
- * also the method Element.setAttribute()
.
- *
Some specialized implementations, such as some [SVG 1.1]
- * implementations, may do normalization automatically, even after
- * mutation; in such case, the value on retrieval may differ from the
- * value on setting.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- */
- public void setValue(String value)
- throws DOMException;
-
- /**
- * The Element
node this attribute is attached to or
- * null
if this attribute is not in use.
- * @since DOM Level 2
- */
- public Element getOwnerElement();
-
- /**
- * The type information associated with this attribute. While the type
- * information contained in this attribute is guarantee to be correct
- * after loading the document or invoking
- * Document.normalizeDocument()
, schemaTypeInfo
- * may not be reliable if the node was moved.
- * @since DOM Level 3
- */
- public TypeInfo getSchemaTypeInfo();
-
- /**
- * Returns whether this attribute is known to be of type ID (i.e. to
- * contain an identifier for its owner element) or not. When it is and
- * its value is unique, the ownerElement
of this attribute
- * can be retrieved using the method Document.getElementById
- * . The implementation could use several ways to determine if an
- * attribute node is known to contain an identifier:
- *
Document.normalizeDocument()
, the post-schema-validation
- * infoset contributions (PSVI contributions) values are used to
- * determine if this attribute is a schema-determined ID attribute using
- * the
- * schema-determined ID definition in [XPointer]
- * .
- * Document.normalizeDocument()
, the infoset [type definition] value is used to determine if this attribute is a DTD-determined ID
- * attribute using the
- * DTD-determined ID definition in [XPointer]
- * .
- * Element.setIdAttribute()
,
- * Element.setIdAttributeNS()
, or
- * Element.setIdAttributeNode()
, i.e. it is an
- * user-determined ID attribute;
- * Note: XPointer framework (see section 3.2 in [XPointer] - * ) consider the DOM user-determined ID attribute as being part of the - * XPointer externally-determined ID definition. - *
Document.normalizeDocument()
, all user-determined ID
- * attributes are reset and all attribute nodes ID information are then
- * reevaluated in accordance to the schema used. As a consequence, if
- * the Attr.schemaTypeInfo
attribute contains an ID type,
- * isId
will always return true.
- * @since DOM Level 3
- */
- public boolean isId();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/CDATASection.java b/libjava/external/w3c_dom/org/w3c/dom/CDATASection.java
deleted file mode 100644
index 9267227e42d..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/CDATASection.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * CDATA sections are used to escape blocks of text containing characters that
- * would otherwise be regarded as markup. The only delimiter that is
- * recognized in a CDATA section is the "]]>" string that ends the CDATA
- * section. CDATA sections cannot be nested. Their primary purpose is for
- * including material such as XML fragments, without needing to escape all
- * the delimiters.
- * The CharacterData.data
attribute holds the text that is
- * contained by the CDATA section. Note that this may contain characters that need to be escaped outside of CDATA sections and
- * that, depending on the character encoding ("charset") chosen for
- * serialization, it may be impossible to write out some characters as part
- * of a CDATA section.
- *
The CDATASection
interface inherits from the
- * CharacterData
interface through the Text
- * interface. Adjacent CDATASection
nodes are not merged by use
- * of the normalize
method of the Node
interface.
- *
No lexical check is done on the content of a CDATA section and it is
- * therefore possible to have the character sequence "]]>"
- * in the content, which is illegal in a CDATA section per section 2.7 of [XML 1.0]. The
- * presence of this character sequence must generate a fatal error during
- * serialization or the cdata section must be splitted before the
- * serialization (see also the parameter "split-cdata-sections"
- * in the DOMConfiguration
interface).
- *
Note: Because no markup is recognized within a
- * CDATASection
, character numeric references cannot be used as
- * an escape mechanism when serializing. Therefore, action needs to be taken
- * when serializing a CDATASection
with a character encoding
- * where some of the contained characters cannot be represented. Failure to
- * do so would not produce well-formed XML.
- *
Note: One potential solution in the serialization process is to - * end the CDATA section before the character, output the character using a - * character reference or entity reference, and open a new CDATA section for - * any further characters in the text node. Note, however, that some code - * conversion libraries at the time of writing do not return an error or - * exception when a character is missing from the encoding, making the task - * of ensuring that data is not corrupted on serialization more difficult. - *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface CDATASection extends Text {
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/CharacterData.java b/libjava/external/w3c_dom/org/w3c/dom/CharacterData.java
deleted file mode 100644
index a12dcedfae3..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/CharacterData.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The CharacterData
interface extends Node with a set of
- * attributes and methods for accessing character data in the DOM. For
- * clarity this set is defined here rather than on each object that uses
- * these attributes and methods. No DOM objects correspond directly to
- * CharacterData
, though Text
and others do
- * inherit the interface from it. All offsets
in this interface
- * start from 0
.
- *
As explained in the DOMString
interface, text strings in
- * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In
- * the following, the term 16-bit units is used whenever necessary to
- * indicate that indexing on CharacterData is done in 16-bit units.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface CharacterData extends Node {
- /**
- * The character data of the node that implements this interface. The DOM
- * implementation may not put arbitrary limits on the amount of data
- * that may be stored in a CharacterData
node. However,
- * implementation limits may mean that the entirety of a node's data may
- * not fit into a single DOMString
. In such cases, the user
- * may call substringData
to retrieve the data in
- * appropriately sized pieces.
- * @exception DOMException
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
- * fit in a DOMString
variable on the implementation
- * platform.
- */
- public String getData()
- throws DOMException;
- /**
- * The character data of the node that implements this interface. The DOM
- * implementation may not put arbitrary limits on the amount of data
- * that may be stored in a CharacterData
node. However,
- * implementation limits may mean that the entirety of a node's data may
- * not fit into a single DOMString
. In such cases, the user
- * may call substringData
to retrieve the data in
- * appropriately sized pieces.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- */
- public void setData(String data)
- throws DOMException;
-
- /**
- * The number of 16-bit units that are available through data
- * and the substringData
method below. This may have the
- * value zero, i.e., CharacterData
nodes may be empty.
- */
- public int getLength();
-
- /**
- * Extracts a range of data from the node.
- * @param offset Start offset of substring to extract.
- * @param count The number of 16-bit units to extract.
- * @return The specified substring. If the sum of offset
and
- * count
exceeds the length
, then all 16-bit
- * units to the end of the data are returned.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified offset
is
- * negative or greater than the number of 16-bit units in
- * data
, or if the specified count
is
- * negative.
- *
DOMSTRING_SIZE_ERR: Raised if the specified range of text does
- * not fit into a DOMString
.
- */
- public String substringData(int offset,
- int count)
- throws DOMException;
-
- /**
- * Append the string to the end of the character data of the node. Upon
- * success, data
provides access to the concatenation of
- * data
and the DOMString
specified.
- * @param arg The DOMString
to append.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void appendData(String arg)
- throws DOMException;
-
- /**
- * Insert a string at the specified 16-bit unit offset.
- * @param offset The character offset at which to insert.
- * @param arg The DOMString
to insert.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified offset
is
- * negative or greater than the number of 16-bit units in
- * data
.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void insertData(int offset,
- String arg)
- throws DOMException;
-
- /**
- * Remove a range of 16-bit units from the node. Upon success,
- * data
and length
reflect the change.
- * @param offset The offset from which to start removing.
- * @param count The number of 16-bit units to delete. If the sum of
- * offset
and count
exceeds
- * length
then all 16-bit units from offset
- * to the end of the data are deleted.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified offset
is
- * negative or greater than the number of 16-bit units in
- * data
, or if the specified count
is
- * negative.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void deleteData(int offset,
- int count)
- throws DOMException;
-
- /**
- * Replace the characters starting at the specified 16-bit unit offset
- * with the specified string.
- * @param offset The offset from which to start replacing.
- * @param count The number of 16-bit units to replace. If the sum of
- * offset
and count
exceeds
- * length
, then all 16-bit units to the end of the data
- * are replaced; (i.e., the effect is the same as a remove
- * method call with the same range, followed by an append
- * method invocation).
- * @param arg The DOMString
with which the range must be
- * replaced.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified offset
is
- * negative or greater than the number of 16-bit units in
- * data
, or if the specified count
is
- * negative.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void replaceData(int offset,
- int count,
- String arg)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/Comment.java b/libjava/external/w3c_dom/org/w3c/dom/Comment.java
deleted file mode 100644
index b04ed4d0a5e..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/Comment.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * This interface inherits from CharacterData
and represents the
- * content of a comment, i.e., all the characters between the starting '
- * <!--
' and ending '-->
'. Note that this is
- * the definition of a comment in XML, and, in practice, HTML, although some
- * HTML tools may implement the full SGML comment structure.
- *
No lexical check is done on the content of a comment and it is
- * therefore possible to have the character sequence "--"
- * (double-hyphen) in the content, which is illegal in a comment per section
- * 2.5 of [XML 1.0]. The
- * presence of this character sequence must generate a fatal error during
- * serialization.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Comment extends CharacterData {
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMConfiguration.java b/libjava/external/w3c_dom/org/w3c/dom/DOMConfiguration.java
deleted file mode 100644
index 7cce1609e19..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMConfiguration.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The DOMConfiguration
interface represents the configuration
- * of a document and maintains a table of recognized parameters. Using the
- * configuration, it is possible to change
- * Document.normalizeDocument()
behavior, such as replacing the
- * CDATASection
nodes with Text
nodes or
- * specifying the type of the schema that must be used when the validation
- * of the Document
is requested. DOMConfiguration
- * objects are also used in [DOM Level 3 Load and Save]
- * in the DOMParser
and DOMSerializer
interfaces.
- *
The parameter names used by the DOMConfiguration
object
- * are defined throughout the DOM Level 3 specifications. Names are
- * case-insensitive. To avoid possible conflicts, as a convention, names
- * referring to parameters defined outside the DOM specification should be
- * made unique. Because parameters are exposed as properties in the , names
- * are recommended to follow the section 5.16 Identifiers of [Unicode] with the addition of the character '-' (HYPHEN-MINUS) but it is not
- * enforced by the DOM implementation. DOM Level 3 Core Implementations are
- * required to recognize all parameters defined in this specification. Some
- * parameter values may also be required to be supported by the
- * implementation. Refer to the definition of the parameter to know if a
- * value must be supported or not.
- *
Note: Parameters are similar to features and properties used in - * SAX2 [SAX]. - *
The following list of parameters defined in the DOM: - *
"canonical-form"
true
DocumentType
node (if any) from the
- * tree, or removing superfluous namespace declarations from each element.
- * Note that this is limited to what can be represented in the DOM; in
- * particular, there is no way to specify the order of the attributes in the
- * DOM. In addition, Setting this parameter to true
will also
- * set the state of the parameters listed below. Later changes to the state
- * of one of those parameters will revert "canonical-form" back to
- * false
. Parameters set to false
: "entities", "
- * normalize-characters", "cdata-sections". Parameters set to
- * true
: "namespaces", "namespace-declarations", "well-formed",
- * "element-content-whitespace". Other parameters are not changed unless
- * explicitly specified in the description of the parameters.false
"cdata-sections"
true
CDATASection
nodes in the document.false
CDATASection
nodes in the document into
- * Text
nodes. The new Text
node is then combined
- * with any adjacent Text
node."check-character-normalization"
true
DOMError.type
equals to
- * "check-character-normalization-failure" is issued. false
"comments"
true
Comment
nodes in the document.false
Comment
nodes in the document."datatype-normalization"
true
true
. Having this parameter activated when "validate" is
- * false
has no effect and no schema-normalization will happen.
- * Note: Since the document contains the result of the XML 1.0 - * processing, this parameter does not apply to attribute value - * normalization as defined in section 3.3.3 of [XML 1.0] and is only - * meant for schema languages other than Document Type Definition (DTD).
false
"element-content-whitespace"
true
false
Text
nodes that contain whitespaces in element
- * content, as described in
- * [element content whitespace]. The implementation is expected to use the attribute
- * Text.isElementContentWhitespace
to determine if a
- * Text
node should be discarded or not."entities"
true
EntityReference
nodes in the document.false
EntityReference
nodes from the document,
- * putting the entity expansions directly in their place. Text
- * nodes are normalized, as defined in Node.normalize
. Only
- * unexpanded entity references are kept in the document. Note: This parameter does not affect Entity
nodes.
"error-handler"
DOMErrorHandler
object. If an error is
- * encountered in the document, the implementation will call back the
- * DOMErrorHandler
registered using this parameter. The
- * implementation may provide a default DOMErrorHandler
object.
- * When called, DOMError.relatedData
will contain the closest
- * node to where the error occurred. If the implementation is unable to
- * determine the node where the error occurs,
- * DOMError.relatedData
will contain the Document
- * node. Mutations to the document from within an error handler will result
- * in implementation dependent behavior. "infoset"
true
false
: "
- * validate-if-schema", "entities", "datatype-normalization", "cdata-sections
- * ".This forces the following parameters to true
: "
- * namespace-declarations", "well-formed", "element-content-whitespace", "
- * comments", "namespaces".Other parameters are not changed unless
- * explicitly specified in the description of the parameters. Note that
- * querying this parameter with getParameter
returns
- * true
only if the individual parameters specified above are
- * appropriately set.false
infoset
to
- * false
has no effect."namespaces"
true
false
"namespace-declarations"
false
.
- * true
false
Node.prefix
) are retained even if this parameter is set to
- * false
."normalize-characters"
true
false
"schema-location"
DOMString
object containing a list of URIs,
- * separated by whitespaces (characters matching the nonterminal
- * production S defined in section 2.3 [XML 1.0]), that
- * represents the schemas against which validation should occur, i.e. the
- * current schema. The types of schemas referenced in this list must match
- * the type specified with schema-type
, otherwise the behavior
- * of an implementation is undefined. The schemas specified using this
- * property take precedence to the schema information specified in the
- * document itself. For namespace aware schema, if a schema specified using
- * this property and a schema specified in the document instance (i.e. using
- * the schemaLocation
attribute) in a schema document (i.e.
- * using schema import
mechanisms) share the same
- * targetNamespace
, the schema specified by the user using this
- * property will be used. If two schemas specified using this property share
- * the same targetNamespace
or have no namespace, the behavior
- * is implementation dependent. If no location has been provided, this
- * parameter is null
.
- * Note: The "schema-location"
parameter is ignored
- * unless the "schema-type" parameter value is set. It is strongly
- * recommended that Document.documentURI
will be set so that an
- * implementation can successfully resolve any external entities referenced.
"schema-type"
DOMString
object containing an absolute URI
- * and representing the type of the schema language used to validate a
- * document against. Note that no lexical checking is done on the absolute
- * URI. If this parameter is not set, a default value may be provided by
- * the implementation, based on the schema languages supported and on the
- * schema language used at load time. If no value is provided, this
- * parameter is null
.
- * Note: For XML Schema [XML Schema Part 1]
- * , applications must use the value
- * "http://www.w3.org/2001/XMLSchema"
. For XML DTD [XML 1.0],
- * applications must use the value
- * "http://www.w3.org/TR/REC-xml"
. Other schema languages are
- * outside the scope of the W3C and therefore should recommend an absolute
- * URI in order to use this method.
"split-cdata-sections"
true
DOMError.type
equals to
- * "cdata-sections-splitted"
and
- * DOMError.relatedData
equals to the first
- * CDATASection
node in document order resulting from the split.false
CDATASection
contains an
- * unrepresentable character."validate"
true
true
. This parameter will reevaluate:
- * Attr.specified
equals to false
, as specified in
- * the description of the Attr
interface;
- * Text.isElementContentWhitespace
for all
- * Text
nodes;
- * Attr.isId
for all Attr
nodes;
- * Element.schemaTypeInfo
and Attr.schemaTypeInfo
.
- * Note: "validate-if-schema" and "validate" are mutually
- * exclusive, setting one of them to true
will set the other
- * one to false
. Applications should also consider setting the
- * parameter "well-formed" to true
, which is the default for
- * that option, when validating the document.
false
true
- * . "validate-if-schema"
true
true
.
- * Note: "validate-if-schema" and "validate" are mutually
- * exclusive, setting one of them to true
will set the other
- * one to false
.
false
true
. "well-formed"
true
Document.xmlVersion
:
- * Node.nodeName
contains invalid characters according to its
- * node type and generate a DOMError
of type
- * "wf-invalid-character-in-node-name"
, with a
- * DOMError.SEVERITY_ERROR
severity, if necessary;
- * Attr
, Element
,
- * Comment
, Text
, CDATASection
nodes
- * for invalid characters and generate a DOMError
of type
- * "wf-invalid-character"
, with a
- * DOMError.SEVERITY_ERROR
severity, if necessary;
- * ProcessingInstruction
nodes for invalid
- * characters and generate a DOMError
of type
- * "wf-invalid-character"
, with a
- * DOMError.SEVERITY_ERROR
severity, if necessary;
- * false
The resolution of the system identifiers associated with entities is
- * done using Document.documentURI
. However, when the feature
- * "LS" defined in [DOM Level 3 Load and Save]
- * is supported by the DOM implementation, the parameter
- * "resource-resolver" can also be used on DOMConfiguration
- * objects attached to Document
nodes. If this parameter is
- * set, Document.normalizeDocument()
will invoke the resource
- * resolver instead of using Document.documentURI
.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface DOMConfiguration {
- /**
- * Set the value of a parameter.
- * @param name The name of the parameter to set.
- * @param value The new value or null
if the user wishes to
- * unset the parameter. While the type of the value parameter is
- * defined as DOMUserData
, the object type must match the
- * type defined by the definition of the parameter. For example, if
- * the parameter is "error-handler", the value must be of type
- * DOMErrorHandler
.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised when the parameter name is not recognized.
- *
NOT_SUPPORTED_ERR: Raised when the parameter name is recognized
- * but the requested value cannot be set.
- *
TYPE_MISMATCH_ERR: Raised if the value type for this parameter
- * name is incompatible with the expected value type.
- */
- public void setParameter(String name,
- Object value)
- throws DOMException;
-
- /**
- * Return the value of a parameter if known.
- * @param name The name of the parameter.
- * @return The current object associated with the specified parameter or
- * null
if no object has been associated or if the
- * parameter is not supported.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised when the parameter name is not recognized.
- */
- public Object getParameter(String name)
- throws DOMException;
-
- /**
- * Check if setting a parameter to a specific value is supported.
- * @param name The name of the parameter to check.
- * @param value An object. if null
, the returned value is
- * true
.
- * @return true
if the parameter could be successfully set
- * to the specified value, or false
if the parameter is
- * not recognized or the requested value is not supported. This does
- * not change the current value of the parameter itself.
- */
- public boolean canSetParameter(String name,
- Object value);
-
- /**
- * The list of the parameters supported by this
- * DOMConfiguration
object and for which at least one value
- * can be set by the application. Note that this list can also contain
- * parameter names defined outside this specification.
- */
- public DOMStringList getParameterNames();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMError.java b/libjava/external/w3c_dom/org/w3c/dom/DOMError.java
deleted file mode 100644
index 37ed7d10d89..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMError.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * DOMError
is an interface that describes an error.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface DOMError {
- // ErrorSeverity
- /**
- * The severity of the error described by the DOMError
is
- * warning. A SEVERITY_WARNING
will not cause the
- * processing to stop, unless DOMErrorHandler.handleError()
- * returns false
.
- */
- public static final short SEVERITY_WARNING = 1;
- /**
- * The severity of the error described by the DOMError
is
- * error. A SEVERITY_ERROR
may not cause the processing to
- * stop if the error can be recovered, unless
- * DOMErrorHandler.handleError()
returns false
.
- */
- public static final short SEVERITY_ERROR = 2;
- /**
- * The severity of the error described by the DOMError
is
- * fatal error. A SEVERITY_FATAL_ERROR
will cause the
- * normal processing to stop. The return value of
- * DOMErrorHandler.handleError()
is ignored unless the
- * implementation chooses to continue, in which case the behavior
- * becomes undefined.
- */
- public static final short SEVERITY_FATAL_ERROR = 3;
-
- /**
- * The severity of the error, either SEVERITY_WARNING
,
- * SEVERITY_ERROR
, or SEVERITY_FATAL_ERROR
.
- */
- public short getSeverity();
-
- /**
- * An implementation specific string describing the error that occurred.
- */
- public String getMessage();
-
- /**
- * A DOMString
indicating which related data is expected in
- * relatedData
. Users should refer to the specification of
- * the error in order to find its DOMString
type and
- * relatedData
definitions if any.
- *
Note: As an example,
- * Document.normalizeDocument()
does generate warnings when
- * the "split-cdata-sections" parameter is in use. Therefore, the method
- * generates a SEVERITY_WARNING
with type
- * "cdata-sections-splitted"
and the first
- * CDATASection
node in document order resulting from the
- * split is returned by the relatedData
attribute.
- */
- public String getType();
-
- /**
- * The related platform dependent exception if any.
- */
- public Object getRelatedException();
-
- /**
- * The related DOMError.type
dependent data if any.
- */
- public Object getRelatedData();
-
- /**
- * The location of the error.
- */
- public DOMLocator getLocation();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMErrorHandler.java b/libjava/external/w3c_dom/org/w3c/dom/DOMErrorHandler.java
deleted file mode 100644
index 3d4ad2aba58..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMErrorHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * DOMErrorHandler
is a callback interface that the DOM
- * implementation can call when reporting errors that happens while
- * processing XML data, or when doing some other processing (e.g. validating
- * a document). A DOMErrorHandler
object can be attached to a
- * Document
using the "error-handler" on the
- * DOMConfiguration
interface. If more than one error needs to
- * be reported during an operation, the sequence and numbers of the errors
- * passed to the error handler are implementation dependent.
- *
The application that is using the DOM implementation is expected to - * implement this interface. - *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface DOMErrorHandler {
- /**
- * This method is called on the error handler when an error occurs.
- *
If an exception is thrown from this method, it is considered to be
- * equivalent of returning true
.
- * @param error The error object that describes the error. This object
- * may be reused by the DOM implementation across multiple calls to
- * the handleError
method.
- * @return If the handleError
method returns
- * false
, the DOM implementation should stop the current
- * processing when possible. If the method returns true
,
- * the processing may continue depending on
- * DOMError.severity
.
- */
- public boolean handleError(DOMError error);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMException.java b/libjava/external/w3c_dom/org/w3c/dom/DOMException.java
deleted file mode 100644
index 0b2578f92f6..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMException.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
- * when an operation is impossible to perform (either for logical reasons,
- * because data is lost, or because the implementation has become unstable).
- * In general, DOM methods return specific error values in ordinary
- * processing situations, such as out-of-bound errors when using
- * NodeList
.
- *
Implementations should raise other exceptions under other circumstances.
- * For example, implementations should raise an implementation-dependent
- * exception if a null
argument is passed when null
- * was not expected.
- *
Some languages and object systems do not support the concept of - * exceptions. For such systems, error conditions may be indicated using - * native error reporting mechanisms. For some bindings, for example, - * methods may return error codes similar to those listed in the - * corresponding method descriptions. - *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public class DOMException extends RuntimeException {
- public DOMException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // ExceptionCode
- /**
- * If index or size is negative, or greater than the allowed value.
- */
- public static final short INDEX_SIZE_ERR = 1;
- /**
- * If the specified range of text does not fit into a
- * DOMString
.
- */
- public static final short DOMSTRING_SIZE_ERR = 2;
- /**
- * If any Node
is inserted somewhere it doesn't belong.
- */
- public static final short HIERARCHY_REQUEST_ERR = 3;
- /**
- * If a Node
is used in a different document than the one
- * that created it (that doesn't support it).
- */
- public static final short WRONG_DOCUMENT_ERR = 4;
- /**
- * If an invalid or illegal character is specified, such as in an XML name.
- */
- public static final short INVALID_CHARACTER_ERR = 5;
- /**
- * If data is specified for a Node
which does not support
- * data.
- */
- public static final short NO_DATA_ALLOWED_ERR = 6;
- /**
- * If an attempt is made to modify an object where modifications are not
- * allowed.
- */
- public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
- /**
- * If an attempt is made to reference a Node
in a context
- * where it does not exist.
- */
- public static final short NOT_FOUND_ERR = 8;
- /**
- * If the implementation does not support the requested type of object or
- * operation.
- */
- public static final short NOT_SUPPORTED_ERR = 9;
- /**
- * If an attempt is made to add an attribute that is already in use
- * elsewhere.
- */
- public static final short INUSE_ATTRIBUTE_ERR = 10;
- /**
- * If an attempt is made to use an object that is not, or is no longer,
- * usable.
- * @since DOM Level 2
- */
- public static final short INVALID_STATE_ERR = 11;
- /**
- * If an invalid or illegal string is specified.
- * @since DOM Level 2
- */
- public static final short SYNTAX_ERR = 12;
- /**
- * If an attempt is made to modify the type of the underlying object.
- * @since DOM Level 2
- */
- public static final short INVALID_MODIFICATION_ERR = 13;
- /**
- * If an attempt is made to create or change an object in a way which is
- * incorrect with regard to namespaces.
- * @since DOM Level 2
- */
- public static final short NAMESPACE_ERR = 14;
- /**
- * If a parameter or an operation is not supported by the underlying
- * object.
- * @since DOM Level 2
- */
- public static final short INVALID_ACCESS_ERR = 15;
- /**
- * If a call to a method such as insertBefore
or
- * removeChild
would make the Node
invalid
- * with respect to "partial validity", this exception would be raised
- * and the operation would not be done. This code is used in [DOM Level 3 Validation]
- * . Refer to this specification for further information.
- * @since DOM Level 3
- */
- public static final short VALIDATION_ERR = 16;
- /**
- * If the type of an object is incompatible with the expected type of the
- * parameter associated to the object.
- * @since DOM Level 3
- */
- public static final short TYPE_MISMATCH_ERR = 17;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMImplementation.java b/libjava/external/w3c_dom/org/w3c/dom/DOMImplementation.java
deleted file mode 100644
index 5bb71e263a9..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMImplementation.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The DOMImplementation
interface provides a number of methods
- * for performing operations that are independent of any particular instance
- * of the document object model.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface DOMImplementation {
- /**
- * Test if the DOM implementation implements a specific feature and
- * version, as specified in .
- * @param feature The name of the feature to test.
- * @param version This is the version number of the feature to test.
- * @return true
if the feature is implemented in the
- * specified version, false
otherwise.
- */
- public boolean hasFeature(String feature,
- String version);
-
- /**
- * Creates an empty DocumentType
node. Entity declarations
- * and notations are not made available. Entity reference expansions and
- * default attribute additions do not occur..
- * @param qualifiedName The qualified name of the document type to be
- * created.
- * @param publicId The external subset public identifier.
- * @param systemId The external subset system identifier.
- * @return A new DocumentType
node with
- * Node.ownerDocument
set to null
.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
- * an XML name according to [XML 1.0].
- *
NAMESPACE_ERR: Raised if the qualifiedName
is
- * malformed.
- *
NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML" and the language exposed through the
- * Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public DocumentType createDocumentType(String qualifiedName,
- String publicId,
- String systemId)
- throws DOMException;
-
- /**
- * Creates a DOM Document object of the specified type with its document
- * element.
- *
Note that based on the DocumentType
given to create
- * the document, the implementation may instantiate specialized
- * Document
objects that support additional features than
- * the "Core", such as "HTML" [DOM Level 2 HTML]
- * . On the other hand, setting the DocumentType
after the
- * document was created makes this very unlikely to happen.
- * Alternatively, specialized Document
creation methods,
- * such as createHTMLDocument
[DOM Level 2 HTML]
- * , can be used to obtain specific types of Document
- * objects.
- * @param namespaceURI The namespace URI of the document element to
- * create or null
.
- * @param qualifiedName The qualified name of the document element to be
- * created or null
.
- * @param doctype The type of document to be created or null
.
- * When doctype
is not null
, its
- * Node.ownerDocument
attribute is set to the document
- * being created.
- * @return A new Document
object with its document element.
- * If the NamespaceURI
, qualifiedName
, and
- * doctype
are null
, the returned
- * Document
is empty with no document element.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
- * an XML name according to [XML 1.0].
- *
NAMESPACE_ERR: Raised if the qualifiedName
is
- * malformed, if the qualifiedName
has a prefix and the
- * namespaceURI
is null
, or if the
- * qualifiedName
is null
and the
- * namespaceURI
is different from null
, or
- * if the qualifiedName
has a prefix that is "xml" and
- * the namespaceURI
is different from "
- * http://www.w3.org/XML/1998/namespace" [XML Namespaces]
- * , or if the DOM implementation does not support the
- * "XML"
feature but a non-null namespace URI was
- * provided, since namespaces were defined by XML.
- *
WRONG_DOCUMENT_ERR: Raised if doctype
has already
- * been used with a different document or was created from a different
- * implementation.
- *
NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML" and the language exposed through the
- * Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public Document createDocument(String namespaceURI,
- String qualifiedName,
- DocumentType doctype)
- throws DOMException;
-
- /**
- * This method returns a specialized object which implements the
- * specialized APIs of the specified feature and version, as specified
- * in . The specialized object may also be obtained by using
- * binding-specific casting methods but is not necessarily expected to,
- * as discussed in . This method also allow the implementation to
- * provide specialized objects which do not support the
- * DOMImplementation
interface.
- * @param feature The name of the feature requested. Note that any plus
- * sign "+" prepended to the name of the feature will be ignored since
- * it is not significant in the context of this method.
- * @param version This is the version number of the feature to test.
- * @return Returns an object which implements the specialized APIs of
- * the specified feature and version, if any, or null
if
- * there is no object which implements interfaces associated with that
- * feature. If the DOMObject
returned by this method
- * implements the DOMImplementation
interface, it must
- * delegate to the primary core DOMImplementation
and not
- * return results inconsistent with the primary core
- * DOMImplementation
such as hasFeature
,
- * getFeature
, etc.
- * @since DOM Level 3
- */
- public Object getFeature(String feature,
- String version);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMImplementationList.java b/libjava/external/w3c_dom/org/w3c/dom/DOMImplementationList.java
deleted file mode 100644
index 18349fdd411..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMImplementationList.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The DOMImplementationList
interface provides the abstraction
- * of an ordered collection of DOM implementations, without defining or
- * constraining how this collection is implemented. The items in the
- * DOMImplementationList
are accessible via an integral index,
- * starting from 0.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface DOMImplementationList {
- /**
- * Returns the index
th item in the collection. If
- * index
is greater than or equal to the number of
- * DOMImplementation
s in the list, this returns
- * null
.
- * @param index Index into the collection.
- * @return The DOMImplementation
at the index
- * th position in the DOMImplementationList
, or
- * null
if that is not a valid index.
- */
- public DOMImplementation item(int index);
-
- /**
- * The number of DOMImplementation
s in the list. The range
- * of valid child node indices is 0 to length-1
inclusive.
- */
- public int getLength();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMImplementationSource.java b/libjava/external/w3c_dom/org/w3c/dom/DOMImplementationSource.java
deleted file mode 100644
index 3c32c188378..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMImplementationSource.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * This interface permits a DOM implementer to supply one or more
- * implementations, based upon requested features and versions, as specified
- * in . Each implemented DOMImplementationSource
object is
- * listed in the binding-specific list of available sources so that its
- * DOMImplementation
objects are made available.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface DOMImplementationSource {
- /**
- * A method to request the first DOM implementation that supports the
- * specified features.
- * @param features A string that specifies which features and versions
- * are required. This is a space separated list in which each feature
- * is specified by its name optionally followed by a space and a
- * version number. This method returns the first item of the list
- * returned by getDOMImplementationList
. As an example,
- * the string "XML 3.0 Traversal +Events 2.0"
will
- * request a DOM implementation that supports the module "XML" for its
- * 3.0 version, a module that support of the "Traversal" module for
- * any version, and the module "Events" for its 2.0 version. The
- * module "Events" must be accessible using the method
- * Node.getFeature()
and
- * DOMImplementation.getFeature()
.
- * @return The first DOM implementation that support the desired
- * features, or null
if this source has none.
- */
- public DOMImplementation getDOMImplementation(String features);
-
- /**
- * A method to request a list of DOM implementations that support the
- * specified features and versions, as specified in .
- * @param features A string that specifies which features and versions
- * are required. This is a space separated list in which each feature
- * is specified by its name optionally followed by a space and a
- * version number. This is something like: "XML 3.0 Traversal +Events
- * 2.0"
- * @return A list of DOM implementations that support the desired
- * features.
- */
- public DOMImplementationList getDOMImplementationList(String features);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMLocator.java b/libjava/external/w3c_dom/org/w3c/dom/DOMLocator.java
deleted file mode 100644
index fcaaa23de87..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMLocator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * DOMLocator
is an interface that describes a location (e.g.
- * where an error occurred).
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface DOMLocator {
- /**
- * The line number this locator is pointing to, or -1
if
- * there is no column number available.
- */
- public int getLineNumber();
-
- /**
- * The column number this locator is pointing to, or -1
if
- * there is no column number available.
- */
- public int getColumnNumber();
-
- /**
- * The byte offset into the input source this locator is pointing to or
- * -1
if there is no byte offset available.
- */
- public int getByteOffset();
-
- /**
- * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646], offset into the input source this locator is pointing to or
- * -1
if there is no UTF-16 offset available.
- */
- public int getUtf16Offset();
-
- /**
- * The node this locator is pointing to, or null
if no node
- * is available.
- */
- public Node getRelatedNode();
-
- /**
- * The URI this locator is pointing to, or null
if no URI is
- * available.
- */
- public String getUri();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DOMStringList.java b/libjava/external/w3c_dom/org/w3c/dom/DOMStringList.java
deleted file mode 100644
index e6c348ae8c4..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DOMStringList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The DOMStringList
interface provides the abstraction of an
- * ordered collection of DOMString
values, without defining or
- * constraining how this collection is implemented. The items in the
- * DOMStringList
are accessible via an integral index, starting
- * from 0.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface DOMStringList {
- /**
- * Returns the index
th item in the collection. If
- * index
is greater than or equal to the number of
- * DOMString
s in the list, this returns null
.
- * @param index Index into the collection.
- * @return The DOMString
at the index
th
- * position in the DOMStringList
, or null
if
- * that is not a valid index.
- */
- public String item(int index);
-
- /**
- * The number of DOMString
s in the list. The range of valid
- * child node indices is 0 to length-1
inclusive.
- */
- public int getLength();
-
- /**
- * Test if a string is part of this DOMStringList
.
- * @param str The string to look for.
- * @return true
if the string has been found,
- * false
otherwise.
- */
- public boolean contains(String str);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/Document.java b/libjava/external/w3c_dom/org/w3c/dom/Document.java
deleted file mode 100644
index 43ebd4ec420..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/Document.java
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The Document
interface represents the entire HTML or XML
- * document. Conceptually, it is the root of the document tree, and provides
- * the primary access to the document's data.
- *
Since elements, text nodes, comments, processing instructions, etc.
- * cannot exist outside the context of a Document
, the
- * Document
interface also contains the factory methods needed
- * to create these objects. The Node
objects created have a
- * ownerDocument
attribute which associates them with the
- * Document
within whose context they were created.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Document extends Node {
- /**
- * The Document Type Declaration (see DocumentType
)
- * associated with this document. For XML documents without a document
- * type declaration this returns null
. For HTML documents,
- * a DocumentType
object may be returned, independently of
- * the presence or absence of document type declaration in the HTML
- * document.
- *
This provides direct access to the DocumentType
node,
- * child node of this Document
. This node can be set at
- * document creation time and later changed through the use of child
- * nodes manipulation methods, such as Node.insertBefore
,
- * or Node.replaceChild
. Note, however, that while some
- * implementations may instantiate different types of
- * Document
objects supporting additional features than the
- * "Core", such as "HTML" [DOM Level 2 HTML]
- * , based on the DocumentType
specified at creation time,
- * changing it afterwards is very unlikely to result in a change of the
- * features supported.
- * @version DOM Level 3
- */
- public DocumentType getDoctype();
-
- /**
- * The DOMImplementation
object that handles this document. A
- * DOM application may use objects from multiple implementations.
- */
- public DOMImplementation getImplementation();
-
- /**
- * This is a convenience attribute that allows direct access to the child
- * node that is the document element of the document.
- */
- public Element getDocumentElement();
-
- /**
- * Creates an element of the type specified. Note that the instance
- * returned implements the Element
interface, so attributes
- * can be specified directly on the returned object.
- *
In addition, if there are known attributes with default values,
- * Attr
nodes representing them are automatically created
- * and attached to the element.
- *
To create an element with a qualified name and namespace URI, use
- * the createElementNS
method.
- * @param tagName The name of the element type to instantiate. For XML,
- * this is case-sensitive, otherwise it depends on the
- * case-sensitivity of the markup language in use. In that case, the
- * name is mapped to the canonical form of that markup by the DOM
- * implementation.
- * @return A new Element
object with the
- * nodeName
attribute set to tagName
, and
- * localName
, prefix
, and
- * namespaceURI
set to null
.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
- * name according to the XML version in use specified in the
- * Document.xmlVersion
attribute.
- */
- public Element createElement(String tagName)
- throws DOMException;
-
- /**
- * Creates an empty DocumentFragment
object.
- * @return A new DocumentFragment
.
- */
- public DocumentFragment createDocumentFragment();
-
- /**
- * Creates a Text
node given the specified string.
- * @param data The data for the node.
- * @return The new Text
object.
- */
- public Text createTextNode(String data);
-
- /**
- * Creates a Comment
node given the specified string.
- * @param data The data for the node.
- * @return The new Comment
object.
- */
- public Comment createComment(String data);
-
- /**
- * Creates a CDATASection
node whose value is the specified
- * string.
- * @param data The data for the CDATASection
contents.
- * @return The new CDATASection
object.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
- */
- public CDATASection createCDATASection(String data)
- throws DOMException;
-
- /**
- * Creates a ProcessingInstruction
node given the specified
- * name and data strings.
- * @param target The target part of the processing instruction.Unlike
- * Document.createElementNS
or
- * Document.createAttributeNS
, no namespace well-formed
- * checking is done on the target name. Applications should invoke
- * Document.normalizeDocument()
with the parameter "
- * namespaces" set to true
in order to ensure that the
- * target name is namespace well-formed.
- * @param data The data for the node.
- * @return The new ProcessingInstruction
object.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified target is not an XML
- * name according to the XML version in use specified in the
- * Document.xmlVersion
attribute.
- *
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
- */
- public ProcessingInstruction createProcessingInstruction(String target,
- String data)
- throws DOMException;
-
- /**
- * Creates an Attr
of the given name. Note that the
- * Attr
instance can then be set on an Element
- * using the setAttributeNode
method.
- *
To create an attribute with a qualified name and namespace URI, use
- * the createAttributeNS
method.
- * @param name The name of the attribute.
- * @return A new Attr
object with the nodeName
- * attribute set to name
, and localName
,
- * prefix
, and namespaceURI
set to
- * null
. The value of the attribute is the empty string.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
- * name according to the XML version in use specified in the
- * Document.xmlVersion
attribute.
- */
- public Attr createAttribute(String name)
- throws DOMException;
-
- /**
- * Creates an EntityReference
object. In addition, if the
- * referenced entity is known, the child list of the
- * EntityReference
node is made the same as that of the
- * corresponding Entity
node.
- *
Note: If any descendant of the Entity
node has
- * an unbound namespace prefix, the corresponding descendant of the
- * created EntityReference
node is also unbound; (its
- * namespaceURI
is null
). The DOM Level 2 and
- * 3 do not support any mechanism to resolve namespace prefixes in this
- * case.
- * @param name The name of the entity to reference.Unlike
- * Document.createElementNS
or
- * Document.createAttributeNS
, no namespace well-formed
- * checking is done on the entity name. Applications should invoke
- * Document.normalizeDocument()
with the parameter "
- * namespaces" set to true
in order to ensure that the
- * entity name is namespace well-formed.
- * @return The new EntityReference
object.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
- * name according to the XML version in use specified in the
- * Document.xmlVersion
attribute.
- *
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
- */
- public EntityReference createEntityReference(String name)
- throws DOMException;
-
- /**
- * Returns a NodeList
of all the Elements
in
- * document order with a given tag name and are contained in the
- * document.
- * @param tagname The name of the tag to match on. The special value "*"
- * matches all tags. For XML, the tagname
parameter is
- * case-sensitive, otherwise it depends on the case-sensitivity of the
- * markup language in use.
- * @return A new NodeList
object containing all the matched
- * Elements
.
- */
- public NodeList getElementsByTagName(String tagname);
-
- /**
- * Imports a node from another document to this document, without altering
- * or removing the source node from the original document; this method
- * creates a new copy of the source node. The returned node has no
- * parent; (parentNode
is null
).
- *
For all nodes, importing a node creates a node object owned by the
- * importing document, with attribute values identical to the source
- * node's nodeName
and nodeType
, plus the
- * attributes related to namespaces (prefix
,
- * localName
, and namespaceURI
). As in the
- * cloneNode
operation, the source node is not altered.
- * User data associated to the imported node is not carried over.
- * However, if any UserDataHandlers
has been specified
- * along with the associated data these handlers will be called with the
- * appropriate parameters before this method returns.
- *
Additional information is copied as appropriate to the
- * nodeType
, attempting to mirror the behavior expected if
- * a fragment of XML or HTML source was copied from one document to
- * another, recognizing that the two documents may have different DTDs
- * in the XML case. The following list describes the specifics for each
- * type of node.
- *
ownerElement
attribute
- * is set to null
and the specified
flag is
- * set to true
on the generated Attr
. The
- * descendants of the source Attr
are recursively imported
- * and the resulting nodes reassembled to form the corresponding subtree.
- * Note that the deep
parameter has no effect on
- * Attr
nodes; they always carry their children with them
- * when imported.deep
option
- * was set to true
, the descendants of the source
- * DocumentFragment
are recursively imported and the
- * resulting nodes reassembled under the imported
- * DocumentFragment
to form the corresponding subtree.
- * Otherwise, this simply generates an empty
- * DocumentFragment
.Document
- * nodes cannot be imported.DocumentType
- * nodes cannot be imported.Attr
nodes are attached to the generated
- * Element
. Default attributes are not copied, though if the document being imported into defines default
- * attributes for this element name, those are assigned. If the
- * importNode
deep
parameter was set to
- * true
, the descendants of the source element are
- * recursively imported and the resulting nodes reassembled to form the
- * corresponding subtree.Entity
nodes can be
- * imported, however in the current release of the DOM the
- * DocumentType
is readonly. Ability to add these imported
- * nodes to a DocumentType
will be considered for addition
- * to a future release of the DOM.On import, the publicId
,
- * systemId
, and notationName
attributes are
- * copied. If a deep
import is requested, the descendants
- * of the the source Entity
are recursively imported and
- * the resulting nodes reassembled to form the corresponding subtree.EntityReference
itself is
- * copied, even if a deep
import is requested, since the
- * source and destination documents might have defined the entity
- * differently. If the document being imported into provides a
- * definition for this entity name, its value is assigned.Notation
nodes can be imported, however in the current
- * release of the DOM the DocumentType
is readonly. Ability
- * to add these imported nodes to a DocumentType
will be
- * considered for addition to a future release of the DOM.On import, the
- * publicId
and systemId
attributes are copied.
- * Note that the deep
parameter has no effect on this type
- * of nodes since they cannot have any children.target
and data
values from those of the
- * source node.Note that the deep
parameter has no effect
- * on this type of nodes since they cannot have any children.CharacterData
copy their data
and
- * length
attributes from those of the source node.Note
- * that the deep
parameter has no effect on these types of
- * nodes since they cannot have any children.true
, recursively import the subtree under
- * the specified node; if false
, import only the node
- * itself, as explained above. This has no effect on nodes that cannot
- * have any children, and on Attr
, and
- * EntityReference
nodes.
- * @return The imported node that belongs to this Document
.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
- * supported.
- * Document.xmlVersion
attribute. This may happen when
- * importing an XML 1.1 [XML 1.1] element
- * into an XML 1.0 document, for instance.
- * @since DOM Level 2
- */
- public Node importNode(Node importedNode,
- boolean deep)
- throws DOMException;
-
- /**
- * Creates an element of the given qualified name and namespace URI.
- * null
as the
- * namespaceURI parameter for methods if they wish to have no namespace.
- * @param namespaceURI The namespace URI of the element to create.
- * @param qualifiedName The qualified name of the element type to
- * instantiate.
- * @return A new Element
object with the following
- * attributes:
- * Attribute | - *Value | - *
---|---|
Node.nodeName |
- *
- * qualifiedName |
- *
Node.namespaceURI |
- *
- * namespaceURI |
- *
Node.prefix |
- * prefix, extracted
- * from qualifiedName , or null if there is
- * no prefix |
- *
Node.localName |
- * local name, extracted from
- * qualifiedName |
- *
Element.tagName |
- *
- * qualifiedName |
- *
qualifiedName
is not an XML name according to the XML
- * version in use specified in the Document.xmlVersion
- * attribute.
- * qualifiedName
is a
- * malformed qualified name, if the qualifiedName
has a
- * prefix and the namespaceURI
is null
, or
- * if the qualifiedName
has a prefix that is "xml" and
- * the namespaceURI
is different from "
- * http://www.w3.org/XML/1998/namespace" [XML Namespaces]
- * , or if the qualifiedName
or its prefix is "xmlns" and
- * the namespaceURI
is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI
is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName
nor its prefix is "xmlns".
- * "XML"
feature, since namespaces were
- * defined by XML.
- * @since DOM Level 2
- */
- public Element createElementNS(String namespaceURI,
- String qualifiedName)
- throws DOMException;
-
- /**
- * Creates an attribute of the given qualified name and namespace URI.
- * null
as the
- * namespaceURI
parameter for methods if they wish to have
- * no namespace.
- * @param namespaceURI The namespace URI of the attribute to create.
- * @param qualifiedName The qualified name of the attribute to
- * instantiate.
- * @return A new Attr
object with the following attributes:
- * - * Attribute | - *Value | - *
---|---|
Node.nodeName |
- * qualifiedName | - *
- * Node.namespaceURI |
- * namespaceURI |
- *
- * Node.prefix |
- * prefix, extracted from
- * qualifiedName , or null if there is no
- * prefix |
- *
Node.localName |
- * local name, extracted from
- * qualifiedName |
- *
Attr.name |
- *
- * qualifiedName |
- *
Node.nodeValue |
- * the empty - * string | - *
qualifiedName
is not an XML name according to the XML
- * version in use specified in the Document.xmlVersion
- * attribute.
- * qualifiedName
is a
- * malformed qualified name, if the qualifiedName
has a
- * prefix and the namespaceURI
is null
, if
- * the qualifiedName
has a prefix that is "xml" and the
- * namespaceURI
is different from "
- * http://www.w3.org/XML/1998/namespace", if the qualifiedName
or its prefix is "xmlns" and the
- * namespaceURI
is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI
is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName
nor its prefix is "xmlns".
- * "XML"
feature, since namespaces were
- * defined by XML.
- * @since DOM Level 2
- */
- public Attr createAttributeNS(String namespaceURI,
- String qualifiedName)
- throws DOMException;
-
- /**
- * Returns a NodeList
of all the Elements
with a
- * given local name and namespace URI in document order.
- * @param namespaceURI The namespace URI of the elements to match on. The
- * special value "*"
matches all namespaces.
- * @param localName The local name of the elements to match on. The
- * special value "*" matches all local names.
- * @return A new NodeList
object containing all the matched
- * Elements
.
- * @since DOM Level 2
- */
- public NodeList getElementsByTagNameNS(String namespaceURI,
- String localName);
-
- /**
- * Returns the Element
that has an ID attribute with the
- * given value. If no such element exists, this returns null
- * . If more than one element has an ID attribute with that value, what
- * is returned is undefined.
- * Attr.isId
to determine if an attribute is of type ID.
- * Note: Attributes with the name "ID" or "id" are not of type
- * ID unless so defined.
- * @param elementId The unique id
value for an element.
- * @return The matching element or null
if there is none.
- * @since DOM Level 2
- */
- public Element getElementById(String elementId);
-
- /**
- * An attribute specifying the encoding used for this document at the time
- * of the parsing. This is null
when it is not known, such
- * as when the Document
was created in memory.
- * @since DOM Level 3
- */
- public String getInputEncoding();
-
- /**
- * An attribute specifying, as part of the XML declaration, the encoding of this document. This is null
when
- * unspecified or when it is not known, such as when the
- * Document
was created in memory.
- * @since DOM Level 3
- */
- public String getXmlEncoding();
-
- /**
- * An attribute specifying, as part of the XML declaration, whether this document is standalone. This is false
when
- * unspecified.
- *
Note: No verification is done on the value when setting
- * this attribute. Applications should use
- * Document.normalizeDocument()
with the "validate"
- * parameter to verify if the value matches the validity
- * constraint for standalone document declaration as defined in [XML 1.0].
- * @since DOM Level 3
- */
- public boolean getXmlStandalone();
- /**
- * An attribute specifying, as part of the XML declaration, whether this document is standalone. This is false
when
- * unspecified.
- *
Note: No verification is done on the value when setting
- * this attribute. Applications should use
- * Document.normalizeDocument()
with the "validate"
- * parameter to verify if the value matches the validity
- * constraint for standalone document declaration as defined in [XML 1.0].
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if this document does not support the
- * "XML" feature.
- * @since DOM Level 3
- */
- public void setXmlStandalone(boolean xmlStandalone)
- throws DOMException;
-
- /**
- * An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if
- * this document supports the "XML" feature, the value is
- * "1.0"
. If this document does not support the "XML"
- * feature, the value is always null
. Changing this
- * attribute will affect methods that check for invalid characters in
- * XML names. Application should invoke
- * Document.normalizeDocument()
in order to check for
- * invalid characters in the Node
s that are already part of
- * this Document
.
- *
DOM applications may use the
- * DOMImplementation.hasFeature(feature, version)
method
- * with parameter values "XMLVersion" and "1.0" (respectively) to
- * determine if an implementation supports [XML 1.0]. DOM
- * applications may use the same method with parameter values
- * "XMLVersion" and "1.1" (respectively) to determine if an
- * implementation supports [XML 1.1]. In both
- * cases, in order to support XML, an implementation must also support
- * the "XML" feature defined in this specification. Document
- * objects supporting a version of the "XMLVersion" feature must not
- * raise a NOT_SUPPORTED_ERR
exception for the same version
- * number when using Document.xmlVersion
.
- * @since DOM Level 3
- */
- public String getXmlVersion();
- /**
- * An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if
- * this document supports the "XML" feature, the value is
- * "1.0"
. If this document does not support the "XML"
- * feature, the value is always null
. Changing this
- * attribute will affect methods that check for invalid characters in
- * XML names. Application should invoke
- * Document.normalizeDocument()
in order to check for
- * invalid characters in the Node
s that are already part of
- * this Document
.
- *
DOM applications may use the
- * DOMImplementation.hasFeature(feature, version)
method
- * with parameter values "XMLVersion" and "1.0" (respectively) to
- * determine if an implementation supports [XML 1.0]. DOM
- * applications may use the same method with parameter values
- * "XMLVersion" and "1.1" (respectively) to determine if an
- * implementation supports [XML 1.1]. In both
- * cases, in order to support XML, an implementation must also support
- * the "XML" feature defined in this specification. Document
- * objects supporting a version of the "XMLVersion" feature must not
- * raise a NOT_SUPPORTED_ERR
exception for the same version
- * number when using Document.xmlVersion
.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the version is set to a value that is
- * not supported by this Document
or if this document
- * does not support the "XML" feature.
- * @since DOM Level 3
- */
- public void setXmlVersion(String xmlVersion)
- throws DOMException;
-
- /**
- * An attribute specifying whether error checking is enforced or not. When
- * set to false
, the implementation is free to not test
- * every possible error case normally defined on DOM operations, and not
- * raise any DOMException
on DOM operations or report
- * errors while using Document.normalizeDocument()
. In case
- * of error, the behavior is undefined. This attribute is
- * true
by default.
- * @since DOM Level 3
- */
- public boolean getStrictErrorChecking();
- /**
- * An attribute specifying whether error checking is enforced or not. When
- * set to false
, the implementation is free to not test
- * every possible error case normally defined on DOM operations, and not
- * raise any DOMException
on DOM operations or report
- * errors while using Document.normalizeDocument()
. In case
- * of error, the behavior is undefined. This attribute is
- * true
by default.
- * @since DOM Level 3
- */
- public void setStrictErrorChecking(boolean strictErrorChecking);
-
- /**
- * The location of the document or null
if undefined or if
- * the Document
was created using
- * DOMImplementation.createDocument
. No lexical checking is
- * performed when setting this attribute; this could result in a
- * null
value returned when using Node.baseURI
- * .
- *
Beware that when the Document
supports the feature
- * "HTML" [DOM Level 2 HTML]
- * , the href attribute of the HTML BASE element takes precedence over
- * this attribute when computing Node.baseURI
.
- * @since DOM Level 3
- */
- public String getDocumentURI();
- /**
- * The location of the document or null
if undefined or if
- * the Document
was created using
- * DOMImplementation.createDocument
. No lexical checking is
- * performed when setting this attribute; this could result in a
- * null
value returned when using Node.baseURI
- * .
- *
Beware that when the Document
supports the feature
- * "HTML" [DOM Level 2 HTML]
- * , the href attribute of the HTML BASE element takes precedence over
- * this attribute when computing Node.baseURI
.
- * @since DOM Level 3
- */
- public void setDocumentURI(String documentURI);
-
- /**
- * Attempts to adopt a node from another document to this document. If
- * supported, it changes the ownerDocument
of the source
- * node, its children, as well as the attached attribute nodes if there
- * are any. If the source node has a parent it is first removed from the
- * child list of its parent. This effectively allows moving a subtree
- * from one document to another (unlike importNode()
which
- * create a copy of the source node instead of moving it). When it
- * fails, applications should use Document.importNode()
- * instead. Note that if the adopted node is already part of this
- * document (i.e. the source and target document are the same), this
- * method still has the effect of removing the source node from the
- * child list of its parent, if any. The following list describes the
- * specifics for each type of node.
- *
ownerElement
attribute is set to null
and
- * the specified
flag is set to true
on the
- * adopted Attr
. The descendants of the source
- * Attr
are recursively adopted.Document
nodes cannot be adopted.DocumentType
nodes cannot be adopted.Entity
nodes cannot be adopted.EntityReference
node itself is adopted, the
- * descendants are discarded, since the source and destination documents
- * might have defined the entity differently. If the document being
- * imported into provides a definition for this entity name, its value
- * is assigned.Notation
nodes cannot be
- * adopted.Note: Since it does not create new nodes unlike the
- * Document.importNode()
method, this method does not raise
- * an INVALID_CHARACTER_ERR
exception, and applications
- * should use the Document.normalizeDocument()
method to
- * check if an imported name is not an XML name according to the XML
- * version in use.
- * @param source The node to move into this document.
- * @return The adopted node, or null
if this operation
- * fails, such as when the source node comes from a different
- * implementation.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the source node is of type
- * DOCUMENT
, DOCUMENT_TYPE
.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
- * readonly.
- * @since DOM Level 3
- */
- public Node adoptNode(Node source)
- throws DOMException;
-
- /**
- * The configuration used when Document.normalizeDocument()
- * is invoked.
- * @since DOM Level 3
- */
- public DOMConfiguration getDomConfig();
-
- /**
- * This method acts as if the document was going through a save and load
- * cycle, putting the document in a "normal" form. As a consequence,
- * this method updates the replacement tree of
- * EntityReference
nodes and normalizes Text
- * nodes, as defined in the method Node.normalize()
.
- *
Otherwise, the actual result depends on the features being set on
- * the Document.domConfig
object and governing what
- * operations actually take place. Noticeably this method could also
- * make the document namespace well-formed according to the algorithm
- * described in , check the character normalization, remove the
- * CDATASection
nodes, etc. See
- * DOMConfiguration
for details.
- *
// Keep in the document - * the information defined // in the XML Information Set (Java example) - * DOMConfiguration docConfig = myDocument.getDomConfig(); - * docConfig.setParameter("infoset", Boolean.TRUE); - * myDocument.normalizeDocument();- * - *
Node.nodeName
- * contains an invalid character according to the XML version in use,
- * errors or warnings (DOMError.SEVERITY_ERROR
or
- * DOMError.SEVERITY_WARNING
) will be reported using the
- * DOMErrorHandler
object associated with the "error-handler
- * " parameter. Note this method might also report fatal errors (
- * DOMError.SEVERITY_FATAL_ERROR
) if an implementation
- * cannot recover from an error.
- * @since DOM Level 3
- */
- public void normalizeDocument();
-
- /**
- * Rename an existing node of type ELEMENT_NODE
or
- * ATTRIBUTE_NODE
.
- * Element
its
- * attributes are moved to the new node, the new node is inserted at the
- * position the old node used to have in its parent's child nodes list
- * if it has one, the user data that was attached to the old node is
- * attached to the new node.
- * Element
only the
- * specified attributes are moved, default attributes originated from
- * the DTD are updated according to the new element name. In addition,
- * the implementation may update default attributes from other schemas.
- * Applications should use Document.normalizeDocument()
to
- * guarantee these attributes are up-to-date.
- * Attr
that is
- * attached to an Element
, the node is first removed from
- * the Element
attributes map. Then, once renamed, either
- * by modifying the existing node or creating a new one as described
- * above, it is put back.
- * NODE_RENAMED
is fired,
- * http://www.w3.org/2001/xml-events
,
- * DOMElementNameChanged
} or {
- * http://www.w3.org/2001/xml-events
,
- * DOMAttributeNameChanged
} is fired.
- * ELEMENT_NODE
nor ATTRIBUTE_NODE
,
- * or if the implementation does not support the renaming of the
- * document element.
- * Document.xmlVersion
attribute.
- * qualifiedName
is a
- * malformed qualified name, if the qualifiedName
has a
- * prefix and the namespaceURI
is null
, or
- * if the qualifiedName
has a prefix that is "xml" and
- * the namespaceURI
is different from "
- * http://www.w3.org/XML/1998/namespace" [XML Namespaces]
- * . Also raised, when the node being renamed is an attribute, if the
- * qualifiedName
, or its prefix, is "xmlns" and the
- * namespaceURI
is different from "http://www.w3.org/2000/xmlns/".
- * @since DOM Level 3
- */
- public Node renameNode(Node n,
- String namespaceURI,
- String qualifiedName)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DocumentFragment.java b/libjava/external/w3c_dom/org/w3c/dom/DocumentFragment.java
deleted file mode 100644
index 8c4531eff87..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DocumentFragment.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * DocumentFragment
is a "lightweight" or "minimal"
- * Document
object. It is very common to want to be able to
- * extract a portion of a document's tree or to create a new fragment of a
- * document. Imagine implementing a user command like cut or rearranging a
- * document by moving fragments around. It is desirable to have an object
- * which can hold such fragments and it is quite natural to use a Node for
- * this purpose. While it is true that a Document
object could
- * fulfill this role, a Document
object can potentially be a
- * heavyweight object, depending on the underlying implementation. What is
- * really needed for this is a very lightweight object.
- * DocumentFragment
is such an object.
- * Furthermore, various operations -- such as inserting nodes as children
- * of another Node
-- may take DocumentFragment
- * objects as arguments; this results in all the child nodes of the
- * DocumentFragment
being moved to the child list of this node.
- *
The children of a DocumentFragment
node are zero or more
- * nodes representing the tops of any sub-trees defining the structure of
- * the document. DocumentFragment
nodes do not need to be
- * well-formed XML documents (although they do need to follow the rules
- * imposed upon well-formed XML parsed entities, which can have multiple top
- * nodes). For example, a DocumentFragment
might have only one
- * child and that child node could be a Text
node. Such a
- * structure model represents neither an HTML document nor a well-formed XML
- * document.
- *
When a DocumentFragment
is inserted into a
- * Document
(or indeed any other Node
that may
- * take children) the children of the DocumentFragment
and not
- * the DocumentFragment
itself are inserted into the
- * Node
. This makes the DocumentFragment
very
- * useful when the user wishes to create nodes that are siblings; the
- * DocumentFragment
acts as the parent of these nodes so that
- * the user can use the standard methods from the Node
- * interface, such as Node.insertBefore
and
- * Node.appendChild
.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface DocumentFragment extends Node {
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/DocumentType.java b/libjava/external/w3c_dom/org/w3c/dom/DocumentType.java
deleted file mode 100644
index 6221c7b5ef6..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/DocumentType.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * Each Document
has a doctype
attribute whose value
- * is either null
or a DocumentType
object. The
- * DocumentType
interface in the DOM Core provides an interface
- * to the list of entities that are defined for the document, and little
- * else because the effect of namespaces and the various XML schema efforts
- * on DTD representation are not clearly understood as of this writing.
- *
DOM Level 3 doesn't support editing DocumentType
nodes.
- * DocumentType
nodes are read-only.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface DocumentType extends Node {
- /**
- * The name of DTD; i.e., the name immediately following the
- * DOCTYPE
keyword.
- */
- public String getName();
-
- /**
- * A NamedNodeMap
containing the general entities, both
- * external and internal, declared in the DTD. Parameter entities are
- * not contained. Duplicates are discarded. For example in:
- *
<!DOCTYPE - * ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar - * "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> - * ]> <ex/>- * the interface provides access to
foo
- * and the first declaration of bar
but not the second
- * declaration of bar
or baz
. Every node in
- * this map also implements the Entity
interface.
- * entities
cannot be altered in any way.
- */
- public NamedNodeMap getEntities();
-
- /**
- * A NamedNodeMap
containing the notations declared in the
- * DTD. Duplicates are discarded. Every node in this map also implements
- * the Notation
interface.
- * notations
cannot be altered in any way.
- */
- public NamedNodeMap getNotations();
-
- /**
- * The public identifier of the external subset.
- * @since DOM Level 2
- */
- public String getPublicId();
-
- /**
- * The system identifier of the external subset. This may be an absolute
- * URI or not.
- * @since DOM Level 2
- */
- public String getSystemId();
-
- /**
- * The internal subset as a string, or null
if there is none.
- * This is does not contain the delimiting square brackets.
- * Note: The actual content returned depends on how much
- * information is available to the implementation. This may vary
- * depending on various parameters, including the XML processor used to
- * build the document.
- * @since DOM Level 2
- */
- public String getInternalSubset();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/Element.java b/libjava/external/w3c_dom/org/w3c/dom/Element.java
deleted file mode 100644
index 6a7f7e3d0c7..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/Element.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The Element
interface represents an element in an HTML or XML
- * document. Elements may have attributes associated with them; since the
- * Element
interface inherits from Node
, the
- * generic Node
interface attribute attributes
may
- * be used to retrieve the set of all attributes for an element. There are
- * methods on the Element
interface to retrieve either an
- * Attr
object by name or an attribute value by name. In XML,
- * where an attribute value may contain entity references, an
- * Attr
object should be retrieved to examine the possibly
- * fairly complex sub-tree representing the attribute value. On the other
- * hand, in HTML, where all attributes have simple string values, methods to
- * directly access an attribute value can safely be used as a convenience.
- *
Note: In DOM Level 2, the method normalize
is
- * inherited from the Node
interface where it was moved.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Element extends Node {
- /**
- * The name of the element. If Node.localName
is different
- * from null
, this attribute is a qualified name. For
- * example, in:
- *
<elementExample id="demo"> ... - * </elementExample> ,- *
tagName
has the value
- * "elementExample"
. Note that this is case-preserving in
- * XML, as are all of the operations of the DOM. The HTML DOM returns
- * the tagName
of an HTML element in the canonical
- * uppercase form, regardless of the case in the source HTML document.
- */
- public String getTagName();
-
- /**
- * Retrieves an attribute value by name.
- * @param name The name of the attribute to retrieve.
- * @return The Attr
value as a string, or the empty string
- * if that attribute does not have a specified or default value.
- */
- public String getAttribute(String name);
-
- /**
- * Adds a new attribute. If an attribute with that name is already present
- * in the element, its value is changed to be that of the value
- * parameter. This value is a simple string; it is not parsed as it is
- * being set. So any markup (such as syntax to be recognized as an
- * entity reference) is treated as literal text, and needs to be
- * appropriately escaped by the implementation when it is written out.
- * In order to assign an attribute value that contains entity
- * references, the user must create an Attr
node plus any
- * Text
and EntityReference
nodes, build the
- * appropriate subtree, and use setAttributeNode
to assign
- * it as the value of an attribute.
- * setAttributeNS
method.
- * @param name The name of the attribute to create or alter.
- * @param value Value to set in string form.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
- * name according to the XML version in use specified in the
- * Document.xmlVersion
attribute.
- * Document.normalizeDocument()
to guarantee this
- * information is up-to-date.
- * removeAttributeNS
method.
- * @param name The name of the attribute to remove.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void removeAttribute(String name)
- throws DOMException;
-
- /**
- * Retrieves an attribute node by name.
- * getAttributeNodeNS
method.
- * @param name The name (nodeName
) of the attribute to
- * retrieve.
- * @return The Attr
node with the specified name (
- * nodeName
) or null
if there is no such
- * attribute.
- */
- public Attr getAttributeNode(String name);
-
- /**
- * Adds a new attribute node. If an attribute with that name (
- * nodeName
) is already present in the element, it is
- * replaced by the new one. Replacing an attribute node by itself has no
- * effect.
- * setAttributeNodeNS
method.
- * @param newAttr The Attr
node to add to the attribute list.
- * @return If the newAttr
attribute replaces an existing
- * attribute, the replaced Attr
node is returned,
- * otherwise null
is returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if newAttr
was created from a
- * different document than the one that created the element.
- * newAttr
is already an
- * attribute of another Element
object. The DOM user must
- * explicitly clone Attr
nodes to re-use them in other
- * elements.
- */
- public Attr setAttributeNode(Attr newAttr)
- throws DOMException;
-
- /**
- * Removes the specified attribute node. If a default value for the
- * removed Attr
node is defined in the DTD, a new node
- * immediately appears with the default value as well as the
- * corresponding namespace URI, local name, and prefix when applicable.
- * The implementation may handle default values from other schemas
- * similarly but applications should use
- * Document.normalizeDocument()
to guarantee this
- * information is up-to-date.
- * @param oldAttr The Attr
node to remove from the attribute
- * list.
- * @return The Attr
node that was removed.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * oldAttr
is not an attribute
- * of the element.
- */
- public Attr removeAttributeNode(Attr oldAttr)
- throws DOMException;
-
- /**
- * Returns a NodeList
of all descendant Elements
- * with a given tag name, in document order.
- * @param name The name of the tag to match on. The special value "*"
- * matches all tags.
- * @return A list of matching Element
nodes.
- */
- public NodeList getElementsByTagName(String name);
-
- /**
- * Retrieves an attribute value by local name and namespace URI.
- * null
as the
- * namespaceURI
parameter for methods if they wish to have
- * no namespace.
- * @param namespaceURI The namespace URI of the attribute to retrieve.
- * @param localName The local name of the attribute to retrieve.
- * @return The Attr
value as a string, or the empty string
- * if that attribute does not have a specified or default value.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML"
and the language exposed
- * through the Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public String getAttributeNS(String namespaceURI,
- String localName)
- throws DOMException;
-
- /**
- * Adds a new attribute. If an attribute with the same local name and
- * namespace URI is already present on the element, its prefix is
- * changed to be the prefix part of the qualifiedName
, and
- * its value is changed to be the value
parameter. This
- * value is a simple string; it is not parsed as it is being set. So any
- * markup (such as syntax to be recognized as an entity reference) is
- * treated as literal text, and needs to be appropriately escaped by the
- * implementation when it is written out. In order to assign an
- * attribute value that contains entity references, the user must create
- * an Attr
node plus any Text
and
- * EntityReference
nodes, build the appropriate subtree,
- * and use setAttributeNodeNS
or
- * setAttributeNode
to assign it as the value of an
- * attribute.
- * null
as the
- * namespaceURI
parameter for methods if they wish to have
- * no namespace.
- * @param namespaceURI The namespace URI of the attribute to create or
- * alter.
- * @param qualifiedName The qualified name of the attribute to create or
- * alter.
- * @param value The value to set in string form.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
- * an XML name according to the XML version in use specified in the
- * Document.xmlVersion
attribute.
- * qualifiedName
is
- * malformed per the Namespaces in XML specification, if the
- * qualifiedName
has a prefix and the
- * namespaceURI
is null
, if the
- * qualifiedName
has a prefix that is "xml" and the
- * namespaceURI
is different from "
- * http://www.w3.org/XML/1998/namespace", if the qualifiedName
or its prefix is "xmlns" and the
- * namespaceURI
is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI
is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName
nor its prefix is "xmlns".
- * "XML"
and the language exposed
- * through the Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public void setAttributeNS(String namespaceURI,
- String qualifiedName,
- String value)
- throws DOMException;
-
- /**
- * Removes an attribute by local name and namespace URI. If a default
- * value for the removed attribute is defined in the DTD, a new
- * attribute immediately appears with the default value as well as the
- * corresponding namespace URI, local name, and prefix when applicable.
- * The implementation may handle default values from other schemas
- * similarly but applications should use
- * Document.normalizeDocument()
to guarantee this
- * information is up-to-date.
- * null
as the
- * namespaceURI
parameter for methods if they wish to have
- * no namespace.
- * @param namespaceURI The namespace URI of the attribute to remove.
- * @param localName The local name of the attribute to remove.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * "XML"
and the language exposed
- * through the Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public void removeAttributeNS(String namespaceURI,
- String localName)
- throws DOMException;
-
- /**
- * Retrieves an Attr
node by local name and namespace URI.
- * null
as the
- * namespaceURI
parameter for methods if they wish to have
- * no namespace.
- * @param namespaceURI The namespace URI of the attribute to retrieve.
- * @param localName The local name of the attribute to retrieve.
- * @return The Attr
node with the specified attribute local
- * name and namespace URI or null
if there is no such
- * attribute.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML"
and the language exposed
- * through the Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public Attr getAttributeNodeNS(String namespaceURI,
- String localName)
- throws DOMException;
-
- /**
- * Adds a new attribute. If an attribute with that local name and that
- * namespace URI is already present in the element, it is replaced by
- * the new one. Replacing an attribute node by itself has no effect.
- * null
as the
- * namespaceURI
parameter for methods if they wish to have
- * no namespace.
- * @param newAttr The Attr
node to add to the attribute list.
- * @return If the newAttr
attribute replaces an existing
- * attribute with the same local name and namespace URI, the replaced
- * Attr
node is returned, otherwise null
is
- * returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if newAttr
was created from a
- * different document than the one that created the element.
- * newAttr
is already an
- * attribute of another Element
object. The DOM user must
- * explicitly clone Attr
nodes to re-use them in other
- * elements.
- * "XML"
and the language exposed
- * through the Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public Attr setAttributeNodeNS(Attr newAttr)
- throws DOMException;
-
- /**
- * Returns a NodeList
of all the descendant
- * Elements
with a given local name and namespace URI in
- * document order.
- * @param namespaceURI The namespace URI of the elements to match on. The
- * special value "*" matches all namespaces.
- * @param localName The local name of the elements to match on. The
- * special value "*" matches all local names.
- * @return A new NodeList
object containing all the matched
- * Elements
.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML"
and the language exposed
- * through the Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public NodeList getElementsByTagNameNS(String namespaceURI,
- String localName)
- throws DOMException;
-
- /**
- * Returns true
when an attribute with a given name is
- * specified on this element or has a default value, false
- * otherwise.
- * @param name The name of the attribute to look for.
- * @return true
if an attribute with the given name is
- * specified on this element or has a default value, false
- * otherwise.
- * @since DOM Level 2
- */
- public boolean hasAttribute(String name);
-
- /**
- * Returns true
when an attribute with a given local name and
- * namespace URI is specified on this element or has a default value,
- * false
otherwise.
- * null
as the
- * namespaceURI
parameter for methods if they wish to have
- * no namespace.
- * @param namespaceURI The namespace URI of the attribute to look for.
- * @param localName The local name of the attribute to look for.
- * @return true
if an attribute with the given local name
- * and namespace URI is specified or has a default value on this
- * element, false
otherwise.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML"
and the language exposed
- * through the Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public boolean hasAttributeNS(String namespaceURI,
- String localName)
- throws DOMException;
-
- /**
- * The type information associated with this element.
- * @since DOM Level 3
- */
- public TypeInfo getSchemaTypeInfo();
-
- /**
- * If the parameter isId
is true
, this method
- * declares the specified attribute to be a user-determined ID attribute
- * . This affects the value of Attr.isId
and the behavior
- * of Document.getElementById
, but does not change any
- * schema that may be in use, in particular this does not affect the
- * Attr.schemaTypeInfo
of the specified Attr
- * node. Use the value false
for the parameter
- * isId
to undeclare an attribute for being a
- * user-determined ID attribute.
- * setIdAttributeNS
method.
- * @param name The name of the attribute.
- * @param isId Whether the attribute is a of type ID.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * isId
is true
, this method
- * declares the specified attribute to be a user-determined ID attribute
- * . This affects the value of Attr.isId
and the behavior
- * of Document.getElementById
, but does not change any
- * schema that may be in use, in particular this does not affect the
- * Attr.schemaTypeInfo
of the specified Attr
- * node. Use the value false
for the parameter
- * isId
to undeclare an attribute for being a
- * user-determined ID attribute.
- * @param namespaceURI The namespace URI of the attribute.
- * @param localName The local name of the attribute.
- * @param isId Whether the attribute is a of type ID.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * isId
is true
, this method
- * declares the specified attribute to be a user-determined ID attribute
- * . This affects the value of Attr.isId
and the behavior
- * of Document.getElementById
, but does not change any
- * schema that may be in use, in particular this does not affect the
- * Attr.schemaTypeInfo
of the specified Attr
- * node. Use the value false
for the parameter
- * isId
to undeclare an attribute for being a
- * user-determined ID attribute.
- * @param idAttr The attribute node.
- * @param isId Whether the attribute is a of type ID.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * The nodeName
attribute that is inherited from
- * Node
contains the name of the entity.
- *
An XML processor may choose to completely expand entities before the
- * structure model is passed to the DOM; in this case there will be no
- * EntityReference
nodes in the document tree.
- *
XML does not mandate that a non-validating XML processor read and
- * process entity declarations made in the external subset or declared in
- * parameter entities. This means that parsed entities declared in the
- * external subset need not be expanded by some classes of applications, and
- * that the replacement text of the entity may not be available. When the
- * replacement text is available, the corresponding Entity
node's child list
- * represents the structure of that replacement value. Otherwise, the child
- * list is empty.
- *
DOM Level 3 does not support editing Entity
nodes; if a
- * user wants to make changes to the contents of an Entity
,
- * every related EntityReference
node has to be replaced in the
- * structure model by a clone of the Entity
's contents, and
- * then the desired changes must be made to each of those clones instead.
- * Entity
nodes and all their descendants are readonly.
- *
An Entity
node does not have any parent.
- *
Note: If the entity contains an unbound namespace prefix, the
- * namespaceURI
of the corresponding node in the
- * Entity
node subtree is null
. The same is true
- * for EntityReference
nodes that refer to this entity, when
- * they are created using the createEntityReference
method of
- * the Document
interface.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Entity extends Node {
- /**
- * The public identifier associated with the entity if specified, and
- * null
otherwise.
- */
- public String getPublicId();
-
- /**
- * The system identifier associated with the entity if specified, and
- * null
otherwise. This may be an absolute URI or not.
- */
- public String getSystemId();
-
- /**
- * For unparsed entities, the name of the notation for the entity. For
- * parsed entities, this is null
.
- */
- public String getNotationName();
-
- /**
- * An attribute specifying the encoding used for this entity at the time
- * of parsing, when it is an external parsed entity. This is
- * null
if it an entity from the internal subset or if it
- * is not known.
- * @since DOM Level 3
- */
- public String getInputEncoding();
-
- /**
- * An attribute specifying, as part of the text declaration, the encoding
- * of this entity, when it is an external parsed entity. This is
- * null
otherwise.
- * @since DOM Level 3
- */
- public String getXmlEncoding();
-
- /**
- * An attribute specifying, as part of the text declaration, the version
- * number of this entity, when it is an external parsed entity. This is
- * null
otherwise.
- * @since DOM Level 3
- */
- public String getXmlVersion();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/EntityReference.java b/libjava/external/w3c_dom/org/w3c/dom/EntityReference.java
deleted file mode 100644
index b42b0913bc8..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/EntityReference.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * EntityReference
nodes may be used to represent an entity
- * reference in the tree. Note that character references and references to
- * predefined entities are considered to be expanded by the HTML or XML
- * processor so that characters are represented by their Unicode equivalent
- * rather than by an entity reference. Moreover, the XML processor may
- * completely expand references to entities while building the
- * Document
, instead of providing EntityReference
- * nodes. If it does provide such nodes, then for an
- * EntityReference
node that represents a reference to a known
- * entity an Entity
exists, and the subtree of the
- * EntityReference
node is a copy of the Entity
- * node subtree. However, the latter may not be true when an entity contains
- * an unbound namespace prefix. In such a case, because the namespace prefix
- * resolution depends on where the entity reference is, the descendants of
- * the EntityReference
node may be bound to different namespace
- * URIs. When an EntityReference
node represents a reference to
- * an unknown entity, the node has no children and its replacement value,
- * when used by Attr.value
for example, is empty.
- *
As for Entity
nodes, EntityReference
nodes and
- * all their descendants are readonly.
- *
Note: EntityReference
nodes may cause element
- * content and attribute value normalization problems when, such as in XML
- * 1.0 and XML Schema, the normalization is performed after entity reference
- * are expanded.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface EntityReference extends Node {
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/NameList.java b/libjava/external/w3c_dom/org/w3c/dom/NameList.java
deleted file mode 100644
index 10caa90f6a0..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/NameList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The NameList
interface provides the abstraction of an ordered
- * collection of parallel pairs of name and namespace values (which could be
- * null values), without defining or constraining how this collection is
- * implemented. The items in the NameList
are accessible via an
- * integral index, starting from 0.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface NameList {
- /**
- * Returns the index
th name item in the collection.
- * @param index Index into the collection.
- * @return The name at the index
th position in the
- * NameList
, or null
if there is no name for
- * the specified index or if the index is out of range.
- */
- public String getName(int index);
-
- /**
- * Returns the index
th namespaceURI item in the collection.
- * @param index Index into the collection.
- * @return The namespace URI at the index
th position in the
- * NameList
, or null
if there is no name for
- * the specified index or if the index is out of range.
- */
- public String getNamespaceURI(int index);
-
- /**
- * The number of pairs (name and namespaceURI) in the list. The range of
- * valid child node indices is 0 to length-1
inclusive.
- */
- public int getLength();
-
- /**
- * Test if a name is part of this NameList
.
- * @param str The name to look for.
- * @return true
if the name has been found,
- * false
otherwise.
- */
- public boolean contains(String str);
-
- /**
- * Test if the pair namespaceURI/name is part of this
- * NameList
.
- * @param namespaceURI The namespace URI to look for.
- * @param name The name to look for.
- * @return true
if the pair namespaceURI/name has been
- * found, false
otherwise.
- */
- public boolean containsNS(String namespaceURI,
- String name);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/NamedNodeMap.java b/libjava/external/w3c_dom/org/w3c/dom/NamedNodeMap.java
deleted file mode 100644
index ad1e67bcdeb..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/NamedNodeMap.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * Objects implementing the NamedNodeMap
interface are used to
- * represent collections of nodes that can be accessed by name. Note that
- * NamedNodeMap
does not inherit from NodeList
;
- * NamedNodeMaps
are not maintained in any particular order.
- * Objects contained in an object implementing NamedNodeMap
may
- * also be accessed by an ordinal index, but this is simply to allow
- * convenient enumeration of the contents of a NamedNodeMap
,
- * and does not imply that the DOM specifies an order to these Nodes.
- *
NamedNodeMap
objects in the DOM are live.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface NamedNodeMap {
- /**
- * Retrieves a node specified by name.
- * @param name The nodeName
of a node to retrieve.
- * @return A Node
(of any type) with the specified
- * nodeName
, or null
if it does not identify
- * any node in this map.
- */
- public Node getNamedItem(String name);
-
- /**
- * Adds a node using its nodeName
attribute. If a node with
- * that name is already present in this map, it is replaced by the new
- * one. Replacing a node by itself has no effect.
- *
As the nodeName
attribute is used to derive the name
- * which the node must be stored under, multiple nodes of certain types
- * (those that have a "special" string value) cannot be stored as the
- * names would clash. This is seen as preferable to allowing nodes to be
- * aliased.
- * @param arg A node to store in this map. The node will later be
- * accessible using the value of its nodeName
attribute.
- * @return If the new Node
replaces an existing node the
- * replaced Node
is returned, otherwise null
- * is returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if arg
was created from a
- * different document than the one that created this map.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- *
INUSE_ATTRIBUTE_ERR: Raised if arg
is an
- * Attr
that is already an attribute of another
- * Element
object. The DOM user must explicitly clone
- * Attr
nodes to re-use them in other elements.
- *
HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node
- * doesn't belong in this NamedNodeMap. Examples would include trying
- * to insert something other than an Attr node into an Element's map
- * of attributes, or a non-Entity node into the DocumentType's map of
- * Entities.
- */
- public Node setNamedItem(Node arg)
- throws DOMException;
-
- /**
- * Removes a node specified by name. When this map contains the attributes
- * attached to an element, if the removed attribute is known to have a
- * default value, an attribute immediately appears containing the
- * default value as well as the corresponding namespace URI, local name,
- * and prefix when applicable.
- * @param name The nodeName
of the node to remove.
- * @return The node removed from this map if a node with such a name
- * exists.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised if there is no node named name
in
- * this map.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- */
- public Node removeNamedItem(String name)
- throws DOMException;
-
- /**
- * Returns the index
th item in the map. If index
- * is greater than or equal to the number of nodes in this map, this
- * returns null
.
- * @param index Index into this map.
- * @return The node at the index
th position in the map, or
- * null
if that is not a valid index.
- */
- public Node item(int index);
-
- /**
- * The number of nodes in this map. The range of valid child node indices
- * is 0
to length-1
inclusive.
- */
- public int getLength();
-
- /**
- * Retrieves a node specified by local name and namespace URI.
- *
Per [XML Namespaces]
- * , applications must use the value null as the namespaceURI parameter
- * for methods if they wish to have no namespace.
- * @param namespaceURI The namespace URI of the node to retrieve.
- * @param localName The local name of the node to retrieve.
- * @return A Node
(of any type) with the specified local
- * name and namespace URI, or null
if they do not
- * identify any node in this map.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML" and the language exposed through the
- * Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public Node getNamedItemNS(String namespaceURI,
- String localName)
- throws DOMException;
-
- /**
- * Adds a node using its namespaceURI
and
- * localName
. If a node with that namespace URI and that
- * local name is already present in this map, it is replaced by the new
- * one. Replacing a node by itself has no effect.
- *
Per [XML Namespaces]
- * , applications must use the value null as the namespaceURI parameter
- * for methods if they wish to have no namespace.
- * @param arg A node to store in this map. The node will later be
- * accessible using the value of its namespaceURI
and
- * localName
attributes.
- * @return If the new Node
replaces an existing node the
- * replaced Node
is returned, otherwise null
- * is returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if arg
was created from a
- * different document than the one that created this map.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- *
INUSE_ATTRIBUTE_ERR: Raised if arg
is an
- * Attr
that is already an attribute of another
- * Element
object. The DOM user must explicitly clone
- * Attr
nodes to re-use them in other elements.
- *
HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node
- * doesn't belong in this NamedNodeMap. Examples would include trying
- * to insert something other than an Attr node into an Element's map
- * of attributes, or a non-Entity node into the DocumentType's map of
- * Entities.
- *
NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML" and the language exposed through the
- * Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public Node setNamedItemNS(Node arg)
- throws DOMException;
-
- /**
- * Removes a node specified by local name and namespace URI. A removed
- * attribute may be known to have a default value when this map contains
- * the attributes attached to an element, as returned by the attributes
- * attribute of the Node
interface. If so, an attribute
- * immediately appears containing the default value as well as the
- * corresponding namespace URI, local name, and prefix when applicable.
- *
Per [XML Namespaces]
- * , applications must use the value null as the namespaceURI parameter
- * for methods if they wish to have no namespace.
- * @param namespaceURI The namespace URI of the node to remove.
- * @param localName The local name of the node to remove.
- * @return The node removed from this map if a node with such a local
- * name and namespace URI exists.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised if there is no node with the specified
- * namespaceURI
and localName
in this map.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- *
NOT_SUPPORTED_ERR: May be raised if the implementation does not
- * support the feature "XML" and the language exposed through the
- * Document does not support XML Namespaces (such as [HTML 4.01]).
- * @since DOM Level 2
- */
- public Node removeNamedItemNS(String namespaceURI,
- String localName)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/Node.java b/libjava/external/w3c_dom/org/w3c/dom/Node.java
deleted file mode 100644
index 989d49a2ea0..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/Node.java
+++ /dev/null
@@ -1,900 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The Node
interface is the primary datatype for the entire
- * Document Object Model. It represents a single node in the document tree.
- * While all objects implementing the Node
interface expose
- * methods for dealing with children, not all objects implementing the
- * Node
interface may have children. For example,
- * Text
nodes may not have children, and adding children to
- * such nodes results in a DOMException
being raised.
- *
The attributes nodeName
, nodeValue
and
- * attributes
are included as a mechanism to get at node
- * information without casting down to the specific derived interface. In
- * cases where there is no obvious mapping of these attributes for a
- * specific nodeType
(e.g., nodeValue
for an
- * Element
or attributes
for a Comment
- * ), this returns null
. Note that the specialized interfaces
- * may contain additional and more convenient mechanisms to get and set the
- * relevant information.
- *
The values of nodeName
,
- * nodeValue
, and attributes
vary according to the
- * node type as follows:
- *
Interface | - *nodeName | - *nodeValue | - *attributes | - *
---|---|---|---|
- * Attr |
- * same as Attr.name |
- * same as
- * Attr.value |
- * null |
- *
CDATASection |
- *
- * "#cdata-section" |
- * same as CharacterData.data , the
- * content of the CDATA Section |
- * null |
- *
Comment |
- *
- * "#comment" |
- * same as CharacterData.data , the
- * content of the comment |
- * null |
- *
Document |
- *
- * "#document" |
- * null |
- * null |
- *
- * DocumentFragment |
- * "#document-fragment" |
- *
- * null |
- * null |
- *
DocumentType |
- * same as
- * DocumentType.name |
- * null |
- * null |
- *
- * Element |
- * same as Element.tagName |
- * null |
- *
- * NamedNodeMap |
- *
Entity |
- * entity name | - *null |
- *
- * null |
- *
EntityReference |
- * name of entity referenced | - *
- * null |
- * null |
- *
Notation |
- * notation name | - *
- * null |
- * null |
- *
ProcessingInstruction |
- * same
- * as ProcessingInstruction.target |
- * same as
- * ProcessingInstruction.data |
- * null |
- *
Text |
- *
- * "#text" |
- * same as CharacterData.data , the content
- * of the text node |
- * null |
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Node {
- // NodeType
- /**
- * The node is an Element
.
- */
- public static final short ELEMENT_NODE = 1;
- /**
- * The node is an Attr
.
- */
- public static final short ATTRIBUTE_NODE = 2;
- /**
- * The node is a Text
node.
- */
- public static final short TEXT_NODE = 3;
- /**
- * The node is a CDATASection
.
- */
- public static final short CDATA_SECTION_NODE = 4;
- /**
- * The node is an EntityReference
.
- */
- public static final short ENTITY_REFERENCE_NODE = 5;
- /**
- * The node is an Entity
.
- */
- public static final short ENTITY_NODE = 6;
- /**
- * The node is a ProcessingInstruction
.
- */
- public static final short PROCESSING_INSTRUCTION_NODE = 7;
- /**
- * The node is a Comment
.
- */
- public static final short COMMENT_NODE = 8;
- /**
- * The node is a Document
.
- */
- public static final short DOCUMENT_NODE = 9;
- /**
- * The node is a DocumentType
.
- */
- public static final short DOCUMENT_TYPE_NODE = 10;
- /**
- * The node is a DocumentFragment
.
- */
- public static final short DOCUMENT_FRAGMENT_NODE = 11;
- /**
- * The node is a Notation
.
- */
- public static final short NOTATION_NODE = 12;
-
- /**
- * The name of this node, depending on its type; see the table above.
- */
- public String getNodeName();
-
- /**
- * The value of this node, depending on its type; see the table above.
- * When it is defined to be null
, setting it has no effect,
- * including if the node is read-only.
- * @exception DOMException
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
- * fit in a DOMString
variable on the implementation
- * platform.
- */
- public String getNodeValue()
- throws DOMException;
- /**
- * The value of this node, depending on its type; see the table above.
- * When it is defined to be null
, setting it has no effect,
- * including if the node is read-only.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if
- * it is not defined to be null
.
- */
- public void setNodeValue(String nodeValue)
- throws DOMException;
-
- /**
- * A code representing the type of the underlying object, as defined above.
- */
- public short getNodeType();
-
- /**
- * The parent of this node. All nodes, except Attr
,
- * Document
, DocumentFragment
,
- * Entity
, and Notation
may have a parent.
- * However, if a node has just been created and not yet added to the
- * tree, or if it has been removed from the tree, this is
- * null
.
- */
- public Node getParentNode();
-
- /**
- * A NodeList
that contains all children of this node. If
- * there are no children, this is a NodeList
containing no
- * nodes.
- */
- public NodeList getChildNodes();
-
- /**
- * The first child of this node. If there is no such node, this returns
- * null
.
- */
- public Node getFirstChild();
-
- /**
- * The last child of this node. If there is no such node, this returns
- * null
.
- */
- public Node getLastChild();
-
- /**
- * The node immediately preceding this node. If there is no such node,
- * this returns null
.
- */
- public Node getPreviousSibling();
-
- /**
- * The node immediately following this node. If there is no such node,
- * this returns null
.
- */
- public Node getNextSibling();
-
- /**
- * A NamedNodeMap
containing the attributes of this node (if
- * it is an Element
) or null
otherwise.
- */
- public NamedNodeMap getAttributes();
-
- /**
- * The Document
object associated with this node. This is
- * also the Document
object used to create new nodes. When
- * this node is a Document
or a DocumentType
- * which is not used with any Document
yet, this is
- * null
.
- * @version DOM Level 2
- */
- public Document getOwnerDocument();
-
- /**
- * Inserts the node newChild
before the existing child node
- * refChild
. If refChild
is null
,
- * insert newChild
at the end of the list of children.
- *
If newChild
is a DocumentFragment
object,
- * all of its children are inserted, in the same order, before
- * refChild
. If the newChild
is already in the
- * tree, it is first removed.
- *
Note: Inserting a node before itself is implementation
- * dependent.
- * @param newChild The node to insert.
- * @param refChild The reference node, i.e., the node before which the
- * new node must be inserted.
- * @return The node being inserted.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
- * allow children of the type of the newChild
node, or if
- * the node to insert is one of this node's ancestors or this node
- * itself, or if this node is of type Document
and the
- * DOM application attempts to insert a second
- * DocumentType
or Element
node.
- *
WRONG_DOCUMENT_ERR: Raised if newChild
was created
- * from a different document than the one that created this node.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
- * if the parent of the node being inserted is readonly.
- *
NOT_FOUND_ERR: Raised if refChild
is not a child of
- * this node.
- *
NOT_SUPPORTED_ERR: if this node is of type Document
,
- * this exception might be raised if the DOM implementation doesn't
- * support the insertion of a DocumentType
or
- * Element
node.
- * @version DOM Level 3
- */
- public Node insertBefore(Node newChild,
- Node refChild)
- throws DOMException;
-
- /**
- * Replaces the child node oldChild
with newChild
- * in the list of children, and returns the oldChild
node.
- *
If newChild
is a DocumentFragment
object,
- * oldChild
is replaced by all of the
- * DocumentFragment
children, which are inserted in the
- * same order. If the newChild
is already in the tree, it
- * is first removed.
- *
Note: Replacing a node with itself is implementation
- * dependent.
- * @param newChild The new node to put in the child list.
- * @param oldChild The node being replaced in the list.
- * @return The node replaced.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
- * allow children of the type of the newChild
node, or if
- * the node to put in is one of this node's ancestors or this node
- * itself, or if this node is of type Document
and the
- * result of the replacement operation would add a second
- * DocumentType
or Element
on the
- * Document
node.
- *
WRONG_DOCUMENT_ERR: Raised if newChild
was created
- * from a different document than the one that created this node.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of
- * the new node is readonly.
- *
NOT_FOUND_ERR: Raised if oldChild
is not a child of
- * this node.
- *
NOT_SUPPORTED_ERR: if this node is of type Document
,
- * this exception might be raised if the DOM implementation doesn't
- * support the replacement of the DocumentType
child or
- * Element
child.
- * @version DOM Level 3
- */
- public Node replaceChild(Node newChild,
- Node oldChild)
- throws DOMException;
-
- /**
- * Removes the child node indicated by oldChild
from the list
- * of children, and returns it.
- * @param oldChild The node being removed.
- * @return The node removed.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- *
NOT_FOUND_ERR: Raised if oldChild
is not a child of
- * this node.
- *
NOT_SUPPORTED_ERR: if this node is of type Document
,
- * this exception might be raised if the DOM implementation doesn't
- * support the removal of the DocumentType
child or the
- * Element
child.
- * @version DOM Level 3
- */
- public Node removeChild(Node oldChild)
- throws DOMException;
-
- /**
- * Adds the node newChild
to the end of the list of children
- * of this node. If the newChild
is already in the tree, it
- * is first removed.
- * @param newChild The node to add.If it is a
- * DocumentFragment
object, the entire contents of the
- * document fragment are moved into the child list of this node
- * @return The node added.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
- * allow children of the type of the newChild
node, or if
- * the node to append is one of this node's ancestors or this node
- * itself, or if this node is of type Document
and the
- * DOM application attempts to append a second
- * DocumentType
or Element
node.
- *
WRONG_DOCUMENT_ERR: Raised if newChild
was created
- * from a different document than the one that created this node.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
- * if the previous parent of the node being inserted is readonly.
- *
NOT_SUPPORTED_ERR: if the newChild
node is a child
- * of the Document
node, this exception might be raised
- * if the DOM implementation doesn't support the removal of the
- * DocumentType
child or Element
child.
- * @version DOM Level 3
- */
- public Node appendChild(Node newChild)
- throws DOMException;
-
- /**
- * Returns whether this node has any children.
- * @return Returns true
if this node has any children,
- * false
otherwise.
- */
- public boolean hasChildNodes();
-
- /**
- * Returns a duplicate of this node, i.e., serves as a generic copy
- * constructor for nodes. The duplicate node has no parent (
- * parentNode
is null
) and no user data. User
- * data associated to the imported node is not carried over. However, if
- * any UserDataHandlers
has been specified along with the
- * associated data these handlers will be called with the appropriate
- * parameters before this method returns.
- *
Cloning an Element
copies all attributes and their
- * values, including those generated by the XML processor to represent
- * defaulted attributes, but this method does not copy any children it
- * contains unless it is a deep clone. This includes text contained in
- * an the Element
since the text is contained in a child
- * Text
node. Cloning an Attr
directly, as
- * opposed to be cloned as part of an Element
cloning
- * operation, returns a specified attribute (specified
is
- * true
). Cloning an Attr
always clones its
- * children, since they represent its value, no matter whether this is a
- * deep clone or not. Cloning an EntityReference
- * automatically constructs its subtree if a corresponding
- * Entity
is available, no matter whether this is a deep
- * clone or not. Cloning any other type of node simply returns a copy of
- * this node.
- *
Note that cloning an immutable subtree results in a mutable copy,
- * but the children of an EntityReference
clone are readonly
- * . In addition, clones of unspecified Attr
nodes are
- * specified. And, cloning Document
,
- * DocumentType
, Entity
, and
- * Notation
nodes is implementation dependent.
- * @param deep If true
, recursively clone the subtree under
- * the specified node; if false
, clone only the node
- * itself (and its attributes, if it is an Element
).
- * @return The duplicate node.
- */
- public Node cloneNode(boolean deep);
-
- /**
- * Puts all Text
nodes in the full depth of the sub-tree
- * underneath this Node
, including attribute nodes, into a
- * "normal" form where only structure (e.g., elements, comments,
- * processing instructions, CDATA sections, and entity references)
- * separates Text
nodes, i.e., there are neither adjacent
- * Text
nodes nor empty Text
nodes. This can
- * be used to ensure that the DOM view of a document is the same as if
- * it were saved and re-loaded, and is useful when operations (such as
- * XPointer [XPointer]
- * lookups) that depend on a particular document tree structure are to
- * be used. If the parameter "normalize-characters" of the
- * DOMConfiguration
object attached to the
- * Node.ownerDocument
is true
, this method
- * will also fully normalize the characters of the Text
- * nodes.
- *
Note: In cases where the document contains
- * CDATASections
, the normalize operation alone may not be
- * sufficient, since XPointers do not differentiate between
- * Text
nodes and CDATASection
nodes.
- * @version DOM Level 3
- */
- public void normalize();
-
- /**
- * Tests whether the DOM implementation implements a specific feature and
- * that feature is supported by this node, as specified in .
- * @param feature The name of the feature to test.
- * @param version This is the version number of the feature to test.
- * @return Returns true
if the specified feature is
- * supported on this node, false
otherwise.
- * @since DOM Level 2
- */
- public boolean isSupported(String feature,
- String version);
-
- /**
- * The namespace URI of this node, or null
if it is
- * unspecified (see ).
- *
This is not a computed value that is the result of a namespace
- * lookup based on an examination of the namespace declarations in
- * scope. It is merely the namespace URI given at creation time.
- *
For nodes of any type other than ELEMENT_NODE
and
- * ATTRIBUTE_NODE
and nodes created with a DOM Level 1
- * method, such as Document.createElement()
, this is always
- * null
.
- *
Note: Per the Namespaces in XML Specification [XML Namespaces]
- * an attribute does not inherit its namespace from the element it is
- * attached to. If an attribute is not explicitly given a namespace, it
- * simply has no namespace.
- * @since DOM Level 2
- */
- public String getNamespaceURI();
-
- /**
- * The namespace prefix of this node, or null
if it is
- * unspecified. When it is defined to be null
, setting it
- * has no effect, including if the node is read-only.
- *
Note that setting this attribute, when permitted, changes the
- * nodeName
attribute, which holds the qualified name, as
- * well as the tagName
and name
attributes of
- * the Element
and Attr
interfaces, when
- * applicable.
- *
Setting the prefix to null
makes it unspecified,
- * setting it to an empty string is implementation dependent.
- *
Note also that changing the prefix of an attribute that is known to
- * have a default value, does not make a new attribute with the default
- * value and the original prefix appear, since the
- * namespaceURI
and localName
do not change.
- *
For nodes of any type other than ELEMENT_NODE
and
- * ATTRIBUTE_NODE
and nodes created with a DOM Level 1
- * method, such as createElement
from the
- * Document
interface, this is always null
.
- * @since DOM Level 2
- */
- public String getPrefix();
- /**
- * The namespace prefix of this node, or null
if it is
- * unspecified. When it is defined to be null
, setting it
- * has no effect, including if the node is read-only.
- *
Note that setting this attribute, when permitted, changes the
- * nodeName
attribute, which holds the qualified name, as
- * well as the tagName
and name
attributes of
- * the Element
and Attr
interfaces, when
- * applicable.
- *
Setting the prefix to null
makes it unspecified,
- * setting it to an empty string is implementation dependent.
- *
Note also that changing the prefix of an attribute that is known to
- * have a default value, does not make a new attribute with the default
- * value and the original prefix appear, since the
- * namespaceURI
and localName
do not change.
- *
For nodes of any type other than ELEMENT_NODE
and
- * ATTRIBUTE_NODE
and nodes created with a DOM Level 1
- * method, such as createElement
from the
- * Document
interface, this is always null
.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
- * illegal character according to the XML version in use specified in
- * the Document.xmlVersion
attribute.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- *
NAMESPACE_ERR: Raised if the specified prefix
is
- * malformed per the Namespaces in XML specification, if the
- * namespaceURI
of this node is null
, if the
- * specified prefix is "xml" and the namespaceURI
of this
- * node is different from "
- * http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and
- * the namespaceURI
of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName
of
- * this node is "xmlns" [XML Namespaces]
- * .
- * @since DOM Level 2
- */
- public void setPrefix(String prefix)
- throws DOMException;
-
- /**
- * Returns the local part of the qualified name of this node.
- *
For nodes of any type other than ELEMENT_NODE
and
- * ATTRIBUTE_NODE
and nodes created with a DOM Level 1
- * method, such as Document.createElement()
, this is always
- * null
.
- * @since DOM Level 2
- */
- public String getLocalName();
-
- /**
- * Returns whether this node (if it is an element) has any attributes.
- * @return Returns true
if this node has any attributes,
- * false
otherwise.
- * @since DOM Level 2
- */
- public boolean hasAttributes();
-
- /**
- * The absolute base URI of this node or null
if the
- * implementation wasn't able to obtain an absolute URI. This value is
- * computed as described in . However, when the Document
- * supports the feature "HTML" [DOM Level 2 HTML]
- * , the base URI is computed using first the value of the href
- * attribute of the HTML BASE element if any, and the value of the
- * documentURI
attribute from the Document
- * interface otherwise.
- * @since DOM Level 3
- */
- public String getBaseURI();
-
- // DocumentPosition
- /**
- * The two nodes are disconnected. Order between disconnected nodes is
- * always implementation-specific.
- */
- public static final short DOCUMENT_POSITION_DISCONNECTED = 0x01;
- /**
- * The second node precedes the reference node.
- */
- public static final short DOCUMENT_POSITION_PRECEDING = 0x02;
- /**
- * The node follows the reference node.
- */
- public static final short DOCUMENT_POSITION_FOLLOWING = 0x04;
- /**
- * The node contains the reference node. A node which contains is always
- * preceding, too.
- */
- public static final short DOCUMENT_POSITION_CONTAINS = 0x08;
- /**
- * The node is contained by the reference node. A node which is contained
- * is always following, too.
- */
- public static final short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
- /**
- * The determination of preceding versus following is
- * implementation-specific.
- */
- public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
-
- /**
- * Compares the reference node, i.e. the node on which this method is
- * being called, with a node, i.e. the one passed as a parameter, with
- * regard to their position in the document and according to the
- * document order.
- * @param other The node to compare against the reference node.
- * @return Returns how the node is positioned relatively to the reference
- * node.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: when the compared nodes are from different DOM
- * implementations that do not coordinate to return consistent
- * implementation-specific results.
- * @since DOM Level 3
- */
- public short compareDocumentPosition(Node other)
- throws DOMException;
-
- /**
- * This attribute returns the text content of this node and its
- * descendants. When it is defined to be null
, setting it
- * has no effect. On setting, any possible children this node may have
- * are removed and, if it the new string is not empty or
- * null
, replaced by a single Text
node
- * containing the string this attribute is set to.
- *
On getting, no serialization is performed, the returned string
- * does not contain any markup. No whitespace normalization is performed
- * and the returned string does not contain the white spaces in element
- * content (see the attribute
- * Text.isElementContentWhitespace
). Similarly, on setting,
- * no parsing is performed either, the input string is taken as pure
- * textual content.
- *
The string returned is made of the text content of this node
- * depending on its type, as defined below:
- *
Node type | - *Content | - *
---|---|
- * ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, - * DOCUMENT_FRAGMENT_NODE | - *concatenation of the textContent
- * attribute value of every child node, excluding COMMENT_NODE and
- * PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
- * node has no children. |
- *
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, - * PROCESSING_INSTRUCTION_NODE | - *nodeValue |
- *
DOCUMENT_NODE, - * DOCUMENT_TYPE_NODE, NOTATION_NODE | - *null | - *
DOMString
variable on the implementation
- * platform.
- * @since DOM Level 3
- */
- public String getTextContent()
- throws DOMException;
- /**
- * This attribute returns the text content of this node and its
- * descendants. When it is defined to be null
, setting it
- * has no effect. On setting, any possible children this node may have
- * are removed and, if it the new string is not empty or
- * null
, replaced by a single Text
node
- * containing the string this attribute is set to.
- * Text.isElementContentWhitespace
). Similarly, on setting,
- * no parsing is performed either, the input string is taken as pure
- * textual content.
- * Node type | - *Content | - *
---|---|
- * ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, - * DOCUMENT_FRAGMENT_NODE | - *concatenation of the textContent
- * attribute value of every child node, excluding COMMENT_NODE and
- * PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
- * node has no children. |
- *
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, - * PROCESSING_INSTRUCTION_NODE | - *nodeValue |
- *
DOCUMENT_NODE, - * DOCUMENT_TYPE_NODE, NOTATION_NODE | - *null | - *
Node
references returned by the implementation reference
- * the same object. When two Node
references are references
- * to the same object, even if through a proxy, the references may be
- * used completely interchangeably, such that all attributes have the
- * same values and calling the same DOM method on either reference
- * always has exactly the same effect.
- * @param other The node to test against.
- * @return Returns true
if the nodes are the same,
- * false
otherwise.
- * @since DOM Level 3
- */
- public boolean isSameNode(Node other);
-
- /**
- * Look up the prefix associated to the given namespace URI, starting from
- * this node. The default namespace declarations are ignored by this
- * method.
- * null
if none is found. If more than one prefix are
- * associated to the namespace prefix, the returned namespace prefix
- * is implementation dependent.
- * @since DOM Level 3
- */
- public String lookupPrefix(String namespaceURI);
-
- /**
- * This method checks if the specified namespaceURI
is the
- * default namespace or not.
- * @param namespaceURI The namespace URI to look for.
- * @return Returns true
if the specified
- * namespaceURI
is the default namespace,
- * false
otherwise.
- * @since DOM Level 3
- */
- public boolean isDefaultNamespace(String namespaceURI);
-
- /**
- * Look up the namespace URI associated to the given prefix, starting from
- * this node.
- * null
, the method will return the default namespace URI
- * if any.
- * @return Returns the associated namespace URI or null
if
- * none is found.
- * @since DOM Level 3
- */
- public String lookupNamespaceURI(String prefix);
-
- /**
- * Tests whether two nodes are equal.
- * Node.isSameNode()
. All nodes that are the
- * same will also be equal, though the reverse may not be true.
- * nodeName
, localName
,
- * namespaceURI
, prefix
, nodeValue
- * . This is: they are both null
, or they have the same
- * length and are character for character identical.
- * attributes
NamedNodeMaps
are equal. This
- * is: they are both null
, or they have the same length and
- * for each node that exists in one map there is a node that exists in
- * the other map and is equal, although not necessarily at the same
- * index.
- * childNodes
NodeLists
are equal.
- * This is: they are both null
, or they have the same
- * length and contain equal nodes at the same index. Note that
- * normalization can affect equality; to avoid this, nodes should be
- * normalized before being compared.
- * DocumentType
nodes to be equal, the following
- * conditions must also be satisfied:
- * publicId
, systemId
,
- * internalSubset
.
- * entities
- * NamedNodeMaps
are equal.
- * notations
- * NamedNodeMaps
are equal.
- * ownerDocument
, baseURI
, and
- * parentNode
attributes, the specified
- * attribute for Attr
nodes, the schemaTypeInfo
- * attribute for Attr
and Element
nodes, the
- * Text.isElementContentWhitespace
attribute for
- * Text
nodes, as well as any user data or event listeners
- * registered on the nodes.
- * Note: As a general rule, anything not mentioned in the
- * description above is not significant in consideration of equality
- * checking. Note that future versions of this specification may take
- * into account more attributes and implementations conform to this
- * specification are expected to be updated accordingly.
- * @param arg The node to compare equality with.
- * @return Returns true
if the nodes are equal,
- * false
otherwise.
- * @since DOM Level 3
- */
- public boolean isEqualNode(Node arg);
-
- /**
- * This method returns a specialized object which implements the
- * specialized APIs of the specified feature and version, as specified
- * in . The specialized object may also be obtained by using
- * binding-specific casting methods but is not necessarily expected to,
- * as discussed in . This method also allow the implementation to
- * provide specialized objects which do not support the Node
- * interface.
- * @param feature The name of the feature requested. Note that any plus
- * sign "+" prepended to the name of the feature will be ignored since
- * it is not significant in the context of this method.
- * @param version This is the version number of the feature to test.
- * @return Returns an object which implements the specialized APIs of
- * the specified feature and version, if any, or null
if
- * there is no object which implements interfaces associated with that
- * feature. If the DOMObject
returned by this method
- * implements the Node
interface, it must delegate to the
- * primary core Node
and not return results inconsistent
- * with the primary core Node
such as attributes,
- * childNodes, etc.
- * @since DOM Level 3
- */
- public Object getFeature(String feature,
- String version);
-
- /**
- * Associate an object to a key on this node. The object can later be
- * retrieved from this node by calling getUserData
with the
- * same key.
- * @param key The key to associate the object to.
- * @param data The object to associate to the given key, or
- * null
to remove any existing association to that key.
- * @param handler The handler to associate to that key, or
- * null
.
- * @return Returns the DOMUserData
previously associated to
- * the given key on this node, or null
if there was none.
- * @since DOM Level 3
- */
- public Object setUserData(String key,
- Object data,
- UserDataHandler handler);
-
- /**
- * Retrieves the object associated to a key on a this node. The object
- * must first have been set to this node by calling
- * setUserData
with the same key.
- * @param key The key the object is associated to.
- * @return Returns the DOMUserData
associated to the given
- * key on this node, or null
if there was none.
- * @since DOM Level 3
- */
- public Object getUserData(String key);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/NodeList.java b/libjava/external/w3c_dom/org/w3c/dom/NodeList.java
deleted file mode 100644
index e4204ec974c..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/NodeList.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The NodeList
interface provides the abstraction of an ordered
- * collection of nodes, without defining or constraining how this collection
- * is implemented. NodeList
objects in the DOM are live.
- *
The items in the NodeList
are accessible via an integral
- * index, starting from 0.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface NodeList {
- /**
- * Returns the index
th item in the collection. If
- * index
is greater than or equal to the number of nodes in
- * the list, this returns null
.
- * @param index Index into the collection.
- * @return The node at the index
th position in the
- * NodeList
, or null
if that is not a valid
- * index.
- */
- public Node item(int index);
-
- /**
- * The number of nodes in the list. The range of valid child node indices
- * is 0 to length-1
inclusive.
- */
- public int getLength();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/Notation.java b/libjava/external/w3c_dom/org/w3c/dom/Notation.java
deleted file mode 100644
index 3739f928443..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/Notation.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * This interface represents a notation declared in the DTD. A notation either
- * declares, by name, the format of an unparsed entity (see section 4.7 of the XML 1.0 specification [XML 1.0]), or is
- * used for formal declaration of processing instruction targets (see section 2.6 of the XML 1.0 specification [XML 1.0]). The
- * nodeName
attribute inherited from Node
is set
- * to the declared name of the notation.
- *
The DOM Core does not support editing Notation
nodes; they
- * are therefore readonly.
- *
A Notation
node does not have any parent.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Notation extends Node {
- /**
- * The public identifier of this notation. If the public identifier was
- * not specified, this is null
.
- */
- public String getPublicId();
-
- /**
- * The system identifier of this notation. If the system identifier was
- * not specified, this is null
. This may be an absolute URI
- * or not.
- */
- public String getSystemId();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ProcessingInstruction.java b/libjava/external/w3c_dom/org/w3c/dom/ProcessingInstruction.java
deleted file mode 100644
index 0b6825f104c..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ProcessingInstruction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The ProcessingInstruction
interface represents a "processing
- * instruction", used in XML as a way to keep processor-specific information
- * in the text of the document.
- *
No lexical check is done on the content of a processing instruction and
- * it is therefore possible to have the character sequence
- * "?>"
in the content, which is illegal a processing
- * instruction per section 2.6 of [XML 1.0]. The
- * presence of this character sequence must generate a fatal error during
- * serialization.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface ProcessingInstruction extends Node {
- /**
- * The target of this processing instruction. XML defines this as being
- * the first token following the markup that begins the processing
- * instruction.
- */
- public String getTarget();
-
- /**
- * The content of this processing instruction. This is from the first non
- * white space character after the target to the character immediately
- * preceding the ?>
.
- */
- public String getData();
- /**
- * The content of this processing instruction. This is from the first non
- * white space character after the target to the character immediately
- * preceding the ?>
.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- */
- public void setData(String data)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/Text.java b/libjava/external/w3c_dom/org/w3c/dom/Text.java
deleted file mode 100644
index 9c294a4a488..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/Text.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The Text
interface inherits from CharacterData
- * and represents the textual content (termed character data in XML) of an Element
or Attr
. If there is no
- * markup inside an element's content, the text is contained in a single
- * object implementing the Text
interface that is the only
- * child of the element. If there is markup, it is parsed into the
- * information items (elements, comments, etc.) and Text
nodes
- * that form the list of children of the element.
- *
When a document is first made available via the DOM, there is only one
- * Text
node for each block of text. Users may create adjacent
- * Text
nodes that represent the contents of a given element
- * without any intervening markup, but should be aware that there is no way
- * to represent the separations between these nodes in XML or HTML, so they
- * will not (in general) persist between DOM editing sessions. The
- * Node.normalize()
method merges any such adjacent
- * Text
objects into a single node for each block of text.
- *
No lexical check is done on the content of a Text
node
- * and, depending on its position in the document, some characters must be
- * escaped during serialization using character references; e.g. the
- * characters "<&" if the textual content is part of an element or of
- * an attribute, the character sequence "]]>" when part of an element,
- * the quotation mark character " or the apostrophe character ' when part of
- * an attribute.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- */
-public interface Text extends CharacterData {
- /**
- * Breaks this node into two nodes at the specified offset
,
- * keeping both in the tree as siblings. After being split, this node
- * will contain all the content up to the offset
point. A
- * new node of the same type, which contains all the content at and
- * after the offset
point, is returned. If the original
- * node had a parent node, the new node is inserted as the next sibling
- * of the original node. When the offset
is equal to the
- * length of this node, the new node has no data.
- * @param offset The 16-bit unit offset at which to split, starting from
- * 0
.
- * @return The new node, of the same type as this node.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
- * than the number of 16-bit units in data
.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public Text splitText(int offset)
- throws DOMException;
-
- /**
- * Returns whether this text node contains
- * element content whitespace, often abusively called "ignorable whitespace". The text node is
- * determined to contain whitespace in element content during the load
- * of the document or if validation occurs while using
- * Document.normalizeDocument()
.
- * @since DOM Level 3
- */
- public boolean isElementContentWhitespace();
-
- /**
- * Returns all text of Text
nodes logically-adjacent text
- * nodes to this node, concatenated in document order.
- *
For instance, in the example below wholeText
on the
- * Text
node that contains "bar" returns "barfoo", while on
- * the Text
node that contains "foo" it returns "barfoo".
- * @since DOM Level 3
- */
- public String getWholeText();
-
- /**
- * Replaces the text of the current node and all logically-adjacent text
- * nodes with the specified text. All logically-adjacent text nodes are
- * removed including the current node unless it was the recipient of the
- * replacement text.
- *
This method returns the node which received the replacement text.
- * The returned node is:
- *
null
, when the replacement text is
- * the empty string;
- * Text
node of the same type (
- * Text
or CDATASection
) as the current node
- * inserted at the location of the replacement.
- * replaceWholeText
on the Text
node that
- * contains "bar" with "yo" in argument results in the following:
- * EntityReference
, the EntityReference
must
- * be removed instead of the read-only nodes. If any
- * EntityReference
to be removed has descendants that are
- * not EntityReference
, Text
, or
- * CDATASection
nodes, the replaceWholeText
- * method must fail before performing any modification of the document,
- * raising a DOMException
with the code
- * NO_MODIFICATION_ALLOWED_ERR
.
- * replaceWholeText
on the Text
node that
- * contains "bar" fails, because the EntityReference
node
- * "ent" contains an Element
node which cannot be removed.
- * @param content The content of the replacing Text
node.
- * @return The Text
node created with the specified content.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the Text
- * nodes being replaced is readonly.
- * @since DOM Level 3
- */
- public Text replaceWholeText(String content)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/TypeInfo.java b/libjava/external/w3c_dom/org/w3c/dom/TypeInfo.java
deleted file mode 100644
index 054f9907245..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/TypeInfo.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * The TypeInfo
interface represents a type referenced from
- * Element
or Attr
nodes, specified in the schemas
- * associated with the document. The type is a pair of a namespace URI and
- * name properties, and depends on the document's schema.
- * If the document's schema is an XML DTD [XML 1.0], the values - * are computed as follows: - *
Attr
node, typeNamespace
is
- * "http://www.w3.org/TR/REC-xml"
and typeName
- * represents the [attribute type] property in the [XML Information Set]
- * . If there is no declaration for the attribute, typeNamespace
- * and typeName
are null
.
- * Element
node, typeNamespace
- * and typeName
are null
.
- * If the document's schema is an XML Schema [XML Schema Part 1] - * , the values are computed as follows using the post-schema-validation - * infoset contributions (also called PSVI contributions): - *
null
.
- * Note: At the time of writing, the XML Schema specification does - * not require exposing the declared type. Thus, DOM implementations might - * choose not to provide type information if validity is not valid. - *
Note: Other schema languages are outside the scope of the W3C
- * and therefore should define how to represent their type systems using
- * TypeInfo
.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface TypeInfo {
- /**
- * The name of a type declared for the associated element or attribute,
- * or null
if unknown.
- */
- public String getTypeName();
-
- /**
- * The namespace of the type declared for the associated element or
- * attribute or null
if the element does not have
- * declaration or if no namespace information is available.
- */
- public String getTypeNamespace();
-
- // DerivationMethods
- /**
- * If the document's schema is an XML Schema [XML Schema Part 1]
- * , this constant represents the derivation by
- * restriction if complex types are involved, or a
- * restriction if simple types are involved.
- *
The reference type definition is derived by restriction from the
- * other type definition if the other type definition is the same as the
- * reference type definition, or if the other type definition can be
- * reached recursively following the {base type definition} property
- * from the reference type definition, and all the derivation methods involved are restriction.
- */
- public static final int DERIVATION_RESTRICTION = 0x00000001;
- /**
- * If the document's schema is an XML Schema [XML Schema Part 1]
- * , this constant represents the derivation by
- * extension.
- *
The reference type definition is derived by extension from the
- * other type definition if the other type definition can be reached
- * recursively following the {base type definition} property from the
- * reference type definition, and at least one of the derivation methods involved is an extension.
- */
- public static final int DERIVATION_EXTENSION = 0x00000002;
- /**
- * If the document's schema is an XML Schema [XML Schema Part 1]
- * , this constant represents the
- * union if simple types are involved.
- *
The reference type definition is derived by union from the other
- * type definition if there exists two type definitions T1 and T2 such
- * as the reference type definition is derived from T1 by
- * DERIVATION_RESTRICTION
or
- * DERIVATION_EXTENSION
, T2 is derived from the other type
- * definition by DERIVATION_RESTRICTION
, T1 has {variety} union, and one of the {member type definitions} is T2. Note that T1 could be
- * the same as the reference type definition, and T2 could be the same
- * as the other type definition.
- */
- public static final int DERIVATION_UNION = 0x00000004;
- /**
- * If the document's schema is an XML Schema [XML Schema Part 1]
- * , this constant represents the list.
- *
The reference type definition is derived by list from the other
- * type definition if there exists two type definitions T1 and T2 such
- * as the reference type definition is derived from T1 by
- * DERIVATION_RESTRICTION
or
- * DERIVATION_EXTENSION
, T2 is derived from the other type
- * definition by DERIVATION_RESTRICTION
, T1 has {variety} list, and T2 is the {item type definition}. Note that T1 could be the same as
- * the reference type definition, and T2 could be the same as the other
- * type definition.
- */
- public static final int DERIVATION_LIST = 0x00000008;
-
- /**
- * This method returns if there is a derivation between the reference
- * type definition, i.e. the TypeInfo
on which the method
- * is being called, and the other type definition, i.e. the one passed
- * as parameters.
- * @param typeNamespaceArg the namespace of the other type definition.
- * @param typeNameArg the name of the other type definition.
- * @param derivationMethod the type of derivation and conditions applied
- * between two types, as described in the list of constants provided
- * in this interface.
- * @return If the document's schema is a DTD or no schema is associated
- * with the document, this method will always return false
- * . If the document's schema is an XML Schema, the method will
- * true
if the reference type definition is derived from
- * the other type definition according to the derivation parameter. If
- * the value of the parameter is 0
(no bit is set to
- * 1
for the derivationMethod
parameter),
- * the method will return true
if the other type
- * definition can be reached by recursing any combination of {base
- * type definition}, {item type definition}, or {member type
- * definitions} from the reference type definition.
- */
- public boolean isDerivedFrom(String typeNamespaceArg,
- String typeNameArg,
- int derivationMethod);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/UserDataHandler.java b/libjava/external/w3c_dom/org/w3c/dom/UserDataHandler.java
deleted file mode 100644
index a16ea7308c2..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/UserDataHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom;
-
-/**
- * When associating an object to a key on a node using
- * Node.setUserData()
the application can provide a handler
- * that gets called when the node the object is associated to is being
- * cloned, imported, or renamed. This can be used by the application to
- * implement various behaviors regarding the data it associates to the DOM
- * nodes. This interface defines that handler.
- *
See also the Document Object Model (DOM) Level 3 Core Specification.
- * @since DOM Level 3
- */
-public interface UserDataHandler {
- // OperationType
- /**
- * The node is cloned, using Node.cloneNode()
.
- */
- public static final short NODE_CLONED = 1;
- /**
- * The node is imported, using Document.importNode()
.
- */
- public static final short NODE_IMPORTED = 2;
- /**
- * The node is deleted.
- *
Note: This may not be supported or may not be reliable in
- * certain environments, such as Java, where the implementation has no
- * real control over when objects are actually deleted.
- */
- public static final short NODE_DELETED = 3;
- /**
- * The node is renamed, using Document.renameNode()
.
- */
- public static final short NODE_RENAMED = 4;
- /**
- * The node is adopted, using Document.adoptNode()
.
- */
- public static final short NODE_ADOPTED = 5;
-
- /**
- * This method is called whenever the node for which this handler is
- * registered is imported or cloned.
- *
DOM applications must not raise exceptions in a
- * UserDataHandler
. The effect of throwing exceptions from
- * the handler is DOM implementation dependent.
- * @param operation Specifies the type of operation that is being
- * performed on the node.
- * @param key Specifies the key for which this handler is being called.
- * @param data Specifies the data for which this handler is being called.
- * @param src Specifies the node being cloned, adopted, imported, or
- * renamed. This is null
when the node is being deleted.
- * @param dst Specifies the node newly created if any, or
- * null
.
- */
- public void handle(short operation,
- String key,
- Object data,
- Node src,
- Node dst);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/bootstrap/DOMImplementationRegistry.java b/libjava/external/w3c_dom/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
deleted file mode 100644
index be73f396bd8..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-
-package org.w3c.dom.bootstrap;
-
-import java.util.StringTokenizer;
-import java.util.Vector;
-import org.w3c.dom.DOMImplementationSource;
-import org.w3c.dom.DOMImplementationList;
-import org.w3c.dom.DOMImplementation;
-import java.io.InputStream;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * A factory that enables applications to obtain instances of
- * DOMImplementation
.
- *
- *
- * Example: - *
- * - *- * // get an instance of the DOMImplementation registry - * DOMImplementationRegistry registry = - * DOMImplementationRegistry.newInstance(); - * // get a DOM implementation the Level 3 XML module - * DOMImplementation domImpl = - * registry.getDOMImplementation("XML 3.0"); - *- * - *
- * This provides an application with an implementation-independent starting - * point. DOM implementations may modify this class to meet new security - * standards or to provide *additional* fallbacks for the list of - * DOMImplementationSources. - *
- * - * @see DOMImplementation - * @see DOMImplementationSource - * @since DOM Level 3 - */ -public final class DOMImplementationRegistry { - /** - * The system property to specify the - * DOMImplementationSource class names. - */ - public static final String PROPERTY = - "org.w3c.dom.DOMImplementationSourceList"; - - /** - * Default columns per line. - */ - private static final int DEFAULT_LINE_LENGTH = 80; - - /** - * The list of DOMImplementationSources. - */ - private Vector sources; - - /** - * Private constructor. - * @param srcs Vector List of DOMImplementationSources - */ - private DOMImplementationRegistry(final Vector srcs) { - sources = srcs; - } - - /** - * Obtain a new instance of aDOMImplementationRegistry
.
- *
-
- * The DOMImplementationRegistry
is initialized by the
- * application or the implementation, depending on the context, by
- * first checking the value of the Java system property
- * org.w3c.dom.DOMImplementationSourceList
and
- * the the service provider whose contents are at
- * "META_INF/services/org.w3c.dom.DOMImplementationSourceList
"
- * The value of this property is a white-space separated list of
- * names of availables classes implementing the
- * DOMImplementationSource
interface. Each class listed
- * in the class name list is instantiated and any exceptions
- * encountered are thrown to the application.
- *
- * @return an initialized instance of DOMImplementationRegistry
- * @throws ClassNotFoundException
- * If any specified class can not be found
- * @throws InstantiationException
- * If any specified class is an interface or abstract class
- * @throws IllegalAccessException
- * If the default constructor of a specified class is not accessible
- * @throws ClassCastException
- * If any specified class does not implement
- * DOMImplementationSource
- */
- public static DOMImplementationRegistry newInstance()
- throws
- ClassNotFoundException,
- InstantiationException,
- IllegalAccessException,
- ClassCastException {
- Vector sources = new Vector();
-
- ClassLoader classLoader = getClassLoader();
- // fetch system property:
- String p = getSystemProperty(PROPERTY);
-
- //
- // if property is not specified then use contents of
- // META_INF/org.w3c.dom.DOMImplementationSourceList from classpath
- if (p == null) {
- p = getServiceValue(classLoader);
- }
- if (p == null) {
- //
- // DOM Implementations can modify here to add *additional* fallback
- // mechanisms to access a list of default DOMImplementationSources.
- p = "gnu.xml.dom.ImplementationSource";
- }
- if (p != null) {
- StringTokenizer st = new StringTokenizer(p);
- while (st.hasMoreTokens()) {
- String sourceName = st.nextToken();
- // Use context class loader, falling back to Class.forName
- // if and only if this fails...
- Class sourceClass = null;
- if (classLoader != null) {
- sourceClass = classLoader.loadClass(sourceName);
- } else {
- sourceClass = Class.forName(sourceName);
- }
- DOMImplementationSource source =
- (DOMImplementationSource) sourceClass.newInstance();
- sources.addElement(source);
- }
- }
- return new DOMImplementationRegistry(sources);
- }
-
- /**
- * Return the first implementation that has the desired
- * features, or null
if none is found.
- *
- * @param features
- * A string that specifies which features are required. This is
- * a space separated list in which each feature is specified by
- * its name optionally followed by a space and a version number.
- * This is something like: "XML 1.0 Traversal +Events 2.0"
- * @return An implementation that has the desired features,
- * or null
if none found.
- */
- public DOMImplementation getDOMImplementation(final String features) {
- int size = sources.size();
- String name = null;
- for (int i = 0; i < size; i++) {
- DOMImplementationSource source =
- (DOMImplementationSource) sources.elementAt(i);
- DOMImplementation impl = source.getDOMImplementation(features);
- if (impl != null) {
- return impl;
- }
- }
- return null;
- }
-
- /**
- * Return a list of implementations that support the
- * desired features.
- *
- * @param features
- * A string that specifies which features are required. This is
- * a space separated list in which each feature is specified by
- * its name optionally followed by a space and a version number.
- * This is something like: "XML 1.0 Traversal +Events 2.0"
- * @return A list of DOMImplementations that support the desired features.
- */
- public DOMImplementationList getDOMImplementationList(final String features) {
- final Vector implementations = new Vector();
- int size = sources.size();
- for (int i = 0; i < size; i++) {
- DOMImplementationSource source =
- (DOMImplementationSource) sources.elementAt(i);
- DOMImplementationList impls =
- source.getDOMImplementationList(features);
- for (int j = 0; j < impls.getLength(); j++) {
- DOMImplementation impl = impls.item(j);
- implementations.addElement(impl);
- }
- }
- return new DOMImplementationList() {
- public DOMImplementation item(final int index) {
- if (index >= 0 && index < implementations.size()) {
- try {
- return (DOMImplementation)
- implementations.elementAt(index);
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
- return null;
- }
-
- public int getLength() {
- return implementations.size();
- }
- };
- }
-
- /**
- * Register an implementation.
- *
- * @param s The source to be registered, may not be null
- */
- public void addSource(final DOMImplementationSource s) {
- if (s == null) {
- throw new NullPointerException();
- }
- if (!sources.contains(s)) {
- sources.addElement(s);
- }
- }
-
- /**
- *
- * Gets a class loader.
- *
- * @return A class loader, possibly null
- */
- private static ClassLoader getClassLoader() {
- try {
- ClassLoader contextClassLoader = getContextClassLoader();
-
- if (contextClassLoader != null) {
- return contextClassLoader;
- }
- } catch (Exception e) {
- // Assume that the DOM application is in a JRE 1.1, use the
- // current ClassLoader
- return DOMImplementationRegistry.class.getClassLoader();
- }
- return DOMImplementationRegistry.class.getClassLoader();
- }
-
- /**
- * This method attempts to return the first line of the resource
- * META_INF/services/org.w3c.dom.DOMImplementationSourceList
- * from the provided ClassLoader.
- *
- * @param classLoader classLoader, may not be null
.
- * @return first line of resource, or null
- */
- private static String getServiceValue(final ClassLoader classLoader) {
- String serviceId = "META-INF/services/" + PROPERTY;
- // try to find services in CLASSPATH
- try {
- InputStream is = getResourceAsStream(classLoader, serviceId);
-
- if (is != null) {
- BufferedReader rd;
- try {
- rd =
- new BufferedReader(new InputStreamReader(is, "UTF-8"),
- DEFAULT_LINE_LENGTH);
- } catch (java.io.UnsupportedEncodingException e) {
- rd =
- new BufferedReader(new InputStreamReader(is),
- DEFAULT_LINE_LENGTH);
- }
- String serviceValue = rd.readLine();
- rd.close();
- if (serviceValue != null && serviceValue.length() > 0) {
- return serviceValue;
- }
- }
- } catch (Exception ex) {
- return null;
- }
- return null;
- }
-
- /**
- * A simple JRE (Java Runtime Environment) 1.1 test
- *
- * @return true
if JRE 1.1
- */
- private static boolean isJRE11() {
- try {
- Class c = Class.forName("java.security.AccessController");
- // java.security.AccessController existed since 1.2 so, if no
- // exception was thrown, the DOM application is running in a JRE
- // 1.2 or higher
- return false;
- } catch (Exception ex) {
- // ignore
- }
- return true;
- }
-
- /**
- * This method returns the ContextClassLoader or null
if
- * running in a JRE 1.1
- *
- * @return The Context Classloader
- */
- private static ClassLoader getContextClassLoader() {
- return isJRE11()
- ? null
- : (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader classLoader = null;
- try {
- classLoader =
- Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) {
- }
- return classLoader;
- }
- });
- }
-
- /**
- * This method returns the system property indicated by the specified name
- * after checking access control privileges. For a JRE 1.1, this check is
- * not done.
- *
- * @param name the name of the system property
- * @return the system property
- */
- private static String getSystemProperty(final String name) {
- return isJRE11()
- ? (String) System.getProperty(name)
- : (String) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(name);
- }
- });
- }
-
- /**
- * This method returns an Inputstream for the reading resource
- * META_INF/services/org.w3c.dom.DOMImplementationSourceList after checking
- * access control privileges. For a JRE 1.1, this check is not done.
- *
- * @param classLoader classLoader
- * @param name the resource
- * @return an Inputstream for the resource specified
- */
- private static InputStream getResourceAsStream(final ClassLoader classLoader,
- final String name) {
- if (isJRE11()) {
- InputStream ris;
- if (classLoader == null) {
- ris = ClassLoader.getSystemResourceAsStream(name);
- } else {
- ris = classLoader.getResourceAsStream(name);
- }
- return ris;
- } else {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (classLoader == null) {
- ris =
- ClassLoader.getSystemResourceAsStream(name);
- } else {
- ris = classLoader.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
- }
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSS2Properties.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSS2Properties.java
deleted file mode 100644
index 89ccf5048ef..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSS2Properties.java
+++ /dev/null
@@ -1,1777 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSS2Properties
interface represents a convenience
- * mechanism for retrieving and setting properties within a
- * CSSStyleDeclaration
. The attributes of this interface
- * correspond to all the properties specified in CSS2. Getting an attribute
- * of this interface is equivalent to calling the
- * getPropertyValue
method of the
- * CSSStyleDeclaration
interface. Setting an attribute of this
- * interface is equivalent to calling the setProperty
method of
- * the CSSStyleDeclaration
interface.
- * A conformant implementation of the CSS module is not required to
- * implement the CSS2Properties
interface. If an implementation
- * does implement this interface, the expectation is that language-specific
- * methods can be used to cast from an instance of the
- * CSSStyleDeclaration
interface to the
- * CSS2Properties
interface.
- *
If an implementation does implement this interface, it is expected to
- * understand the specific syntax of the shorthand properties, and apply
- * their semantics; when the margin
property is set, for
- * example, the marginTop
, marginRight
,
- * marginBottom
and marginLeft
properties are
- * actually being set by the underlying implementation.
- *
When dealing with CSS "shorthand" properties, the shorthand properties - * should be decomposed into their component longhand properties as - * appropriate, and when querying for their value, the form returned should - * be the shortest form exactly equivalent to the declarations made in the - * ruleset. However, if there is no shorthand declaration that could be - * added to the ruleset without changing in any way the rules already - * declared in the ruleset (i.e., by adding longhand rules that were - * previously not declared in the ruleset), then the empty string should be - * returned for the shorthand property. - *
For example, querying for the font
property should not
- * return "normal normal normal 14pt/normal Arial, sans-serif", when "14pt
- * Arial, sans-serif" suffices. (The normals are initial values, and are
- * implied by use of the longhand property.)
- *
If the values for all the longhand properties that compose a particular
- * string are the initial values, then a string consisting of all the
- * initial values should be returned (e.g. a border-width
value
- * of "medium" should be returned as such, not as "").
- *
For some shorthand properties that take missing values from other
- * sides, such as the margin
, padding
, and
- * border-[width|style|color]
properties, the minimum number of
- * sides possible should be used; i.e., "0px 10px" will be returned instead
- * of "0px 10px 0px 10px".
- *
If the value of a shorthand property can not be decomposed into its
- * component longhand properties, as is the case for the font
- * property with a value of "menu", querying for the values of the component
- * longhand properties should return the empty string.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSS2Properties {
- /**
- * See the azimuth property definition in CSS2.
- */
- public String getAzimuth();
- /**
- * See the azimuth property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setAzimuth(String azimuth)
- throws DOMException;
-
- /**
- * See the background property definition in CSS2.
- */
- public String getBackground();
- /**
- * See the background property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackground(String background)
- throws DOMException;
-
- /**
- * See the background-attachment property definition in CSS2.
- */
- public String getBackgroundAttachment();
- /**
- * See the background-attachment property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundAttachment(String backgroundAttachment)
- throws DOMException;
-
- /**
- * See the background-color property definition in CSS2.
- */
- public String getBackgroundColor();
- /**
- * See the background-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundColor(String backgroundColor)
- throws DOMException;
-
- /**
- * See the background-image property definition in CSS2.
- */
- public String getBackgroundImage();
- /**
- * See the background-image property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundImage(String backgroundImage)
- throws DOMException;
-
- /**
- * See the background-position property definition in CSS2.
- */
- public String getBackgroundPosition();
- /**
- * See the background-position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundPosition(String backgroundPosition)
- throws DOMException;
-
- /**
- * See the background-repeat property definition in CSS2.
- */
- public String getBackgroundRepeat();
- /**
- * See the background-repeat property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundRepeat(String backgroundRepeat)
- throws DOMException;
-
- /**
- * See the border property definition in CSS2.
- */
- public String getBorder();
- /**
- * See the border property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorder(String border)
- throws DOMException;
-
- /**
- * See the border-collapse property definition in CSS2.
- */
- public String getBorderCollapse();
- /**
- * See the border-collapse property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderCollapse(String borderCollapse)
- throws DOMException;
-
- /**
- * See the border-color property definition in CSS2.
- */
- public String getBorderColor();
- /**
- * See the border-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderColor(String borderColor)
- throws DOMException;
-
- /**
- * See the border-spacing property definition in CSS2.
- */
- public String getBorderSpacing();
- /**
- * See the border-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderSpacing(String borderSpacing)
- throws DOMException;
-
- /**
- * See the border-style property definition in CSS2.
- */
- public String getBorderStyle();
- /**
- * See the border-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderStyle(String borderStyle)
- throws DOMException;
-
- /**
- * See the border-top property definition in CSS2.
- */
- public String getBorderTop();
- /**
- * See the border-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTop(String borderTop)
- throws DOMException;
-
- /**
- * See the border-right property definition in CSS2.
- */
- public String getBorderRight();
- /**
- * See the border-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRight(String borderRight)
- throws DOMException;
-
- /**
- * See the border-bottom property definition in CSS2.
- */
- public String getBorderBottom();
- /**
- * See the border-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottom(String borderBottom)
- throws DOMException;
-
- /**
- * See the border-left property definition in CSS2.
- */
- public String getBorderLeft();
- /**
- * See the border-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeft(String borderLeft)
- throws DOMException;
-
- /**
- * See the border-top-color property definition in CSS2.
- */
- public String getBorderTopColor();
- /**
- * See the border-top-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTopColor(String borderTopColor)
- throws DOMException;
-
- /**
- * See the border-right-color property definition in CSS2.
- */
- public String getBorderRightColor();
- /**
- * See the border-right-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRightColor(String borderRightColor)
- throws DOMException;
-
- /**
- * See the border-bottom-color property definition in CSS2.
- */
- public String getBorderBottomColor();
- /**
- * See the border-bottom-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottomColor(String borderBottomColor)
- throws DOMException;
-
- /**
- * See the border-left-color property definition in CSS2.
- */
- public String getBorderLeftColor();
- /**
- * See the border-left-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeftColor(String borderLeftColor)
- throws DOMException;
-
- /**
- * See the border-top-style property definition in CSS2.
- */
- public String getBorderTopStyle();
- /**
- * See the border-top-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTopStyle(String borderTopStyle)
- throws DOMException;
-
- /**
- * See the border-right-style property definition in CSS2.
- */
- public String getBorderRightStyle();
- /**
- * See the border-right-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRightStyle(String borderRightStyle)
- throws DOMException;
-
- /**
- * See the border-bottom-style property definition in CSS2.
- */
- public String getBorderBottomStyle();
- /**
- * See the border-bottom-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottomStyle(String borderBottomStyle)
- throws DOMException;
-
- /**
- * See the border-left-style property definition in CSS2.
- */
- public String getBorderLeftStyle();
- /**
- * See the border-left-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeftStyle(String borderLeftStyle)
- throws DOMException;
-
- /**
- * See the border-top-width property definition in CSS2.
- */
- public String getBorderTopWidth();
- /**
- * See the border-top-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTopWidth(String borderTopWidth)
- throws DOMException;
-
- /**
- * See the border-right-width property definition in CSS2.
- */
- public String getBorderRightWidth();
- /**
- * See the border-right-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRightWidth(String borderRightWidth)
- throws DOMException;
-
- /**
- * See the border-bottom-width property definition in CSS2.
- */
- public String getBorderBottomWidth();
- /**
- * See the border-bottom-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottomWidth(String borderBottomWidth)
- throws DOMException;
-
- /**
- * See the border-left-width property definition in CSS2.
- */
- public String getBorderLeftWidth();
- /**
- * See the border-left-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeftWidth(String borderLeftWidth)
- throws DOMException;
-
- /**
- * See the border-width property definition in CSS2.
- */
- public String getBorderWidth();
- /**
- * See the border-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderWidth(String borderWidth)
- throws DOMException;
-
- /**
- * See the bottom property definition in CSS2.
- */
- public String getBottom();
- /**
- * See the bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBottom(String bottom)
- throws DOMException;
-
- /**
- * See the caption-side property definition in CSS2.
- */
- public String getCaptionSide();
- /**
- * See the caption-side property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCaptionSide(String captionSide)
- throws DOMException;
-
- /**
- * See the clear property definition in CSS2.
- */
- public String getClear();
- /**
- * See the clear property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setClear(String clear)
- throws DOMException;
-
- /**
- * See the clip property definition in CSS2.
- */
- public String getClip();
- /**
- * See the clip property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setClip(String clip)
- throws DOMException;
-
- /**
- * See the color property definition in CSS2.
- */
- public String getColor();
- /**
- * See the color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setColor(String color)
- throws DOMException;
-
- /**
- * See the content property definition in CSS2.
- */
- public String getContent();
- /**
- * See the content property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setContent(String content)
- throws DOMException;
-
- /**
- * See the counter-increment property definition in CSS2.
- */
- public String getCounterIncrement();
- /**
- * See the counter-increment property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCounterIncrement(String counterIncrement)
- throws DOMException;
-
- /**
- * See the counter-reset property definition in CSS2.
- */
- public String getCounterReset();
- /**
- * See the counter-reset property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCounterReset(String counterReset)
- throws DOMException;
-
- /**
- * See the cue property definition in CSS2.
- */
- public String getCue();
- /**
- * See the cue property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCue(String cue)
- throws DOMException;
-
- /**
- * See the cue-after property definition in CSS2.
- */
- public String getCueAfter();
- /**
- * See the cue-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCueAfter(String cueAfter)
- throws DOMException;
-
- /**
- * See the cue-before property definition in CSS2.
- */
- public String getCueBefore();
- /**
- * See the cue-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCueBefore(String cueBefore)
- throws DOMException;
-
- /**
- * See the cursor property definition in CSS2.
- */
- public String getCursor();
- /**
- * See the cursor property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCursor(String cursor)
- throws DOMException;
-
- /**
- * See the direction property definition in CSS2.
- */
- public String getDirection();
- /**
- * See the direction property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setDirection(String direction)
- throws DOMException;
-
- /**
- * See the display property definition in CSS2.
- */
- public String getDisplay();
- /**
- * See the display property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setDisplay(String display)
- throws DOMException;
-
- /**
- * See the elevation property definition in CSS2.
- */
- public String getElevation();
- /**
- * See the elevation property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setElevation(String elevation)
- throws DOMException;
-
- /**
- * See the empty-cells property definition in CSS2.
- */
- public String getEmptyCells();
- /**
- * See the empty-cells property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setEmptyCells(String emptyCells)
- throws DOMException;
-
- /**
- * See the float property definition in CSS2.
- */
- public String getCssFloat();
- /**
- * See the float property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCssFloat(String cssFloat)
- throws DOMException;
-
- /**
- * See the font property definition in CSS2.
- */
- public String getFont();
- /**
- * See the font property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFont(String font)
- throws DOMException;
-
- /**
- * See the font-family property definition in CSS2.
- */
- public String getFontFamily();
- /**
- * See the font-family property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontFamily(String fontFamily)
- throws DOMException;
-
- /**
- * See the font-size property definition in CSS2.
- */
- public String getFontSize();
- /**
- * See the font-size property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontSize(String fontSize)
- throws DOMException;
-
- /**
- * See the font-size-adjust property definition in CSS2.
- */
- public String getFontSizeAdjust();
- /**
- * See the font-size-adjust property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontSizeAdjust(String fontSizeAdjust)
- throws DOMException;
-
- /**
- * See the font-stretch property definition in CSS2.
- */
- public String getFontStretch();
- /**
- * See the font-stretch property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontStretch(String fontStretch)
- throws DOMException;
-
- /**
- * See the font-style property definition in CSS2.
- */
- public String getFontStyle();
- /**
- * See the font-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontStyle(String fontStyle)
- throws DOMException;
-
- /**
- * See the font-variant property definition in CSS2.
- */
- public String getFontVariant();
- /**
- * See the font-variant property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontVariant(String fontVariant)
- throws DOMException;
-
- /**
- * See the font-weight property definition in CSS2.
- */
- public String getFontWeight();
- /**
- * See the font-weight property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontWeight(String fontWeight)
- throws DOMException;
-
- /**
- * See the height property definition in CSS2.
- */
- public String getHeight();
- /**
- * See the height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setHeight(String height)
- throws DOMException;
-
- /**
- * See the left property definition in CSS2.
- */
- public String getLeft();
- /**
- * See the left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setLeft(String left)
- throws DOMException;
-
- /**
- * See the letter-spacing property definition in CSS2.
- */
- public String getLetterSpacing();
- /**
- * See the letter-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setLetterSpacing(String letterSpacing)
- throws DOMException;
-
- /**
- * See the line-height property definition in CSS2.
- */
- public String getLineHeight();
- /**
- * See the line-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setLineHeight(String lineHeight)
- throws DOMException;
-
- /**
- * See the list-style property definition in CSS2.
- */
- public String getListStyle();
- /**
- * See the list-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStyle(String listStyle)
- throws DOMException;
-
- /**
- * See the list-style-image property definition in CSS2.
- */
- public String getListStyleImage();
- /**
- * See the list-style-image property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStyleImage(String listStyleImage)
- throws DOMException;
-
- /**
- * See the list-style-position property definition in CSS2.
- */
- public String getListStylePosition();
- /**
- * See the list-style-position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStylePosition(String listStylePosition)
- throws DOMException;
-
- /**
- * See the list-style-type property definition in CSS2.
- */
- public String getListStyleType();
- /**
- * See the list-style-type property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStyleType(String listStyleType)
- throws DOMException;
-
- /**
- * See the margin property definition in CSS2.
- */
- public String getMargin();
- /**
- * See the margin property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMargin(String margin)
- throws DOMException;
-
- /**
- * See the margin-top property definition in CSS2.
- */
- public String getMarginTop();
- /**
- * See the margin-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginTop(String marginTop)
- throws DOMException;
-
- /**
- * See the margin-right property definition in CSS2.
- */
- public String getMarginRight();
- /**
- * See the margin-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginRight(String marginRight)
- throws DOMException;
-
- /**
- * See the margin-bottom property definition in CSS2.
- */
- public String getMarginBottom();
- /**
- * See the margin-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginBottom(String marginBottom)
- throws DOMException;
-
- /**
- * See the margin-left property definition in CSS2.
- */
- public String getMarginLeft();
- /**
- * See the margin-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginLeft(String marginLeft)
- throws DOMException;
-
- /**
- * See the marker-offset property definition in CSS2.
- */
- public String getMarkerOffset();
- /**
- * See the marker-offset property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarkerOffset(String markerOffset)
- throws DOMException;
-
- /**
- * See the marks property definition in CSS2.
- */
- public String getMarks();
- /**
- * See the marks property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarks(String marks)
- throws DOMException;
-
- /**
- * See the max-height property definition in CSS2.
- */
- public String getMaxHeight();
- /**
- * See the max-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMaxHeight(String maxHeight)
- throws DOMException;
-
- /**
- * See the max-width property definition in CSS2.
- */
- public String getMaxWidth();
- /**
- * See the max-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMaxWidth(String maxWidth)
- throws DOMException;
-
- /**
- * See the min-height property definition in CSS2.
- */
- public String getMinHeight();
- /**
- * See the min-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMinHeight(String minHeight)
- throws DOMException;
-
- /**
- * See the min-width property definition in CSS2.
- */
- public String getMinWidth();
- /**
- * See the min-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMinWidth(String minWidth)
- throws DOMException;
-
- /**
- * See the orphans property definition in CSS2.
- */
- public String getOrphans();
- /**
- * See the orphans property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOrphans(String orphans)
- throws DOMException;
-
- /**
- * See the outline property definition in CSS2.
- */
- public String getOutline();
- /**
- * See the outline property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutline(String outline)
- throws DOMException;
-
- /**
- * See the outline-color property definition in CSS2.
- */
- public String getOutlineColor();
- /**
- * See the outline-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutlineColor(String outlineColor)
- throws DOMException;
-
- /**
- * See the outline-style property definition in CSS2.
- */
- public String getOutlineStyle();
- /**
- * See the outline-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutlineStyle(String outlineStyle)
- throws DOMException;
-
- /**
- * See the outline-width property definition in CSS2.
- */
- public String getOutlineWidth();
- /**
- * See the outline-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutlineWidth(String outlineWidth)
- throws DOMException;
-
- /**
- * See the overflow property definition in CSS2.
- */
- public String getOverflow();
- /**
- * See the overflow property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOverflow(String overflow)
- throws DOMException;
-
- /**
- * See the padding property definition in CSS2.
- */
- public String getPadding();
- /**
- * See the padding property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPadding(String padding)
- throws DOMException;
-
- /**
- * See the padding-top property definition in CSS2.
- */
- public String getPaddingTop();
- /**
- * See the padding-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingTop(String paddingTop)
- throws DOMException;
-
- /**
- * See the padding-right property definition in CSS2.
- */
- public String getPaddingRight();
- /**
- * See the padding-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingRight(String paddingRight)
- throws DOMException;
-
- /**
- * See the padding-bottom property definition in CSS2.
- */
- public String getPaddingBottom();
- /**
- * See the padding-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingBottom(String paddingBottom)
- throws DOMException;
-
- /**
- * See the padding-left property definition in CSS2.
- */
- public String getPaddingLeft();
- /**
- * See the padding-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingLeft(String paddingLeft)
- throws DOMException;
-
- /**
- * See the page property definition in CSS2.
- */
- public String getPage();
- /**
- * See the page property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPage(String page)
- throws DOMException;
-
- /**
- * See the page-break-after property definition in CSS2.
- */
- public String getPageBreakAfter();
- /**
- * See the page-break-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPageBreakAfter(String pageBreakAfter)
- throws DOMException;
-
- /**
- * See the page-break-before property definition in CSS2.
- */
- public String getPageBreakBefore();
- /**
- * See the page-break-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPageBreakBefore(String pageBreakBefore)
- throws DOMException;
-
- /**
- * See the page-break-inside property definition in CSS2.
- */
- public String getPageBreakInside();
- /**
- * See the page-break-inside property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPageBreakInside(String pageBreakInside)
- throws DOMException;
-
- /**
- * See the pause property definition in CSS2.
- */
- public String getPause();
- /**
- * See the pause property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPause(String pause)
- throws DOMException;
-
- /**
- * See the pause-after property definition in CSS2.
- */
- public String getPauseAfter();
- /**
- * See the pause-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPauseAfter(String pauseAfter)
- throws DOMException;
-
- /**
- * See the pause-before property definition in CSS2.
- */
- public String getPauseBefore();
- /**
- * See the pause-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPauseBefore(String pauseBefore)
- throws DOMException;
-
- /**
- * See the pitch property definition in CSS2.
- */
- public String getPitch();
- /**
- * See the pitch property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPitch(String pitch)
- throws DOMException;
-
- /**
- * See the pitch-range property definition in CSS2.
- */
- public String getPitchRange();
- /**
- * See the pitch-range property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPitchRange(String pitchRange)
- throws DOMException;
-
- /**
- * See the play-during property definition in CSS2.
- */
- public String getPlayDuring();
- /**
- * See the play-during property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPlayDuring(String playDuring)
- throws DOMException;
-
- /**
- * See the position property definition in CSS2.
- */
- public String getPosition();
- /**
- * See the position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPosition(String position)
- throws DOMException;
-
- /**
- * See the quotes property definition in CSS2.
- */
- public String getQuotes();
- /**
- * See the quotes property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setQuotes(String quotes)
- throws DOMException;
-
- /**
- * See the richness property definition in CSS2.
- */
- public String getRichness();
- /**
- * See the richness property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setRichness(String richness)
- throws DOMException;
-
- /**
- * See the right property definition in CSS2.
- */
- public String getRight();
- /**
- * See the right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setRight(String right)
- throws DOMException;
-
- /**
- * See the size property definition in CSS2.
- */
- public String getSize();
- /**
- * See the size property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSize(String size)
- throws DOMException;
-
- /**
- * See the speak property definition in CSS2.
- */
- public String getSpeak();
- /**
- * See the speak property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeak(String speak)
- throws DOMException;
-
- /**
- * See the speak-header property definition in CSS2.
- */
- public String getSpeakHeader();
- /**
- * See the speak-header property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeakHeader(String speakHeader)
- throws DOMException;
-
- /**
- * See the speak-numeral property definition in CSS2.
- */
- public String getSpeakNumeral();
- /**
- * See the speak-numeral property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeakNumeral(String speakNumeral)
- throws DOMException;
-
- /**
- * See the speak-punctuation property definition in CSS2.
- */
- public String getSpeakPunctuation();
- /**
- * See the speak-punctuation property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeakPunctuation(String speakPunctuation)
- throws DOMException;
-
- /**
- * See the speech-rate property definition in CSS2.
- */
- public String getSpeechRate();
- /**
- * See the speech-rate property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeechRate(String speechRate)
- throws DOMException;
-
- /**
- * See the stress property definition in CSS2.
- */
- public String getStress();
- /**
- * See the stress property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setStress(String stress)
- throws DOMException;
-
- /**
- * See the table-layout property definition in CSS2.
- */
- public String getTableLayout();
- /**
- * See the table-layout property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTableLayout(String tableLayout)
- throws DOMException;
-
- /**
- * See the text-align property definition in CSS2.
- */
- public String getTextAlign();
- /**
- * See the text-align property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextAlign(String textAlign)
- throws DOMException;
-
- /**
- * See the text-decoration property definition in CSS2.
- */
- public String getTextDecoration();
- /**
- * See the text-decoration property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextDecoration(String textDecoration)
- throws DOMException;
-
- /**
- * See the text-indent property definition in CSS2.
- */
- public String getTextIndent();
- /**
- * See the text-indent property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextIndent(String textIndent)
- throws DOMException;
-
- /**
- * See the text-shadow property definition in CSS2.
- */
- public String getTextShadow();
- /**
- * See the text-shadow property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextShadow(String textShadow)
- throws DOMException;
-
- /**
- * See the text-transform property definition in CSS2.
- */
- public String getTextTransform();
- /**
- * See the text-transform property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextTransform(String textTransform)
- throws DOMException;
-
- /**
- * See the top property definition in CSS2.
- */
- public String getTop();
- /**
- * See the top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTop(String top)
- throws DOMException;
-
- /**
- * See the unicode-bidi property definition in CSS2.
- */
- public String getUnicodeBidi();
- /**
- * See the unicode-bidi property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setUnicodeBidi(String unicodeBidi)
- throws DOMException;
-
- /**
- * See the vertical-align property definition in CSS2.
- */
- public String getVerticalAlign();
- /**
- * See the vertical-align property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVerticalAlign(String verticalAlign)
- throws DOMException;
-
- /**
- * See the visibility property definition in CSS2.
- */
- public String getVisibility();
- /**
- * See the visibility property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVisibility(String visibility)
- throws DOMException;
-
- /**
- * See the voice-family property definition in CSS2.
- */
- public String getVoiceFamily();
- /**
- * See the voice-family property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVoiceFamily(String voiceFamily)
- throws DOMException;
-
- /**
- * See the volume property definition in CSS2.
- */
- public String getVolume();
- /**
- * See the volume property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVolume(String volume)
- throws DOMException;
-
- /**
- * See the white-space property definition in CSS2.
- */
- public String getWhiteSpace();
- /**
- * See the white-space property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWhiteSpace(String whiteSpace)
- throws DOMException;
-
- /**
- * See the widows property definition in CSS2.
- */
- public String getWidows();
- /**
- * See the widows property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWidows(String widows)
- throws DOMException;
-
- /**
- * See the width property definition in CSS2.
- */
- public String getWidth();
- /**
- * See the width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWidth(String width)
- throws DOMException;
-
- /**
- * See the word-spacing property definition in CSS2.
- */
- public String getWordSpacing();
- /**
- * See the word-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWordSpacing(String wordSpacing)
- throws DOMException;
-
- /**
- * See the z-index property definition in CSS2.
- */
- public String getZIndex();
- /**
- * See the z-index property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setZIndex(String zIndex)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSCharsetRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSCharsetRule.java
deleted file mode 100644
index 8c0defa4753..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSCharsetRule.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSSCharsetRule
interface represents a @charset rule in a
- * CSS style sheet. The value of the encoding
attribute does
- * not affect the encoding of text data in the DOM objects; this encoding is
- * always UTF-16. After a stylesheet is loaded, the value of the
- * encoding
attribute is the value found in the
- * @charset
rule. If there was no @charset
in the
- * original document, then no CSSCharsetRule
is created. The
- * value of the encoding
attribute may also be used as a hint
- * for the encoding used on serialization of the style sheet.
- *
The value of the @charset rule (and therefore of the
- * CSSCharsetRule
) may not correspond to the encoding the
- * document actually came in; character encoding information e.g. in an HTTP
- * header, has priority (see CSS document representation) but this is not
- * reflected in the CSSCharsetRule
.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSCharsetRule extends CSSRule {
- /**
- * The encoding information used in this @charset
rule.
- */
- public String getEncoding();
- /**
- * The encoding information used in this @charset
rule.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified encoding value has a syntax error
- * and is unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding rule is
- * readonly.
- */
- public void setEncoding(String encoding)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSFontFaceRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSFontFaceRule.java
deleted file mode 100644
index a1795706118..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSFontFaceRule.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The CSSFontFaceRule
interface represents a @font-face rule in
- * a CSS style sheet. The @font-face
rule is used to hold a set
- * of font descriptions.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSFontFaceRule extends CSSRule {
- /**
- * The declaration-block of this rule.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSImportRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSImportRule.java
deleted file mode 100644
index e18ad569bcb..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSImportRule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.stylesheets.MediaList;
-
-/**
- * The CSSImportRule
interface represents a @import rule within
- * a CSS style sheet. The @import
rule is used to import style
- * rules from other style sheets.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSImportRule extends CSSRule {
- /**
- * The location of the style sheet to be imported. The attribute will not
- * contain the "url(...)"
specifier around the URI.
- */
- public String getHref();
-
- /**
- * A list of media types for which this style sheet may be used.
- */
- public MediaList getMedia();
-
- /**
- * The style sheet referred to by this rule, if it has been loaded. The
- * value of this attribute is null
if the style sheet has
- * not yet been loaded or if it will not be loaded (e.g. if the style
- * sheet is for a media type not supported by the user agent).
- */
- public CSSStyleSheet getStyleSheet();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSMediaRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSMediaRule.java
deleted file mode 100644
index 68a73045ede..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSMediaRule.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.stylesheets.MediaList;
-
-/**
- * The CSSMediaRule
interface represents a @media rule in a CSS
- * style sheet. A @media
rule can be used to delimit style
- * rules for specific media types.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSMediaRule extends CSSRule {
- /**
- * A list of media types for this rule.
- */
- public MediaList getMedia();
-
- /**
- * A list of all CSS rules contained within the media block.
- */
- public CSSRuleList getCssRules();
-
- /**
- * Used to insert a new rule into the media block.
- * @param rule The parsable text representing the rule. For rule sets
- * this contains both the selector and the style declaration. For
- * at-rules, this specifies both the at-identifier and the rule
- * content.
- * @param index The index within the media block's rule collection of
- * the rule before which to insert the specified rule. If the
- * specified index is equal to the length of the media blocks's rule
- * collection, the rule will be added to the end of the media block.
- * @return The index within the media block's rule collection of the
- * newly inserted rule.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the
- * specified index, e.g., if an @import
rule is inserted
- * after a standard rule set or other at-rule.
- *
INDEX_SIZE_ERR: Raised if the specified index is not a valid
- * insertion point.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
- * readonly.
- *
SYNTAX_ERR: Raised if the specified rule has a syntax error and
- * is unparsable.
- */
- public int insertRule(String rule,
- int index)
- throws DOMException;
-
- /**
- * Used to delete a rule from the media block.
- * @param index The index within the media block's rule collection of
- * the rule to remove.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index does not correspond to
- * a rule in the media rule list.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
- * readonly.
- */
- public void deleteRule(int index)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSPageRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSPageRule.java
deleted file mode 100644
index 538626a97e9..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSPageRule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSSPageRule
interface represents a @page rule within a
- * CSS style sheet. The @page
rule is used to specify the
- * dimensions, orientation, margins, etc. of a page box for paged media.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSPageRule extends CSSRule {
- /**
- * The parsable textual representation of the page selector for the rule.
- */
- public String getSelectorText();
- /**
- * The parsable textual representation of the page selector for the rule.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is readonly.
- */
- public void setSelectorText(String selectorText)
- throws DOMException;
-
- /**
- * The declaration-block of this rule.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSPrimitiveValue.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSPrimitiveValue.java
deleted file mode 100644
index 4131d26cda3..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSPrimitiveValue.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSSPrimitiveValue
interface represents a single CSS value
- * . This interface may be used to determine the value of a specific style
- * property currently set in a block or to set a specific style property
- * explicitly within the block. An instance of this interface might be
- * obtained from the getPropertyCSSValue
method of the
- * CSSStyleDeclaration
interface. A
- * CSSPrimitiveValue
object only occurs in a context of a CSS
- * property.
- *
Conversions are allowed between absolute values (from millimeters to
- * centimeters, from degrees to radians, and so on) but not between relative
- * values. (For example, a pixel value cannot be converted to a centimeter
- * value.) Percentage values can't be converted since they are relative to
- * the parent value (or another property value). There is one exception for
- * color percentage values: since a color percentage value is relative to
- * the range 0-255, a color percentage value can be converted to a number;
- * (see also the RGBColor
interface).
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSPrimitiveValue extends CSSValue {
- // UnitTypes
- /**
- * The value is not a recognized CSS2 value. The value can only be
- * obtained by using the cssText
attribute.
- */
- public static final short CSS_UNKNOWN = 0;
- /**
- * The value is a simple number. The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_NUMBER = 1;
- /**
- * The value is a percentage. The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_PERCENTAGE = 2;
- /**
- * The value is a length (ems). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_EMS = 3;
- /**
- * The value is a length (exs). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_EXS = 4;
- /**
- * The value is a length (px). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_PX = 5;
- /**
- * The value is a length (cm). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_CM = 6;
- /**
- * The value is a length (mm). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_MM = 7;
- /**
- * The value is a length (in). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_IN = 8;
- /**
- * The value is a length (pt). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_PT = 9;
- /**
- * The value is a length (pc). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_PC = 10;
- /**
- * The value is an angle (deg). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_DEG = 11;
- /**
- * The value is an angle (rad). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_RAD = 12;
- /**
- * The value is an angle (grad). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_GRAD = 13;
- /**
- * The value is a time (ms). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_MS = 14;
- /**
- * The value is a time (s). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_S = 15;
- /**
- * The value is a frequency (Hz). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_HZ = 16;
- /**
- * The value is a frequency (kHz). The value can be obtained by using the
- * getFloatValue
method.
- */
- public static final short CSS_KHZ = 17;
- /**
- * The value is a number with an unknown dimension. The value can be
- * obtained by using the getFloatValue
method.
- */
- public static final short CSS_DIMENSION = 18;
- /**
- * The value is a STRING. The value can be obtained by using the
- * getStringValue
method.
- */
- public static final short CSS_STRING = 19;
- /**
- * The value is a URI. The value can be obtained by using the
- * getStringValue
method.
- */
- public static final short CSS_URI = 20;
- /**
- * The value is an identifier. The value can be obtained by using the
- * getStringValue
method.
- */
- public static final short CSS_IDENT = 21;
- /**
- * The value is a attribute function. The value can be obtained by using
- * the getStringValue
method.
- */
- public static final short CSS_ATTR = 22;
- /**
- * The value is a counter or counters function. The value can be obtained
- * by using the getCounterValue
method.
- */
- public static final short CSS_COUNTER = 23;
- /**
- * The value is a rect function. The value can be obtained by using the
- * getRectValue
method.
- */
- public static final short CSS_RECT = 24;
- /**
- * The value is a RGB color. The value can be obtained by using the
- * getRGBColorValue
method.
- */
- public static final short CSS_RGBCOLOR = 25;
-
- /**
- * The type of the value as defined by the constants specified above.
- */
- public short getPrimitiveType();
-
- /**
- * A method to set the float value with a specified unit. If the property
- * attached with this value can not accept the specified unit or the
- * float value, the value will be unchanged and a
- * DOMException
will be raised.
- * @param unitType A unit code as defined above. The unit code can only
- * be a float unit type (i.e. CSS_NUMBER
,
- * CSS_PERCENTAGE
, CSS_EMS
,
- * CSS_EXS
, CSS_PX
, CSS_CM
,
- * CSS_MM
, CSS_IN
, CSS_PT
,
- * CSS_PC
, CSS_DEG
, CSS_RAD
,
- * CSS_GRAD
, CSS_MS
, CSS_S
,
- * CSS_HZ
, CSS_KHZ
,
- * CSS_DIMENSION
).
- * @param floatValue The new float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the attached property doesn't support
- * the float value or the unit type.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFloatValue(short unitType,
- float floatValue)
- throws DOMException;
-
- /**
- * This method is used to get a float value in a specified unit. If this
- * CSS value doesn't contain a float value or can't be converted into
- * the specified unit, a DOMException
is raised.
- * @param unitType A unit code to get the float value. The unit code can
- * only be a float unit type (i.e. CSS_NUMBER
,
- * CSS_PERCENTAGE
, CSS_EMS
,
- * CSS_EXS
, CSS_PX
, CSS_CM
,
- * CSS_MM
, CSS_IN
, CSS_PT
,
- * CSS_PC
, CSS_DEG
, CSS_RAD
,
- * CSS_GRAD
, CSS_MS
, CSS_S
,
- * CSS_HZ
, CSS_KHZ
,
- * CSS_DIMENSION
).
- * @return The float value in the specified unit.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a float
- * value or if the float value can't be converted into the specified
- * unit.
- */
- public float getFloatValue(short unitType)
- throws DOMException;
-
- /**
- * A method to set the string value with the specified unit. If the
- * property attached to this value can't accept the specified unit or
- * the string value, the value will be unchanged and a
- * DOMException
will be raised.
- * @param stringType A string code as defined above. The string code can
- * only be a string unit type (i.e. CSS_STRING
,
- * CSS_URI
, CSS_IDENT
, and
- * CSS_ATTR
).
- * @param stringValue The new string value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string
- * value or if the string value can't be converted into the specified
- * unit.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setStringValue(short stringType,
- String stringValue)
- throws DOMException;
-
- /**
- * This method is used to get the string value. If the CSS value doesn't
- * contain a string value, a DOMException
is raised. Some
- * properties (like 'font-family' or 'voice-family') convert a
- * whitespace separated list of idents to a string.
- * @return The string value in the current unit. The current
- * primitiveType
can only be a string unit type (i.e.
- * CSS_STRING
, CSS_URI
,
- * CSS_IDENT
and CSS_ATTR
).
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string
- * value.
- */
- public String getStringValue()
- throws DOMException;
-
- /**
- * This method is used to get the Counter value. If this CSS value
- * doesn't contain a counter value, a DOMException
is
- * raised. Modification to the corresponding style property can be
- * achieved using the Counter
interface.
- * @return The Counter value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a
- * Counter value (e.g. this is not CSS_COUNTER
).
- */
- public Counter getCounterValue()
- throws DOMException;
-
- /**
- * This method is used to get the Rect value. If this CSS value doesn't
- * contain a rect value, a DOMException
is raised.
- * Modification to the corresponding style property can be achieved
- * using the Rect
interface.
- * @return The Rect value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a Rect
- * value. (e.g. this is not CSS_RECT
).
- */
- public Rect getRectValue()
- throws DOMException;
-
- /**
- * This method is used to get the RGB color. If this CSS value doesn't
- * contain a RGB color value, a DOMException
is raised.
- * Modification to the corresponding style property can be achieved
- * using the RGBColor
interface.
- * @return the RGB color value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the attached property can't return a
- * RGB color value (e.g. this is not CSS_RGBCOLOR
).
- */
- public RGBColor getRGBColorValue()
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSRule.java
deleted file mode 100644
index 788f946eca5..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSRule.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSSRule
interface is the abstract base interface for any
- * type of CSS statement. This includes both rule sets and at-rules. An
- * implementation is expected to preserve all rules specified in a CSS style
- * sheet, even if the rule is not recognized by the parser. Unrecognized
- * rules are represented using the CSSUnknownRule
interface.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSRule {
- // RuleType
- /**
- * The rule is a CSSUnknownRule
.
- */
- public static final short UNKNOWN_RULE = 0;
- /**
- * The rule is a CSSStyleRule
.
- */
- public static final short STYLE_RULE = 1;
- /**
- * The rule is a CSSCharsetRule
.
- */
- public static final short CHARSET_RULE = 2;
- /**
- * The rule is a CSSImportRule
.
- */
- public static final short IMPORT_RULE = 3;
- /**
- * The rule is a CSSMediaRule
.
- */
- public static final short MEDIA_RULE = 4;
- /**
- * The rule is a CSSFontFaceRule
.
- */
- public static final short FONT_FACE_RULE = 5;
- /**
- * The rule is a CSSPageRule
.
- */
- public static final short PAGE_RULE = 6;
-
- /**
- * The type of the rule, as defined above. The expectation is that
- * binding-specific casting methods can be used to cast down from an
- * instance of the CSSRule
interface to the specific
- * derived interface implied by the type
.
- */
- public short getType();
-
- /**
- * The parsable textual representation of the rule. This reflects the
- * current state of the rule and not its initial value.
- */
- public String getCssText();
- /**
- * The parsable textual representation of the rule. This reflects the
- * current state of the rule and not its initial value.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- *
INVALID_MODIFICATION_ERR: Raised if the specified CSS string
- * value represents a different type of rule than the current one.
- *
HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at
- * this point in the style sheet.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.
- */
- public void setCssText(String cssText)
- throws DOMException;
-
- /**
- * The style sheet that contains this rule.
- */
- public CSSStyleSheet getParentStyleSheet();
-
- /**
- * If this rule is contained inside another rule (e.g. a style rule
- * inside an @media block), this is the containing rule. If this rule is
- * not nested inside any other rules, this returns null
.
- */
- public CSSRule getParentRule();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSRuleList.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSRuleList.java
deleted file mode 100644
index 41c2c68377c..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSRuleList.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The CSSRuleList
interface provides the abstraction of an
- * ordered collection of CSS rules.
- *
The items in the CSSRuleList
are accessible via an
- * integral index, starting from 0.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSRuleList {
- /**
- * The number of CSSRules
in the list. The range of valid
- * child rule indices is 0
to length-1
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve a CSS rule by ordinal index. The order in this
- * collection represents the order of the rules in the CSS style sheet.
- * If index is greater than or equal to the number of rules in the list,
- * this returns null
.
- * @param index Index into the collection
- * @return The style rule at the index
position in the
- * CSSRuleList
, or null
if that is not a
- * valid index.
- */
- public CSSRule item(int index);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleDeclaration.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleDeclaration.java
deleted file mode 100644
index e5e346b0a71..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleDeclaration.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSSStyleDeclaration
interface represents a single CSS
- * declaration block. This interface may be used to determine the style
- * properties currently set in a block or to set style properties explicitly
- * within the block.
- *
While an implementation may not recognize all CSS properties within a
- * CSS declaration block, it is expected to provide access to all specified
- * properties in the style sheet through the CSSStyleDeclaration
- * interface. Furthermore, implementations that support a specific level of
- * CSS should correctly handle CSS shorthand properties for that level. For
- * a further discussion of shorthand properties, see the
- * CSS2Properties
interface.
- *
This interface is also used to provide a read-only access to the
- * computed values of an element. See also the ViewCSS
- * interface. The CSS Object Model doesn't provide an access to the
- * specified or actual values of the CSS cascade.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSStyleDeclaration {
- /**
- * The parsable textual representation of the declaration block
- * (excluding the surrounding curly braces). Setting this attribute will
- * result in the parsing of the new value and resetting of all the
- * properties in the declaration block including the removal or addition
- * of properties.
- */
- public String getCssText();
- /**
- * The parsable textual representation of the declaration block
- * (excluding the surrounding curly braces). Setting this attribute will
- * result in the parsing of the new value and resetting of all the
- * properties in the declaration block including the removal or addition
- * of properties.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly or a property is readonly.
- */
- public void setCssText(String cssText)
- throws DOMException;
-
- /**
- * Used to retrieve the value of a CSS property if it has been explicitly
- * set within this declaration block.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return Returns the value of the property if it has been explicitly
- * set for this declaration block. Returns the empty string if the
- * property has not been set.
- */
- public String getPropertyValue(String propertyName);
-
- /**
- * Used to retrieve the object representation of the value of a CSS
- * property if it has been explicitly set within this declaration block.
- * This method returns null
if the property is a shorthand
- * property. Shorthand property values can only be accessed and modified
- * as strings, using the getPropertyValue
and
- * setProperty
methods.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return Returns the value of the property if it has been explicitly
- * set for this declaration block. Returns null
if the
- * property has not been set.
- */
- public CSSValue getPropertyCSSValue(String propertyName);
-
- /**
- * Used to remove a CSS property if it has been explicitly set within
- * this declaration block.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return Returns the value of the property if it has been explicitly
- * set for this declaration block. Returns the empty string if the
- * property has not been set or the property name does not correspond
- * to a known CSS property.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly
- * or the property is readonly.
- */
- public String removeProperty(String propertyName)
- throws DOMException;
-
- /**
- * Used to retrieve the priority of a CSS property (e.g. the
- * "important"
qualifier) if the priority has been
- * explicitly set in this declaration block.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return A string representing the priority (e.g.
- * "important"
) if the property has been explicitly set
- * in this declaration block and has a priority specified. The empty
- * string otherwise.
- */
- public String getPropertyPriority(String propertyName);
-
- /**
- * Used to set a property value and priority within this declaration
- * block. setProperty
permits to modify a property or add a
- * new one in the declaration block. Any call to this method may modify
- * the order of properties in the item
method.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @param value The new value of the property.
- * @param priority The new priority of the property (e.g.
- * "important"
) or the empty string if none.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified value has a syntax error and is
- * unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly or the property is readonly.
- */
- public void setProperty(String propertyName,
- String value,
- String priority)
- throws DOMException;
-
- /**
- * The number of properties that have been explicitly set in this
- * declaration block. The range of valid indices is 0 to length-1
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve the properties that have been explicitly set in this
- * declaration block. The order of the properties retrieved using this
- * method does not have to be the order in which they were set. This
- * method can be used to iterate over all properties in this declaration
- * block.
- * @param index Index of the property name to retrieve.
- * @return The name of the property at this ordinal position. The empty
- * string if no property exists at this position.
- */
- public String item(int index);
-
- /**
- * The CSS rule that contains this declaration block or null
- * if this CSSStyleDeclaration
is not attached to a
- * CSSRule
.
- */
- public CSSRule getParentRule();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleRule.java
deleted file mode 100644
index 626f3224b4c..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleRule.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSSStyleRule
interface represents a single rule set in a
- * CSS style sheet.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSStyleRule extends CSSRule {
- /**
- * The textual representation of the selector for the rule set. The
- * implementation may have stripped out insignificant whitespace while
- * parsing the selector.
- */
- public String getSelectorText();
- /**
- * The textual representation of the selector for the rule set. The
- * implementation may have stripped out insignificant whitespace while
- * parsing the selector.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is readonly.
- */
- public void setSelectorText(String selectorText)
- throws DOMException;
-
- /**
- * The declaration-block of this rule set.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleSheet.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleSheet.java
deleted file mode 100644
index b529e5db089..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSStyleSheet.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.stylesheets.StyleSheet;
-
-/**
- * The CSSStyleSheet
interface is a concrete interface used to
- * represent a CSS style sheet i.e., a style sheet whose content type is
- * "text/css".
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSStyleSheet extends StyleSheet {
- /**
- * If this style sheet comes from an @import
rule, the
- * ownerRule
attribute will contain the
- * CSSImportRule
. In that case, the ownerNode
- * attribute in the StyleSheet
interface will be
- * null
. If the style sheet comes from an element or a
- * processing instruction, the ownerRule
attribute will be
- * null
and the ownerNode
attribute will
- * contain the Node
.
- */
- public CSSRule getOwnerRule();
-
- /**
- * The list of all CSS rules contained within the style sheet. This
- * includes both rule sets and at-rules.
- */
- public CSSRuleList getCssRules();
-
- /**
- * Used to insert a new rule into the style sheet. The new rule now
- * becomes part of the cascade.
- * @param rule The parsable text representing the rule. For rule sets
- * this contains both the selector and the style declaration. For
- * at-rules, this specifies both the at-identifier and the rule
- * content.
- * @param index The index within the style sheet's rule list of the rule
- * before which to insert the specified rule. If the specified index
- * is equal to the length of the style sheet's rule collection, the
- * rule will be added to the end of the style sheet.
- * @return The index within the style sheet's rule collection of the
- * newly inserted rule.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the
- * specified index e.g. if an @import
rule is inserted
- * after a standard rule set or other at-rule.
- *
INDEX_SIZE_ERR: Raised if the specified index is not a valid
- * insertion point.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
- * readonly.
- *
SYNTAX_ERR: Raised if the specified rule has a syntax error and
- * is unparsable.
- */
- public int insertRule(String rule,
- int index)
- throws DOMException;
-
- /**
- * Used to delete a rule from the style sheet.
- * @param index The index within the style sheet's rule list of the rule
- * to remove.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index does not correspond to
- * a rule in the style sheet's rule list.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
- * readonly.
- */
- public void deleteRule(int index)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSUnknownRule.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSUnknownRule.java
deleted file mode 100644
index 763d5f1b61f..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSUnknownRule.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The CSSUnknownRule
interface represents an at-rule not
- * supported by this user agent.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSUnknownRule extends CSSRule {
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSValue.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSValue.java
deleted file mode 100644
index 0285bcc7721..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSValue.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The CSSValue
interface represents a simple or a complex
- * value. A CSSValue
object only occurs in a context of a CSS
- * property.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSValue {
- // UnitTypes
- /**
- * The value is inherited and the cssText
contains "inherit".
- */
- public static final short CSS_INHERIT = 0;
- /**
- * The value is a primitive value and an instance of the
- * CSSPrimitiveValue
interface can be obtained by using
- * binding-specific casting methods on this instance of the
- * CSSValue
interface.
- */
- public static final short CSS_PRIMITIVE_VALUE = 1;
- /**
- * The value is a CSSValue
list and an instance of the
- * CSSValueList
interface can be obtained by using
- * binding-specific casting methods on this instance of the
- * CSSValue
interface.
- */
- public static final short CSS_VALUE_LIST = 2;
- /**
- * The value is a custom value.
- */
- public static final short CSS_CUSTOM = 3;
-
- /**
- * A string representation of the current value.
- */
- public String getCssText();
- /**
- * A string representation of the current value.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error (according to the attached property) or is unparsable.
- *
INVALID_MODIFICATION_ERR: Raised if the specified CSS string
- * value represents a different type of values than the values allowed
- * by the CSS property.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this value is readonly.
- */
- public void setCssText(String cssText)
- throws DOMException;
-
- /**
- * A code defining the type of the value as defined above.
- */
- public short getCssValueType();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/CSSValueList.java b/libjava/external/w3c_dom/org/w3c/dom/css/CSSValueList.java
deleted file mode 100644
index bf15bb3ebfd..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/CSSValueList.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The CSSValueList
interface provides the abstraction of an
- * ordered collection of CSS values.
- *
Some properties allow an empty list into their syntax. In that case,
- * these properties take the none
identifier. So, an empty list
- * means that the property has the value none
.
- *
The items in the CSSValueList
are accessible via an
- * integral index, starting from 0.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface CSSValueList extends CSSValue {
- /**
- * The number of CSSValues
in the list. The range of valid
- * values of the indices is 0
to length-1
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve a CSSValue
by ordinal index. The order in
- * this collection represents the order of the values in the CSS style
- * property. If index is greater than or equal to the number of values
- * in the list, this returns null
.
- * @param index Index into the collection.
- * @return The CSSValue
at the index
position
- * in the CSSValueList
, or null
if that is
- * not a valid index.
- */
- public CSSValue item(int index);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/Counter.java b/libjava/external/w3c_dom/org/w3c/dom/css/Counter.java
deleted file mode 100644
index 8cd4967b32d..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/Counter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The Counter
interface is used to represent any counter or
- * counters function value. This interface reflects the values in the
- * underlying style property.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface Counter {
- /**
- * This attribute is used for the identifier of the counter.
- */
- public String getIdentifier();
-
- /**
- * This attribute is used for the style of the list.
- */
- public String getListStyle();
-
- /**
- * This attribute is used for the separator of the nested counters.
- */
- public String getSeparator();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/DOMImplementationCSS.java b/libjava/external/w3c_dom/org/w3c/dom/css/DOMImplementationCSS.java
deleted file mode 100644
index 65c97291ef4..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/DOMImplementationCSS.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DOMException;
-
-/**
- * This interface allows the DOM user to create a CSSStyleSheet
- * outside the context of a document. There is no way to associate the new
- * CSSStyleSheet
with a document in DOM Level 2.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface DOMImplementationCSS extends DOMImplementation {
- /**
- * Creates a new CSSStyleSheet
.
- * @param title The advisory title. See also the section.
- * @param media The comma-separated list of media associated with the
- * new style sheet. See also the section.
- * @return A new CSS style sheet.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified media string value has a syntax
- * error and is unparsable.
- */
- public CSSStyleSheet createCSSStyleSheet(String title,
- String media)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/DocumentCSS.java b/libjava/external/w3c_dom/org/w3c/dom/css/DocumentCSS.java
deleted file mode 100644
index 8fe93c79a7e..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/DocumentCSS.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.stylesheets.DocumentStyle;
-
-/**
- * This interface represents a document with a CSS view.
- *
The getOverrideStyle
method provides a mechanism through
- * which a DOM author could effect immediate change to the style of an
- * element without modifying the explicitly linked style sheets of a
- * document or the inline style of elements in the style sheets. This style
- * sheet comes after the author style sheet in the cascade algorithm and is
- * called override style sheet. The override style sheet takes precedence
- * over author style sheets. An "!important" declaration still takes
- * precedence over a normal declaration. Override, author, and user style
- * sheets all may contain "!important" declarations. User "!important" rules
- * take precedence over both override and author "!important" rules, and
- * override "!important" rules take precedence over author "!important"
- * rules.
- *
The expectation is that an instance of the DocumentCSS
- * interface can be obtained by using binding-specific casting methods on an
- * instance of the Document
interface.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface DocumentCSS extends DocumentStyle {
- /**
- * This method is used to retrieve the override style declaration for a
- * specified element and a specified pseudo-element.
- * @param elt The element whose style is to be modified. This parameter
- * cannot be null.
- * @param pseudoElt The pseudo-element or null
if none.
- * @return The override style declaration.
- */
- public CSSStyleDeclaration getOverrideStyle(Element elt,
- String pseudoElt);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/ElementCSSInlineStyle.java b/libjava/external/w3c_dom/org/w3c/dom/css/ElementCSSInlineStyle.java
deleted file mode 100644
index 98b60bf9ddf..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/ElementCSSInlineStyle.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * Inline style information attached to elements is exposed through the
- * style
attribute. This represents the contents of the STYLE
- * attribute for HTML elements (or elements in other schemas or DTDs which
- * use the STYLE attribute in the same way). The expectation is that an
- * instance of the ElementCSSInlineStyle interface can be obtained by using
- * binding-specific casting methods on an instance of the Element interface
- * when the element supports inline CSS style informations.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface ElementCSSInlineStyle {
- /**
- * The style attribute.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/RGBColor.java b/libjava/external/w3c_dom/org/w3c/dom/css/RGBColor.java
deleted file mode 100644
index cd5daa56703..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/RGBColor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The RGBColor
interface is used to represent any RGB color
- * value. This interface reflects the values in the underlying style
- * property. Hence, modifications made to the CSSPrimitiveValue
- * objects modify the style property.
- *
A specified RGB color is not clipped (even if the number is outside the - * range 0-255 or 0%-100%). A computed RGB color is clipped depending on the - * device. - *
Even if a style sheet can only contain an integer for a color value, - * the internal storage of this integer is a float, and this can be used as - * a float in the specified or the computed style. - *
A color percentage value can always be converted to a number and vice - * versa. - *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface RGBColor {
- /**
- * This attribute is used for the red value of the RGB color.
- */
- public CSSPrimitiveValue getRed();
-
- /**
- * This attribute is used for the green value of the RGB color.
- */
- public CSSPrimitiveValue getGreen();
-
- /**
- * This attribute is used for the blue value of the RGB color.
- */
- public CSSPrimitiveValue getBlue();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/Rect.java b/libjava/external/w3c_dom/org/w3c/dom/css/Rect.java
deleted file mode 100644
index f5efb1084d9..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/Rect.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The Rect
interface is used to represent any rect value. This
- * interface reflects the values in the underlying style property. Hence,
- * modifications made to the CSSPrimitiveValue
objects modify
- * the style property.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface Rect {
- /**
- * This attribute is used for the top of the rect.
- */
- public CSSPrimitiveValue getTop();
-
- /**
- * This attribute is used for the right of the rect.
- */
- public CSSPrimitiveValue getRight();
-
- /**
- * This attribute is used for the bottom of the rect.
- */
- public CSSPrimitiveValue getBottom();
-
- /**
- * This attribute is used for the left of the rect.
- */
- public CSSPrimitiveValue getLeft();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/css/ViewCSS.java b/libjava/external/w3c_dom/org/w3c/dom/css/ViewCSS.java
deleted file mode 100644
index 76b585a54d2..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/css/ViewCSS.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.views.AbstractView;
-
-/**
- * This interface represents a CSS view. The getComputedStyle
- * method provides a read only access to the computed values of an element.
- *
The expectation is that an instance of the ViewCSS
- * interface can be obtained by using binding-specific casting methods on an
- * instance of the AbstractView
interface.
- *
Since a computed style is related to an Element
node, if
- * this element is removed from the document, the associated
- * CSSStyleDeclaration
and CSSValue
related to
- * this declaration are no longer valid.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface ViewCSS extends AbstractView {
- /**
- * This method is used to get the computed style as it is defined in [CSS2].
- * @param elt The element whose style is to be computed. This parameter
- * cannot be null.
- * @param pseudoElt The pseudo-element or null
if none.
- * @return The computed style. The CSSStyleDeclaration
is
- * read-only and contains only absolute values.
- */
- public CSSStyleDeclaration getComputedStyle(Element elt,
- String pseudoElt);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/DocumentEvent.java b/libjava/external/w3c_dom/org/w3c/dom/events/DocumentEvent.java
deleted file mode 100644
index 76644bc5a3d..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/DocumentEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The DocumentEvent
interface provides a mechanism by which the
- * user can create an Event of a type supported by the implementation. It is
- * expected that the DocumentEvent
interface will be
- * implemented on the same object which implements the Document
- * interface in an implementation which supports the Event model.
- *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public interface DocumentEvent {
- /**
- *
- * @param eventType The eventType
parameter specifies the
- * type of Event
interface to be created. If the
- * Event
interface specified is supported by the
- * implementation this method will return a new Event
of
- * the interface type requested. If the Event
is to be
- * dispatched via the dispatchEvent
method the
- * appropriate event init method must be called after creation in
- * order to initialize the Event
's values. As an example,
- * a user wishing to synthesize some kind of UIEvent
- * would call createEvent
with the parameter "UIEvents".
- * The initUIEvent
method could then be called on the
- * newly created UIEvent
to set the specific type of
- * UIEvent to be dispatched and set its context information.The
- * createEvent
method is used in creating
- * Event
s when it is either inconvenient or unnecessary
- * for the user to create an Event
themselves. In cases
- * where the implementation provided Event
is
- * insufficient, users may supply their own Event
- * implementations for use with the dispatchEvent
method.
- * @return The newly created Event
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the implementation does not support the
- * type of Event
interface requested
- */
- public Event createEvent(String eventType)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/Event.java b/libjava/external/w3c_dom/org/w3c/dom/events/Event.java
deleted file mode 100644
index 14a9239ed76..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/Event.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * The Event
interface is used to provide contextual information
- * about an event to the handler processing the event. An object which
- * implements the Event
interface is generally passed as the
- * first parameter to an event handler. More specific context information is
- * passed to event handlers by deriving additional interfaces from
- * Event
which contain information directly relating to the
- * type of event they accompany. These derived interfaces are also
- * implemented by the object passed to the event listener.
- *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public interface Event {
- // PhaseType
- /**
- * The current event phase is the capturing phase.
- */
- public static final short CAPTURING_PHASE = 1;
- /**
- * The event is currently being evaluated at the target
- * EventTarget
.
- */
- public static final short AT_TARGET = 2;
- /**
- * The current event phase is the bubbling phase.
- */
- public static final short BUBBLING_PHASE = 3;
-
- /**
- * The name of the event (case-insensitive). The name must be an XML name.
- */
- public String getType();
-
- /**
- * Used to indicate the EventTarget
to which the event was
- * originally dispatched.
- */
- public EventTarget getTarget();
-
- /**
- * Used to indicate the EventTarget
whose
- * EventListeners
are currently being processed. This is
- * particularly useful during capturing and bubbling.
- */
- public EventTarget getCurrentTarget();
-
- /**
- * Used to indicate which phase of event flow is currently being
- * evaluated.
- */
- public short getEventPhase();
-
- /**
- * Used to indicate whether or not an event is a bubbling event. If the
- * event can bubble the value is true, else the value is false.
- */
- public boolean getBubbles();
-
- /**
- * Used to indicate whether or not an event can have its default action
- * prevented. If the default action can be prevented the value is true,
- * else the value is false.
- */
- public boolean getCancelable();
-
- /**
- * Used to specify the time (in milliseconds relative to the epoch) at
- * which the event was created. Due to the fact that some systems may
- * not provide this information the value of timeStamp
may
- * be not available for all events. When not available, a value of 0
- * will be returned. Examples of epoch time are the time of the system
- * start or 0:0:0 UTC 1st January 1970.
- */
- public long getTimeStamp();
-
- /**
- * The stopPropagation
method is used prevent further
- * propagation of an event during event flow. If this method is called
- * by any EventListener
the event will cease propagating
- * through the tree. The event will complete dispatch to all listeners
- * on the current EventTarget
before event flow stops. This
- * method may be used during any stage of event flow.
- */
- public void stopPropagation();
-
- /**
- * If an event is cancelable, the preventDefault
method is
- * used to signify that the event is to be canceled, meaning any default
- * action normally taken by the implementation as a result of the event
- * will not occur. If, during any stage of event flow, the
- * preventDefault
method is called the event is canceled.
- * Any default action associated with the event will not occur. Calling
- * this method for a non-cancelable event has no effect. Once
- * preventDefault
has been called it will remain in effect
- * throughout the remainder of the event's propagation. This method may
- * be used during any stage of event flow.
- */
- public void preventDefault();
-
- /**
- * The initEvent
method is used to initialize the value of an
- * Event
created through the DocumentEvent
- * interface. This method may only be called before the
- * Event
has been dispatched via the
- * dispatchEvent
method, though it may be called multiple
- * times during that phase if necessary. If called multiple times the
- * final invocation takes precedence. If called from a subclass of
- * Event
interface only the values specified in the
- * initEvent
method are modified, all other attributes are
- * left unchanged.
- * @param eventTypeArg Specifies the event type. This type may be any
- * event type currently defined in this specification or a new event
- * type.. The string must be an XML name. Any new event type must not
- * begin with any upper, lower, or mixed case version of the string
- * "DOM". This prefix is reserved for future DOM event sets. It is
- * also strongly recommended that third parties adding their own
- * events use their own prefix to avoid confusion and lessen the
- * probability of conflicts with other new events.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- */
- public void initEvent(String eventTypeArg,
- boolean canBubbleArg,
- boolean cancelableArg);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/EventException.java b/libjava/external/w3c_dom/org/w3c/dom/events/EventException.java
deleted file mode 100644
index 7a6ff262052..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/EventException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * Event operations may throw an EventException
as specified in
- * their method descriptions.
- *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public class EventException extends RuntimeException {
- public EventException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // EventExceptionCode
- /**
- * If the Event
's type was not specified by initializing the
- * event before the method was called. Specification of the Event's type
- * as null
or an empty string will also trigger this
- * exception.
- */
- public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/EventListener.java b/libjava/external/w3c_dom/org/w3c/dom/events/EventListener.java
deleted file mode 100644
index 1df80202cea..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/EventListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * The EventListener
interface is the primary method for
- * handling events. Users implement the EventListener
interface
- * and register their listener on an EventTarget
using the
- * AddEventListener
method. The users should also remove their
- * EventListener
from its EventTarget
after they
- * have completed using the listener.
- *
When a Node
is copied using the cloneNode
- * method the EventListener
s attached to the source
- * Node
are not attached to the copied Node
. If
- * the user wishes the same EventListener
s to be added to the
- * newly created copy the user must add them manually.
- *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public interface EventListener {
- /**
- * This method is called whenever an event occurs of the type for which
- * the EventListener
interface was registered.
- * @param evt The Event
contains contextual information
- * about the event. It also contains the stopPropagation
- * and preventDefault
methods which are used in
- * determining the event's flow and default action.
- */
- public void handleEvent(Event evt);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/EventTarget.java b/libjava/external/w3c_dom/org/w3c/dom/events/EventTarget.java
deleted file mode 100644
index f07663660fd..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/EventTarget.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * The EventTarget
interface is implemented by all
- * Nodes
in an implementation which supports the DOM Event
- * Model. Therefore, this interface can be obtained by using
- * binding-specific casting methods on an instance of the Node
- * interface. The interface allows registration and removal of
- * EventListeners
on an EventTarget
and dispatch
- * of events to that EventTarget
.
- *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public interface EventTarget {
- /**
- * This method allows the registration of event listeners on the event
- * target. If an EventListener
is added to an
- * EventTarget
while it is processing an event, it will not
- * be triggered by the current actions but may be triggered during a
- * later stage of event flow, such as the bubbling phase.
- *
If multiple identical EventListener
s are registered
- * on the same EventTarget
with the same parameters the
- * duplicate instances are discarded. They do not cause the
- * EventListener
to be called twice and since they are
- * discarded they do not need to be removed with the
- * removeEventListener
method.
- * @param type The event type for which the user is registering
- * @param listener The listener
parameter takes an interface
- * implemented by the user which contains the methods to be called
- * when the event occurs.
- * @param useCapture If true, useCapture
indicates that the
- * user wishes to initiate capture. After initiating capture, all
- * events of the specified type will be dispatched to the registered
- * EventListener
before being dispatched to any
- * EventTargets
beneath them in the tree. Events which
- * are bubbling upward through the tree will not trigger an
- * EventListener
designated to use capture.
- */
- public void addEventListener(String type,
- EventListener listener,
- boolean useCapture);
-
- /**
- * This method allows the removal of event listeners from the event
- * target. If an EventListener
is removed from an
- * EventTarget
while it is processing an event, it will not
- * be triggered by the current actions. EventListener
s can
- * never be invoked after being removed.
- *
Calling removeEventListener
with arguments which do
- * not identify any currently registered EventListener
on
- * the EventTarget
has no effect.
- * @param type Specifies the event type of the EventListener
- * being removed.
- * @param listener The EventListener
parameter indicates the
- * EventListener
to be removed.
- * @param useCapture Specifies whether the EventListener
- * being removed was registered as a capturing listener or not. If a
- * listener was registered twice, one with capture and one without,
- * each must be removed separately. Removal of a capturing listener
- * does not affect a non-capturing version of the same listener, and
- * vice versa.
- */
- public void removeEventListener(String type,
- EventListener listener,
- boolean useCapture);
-
- /**
- * This method allows the dispatch of events into the implementations
- * event model. Events dispatched in this manner will have the same
- * capturing and bubbling behavior as events dispatched directly by the
- * implementation. The target of the event is the
- * EventTarget
on which dispatchEvent
is
- * called.
- * @param evt Specifies the event type, behavior, and contextual
- * information to be used in processing the event.
- * @return The return value of dispatchEvent
indicates
- * whether any of the listeners which handled the event called
- * preventDefault
. If preventDefault
was
- * called the value is false, else the value is true.
- * @exception EventException
- * UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event
's type
- * was not specified by initializing the event before
- * dispatchEvent
was called. Specification of the
- * Event
's type as null
or an empty string
- * will also trigger this exception.
- */
- public boolean dispatchEvent(Event evt)
- throws EventException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/MouseEvent.java b/libjava/external/w3c_dom/org/w3c/dom/events/MouseEvent.java
deleted file mode 100644
index be780357a88..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/MouseEvent.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.views.AbstractView;
-
-/**
- * The MouseEvent
interface provides specific contextual
- * information associated with Mouse events.
- *
The detail
attribute inherited from UIEvent
- * indicates the number of times a mouse button has been pressed and
- * released over the same screen location during a user action. The
- * attribute value is 1 when the user begins this action and increments by 1
- * for each full sequence of pressing and releasing. If the user moves the
- * mouse between the mousedown and mouseup the value will be set to 0,
- * indicating that no click is occurring.
- *
In the case of nested elements mouse events are always targeted at the - * most deeply nested element. Ancestors of the targeted element may use - * bubbling to obtain notification of mouse events which occur within its - * descendent elements. - *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public interface MouseEvent extends UIEvent {
- /**
- * The horizontal coordinate at which the event occurred relative to the
- * origin of the screen coordinate system.
- */
- public int getScreenX();
-
- /**
- * The vertical coordinate at which the event occurred relative to the
- * origin of the screen coordinate system.
- */
- public int getScreenY();
-
- /**
- * The horizontal coordinate at which the event occurred relative to the
- * DOM implementation's client area.
- */
- public int getClientX();
-
- /**
- * The vertical coordinate at which the event occurred relative to the DOM
- * implementation's client area.
- */
- public int getClientY();
-
- /**
- * Used to indicate whether the 'ctrl' key was depressed during the firing
- * of the event.
- */
- public boolean getCtrlKey();
-
- /**
- * Used to indicate whether the 'shift' key was depressed during the
- * firing of the event.
- */
- public boolean getShiftKey();
-
- /**
- * Used to indicate whether the 'alt' key was depressed during the firing
- * of the event. On some platforms this key may map to an alternative
- * key name.
- */
- public boolean getAltKey();
-
- /**
- * Used to indicate whether the 'meta' key was depressed during the firing
- * of the event. On some platforms this key may map to an alternative
- * key name.
- */
- public boolean getMetaKey();
-
- /**
- * During mouse events caused by the depression or release of a mouse
- * button, button
is used to indicate which mouse button
- * changed state. The values for button
range from zero to
- * indicate the left button of the mouse, one to indicate the middle
- * button if present, and two to indicate the right button. For mice
- * configured for left handed use in which the button actions are
- * reversed the values are instead read from right to left.
- */
- public short getButton();
-
- /**
- * Used to identify a secondary EventTarget
related to a UI
- * event. Currently this attribute is used with the mouseover event to
- * indicate the EventTarget
which the pointing device
- * exited and with the mouseout event to indicate the
- * EventTarget
which the pointing device entered.
- */
- public EventTarget getRelatedTarget();
-
- /**
- * The initMouseEvent
method is used to initialize the value
- * of a MouseEvent
created through the
- * DocumentEvent
interface. This method may only be called
- * before the MouseEvent
has been dispatched via the
- * dispatchEvent
method, though it may be called multiple
- * times during that phase if necessary. If called multiple times, the
- * final invocation takes precedence.
- * @param typeArg Specifies the event type.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- * @param viewArg Specifies the Event
's
- * AbstractView
.
- * @param detailArg Specifies the Event
's mouse click count.
- * @param screenXArg Specifies the Event
's screen x
- * coordinate
- * @param screenYArg Specifies the Event
's screen y
- * coordinate
- * @param clientXArg Specifies the Event
's client x
- * coordinate
- * @param clientYArg Specifies the Event
's client y
- * coordinate
- * @param ctrlKeyArg Specifies whether or not control key was depressed
- * during the Event
.
- * @param altKeyArg Specifies whether or not alt key was depressed during
- * the Event
.
- * @param shiftKeyArg Specifies whether or not shift key was depressed
- * during the Event
.
- * @param metaKeyArg Specifies whether or not meta key was depressed
- * during the Event
.
- * @param buttonArg Specifies the Event
's mouse button.
- * @param relatedTargetArg Specifies the Event
's related
- * EventTarget
.
- */
- public void initMouseEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- AbstractView viewArg,
- int detailArg,
- int screenXArg,
- int screenYArg,
- int clientXArg,
- int clientYArg,
- boolean ctrlKeyArg,
- boolean altKeyArg,
- boolean shiftKeyArg,
- boolean metaKeyArg,
- short buttonArg,
- EventTarget relatedTargetArg);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/MutationEvent.java b/libjava/external/w3c_dom/org/w3c/dom/events/MutationEvent.java
deleted file mode 100644
index 3db40038e93..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/MutationEvent.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.Node;
-
-/**
- * The MutationEvent
interface provides specific contextual
- * information associated with Mutation events.
- *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public interface MutationEvent extends Event {
- // attrChangeType
- /**
- * The Attr
was modified in place.
- */
- public static final short MODIFICATION = 1;
- /**
- * The Attr
was just added.
- */
- public static final short ADDITION = 2;
- /**
- * The Attr
was just removed.
- */
- public static final short REMOVAL = 3;
-
- /**
- * relatedNode
is used to identify a secondary node related
- * to a mutation event. For example, if a mutation event is dispatched
- * to a node indicating that its parent has changed, the
- * relatedNode
is the changed parent. If an event is
- * instead dispatched to a subtree indicating a node was changed within
- * it, the relatedNode
is the changed node. In the case of
- * the DOMAttrModified event it indicates the Attr
node
- * which was modified, added, or removed.
- */
- public Node getRelatedNode();
-
- /**
- * prevValue
indicates the previous value of the
- * Attr
node in DOMAttrModified events, and of the
- * CharacterData
node in DOMCharacterDataModified events.
- */
- public String getPrevValue();
-
- /**
- * newValue
indicates the new value of the Attr
- * node in DOMAttrModified events, and of the CharacterData
- * node in DOMCharacterDataModified events.
- */
- public String getNewValue();
-
- /**
- * attrName
indicates the name of the changed
- * Attr
node in a DOMAttrModified event.
- */
- public String getAttrName();
-
- /**
- * attrChange
indicates the type of change which triggered
- * the DOMAttrModified event. The values can be MODIFICATION
- * , ADDITION
, or REMOVAL
.
- */
- public short getAttrChange();
-
- /**
- * The initMutationEvent
method is used to initialize the
- * value of a MutationEvent
created through the
- * DocumentEvent
interface. This method may only be called
- * before the MutationEvent
has been dispatched via the
- * dispatchEvent
method, though it may be called multiple
- * times during that phase if necessary. If called multiple times, the
- * final invocation takes precedence.
- * @param typeArg Specifies the event type.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- * @param relatedNodeArg Specifies the Event
's related Node.
- * @param prevValueArg Specifies the Event
's
- * prevValue
attribute. This value may be null.
- * @param newValueArg Specifies the Event
's
- * newValue
attribute. This value may be null.
- * @param attrNameArg Specifies the Event
's
- * attrName
attribute. This value may be null.
- * @param attrChangeArg Specifies the Event
's
- * attrChange
attribute
- */
- public void initMutationEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- Node relatedNodeArg,
- String prevValueArg,
- String newValueArg,
- String attrNameArg,
- short attrChangeArg);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/events/UIEvent.java b/libjava/external/w3c_dom/org/w3c/dom/events/UIEvent.java
deleted file mode 100644
index 15affe8791e..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/events/UIEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.views.AbstractView;
-
-/**
- * The UIEvent
interface provides specific contextual information
- * associated with User Interface events.
- *
See also the Document Object Model (DOM) Level 2 Events Specification.
- * @since DOM Level 2
- */
-public interface UIEvent extends Event {
- /**
- * The view
attribute identifies the AbstractView
- * from which the event was generated.
- */
- public AbstractView getView();
-
- /**
- * Specifies some detail information about the Event
,
- * depending on the type of event.
- */
- public int getDetail();
-
- /**
- * The initUIEvent
method is used to initialize the value of
- * a UIEvent
created through the DocumentEvent
- * interface. This method may only be called before the
- * UIEvent
has been dispatched via the
- * dispatchEvent
method, though it may be called multiple
- * times during that phase if necessary. If called multiple times, the
- * final invocation takes precedence.
- * @param typeArg Specifies the event type.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- * @param viewArg Specifies the Event
's
- * AbstractView
.
- * @param detailArg Specifies the Event
's detail.
- */
- public void initUIEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- AbstractView viewArg,
- int detailArg);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAnchorElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAnchorElement.java
deleted file mode 100644
index eaac35c8a76..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAnchorElement.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * The anchor element. See the A element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLAnchorElement extends HTMLElement {
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public String getAccessKey();
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public void setAccessKey(String accessKey);
-
- /**
- * The character encoding of the linked resource. See the charset
- * attribute definition in HTML 4.01.
- */
- public String getCharset();
- /**
- * The character encoding of the linked resource. See the charset
- * attribute definition in HTML 4.01.
- */
- public void setCharset(String charset);
-
- /**
- * Comma-separated list of lengths, defining an active region geometry.
- * See also shape
for the shape of the region. See the
- * coords attribute definition in HTML 4.01.
- */
- public String getCoords();
- /**
- * Comma-separated list of lengths, defining an active region geometry.
- * See also shape
for the shape of the region. See the
- * coords attribute definition in HTML 4.01.
- */
- public void setCoords(String coords);
-
- /**
- * The absolute URI [IETF RFC 2396] of the linked resource. See the href attribute
- * definition in HTML 4.01.
- */
- public String getHref();
- /**
- * The absolute URI [IETF RFC 2396] of the linked resource. See the href attribute
- * definition in HTML 4.01.
- */
- public void setHref(String href);
-
- /**
- * Language code of the linked resource. See the hreflang attribute
- * definition in HTML 4.01.
- */
- public String getHreflang();
- /**
- * Language code of the linked resource. See the hreflang attribute
- * definition in HTML 4.01.
- */
- public void setHreflang(String hreflang);
-
- /**
- * Anchor name. See the name attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * Anchor name. See the name attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * Forward link type. See the rel attribute definition in HTML 4.01.
- */
- public String getRel();
- /**
- * Forward link type. See the rel attribute definition in HTML 4.01.
- */
- public void setRel(String rel);
-
- /**
- * Reverse link type. See the rev attribute definition in HTML 4.01.
- */
- public String getRev();
- /**
- * Reverse link type. See the rev attribute definition in HTML 4.01.
- */
- public void setRev(String rev);
-
- /**
- * The shape of the active area. The coordinates are given by
- * coords
. See the shape attribute definition in HTML 4.01.
- */
- public String getShape();
- /**
- * The shape of the active area. The coordinates are given by
- * coords
. See the shape attribute definition in HTML 4.01.
- */
- public void setShape(String shape);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public int getTabIndex();
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public void setTabIndex(int tabIndex);
-
- /**
- * Frame to render the resource in. See the target attribute definition in
- * HTML 4.01.
- */
- public String getTarget();
- /**
- * Frame to render the resource in. See the target attribute definition in
- * HTML 4.01.
- */
- public void setTarget(String target);
-
- /**
- * Advisory content type. See the type attribute definition in HTML 4.01.
- */
- public String getType();
- /**
- * Advisory content type. See the type attribute definition in HTML 4.01.
- */
- public void setType(String type);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAppletElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAppletElement.java
deleted file mode 100644
index f27b51afb7a..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAppletElement.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * An embedded Java applet. See the APPLET element definition in HTML 4.01.
- * This element is deprecated in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLAppletElement extends HTMLElement { - /** - * Aligns this object (vertically or horizontally) with respect to its - * surrounding text. See the align attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public String getAlign(); - /** - * Aligns this object (vertically or horizontally) with respect to its - * surrounding text. See the align attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public void setAlign(String align); - - /** - * Alternate text for user agents not rendering the normal content of this - * element. See the alt attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public String getAlt(); - /** - * Alternate text for user agents not rendering the normal content of this - * element. See the alt attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public void setAlt(String alt); - - /** - * Comma-separated archive list. See the archive attribute definition in - * HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getArchive(); - /** - * Comma-separated archive list. See the archive attribute definition in - * HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setArchive(String archive); - - /** - * Applet class file. See the code attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public String getCode(); - /** - * Applet class file. See the code attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public void setCode(String code); - - /** - * Optional base URI [IETF RFC 2396] for applet. See the codebase attribute definition in - * HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getCodeBase(); - /** - * Optional base URI [IETF RFC 2396] for applet. See the codebase attribute definition in - * HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setCodeBase(String codeBase); - - /** - * Override height. See the height attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public String getHeight(); - /** - * Override height. See the height attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public void setHeight(String height); - - /** - * Horizontal space, in pixels, to the left and right of this image, - * applet, or object. See the hspace attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public int getHspace(); - /** - * Horizontal space, in pixels, to the left and right of this image, - * applet, or object. See the hspace attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public void setHspace(int hspace); - - /** - * The name of the applet. See the name attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public String getName(); - /** - * The name of the applet. See the name attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public void setName(String name); - - /** - * The value of the "object" attribute. See the object attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public String getObject(); - /** - * The value of the "object" attribute. See the object attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public void setObject(String object); - - /** - * Vertical space, in pixels, above and below this image, applet, or - * object. See the vspace attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public int getVspace(); - /** - * Vertical space, in pixels, above and below this image, applet, or - * object. See the vspace attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public void setVspace(int vspace); - - /** - * Override width. See the width attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public String getWidth(); - /** - * Override width. See the width attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public void setWidth(String width); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAreaElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAreaElement.java deleted file mode 100644 index 75d1dc5cfa9..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLAreaElement.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Client-side image map area definition. See the AREA element definition in - * HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLAreaElement extends HTMLElement {
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public String getAccessKey();
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public void setAccessKey(String accessKey);
-
- /**
- * Alternate text for user agents not rendering the normal content of this
- * element. See the alt attribute definition in HTML 4.01.
- */
- public String getAlt();
- /**
- * Alternate text for user agents not rendering the normal content of this
- * element. See the alt attribute definition in HTML 4.01.
- */
- public void setAlt(String alt);
-
- /**
- * Comma-separated list of lengths, defining an active region geometry.
- * See also shape
for the shape of the region. See the
- * coords attribute definition in HTML 4.01.
- */
- public String getCoords();
- /**
- * Comma-separated list of lengths, defining an active region geometry.
- * See also shape
for the shape of the region. See the
- * coords attribute definition in HTML 4.01.
- */
- public void setCoords(String coords);
-
- /**
- * The URI [IETF RFC 2396] of the linked resource. See the href attribute definition in
- * HTML 4.01.
- */
- public String getHref();
- /**
- * The URI [IETF RFC 2396] of the linked resource. See the href attribute definition in
- * HTML 4.01.
- */
- public void setHref(String href);
-
- /**
- * Specifies that this area is inactive, i.e., has no associated action.
- * See the nohref attribute definition in HTML 4.01.
- */
- public boolean getNoHref();
- /**
- * Specifies that this area is inactive, i.e., has no associated action.
- * See the nohref attribute definition in HTML 4.01.
- */
- public void setNoHref(boolean noHref);
-
- /**
- * The shape of the active area. The coordinates are given by
- * coords
. See the shape attribute definition in HTML 4.01.
- */
- public String getShape();
- /**
- * The shape of the active area. The coordinates are given by
- * coords
. See the shape attribute definition in HTML 4.01.
- */
- public void setShape(String shape);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public int getTabIndex();
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public void setTabIndex(int tabIndex);
-
- /**
- * Frame to render the resource in. See the target attribute definition in
- * HTML 4.01.
- */
- public String getTarget();
- /**
- * Frame to render the resource in. See the target attribute definition in
- * HTML 4.01.
- */
- public void setTarget(String target);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBRElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBRElement.java
deleted file mode 100644
index a865d282d41..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBRElement.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Force a line break. See the BR element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLBRElement extends HTMLElement { - /** - * Control flow of text around floats. See the clear attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getClear(); - /** - * Control flow of text around floats. See the clear attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setClear(String clear); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBaseElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBaseElement.java deleted file mode 100644 index 7b52dbcc209..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBaseElement.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Document base URI [IETF RFC 2396]. See the BASE element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLBaseElement extends HTMLElement { - /** - * The base URI [IETF RFC 2396]. See the href attribute definition in HTML 4.01. - */ - public String getHref(); - /** - * The base URI [IETF RFC 2396]. See the href attribute definition in HTML 4.01. - */ - public void setHref(String href); - - /** - * The default target frame. See the target attribute definition in HTML - * 4.01. - */ - public String getTarget(); - /** - * The default target frame. See the target attribute definition in HTML - * 4.01. - */ - public void setTarget(String target); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBaseFontElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBaseFontElement.java deleted file mode 100644 index 5a3c5c93cee..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBaseFontElement.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Base font. See the BASEFONT element definition in HTML 4.01. This element - * is deprecated in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLBaseFontElement extends HTMLElement { - /** - * Font color. See the color attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public String getColor(); - /** - * Font color. See the color attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public void setColor(String color); - - /** - * Font face identifier. See the face attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public String getFace(); - /** - * Font face identifier. See the face attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public void setFace(String face); - - /** - * Computed font size. See the size attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public int getSize(); - /** - * Computed font size. See the size attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - * @version DOM Level 2 - */ - public void setSize(int size); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBodyElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBodyElement.java deleted file mode 100644 index 8898c5de030..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLBodyElement.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * The HTML document body. This element is always present in the DOM API, even - * if the tags are not present in the source document. See the BODY element - * definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLBodyElement extends HTMLElement { - /** - * Color of active links (after mouse-button down, but before mouse-button - * up). See the alink attribute definition in HTML 4.01. This attribute - * is deprecated in HTML 4.01. - */ - public String getALink(); - /** - * Color of active links (after mouse-button down, but before mouse-button - * up). See the alink attribute definition in HTML 4.01. This attribute - * is deprecated in HTML 4.01. - */ - public void setALink(String aLink); - - /** - * URI [IETF RFC 2396] of the background texture tile image. See the background attribute - * definition in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getBackground(); - /** - * URI [IETF RFC 2396] of the background texture tile image. See the background attribute - * definition in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setBackground(String background); - - /** - * Document background color. See the bgcolor attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getBgColor(); - /** - * Document background color. See the bgcolor attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setBgColor(String bgColor); - - /** - * Color of links that are not active and unvisited. See the link - * attribute definition in HTML 4.01. This attribute is deprecated in - * HTML 4.01. - */ - public String getLink(); - /** - * Color of links that are not active and unvisited. See the link - * attribute definition in HTML 4.01. This attribute is deprecated in - * HTML 4.01. - */ - public void setLink(String link); - - /** - * Document text color. See the text attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public String getText(); - /** - * Document text color. See the text attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public void setText(String text); - - /** - * Color of links that have been visited by the user. See the vlink - * attribute definition in HTML 4.01. This attribute is deprecated in - * HTML 4.01. - */ - public String getVLink(); - /** - * Color of links that have been visited by the user. See the vlink - * attribute definition in HTML 4.01. This attribute is deprecated in - * HTML 4.01. - */ - public void setVLink(String vLink); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLButtonElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLButtonElement.java deleted file mode 100644 index 7efe1834c26..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLButtonElement.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Push button. See the BUTTON element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLButtonElement extends HTMLElement {
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public String getAccessKey();
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public void setAccessKey(String accessKey);
-
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public boolean getDisabled();
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public void setDisabled(boolean disabled);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public int getTabIndex();
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public void setTabIndex(int tabIndex);
-
- /**
- * The type of button (all lower case). See the type attribute definition
- * in HTML 4.01.
- */
- public String getType();
-
- /**
- * The current form control value. See the value attribute definition in
- * HTML 4.01.
- */
- public String getValue();
- /**
- * The current form control value. See the value attribute definition in
- * HTML 4.01.
- */
- public void setValue(String value);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLCollection.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLCollection.java
deleted file mode 100644
index 6b6751783fe..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLCollection.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-import org.w3c.dom.Node;
-
-/**
- * An HTMLCollection
is a list of nodes. An individual node may
- * be accessed by either ordinal index or the node's name
or
- * id
attributes. Collections in the HTML DOM are assumed to be
- * live meaning that they are automatically updated when the underlying
- * document is changed.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLCollection {
- /**
- * This attribute specifies the length or size of the list.
- */
- public int getLength();
-
- /**
- * This method retrieves a node specified by ordinal index. Nodes are
- * numbered in tree order (depth-first traversal order).
- * @param index The index of the node to be fetched. The index origin is
- * 0
.
- * @return The Node
at the corresponding position upon
- * success. A value of null
is returned if the index is
- * out of range.
- */
- public Node item(int index);
-
- /**
- * This method retrieves a Node
using a name. With [HTML 4.01]
- * documents, it first searches for a Node
with a matching
- * id
attribute. If it doesn't find one, it then searches
- * for a Node
with a matching name
attribute,
- * but only on those elements that are allowed a name attribute. With [XHTML 1.0]
- * documents, this method only searches for Nodes
with a
- * matching id
attribute. This method is case insensitive
- * in HTML documents and case sensitive in XHTML documents.
- * @param name The name of the Node
to be fetched.
- * @return The Node
with a name
or
- * id
attribute whose value corresponds to the specified
- * string. Upon failure (e.g., no node with this name exists), returns
- * null
.
- */
- public Node namedItem(String name);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDListElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDListElement.java
deleted file mode 100644
index e8a3bb4a064..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDListElement.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Definition list. See the DL element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLDListElement extends HTMLElement { - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public boolean getCompact(); - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setCompact(boolean compact); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDirectoryElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDirectoryElement.java deleted file mode 100644 index 5a405c80432..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDirectoryElement.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Directory list. See the DIR element definition in HTML 4.01. This element - * is deprecated in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLDirectoryElement extends HTMLElement { - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public boolean getCompact(); - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setCompact(boolean compact); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDivElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDivElement.java deleted file mode 100644 index 31107c5f168..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDivElement.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Generic block container. See the DIV element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLDivElement extends HTMLElement {
- /**
- * Horizontal text alignment. See the align attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Horizontal text alignment. See the align attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDocument.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDocument.java
deleted file mode 100644
index 79ad1b3363f..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLDocument.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.DOMException;
-
-/**
- * An HTMLDocument
is the root of the HTML hierarchy and holds
- * the entire content. Besides providing access to the hierarchy, it also
- * provides some convenience methods for accessing certain sets of
- * information from the document.
- *
The following properties have been deprecated in favor of the
- * corresponding ones for the BODY
element:alinkColorbackground
- * bgColorfgColorlinkColorvlinkColorIn DOM Level 2, the method
- * getElementById
is inherited from the Document
- * interface where it was moved to.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLDocument extends Document {
- /**
- * The title of a document as specified by the TITLE
element
- * in the head of the document.
- */
- public String getTitle();
- /**
- * The title of a document as specified by the TITLE
element
- * in the head of the document.
- */
- public void setTitle(String title);
-
- /**
- * Returns the URI [IETF RFC 2396] of the page that linked to this page. The value is an
- * empty string if the user navigated to the page directly (not through
- * a link, but, for example, via a bookmark).
- */
- public String getReferrer();
-
- /**
- * The domain name of the server that served the document, or
- * null
if the server cannot be identified by a domain
- * name.
- */
- public String getDomain();
-
- /**
- * The absolute URI [IETF RFC 2396] of the document.
- */
- public String getURL();
-
- /**
- * The element that contains the content for the document. In documents
- * with BODY
contents, returns the BODY
- * element. In frameset documents, this returns the outermost
- * FRAMESET
element.
- */
- public HTMLElement getBody();
- /**
- * The element that contains the content for the document. In documents
- * with BODY
contents, returns the BODY
- * element. In frameset documents, this returns the outermost
- * FRAMESET
element.
- */
- public void setBody(HTMLElement body);
-
- /**
- * A collection of all the IMG
elements in a document. The
- * behavior is limited to IMG
elements for backwards
- * compatibility. As suggested by [HTML 4.01], to include images, authors may use
- * the OBJECT
element or the IMG
element.
- * Therefore, it is recommended not to use this attribute to find the
- * images in the document but getElementsByTagName
with
- * HTML 4.01 or getElementsByTagNameNS
with XHTML 1.0.
- */
- public HTMLCollection getImages();
-
- /**
- * A collection of all the OBJECT
elements that include
- * applets and APPLET
(deprecated) elements in a document.
- */
- public HTMLCollection getApplets();
-
- /**
- * A collection of all AREA
elements and anchor (
- * A
) elements in a document with a value for the
- * href
attribute.
- */
- public HTMLCollection getLinks();
-
- /**
- * A collection of all the forms of a document.
- */
- public HTMLCollection getForms();
-
- /**
- * A collection of all the anchor (A
) elements in a document
- * with a value for the name
attribute. For reasons of
- * backward compatibility, the returned set of anchors only contains
- * those anchors created with the name
attribute, not those
- * created with the id
attribute. Note that in [XHTML 1.0], the
- * name
attribute (see section 4.10) has no semantics and
- * is only present for legacy user agents: the id
attribute
- * is used instead. Users should prefer the iterator mechanisms provided
- * by [DOM Level 2 Traversal] instead.
- */
- public HTMLCollection getAnchors();
-
- /**
- * This mutable string attribute denotes persistent state information
- * that (1) is associated with the current frame or document and (2) is
- * composed of information described by the cookies
- * non-terminal of [IETF RFC 2965], Section 4.2.2.
- *
If no persistent state information is available for the current
- * frame or document document, then this property's value is an empty
- * string.
- *
When this attribute is read, all cookies are returned as a single
- * string, with each cookie's name-value pair concatenated into a list
- * of name-value pairs, each list item being separated by a ';'
- * (semicolon).
- *
When this attribute is set, the value it is set to should be a
- * string that adheres to the cookie
non-terminal of [IETF RFC 2965]; that
- * is, it should be a single name-value pair followed by zero or more
- * cookie attribute values. If no domain attribute is specified, then
- * the domain attribute for the new value defaults to the host portion
- * of an absolute URI [IETF RFC 2396] of the current frame or document. If no path
- * attribute is specified, then the path attribute for the new value
- * defaults to the absolute path portion of the URI [IETF RFC 2396] of the current
- * frame or document. If no max-age attribute is specified, then the
- * max-age attribute for the new value defaults to a user agent defined
- * value. If a cookie with the specified name is already associated with
- * the current frame or document, then the new value as well as the new
- * attributes replace the old value and attributes. If a max-age
- * attribute of 0 is specified for the new value, then any existing
- * cookies of the specified name are removed from the cookie storage.
- * See [IETF RFC 2965] for the semantics of persistent state item attribute value
- * pairs. The precise nature of a user agent session is not defined by
- * this specification.
- */
- public String getCookie();
- /**
- * This mutable string attribute denotes persistent state information
- * that (1) is associated with the current frame or document and (2) is
- * composed of information described by the cookies
- * non-terminal of [IETF RFC 2965], Section 4.2.2.
- *
If no persistent state information is available for the current
- * frame or document document, then this property's value is an empty
- * string.
- *
When this attribute is read, all cookies are returned as a single
- * string, with each cookie's name-value pair concatenated into a list
- * of name-value pairs, each list item being separated by a ';'
- * (semicolon).
- *
When this attribute is set, the value it is set to should be a
- * string that adheres to the cookie
non-terminal of [IETF RFC 2965]; that
- * is, it should be a single name-value pair followed by zero or more
- * cookie attribute values. If no domain attribute is specified, then
- * the domain attribute for the new value defaults to the host portion
- * of an absolute URI [IETF RFC 2396] of the current frame or document. If no path
- * attribute is specified, then the path attribute for the new value
- * defaults to the absolute path portion of the URI [IETF RFC 2396] of the current
- * frame or document. If no max-age attribute is specified, then the
- * max-age attribute for the new value defaults to a user agent defined
- * value. If a cookie with the specified name is already associated with
- * the current frame or document, then the new value as well as the new
- * attributes replace the old value and attributes. If a max-age
- * attribute of 0 is specified for the new value, then any existing
- * cookies of the specified name are removed from the cookie storage.
- * See [IETF RFC 2965] for the semantics of persistent state item attribute value
- * pairs. The precise nature of a user agent session is not defined by
- * this specification.
- * @exception DOMException
- * SYNTAX_ERR: If the new value does not adhere to the cookie syntax
- * specified by [IETF RFC 2965].
- */
- public void setCookie(String cookie)
- throws DOMException;
-
- /**
- * Open a document stream for writing. If a document exists in the target,
- * this method clears it. This method and the ones following allow a
- * user to add to or replace the structure model of a document using
- * strings of unparsed HTML. At the time of writing alternate methods
- * for providing similar functionality for both HTML and XML documents
- * were being considered (see [DOM Level 3 Load and Save]).
- */
- public void open();
-
- /**
- * Closes a document stream opened by open()
and forces
- * rendering.
- */
- public void close();
-
- /**
- * Write a string of text to a document stream opened by
- * open()
. Note that the function will produce a document
- * which is not necessarily driven by a DTD and therefore might be
- * produce an invalid result in the context of the document.
- * @param text The string to be parsed into some structure in the
- * document structure model.
- */
- public void write(String text);
-
- /**
- * Write a string of text followed by a newline character to a document
- * stream opened by open()
. Note that the function will
- * produce a document which is not necessarily driven by a DTD and
- * therefore might be produce an invalid result in the context of the
- * document
- * @param text The string to be parsed into some structure in the
- * document structure model.
- */
- public void writeln(String text);
-
- /**
- * With [HTML 4.01] documents, this method returns the (possibly empty) collection
- * of elements whose name
value is given by
- * elementName
. In [XHTML 1.0] documents, this methods only return the
- * (possibly empty) collection of form controls with matching name. This
- * method is case sensitive.
- * @param elementName The name
attribute value for an
- * element.
- * @return The matching elements.
- */
- public NodeList getElementsByName(String elementName);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLElement.java
deleted file mode 100644
index ed37419d3bc..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLElement.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-import org.w3c.dom.Element;
-
-/**
- * All HTML element interfaces derive from this class. Elements that only
- * expose the HTML core attributes are represented by the base
- * HTMLElement
interface. These elements are as follows:
- * special: SUB, SUP, SPAN, BDOfont: TT, I, B, U, S, STRIKE, BIG, SMALL
- * phrase: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ACRONYM, ABBRlist:
- * DD, DTNOFRAMES, NOSCRIPTADDRESS, CENTERThe style
attribute
- * of an HTML element is accessible through the
- * ElementCSSInlineStyle
interface which is defined in the CSS
- * module [DOM Level 2 Style Sheets and CSS].
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLElement extends Element { - /** - * The element's identifier. See the id attribute definition in HTML 4.01. - */ - public String getId(); - /** - * The element's identifier. See the id attribute definition in HTML 4.01. - */ - public void setId(String id); - - /** - * The element's advisory title. See the title attribute definition in - * HTML 4.01. - */ - public String getTitle(); - /** - * The element's advisory title. See the title attribute definition in - * HTML 4.01. - */ - public void setTitle(String title); - - /** - * Language code defined in RFC 1766. See the lang attribute definition in - * HTML 4.01. - */ - public String getLang(); - /** - * Language code defined in RFC 1766. See the lang attribute definition in - * HTML 4.01. - */ - public void setLang(String lang); - - /** - * Specifies the base direction of directionally neutral text and the - * directionality of tables. See the dir attribute definition in HTML - * 4.01. - */ - public String getDir(); - /** - * Specifies the base direction of directionally neutral text and the - * directionality of tables. See the dir attribute definition in HTML - * 4.01. - */ - public void setDir(String dir); - - /** - * The class attribute of the element. This attribute has been renamed due - * to conflicts with the "class" keyword exposed by many languages. See - * the class attribute definition in HTML 4.01. - */ - public String getClassName(); - /** - * The class attribute of the element. This attribute has been renamed due - * to conflicts with the "class" keyword exposed by many languages. See - * the class attribute definition in HTML 4.01. - */ - public void setClassName(String className); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFieldSetElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFieldSetElement.java deleted file mode 100644 index c962a567d1b..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFieldSetElement.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Organizes form controls into logical groups. See the FIELDSET element - * definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLFieldSetElement extends HTMLElement {
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFontElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFontElement.java
deleted file mode 100644
index 8fa25893c35..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFontElement.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Local change to font. See the FONT element definition in HTML 4.01. This
- * element is deprecated in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLFontElement extends HTMLElement {
- /**
- * Font color. See the color attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public String getColor();
- /**
- * Font color. See the color attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public void setColor(String color);
-
- /**
- * Font face identifier. See the face attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public String getFace();
- /**
- * Font face identifier. See the face attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setFace(String face);
-
- /**
- * Font size. See the size attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public String getSize();
- /**
- * Font size. See the size attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public void setSize(String size);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFormElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFormElement.java
deleted file mode 100644
index 109f31a57dd..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFormElement.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * The FORM
element encompasses behavior similar to a collection
- * and an element. It provides direct access to the contained form controls
- * as well as the attributes of the form element. See the FORM element
- * definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLFormElement extends HTMLElement { - /** - * Returns a collection of all form control elements in the form. - */ - public HTMLCollection getElements(); - - /** - * The number of form controls in the form. - */ - public int getLength(); - - /** - * Names the form. - */ - public String getName(); - /** - * Names the form. - */ - public void setName(String name); - - /** - * List of character sets supported by the server. See the accept-charset - * attribute definition in HTML 4.01. - */ - public String getAcceptCharset(); - /** - * List of character sets supported by the server. See the accept-charset - * attribute definition in HTML 4.01. - */ - public void setAcceptCharset(String acceptCharset); - - /** - * Server-side form handler. See the action attribute definition in HTML - * 4.01. - */ - public String getAction(); - /** - * Server-side form handler. See the action attribute definition in HTML - * 4.01. - */ - public void setAction(String action); - - /** - * The content type of the submitted form, generally - * "application/x-www-form-urlencoded". See the enctype attribute - * definition in HTML 4.01. The onsubmit even handler is not guaranteed - * to be triggered when invoking this method. The behavior is - * inconsistent for historical reasons and authors should not rely on a - * particular one. - */ - public String getEnctype(); - /** - * The content type of the submitted form, generally - * "application/x-www-form-urlencoded". See the enctype attribute - * definition in HTML 4.01. The onsubmit even handler is not guaranteed - * to be triggered when invoking this method. The behavior is - * inconsistent for historical reasons and authors should not rely on a - * particular one. - */ - public void setEnctype(String enctype); - - /** - * HTTP method [IETF RFC 2616] used to submit form. See the method attribute definition - * in HTML 4.01. - */ - public String getMethod(); - /** - * HTTP method [IETF RFC 2616] used to submit form. See the method attribute definition - * in HTML 4.01. - */ - public void setMethod(String method); - - /** - * Frame to render the resource in. See the target attribute definition in - * HTML 4.01. - */ - public String getTarget(); - /** - * Frame to render the resource in. See the target attribute definition in - * HTML 4.01. - */ - public void setTarget(String target); - - /** - * Submits the form. It performs the same action as a submit button. - */ - public void submit(); - - /** - * Restores a form element's default values. It performs the same action - * as a reset button. - */ - public void reset(); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFrameElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFrameElement.java deleted file mode 100644 index d6100815f5a..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFrameElement.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -import org.w3c.dom.Document; - -/** - * Create a frame. See the FRAME element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLFrameElement extends HTMLElement {
- /**
- * Request frame borders. See the frameborder attribute definition in HTML
- * 4.01.
- */
- public String getFrameBorder();
- /**
- * Request frame borders. See the frameborder attribute definition in HTML
- * 4.01.
- */
- public void setFrameBorder(String frameBorder);
-
- /**
- * URI [IETF RFC 2396] designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.01.
- */
- public String getLongDesc();
- /**
- * URI [IETF RFC 2396] designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.01.
- */
- public void setLongDesc(String longDesc);
-
- /**
- * Frame margin height, in pixels. See the marginheight attribute
- * definition in HTML 4.01.
- */
- public String getMarginHeight();
- /**
- * Frame margin height, in pixels. See the marginheight attribute
- * definition in HTML 4.01.
- */
- public void setMarginHeight(String marginHeight);
-
- /**
- * Frame margin width, in pixels. See the marginwidth attribute definition
- * in HTML 4.01.
- */
- public String getMarginWidth();
- /**
- * Frame margin width, in pixels. See the marginwidth attribute definition
- * in HTML 4.01.
- */
- public void setMarginWidth(String marginWidth);
-
- /**
- * The frame name (object of the target
attribute). See the
- * name attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * The frame name (object of the target
attribute). See the
- * name attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * When true, forbid user from resizing frame. See the noresize attribute
- * definition in HTML 4.01.
- */
- public boolean getNoResize();
- /**
- * When true, forbid user from resizing frame. See the noresize attribute
- * definition in HTML 4.01.
- */
- public void setNoResize(boolean noResize);
-
- /**
- * Specify whether or not the frame should have scrollbars. See the
- * scrolling attribute definition in HTML 4.01.
- */
- public String getScrolling();
- /**
- * Specify whether or not the frame should have scrollbars. See the
- * scrolling attribute definition in HTML 4.01.
- */
- public void setScrolling(String scrolling);
-
- /**
- * A URI [IETF RFC 2396] designating the initial frame contents. See the src attribute
- * definition in HTML 4.01.
- */
- public String getSrc();
- /**
- * A URI [IETF RFC 2396] designating the initial frame contents. See the src attribute
- * definition in HTML 4.01.
- */
- public void setSrc(String src);
-
- /**
- * The document this frame contains, if there is any and it is available,
- * or null
otherwise.
- * @since DOM Level 2
- */
- public Document getContentDocument();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFrameSetElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFrameSetElement.java
deleted file mode 100644
index 4e5d75bde1b..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLFrameSetElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Create a grid of frames. See the FRAMESET element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLFrameSetElement extends HTMLElement { - /** - * The number of columns of frames in the frameset. See the cols attribute - * definition in HTML 4.01. - */ - public String getCols(); - /** - * The number of columns of frames in the frameset. See the cols attribute - * definition in HTML 4.01. - */ - public void setCols(String cols); - - /** - * The number of rows of frames in the frameset. See the rows attribute - * definition in HTML 4.01. - */ - public String getRows(); - /** - * The number of rows of frames in the frameset. See the rows attribute - * definition in HTML 4.01. - */ - public void setRows(String rows); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHRElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHRElement.java deleted file mode 100644 index b09ec0f3fb1..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHRElement.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Create a horizontal rule. See the HR element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLHRElement extends HTMLElement { - /** - * Align the rule on the page. See the align attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getAlign(); - /** - * Align the rule on the page. See the align attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setAlign(String align); - - /** - * Indicates to the user agent that there should be no shading in the - * rendering of this element. See the noshade attribute definition in - * HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public boolean getNoShade(); - /** - * Indicates to the user agent that there should be no shading in the - * rendering of this element. See the noshade attribute definition in - * HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setNoShade(boolean noShade); - - /** - * The height of the rule. See the size attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public String getSize(); - /** - * The height of the rule. See the size attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public void setSize(String size); - - /** - * The width of the rule. See the width attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public String getWidth(); - /** - * The width of the rule. See the width attribute definition in HTML 4.01. - * This attribute is deprecated in HTML 4.01. - */ - public void setWidth(String width); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHeadElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHeadElement.java deleted file mode 100644 index c4550a50711..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHeadElement.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Document head information. See the HEAD element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLHeadElement extends HTMLElement {
- /**
- * URI [IETF RFC 2396] designating a metadata profile. See the profile attribute
- * definition in HTML 4.01.
- */
- public String getProfile();
- /**
- * URI [IETF RFC 2396] designating a metadata profile. See the profile attribute
- * definition in HTML 4.01.
- */
- public void setProfile(String profile);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHeadingElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHeadingElement.java
deleted file mode 100644
index 149752507e3..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHeadingElement.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * For the H1
to H6
elements. See the H1 element
- * definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLHeadingElement extends HTMLElement { - /** - * Horizontal text alignment. See the align attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getAlign(); - /** - * Horizontal text alignment. See the align attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setAlign(String align); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHtmlElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHtmlElement.java deleted file mode 100644 index 5ba30fe3177..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLHtmlElement.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Root of an HTML document. See the HTML element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLHtmlElement extends HTMLElement { - /** - * Version information about the document's DTD. See the version attribute - * definition in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public String getVersion(); - /** - * Version information about the document's DTD. See the version attribute - * definition in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setVersion(String version); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLIFrameElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLIFrameElement.java deleted file mode 100644 index 7cac12f89e5..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLIFrameElement.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -import org.w3c.dom.Document; - -/** - * Inline subwindows. See the IFRAME element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLIFrameElement extends HTMLElement {
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Request frame borders. See the frameborder attribute definition in HTML
- * 4.01.
- */
- public String getFrameBorder();
- /**
- * Request frame borders. See the frameborder attribute definition in HTML
- * 4.01.
- */
- public void setFrameBorder(String frameBorder);
-
- /**
- * Frame height. See the height attribute definition in HTML 4.01.
- */
- public String getHeight();
- /**
- * Frame height. See the height attribute definition in HTML 4.01.
- */
- public void setHeight(String height);
-
- /**
- * URI [IETF RFC 2396] designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.01.
- */
- public String getLongDesc();
- /**
- * URI [IETF RFC 2396] designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.01.
- */
- public void setLongDesc(String longDesc);
-
- /**
- * Frame margin height, in pixels. See the marginheight attribute
- * definition in HTML 4.01.
- */
- public String getMarginHeight();
- /**
- * Frame margin height, in pixels. See the marginheight attribute
- * definition in HTML 4.01.
- */
- public void setMarginHeight(String marginHeight);
-
- /**
- * Frame margin width, in pixels. See the marginwidth attribute definition
- * in HTML 4.01.
- */
- public String getMarginWidth();
- /**
- * Frame margin width, in pixels. See the marginwidth attribute definition
- * in HTML 4.01.
- */
- public void setMarginWidth(String marginWidth);
-
- /**
- * The frame name (object of the target
attribute). See the
- * name attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * The frame name (object of the target
attribute). See the
- * name attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * Specify whether or not the frame should have scrollbars. See the
- * scrolling attribute definition in HTML 4.01.
- */
- public String getScrolling();
- /**
- * Specify whether or not the frame should have scrollbars. See the
- * scrolling attribute definition in HTML 4.01.
- */
- public void setScrolling(String scrolling);
-
- /**
- * A URI [IETF RFC 2396] designating the initial frame contents. See the src attribute
- * definition in HTML 4.01.
- */
- public String getSrc();
- /**
- * A URI [IETF RFC 2396] designating the initial frame contents. See the src attribute
- * definition in HTML 4.01.
- */
- public void setSrc(String src);
-
- /**
- * Frame width. See the width attribute definition in HTML 4.01.
- */
- public String getWidth();
- /**
- * Frame width. See the width attribute definition in HTML 4.01.
- */
- public void setWidth(String width);
-
- /**
- * The document this frame contains, if there is any and it is available,
- * or null
otherwise.
- * @since DOM Level 2
- */
- public Document getContentDocument();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLImageElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLImageElement.java
deleted file mode 100644
index 8e8142184d4..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLImageElement.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Embedded image. See the IMG element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLImageElement extends HTMLElement {
- /**
- * The name of the element (for backwards compatibility).
- */
- public String getName();
- /**
- * The name of the element (for backwards compatibility).
- */
- public void setName(String name);
-
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Alternate text for user agents not rendering the normal content of this
- * element. See the alt attribute definition in HTML 4.01.
- */
- public String getAlt();
- /**
- * Alternate text for user agents not rendering the normal content of this
- * element. See the alt attribute definition in HTML 4.01.
- */
- public void setAlt(String alt);
-
- /**
- * Width of border around image. See the border attribute definition in
- * HTML 4.01. This attribute is deprecated in HTML 4.01. Note that the
- * type of this attribute was DOMString
in DOM Level 1 HTML [DOM Level 1]
- * .
- */
- public String getBorder();
- /**
- * Width of border around image. See the border attribute definition in
- * HTML 4.01. This attribute is deprecated in HTML 4.01. Note that the
- * type of this attribute was DOMString
in DOM Level 1 HTML [DOM Level 1]
- * .
- */
- public void setBorder(String border);
-
- /**
- * Height of the image in pixels. See the height attribute definition in
- * HTML 4.01. Note that the type of this attribute was
- * DOMString
in DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public int getHeight();
- /**
- * Height of the image in pixels. See the height attribute definition in
- * HTML 4.01. Note that the type of this attribute was
- * DOMString
in DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public void setHeight(int height);
-
- /**
- * Horizontal space to the left and right of this image in pixels. See the
- * hspace attribute definition in HTML 4.01. This attribute is
- * deprecated in HTML 4.01. Note that the type of this attribute was
- * DOMString
in DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public int getHspace();
- /**
- * Horizontal space to the left and right of this image in pixels. See the
- * hspace attribute definition in HTML 4.01. This attribute is
- * deprecated in HTML 4.01. Note that the type of this attribute was
- * DOMString
in DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public void setHspace(int hspace);
-
- /**
- * Use server-side image map. See the ismap attribute definition in HTML
- * 4.01.
- */
- public boolean getIsMap();
- /**
- * Use server-side image map. See the ismap attribute definition in HTML
- * 4.01.
- */
- public void setIsMap(boolean isMap);
-
- /**
- * URI [IETF RFC 2396] designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.01.
- */
- public String getLongDesc();
- /**
- * URI [IETF RFC 2396] designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.01.
- */
- public void setLongDesc(String longDesc);
-
- /**
- * URI [IETF RFC 2396] designating the source of this image. See the src attribute
- * definition in HTML 4.01.
- */
- public String getSrc();
- /**
- * URI [IETF RFC 2396] designating the source of this image. See the src attribute
- * definition in HTML 4.01.
- */
- public void setSrc(String src);
-
- /**
- * Use client-side image map. See the usemap attribute definition in HTML
- * 4.01.
- */
- public String getUseMap();
- /**
- * Use client-side image map. See the usemap attribute definition in HTML
- * 4.01.
- */
- public void setUseMap(String useMap);
-
- /**
- * Vertical space above and below this image in pixels. See the vspace
- * attribute definition in HTML 4.01. This attribute is deprecated in
- * HTML 4.01. Note that the type of this attribute was "DOMString" in
- * DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public int getVspace();
- /**
- * Vertical space above and below this image in pixels. See the vspace
- * attribute definition in HTML 4.01. This attribute is deprecated in
- * HTML 4.01. Note that the type of this attribute was "DOMString" in
- * DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public void setVspace(int vspace);
-
- /**
- * The width of the image in pixels. See the width attribute definition in
- * HTML 4.01. Note that the type of this attribute was
- * DOMString
in DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public int getWidth();
- /**
- * The width of the image in pixels. See the width attribute definition in
- * HTML 4.01. Note that the type of this attribute was
- * DOMString
in DOM Level 1 HTML [DOM Level 1].
- * @version DOM Level 2
- */
- public void setWidth(int width);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLInputElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLInputElement.java
deleted file mode 100644
index b0d0d9d091b..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLInputElement.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Form control.Depending upon the environment in which the page is being
- * viewed, the value property may be read-only for the file upload input
- * type. For the "password" input type, the actual value returned may be
- * masked to prevent unauthorized use. See the INPUT element definition in [HTML 4.01].
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLInputElement extends HTMLElement {
- /**
- * When the type
attribute of the element has the value
- * "text", "file" or "password", this represents the HTML value
- * attribute of the element. The value of this attribute does not change
- * if the contents of the corresponding form control, in an interactive
- * user agent, changes. See the value attribute definition in HTML 4.01.
- */
- public String getDefaultValue();
- /**
- * When the type
attribute of the element has the value
- * "text", "file" or "password", this represents the HTML value
- * attribute of the element. The value of this attribute does not change
- * if the contents of the corresponding form control, in an interactive
- * user agent, changes. See the value attribute definition in HTML 4.01.
- */
- public void setDefaultValue(String defaultValue);
-
- /**
- * When type
has the value "radio" or "checkbox", this
- * represents the HTML checked attribute of the element. The value of
- * this attribute does not change if the state of the corresponding form
- * control, in an interactive user agent, changes. See the checked
- * attribute definition in HTML 4.01.
- */
- public boolean getDefaultChecked();
- /**
- * When type
has the value "radio" or "checkbox", this
- * represents the HTML checked attribute of the element. The value of
- * this attribute does not change if the state of the corresponding form
- * control, in an interactive user agent, changes. See the checked
- * attribute definition in HTML 4.01.
- */
- public void setDefaultChecked(boolean defaultChecked);
-
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A comma-separated list of content types that a server processing this
- * form will handle correctly. See the accept attribute definition in
- * HTML 4.01.
- */
- public String getAccept();
- /**
- * A comma-separated list of content types that a server processing this
- * form will handle correctly. See the accept attribute definition in
- * HTML 4.01.
- */
- public void setAccept(String accept);
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public String getAccessKey();
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public void setAccessKey(String accessKey);
-
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Alternate text for user agents not rendering the normal content of this
- * element. See the alt attribute definition in HTML 4.01.
- */
- public String getAlt();
- /**
- * Alternate text for user agents not rendering the normal content of this
- * element. See the alt attribute definition in HTML 4.01.
- */
- public void setAlt(String alt);
-
- /**
- * When the type
attribute of the element has the value
- * "radio" or "checkbox", this represents the current state of the form
- * control, in an interactive user agent. Changes to this attribute
- * change the state of the form control, but do not change the value of
- * the HTML checked attribute of the INPUT element.During the handling
- * of a click event on an input element with a type attribute that has
- * the value "radio" or "checkbox", some implementations may change the
- * value of this property before the event is being dispatched in the
- * document. If the default action of the event is canceled, the value
- * of the property may be changed back to its original value. This means
- * that the value of this property during the handling of click events
- * is implementation dependent.
- */
- public boolean getChecked();
- /**
- * When the type
attribute of the element has the value
- * "radio" or "checkbox", this represents the current state of the form
- * control, in an interactive user agent. Changes to this attribute
- * change the state of the form control, but do not change the value of
- * the HTML checked attribute of the INPUT element.During the handling
- * of a click event on an input element with a type attribute that has
- * the value "radio" or "checkbox", some implementations may change the
- * value of this property before the event is being dispatched in the
- * document. If the default action of the event is canceled, the value
- * of the property may be changed back to its original value. This means
- * that the value of this property during the handling of click events
- * is implementation dependent.
- */
- public void setChecked(boolean checked);
-
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public boolean getDisabled();
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public void setDisabled(boolean disabled);
-
- /**
- * Maximum number of characters for text fields, when type
- * has the value "text" or "password". See the maxlength attribute
- * definition in HTML 4.01.
- */
- public int getMaxLength();
- /**
- * Maximum number of characters for text fields, when type
- * has the value "text" or "password". See the maxlength attribute
- * definition in HTML 4.01.
- */
- public void setMaxLength(int maxLength);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * This control is read-only. Relevant only when type
has the
- * value "text" or "password". See the readonly attribute definition in
- * HTML 4.01.
- */
- public boolean getReadOnly();
- /**
- * This control is read-only. Relevant only when type
has the
- * value "text" or "password". See the readonly attribute definition in
- * HTML 4.01.
- */
- public void setReadOnly(boolean readOnly);
-
- /**
- * Size information. The precise meaning is specific to each type of
- * field. See the size attribute definition in HTML 4.01.
- * @version DOM Level 2
- */
- public int getSize();
- /**
- * Size information. The precise meaning is specific to each type of
- * field. See the size attribute definition in HTML 4.01.
- * @version DOM Level 2
- */
- public void setSize(int size);
-
- /**
- * When the type
attribute has the value "image", this
- * attribute specifies the location of the image to be used to decorate
- * the graphical submit button. See the src attribute definition in HTML
- * 4.01.
- */
- public String getSrc();
- /**
- * When the type
attribute has the value "image", this
- * attribute specifies the location of the image to be used to decorate
- * the graphical submit button. See the src attribute definition in HTML
- * 4.01.
- */
- public void setSrc(String src);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public int getTabIndex();
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public void setTabIndex(int tabIndex);
-
- /**
- * The type of control created (all lower case). See the type attribute
- * definition in HTML 4.01.
- * @version DOM Level 2
- */
- public String getType();
- /**
- * The type of control created (all lower case). See the type attribute
- * definition in HTML 4.01.
- * @version DOM Level 2
- */
- public void setType(String type);
-
- /**
- * Use client-side image map. See the usemap attribute definition in HTML
- * 4.01.
- */
- public String getUseMap();
- /**
- * Use client-side image map. See the usemap attribute definition in HTML
- * 4.01.
- */
- public void setUseMap(String useMap);
-
- /**
- * When the type
attribute of the element has the value
- * "text", "file" or "password", this represents the current contents of
- * the corresponding form control, in an interactive user agent.
- * Changing this attribute changes the contents of the form control, but
- * does not change the value of the HTML value attribute of the element.
- * When the type
attribute of the element has the value
- * "button", "hidden", "submit", "reset", "image", "checkbox" or
- * "radio", this represents the HTML value attribute of the element. See
- * the value attribute definition in HTML 4.01.
- */
- public String getValue();
- /**
- * When the type
attribute of the element has the value
- * "text", "file" or "password", this represents the current contents of
- * the corresponding form control, in an interactive user agent.
- * Changing this attribute changes the contents of the form control, but
- * does not change the value of the HTML value attribute of the element.
- * When the type
attribute of the element has the value
- * "button", "hidden", "submit", "reset", "image", "checkbox" or
- * "radio", this represents the HTML value attribute of the element. See
- * the value attribute definition in HTML 4.01.
- */
- public void setValue(String value);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
- /**
- * Select the contents of the text area. For INPUT
elements
- * whose type
attribute has one of the following values:
- * "text", "file", or "password".
- */
- public void select();
-
- /**
- * Simulate a mouse-click. For INPUT
elements whose
- * type
attribute has one of the following values:
- * "button", "checkbox", "radio", "reset", or "submit".
- */
- public void click();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLIsIndexElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLIsIndexElement.java
deleted file mode 100644
index 898b9e46a01..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLIsIndexElement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * This element is used for single-line text input. See the ISINDEX element
- * definition in HTML 4.01. This element is deprecated in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLIsIndexElement extends HTMLElement {
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * The prompt message. See the prompt attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public String getPrompt();
- /**
- * The prompt message. See the prompt attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setPrompt(String prompt);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLIElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLIElement.java
deleted file mode 100644
index df20c000ac2..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLIElement.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * List item. See the LI element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLLIElement extends HTMLElement {
- /**
- * List item bullet style. See the type attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public String getType();
- /**
- * List item bullet style. See the type attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setType(String type);
-
- /**
- * Reset sequence number when used in OL
. See the value
- * attribute definition in HTML 4.01. This attribute is deprecated in
- * HTML 4.01.
- */
- public int getValue();
- /**
- * Reset sequence number when used in OL
. See the value
- * attribute definition in HTML 4.01. This attribute is deprecated in
- * HTML 4.01.
- */
- public void setValue(int value);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLabelElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLabelElement.java
deleted file mode 100644
index 69a104053c2..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLabelElement.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Form field label text. See the LABEL element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLLabelElement extends HTMLElement {
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public String getAccessKey();
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public void setAccessKey(String accessKey);
-
- /**
- * This attribute links this label with another form control by
- * id
attribute. See the for attribute definition in HTML
- * 4.01.
- */
- public String getHtmlFor();
- /**
- * This attribute links this label with another form control by
- * id
attribute. See the for attribute definition in HTML
- * 4.01.
- */
- public void setHtmlFor(String htmlFor);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLegendElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLegendElement.java
deleted file mode 100644
index b976d099a6a..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLegendElement.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Provides a caption for a FIELDSET
grouping. See the LEGEND
- * element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLLegendElement extends HTMLElement {
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public String getAccessKey();
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public void setAccessKey(String accessKey);
-
- /**
- * Text alignment relative to FIELDSET
. See the align
- * attribute definition in HTML 4.01. This attribute is deprecated in
- * HTML 4.01.
- */
- public String getAlign();
- /**
- * Text alignment relative to FIELDSET
. See the align
- * attribute definition in HTML 4.01. This attribute is deprecated in
- * HTML 4.01.
- */
- public void setAlign(String align);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLinkElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLinkElement.java
deleted file mode 100644
index 4ed72ca9483..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLLinkElement.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * The LINK
element specifies a link to an external resource, and
- * defines this document's relationship to that resource (or vice versa).
- * See the LINK element definition in HTML 4.01 (see also the
- * LinkStyle
interface in the StyleSheet module [DOM Level 2 Style Sheets and CSS]).
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLLinkElement extends HTMLElement { - /** - * Enables/disables the link. This is currently only used for style sheet - * links, and may be used to activate or deactivate style sheets. - */ - public boolean getDisabled(); - /** - * Enables/disables the link. This is currently only used for style sheet - * links, and may be used to activate or deactivate style sheets. - */ - public void setDisabled(boolean disabled); - - /** - * The character encoding of the resource being linked to. See the charset - * attribute definition in HTML 4.01. - */ - public String getCharset(); - /** - * The character encoding of the resource being linked to. See the charset - * attribute definition in HTML 4.01. - */ - public void setCharset(String charset); - - /** - * The URI [IETF RFC 2396] of the linked resource. See the href attribute definition in - * HTML 4.01. - */ - public String getHref(); - /** - * The URI [IETF RFC 2396] of the linked resource. See the href attribute definition in - * HTML 4.01. - */ - public void setHref(String href); - - /** - * Language code of the linked resource. See the hreflang attribute - * definition in HTML 4.01. - */ - public String getHreflang(); - /** - * Language code of the linked resource. See the hreflang attribute - * definition in HTML 4.01. - */ - public void setHreflang(String hreflang); - - /** - * Designed for use with one or more target media. See the media attribute - * definition in HTML 4.01. - */ - public String getMedia(); - /** - * Designed for use with one or more target media. See the media attribute - * definition in HTML 4.01. - */ - public void setMedia(String media); - - /** - * Forward link type. See the rel attribute definition in HTML 4.01. - */ - public String getRel(); - /** - * Forward link type. See the rel attribute definition in HTML 4.01. - */ - public void setRel(String rel); - - /** - * Reverse link type. See the rev attribute definition in HTML 4.01. - */ - public String getRev(); - /** - * Reverse link type. See the rev attribute definition in HTML 4.01. - */ - public void setRev(String rev); - - /** - * Frame to render the resource in. See the target attribute definition in - * HTML 4.01. - */ - public String getTarget(); - /** - * Frame to render the resource in. See the target attribute definition in - * HTML 4.01. - */ - public void setTarget(String target); - - /** - * Advisory content type. See the type attribute definition in HTML 4.01. - */ - public String getType(); - /** - * Advisory content type. See the type attribute definition in HTML 4.01. - */ - public void setType(String type); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMapElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMapElement.java deleted file mode 100644 index e413727ab4d..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMapElement.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Client-side image map. See the MAP element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLMapElement extends HTMLElement {
- /**
- * The list of areas defined for the image map.
- */
- public HTMLCollection getAreas();
-
- /**
- * Names the map (for use with usemap
). See the name
- * attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * Names the map (for use with usemap
). See the name
- * attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMenuElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMenuElement.java
deleted file mode 100644
index 7c8ec62d0eb..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMenuElement.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Menu list. See the MENU element definition in HTML 4.01. This element is
- * deprecated in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLMenuElement extends HTMLElement { - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public boolean getCompact(); - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setCompact(boolean compact); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMetaElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMetaElement.java deleted file mode 100644 index b6bf05d40c7..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLMetaElement.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * This contains generic meta-information about the document. See the META - * element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLMetaElement extends HTMLElement { - /** - * Associated information. See the content attribute definition in HTML - * 4.01. - */ - public String getContent(); - /** - * Associated information. See the content attribute definition in HTML - * 4.01. - */ - public void setContent(String content); - - /** - * HTTP response header name [IETF RFC 2616]. See the http-equiv attribute definition in - * HTML 4.01. - */ - public String getHttpEquiv(); - /** - * HTTP response header name [IETF RFC 2616]. See the http-equiv attribute definition in - * HTML 4.01. - */ - public void setHttpEquiv(String httpEquiv); - - /** - * Meta information name. See the name attribute definition in HTML 4.01. - */ - public String getName(); - /** - * Meta information name. See the name attribute definition in HTML 4.01. - */ - public void setName(String name); - - /** - * Select form of content. See the scheme attribute definition in HTML - * 4.01. - */ - public String getScheme(); - /** - * Select form of content. See the scheme attribute definition in HTML - * 4.01. - */ - public void setScheme(String scheme); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLModElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLModElement.java deleted file mode 100644 index 006ba69c4bd..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLModElement.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Notice of modification to part of a document. See the INS and DEL element - * definitions in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLModElement extends HTMLElement { - /** - * A URI [IETF RFC 2396] designating a document that describes the reason for the change. - * See the cite attribute definition in HTML 4.01. - */ - public String getCite(); - /** - * A URI [IETF RFC 2396] designating a document that describes the reason for the change. - * See the cite attribute definition in HTML 4.01. - */ - public void setCite(String cite); - - /** - * The date and time of the change. See the datetime attribute definition - * in HTML 4.01. - */ - public String getDateTime(); - /** - * The date and time of the change. See the datetime attribute definition - * in HTML 4.01. - */ - public void setDateTime(String dateTime); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOListElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOListElement.java deleted file mode 100644 index 13041c8a106..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOListElement.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Ordered list. See the OL element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLOListElement extends HTMLElement { - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public boolean getCompact(); - /** - * Reduce spacing between list items. See the compact attribute definition - * in HTML 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setCompact(boolean compact); - - /** - * Starting sequence number. See the start attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public int getStart(); - /** - * Starting sequence number. See the start attribute definition in HTML - * 4.01. This attribute is deprecated in HTML 4.01. - */ - public void setStart(int start); - - /** - * Numbering style. See the type attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public String getType(); - /** - * Numbering style. See the type attribute definition in HTML 4.01. This - * attribute is deprecated in HTML 4.01. - */ - public void setType(String type); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLObjectElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLObjectElement.java deleted file mode 100644 index 11795468d77..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLObjectElement.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -import org.w3c.dom.Document; - -/** - * Generic embedded object.In principle, all properties on the object element - * are read-write but in some environments some properties may be read-only - * once the underlying object is instantiated. See the OBJECT element - * definition in [HTML 4.01]. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLObjectElement extends HTMLElement {
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * Applet class file. See the code
attribute for
- * HTMLAppletElement.
- */
- public String getCode();
- /**
- * Applet class file. See the code
attribute for
- * HTMLAppletElement.
- */
- public void setCode(String code);
-
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Space-separated list of archives. See the archive attribute definition
- * in HTML 4.01.
- */
- public String getArchive();
- /**
- * Space-separated list of archives. See the archive attribute definition
- * in HTML 4.01.
- */
- public void setArchive(String archive);
-
- /**
- * Width of border around the object. See the border attribute definition
- * in HTML 4.01. This attribute is deprecated in HTML 4.01.
- */
- public String getBorder();
- /**
- * Width of border around the object. See the border attribute definition
- * in HTML 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setBorder(String border);
-
- /**
- * Base URI [IETF RFC 2396] for classid
, data
, and
- * archive
attributes. See the codebase attribute definition
- * in HTML 4.01.
- */
- public String getCodeBase();
- /**
- * Base URI [IETF RFC 2396] for classid
, data
, and
- * archive
attributes. See the codebase attribute definition
- * in HTML 4.01.
- */
- public void setCodeBase(String codeBase);
-
- /**
- * Content type for data downloaded via classid
attribute.
- * See the codetype attribute definition in HTML 4.01.
- */
- public String getCodeType();
- /**
- * Content type for data downloaded via classid
attribute.
- * See the codetype attribute definition in HTML 4.01.
- */
- public void setCodeType(String codeType);
-
- /**
- * A URI [IETF RFC 2396] specifying the location of the object's data. See the data
- * attribute definition in HTML 4.01.
- */
- public String getData();
- /**
- * A URI [IETF RFC 2396] specifying the location of the object's data. See the data
- * attribute definition in HTML 4.01.
- */
- public void setData(String data);
-
- /**
- * Declare (for future reference), but do not instantiate, this object.
- * See the declare attribute definition in HTML 4.01.
- */
- public boolean getDeclare();
- /**
- * Declare (for future reference), but do not instantiate, this object.
- * See the declare attribute definition in HTML 4.01.
- */
- public void setDeclare(boolean declare);
-
- /**
- * Override height. See the height attribute definition in HTML 4.01.
- */
- public String getHeight();
- /**
- * Override height. See the height attribute definition in HTML 4.01.
- */
- public void setHeight(String height);
-
- /**
- * Horizontal space, in pixels, to the left and right of this image,
- * applet, or object. See the hspace attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public int getHspace();
- /**
- * Horizontal space, in pixels, to the left and right of this image,
- * applet, or object. See the hspace attribute definition in HTML 4.01.
- * This attribute is deprecated in HTML 4.01.
- */
- public void setHspace(int hspace);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * Message to render while loading the object. See the standby attribute
- * definition in HTML 4.01.
- */
- public String getStandby();
- /**
- * Message to render while loading the object. See the standby attribute
- * definition in HTML 4.01.
- */
- public void setStandby(String standby);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public int getTabIndex();
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public void setTabIndex(int tabIndex);
-
- /**
- * Content type for data downloaded via data
attribute. See
- * the type attribute definition in HTML 4.01.
- */
- public String getType();
- /**
- * Content type for data downloaded via data
attribute. See
- * the type attribute definition in HTML 4.01.
- */
- public void setType(String type);
-
- /**
- * Use client-side image map. See the usemap attribute definition in HTML
- * 4.01.
- */
- public String getUseMap();
- /**
- * Use client-side image map. See the usemap attribute definition in HTML
- * 4.01.
- */
- public void setUseMap(String useMap);
-
- /**
- * Vertical space, in pixels, above and below this image, applet, or
- * object. See the vspace attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public int getVspace();
- /**
- * Vertical space, in pixels, above and below this image, applet, or
- * object. See the vspace attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public void setVspace(int vspace);
-
- /**
- * Override width. See the width attribute definition in HTML 4.01.
- */
- public String getWidth();
- /**
- * Override width. See the width attribute definition in HTML 4.01.
- */
- public void setWidth(String width);
-
- /**
- * The document this object contains, if there is any and it is available,
- * or null
otherwise.
- * @since DOM Level 2
- */
- public Document getContentDocument();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptGroupElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptGroupElement.java
deleted file mode 100644
index 8bd606a7126..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptGroupElement.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Group options together in logical subdivisions. See the OPTGROUP element
- * definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLOptGroupElement extends HTMLElement { - /** - * The control is unavailable in this context. See the disabled attribute - * definition in HTML 4.01. - */ - public boolean getDisabled(); - /** - * The control is unavailable in this context. See the disabled attribute - * definition in HTML 4.01. - */ - public void setDisabled(boolean disabled); - - /** - * Assigns a label to this option group. See the label attribute definition - * in HTML 4.01. - */ - public String getLabel(); - /** - * Assigns a label to this option group. See the label attribute definition - * in HTML 4.01. - */ - public void setLabel(String label); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptionElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptionElement.java deleted file mode 100644 index f3b38a6019c..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptionElement.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * A selectable choice. See the OPTION element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLOptionElement extends HTMLElement {
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * Represents the value of the HTML selected attribute. The value of this
- * attribute does not change if the state of the corresponding form
- * control, in an interactive user agent, changes. See the selected
- * attribute definition in HTML 4.01.
- * @version DOM Level 2
- */
- public boolean getDefaultSelected();
- /**
- * Represents the value of the HTML selected attribute. The value of this
- * attribute does not change if the state of the corresponding form
- * control, in an interactive user agent, changes. See the selected
- * attribute definition in HTML 4.01.
- * @version DOM Level 2
- */
- public void setDefaultSelected(boolean defaultSelected);
-
- /**
- * The text contained within the option element.
- */
- public String getText();
-
- /**
- * The index of this OPTION
in its parent SELECT
- * , starting from 0.
- * @version DOM Level 2
- */
- public int getIndex();
-
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public boolean getDisabled();
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public void setDisabled(boolean disabled);
-
- /**
- * Option label for use in hierarchical menus. See the label attribute
- * definition in HTML 4.01.
- */
- public String getLabel();
- /**
- * Option label for use in hierarchical menus. See the label attribute
- * definition in HTML 4.01.
- */
- public void setLabel(String label);
-
- /**
- * Represents the current state of the corresponding form control, in an
- * interactive user agent. Changing this attribute changes the state of
- * the form control, but does not change the value of the HTML selected
- * attribute of the element.
- */
- public boolean getSelected();
- /**
- * Represents the current state of the corresponding form control, in an
- * interactive user agent. Changing this attribute changes the state of
- * the form control, but does not change the value of the HTML selected
- * attribute of the element.
- */
- public void setSelected(boolean selected);
-
- /**
- * The current form control value. See the value attribute definition in
- * HTML 4.01.
- */
- public String getValue();
- /**
- * The current form control value. See the value attribute definition in
- * HTML 4.01.
- */
- public void setValue(String value);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptionsCollection.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptionsCollection.java
deleted file mode 100644
index d70d92d73e2..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLOptionsCollection.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * An HTMLOptionsCollection
is a list of nodes representing HTML
- * option element. An individual node may be accessed by either ordinal
- * index or the node's name
or id
attributes.
- * Collections in the HTML DOM are assumed to be live meaning that they are
- * automatically updated when the underlying document is changed.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- * @since DOM Level 2
- */
-public interface HTMLOptionsCollection {
- /**
- * This attribute specifies the length or size of the list.
- */
- public int getLength();
- /**
- * This attribute specifies the length or size of the list.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: if setting the length is not allowed by the
- * implementation.
- */
- public void setLength(int length)
- throws DOMException;
-
- /**
- * This method retrieves a node specified by ordinal index. Nodes are
- * numbered in tree order (depth-first traversal order).
- * @param index The index of the node to be fetched. The index origin is
- * 0.
- * @return The Node
at the corresponding position upon
- * success. A value of null
is returned if the index is
- * out of range.
- */
- public Node item(int index);
-
- /**
- * This method retrieves a Node
using a name. It first
- * searches for a Node
with a matching id
- * attribute. If it doesn't find one, it then searches for a
- * Node
with a matching name
attribute, but
- * only on those elements that are allowed a name attribute. This method
- * is case insensitive in HTML documents and case sensitive in XHTML
- * documents.
- * @param name The name of the Node
to be fetched.
- * @return The Node
with a name
or
- * id
attribute whose value corresponds to the specified
- * string. Upon failure (e.g., no node with this name exists), returns
- * null
.
- */
- public Node namedItem(String name);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLParagraphElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLParagraphElement.java
deleted file mode 100644
index 1cb8e04203b..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLParagraphElement.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Paragraphs. See the P element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLParagraphElement extends HTMLElement {
- /**
- * Horizontal text alignment. See the align attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Horizontal text alignment. See the align attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLParamElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLParamElement.java
deleted file mode 100644
index ecf91c287d3..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLParamElement.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Parameters fed to the OBJECT
element. See the PARAM element
- * definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLParamElement extends HTMLElement {
- /**
- * The name of a run-time parameter. See the name attribute definition in
- * HTML 4.01.
- */
- public String getName();
- /**
- * The name of a run-time parameter. See the name attribute definition in
- * HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * Content type for the value
attribute when
- * valuetype
has the value "ref". See the type attribute
- * definition in HTML 4.01.
- */
- public String getType();
- /**
- * Content type for the value
attribute when
- * valuetype
has the value "ref". See the type attribute
- * definition in HTML 4.01.
- */
- public void setType(String type);
-
- /**
- * The value of a run-time parameter. See the value attribute definition
- * in HTML 4.01.
- */
- public String getValue();
- /**
- * The value of a run-time parameter. See the value attribute definition
- * in HTML 4.01.
- */
- public void setValue(String value);
-
- /**
- * Information about the meaning of the value
attribute
- * value. See the valuetype attribute definition in HTML 4.01.
- */
- public String getValueType();
- /**
- * Information about the meaning of the value
attribute
- * value. See the valuetype attribute definition in HTML 4.01.
- */
- public void setValueType(String valueType);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLPreElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLPreElement.java
deleted file mode 100644
index bab7358a730..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLPreElement.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Preformatted text. See the PRE element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLPreElement extends HTMLElement {
- /**
- * Fixed width for content. See the width attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public int getWidth();
- /**
- * Fixed width for content. See the width attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setWidth(int width);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLQuoteElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLQuoteElement.java
deleted file mode 100644
index c7cc666f417..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLQuoteElement.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * For the Q
and BLOCKQUOTE
elements. See the Q
- * element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLQuoteElement extends HTMLElement { - /** - * A URI [IETF RFC 2396] designating a source document or message. See the cite attribute - * definition in HTML 4.01. - */ - public String getCite(); - /** - * A URI [IETF RFC 2396] designating a source document or message. See the cite attribute - * definition in HTML 4.01. - */ - public void setCite(String cite); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLScriptElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLScriptElement.java deleted file mode 100644 index a35f7ddc1cb..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLScriptElement.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Script statements. See the SCRIPT element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLScriptElement extends HTMLElement { - /** - * The script content of the element. - */ - public String getText(); - /** - * The script content of the element. - */ - public void setText(String text); - - /** - * Reserved for future use. - */ - public String getHtmlFor(); - /** - * Reserved for future use. - */ - public void setHtmlFor(String htmlFor); - - /** - * Reserved for future use. - */ - public String getEvent(); - /** - * Reserved for future use. - */ - public void setEvent(String event); - - /** - * The character encoding of the linked resource. See the charset - * attribute definition in HTML 4.01. - */ - public String getCharset(); - /** - * The character encoding of the linked resource. See the charset - * attribute definition in HTML 4.01. - */ - public void setCharset(String charset); - - /** - * Indicates that the user agent can defer processing of the script. See - * the defer attribute definition in HTML 4.01. - */ - public boolean getDefer(); - /** - * Indicates that the user agent can defer processing of the script. See - * the defer attribute definition in HTML 4.01. - */ - public void setDefer(boolean defer); - - /** - * URI [IETF RFC 2396] designating an external script. See the src attribute definition - * in HTML 4.01. - */ - public String getSrc(); - /** - * URI [IETF RFC 2396] designating an external script. See the src attribute definition - * in HTML 4.01. - */ - public void setSrc(String src); - - /** - * The content type of the script language. See the type attribute - * definition in HTML 4.01. - */ - public String getType(); - /** - * The content type of the script language. See the type attribute - * definition in HTML 4.01. - */ - public void setType(String type); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLSelectElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLSelectElement.java deleted file mode 100644 index c5d83b05182..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLSelectElement.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -import org.w3c.dom.DOMException; - -/** - * The select element allows the selection of an option. The contained options - * can be directly accessed through the select element as a collection. See - * the SELECT element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLSelectElement extends HTMLElement {
- /**
- * The type of this form control. This is the string "select-multiple"
- * when the multiple attribute is true
and the string
- * "select-one" when false
.
- */
- public String getType();
-
- /**
- * The ordinal index of the selected option, starting from 0. The value -1
- * is returned if no element is selected. If multiple options are
- * selected, the index of the first selected option is returned.
- */
- public int getSelectedIndex();
- /**
- * The ordinal index of the selected option, starting from 0. The value -1
- * is returned if no element is selected. If multiple options are
- * selected, the index of the first selected option is returned.
- */
- public void setSelectedIndex(int selectedIndex);
-
- /**
- * The current form control value (i.e. the value of the currently
- * selected option), if multiple options are selected this is the value
- * of the first selected option.
- */
- public String getValue();
- /**
- * The current form control value (i.e. the value of the currently
- * selected option), if multiple options are selected this is the value
- * of the first selected option.
- */
- public void setValue(String value);
-
- /**
- * The number of options in this SELECT
.
- * @version DOM Level 2
- */
- public int getLength();
- /**
- * The number of options in this SELECT
.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: if setting the length is not allowed by the
- * implementation.
- * @version DOM Level 2
- */
- public void setLength(int length)
- throws DOMException;
-
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * The collection of OPTION
elements contained by this
- * element.
- * @version DOM Level 2
- */
- public HTMLOptionsCollection getOptions();
-
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public boolean getDisabled();
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public void setDisabled(boolean disabled);
-
- /**
- * If true, multiple OPTION
elements may be selected in this
- * SELECT
. See the multiple attribute definition in HTML
- * 4.01.
- */
- public boolean getMultiple();
- /**
- * If true, multiple OPTION
elements may be selected in this
- * SELECT
. See the multiple attribute definition in HTML
- * 4.01.
- */
- public void setMultiple(boolean multiple);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * Number of visible rows. See the size attribute definition in HTML 4.01.
- */
- public int getSize();
- /**
- * Number of visible rows. See the size attribute definition in HTML 4.01.
- */
- public void setSize(int size);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public int getTabIndex();
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public void setTabIndex(int tabIndex);
-
- /**
- * Add a new element to the collection of OPTION
elements for
- * this SELECT
. This method is the equivalent of the
- * appendChild
method of the Node
interface if
- * the before
parameter is null
. It is
- * equivalent to the insertBefore
method on the parent of
- * before
in all other cases. This method may have no
- * effect if the new element is not an OPTION
or an
- * OPTGROUP
.
- * @param element The element to add.
- * @param before The element to insert before, or null
for
- * the tail of the list.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised if before
is not a descendant of
- * the SELECT
element.
- */
- public void add(HTMLElement element,
- HTMLElement before)
- throws DOMException;
-
- /**
- * Remove an element from the collection of OPTION
elements
- * for this SELECT
. Does nothing if no element has the
- * given index.
- * @param index The index of the item to remove, starting from 0.
- */
- public void remove(int index);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLStyleElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLStyleElement.java
deleted file mode 100644
index 148bcda1cf2..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLStyleElement.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Style information. See the STYLE element definition in HTML 4.01, the CSS
- * module [DOM Level 2 Style Sheets and CSS] and the LinkStyle
interface in the StyleSheets
- * module [DOM Level 2 Style Sheets and CSS].
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLStyleElement extends HTMLElement { - /** - * Enables/disables the style sheet. - */ - public boolean getDisabled(); - /** - * Enables/disables the style sheet. - */ - public void setDisabled(boolean disabled); - - /** - * Designed for use with one or more target media. See the media attribute - * definition in HTML 4.01. - */ - public String getMedia(); - /** - * Designed for use with one or more target media. See the media attribute - * definition in HTML 4.01. - */ - public void setMedia(String media); - - /** - * The content type of the style sheet language. See the type attribute - * definition in HTML 4.01. - */ - public String getType(); - /** - * The content type of the style sheet language. See the type attribute - * definition in HTML 4.01. - */ - public void setType(String type); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableCaptionElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableCaptionElement.java deleted file mode 100644 index 6c0d872e541..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableCaptionElement.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Table caption See the CAPTION element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLTableCaptionElement extends HTMLElement {
- /**
- * Caption alignment with respect to the table. See the align attribute
- * definition in HTML 4.01. This attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Caption alignment with respect to the table. See the align attribute
- * definition in HTML 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableCellElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableCellElement.java
deleted file mode 100644
index 1e8dc3d4738..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableCellElement.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * The object used to represent the TH
and TD
- * elements. See the TD element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLTableCellElement extends HTMLElement {
- /**
- * The index of this cell in the row, starting from 0. This index is in
- * document tree order and not display order.
- */
- public int getCellIndex();
-
- /**
- * Abbreviation for header cells. See the abbr attribute definition in
- * HTML 4.01.
- */
- public String getAbbr();
- /**
- * Abbreviation for header cells. See the abbr attribute definition in
- * HTML 4.01.
- */
- public void setAbbr(String abbr);
-
- /**
- * Horizontal alignment of data in cell. See the align attribute definition
- * in HTML 4.01.
- */
- public String getAlign();
- /**
- * Horizontal alignment of data in cell. See the align attribute definition
- * in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Names group of related headers. See the axis attribute definition in
- * HTML 4.01.
- */
- public String getAxis();
- /**
- * Names group of related headers. See the axis attribute definition in
- * HTML 4.01.
- */
- public void setAxis(String axis);
-
- /**
- * Cell background color. See the bgcolor attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public String getBgColor();
- /**
- * Cell background color. See the bgcolor attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setBgColor(String bgColor);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public String getCh();
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public String getChOff();
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public void setChOff(String chOff);
-
- /**
- * Number of columns spanned by cell. See the colspan attribute definition
- * in HTML 4.01.
- */
- public int getColSpan();
- /**
- * Number of columns spanned by cell. See the colspan attribute definition
- * in HTML 4.01.
- */
- public void setColSpan(int colSpan);
-
- /**
- * List of id
attribute values for header cells. See the
- * headers attribute definition in HTML 4.01.
- */
- public String getHeaders();
- /**
- * List of id
attribute values for header cells. See the
- * headers attribute definition in HTML 4.01.
- */
- public void setHeaders(String headers);
-
- /**
- * Cell height. See the height attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public String getHeight();
- /**
- * Cell height. See the height attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public void setHeight(String height);
-
- /**
- * Suppress word wrapping. See the nowrap attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public boolean getNoWrap();
- /**
- * Suppress word wrapping. See the nowrap attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setNoWrap(boolean noWrap);
-
- /**
- * Number of rows spanned by cell. See the rowspan attribute definition in
- * HTML 4.01.
- */
- public int getRowSpan();
- /**
- * Number of rows spanned by cell. See the rowspan attribute definition in
- * HTML 4.01.
- */
- public void setRowSpan(int rowSpan);
-
- /**
- * Scope covered by header cells. See the scope attribute definition in
- * HTML 4.01.
- */
- public String getScope();
- /**
- * Scope covered by header cells. See the scope attribute definition in
- * HTML 4.01.
- */
- public void setScope(String scope);
-
- /**
- * Vertical alignment of data in cell. See the valign attribute definition
- * in HTML 4.01.
- */
- public String getVAlign();
- /**
- * Vertical alignment of data in cell. See the valign attribute definition
- * in HTML 4.01.
- */
- public void setVAlign(String vAlign);
-
- /**
- * Cell width. See the width attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public String getWidth();
- /**
- * Cell width. See the width attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public void setWidth(String width);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableColElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableColElement.java
deleted file mode 100644
index 85a42ddd2bb..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableColElement.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Regroups the COL
and COLGROUP
elements. See the
- * COL element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLTableColElement extends HTMLElement {
- /**
- * Horizontal alignment of cell data in column. See the align attribute
- * definition in HTML 4.01.
- */
- public String getAlign();
- /**
- * Horizontal alignment of cell data in column. See the align attribute
- * definition in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public String getCh();
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public String getChOff();
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public void setChOff(String chOff);
-
- /**
- * Indicates the number of columns in a group or affected by a grouping.
- * See the span attribute definition in HTML 4.01.
- */
- public int getSpan();
- /**
- * Indicates the number of columns in a group or affected by a grouping.
- * See the span attribute definition in HTML 4.01.
- */
- public void setSpan(int span);
-
- /**
- * Vertical alignment of cell data in column. See the valign attribute
- * definition in HTML 4.01.
- */
- public String getVAlign();
- /**
- * Vertical alignment of cell data in column. See the valign attribute
- * definition in HTML 4.01.
- */
- public void setVAlign(String vAlign);
-
- /**
- * Default column width. See the width attribute definition in HTML 4.01.
- */
- public String getWidth();
- /**
- * Default column width. See the width attribute definition in HTML 4.01.
- */
- public void setWidth(String width);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableElement.java
deleted file mode 100644
index d36b19cfa78..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableElement.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The create* and delete* methods on the table allow authors to construct and
- * modify tables. [HTML 4.01] specifies that only one of each of the
- * CAPTION
, THEAD
, and TFOOT
elements
- * may exist in a table. Therefore, if one exists, and the createTHead() or
- * createTFoot() method is called, the method returns the existing THead or
- * TFoot element. See the TABLE element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLTableElement extends HTMLElement {
- /**
- * Returns the table's CAPTION
, or void if none exists.
- * @version DOM Level 2
- */
- public HTMLTableCaptionElement getCaption();
- /**
- * Returns the table's CAPTION
, or void if none exists.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: if the element is not a CAPTION
.
- * @version DOM Level 2
- */
- public void setCaption(HTMLTableCaptionElement caption)
- throws DOMException;
-
- /**
- * Returns the table's THEAD
, or null
if none
- * exists.
- * @version DOM Level 2
- */
- public HTMLTableSectionElement getTHead();
- /**
- * Returns the table's THEAD
, or null
if none
- * exists.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: if the element is not a THEAD
.
- * @version DOM Level 2
- */
- public void setTHead(HTMLTableSectionElement tHead)
- throws DOMException;
-
- /**
- * Returns the table's TFOOT
, or null
if none
- * exists.
- * @version DOM Level 2
- */
- public HTMLTableSectionElement getTFoot();
- /**
- * Returns the table's TFOOT
, or null
if none
- * exists.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: if the element is not a TFOOT
.
- * @version DOM Level 2
- */
- public void setTFoot(HTMLTableSectionElement tFoot)
- throws DOMException;
-
- /**
- * Returns a collection of all the rows in the table, including all in
- * THEAD
, TFOOT
, all TBODY
- * elements.
- */
- public HTMLCollection getRows();
-
- /**
- * Returns a collection of the table bodies (including implicit ones).
- */
- public HTMLCollection getTBodies();
-
- /**
- * Specifies the table's position with respect to the rest of the
- * document. See the align attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public String getAlign();
- /**
- * Specifies the table's position with respect to the rest of the
- * document. See the align attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Cell background color. See the bgcolor attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public String getBgColor();
- /**
- * Cell background color. See the bgcolor attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setBgColor(String bgColor);
-
- /**
- * The width of the border around the table. See the border attribute
- * definition in HTML 4.01.
- */
- public String getBorder();
- /**
- * The width of the border around the table. See the border attribute
- * definition in HTML 4.01.
- */
- public void setBorder(String border);
-
- /**
- * Specifies the horizontal and vertical space between cell content and
- * cell borders. See the cellpadding attribute definition in HTML 4.01.
- */
- public String getCellPadding();
- /**
- * Specifies the horizontal and vertical space between cell content and
- * cell borders. See the cellpadding attribute definition in HTML 4.01.
- */
- public void setCellPadding(String cellPadding);
-
- /**
- * Specifies the horizontal and vertical separation between cells. See the
- * cellspacing attribute definition in HTML 4.01.
- */
- public String getCellSpacing();
- /**
- * Specifies the horizontal and vertical separation between cells. See the
- * cellspacing attribute definition in HTML 4.01.
- */
- public void setCellSpacing(String cellSpacing);
-
- /**
- * Specifies which external table borders to render. See the frame
- * attribute definition in HTML 4.01.
- */
- public String getFrame();
- /**
- * Specifies which external table borders to render. See the frame
- * attribute definition in HTML 4.01.
- */
- public void setFrame(String frame);
-
- /**
- * Specifies which internal table borders to render. See the rules
- * attribute definition in HTML 4.01.
- */
- public String getRules();
- /**
- * Specifies which internal table borders to render. See the rules
- * attribute definition in HTML 4.01.
- */
- public void setRules(String rules);
-
- /**
- * Description about the purpose or structure of a table. See the summary
- * attribute definition in HTML 4.01.
- */
- public String getSummary();
- /**
- * Description about the purpose or structure of a table. See the summary
- * attribute definition in HTML 4.01.
- */
- public void setSummary(String summary);
-
- /**
- * Specifies the desired table width. See the width attribute definition
- * in HTML 4.01.
- */
- public String getWidth();
- /**
- * Specifies the desired table width. See the width attribute definition
- * in HTML 4.01.
- */
- public void setWidth(String width);
-
- /**
- * Create a table header row or return an existing one.
- * @return A new table header element (THEAD
).
- */
- public HTMLElement createTHead();
-
- /**
- * Delete the header from the table, if one exists.
- */
- public void deleteTHead();
-
- /**
- * Create a table footer row or return an existing one.
- * @return A footer element (TFOOT
).
- */
- public HTMLElement createTFoot();
-
- /**
- * Delete the footer from the table, if one exists.
- */
- public void deleteTFoot();
-
- /**
- * Create a new table caption object or return an existing one.
- * @return A CAPTION
element.
- */
- public HTMLElement createCaption();
-
- /**
- * Delete the table caption, if one exists.
- */
- public void deleteCaption();
-
- /**
- * Insert a new empty row in the table. The new row is inserted
- * immediately before and in the same section as the current
- * index
th row in the table. If index
is -1 or
- * equal to the number of rows, the new row is appended. In addition,
- * when the table is empty the row is inserted into a TBODY
- * which is created and inserted into the table.A table row cannot be
- * empty according to [HTML 4.01].
- * @param index The row number where to insert a new row. This index
- * starts from 0 and is relative to the logical order (not document
- * order) of all the rows contained inside the table.
- * @return The newly created row.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than the
- * number of rows or if the index is a negative number other than -1.
- * @version DOM Level 2
- */
- public HTMLElement insertRow(int index)
- throws DOMException;
-
- /**
- * Delete a table row.
- * @param index The index of the row to be deleted. This index starts
- * from 0 and is relative to the logical order (not document order) of
- * all the rows contained inside the table. If the index is -1 the
- * last row in the table is deleted.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than or
- * equal to the number of rows or if the index is a negative number
- * other than -1.
- * @version DOM Level 2
- */
- public void deleteRow(int index)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableRowElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableRowElement.java
deleted file mode 100644
index 9f4fbf96c67..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableRowElement.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-import org.w3c.dom.DOMException;
-
-/**
- * A row in a table. See the TR element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLTableRowElement extends HTMLElement {
- /**
- * This is in logical order and not in document order. The
- * rowIndex
does take into account sections (
- * THEAD
, TFOOT
, or TBODY
) within
- * the table, placing THEAD
rows first in the index,
- * followed by TBODY
rows, followed by TFOOT
- * rows.
- * @version DOM Level 2
- */
- public int getRowIndex();
-
- /**
- * The index of this row, relative to the current section (
- * THEAD
, TFOOT
, or TBODY
),
- * starting from 0.
- * @version DOM Level 2
- */
- public int getSectionRowIndex();
-
- /**
- * The collection of cells in this row.
- * @version DOM Level 2
- */
- public HTMLCollection getCells();
-
- /**
- * Horizontal alignment of data within cells of this row. See the align
- * attribute definition in HTML 4.01.
- */
- public String getAlign();
- /**
- * Horizontal alignment of data within cells of this row. See the align
- * attribute definition in HTML 4.01.
- */
- public void setAlign(String align);
-
- /**
- * Background color for rows. See the bgcolor attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public String getBgColor();
- /**
- * Background color for rows. See the bgcolor attribute definition in HTML
- * 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setBgColor(String bgColor);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public String getCh();
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public String getChOff();
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public void setChOff(String chOff);
-
- /**
- * Vertical alignment of data within cells of this row. See the valign
- * attribute definition in HTML 4.01.
- */
- public String getVAlign();
- /**
- * Vertical alignment of data within cells of this row. See the valign
- * attribute definition in HTML 4.01.
- */
- public void setVAlign(String vAlign);
-
- /**
- * Insert an empty TD
cell into this row. If
- * index
is -1 or equal to the number of cells, the new
- * cell is appended.
- * @param index The place to insert the cell, starting from 0.
- * @return The newly created cell.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index
is greater
- * than the number of cells or if the index is a negative number other
- * than -1.
- * @version DOM Level 2
- */
- public HTMLElement insertCell(int index)
- throws DOMException;
-
- /**
- * Delete a cell from the current row.
- * @param index The index of the cell to delete, starting from 0. If the
- * index is -1 the last cell in the row is deleted.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index
is greater
- * than or equal to the number of cells or if the index is a negative
- * number other than -1.
- * @version DOM Level 2
- */
- public void deleteCell(int index)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableSectionElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableSectionElement.java
deleted file mode 100644
index 5aa6ce4402d..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTableSectionElement.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The THEAD
, TFOOT
, and TBODY
- * elements.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLTableSectionElement extends HTMLElement {
- /**
- * Horizontal alignment of data in cells. See the align
- * attribute for HTMLTheadElement for details.
- */
- public String getAlign();
- /**
- * Horizontal alignment of data in cells. See the align
- * attribute for HTMLTheadElement for details.
- */
- public void setAlign(String align);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public String getCh();
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.01.
- */
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public String getChOff();
- /**
- * Offset of alignment character. See the charoff attribute definition in
- * HTML 4.01.
- */
- public void setChOff(String chOff);
-
- /**
- * Vertical alignment of data in cells. See the valign
- * attribute for HTMLTheadElement for details.
- */
- public String getVAlign();
- /**
- * Vertical alignment of data in cells. See the valign
- * attribute for HTMLTheadElement for details.
- */
- public void setVAlign(String vAlign);
-
- /**
- * The collection of rows in this table section.
- */
- public HTMLCollection getRows();
-
- /**
- * Insert a row into this section. The new row is inserted immediately
- * before the current index
th row in this section. If
- * index
is -1 or equal to the number of rows in this
- * section, the new row is appended.
- * @param index The row number where to insert a new row. This index
- * starts from 0 and is relative only to the rows contained inside
- * this section, not all the rows in the table.
- * @return The newly created row.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than the
- * number of rows of if the index is a negative number other than -1.
- * @version DOM Level 2
- */
- public HTMLElement insertRow(int index)
- throws DOMException;
-
- /**
- * Delete a row from this section.
- * @param index The index of the row to be deleted, or -1 to delete the
- * last row. This index starts from 0 and is relative only to the rows
- * contained inside this section, not all the rows in the table.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than or
- * equal to the number of rows or if the index is a negative number
- * other than -1.
- * @version DOM Level 2
- */
- public void deleteRow(int index)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTextAreaElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTextAreaElement.java
deleted file mode 100644
index ed5c6c978d6..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTextAreaElement.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * Multi-line text field. See the TEXTAREA element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLTextAreaElement extends HTMLElement {
- /**
- * Represents the contents of the element. The value of this attribute
- * does not change if the contents of the corresponding form control, in
- * an interactive user agent, changes.
- * @version DOM Level 2
- */
- public String getDefaultValue();
- /**
- * Represents the contents of the element. The value of this attribute
- * does not change if the contents of the corresponding form control, in
- * an interactive user agent, changes.
- * @version DOM Level 2
- */
- public void setDefaultValue(String defaultValue);
-
- /**
- * Returns the FORM
element containing this control. Returns
- * null
if this control is not within the context of a
- * form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public String getAccessKey();
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.01.
- */
- public void setAccessKey(String accessKey);
-
- /**
- * Width of control (in characters). See the cols attribute definition in
- * HTML 4.01.
- */
- public int getCols();
- /**
- * Width of control (in characters). See the cols attribute definition in
- * HTML 4.01.
- */
- public void setCols(int cols);
-
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public boolean getDisabled();
- /**
- * The control is unavailable in this context. See the disabled attribute
- * definition in HTML 4.01.
- */
- public void setDisabled(boolean disabled);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public String getName();
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.01.
- */
- public void setName(String name);
-
- /**
- * This control is read-only. See the readonly attribute definition in
- * HTML 4.01.
- */
- public boolean getReadOnly();
- /**
- * This control is read-only. See the readonly attribute definition in
- * HTML 4.01.
- */
- public void setReadOnly(boolean readOnly);
-
- /**
- * Number of text rows. See the rows attribute definition in HTML 4.01.
- */
- public int getRows();
- /**
- * Number of text rows. See the rows attribute definition in HTML 4.01.
- */
- public void setRows(int rows);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public int getTabIndex();
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.01.
- */
- public void setTabIndex(int tabIndex);
-
- /**
- * The type of this form control. This the string "textarea".
- */
- public String getType();
-
- /**
- * Represents the current contents of the corresponding form control, in
- * an interactive user agent. Changing this attribute changes the
- * contents of the form control, but does not change the contents of the
- * element. If the entirety of the data can not fit into a single
- * DOMString
, the implementation may truncate the data.
- */
- public String getValue();
- /**
- * Represents the current contents of the corresponding form control, in
- * an interactive user agent. Changing this attribute changes the
- * contents of the form control, but does not change the contents of the
- * element. If the entirety of the data can not fit into a single
- * DOMString
, the implementation may truncate the data.
- */
- public void setValue(String value);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
- /**
- * Select the contents of the TEXTAREA
.
- */
- public void select();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTitleElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTitleElement.java
deleted file mode 100644
index 67122bb0a71..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLTitleElement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.html2;
-
-/**
- * The document title. See the TITLE element definition in HTML 4.01.
- *
See also the Document Object Model (DOM) Level 2 HTML Specification. - */ -public interface HTMLTitleElement extends HTMLElement { - /** - * The specified title as a string. - */ - public String getText(); - /** - * The specified title as a string. - */ - public void setText(String text); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLUListElement.java b/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLUListElement.java deleted file mode 100644 index 61ccb322f45..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/html2/HTMLUListElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. - * See W3C License http://www.w3.org/Consortium/Legal/ for more details. - */ - -package org.w3c.dom.html2; - -/** - * Unordered list. See the UL element definition in HTML 4.01. - *
See also the Document Object Model (DOM) Level 2 HTML Specification.
- */
-public interface HTMLUListElement extends HTMLElement {
- /**
- * Reduce spacing between list items. See the compact attribute definition
- * in HTML 4.01. This attribute is deprecated in HTML 4.01.
- */
- public boolean getCompact();
- /**
- * Reduce spacing between list items. See the compact attribute definition
- * in HTML 4.01. This attribute is deprecated in HTML 4.01.
- */
- public void setCompact(boolean compact);
-
- /**
- * Bullet style. See the type attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public String getType();
- /**
- * Bullet style. See the type attribute definition in HTML 4.01. This
- * attribute is deprecated in HTML 4.01.
- */
- public void setType(String type);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/DOMImplementationLS.java b/libjava/external/w3c_dom/org/w3c/dom/ls/DOMImplementationLS.java
deleted file mode 100644
index c94fc8e4651..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/DOMImplementationLS.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-import org.w3c.dom.DOMException;
-
-/**
- * DOMImplementationLS
contains the factory methods for creating
- * Load and Save objects.
- *
The expectation is that an instance of the
- * DOMImplementationLS
interface can be obtained by using
- * binding-specific casting methods on an instance of the
- * DOMImplementation
interface or, if the Document
- * supports the feature "Core"
version "3.0"
- * defined in [DOM Level 3 Core]
- * , by using the method DOMImplementation.getFeature
with
- * parameter values "LS"
(or "LS-Async"
) and
- * "3.0"
(respectively).
- *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface DOMImplementationLS {
- // DOMImplementationLSMode
- /**
- * Create a synchronous LSParser
.
- */
- public static final short MODE_SYNCHRONOUS = 1;
- /**
- * Create an asynchronous LSParser
.
- */
- public static final short MODE_ASYNCHRONOUS = 2;
-
- /**
- * Create a new LSParser
. The newly constructed parser may
- * then be configured by means of its DOMConfiguration
- * object, and used to parse documents by means of its parse
- * method.
- * @param mode The mode
argument is either
- * MODE_SYNCHRONOUS
or MODE_ASYNCHRONOUS
, if
- * mode
is MODE_SYNCHRONOUS
then the
- * LSParser
that is created will operate in synchronous
- * mode, if it's MODE_ASYNCHRONOUS
then the
- * LSParser
that is created will operate in asynchronous
- * mode.
- * @param schemaType An absolute URI representing the type of the schema
- * language used during the load of a Document
using the
- * newly created LSParser
. Note that no lexical checking
- * is done on the absolute URI. In order to create a
- * LSParser
for any kind of schema types (i.e. the
- * LSParser will be free to use any schema found), use the value
- * null
.
- *
Note: For W3C XML Schema [XML Schema Part 1]
- * , applications must use the value
- * "http://www.w3.org/2001/XMLSchema"
. For XML DTD [XML 1.0],
- * applications must use the value
- * "http://www.w3.org/TR/REC-xml"
. Other Schema languages
- * are outside the scope of the W3C and therefore should recommend an
- * absolute URI in order to use this method.
- * @return The newly created LSParser
object. This
- * LSParser
is either synchronous or asynchronous
- * depending on the value of the mode
argument.
- *
Note: By default, the newly created LSParser
- * does not contain a DOMErrorHandler
, i.e. the value of
- * the "
- * error-handler" configuration parameter is null
. However, implementations
- * may provide a default error handler at creation time. In that case,
- * the initial value of the "error-handler"
configuration
- * parameter on the new LSParser
object contains a
- * reference to the default error handler.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is
- * not supported.
- */
- public LSParser createLSParser(short mode,
- String schemaType)
- throws DOMException;
-
- /**
- * Create a new LSSerializer
object.
- * @return The newly created LSSerializer
object.
- *
Note: By default, the newly created
- * LSSerializer
has no DOMErrorHandler
, i.e.
- * the value of the "error-handler"
configuration
- * parameter is null
. However, implementations may
- * provide a default error handler at creation time. In that case, the
- * initial value of the "error-handler"
configuration
- * parameter on the new LSSerializer
object contains a
- * reference to the default error handler.
- */
- public LSSerializer createLSSerializer();
-
- /**
- * Create a new empty input source object where
- * LSInput.characterStream
, LSInput.byteStream
- * , LSInput.stringData
LSInput.systemId
,
- * LSInput.publicId
, LSInput.baseURI
, and
- * LSInput.encoding
are null, and
- * LSInput.certifiedText
is false.
- * @return The newly created input object.
- */
- public LSInput createLSInput();
-
- /**
- * Create a new empty output destination object where
- * LSOutput.characterStream
,
- * LSOutput.byteStream
, LSOutput.systemId
,
- * LSOutput.encoding
are null.
- * @return The newly created output object.
- */
- public LSOutput createLSOutput();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSException.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSException.java
deleted file mode 100644
index 65a83f0ded1..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-/**
- * Parser or write operations may throw an LSException
if the
- * processing is stopped. The processing can be stopped due to a
- * DOMError
with a severity of
- * DOMError.SEVERITY_FATAL_ERROR
or a non recovered
- * DOMError.SEVERITY_ERROR
, or if
- * DOMErrorHandler.handleError()
returned false
.
- *
Note: As suggested in the definition of the constants in the
- * DOMError
interface, a DOM implementation may choose to
- * continue after a fatal error, but the resulting DOM tree is then
- * implementation dependent.
- *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public class LSException extends RuntimeException {
- public LSException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // LSExceptionCode
- /**
- * If an attempt was made to load a document, or an XML Fragment, using
- * LSParser
and the processing has been stopped.
- */
- public static final short PARSE_ERR = 81;
- /**
- * If an attempt was made to serialize a Node
using
- * LSSerializer
and the processing has been stopped.
- */
- public static final short SERIALIZE_ERR = 82;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSInput.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSInput.java
deleted file mode 100644
index 862bf7703b7..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSInput.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-/**
- * This interface represents an input source for data.
- *
This interface allows an application to encapsulate information about - * an input source in a single object, which may include a public - * identifier, a system identifier, a byte stream (possibly with a specified - * encoding), a base URI, and/or a character stream. - *
The exact definitions of a byte stream and a character stream are - * binding dependent. - *
The application is expected to provide objects that implement this
- * interface whenever such objects are needed. The application can either
- * provide its own objects that implement this interface, or it can use the
- * generic factory method DOMImplementationLS.createLSInput()
- * to create objects that implement this interface.
- *
The LSParser
will use the LSInput
object to
- * determine how to read data. The LSParser
will look at the
- * different inputs specified in the LSInput
in the following
- * order to know which one to read from, the first one that is not null and
- * not an empty string will be used:
- *
LSInput.characterStream
- * LSInput.byteStream
- * LSInput.stringData
- * LSInput.systemId
- * LSInput.publicId
- * If all inputs are null, the LSParser
will report a
- * DOMError
with its DOMError.type
set to
- * "no-input-specified"
and its DOMError.severity
- * set to DOMError.SEVERITY_FATAL_ERROR
.
- *
LSInput
objects belong to the application. The DOM
- * implementation will never modify them (though it may make copies and
- * modify the copies, if necessary).
- *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSInput {
- /**
- * An attribute of a language and binding dependent type that represents
- * a stream of 16-bit units. The application must encode the stream
- * using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). It is not a requirement to have an XML declaration when
- * using character streams. If an XML declaration is present, the value
- * of the encoding attribute will be ignored.
- */
- public java.io.Reader getCharacterStream();
- /**
- * An attribute of a language and binding dependent type that represents
- * a stream of 16-bit units. The application must encode the stream
- * using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). It is not a requirement to have an XML declaration when
- * using character streams. If an XML declaration is present, the value
- * of the encoding attribute will be ignored.
- */
- public void setCharacterStream(java.io.Reader characterStream);
-
- /**
- * An attribute of a language and binding dependent type that represents
- * a stream of bytes.
- *
If the application knows the character encoding of the byte
- * stream, it should set the encoding attribute. Setting the encoding in
- * this way will override any encoding specified in an XML declaration
- * in the data.
- */
- public java.io.InputStream getByteStream();
- /**
- * An attribute of a language and binding dependent type that represents
- * a stream of bytes.
- *
If the application knows the character encoding of the byte
- * stream, it should set the encoding attribute. Setting the encoding in
- * this way will override any encoding specified in an XML declaration
- * in the data.
- */
- public void setByteStream(java.io.InputStream byteStream);
-
- /**
- * String data to parse. If provided, this will always be treated as a
- * sequence of 16-bit units (UTF-16 encoded characters). It is not a
- * requirement to have an XML declaration when using
- * stringData
. If an XML declaration is present, the value
- * of the encoding attribute will be ignored.
- */
- public String getStringData();
- /**
- * String data to parse. If provided, this will always be treated as a
- * sequence of 16-bit units (UTF-16 encoded characters). It is not a
- * requirement to have an XML declaration when using
- * stringData
. If an XML declaration is present, the value
- * of the encoding attribute will be ignored.
- */
- public void setStringData(String stringData);
-
- /**
- * The system identifier, a URI reference [IETF RFC 2396], for this
- * input source. The system identifier is optional if there is a byte
- * stream, a character stream, or string data. It is still useful to
- * provide one, since the application will use it to resolve any
- * relative URIs and can include it in error messages and warnings. (The
- * LSParser will only attempt to fetch the resource identified by the
- * URI reference if there is no other input available in the input
- * source.)
- *
If the application knows the character encoding of the object
- * pointed to by the system identifier, it can set the encoding using
- * the encoding
attribute.
- *
If the specified system ID is a relative URI reference (see
- * section 5 in [IETF RFC 2396]), the DOM
- * implementation will attempt to resolve the relative URI with the
- * baseURI
as the base, if that fails, the behavior is
- * implementation dependent.
- */
- public String getSystemId();
- /**
- * The system identifier, a URI reference [IETF RFC 2396], for this
- * input source. The system identifier is optional if there is a byte
- * stream, a character stream, or string data. It is still useful to
- * provide one, since the application will use it to resolve any
- * relative URIs and can include it in error messages and warnings. (The
- * LSParser will only attempt to fetch the resource identified by the
- * URI reference if there is no other input available in the input
- * source.)
- *
If the application knows the character encoding of the object
- * pointed to by the system identifier, it can set the encoding using
- * the encoding
attribute.
- *
If the specified system ID is a relative URI reference (see
- * section 5 in [IETF RFC 2396]), the DOM
- * implementation will attempt to resolve the relative URI with the
- * baseURI
as the base, if that fails, the behavior is
- * implementation dependent.
- */
- public void setSystemId(String systemId);
-
- /**
- * The public identifier for this input source. This may be mapped to an
- * input source using an implementation dependent mechanism (such as
- * catalogues or other mappings). The public identifier, if specified,
- * may also be reported as part of the location information when errors
- * are reported.
- */
- public String getPublicId();
- /**
- * The public identifier for this input source. This may be mapped to an
- * input source using an implementation dependent mechanism (such as
- * catalogues or other mappings). The public identifier, if specified,
- * may also be reported as part of the location information when errors
- * are reported.
- */
- public void setPublicId(String publicId);
-
- /**
- * The base URI to be used (see section 5.1.4 in [IETF RFC 2396]) for
- * resolving a relative systemId
to an absolute URI.
- *
If, when used, the base URI is itself a relative URI, an empty
- * string, or null, the behavior is implementation dependent.
- */
- public String getBaseURI();
- /**
- * The base URI to be used (see section 5.1.4 in [IETF RFC 2396]) for
- * resolving a relative systemId
to an absolute URI.
- *
If, when used, the base URI is itself a relative URI, an empty
- * string, or null, the behavior is implementation dependent.
- */
- public void setBaseURI(String baseURI);
-
- /**
- * The character encoding, if known. The encoding must be a string
- * acceptable for an XML encoding declaration ([XML 1.0] section
- * 4.3.3 "Character Encoding in Entities").
- *
This attribute has no effect when the application provides a
- * character stream or string data. For other sources of input, an
- * encoding specified by means of this attribute will override any
- * encoding specified in the XML declaration or the Text declaration, or
- * an encoding obtained from a higher level protocol, such as HTTP [IETF RFC 2616].
- */
- public String getEncoding();
- /**
- * The character encoding, if known. The encoding must be a string
- * acceptable for an XML encoding declaration ([XML 1.0] section
- * 4.3.3 "Character Encoding in Entities").
- *
This attribute has no effect when the application provides a
- * character stream or string data. For other sources of input, an
- * encoding specified by means of this attribute will override any
- * encoding specified in the XML declaration or the Text declaration, or
- * an encoding obtained from a higher level protocol, such as HTTP [IETF RFC 2616].
- */
- public void setEncoding(String encoding);
-
- /**
- * If set to true, assume that the input is certified (see section 2.13
- * in [XML 1.1]) when
- * parsing [XML 1.1].
- */
- public boolean getCertifiedText();
- /**
- * If set to true, assume that the input is certified (see section 2.13
- * in [XML 1.1]) when
- * parsing [XML 1.1].
- */
- public void setCertifiedText(boolean certifiedText);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSLoadEvent.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSLoadEvent.java
deleted file mode 100644
index 601a5be11b7..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSLoadEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.events.Event;
-
-/**
- * This interface represents a load event object that signals the completion
- * of a document load.
- *
See also the Document Object Model (DOM) Level 3 Load -and Save Specification. - */ -public interface LSLoadEvent extends Event { - /** - * The document that finished loading. - */ - public Document getNewDocument(); - - /** - * The input source that was parsed. - */ - public LSInput getInput(); - -} diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSOutput.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSOutput.java deleted file mode 100644 index 2f8675c571e..00000000000 --- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSOutput.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2004 World Wide Web Consortium, - * - * (Massachusetts Institute of Technology, European Research Consortium for - * Informatics and Mathematics, Keio University). All Rights Reserved. This - * work is distributed under the W3C(r) Software License [1] in the hope that - * it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 - */ - -package org.w3c.dom.ls; - -/** - * This interface represents an output destination for data. - *
This interface allows an application to encapsulate information about - * an output destination in a single object, which may include a URI, a byte - * stream (possibly with a specified encoding), a base URI, and/or a - * character stream. - *
The exact definitions of a byte stream and a character stream are - * binding dependent. - *
The application is expected to provide objects that implement this
- * interface whenever such objects are needed. The application can either
- * provide its own objects that implement this interface, or it can use the
- * generic factory method DOMImplementationLS.createLSOutput()
- * to create objects that implement this interface.
- *
The LSSerializer
will use the LSOutput
object
- * to determine where to serialize the output to. The
- * LSSerializer
will look at the different outputs specified in
- * the LSOutput
in the following order to know which one to
- * output to, the first one that is not null and not an empty string will be
- * used:
- *
LSOutput.characterStream
- * LSOutput.byteStream
- * LSOutput.systemId
- * LSOutput
objects belong to the application. The DOM
- * implementation will never modify them (though it may make copies and
- * modify the copies, if necessary).
- *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSOutput {
- /**
- * An attribute of a language and binding dependent type that represents
- * a writable stream to which 16-bit units can be output.
- */
- public java.io.Writer getCharacterStream();
- /**
- * An attribute of a language and binding dependent type that represents
- * a writable stream to which 16-bit units can be output.
- */
- public void setCharacterStream(java.io.Writer characterStream);
-
- /**
- * An attribute of a language and binding dependent type that represents
- * a writable stream of bytes.
- */
- public java.io.OutputStream getByteStream();
- /**
- * An attribute of a language and binding dependent type that represents
- * a writable stream of bytes.
- */
- public void setByteStream(java.io.OutputStream byteStream);
-
- /**
- * The system identifier, a URI reference [IETF RFC 2396], for this
- * output destination.
- *
If the system ID is a relative URI reference (see section 5 in [IETF RFC 2396]), the
- * behavior is implementation dependent.
- */
- public String getSystemId();
- /**
- * The system identifier, a URI reference [IETF RFC 2396], for this
- * output destination.
- *
If the system ID is a relative URI reference (see section 5 in [IETF RFC 2396]), the
- * behavior is implementation dependent.
- */
- public void setSystemId(String systemId);
-
- /**
- * The character encoding to use for the output. The encoding must be a
- * string acceptable for an XML encoding declaration ([XML 1.0] section
- * 4.3.3 "Character Encoding in Entities"), it is recommended that
- * character encodings registered (as charsets) with the Internet
- * Assigned Numbers Authority [IANA-CHARSETS]
- * should be referred to using their registered names.
- */
- public String getEncoding();
- /**
- * The character encoding to use for the output. The encoding must be a
- * string acceptable for an XML encoding declaration ([XML 1.0] section
- * 4.3.3 "Character Encoding in Entities"), it is recommended that
- * character encodings registered (as charsets) with the Internet
- * Assigned Numbers Authority [IANA-CHARSETS]
- * should be referred to using their registered names.
- */
- public void setEncoding(String encoding);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSParser.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSParser.java
deleted file mode 100644
index ee918e0dce7..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSParser.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * An interface to an object that is able to build, or augment, a DOM tree
- * from various input sources.
- *
LSParser
provides an API for parsing XML and building the
- * corresponding DOM document structure. A LSParser
instance
- * can be obtained by invoking the
- * DOMImplementationLS.createLSParser()
method.
- *
As specified in [DOM Level 3 Core] - * , when a document is first made available via the LSParser: - *
value
and
- * nodeValue
attributes of an Attr
node initially
- * return the XML 1.0
- * normalized value. However, if the parameters "
- * validate-if-schema" and "
- * datatype-normalization" are set to true
, depending on the attribute normalization
- * used, the attribute values may differ from the ones obtained by the XML
- * 1.0 attribute normalization. If the parameters "
- * datatype-normalization" is set to false
, the XML 1.0 attribute normalization is
- * guaranteed to occur, and if the attributes list does not contain
- * namespace declarations, the attributes
attribute on
- * Element
node represents the property [attributes] defined in [XML Information Set]
- * .
- * Asynchronous LSParser
objects are expected to also
- * implement the events::EventTarget
interface so that event
- * listeners can be registered on asynchronous LSParser
- * objects.
- *
Events supported by asynchronous LSParser
objects are:
- *
LSParser
finishes to load the document. See also the
- * definition of the LSLoadEvent
interface. LSParser
signals progress as data is parsed. This
- * specification does not attempt to define exactly when progress events
- * should be dispatched. That is intentionally left as
- * implementation-dependent. Here is one example of how an application might
- * dispatch progress events: Once the parser starts receiving data, a
- * progress event is dispatched to indicate that the parsing starts. From
- * there on, a progress event is dispatched for every 4096 bytes of data
- * that is received and processed. This is only one example, though, and
- * implementations can choose to dispatch progress events at any time while
- * parsing, or not dispatch them at all. See also the definition of the
- * LSProgressEvent
interface. Note: All events defined in this specification use the
- * namespace URI "http://www.w3.org/2002/DOMLS"
.
- *
While parsing an input source, errors are reported to the application
- * through the error handler (LSParser.domConfig
's "
- * error-handler" parameter). This specification does in no way try to define all possible
- * errors that can occur while parsing XML, or any other markup, but some
- * common error cases are defined. The types (DOMError.type
) of
- * errors and warnings defined by this specification are:
- *
"check-character-normalization-failure" [error]
"doctype-not-allowed" [fatal]
true
- * and a doctype is encountered. "no-input-specified" [fatal]
LSInput
object. "pi-base-uri-not-preserved" [warning]
false
and the following XML file is parsed:
- * - * <!DOCTYPE root [ <!ENTITY e SYSTEM 'subdir/myentity.ent' ]> - * <root> &e; </root>- * And
subdir/myentity.ent
- * contains:
- * <one> <two/> </one> <?pi 3.14159?> - * <more/>- *
"unbound-prefix-in-entity" [warning]
true
and an unbound namespace prefix is
- * encountered in an entity's replacement text. Raising this warning is not
- * enforced since some existing parsers may not recognize unbound namespace
- * prefixes in the replacement text of entities. "unknown-character-denormalization" [fatal]
false
and a character is encountered for which the
- * processor cannot determine the normalization properties. "unsupported-encoding" [fatal]
"unsupported-media-type" [fatal]
true
and an unsupported media type is encountered. In addition to raising the defined errors and warnings, implementations - * are expected to raise implementation specific errors and warnings for any - * other error and warning cases such as IO errors (file not found, - * permission denied,...), XML well-formedness errors, and so on. - *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSParser {
- /**
- * The DOMConfiguration
object used when parsing an input
- * source. This DOMConfiguration
is specific to the parse
- * operation. No parameter values from this DOMConfiguration
- * object are passed automatically to the DOMConfiguration
- * object on the Document
that is created, or used, by the
- * parse operation. The DOM application is responsible for passing any
- * needed parameter values from this DOMConfiguration
- * object to the DOMConfiguration
object referenced by the
- * Document
object.
- *
In addition to the parameters recognized in on the
- * DOMConfiguration interface defined in [DOM Level 3 Core]
- * , the DOMConfiguration
objects for LSParser
- * add or modify the following parameters:
- *
"charset-overrides-xml-encoding"
true
LSInput
overrides
- * any encoding from the protocol. false
"disallow-doctype"
true
false
"ignore-unknown-character-denormalizations"
true
false
"infoset"
DOMConfiguration
for a description of
- * this parameter. Unlike in [DOM Level 3 Core]
- * , this parameter will default to true
for
- * LSParser
. "namespaces"
true
false
"resource-resolver"
LSResourceResolver
object, or null. If
- * the value of this parameter is not null when an external resource
- * (such as an external XML entity or an XML schema location) is
- * encountered, the implementation will request that the
- * LSResourceResolver
referenced in this parameter resolves
- * the resource. "supported-media-types-only"
true
false
"validate"
DOMConfiguration
for a description of this parameter.
- * Unlike in [DOM Level 3 Core]
- * , the processing of the internal subset is always accomplished, even
- * if this parameter is set to false
. "validate-if-schema"
DOMConfiguration
for a description of this parameter.
- * Unlike in [DOM Level 3 Core]
- * , the processing of the internal subset is always accomplished, even
- * if this parameter is set to false
. "well-formed"
DOMConfiguration
for a description of this parameter.
- * Unlike in [DOM Level 3 Core]
- * , this parameter cannot be set to false
. DOMConfiguration
parameters have been applied. For
- * example, if "
- * validate" is set to true
, the validation is done before invoking the
- * filter.
- */
- public LSParserFilter getFilter();
- /**
- * When a filter is provided, the implementation will call out to the
- * filter as it is constructing the DOM tree structure. The filter can
- * choose to remove elements from the document being constructed, or to
- * terminate the parsing early.
- * DOMConfiguration
parameters have been applied. For
- * example, if "
- * validate" is set to true
, the validation is done before invoking the
- * filter.
- */
- public void setFilter(LSParserFilter filter);
-
- /**
- * true
if the LSParser
is asynchronous,
- * false
if it is synchronous.
- */
- public boolean getAsync();
-
- /**
- * true
if the LSParser
is currently busy
- * loading a document, otherwise false
.
- */
- public boolean getBusy();
-
- /**
- * Parse an XML document from a resource identified by a
- * LSInput
.
- * @param input The LSInput
from which the source of the
- * document is to be read.
- * @return If the LSParser
is a synchronous
- * LSParser
, the newly created and populated
- * Document
is returned. If the LSParser
is
- * asynchronous, null
is returned since the document
- * object may not yet be constructed when this method returns.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if the LSParser
's
- * LSParser.busy
attribute is true
.
- * @exception LSException
- * PARSE_ERR: Raised if the LSParser
was unable to load
- * the XML document. DOM applications should attach a
- * DOMErrorHandler
using the parameter "
- * error-handler" if they wish to get details on the error.
- */
- public Document parse(LSInput input)
- throws DOMException, LSException;
-
- /**
- * Parse an XML document from a location identified by a URI reference [IETF RFC 2396]. If the URI
- * contains a fragment identifier (see section 4.1 in [IETF RFC 2396]), the
- * behavior is not defined by this specification, future versions of
- * this specification may define the behavior.
- * @param uri The location of the XML document to be read.
- * @return If the LSParser
is a synchronous
- * LSParser
, the newly created and populated
- * Document
is returned, or null
if an error
- * occured. If the LSParser
is asynchronous,
- * null
is returned since the document object may not yet
- * be constructed when this method returns.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if the LSParser.busy
- * attribute is true
.
- * @exception LSException
- * PARSE_ERR: Raised if the LSParser
was unable to load
- * the XML document. DOM applications should attach a
- * DOMErrorHandler
using the parameter "
- * error-handler" if they wish to get details on the error.
- */
- public Document parseURI(String uri)
- throws DOMException, LSException;
-
- // ACTION_TYPES
- /**
- * Append the result of the parse operation as children of the context
- * node. For this action to work, the context node must be an
- * Element
or a DocumentFragment
.
- */
- public static final short ACTION_APPEND_AS_CHILDREN = 1;
- /**
- * Replace all the children of the context node with the result of the
- * parse operation. For this action to work, the context node must be an
- * Element
, a Document
, or a
- * DocumentFragment
.
- */
- public static final short ACTION_REPLACE_CHILDREN = 2;
- /**
- * Insert the result of the parse operation as the immediately preceding
- * sibling of the context node. For this action to work the context
- * node's parent must be an Element
or a
- * DocumentFragment
.
- */
- public static final short ACTION_INSERT_BEFORE = 3;
- /**
- * Insert the result of the parse operation as the immediately following
- * sibling of the context node. For this action to work the context
- * node's parent must be an Element
or a
- * DocumentFragment
.
- */
- public static final short ACTION_INSERT_AFTER = 4;
- /**
- * Replace the context node with the result of the parse operation. For
- * this action to work, the context node must have a parent, and the
- * parent must be an Element
or a
- * DocumentFragment
.
- */
- public static final short ACTION_REPLACE = 5;
-
- /**
- * Parse an XML fragment from a resource identified by a
- * LSInput
and insert the content into an existing document
- * at the position specified with the context
and
- * action
arguments. When parsing the input stream, the
- * context node (or its parent, depending on where the result will be
- * inserted) is used for resolving unbound namespace prefixes. The
- * context node's ownerDocument
node (or the node itself if
- * the node of type DOCUMENT_NODE
) is used to resolve
- * default attributes and entity references.
- * Document
node and the action
- * is ACTION_REPLACE_CHILDREN
, then the document that is
- * passed as the context node will be changed such that its
- * xmlEncoding
, documentURI
,
- * xmlVersion
, inputEncoding
,
- * xmlStandalone
, and all other such attributes are set to
- * what they would be set to if the input source was parsed using
- * LSParser.parse()
.
- * LSParser
is asynchronous (LSParser.async
is
- * true
).
- * ErrorHandler
instance associated with the "
- * error-handler" parameter of the DOMConfiguration
.
- * parseWithContext
, the values of the
- * following configuration parameters will be ignored and their default
- * values will always be used instead: "
- * validate", "
- * validate-if-schema", and "
- * element-content-whitespace". Other parameters will be treated normally, and the parser is expected
- * to call the LSParserFilter
just as if a whole document
- * was parsed.
- * @param input The LSInput
from which the source document
- * is to be read. The source document must be an XML fragment, i.e.
- * anything except a complete XML document (except in the case where
- * the context node of type DOCUMENT_NODE
, and the action
- * is ACTION_REPLACE_CHILDREN
), a DOCTYPE (internal
- * subset), entity declaration(s), notation declaration(s), or XML or
- * text declaration(s).
- * @param contextArg The node that is used as the context for the data
- * that is being parsed. This node must be a Document
- * node, a DocumentFragment
node, or a node of a type
- * that is allowed as a child of an Element
node, e.g. it
- * cannot be an Attribute
node.
- * @param action This parameter describes which action should be taken
- * between the new set of nodes being inserted and the existing
- * children of the context node. The set of possible actions is
- * defined in ACTION_TYPES
above.
- * @return Return the node that is the result of the parse operation. If
- * the result is more than one top-level node, the first one is
- * returned.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be
- * inserted before, after, or as a child of the context node (see also
- * Node.insertBefore
or Node.replaceChild
in [DOM Level 3 Core]
- * ).
- * LSParser
doesn't
- * support this method, or if the context node is of type
- * Document
and the DOM implementation doesn't support
- * the replacement of the DocumentType
child or
- * Element
child.
- * LSParser.busy
- * attribute is true
.
- * @exception LSException
- * PARSE_ERR: Raised if the LSParser
was unable to load
- * the XML fragment. DOM applications should attach a
- * DOMErrorHandler
using the parameter "
- * error-handler" if they wish to get details on the error.
- */
- public Node parseWithContext(LSInput input,
- Node contextArg,
- short action)
- throws DOMException, LSException;
-
- /**
- * Abort the loading of the document that is currently being loaded by
- * the LSParser
. If the LSParser
is currently
- * not busy, a call to this method does nothing.
- */
- public void abort();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSParserFilter.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSParserFilter.java
deleted file mode 100644
index 4e612945e95..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSParserFilter.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Element;
-
-/**
- * LSParserFilter
s provide applications the ability to examine
- * nodes as they are being constructed while parsing. As each node is
- * examined, it may be modified or removed, or the entire parse may be
- * terminated early.
- * At the time any of the filter methods are called by the parser, the
- * owner Document and DOMImplementation objects exist and are accessible.
- * The document element is never passed to the LSParserFilter
- * methods, i.e. it is not possible to filter out the document element.
- * Document
, DocumentType
, Notation
,
- * Entity
, and Attr
nodes are never passed to the
- * acceptNode
method on the filter. The child nodes of an
- * EntityReference
node are passed to the filter if the
- * parameter "
- * entities" is set to false
. Note that, as described by the parameter "
- * entities", unexpanded entity reference nodes are never discarded and are always
- * passed to the filter.
- *
All validity checking while parsing a document occurs on the source - * document as it appears on the input stream, not on the DOM document as it - * is built in memory. With filters, the document in memory may be a subset - * of the document on the stream, and its validity may have been affected by - * the filtering. - *
All default attributes must be present on elements when the elements - * are passed to the filter methods. All other default content must be - * passed to the filter methods. - *
DOM applications must not raise exceptions in a filter. The effect of - * throwing exceptions from a filter is DOM implementation dependent. - *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSParserFilter {
- // Constants returned by startElement and acceptNode
- /**
- * Accept the node.
- */
- public static final short FILTER_ACCEPT = 1;
- /**
- * Reject the node and its children.
- */
- public static final short FILTER_REJECT = 2;
- /**
- * Skip this single node. The children of this node will still be
- * considered.
- */
- public static final short FILTER_SKIP = 3;
- /**
- * Interrupt the normal processing of the document.
- */
- public static final short FILTER_INTERRUPT = 4;
-
- /**
- * The parser will call this method after each Element
start
- * tag has been scanned, but before the remainder of the
- * Element
is processed. The intent is to allow the
- * element, including any children, to be efficiently skipped. Note that
- * only element nodes are passed to the startElement
- * function.
- *
The element node passed to startElement
for filtering
- * will include all of the Element's attributes, but none of the
- * children nodes. The Element may not yet be in place in the document
- * being constructed (it may not have a parent node.)
- *
A startElement
filter function may access or change
- * the attributes for the Element. Changing Namespace declarations will
- * have no effect on namespace resolution by the parser.
- *
For efficiency, the Element node passed to the filter may not be
- * the same one as is actually placed in the tree if the node is
- * accepted. And the actual node (node object identity) may be reused
- * during the process of reading in and filtering a document.
- * @param elementArg The newly encountered element. At the time this
- * method is called, the element is incomplete - it will have its
- * attributes, but no children.
- * @return
- *
FILTER_ACCEPT
if the Element
should
- * be included in the DOM document being built.
- * FILTER_REJECT
if the Element
and all of
- * its children should be rejected.
- * FILTER_SKIP
if the
- * Element
should be skipped. All of its children are
- * inserted in place of the skipped Element
node.
- * FILTER_INTERRUPT
if the filter wants to stop the
- * processing of the document. Interrupting the processing of the
- * document does no longer guarantee that the resulting DOM tree is
- * XML well-formed. The Element
is rejected.
- * FILTER_ACCEPT
if this Node
should
- * be included in the DOM document being built.
- * FILTER_REJECT
if the Node
and all of its
- * children should be rejected.
- * FILTER_SKIP
if the
- * Node
should be skipped and the Node
- * should be replaced by all the children of the Node
.
- * FILTER_INTERRUPT
if the filter wants to stop the
- * processing of the document. Interrupting the processing of the
- * document does no longer guarantee that the resulting DOM tree is
- * XML well-formed. The Node
is accepted and will be the
- * last completely parsed node.
- * LSParser
what types of nodes to show to the
- * method LSParserFilter.acceptNode
. If a node is not shown
- * to the filter using this attribute, it is automatically included in
- * the DOM document being built. See NodeFilter
for
- * definition of the constants. The constants SHOW_ATTRIBUTE
- * , SHOW_DOCUMENT
, SHOW_DOCUMENT_TYPE
,
- * SHOW_NOTATION
, SHOW_ENTITY
, and
- * SHOW_DOCUMENT_FRAGMENT
are meaningless here. Those nodes
- * will never be passed to LSParserFilter.acceptNode
.
- * Event
interface defined in [DOM Level 3 Events]
- * .
- * The units used for the attributes position
and
- * totalSize
are not specified and can be implementation and
- * input dependent.
- *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSProgressEvent extends Event {
- /**
- * The input source that is being parsed.
- */
- public LSInput getInput();
-
- /**
- * The current position in the input source, including all external
- * entities and other resources that have been read.
- */
- public int getPosition();
-
- /**
- * The total size of the document including all external resources, this
- * number might change as a document is being parsed if references to
- * more external resources are seen. A value of 0
is
- * returned if the total size cannot be determined or estimated.
- */
- public int getTotalSize();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSResourceResolver.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSResourceResolver.java
deleted file mode 100644
index c0c523c8a00..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSResourceResolver.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-/**
- * LSResourceResolver
provides a way for applications to
- * redirect references to external resources.
- *
Applications needing to implement custom handling for external
- * resources can implement this interface and register their implementation
- * by setting the "resource-resolver" parameter of
- * DOMConfiguration
objects attached to LSParser
- * and LSSerializer
. It can also be register on
- * DOMConfiguration
objects attached to Document
- * if the "LS" feature is supported.
- *
The LSParser
will then allow the application to intercept
- * any external entities, including the external DTD subset and external
- * parameter entities, before including them. The top-level document entity
- * is never passed to the resolveResource
method.
- *
Many DOM applications will not need to implement this interface, but it - * will be especially useful for applications that build XML documents from - * databases or other specialized input sources, or for applications that - * use URNs. - *
Note: LSResourceResolver
is based on the SAX2 [SAX] EntityResolver
- * interface.
- *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSResourceResolver {
- /**
- * Allow the application to resolve external resources.
- *
The LSParser
will call this method before opening any
- * external resource, including the external DTD subset, external
- * entities referenced within the DTD, and external entities referenced
- * within the document element (however, the top-level document entity
- * is not passed to this method). The application may then request that
- * the LSParser
resolve the external resource itself, that
- * it use an alternative URI, or that it use an entirely different input
- * source.
- *
Application writers can use this method to redirect external
- * system identifiers to secure and/or local URI, to look up public
- * identifiers in a catalogue, or to read an entity from a database or
- * other input source (including, for example, a dialog box).
- * @param type The type of the resource being resolved. For XML [XML 1.0] resources
- * (i.e. entities), applications must use the value
- * "http://www.w3.org/TR/REC-xml"
. For XML Schema [XML Schema Part 1]
- * , applications must use the value
- * "http://www.w3.org/2001/XMLSchema"
. Other types of
- * resources are outside the scope of this specification and therefore
- * should recommend an absolute URI in order to use this method.
- * @param namespaceURI The namespace of the resource being resolved,
- * e.g. the target namespace of the XML Schema [XML Schema Part 1]
- * when resolving XML Schema resources.
- * @param publicId The public identifier of the external entity being
- * referenced, or null
if no public identifier was
- * supplied or if the resource is not an entity.
- * @param systemId The system identifier, a URI reference [IETF RFC 2396], of the
- * external resource being referenced, or null
if no
- * system identifier was supplied.
- * @param baseURI The absolute base URI of the resource being parsed, or
- * null
if there is no base URI.
- * @return A LSInput
object describing the new input
- * source, or null
to request that the parser open a
- * regular URI connection to the resource.
- */
- public LSInput resolveResource(String type,
- String namespaceURI,
- String publicId,
- String systemId,
- String baseURI);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSSerializer.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSSerializer.java
deleted file mode 100644
index e7b6350d304..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSSerializer.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * A LSSerializer
provides an API for serializing (writing) a
- * DOM document out into XML. The XML data is written to a string or an
- * output stream. Any changes or fixups made during the serialization affect
- * only the serialized data. The Document
object and its
- * children are never altered by the serialization operation.
- *
During serialization of XML data, namespace fixup is done as defined in [DOM Level 3 Core]
- * , Appendix B. [DOM Level 2 Core]
- * allows empty strings as a real namespace URI. If the
- * namespaceURI
of a Node
is empty string, the
- * serialization will treat them as null
, ignoring the prefix
- * if any.
- *
LSSerializer
accepts any node type for serialization. For
- * nodes of type Document
or Entity
, well-formed
- * XML will be created when possible (well-formedness is guaranteed if the
- * document or entity comes from a parse operation and is unchanged since it
- * was created). The serialized output for these node types is either as a
- * XML document or an External XML Entity, respectively, and is acceptable
- * input for an XML parser. For all other types of nodes the serialized form
- * is implementation dependent.
- *
Within a Document
, DocumentFragment
, or
- * Entity
being serialized, Nodes
are processed as
- * follows
- *
Document
nodes are written, including the XML
- * declaration (unless the parameter "xml-declaration" is set to
- * false
) and a DTD subset, if one exists in the DOM. Writing a
- * Document
node serializes the entire document.
- * Entity
nodes, when written directly by
- * LSSerializer.write
, outputs the entity expansion but no
- * namespace fixup is done. The resulting output will be valid as an
- * external entity.
- * true
, EntityReference
nodes are
- * serialized as an entity reference of the form "
- * &entityName;
" in the output. Child nodes (the expansion)
- * of the entity reference are ignored. If the parameter "
- * entities" is set to false
, only the children of the entity reference
- * are serialized. EntityReference
nodes with no children (no
- * corresponding Entity
node or the corresponding
- * Entity
nodes have no children) are always serialized.
- * CDATAsections
containing content characters that cannot be
- * represented in the specified output encoding are handled according to the
- * "
- * split-cdata-sections" parameter. If the parameter is set to true
,
- * CDATAsections
are split, and the unrepresentable characters
- * are serialized as numeric character references in ordinary content. The
- * exact position and number of splits is not specified. If the parameter
- * is set to false
, unrepresentable characters in a
- * CDATAsection
are reported as
- * "wf-invalid-character"
errors if the parameter "
- * well-formed" is set to true
. The error is not recoverable - there is no
- * mechanism for supplying alternative characters and continuing with the
- * serialization.
- * DocumentFragment
nodes are serialized by
- * serializing the children of the document fragment in the order they
- * appear in the document fragment.
- * Note: The serialization of a Node
does not always
- * generate a well-formed XML document, i.e. a LSParser
might
- * throw fatal errors when parsing the resulting serialization.
- *
Within the character data of a document (outside of markup), any - * characters that cannot be represented directly are replaced with - * character references. Occurrences of '<' and '&' are replaced by - * the predefined entities < and &. The other predefined - * entities (>, ', and ") might not be used, except - * where needed (e.g. using > in cases such as ']]>'). Any - * characters that cannot be represented directly in the output character - * encoding are serialized as numeric character references (and since - * character encoding standards commonly use hexadecimal representations of - * characters, using the hexadecimal representation when serializing - * character references is encouraged). - *
To allow attribute values to contain both single and double quotes, the - * apostrophe or single-quote character (') may be represented as - * "'", and the double-quote character (") as """. New - * line characters and other characters that cannot be represented directly - * in attribute values in the output character encoding are serialized as a - * numeric character reference. - *
Within markup, but outside of attributes, any occurrence of a character
- * that cannot be represented in the output character encoding is reported
- * as a DOMError
fatal error. An example would be serializing
- * the element <LaCa\u00f1ada/> with encoding="us-ascii"
.
- * This will result with a generation of a DOMError
- * "wf-invalid-character-in-node-name" (as proposed in "
- * well-formed").
- *
When requested by setting the parameter "
- * normalize-characters" on LSSerializer
to true, character normalization is
- * performed according to the definition of fully
- * normalized characters included in appendix E of [XML 1.1] on all
- * data to be serialized, both markup and character data. The character
- * normalization process affects only the data as it is being written; it
- * does not alter the DOM's view of the document after serialization has
- * completed.
- *
Implementations are required to support the encodings "UTF-8",
- * "UTF-16", "UTF-16BE", and "UTF-16LE" to guarantee that data is
- * serializable in all encodings that are required to be supported by all
- * XML parsers. When the encoding is UTF-8, whether or not a byte order mark
- * is serialized, or if the output is big-endian or little-endian, is
- * implementation dependent. When the encoding is UTF-16, whether or not the
- * output is big-endian or little-endian is implementation dependent, but a
- * Byte Order Mark must be generated for non-character outputs, such as
- * LSOutput.byteStream
or LSOutput.systemId
. If
- * the Byte Order Mark is not generated, a "byte-order-mark-needed" warning
- * is reported. When the encoding is UTF-16LE or UTF-16BE, the output is
- * big-endian (UTF-16BE) or little-endian (UTF-16LE) and the Byte Order Mark
- * is not be generated. In all cases, the encoding declaration, if
- * generated, will correspond to the encoding used during the serialization
- * (e.g. encoding="UTF-16"
will appear if UTF-16 was
- * requested).
- *
Namespaces are fixed up during serialization, the serialization process - * will verify that namespace declarations, namespace prefixes and the - * namespace URI associated with elements and attributes are consistent. If - * inconsistencies are found, the serialized form of the document will be - * altered to remove them. The method used for doing the namespace fixup - * while serializing a document is the algorithm defined in Appendix B.1, - * "Namespace normalization", of [DOM Level 3 Core] - * . - *
While serializing a document, the parameter "discard-default-content" - * controls whether or not non-specified data is serialized. - *
While serializing, errors and warnings are reported to the application
- * through the error handler (LSSerializer.domConfig
's "
- * error-handler" parameter). This specification does in no way try to define all possible
- * errors and warnings that can occur while serializing a DOM node, but some
- * common error and warning cases are defined. The types (
- * DOMError.type
) of errors and warnings defined by this
- * specification are:
- *
"no-output-specified" [fatal]
LSOutput
if no output is specified in the
- * LSOutput
. "unbound-prefix-in-entity-reference" [fatal]
true
and an entity whose replacement text
- * contains unbound namespace prefixes is referenced in a location where
- * there are no bindings for the namespace prefixes. "unsupported-encoding" [fatal]
In addition to raising the defined errors and warnings, implementations - * are expected to raise implementation specific errors and warnings for any - * other error and warning cases such as IO errors (file not found, - * permission denied,...) and so on. - *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSSerializer {
- /**
- * The DOMConfiguration
object used by the
- * LSSerializer
when serializing a DOM node.
- *
In addition to the parameters recognized by the
- * DOMConfiguration interface defined in [DOM Level 3 Core]
- * , the DOMConfiguration
objects for
- * LSSerializer
adds, or modifies, the following
- * parameters:
- *
"canonical-form"
true
true
will set the parameters
- * "format-pretty-print", "discard-default-content", and "xml-declaration
- * ", to false
. Setting one of those parameters to
- * true
will set this parameter to false
.
- * Serializing an XML 1.1 document when "canonical-form" is
- * true
will generate a fatal error. false
"discard-default-content"
true
Attr.specified
attribute to decide what attributes
- * should be discarded. Note that some implementations might use
- * whatever information available to the implementation (i.e. XML
- * schema, DTD, the Attr.specified
attribute, and so on) to
- * determine what attributes and content to discard if this parameter is
- * set to true
. false
"format-pretty-print"
true
false
"ignore-unknown-character-denormalizations"
true
"unknown-character-denormalization"
warning (instead of
- * raising an error, if this parameter is not set) and ignore any
- * possible denormalizations caused by these characters. false
"normalize-characters"
DOMConfiguration
in [DOM Level 3 Core]
- * . Unlike in the Core, the default value for this parameter is
- * true
. While DOM implementations are not required to
- * support fully
- * normalizing the characters in the document according to appendix E of [XML 1.1], this
- * parameter must be activated by default if supported. "xml-declaration"
true
Document
, Element
, or Entity
- * node is serialized, the XML declaration, or text declaration, should
- * be included. The version (Document.xmlVersion
if the
- * document is a Level 3 document and the version is non-null, otherwise
- * use the value "1.0"), and the output encoding (see
- * LSSerializer.write
for details on how to find the output
- * encoding) are specified in the serialized XML declaration. false
"xml-declaration-needed"
warning if this will cause
- * problems (i.e. the serialized data is of an XML version other than [XML 1.0], or an
- * encoding would be needed to be able to re-parse the serialized data). null
will reset its
- * value to the default value.
- * null
will reset its
- * value to the default value.
- * DOMConfiguration
parameters have been applied. For
- * example, CDATA sections won't be passed to the filter if "
- * cdata-sections" is set to false
.
- */
- public LSSerializerFilter getFilter();
- /**
- * When the application provides a filter, the serializer will call out
- * to the filter before serializing each Node. The filter implementation
- * can choose to remove the node from the stream or to terminate the
- * serialization early.
- * DOMConfiguration
parameters have been applied. For
- * example, CDATA sections won't be passed to the filter if "
- * cdata-sections" is set to false
.
- */
- public void setFilter(LSSerializerFilter filter);
-
- /**
- * Serialize the specified node as described above in the general
- * description of the LSSerializer
interface. The output is
- * written to the supplied LSOutput
.
- * LSOutput
, the encoding is found by
- * looking at the encoding information that is reachable through the
- * LSOutput
and the item to be written (or its owner
- * document) in this order:
- * LSOutput.encoding
,
- * Document.inputEncoding
,
- * Document.xmlEncoding
.
- * LSOutput
, a
- * "no-output-specified" fatal error is raised.
- * true
if node
was
- * successfully serialized. Return false
in case the
- * normal processing stopped but the implementation kept serializing
- * the document; the result of the serialization being implementation
- * dependent then.
- * @exception LSException
- * SERIALIZE_ERR: Raised if the LSSerializer
was unable to
- * serialize the node. DOM applications should attach a
- * DOMErrorHandler
using the parameter "
- * error-handler" if they wish to get details on the error.
- */
- public boolean write(Node nodeArg,
- LSOutput destination)
- throws LSException;
-
- /**
- * A convenience method that acts as if LSSerializer.write
- * was called with a LSOutput
with no encoding specified
- * and LSOutput.systemId
set to the uri
- * argument.
- * @param nodeArg The node to serialize.
- * @param uri The URI to write to.
- * @return Returns true
if node
was
- * successfully serialized. Return false
in case the
- * normal processing stopped but the implementation kept serializing
- * the document; the result of the serialization being implementation
- * dependent then.
- * @exception LSException
- * SERIALIZE_ERR: Raised if the LSSerializer
was unable to
- * serialize the node. DOM applications should attach a
- * DOMErrorHandler
using the parameter "
- * error-handler" if they wish to get details on the error.
- */
- public boolean writeToURI(Node nodeArg,
- String uri)
- throws LSException;
-
- /**
- * Serialize the specified node as described above in the general
- * description of the LSSerializer
interface. The output is
- * written to a DOMString
that is returned to the caller.
- * The encoding used is the encoding of the DOMString
type,
- * i.e. UTF-16. Note that no Byte Order Mark is generated in a
- * DOMString
object.
- * @param nodeArg The node to serialize.
- * @return Returns the serialized data.
- * @exception DOMException
- * DOMSTRING_SIZE_ERR: Raised if the resulting string is too long to
- * fit in a DOMString
.
- * @exception LSException
- * SERIALIZE_ERR: Raised if the LSSerializer
was unable to
- * serialize the node. DOM applications should attach a
- * DOMErrorHandler
using the parameter "
- * error-handler" if they wish to get details on the error.
- */
- public String writeToString(Node nodeArg)
- throws DOMException, LSException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ls/LSSerializerFilter.java b/libjava/external/w3c_dom/org/w3c/dom/ls/LSSerializerFilter.java
deleted file mode 100644
index 049459c6417..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ls/LSSerializerFilter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.ls;
-
-import org.w3c.dom.traversal.NodeFilter;
-
-/**
- * LSSerializerFilter
s provide applications the ability to
- * examine nodes as they are being serialized and decide what nodes should
- * be serialized or not. The LSSerializerFilter
interface is
- * based on the NodeFilter
interface defined in [DOM Level 2 Traversal and Range]
- * .
- * Document
, DocumentType
,
- * DocumentFragment
, Notation
, Entity
- * , and children of Attr
nodes are not passed to the filter.
- * The child nodes of an EntityReference
node are only passed
- * to the filter if the EntityReference
node is skipped by the
- * method LSParserFilter.acceptNode()
.
- *
When serializing an Element
, the element is passed to the
- * filter before any of its attributes are passed to the filter. Namespace
- * declaration attributes, and default attributes (except in the case when "
- * discard-default-content" is set to false
), are never passed
- * to the filter.
- *
The result of any attempt to modify a node passed to a
- * LSSerializerFilter
is implementation dependent.
- *
DOM applications must not raise exceptions in a filter. The effect of - * throwing exceptions from a filter is DOM implementation dependent. - *
For efficiency, a node passed to the filter may not be the same as the - * one that is actually in the tree. And the actual node (node object - * identity) may be reused during the process of filtering and serializing a - * document. - *
See also the Document Object Model (DOM) Level 3 Load
-and Save Specification.
- */
-public interface LSSerializerFilter extends NodeFilter {
- /**
- * Tells the LSSerializer
what types of nodes to show to the
- * filter. If a node is not shown to the filter using this attribute, it
- * is automatically serialized. See NodeFilter
for
- * definition of the constants. The constants SHOW_DOCUMENT
- * , SHOW_DOCUMENT_TYPE
, SHOW_DOCUMENT_FRAGMENT
- * , SHOW_NOTATION
, and SHOW_ENTITY
are
- * meaningless here, such nodes will never be passed to a
- * LSSerializerFilter
.
- *
Unlike [DOM Level 2 Traversal and Range]
- * , the SHOW_ATTRIBUTE
constant indicates that the
- * Attr
nodes are shown and passed to the filter.
- *
The constants used here are defined in [DOM Level 2 Traversal and Range]
- * .
- */
- public int getWhatToShow();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ranges/DocumentRange.java b/libjava/external/w3c_dom/org/w3c/dom/ranges/DocumentRange.java
deleted file mode 100644
index 6b522670e20..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ranges/DocumentRange.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.ranges;
-
-/**
- *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
- * @since DOM Level 2
- */
-public interface DocumentRange {
- /**
- * This interface can be obtained from the object implementing the
- * Document
interface using binding-specific casting
- * methods.
- * @return The initial state of the Range returned from this method is
- * such that both of its boundary-points are positioned at the
- * beginning of the corresponding Document, before any content. The
- * Range returned can only be used to select content associated with
- * this Document, or with DocumentFragments and Attrs for which this
- * Document is the ownerDocument
.
- */
- public Range createRange();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ranges/Range.java b/libjava/external/w3c_dom/org/w3c/dom/ranges/Range.java
deleted file mode 100644
index a576b4dd642..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ranges/Range.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.ranges;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentFragment;
-
-/**
- *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
- * @since DOM Level 2
- */
-public interface Range {
- /**
- * Node within which the Range begins
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public Node getStartContainer()
- throws DOMException;
-
- /**
- * Offset within the starting node of the Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public int getStartOffset()
- throws DOMException;
-
- /**
- * Node within which the Range ends
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public Node getEndContainer()
- throws DOMException;
-
- /**
- * Offset within the ending node of the Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public int getEndOffset()
- throws DOMException;
-
- /**
- * TRUE if the Range is collapsed
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public boolean getCollapsed()
- throws DOMException;
-
- /**
- * The deepest common ancestor container of the Range's two
- * boundary-points.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public Node getCommonAncestorContainer()
- throws DOMException;
-
- /**
- * Sets the attributes describing the start of the Range.
- * @param refNode The refNode
value. This parameter must be
- * different from null
.
- * @param offset The startOffset
value.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if refNode
or an ancestor
- * of refNode
is an Entity, Notation, or DocumentType
- * node.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if offset
is negative or greater
- * than the number of child units in refNode
. Child units
- * are 16-bit units if refNode
is a type of CharacterData
- * node (e.g., a Text or Comment node) or a ProcessingInstruction
- * node. Child units are Nodes in all other cases.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void setStart(Node refNode,
- int offset)
- throws RangeException, DOMException;
-
- /**
- * Sets the attributes describing the end of a Range.
- * @param refNode The refNode
value. This parameter must be
- * different from null
.
- * @param offset The endOffset
value.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if refNode
or an ancestor
- * of refNode
is an Entity, Notation, or DocumentType
- * node.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if offset
is negative or greater
- * than the number of child units in refNode
. Child units
- * are 16-bit units if refNode
is a type of CharacterData
- * node (e.g., a Text or Comment node) or a ProcessingInstruction
- * node. Child units are Nodes in all other cases.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void setEnd(Node refNode,
- int offset)
- throws RangeException, DOMException;
-
- /**
- * Sets the start position to be before a node
- * @param refNode Range starts before refNode
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * refNode
is not an Attr, Document, or DocumentFragment
- * node or if refNode
is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void setStartBefore(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Sets the start position to be after a node
- * @param refNode Range starts after refNode
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * refNode
is not an Attr, Document, or DocumentFragment
- * node or if refNode
is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void setStartAfter(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Sets the end position to be before a node.
- * @param refNode Range ends before refNode
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * refNode
is not an Attr, Document, or DocumentFragment
- * node or if refNode
is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void setEndBefore(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Sets the end of a Range to be after a node
- * @param refNode Range ends after refNode
.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * refNode
is not an Attr, Document or DocumentFragment
- * node or if refNode
is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void setEndAfter(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Collapse a Range onto one of its boundary-points
- * @param toStart If TRUE, collapses the Range onto its start; if FALSE,
- * collapses it onto its end.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public void collapse(boolean toStart)
- throws DOMException;
-
- /**
- * Select a node and its contents
- * @param refNode The node to select.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode
- * is an Entity, Notation or DocumentType node or if
- * refNode
is a Document, DocumentFragment, Attr, Entity,
- * or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void selectNode(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Select the contents within a node
- * @param refNode Node to select from
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if refNode
or an ancestor
- * of refNode
is an Entity, Notation or DocumentType node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- *
WRONG_DOCUMENT_ERR: Raised if refNode
was created
- * from a different document than the one that created this range.
- */
- public void selectNodeContents(Node refNode)
- throws RangeException, DOMException;
-
- // CompareHow
- /**
- * Compare start boundary-point of sourceRange
to start
- * boundary-point of Range on which compareBoundaryPoints
- * is invoked.
- */
- public static final short START_TO_START = 0;
- /**
- * Compare start boundary-point of sourceRange
to end
- * boundary-point of Range on which compareBoundaryPoints
- * is invoked.
- */
- public static final short START_TO_END = 1;
- /**
- * Compare end boundary-point of sourceRange
to end
- * boundary-point of Range on which compareBoundaryPoints
- * is invoked.
- */
- public static final short END_TO_END = 2;
- /**
- * Compare end boundary-point of sourceRange
to start
- * boundary-point of Range on which compareBoundaryPoints
- * is invoked.
- */
- public static final short END_TO_START = 3;
-
- /**
- * Compare the boundary-points of two Ranges in a document.
- * @param how A code representing the type of comparison, as defined
- * above.
- * @param sourceRange The Range
on which this current
- * Range
is compared to.
- * @return -1, 0 or 1 depending on whether the corresponding
- * boundary-point of the Range is respectively before, equal to, or
- * after the corresponding boundary-point of sourceRange
.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the same
- * Document or DocumentFragment.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- */
- public short compareBoundaryPoints(short how,
- Range sourceRange)
- throws DOMException;
-
- /**
- * Removes the contents of a Range from the containing document or
- * document fragment without returning a reference to the removed
- * content.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
- * the Range is read-only or any of the nodes that contain any of the
- * content of the Range are read-only.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- */
- public void deleteContents()
- throws DOMException;
-
- /**
- * Moves the contents of a Range from the containing document or document
- * fragment to a new DocumentFragment.
- * @return A DocumentFragment containing the extracted contents.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
- * the Range is read-only or any of the nodes which contain any of the
- * content of the Range are read-only.
- *
HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be
- * extracted into the new DocumentFragment.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- */
- public DocumentFragment extractContents()
- throws DOMException;
-
- /**
- * Duplicates the contents of a Range
- * @return A DocumentFragment that contains content equivalent to this
- * Range.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be
- * extracted into the new DocumentFragment.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- */
- public DocumentFragment cloneContents()
- throws DOMException;
-
- /**
- * Inserts a node into the Document or DocumentFragment at the start of
- * the Range. If the container is a Text node, this will be split at the
- * start of the Range (as if the Text node's splitText method was
- * performed at the insertion point) and the insertion will occur
- * between the two resulting Text nodes. Adjacent Text nodes will not be
- * automatically merged. If the node to be inserted is a
- * DocumentFragment node, the children will be inserted rather than the
- * DocumentFragment node itself.
- * @param newNode The node to insert at the start of the Range
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the
- * start of the Range is read-only.
- *
WRONG_DOCUMENT_ERR: Raised if newNode
and the
- * container of the start of the Range were not created from the same
- * document.
- *
HIERARCHY_REQUEST_ERR: Raised if the container of the start of
- * the Range is of a type that does not allow children of the type of
- * newNode
or if newNode
is an ancestor of
- * the container.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if newNode
is an Attr,
- * Entity, Notation, or Document node.
- */
- public void insertNode(Node newNode)
- throws DOMException, RangeException;
-
- /**
- * Reparents the contents of the Range to the given node and inserts the
- * node at the position of the start of the Range.
- * @param newParent The node to surround the contents with.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of
- * either boundary-point of the Range is read-only.
- *
WRONG_DOCUMENT_ERR: Raised if newParent
and the
- * container of the start of the Range were not created from the same
- * document.
- *
HIERARCHY_REQUEST_ERR: Raised if the container of the start of
- * the Range is of a type that does not allow children of the type of
- * newParent
or if newParent
is an ancestor
- * of the container or if node
would end up with a child
- * node of a type not allowed by the type of node
.
- *
INVALID_STATE_ERR: Raised if detach()
has already
- * been invoked on this object.
- * @exception RangeException
- * BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a
- * non-text node.
- *
INVALID_NODE_TYPE_ERR: Raised if node
is an Attr,
- * Entity, DocumentType, Notation, Document, or DocumentFragment node.
- */
- public void surroundContents(Node newParent)
- throws DOMException, RangeException;
-
- /**
- * Produces a new Range whose boundary-points are equal to the
- * boundary-points of the Range.
- * @return The duplicated Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public Range cloneRange()
- throws DOMException;
-
- /**
- * Returns the contents of a Range as a string. This string contains only
- * the data characters, not any markup.
- * @return The contents of the Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public String toString()
- throws DOMException;
-
- /**
- * Called to indicate that the Range is no longer in use and that the
- * implementation may relinquish any resources associated with this
- * Range. Subsequent calls to any methods or attribute getters on this
- * Range will result in a DOMException
being thrown with an
- * error code of INVALID_STATE_ERR
.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if detach()
has already been
- * invoked on this object.
- */
- public void detach()
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/ranges/RangeException.java b/libjava/external/w3c_dom/org/w3c/dom/ranges/RangeException.java
deleted file mode 100644
index 551008e5dba..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/ranges/RangeException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.ranges;
-
-/**
- * Range operations may throw a RangeException
as specified in
- * their method descriptions.
- *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
- * @since DOM Level 2
- */
-public class RangeException extends RuntimeException {
- public RangeException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // RangeExceptionCode
- /**
- * If the boundary-points of a Range do not meet specific requirements.
- */
- public static final short BAD_BOUNDARYPOINTS_ERR = 1;
- /**
- * If the container of an boundary-point of a Range is being set to either
- * a node of an invalid type or a node with an ancestor of an invalid
- * type.
- */
- public static final short INVALID_NODE_TYPE_ERR = 2;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/DocumentStyle.java b/libjava/external/w3c_dom/org/w3c/dom/stylesheets/DocumentStyle.java
deleted file mode 100644
index 612a561135a..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/DocumentStyle.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-/**
- * The DocumentStyle
interface provides a mechanism by which the
- * style sheets embedded in a document can be retrieved. The expectation is
- * that an instance of the DocumentStyle
interface can be
- * obtained by using binding-specific casting methods on an instance of the
- * Document
interface.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface DocumentStyle {
- /**
- * A list containing all the style sheets explicitly linked into or
- * embedded in a document. For HTML documents, this includes external
- * style sheets, included via the HTML LINK element, and inline STYLE
- * elements. In XML, this includes external style sheets, included via
- * style sheet processing instructions (see [XML StyleSheet]).
- */
- public StyleSheetList getStyleSheets();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/LinkStyle.java b/libjava/external/w3c_dom/org/w3c/dom/stylesheets/LinkStyle.java
deleted file mode 100644
index 481bd19dbab..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/LinkStyle.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-/**
- * The LinkStyle
interface provides a mechanism by which a style
- * sheet can be retrieved from the node responsible for linking it into a
- * document. An instance of the LinkStyle
interface can be
- * obtained using binding-specific casting methods on an instance of a
- * linking node (HTMLLinkElement
, HTMLStyleElement
- * or ProcessingInstruction
in DOM Level 2).
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface LinkStyle {
- /**
- * The style sheet.
- */
- public StyleSheet getSheet();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/MediaList.java b/libjava/external/w3c_dom/org/w3c/dom/stylesheets/MediaList.java
deleted file mode 100644
index f83d5f13d62..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/MediaList.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The MediaList
interface provides the abstraction of an
- * ordered collection of media, without defining or constraining how this
- * collection is implemented. An empty list is the same as a list that
- * contains the medium "all"
.
- *
The items in the MediaList
are accessible via an integral
- * index, starting from 0.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface MediaList {
- /**
- * The parsable textual representation of the media list. This is a
- * comma-separated list of media.
- */
- public String getMediaText();
- /**
- * The parsable textual representation of the media list. This is a
- * comma-separated list of media.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified string value has a syntax error
- * and is unparsable.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is
- * readonly.
- */
- public void setMediaText(String mediaText)
- throws DOMException;
-
- /**
- * The number of media in the list. The range of valid media is
- * 0
to length-1
inclusive.
- */
- public int getLength();
-
- /**
- * Returns the index
th in the list. If index
is
- * greater than or equal to the number of media in the list, this
- * returns null
.
- * @param index Index into the collection.
- * @return The medium at the index
th position in the
- * MediaList
, or null
if that is not a valid
- * index.
- */
- public String item(int index);
-
- /**
- * Deletes the medium indicated by oldMedium
from the list.
- * @param oldMedium The medium to delete in the media list.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
- *
NOT_FOUND_ERR: Raised if oldMedium
is not in the
- * list.
- */
- public void deleteMedium(String oldMedium)
- throws DOMException;
-
- /**
- * Adds the medium newMedium
to the end of the list. If the
- * newMedium
is already used, it is first removed.
- * @param newMedium The new medium to add.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: If the medium contains characters that are
- * invalid in the underlying style language.
- *
NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
- */
- public void appendMedium(String newMedium)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/StyleSheet.java b/libjava/external/w3c_dom/org/w3c/dom/stylesheets/StyleSheet.java
deleted file mode 100644
index 3da43076994..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/StyleSheet.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-import org.w3c.dom.Node;
-
-/**
- * The StyleSheet
interface is the abstract base interface for
- * any type of style sheet. It represents a single style sheet associated
- * with a structured document. In HTML, the StyleSheet interface represents
- * either an external style sheet, included via the HTML LINK element, or
- * an inline STYLE element. In XML, this interface represents an external
- * style sheet, included via a style sheet processing instruction.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface StyleSheet {
- /**
- * This specifies the style sheet language for this style sheet. The
- * style sheet language is specified as a content type (e.g.
- * "text/css"). The content type is often specified in the
- * ownerNode
. Also see the type attribute definition for
- * the LINK
element in HTML 4.0, and the type
- * pseudo-attribute for the XML style sheet processing instruction.
- */
- public String getType();
-
- /**
- * false
if the style sheet is applied to the document.
- * true
if it is not. Modifying this attribute may cause a
- * new resolution of style for the document. A stylesheet only applies
- * if both an appropriate medium definition is present and the disabled
- * attribute is false. So, if the media doesn't apply to the current
- * user agent, the disabled
attribute is ignored.
- */
- public boolean getDisabled();
- /**
- * false
if the style sheet is applied to the document.
- * true
if it is not. Modifying this attribute may cause a
- * new resolution of style for the document. A stylesheet only applies
- * if both an appropriate medium definition is present and the disabled
- * attribute is false. So, if the media doesn't apply to the current
- * user agent, the disabled
attribute is ignored.
- */
- public void setDisabled(boolean disabled);
-
- /**
- * The node that associates this style sheet with the document. For HTML,
- * this may be the corresponding LINK
or STYLE
- * element. For XML, it may be the linking processing instruction. For
- * style sheets that are included by other style sheets, the value of
- * this attribute is null
.
- */
- public Node getOwnerNode();
-
- /**
- * For style sheet languages that support the concept of style sheet
- * inclusion, this attribute represents the including style sheet, if
- * one exists. If the style sheet is a top-level style sheet, or the
- * style sheet language does not support inclusion, the value of this
- * attribute is null
.
- */
- public StyleSheet getParentStyleSheet();
-
- /**
- * If the style sheet is a linked style sheet, the value of its attribute
- * is its location. For inline style sheets, the value of this attribute
- * is null
. See the href attribute definition for the
- * LINK
element in HTML 4.0, and the href pseudo-attribute
- * for the XML style sheet processing instruction.
- */
- public String getHref();
-
- /**
- * The advisory title. The title is often specified in the
- * ownerNode
. See the title attribute definition for the
- * LINK
element in HTML 4.0, and the title pseudo-attribute
- * for the XML style sheet processing instruction.
- */
- public String getTitle();
-
- /**
- * The intended destination media for style information. The media is
- * often specified in the ownerNode
. If no media has been
- * specified, the MediaList
will be empty. See the media
- * attribute definition for the LINK
element in HTML 4.0,
- * and the media pseudo-attribute for the XML style sheet processing
- * instruction . Modifying the media list may cause a change to the
- * attribute disabled
.
- */
- public MediaList getMedia();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/StyleSheetList.java b/libjava/external/w3c_dom/org/w3c/dom/stylesheets/StyleSheetList.java
deleted file mode 100644
index b8f9a442330..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/stylesheets/StyleSheetList.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-/**
- * The StyleSheetList
interface provides the abstraction of an
- * ordered collection of style sheets.
- *
The items in the StyleSheetList
are accessible via an
- * integral index, starting from 0.
- *
See also the Document Object Model (DOM) Level 2 Style Specification.
- * @since DOM Level 2
- */
-public interface StyleSheetList {
- /**
- * The number of StyleSheets
in the list. The range of valid
- * child stylesheet indices is 0
to length-1
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve a style sheet by ordinal index. If index is greater
- * than or equal to the number of style sheets in the list, this returns
- * null
.
- * @param index Index into the collection
- * @return The style sheet at the index
position in the
- * StyleSheetList
, or null
if that is not a
- * valid index.
- */
- public StyleSheet item(int index);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/traversal/DocumentTraversal.java b/libjava/external/w3c_dom/org/w3c/dom/traversal/DocumentTraversal.java
deleted file mode 100644
index bc45ad9f753..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/traversal/DocumentTraversal.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * DocumentTraversal
contains methods that create
- * NodeIterators
and TreeWalkers
to traverse a
- * node and its children in document order (depth first, pre-order
- * traversal, which is equivalent to the order in which the start tags occur
- * in the text representation of the document). In DOMs which support the
- * Traversal feature, DocumentTraversal
will be implemented by
- * the same objects that implement the Document interface.
- *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
- * @since DOM Level 2
- */
-public interface DocumentTraversal {
- /**
- * Create a new NodeIterator
over the subtree rooted at the
- * specified node.
- * @param root The node which will be iterated together with its
- * children. The NodeIterator
is initially positioned
- * just before this node. The whatToShow
flags and the
- * filter, if any, are not considered when setting this position. The
- * root must not be null
.
- * @param whatToShow This flag specifies which node types may appear in
- * the logical view of the tree presented by the
- * NodeIterator
. See the description of
- * NodeFilter
for the set of possible SHOW_
- * values.These flags can be combined using OR
.
- * @param filter The NodeFilter
to be used with this
- * NodeIterator
, or null
to indicate no
- * filter.
- * @param entityReferenceExpansion The value of this flag determines
- * whether entity reference nodes are expanded.
- * @return The newly created NodeIterator
.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the specified root
is
- * null
.
- */
- public NodeIterator createNodeIterator(Node root,
- int whatToShow,
- NodeFilter filter,
- boolean entityReferenceExpansion)
- throws DOMException;
-
- /**
- * Create a new TreeWalker
over the subtree rooted at the
- * specified node.
- * @param root The node which will serve as the root
for the
- * TreeWalker
. The whatToShow
flags and the
- * NodeFilter
are not considered when setting this value;
- * any node type will be accepted as the root
. The
- * currentNode
of the TreeWalker
is
- * initialized to this node, whether or not it is visible. The
- * root
functions as a stopping point for traversal
- * methods that look upward in the document structure, such as
- * parentNode
and nextNode. The root
must
- * not be null
.
- * @param whatToShow This flag specifies which node types may appear in
- * the logical view of the tree presented by the
- * TreeWalker
. See the description of
- * NodeFilter
for the set of possible SHOW_
- * values.These flags can be combined using OR
.
- * @param filter The NodeFilter
to be used with this
- * TreeWalker
, or null
to indicate no filter.
- * @param entityReferenceExpansion If this flag is false, the contents of
- * EntityReference
nodes are not presented in the logical
- * view.
- * @return The newly created TreeWalker
.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the specified root
is
- * null
.
- */
- public TreeWalker createTreeWalker(Node root,
- int whatToShow,
- NodeFilter filter,
- boolean entityReferenceExpansion)
- throws DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/traversal/NodeFilter.java b/libjava/external/w3c_dom/org/w3c/dom/traversal/NodeFilter.java
deleted file mode 100644
index b9beac476b3..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/traversal/NodeFilter.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-
-/**
- * Filters are objects that know how to "filter out" nodes. If a
- * NodeIterator
or TreeWalker
is given a
- * NodeFilter
, it applies the filter before it returns the next
- * node. If the filter says to accept the node, the traversal logic returns
- * it; otherwise, traversal looks for the next node and pretends that the
- * node that was rejected was not there.
- *
The DOM does not provide any filters. NodeFilter
is just an
- * interface that users can implement to provide their own filters.
- *
NodeFilters
do not need to know how to traverse from node
- * to node, nor do they need to know anything about the data structure that
- * is being traversed. This makes it very easy to write filters, since the
- * only thing they have to know how to do is evaluate a single node. One
- * filter may be used with a number of different kinds of traversals,
- * encouraging code reuse.
- *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
- * @since DOM Level 2
- */
-public interface NodeFilter {
- // Constants returned by acceptNode
- /**
- * Accept the node. Navigation methods defined for
- * NodeIterator
or TreeWalker
will return this
- * node.
- */
- public static final short FILTER_ACCEPT = 1;
- /**
- * Reject the node. Navigation methods defined for
- * NodeIterator
or TreeWalker
will not return
- * this node. For TreeWalker
, the children of this node
- * will also be rejected. NodeIterators
treat this as a
- * synonym for FILTER_SKIP
.
- */
- public static final short FILTER_REJECT = 2;
- /**
- * Skip this single node. Navigation methods defined for
- * NodeIterator
or TreeWalker
will not return
- * this node. For both NodeIterator
and
- * TreeWalker
, the children of this node will still be
- * considered.
- */
- public static final short FILTER_SKIP = 3;
-
- // Constants for whatToShow
- /**
- * Show all Nodes
.
- */
- public static final int SHOW_ALL = 0xFFFFFFFF;
- /**
- * Show Element
nodes.
- */
- public static final int SHOW_ELEMENT = 0x00000001;
- /**
- * Show Attr
nodes. This is meaningful only when creating an
- * NodeIterator
or TreeWalker
with an
- * attribute node as its root
; in this case, it means that
- * the attribute node will appear in the first position of the iteration
- * or traversal. Since attributes are never children of other nodes,
- * they do not appear when traversing over the document tree.
- */
- public static final int SHOW_ATTRIBUTE = 0x00000002;
- /**
- * Show Text
nodes.
- */
- public static final int SHOW_TEXT = 0x00000004;
- /**
- * Show CDATASection
nodes.
- */
- public static final int SHOW_CDATA_SECTION = 0x00000008;
- /**
- * Show EntityReference
nodes.
- */
- public static final int SHOW_ENTITY_REFERENCE = 0x00000010;
- /**
- * Show Entity
nodes. This is meaningful only when creating
- * an NodeIterator
or TreeWalker
with an
- * Entity
node as its root
; in this case, it
- * means that the Entity
node will appear in the first
- * position of the traversal. Since entities are not part of the
- * document tree, they do not appear when traversing over the document
- * tree.
- */
- public static final int SHOW_ENTITY = 0x00000020;
- /**
- * Show ProcessingInstruction
nodes.
- */
- public static final int SHOW_PROCESSING_INSTRUCTION = 0x00000040;
- /**
- * Show Comment
nodes.
- */
- public static final int SHOW_COMMENT = 0x00000080;
- /**
- * Show Document
nodes.
- */
- public static final int SHOW_DOCUMENT = 0x00000100;
- /**
- * Show DocumentType
nodes.
- */
- public static final int SHOW_DOCUMENT_TYPE = 0x00000200;
- /**
- * Show DocumentFragment
nodes.
- */
- public static final int SHOW_DOCUMENT_FRAGMENT = 0x00000400;
- /**
- * Show Notation
nodes. This is meaningful only when creating
- * an NodeIterator
or TreeWalker
with a
- * Notation
node as its root
; in this case, it
- * means that the Notation
node will appear in the first
- * position of the traversal. Since notations are not part of the
- * document tree, they do not appear when traversing over the document
- * tree.
- */
- public static final int SHOW_NOTATION = 0x00000800;
-
- /**
- * Test whether a specified node is visible in the logical view of a
- * TreeWalker
or NodeIterator
. This function
- * will be called by the implementation of TreeWalker
and
- * NodeIterator
; it is not normally called directly from
- * user code. (Though you could do so if you wanted to use the same
- * filter to guide your own application logic.)
- * @param n The node to check to see if it passes the filter or not.
- * @return A constant to determine whether the node is accepted,
- * rejected, or skipped, as defined above.
- */
- public short acceptNode(Node n);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/traversal/NodeIterator.java b/libjava/external/w3c_dom/org/w3c/dom/traversal/NodeIterator.java
deleted file mode 100644
index d1f0d08399d..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/traversal/NodeIterator.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * NodeIterators
are used to step through a set of nodes, e.g.
- * the set of nodes in a NodeList
, the document subtree
- * governed by a particular Node
, the results of a query, or
- * any other set of nodes. The set of nodes to be iterated is determined by
- * the implementation of the NodeIterator
. DOM Level 2
- * specifies a single NodeIterator
implementation for
- * document-order traversal of a document subtree. Instances of these
- * NodeIterators
are created by calling
- * DocumentTraversal
.createNodeIterator()
.
- *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
- * @since DOM Level 2
- */
-public interface NodeIterator {
- /**
- * The root node of the NodeIterator
, as specified when it
- * was created.
- */
- public Node getRoot();
-
- /**
- * This attribute determines which node types are presented via the
- * NodeIterator
. The available set of constants is defined
- * in the NodeFilter
interface. Nodes not accepted by
- * whatToShow
will be skipped, but their children may still
- * be considered. Note that this skip takes precedence over the filter,
- * if any.
- */
- public int getWhatToShow();
-
- /**
- * The NodeFilter
used to screen nodes.
- */
- public NodeFilter getFilter();
-
- /**
- * The value of this flag determines whether the children of entity
- * reference nodes are visible to the NodeIterator
. If
- * false, these children and their descendants will be rejected. Note
- * that this rejection takes precedence over whatToShow
and
- * the filter. Also note that this is currently the only situation where
- * NodeIterators
may reject a complete subtree rather than
- * skipping individual nodes.
- *
- *
To produce a view of the document that has entity references
- * expanded and does not expose the entity reference node itself, use
- * the whatToShow
flags to hide the entity reference node
- * and set expandEntityReferences
to true when creating the
- * NodeIterator
. To produce a view of the document that has
- * entity reference nodes but no entity expansion, use the
- * whatToShow
flags to show the entity reference node and
- * set expandEntityReferences
to false.
- */
- public boolean getExpandEntityReferences();
-
- /**
- * Returns the next node in the set and advances the position of the
- * NodeIterator
in the set. After a
- * NodeIterator
is created, the first call to
- * nextNode()
returns the first node in the set.
- * @return The next Node
in the set being iterated over, or
- * null
if there are no more members in that set.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if this method is called after the
- * detach
method was invoked.
- */
- public Node nextNode()
- throws DOMException;
-
- /**
- * Returns the previous node in the set and moves the position of the
- * NodeIterator
backwards in the set.
- * @return The previous Node
in the set being iterated over,
- * or null
if there are no more members in that set.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if this method is called after the
- * detach
method was invoked.
- */
- public Node previousNode()
- throws DOMException;
-
- /**
- * Detaches the NodeIterator
from the set which it iterated
- * over, releasing any computational resources and placing the
- * NodeIterator
in the INVALID state. After
- * detach
has been invoked, calls to nextNode
- * or previousNode
will raise the exception
- * INVALID_STATE_ERR.
- */
- public void detach();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/traversal/TreeWalker.java b/libjava/external/w3c_dom/org/w3c/dom/traversal/TreeWalker.java
deleted file mode 100644
index f5fff86be09..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/traversal/TreeWalker.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * TreeWalker
objects are used to navigate a document tree or
- * subtree using the view of the document defined by their
- * whatToShow
flags and filter (if any). Any function which
- * performs navigation using a TreeWalker
will automatically
- * support any view defined by a TreeWalker
.
- *
Omitting nodes from the logical view of a subtree can result in a
- * structure that is substantially different from the same subtree in the
- * complete, unfiltered document. Nodes that are siblings in the
- * TreeWalker
view may be children of different, widely
- * separated nodes in the original view. For instance, consider a
- * NodeFilter
that skips all nodes except for Text nodes and
- * the root node of a document. In the logical view that results, all text
- * nodes will be siblings and appear as direct children of the root node, no
- * matter how deeply nested the structure of the original document.
- *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
- * @since DOM Level 2
- */
-public interface TreeWalker {
- /**
- * The root
node of the TreeWalker
, as specified
- * when it was created.
- */
- public Node getRoot();
-
- /**
- * This attribute determines which node types are presented via the
- * TreeWalker
. The available set of constants is defined in
- * the NodeFilter
interface. Nodes not accepted by
- * whatToShow
will be skipped, but their children may still
- * be considered. Note that this skip takes precedence over the filter,
- * if any.
- */
- public int getWhatToShow();
-
- /**
- * The filter used to screen nodes.
- */
- public NodeFilter getFilter();
-
- /**
- * The value of this flag determines whether the children of entity
- * reference nodes are visible to the TreeWalker
. If false,
- * these children and their descendants will be rejected. Note that
- * this rejection takes precedence over whatToShow
and the
- * filter, if any.
- *
To produce a view of the document that has entity references
- * expanded and does not expose the entity reference node itself, use
- * the whatToShow
flags to hide the entity reference node
- * and set expandEntityReferences
to true when creating the
- * TreeWalker
. To produce a view of the document that has
- * entity reference nodes but no entity expansion, use the
- * whatToShow
flags to show the entity reference node and
- * set expandEntityReferences
to false.
- */
- public boolean getExpandEntityReferences();
-
- /**
- * The node at which the TreeWalker
is currently positioned.
- *
Alterations to the DOM tree may cause the current node to no longer
- * be accepted by the TreeWalker
's associated filter.
- * currentNode
may also be explicitly set to any node,
- * whether or not it is within the subtree specified by the
- * root
node or would be accepted by the filter and
- * whatToShow
flags. Further traversal occurs relative to
- * currentNode
even if it is not part of the current view,
- * by applying the filters in the requested direction; if no traversal
- * is possible, currentNode
is not changed.
- */
- public Node getCurrentNode();
- /**
- * The node at which the TreeWalker
is currently positioned.
- *
Alterations to the DOM tree may cause the current node to no longer
- * be accepted by the TreeWalker
's associated filter.
- * currentNode
may also be explicitly set to any node,
- * whether or not it is within the subtree specified by the
- * root
node or would be accepted by the filter and
- * whatToShow
flags. Further traversal occurs relative to
- * currentNode
even if it is not part of the current view,
- * by applying the filters in the requested direction; if no traversal
- * is possible, currentNode
is not changed.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if an attempt is made to set
- * currentNode
to null
.
- */
- public void setCurrentNode(Node currentNode)
- throws DOMException;
-
- /**
- * Moves to and returns the closest visible ancestor node of the current
- * node. If the search for parentNode
attempts to step
- * upward from the TreeWalker
's root
node, or
- * if it fails to find a visible ancestor node, this method retains the
- * current position and returns null
.
- * @return The new parent node, or null
if the current node
- * has no parent in the TreeWalker
's logical view.
- */
- public Node parentNode();
-
- /**
- * Moves the TreeWalker
to the first visible child of the
- * current node, and returns the new node. If the current node has no
- * visible children, returns null
, and retains the current
- * node.
- * @return The new node, or null
if the current node has no
- * visible children in the TreeWalker
's logical view.
- */
- public Node firstChild();
-
- /**
- * Moves the TreeWalker
to the last visible child of the
- * current node, and returns the new node. If the current node has no
- * visible children, returns null
, and retains the current
- * node.
- * @return The new node, or null
if the current node has no
- * children in the TreeWalker
's logical view.
- */
- public Node lastChild();
-
- /**
- * Moves the TreeWalker
to the previous sibling of the
- * current node, and returns the new node. If the current node has no
- * visible previous sibling, returns null
, and retains the
- * current node.
- * @return The new node, or null
if the current node has no
- * previous sibling. in the TreeWalker
's logical view.
- */
- public Node previousSibling();
-
- /**
- * Moves the TreeWalker
to the next sibling of the current
- * node, and returns the new node. If the current node has no visible
- * next sibling, returns null
, and retains the current node.
- * @return The new node, or null
if the current node has no
- * next sibling. in the TreeWalker
's logical view.
- */
- public Node nextSibling();
-
- /**
- * Moves the TreeWalker
to the previous visible node in
- * document order relative to the current node, and returns the new
- * node. If the current node has no previous node, or if the search for
- * previousNode
attempts to step upward from the
- * TreeWalker
's root
node, returns
- * null
, and retains the current node.
- * @return The new node, or null
if the current node has no
- * previous node in the TreeWalker
's logical view.
- */
- public Node previousNode();
-
- /**
- * Moves the TreeWalker
to the next visible node in document
- * order relative to the current node, and returns the new node. If the
- * current node has no next node, or if the search for nextNode attempts
- * to step upward from the TreeWalker
's root
- * node, returns null
, and retains the current node.
- * @return The new node, or null
if the current node has no
- * next node in the TreeWalker
's logical view.
- */
- public Node nextNode();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/views/AbstractView.java b/libjava/external/w3c_dom/org/w3c/dom/views/AbstractView.java
deleted file mode 100644
index 97e8f0e2b0b..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/views/AbstractView.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.views;
-
-/**
- * A base interface that all views shall derive from.
- *
See also the Document Object Model (DOM) Level 2 Views Specification.
- * @since DOM Level 2
- */
-public interface AbstractView {
- /**
- * The source DocumentView
of which this is an
- * AbstractView
.
- */
- public DocumentView getDocument();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/views/DocumentView.java b/libjava/external/w3c_dom/org/w3c/dom/views/DocumentView.java
deleted file mode 100644
index 2cb9eebb84b..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/views/DocumentView.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.views;
-
-/**
- * The DocumentView
interface is implemented by
- * Document
objects in DOM implementations supporting DOM
- * Views. It provides an attribute to retrieve the default view of a
- * document.
- *
See also the Document Object Model (DOM) Level 2 Views Specification.
- * @since DOM Level 2
- */
-public interface DocumentView {
- /**
- * The default AbstractView
for this Document
,
- * or null
if none available.
- */
- public AbstractView getDefaultView();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java b/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java
deleted file mode 100644
index a85c0e811da..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.xpath;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * The evaluation of XPath expressions is provided by
- * XPathEvaluator
. In a DOM implementation which supports the
- * XPath 3.0 feature, as described above, the XPathEvaluator
- * interface will be implemented on the same object which implements the
- * Document
interface permitting it to be obtained by the usual
- * binding-specific method such as casting or by using the DOM Level 3
- * getInterface method. In this case the implementation obtained from the
- * Document supports the XPath DOM module and is compatible with the XPath
- * 1.0 specification.
- *
Evaluation of expressions with specialized extension functions or
- * variables may not work in all implementations and is, therefore, not
- * portable. XPathEvaluator
implementations may be available
- * from other sources that could provide specific support for specialized
- * extension functions or variables as would be defined by other
- * specifications.
- *
See also the Document Object Model (DOM) Level 3 XPath Specification.
- */
-public interface XPathEvaluator {
- /**
- * Creates a parsed XPath expression with resolved namespaces. This is
- * useful when an expression will be reused in an application since it
- * makes it possible to compile the expression string into a more
- * efficient internal form and preresolve all namespace prefixes which
- * occur within the expression.
- * @param expression The XPath expression string to be parsed.
- * @param resolver The resolver
permits translation of all
- * prefixes, including the xml
namespace prefix, within
- * the XPath expression into appropriate namespace URIs. If this is
- * specified as null
, any namespace prefix within the
- * expression will result in DOMException
being thrown
- * with the code NAMESPACE_ERR
.
- * @return The compiled form of the XPath expression.
- * @exception XPathException
- * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
- * according to the rules of the XPathEvaluator
.
- * @exception DOMException
- * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
- * which cannot be resolved by the specified
- * XPathNSResolver
.
- */
- public XPathExpression createExpression(String expression,
- XPathNSResolver resolver)
- throws XPathException, DOMException;
-
- /**
- * Adapts any DOM node to resolve namespaces so that an XPath expression
- * can be easily evaluated relative to the context of the node where it
- * appeared within the document. This adapter works like the DOM Level 3
- * method lookupNamespaceURI
on nodes in resolving the
- * namespaceURI from a given prefix using the current information
- * available in the node's hierarchy at the time lookupNamespaceURI is
- * called. also correctly resolving the implicit xml prefix.
- * @param nodeResolver The node to be used as a context for namespace
- * resolution.
- * @return XPathNSResolver
which resolves namespaces with
- * respect to the definitions in scope for a specified node.
- */
- public XPathNSResolver createNSResolver(Node nodeResolver);
-
- /**
- * Evaluates an XPath expression string and returns a result of the
- * specified type if possible.
- * @param expression The XPath expression string to be parsed and
- * evaluated.
- * @param contextNode The context
is context node for the
- * evaluation of this XPath expression. If the XPathEvaluator was
- * obtained by casting the Document
then this must be
- * owned by the same document and must be a Document
,
- * Element
, Attribute
, Text
,
- * CDATASection
, Comment
,
- * ProcessingInstruction
, or XPathNamespace
- * node. If the context node is a Text
or a
- * CDATASection
, then the context is interpreted as the
- * whole logical text node as seen by XPath, unless the node is empty
- * in which case it may not serve as the XPath context.
- * @param resolver The resolver
permits translation of all
- * prefixes, including the xml
namespace prefix, within
- * the XPath expression into appropriate namespace URIs. If this is
- * specified as null
, any namespace prefix within the
- * expression will result in DOMException
being thrown
- * with the code NAMESPACE_ERR
.
- * @param type If a specific type
is specified, then the
- * result will be returned as the corresponding type.For XPath 1.0
- * results, this must be one of the codes of the
- * XPathResult
interface.
- * @param result The result
specifies a specific result
- * object which may be reused and returned by this method. If this is
- * specified as null
or the implementation does not reuse
- * the specified result, a new result object will be constructed and
- * returned.For XPath 1.0 results, this object will be of type
- * XPathResult
.
- * @return The result of the evaluation of the XPath expression.For XPath
- * 1.0 results, this object will be of type XPathResult
.
- * @exception XPathException
- * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
- * according to the rules of the XPathEvaluator
i
- *
TYPE_ERR: Raised if the result cannot be converted to return the
- * specified type.
- * @exception DOMException
- * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
- * which cannot be resolved by the specified
- * XPathNSResolver
.
- *
WRONG_DOCUMENT_ERR: The Node is from a document that is not
- * supported by this XPathEvaluator
.
- *
NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
- * context node or the request type is not permitted by this
- * XPathEvaluator
.
- */
- public Object evaluate(String expression,
- Node contextNode,
- XPathNSResolver resolver,
- short type,
- Object result)
- throws XPathException, DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathException.java b/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathException.java
deleted file mode 100644
index deb1bd78394..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.xpath;
-
-/**
- * A new exception has been created for exceptions specific to these XPath
- * interfaces.
- *
See also the Document Object Model (DOM) Level 3 XPath Specification.
- */
-public class XPathException extends RuntimeException {
- public XPathException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // XPathExceptionCode
- /**
- * If the expression has a syntax error or otherwise is not a legal
- * expression according to the rules of the specific
- * XPathEvaluator
or contains specialized extension
- * functions or variables not supported by this implementation.
- */
- public static final short INVALID_EXPRESSION_ERR = 51;
- /**
- * If the expression cannot be converted to return the specified type.
- */
- public static final short TYPE_ERR = 52;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java b/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java
deleted file mode 100644
index e972532544d..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.xpath;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * The XPathExpression
interface represents a parsed and resolved
- * XPath expression.
- *
See also the Document Object Model (DOM) Level 3 XPath Specification.
- */
-public interface XPathExpression {
- /**
- * Evaluates this XPath expression and returns a result.
- * @param contextNode The context
is context node for the
- * evaluation of this XPath expression.If the XPathEvaluator was
- * obtained by casting the Document
then this must be
- * owned by the same document and must be a Document
,
- * Element
, Attribute
, Text
,
- * CDATASection
, Comment
,
- * ProcessingInstruction
, or XPathNamespace
- * node.If the context node is a Text
or a
- * CDATASection
, then the context is interpreted as the
- * whole logical text node as seen by XPath, unless the node is empty
- * in which case it may not serve as the XPath context.
- * @param type If a specific type
is specified, then the
- * result will be coerced to return the specified type relying on
- * XPath conversions and fail if the desired coercion is not possible.
- * This must be one of the type codes of XPathResult
.
- * @param result The result
specifies a specific result
- * object which may be reused and returned by this method. If this is
- * specified as null
or the implementation does not reuse
- * the specified result, a new result object will be constructed and
- * returned.For XPath 1.0 results, this object will be of type
- * XPathResult
.
- * @return The result of the evaluation of the XPath expression.For XPath
- * 1.0 results, this object will be of type XPathResult
.
- * @exception XPathException
- * TYPE_ERR: Raised if the result cannot be converted to return the
- * specified type.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: The Node is from a document that is not supported
- * by the XPathEvaluator that created this XPathExpression
- * .
- *
NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
- * context node or the request type is not permitted by this
- * XPathExpression
.
- */
- public Object evaluate(Node contextNode,
- short type,
- Object result)
- throws XPathException, DOMException;
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java b/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java
deleted file mode 100644
index b8f05213812..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.xpath;
-
-/**
- * The XPathNSResolver
interface permit prefix
- * strings in the expression to be properly bound to
- * namespaceURI
strings. XPathEvaluator
can
- * construct an implementation of XPathNSResolver
from a node,
- * or the interface may be implemented by any application.
- *
See also the Document Object Model (DOM) Level 3 XPath Specification.
- */
-public interface XPathNSResolver {
- /**
- * Look up the namespace URI associated to the given namespace prefix. The
- * XPath evaluator must never call this with a null
or
- * empty argument, because the result of doing this is undefined.
- * @param prefix The prefix to look for.
- * @return Returns the associated namespace URI or null
if
- * none is found.
- */
- public String lookupNamespaceURI(String prefix);
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java b/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java
deleted file mode 100644
index 9f15481d584..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.xpath;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * The XPathNamespace
interface is returned by
- * XPathResult
interfaces to represent the XPath namespace node
- * type that DOM lacks. There is no public constructor for this node type.
- * Attempts to place it into a hierarchy or a NamedNodeMap result in a
- * DOMException
with the code HIERARCHY_REQUEST_ERR
- * . This node is read only, so methods or setting of attributes that would
- * mutate the node result in a DOMException with the code
- * NO_MODIFICATION_ALLOWED_ERR
.
- *
The core specification describes attributes of the Node
- * interface that are different for different node types but does not
- * describe XPATH_NAMESPACE_NODE
, so here is a description of
- * those attributes for this node type. All attributes of Node
- * not described in this section have a null
or
- * false
value.
- *
ownerDocument
matches the ownerDocument
of the
- * ownerElement
even if the element is later adopted.
- *
nodeName
is always the string "#namespace
".
- *
prefix
is the prefix of the namespace represented by the
- * node.
- *
localName
is the same as prefix
.
- *
nodeType
is equal to XPATH_NAMESPACE_NODE
.
- *
namespaceURI
is the namespace URI of the namespace
- * represented by the node.
- *
nodeValue
is the same as namespaceURI
.
- *
adoptNode
, cloneNode
, and
- * importNode
fail on this node type by raising a
- * DOMException
with the code NOT_SUPPORTED_ERR
.
- *
Note: In future versions of the XPath specification, the - * definition of a namespace node may be changed incomatibly, in which case - * incompatible changes to field values may be required to implement - * versions beyond XPath 1.0. - *
See also the Document Object Model (DOM) Level 3 XPath Specification.
- */
-public interface XPathNamespace extends Node {
- // XPathNodeType
- /**
- * The node is a Namespace
.
- */
- public static final short XPATH_NAMESPACE_NODE = 13;
-
- /**
- * The Element
on which the namespace was in scope when it
- * was requested. This does not change on a returned namespace node even
- * if the document changes such that the namespace goes out of scope on
- * that element and this node is no longer found there by XPath.
- */
- public Element getOwnerElement();
-
-}
diff --git a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java b/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java
deleted file mode 100644
index 56064b90ecf..00000000000
--- a/libjava/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 2004 World Wide Web Consortium,
- *
- * (Massachusetts Institute of Technology, European Research Consortium for
- * Informatics and Mathematics, Keio University). All Rights Reserved. This
- * work is distributed under the W3C(r) Software License [1] in the hope that
- * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
- */
-
-package org.w3c.dom.xpath;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * The XPathResult
interface represents the result of the
- * evaluation of an XPath 1.0 expression within the context of a particular
- * node. Since evaluation of an XPath expression can result in various
- * result types, this object makes it possible to discover and manipulate
- * the type and value of the result.
- *
See also the Document Object Model (DOM) Level 3 XPath Specification.
- */
-public interface XPathResult {
- // XPathResultType
- /**
- * This code does not represent a specific type. An evaluation of an XPath
- * expression will never produce this type. If this type is requested,
- * then the evaluation returns whatever type naturally results from
- * evaluation of the expression.
- *
If the natural result is a node set when ANY_TYPE
was
- * requested, then UNORDERED_NODE_ITERATOR_TYPE
is always
- * the resulting type. Any other representation of a node set must be
- * explicitly requested.
- */
- public static final short ANY_TYPE = 0;
- /**
- * The result is a number as defined by [XPath 1.0].
- * Document modification does not invalidate the number, but may mean
- * that reevaluation would not yield the same number.
- */
- public static final short NUMBER_TYPE = 1;
- /**
- * The result is a string as defined by [XPath 1.0].
- * Document modification does not invalidate the string, but may mean
- * that the string no longer corresponds to the current document.
- */
- public static final short STRING_TYPE = 2;
- /**
- * The result is a boolean as defined by [XPath 1.0].
- * Document modification does not invalidate the boolean, but may mean
- * that reevaluation would not yield the same boolean.
- */
- public static final short BOOLEAN_TYPE = 3;
- /**
- * The result is a node set as defined by [XPath 1.0] that
- * will be accessed iteratively, which may not produce nodes in a
- * particular order. Document modification invalidates the iteration.
- *
This is the default type returned if the result is a node set and
- * ANY_TYPE
is requested.
- */
- public static final short UNORDERED_NODE_ITERATOR_TYPE = 4;
- /**
- * The result is a node set as defined by [XPath 1.0] that
- * will be accessed iteratively, which will produce document-ordered
- * nodes. Document modification invalidates the iteration.
- */
- public static final short ORDERED_NODE_ITERATOR_TYPE = 5;
- /**
- * The result is a node set as defined by [XPath 1.0] that
- * will be accessed as a snapshot list of nodes that may not be in a
- * particular order. Document modification does not invalidate the
- * snapshot but may mean that reevaluation would not yield the same
- * snapshot and nodes in the snapshot may have been altered, moved, or
- * removed from the document.
- */
- public static final short UNORDERED_NODE_SNAPSHOT_TYPE = 6;
- /**
- * The result is a node set as defined by [XPath 1.0] that
- * will be accessed as a snapshot list of nodes that will be in original
- * document order. Document modification does not invalidate the
- * snapshot but may mean that reevaluation would not yield the same
- * snapshot and nodes in the snapshot may have been altered, moved, or
- * removed from the document.
- */
- public static final short ORDERED_NODE_SNAPSHOT_TYPE = 7;
- /**
- * The result is a node set as defined by [XPath 1.0] and
- * will be accessed as a single node, which may be null
if
- * the node set is empty. Document modification does not invalidate the
- * node, but may mean that the result node no longer corresponds to the
- * current document. This is a convenience that permits optimization
- * since the implementation can stop once any node in the resulting set
- * has been found.
- *
If there is more than one node in the actual result, the single
- * node returned might not be the first in document order.
- */
- public static final short ANY_UNORDERED_NODE_TYPE = 8;
- /**
- * The result is a node set as defined by [XPath 1.0] and
- * will be accessed as a single node, which may be null
if
- * the node set is empty. Document modification does not invalidate the
- * node, but may mean that the result node no longer corresponds to the
- * current document. This is a convenience that permits optimization
- * since the implementation can stop once the first node in document
- * order of the resulting set has been found.
- *
If there are more than one node in the actual result, the single
- * node returned will be the first in document order.
- */
- public static final short FIRST_ORDERED_NODE_TYPE = 9;
-
- /**
- * A code representing the type of this result, as defined by the type
- * constants.
- */
- public short getResultType();
-
- /**
- * The value of this number result. If the native double type of the DOM
- * binding does not directly support the exact IEEE 754 result of the
- * XPath expression, then it is up to the definition of the binding to
- * specify how the XPath number is converted to the native binding
- * number.
- * @exception XPathException
- * TYPE_ERR: raised if resultType
is not
- * NUMBER_TYPE
.
- */
- public double getNumberValue()
- throws XPathException;
-
- /**
- * The value of this string result.
- * @exception XPathException
- * TYPE_ERR: raised if resultType
is not
- * STRING_TYPE
.
- */
- public String getStringValue()
- throws XPathException;
-
- /**
- * The value of this boolean result.
- * @exception XPathException
- * TYPE_ERR: raised if resultType
is not
- * BOOLEAN_TYPE
.
- */
- public boolean getBooleanValue()
- throws XPathException;
-
- /**
- * The value of this single node result, which may be null
.
- * @exception XPathException
- * TYPE_ERR: raised if resultType
is not
- * ANY_UNORDERED_NODE_TYPE
or
- * FIRST_ORDERED_NODE_TYPE
.
- */
- public Node getSingleNodeValue()
- throws XPathException;
-
- /**
- * Signifies that the iterator has become invalid. True if
- * resultType
is UNORDERED_NODE_ITERATOR_TYPE
- * or ORDERED_NODE_ITERATOR_TYPE
and the document has been
- * modified since this result was returned.
- */
- public boolean getInvalidIteratorState();
-
- /**
- * The number of nodes in the result snapshot. Valid values for
- * snapshotItem indices are 0
to
- * snapshotLength-1
inclusive.
- * @exception XPathException
- * TYPE_ERR: raised if resultType
is not
- * UNORDERED_NODE_SNAPSHOT_TYPE
or
- * ORDERED_NODE_SNAPSHOT_TYPE
.
- */
- public int getSnapshotLength()
- throws XPathException;
-
- /**
- * Iterates and returns the next node from the node set or
- * null
if there are no more nodes.
- * @return Returns the next node.
- * @exception XPathException
- * TYPE_ERR: raised if resultType
is not
- * UNORDERED_NODE_ITERATOR_TYPE
or
- * ORDERED_NODE_ITERATOR_TYPE
.
- * @exception DOMException
- * INVALID_STATE_ERR: The document has been mutated since the result was
- * returned.
- */
- public Node iterateNext()
- throws XPathException, DOMException;
-
- /**
- * Returns the index
th item in the snapshot collection. If
- * index
is greater than or equal to the number of nodes in
- * the list, this method returns null
. Unlike the iterator
- * result, the snapshot does not become invalid, but may not correspond
- * to the current document if it is mutated.
- * @param index Index into the snapshot collection.
- * @return The node at the index
th position in the
- * NodeList
, or null
if that is not a valid
- * index.
- * @exception XPathException
- * TYPE_ERR: raised if resultType
is not
- * UNORDERED_NODE_SNAPSHOT_TYPE
or
- * ORDERED_NODE_SNAPSHOT_TYPE
.
- */
- public Node snapshotItem(int index)
- throws XPathException;
-
-}
diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in
index a357231c683..56189d7a7d9 100644
--- a/libjava/gcj/Makefile.in
+++ b/libjava/gcj/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -43,14 +43,12 @@ DIST_COMMON = $(gcj_HEADERS) $(srcdir)/Makefile.am \
$(toolgcj_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
- $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gxx-include-dir.m4 \
$(top_srcdir)/../config/iconv.m4 \
$(top_srcdir)/../config/lcmessage.m4 \
- $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
- $(top_srcdir)/../config/lib-prefix.m4 $(top_srcdir)/pkg.m4 \
+ $(top_srcdir)/../config/lib-prefix.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
diff --git a/libjava/gnu/classpath/Configuration.java.in b/libjava/gnu/classpath/Configuration.java.in
deleted file mode 100644
index f1c6bc5680d..00000000000
--- a/libjava/gnu/classpath/Configuration.java.in
+++ /dev/null
@@ -1,62 +0,0 @@
-/* gnu.classpath.Configuration
- Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.classpath;
-
-/**
- * This file defines compile-time constants that can be accessed by
- * java code. It is pre-processed by configure.
- */
-public interface Configuration
-{
- // The value of DEBUG is substituted according to whether the
- // "--enable-libgcj-debug" argument was passed to configure. Code
- // which is made conditional based on the value of this flag will
- // be removed by the optimizer in a non-debug build.
- boolean DEBUG = @LIBGCJDEBUG@;
-
- // For libgcj we never load the JNI libraries.
- boolean INIT_LOAD_LIBRARY = false;
-
- // For libgcj we have native methods for dynamic proxy support....
- boolean HAVE_NATIVE_GET_PROXY_DATA = false;
- boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
- boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
-
- // Name of default AWT peer library.
- String default_awt_peer_toolkit = "@TOOLKIT@";
-}
diff --git a/libjava/gnu/classpath/ServiceFactory.java b/libjava/gnu/classpath/ServiceFactory.java
deleted file mode 100644
index 711a9042cbf..00000000000
--- a/libjava/gnu/classpath/ServiceFactory.java
+++ /dev/null
@@ -1,573 +0,0 @@
-/* ServiceFactory.java -- Factory for plug-in services.
- Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-
-/**
- * A factory for plug-ins that conform to a service provider
- * interface. This is a general mechanism that gets used by a number
- * of packages in the Java API. For instance, {@link
- * java.nio.charset.spi.CharsetProvider} allows to write custom
- * encoders and decoders for character sets, {@link
- * javax.imageio.spi.ImageReaderSpi} allows to support custom image
- * formats, and {@link javax.print.PrintService} makes it possible to
- * write custom printer drivers.
- *
- *
The plug-ins are concrete implementations of the service - * provider interface, which is defined as an interface or an abstract - * class. The implementation classes must be public and have a public - * constructor that takes no arguments. - * - *
Plug-ins are usually deployed in JAR files. A JAR that provides
- * an implementation of a service must declare this in a resource file
- * whose name is the fully qualified service name and whose location
- * is the directory META-INF/services
. This UTF-8 encoded
- * text file lists, on separate lines, the fully qualified names of
- * the concrete implementations. Thus, one JAR file can provide an
- * arbitrary number of implementations for an arbitrary count of
- * service provider interfaces.
- *
- *
Example - * - *
For example, a JAR might provide two implementations of the
- * service provider interface org.foo.ThinkService
,
- * namely com.acme.QuickThinker
and
- * com.acme.DeepThinker
. The code for QuickThinker
- * woud look as follows:
- *
- *
- * package com.acme; - * - * /** - * * Provices a super-quick, but not very deep implementation of ThinkService. - * */ - * public class QuickThinker - * implements org.foo.ThinkService - * { - * /** - * * Constructs a new QuickThinker. The service factory (which is - * * part of the Java environment) calls this no-argument constructor - * * when it looks up the available implementations of ThinkService. - * * - * * <p>Note that an application might query all available - * * ThinkService providers, but use just one of them. Therefore, - * * constructing an instance should be very inexpensive. For example, - * * large data structures should only be allocated when the service - * * actually gets used. - * */ - * public QuickThinker() - * { - * } - * - * /** - * * Returns the speed of this ThinkService in thoughts per second. - * * Applications can choose among the available service providers - * * based on this value. - * */ - * public double getSpeed() - * { - * return 314159.2654; - * } - * - * /** - * * Produces a thought. While the returned thoughts are not very - * * deep, they are generated in very short time. - * */ - * public Thought think() - * { - * return null; - * } - * } - *- * - *
The code for com.acme.DeepThinker
is left as an
- * exercise to the reader.
- *
- *
Acme’s ThinkService
plug-in gets deployed as
- * a JAR file. Besides the bytecode and resources for
- * QuickThinker
and DeepThinker
, it also
- * contains the text file
- * META-INF/services/org.foo.ThinkService
:
- *
- *
- * # Available implementations of org.foo.ThinkService - * com.acme.QuickThinker - * com.acme.DeepThinker - *- * - *
Thread Safety - * - *
It is safe to use ServiceFactory
from multiple
- * concurrent threads without external synchronization.
- *
- *
Note for User Applications - * - *
User applications that want to load plug-ins should not directly
- * use gnu.classpath.ServiceFactory
, because this class
- * is only available in Java environments that are based on GNU
- * Classpath. Instead, it is recommended that user applications call
- * {@link
- * javax.imageio.spi.ServiceRegistry#lookupProviders(Class)}. This API
- * is actually independent of image I/O, and it is available on every
- * environment.
- *
- * @author Sascha Brawer
- */
-public final class ServiceFactory
-{
- /**
- * A logger that gets informed when a service gets loaded, or
- * when there is a problem with loading a service.
- *
- *
Because {@link java.util.logging.Logger#getLogger(String)} - * is thread-safe, we do not need to worry about synchronization - * here. - */ - private static final Logger LOGGER = Logger.getLogger("gnu.classpath"); - - - /** - * Declared private in order to prevent constructing instances of - * this utility class. - */ - private ServiceFactory() - { - } - - - /** - * Finds service providers that are implementing the specified - * Service Provider Interface. - * - *
On-demand loading: Loading and initializing service - * providers is delayed as much as possible. The rationale is that - * typical clients will iterate through the set of installed service - * providers until one is found that matches some criteria (like - * supported formats, or quality of service). In such scenarios, it - * might make sense to install only the frequently needed service - * providers on the local machine. More exotic providers can be put - * onto a server; the server will only be contacted when no suitable - * service could be found locally. - * - *
Security considerations: Any loaded service providers
- * are loaded through the specified ClassLoader, or the system
- * ClassLoader if Class loading and instantiation is encapsulated in a
- * This class is also a thread that is responsible for pulling
- * packets off the wire and sticking them in a queue for packet
- * processing threads.
- *
- * @author Keith Seitz (keiths@redhat.com)
- */
-public class JdwpConnection
- extends Thread
-{
- // The JDWP handshake
- private static final byte[] _HANDSHAKE = {'J', 'D', 'W', 'P', '-', 'H', 'a',
- 'n', 'd', 's', 'h', 'a', 'k', 'e'};
-
- // Transport method
- private ITransport _transport;
-
- // Command queue
- private ArrayList _commandQueue;
-
- // Shutdown flag
- private boolean _shutdown;
-
- // Input stream from transport
- private DataInputStream _inStream;
-
- // Output stream from transprot
- private DataOutputStream _outStream;
-
- // A buffer used to construct the packet data
- private ByteArrayOutputStream _bytes;
-
- // A DataOutputStream for the byte buffer
- private DataOutputStream _doStream;
-
- /**
- * Creates a new The above screen shot shows the result of applying six different
- * BitwiseXORComposites. They were constructed with the colors colors
- * white, blue, black, orange, green, and brown, respectively. Each
- * composite was used to paint a fully white rectangle on top of the
- * blue bar in the background.
- *
- * The purpose of this composite is to support the {@link
- * Graphics#setXORMode(Color)} method in composite-aware graphics
- * implementations. Applications typically would use
- * A concrete Applying this CompositeContext on a 1024x1024 BufferedImage of
- * Applying this CompositeContext on a 1024x1024 BufferedImage of
- * There exist some parts of AWT and Java2D that are specific to
- * the underlying platform, but for which the {@link Toolkit} class
- * does not provide suitable abstractions. Examples include some
- * methods of {@link Font} or {@link GraphicsEnvironment}. Those
- * methods use ClasspathToolkit as a central place for obtaining
- * platform-specific functionality.
- *
- * In addition, ClasspathToolkit implements some abstract methods
- * of {@link java.awt.Toolkit} that are not really platform-specific,
- * such as the maintenance of a cache of loaded images.
- *
- * Thread Safety: The methods of this class may safely be
- * called without external synchronization. This also hold for any
- * inherited {@link Toolkit} methods. Subclasses are responsible for
- * the necessary synchronization.
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
-public abstract class ClasspathToolkit
- extends Toolkit
-{
- /**
- * A map from URLs to previously loaded images, used by {@link
- * #getImage(java.net.URL)}. For images that were loaded via a path
- * to an image file, the map contains a key with a file URL.
- */
- private HashMap imageCache;
-
-
- /**
- * Returns a shared instance of the local, platform-specific
- * graphics environment.
- *
- * This method is specific to GNU Classpath. It gets called by
- * the Classpath implementation of {@link
- * GraphicsEnvironment.getLocalGraphcisEnvironment()}.
- */
- public abstract GraphicsEnvironment getLocalGraphicsEnvironment();
-
-
- /**
- * Determines the current size of the default, primary screen.
- *
- * @throws HeadlessException if the local graphics environment is
- * headless, which means that no screen is attached and no user
- * interaction is allowed.
- */
- public Dimension getScreenSize()
- {
- DisplayMode mode;
-
- // getDefaultScreenDevice throws HeadlessException if the
- // local graphics environment is headless.
- mode = GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDisplayMode();
-
- return new Dimension(mode.getWidth(), mode.getHeight());
- }
-
-
- /**
- * Determines the current color model of the default, primary
- * screen.
- *
- * @see GraphicsEnvironment#getDefaultScreenDevice()
- * @see java.awt.GraphicsDevice#getDefaultConfiguration()
- * @see java.awt.GraphicsConfiguration#getColorModel()
- *
- * @throws HeadlessException if the local graphics environment is
- * headless, which means that no screen is attached and no user
- * interaction is allowed.
- */
- public ColorModel getColorModel()
- {
- // getDefaultScreenDevice throws HeadlessException if the
- // local graphics environment is headless.
- return GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration()
- .getColorModel();
- }
-
- /**
- * Retrieves the metrics for rendering a font on the screen.
- *
- * @param font the font whose metrics are requested.
- */
- public FontMetrics getFontMetrics(Font font)
- {
- return ((ClasspathFontPeer) font.getPeer ()).getFontMetrics (font);
- }
-
-
- /**
- * Acquires an appropriate {@link ClasspathFontPeer}, for use in
- * classpath's implementation of {@link java.awt.Font}.
- *
- * @param name The logical name of the font. This may be either a face
- * name or a logical font name, or may even be null. A default
- * implementation of name decoding is provided in
- * {@link ClasspathFontPeer}, but may be overridden in other toolkits.
- *
- * @param attrs Any extra {@link java.awt.font.TextAttribute} attributes
- * this font peer should have, such as size, weight, family name, or
- * transformation.
- */
- public abstract ClasspathFontPeer getClasspathFontPeer (String name, Map attrs);
-
- public abstract ClasspathTextLayoutPeer
- getClasspathTextLayoutPeer (AttributedString str, FontRenderContext frc);
-
-
- /**
- * Creates a {@link Font}, in a platform-specific manner.
- *
- * The default implementation simply constructs a {@link Font}, but some
- * toolkits may wish to override this, to return {@link Font} subclasses which
- * implement {@link java.awt.font.OpenType} or
- * {@link java.awt.font.MultipleMaster}.
- */
- public Font getFont (String name, Map attrs)
- {
- return new Font (name, attrs);
- }
-
-
- /**
- * Creates a font, reading the glyph definitions from a stream.
- *
- * This method provides the platform-specific implementation for
- * the static factory method {@link Font#createFont(int,
- * java.io.InputStream)}.
- *
- * @param format the format of the font data, such as {@link
- * Font#TRUETYPE_FONT}. An implementation may ignore this argument
- * if it is able to automatically recognize the font format from the
- * provided data.
- *
- * @param stream an input stream from where the font data is read
- * in. The stream will be advanced to the position after the font
- * data, but not closed.
- *
- * @throws IllegalArgumentException if This method maintains a cache for images. If an image has been
- * loaded from the same path before, the cached copy will be
- * returned. The implementation may hold cached copies for an
- * indefinite time, which can consume substantial resources with
- * large images. Users are therefore advised to use {@link
- * #createImage(java.lang.String)} instead.
- *
- * The default implementation creates a file URL for the
- * specified path and invokes {@link #getImage(URL)}.
- *
- * @param path A path to the image file.
- *
- * @return IllegalArgumentException if This method maintains a cache for images. If an image has been
- * loaded from the same URL before, the cached copy will be
- * returned. The implementation may hold cached copies for an
- * indefinite time, which can consume substantial resources with
- * large images. Users are therefore advised to use {@link
- * #createImage(java.net.URL)} instead.
- *
- * @param url the URL from where the image is read.
- */
- public Image getImage(URL url)
- {
- Image result;
-
- synchronized (this)
- {
- // Many applications never call getImage. Therefore, we lazily
- // create the image cache when it is actually needed.
- if (imageCache == null)
- imageCache = new HashMap();
- else
- {
- result = (Image) imageCache.get(url);
- if (result != null)
- return result;
- }
-
- // The createImage(URL) method, which is specified by
- // java.awt.Toolkit, is not implemented by this abstract class
- // because it is platform-dependent. Once Classpath has support
- // for the javax.imageio package, it might be worth considering
- // that toolkits provide native stream readers. Then, the class
- // ClasspathToolkit could provide a general implementation that
- // delegates the image format parsing to javax.imageio.
- result = createImage(url);
-
- // It is not clear whether it would be a good idea to use weak
- // references here. The advantage would be reduced memory
- // consumption, since loaded images would not be kept
- // forever. But on VMs that frequently perform garbage
- // collection (which includes VMs with a parallel or incremental
- // collector), the image might frequently need to be re-loaded,
- // possibly over a slow network connection.
- imageCache.put(url, result);
-
- return result;
- }
- }
-
-
- /**
- * Returns an image from the specified file, which must be in a
- * recognized format. The set of recognized image formats may vary
- * from toolkit to toolkit.
- *
- * A new image is created every time this method gets called,
- * even if the same path has been passed before.
- *
- * The default implementation creates a file URL for the
- * specified path and invokes {@link #createImage(URL)}.
- *
- * @param path A path to the file to be read in.
- */
- public Image createImage(String path)
- {
- try
- {
- // The abstract method createImage(URL) is defined by
- // java.awt.Toolkit, but intentionally not implemented by
- // ClasspathToolkit because it is platform specific.
- return createImage(new File(path).toURL());
- }
- catch (MalformedURLException muex)
- {
- throw (IllegalArgumentException) new IllegalArgumentException(path)
- .initCause(muex);
- }
- }
-
- /**
- * Creates an ImageProducer from the specified URL. The image is assumed
- * to be in a recognised format. If the toolkit does not implement the
- * image format or the image format is not recognised, null is returned.
- * This default implementation is overriden by the Toolkit implementations.
- *
- * @param url URL to read image data from.
- */
- public ImageProducer createImageProducer(URL url)
- {
- return null;
- }
-
- public abstract RobotPeer createRobot (GraphicsDevice screen)
- throws AWTException;
-
- /**
- * Used to register ImageIO SPIs provided by the toolkit.
- */
-
- public void registerImageIOSpis(IIORegistry reg)
- {
- }
-
- public abstract boolean nativeQueueEmpty();
- public abstract void wakeNativeQueue();
- public abstract void iterateNativeQueue(EventQueue locked, boolean block);
-}
diff --git a/libjava/gnu/java/awt/ComponentDataBlitOp.java b/libjava/gnu/java/awt/ComponentDataBlitOp.java
deleted file mode 100644
index 545427ea767..00000000000
--- a/libjava/gnu/java/awt/ComponentDataBlitOp.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.awt;
-
-import java.awt.RenderingHints;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.ComponentSampleModel;
-import java.awt.image.DataBuffer;
-import java.awt.image.Raster;
-import java.awt.image.RasterOp;
-import java.awt.image.WritableRaster;
-
-/**
- * This raster copy operation assumes that both source and destination
- * sample models are tightly pixel packed and contain the same number
- * of bands.
- *
- * @throws java.lang.ClassCastException if the sample models of the
- * rasters are not of type ComponentSampleModel.
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public class ComponentDataBlitOp implements RasterOp
-{
- public static final ComponentDataBlitOp INSTANCE = new ComponentDataBlitOp();
-
- public WritableRaster filter(Raster src, WritableRaster dest)
- {
- if (dest == null)
- dest = createCompatibleDestRaster(src);
-
- DataBuffer srcDB = src.getDataBuffer();
- DataBuffer destDB = dest.getDataBuffer();
-
- ComponentSampleModel srcSM = (ComponentSampleModel) src.getSampleModel();
- ComponentSampleModel destSM = (ComponentSampleModel) dest.getSampleModel();
-
-
- // Calculate offset to data in the underlying arrays:
-
- int srcScanlineStride = srcSM.getScanlineStride();
- int destScanlineStride = destSM.getScanlineStride();
- int srcX = src.getMinX() - src.getSampleModelTranslateX();
- int srcY = src.getMinY() - src.getSampleModelTranslateY();
- int destX = dest.getMinX() - dest.getSampleModelTranslateX();
- int destY = dest.getMinY() - dest.getSampleModelTranslateY();
-
- int numBands = srcSM.getNumBands();
-
- /* We can't use getOffset(x, y) from the sample model since we
- don't want the band offset added in. */
-
- int srcOffset =
- numBands*srcX + srcScanlineStride*srcY + // from sample model
- srcDB.getOffset(); // from data buffer
-
- int destOffset =
- numBands*destX + destScanlineStride*destY + // from sample model
- destDB.getOffset(); // from data buffer
-
- // Determine how much, and how many times to blit.
-
- int rowSize = src.getWidth()*numBands;
- int h = src.getHeight();
-
- if ((rowSize == srcScanlineStride) &&
- (rowSize == destScanlineStride))
- {
- // collapse scan line blits to one large blit.
- rowSize *= h;
- h = 1;
- }
-
-
- // Do blitting
-
- Object srcArray = Buffers.getData(srcDB);
- Object destArray = Buffers.getData(destDB);
-
- for (int yd = 0; yd State kept by the peer: a peer is generated for each Font
- * object in the default implementation. If you wish to share peers between
- * fonts, you will need to subclass both ClasspathFontPeer and
- * {@link ClasspathToolKit}. Thread Safety: Methods of this interface may be called
- * from arbitrary threads at any time. Implementations of the
- * This method is currently not used by {@link Font}. However,
- * this name would be needed by any serious desktop publishing
- * application.
- *
- * @param font the font whose sub-family name is requested.
- *
- * @param locale the locale for which to localize the name. If
- * This method is currently not used by GNU Classpath. However,
- * it would be very useful for someone wishing to write a good
- * PostScript or PDF stream provider for the
- * Names are not unique: Under some rare circumstances,
- * the same name can be returned for different glyphs. It is
- * therefore recommended that printer drivers check whether the same
- * name has already been returned for antoher glyph, and make the
- * name unique by adding the string ".alt" followed by the glyph
- * index. This situation would occur for an OpenType or TrueType font
- * that has a
- **
- ** This class is not well-synchronized. (It can be, it
- ** just isn't yet.)
- **
- ** @author John Keiser
- ** @version 1.1.0, 30 Jul 1998
- ** @see java.beans.BeanInfo
- **/
-
-public class BeanInfoEmbryo {
-
- // by using a TreeMap the properties will be sorted alphabetically by name
- // which matches the (undocumented) behavior of jdk
- TreeMap properties = new TreeMap();
- Hashtable events = new Hashtable();
- Vector methods = new Vector();
-
- BeanDescriptor beanDescriptor;
- BeanInfo[] additionalBeanInfo;
- java.awt.Image[] im;
- String defaultPropertyName;
- String defaultEventName;
-
- public BeanInfoEmbryo() {
- }
-
- public BeanInfo getBeanInfo() {
- int defaultProperty = -1;
- int defaultEvent = -1;
-
- PropertyDescriptor[] Aproperties = new PropertyDescriptor[properties.size()];
- int i = 0;
- Iterator it = properties.entrySet().iterator();
- while (it.hasNext()) {
- Aproperties[i] = (PropertyDescriptor) (((Map.Entry)it.next()).getValue());
- if(defaultPropertyName != null && Aproperties[i].getName().equals(defaultPropertyName)) {
- defaultProperty = i;
- }
- i++;
- }
-
- EventSetDescriptor[] Aevents = new EventSetDescriptor[events.size()];
- i = 0;
- Enumeration e = events.elements();
- while (e.hasMoreElements()) {
- Aevents[i] = (EventSetDescriptor) e.nextElement();
- if(defaultEventName != null && Aevents[i].getName().equals(defaultEventName)) {
- defaultEvent = i;
- }
- i++;
- }
-
- MethodDescriptor[] Amethods = new MethodDescriptor[methods.size()];
- methods.copyInto(Amethods);
-
- return new ExplicitBeanInfo(beanDescriptor,additionalBeanInfo,Aproperties,defaultProperty,Aevents,defaultEvent,Amethods,im);
- }
-
- public void setBeanDescriptor(BeanDescriptor b) {
- beanDescriptor = b;
- }
-
- public void setAdditionalBeanInfo(BeanInfo[] b) {
- additionalBeanInfo = b;
- }
-
- public boolean hasProperty(PropertyDescriptor p) {
- return properties.get(p.getName()) != null;
- }
- public void addProperty(PropertyDescriptor p) {
- properties.put(p.getName(),p);
- }
- public void addIndexedProperty(IndexedPropertyDescriptor p) {
- properties.put(p.getName(),p);
- }
-
- public boolean hasEvent(EventSetDescriptor e) {
- return events.get(e.getName()) != null;
- }
- public void addEvent(EventSetDescriptor e) {
- events.put(e.getName(),e);
- }
-
- public boolean hasMethod(MethodDescriptor m) {
- for(int i=0;i This is the default implementation for GNU Classpath and is used for It has no functionality in order to allow it to be used without any dependencies
- * (e.g. sound, network access, ...). This class is used for This class provides the implementation for an indexed get and set method.
- * But this does not mean that the result object supports these operation. Note: Often multiple steps are needed to construct a fully usuable object instance.
- * Such a construction can be called assembly and thats why this exception was
- * named AssemblyException. The constructor is invoked when a sub-context is a statement or the Context ends. Depending on the result of isStatement() a Context can be statement or an
- * expression. An expression returns a value to the Context of its parent handler,
- * a statement does not. Whenever a Context is a statement the parent handler's
- * Context is informed about that through the {@link notifyStatement}-method. The implementation just writes the exception's message to When the implementation is correct none of this class' methods
- * (except An IndexContent is a get operation when no argument is provided and a set operation if one
- * argument is provided. When the result object is available methods can be called on it using sub-Contexts. The ObjectContext does not accept any parameter object and ignores notifications
- * about sub-contexts being statements. When the method call has to be made and there is no argument we 'get' the property.
- * With one argument it is 'set'. All of these tags have in common that they do not accept attributes. A warning is
- * send to the parser's ExceptionListener when one or more attributes exist.
- **
- ** To Do: add support for a checkbox
- ** as the custom editor.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class NativeBooleanEditor extends PropertyEditorSupport {
- String[] tags = {"true","false"};
-
- /**
- * setAsText for boolean checks for true or false or t or f.
- * "" also means false.
- **/
- public void setAsText(String val) throws IllegalArgumentException {
- if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("t")) {
- setValue(Boolean.TRUE);
- } else if(val.equalsIgnoreCase("false") || val.equalsIgnoreCase("f") || val.equals("")) {
- setValue(Boolean.FALSE);
- } else {
- throw new IllegalArgumentException("Value must be true, false, t, f or empty.");
- }
- }
-
-
- /** getAsText for boolean calls Boolean.toString(). **/
- public String getAsText() {
- return getValue().toString();
- }
-}
diff --git a/libjava/gnu/java/beans/editors/NativeByteEditor.java b/libjava/gnu/java/beans/editors/NativeByteEditor.java
deleted file mode 100644
index f3ec5fa1945..00000000000
--- a/libjava/gnu/java/beans/editors/NativeByteEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* gnu.java.beans.editors.NativeByteEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans.editors;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- ** NativeByteEditor is a property editor for the
- ** byte type.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class NativeByteEditor extends PropertyEditorSupport {
- /** setAsText for byte calls Byte.valueOf(). **/
- public void setAsText(String val) throws IllegalArgumentException {
- setValue(Byte.valueOf(val));
- }
-
- /** getAsText for byte calls Byte.toString(). **/
- public String getAsText() {
- return getValue().toString();
- }
-}
diff --git a/libjava/gnu/java/beans/editors/NativeDoubleEditor.java b/libjava/gnu/java/beans/editors/NativeDoubleEditor.java
deleted file mode 100644
index 8d8aae15337..00000000000
--- a/libjava/gnu/java/beans/editors/NativeDoubleEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* gnu.java.beans.editors.NativeDoubleEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans.editors;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- ** NativeDoubleEditor is a property editor for the
- ** double type.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class NativeDoubleEditor extends PropertyEditorSupport {
- /** setAsText for double calls Double.valueOf(). **/
- public void setAsText(String val) throws IllegalArgumentException {
- setValue(Double.valueOf(val));
- }
-
- /** getAsText for double calls Double.toString(). **/
- public String getAsText() {
- return getValue().toString();
- }
-}
diff --git a/libjava/gnu/java/beans/editors/NativeFloatEditor.java b/libjava/gnu/java/beans/editors/NativeFloatEditor.java
deleted file mode 100644
index 801377e7df9..00000000000
--- a/libjava/gnu/java/beans/editors/NativeFloatEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* gnu.java.beans.editors.NativeFloatEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans.editors;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- ** NativeFloatEditor is a property editor for the
- ** float type.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class NativeFloatEditor extends PropertyEditorSupport {
- /** setAsText for float calls Float.valueOf(). **/
- public void setAsText(String val) throws IllegalArgumentException {
- setValue(Float.valueOf(val));
- }
-
- /** getAsText for float calls Float.toString(). **/
- public String getAsText() {
- return getValue().toString();
- }
-}
diff --git a/libjava/gnu/java/beans/editors/NativeIntEditor.java b/libjava/gnu/java/beans/editors/NativeIntEditor.java
deleted file mode 100644
index a6148841c46..00000000000
--- a/libjava/gnu/java/beans/editors/NativeIntEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* gnu.java.beans.editors.NativeIntEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans.editors;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- ** NativeIntEditor is a property editor for the
- ** int type.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class NativeIntEditor extends PropertyEditorSupport {
- /** setAsText for int calls Integer.valueOf(). **/
- public void setAsText(String val) throws IllegalArgumentException {
- setValue(Integer.valueOf(val));
- }
-
- /** getAsText for int calls Integer.toString(). **/
- public String getAsText() {
- return getValue().toString();
- }
-}
diff --git a/libjava/gnu/java/beans/editors/NativeLongEditor.java b/libjava/gnu/java/beans/editors/NativeLongEditor.java
deleted file mode 100644
index 95e9dc87028..00000000000
--- a/libjava/gnu/java/beans/editors/NativeLongEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* gnu.java.beans.editors.NativeLongEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans.editors;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- ** NativeLongEditor is a property editor for the
- ** long type.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class NativeLongEditor extends PropertyEditorSupport {
- /** setAsText for long calls Long.valueOf(). **/
- public void setAsText(String val) throws IllegalArgumentException {
- setValue(Long.valueOf(val));
- }
-
- /** getAsText for long calls Long.toString(). **/
- public String getAsText() {
- return getValue().toString();
- }
-}
diff --git a/libjava/gnu/java/beans/editors/NativeShortEditor.java b/libjava/gnu/java/beans/editors/NativeShortEditor.java
deleted file mode 100644
index ffaa266492e..00000000000
--- a/libjava/gnu/java/beans/editors/NativeShortEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* gnu.java.beans.editors.NativeShortEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans.editors;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- ** NativeShortEditor is a property editor for the
- ** short type.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class NativeShortEditor extends PropertyEditorSupport {
- /** setAsText for short calls Short.valueOf(). **/
- public void setAsText(String val) throws IllegalArgumentException {
- setValue(Short.valueOf(val));
- }
-
- /** getAsText for short calls Short.toString(). **/
- public String getAsText() {
- return getValue().toString();
- }
-}
diff --git a/libjava/gnu/java/beans/editors/StringEditor.java b/libjava/gnu/java/beans/editors/StringEditor.java
deleted file mode 100644
index 8242d5475a5..00000000000
--- a/libjava/gnu/java/beans/editors/StringEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* gnu.java.beans.editors.StringEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans.editors;
-
-import java.beans.PropertyEditorSupport;
-
-/**
- ** NativeByteEditor is a property editor for the
- ** byte type.
- **
- ** @author John Keiser
- ** @version 1.1.0, 29 Jul 1998
- **/
-
-public class StringEditor extends PropertyEditorSupport {
- /** setAsText just sets the value. **/
- public void setAsText(String val) throws IllegalArgumentException {
- setValue(val);
- }
-
- /** getAsText just returns the value. **/
- public String getAsText() {
- return (String)getValue();
- }
-}
diff --git a/libjava/gnu/java/io/ASN1ParsingException.java b/libjava/gnu/java/io/ASN1ParsingException.java
deleted file mode 100644
index 5d2c64ab54f..00000000000
--- a/libjava/gnu/java/io/ASN1ParsingException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ASN1ParsingException.java -- ASN.1 parsing exception.
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.io;
-
-/**
- * Signals a malformed ASN.1 sequence.
- */
-public class ASN1ParsingException extends java.io.IOException
-{
-
- public ASN1ParsingException()
- {
- super();
- }
-
- public ASN1ParsingException(String msg)
- {
- super(msg);
- }
-}
diff --git a/libjava/gnu/java/io/Base64InputStream.java b/libjava/gnu/java/io/Base64InputStream.java
deleted file mode 100644
index b0824ab6935..00000000000
--- a/libjava/gnu/java/io/Base64InputStream.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/* Base64InputStream.java -- base-64 input stream.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.io;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * A filter input stream that decodes data encoded in the Base-64
- * encoding scheme.
- *
- * @author Casey Marshall (rsdio@metastatic.org)
- */
-public class Base64InputStream extends FilterInputStream
-{
-
- // Constants and fields.
- // ------------------------------------------------------------------------
-
- /** Base-64 digits. */
- private static final String BASE_64 =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- /** Base-64 padding character. */
- private static final char BASE_64_PAD = '=';
-
- /** Decoding state. */
- private int state;
-
- /** Intermediate decoded value. */
- private int temp;
-
- /** EOF flag. */
- private boolean eof;
-
- private final byte[] one = new byte[1];
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new Base-64 input stream. The input bytes must be the
- * ASCII characters A-Z, a-z, 0-9, + and /, with optional whitespace,
- * and will be decoded into a byte stream.
- *
- * @param in The source of Base-64 input.
- */
- public Base64InputStream(InputStream in)
- {
- super(in);
- state = 0;
- temp = 0;
- eof = false;
- }
-
- // Class method.
- // ------------------------------------------------------------------------
-
- /**
- * Decode a single Base-64 string to a byte array.
- *
- * @param base64 The Base-64 encoded data.
- * @return The decoded bytes.
- * @throws IOException If the given data do not compose a valid Base-64
- * sequence.
- */
- public static byte[] decode(String base64) throws IOException
- {
- Base64InputStream in =
- new Base64InputStream(new ByteArrayInputStream(base64.getBytes()));
- ByteArrayOutputStream out =
- new ByteArrayOutputStream((int) (base64.length() / 0.666));
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) != -1)
- out.write(buf, 0, len);
- return out.toByteArray();
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- public int available()
- {
- return 0;
- }
-
- public int read() throws IOException
- {
- if (read(one) == 1)
- return one[0];
- return -1;
- }
-
- public int read(byte[] buf, int off, int len) throws IOException
- {
- if (eof)
- return -1;
- int count = 0;
- while (count < len)
- {
- int i;
- while (Character.isWhitespace((char) (i = in.read())));
- int pos = BASE_64.indexOf((char) i);
- if (pos >= 0)
- {
- switch (state)
- {
- case 0:
- temp = pos << 2;
- state = 1;
- break;
- case 1:
- buf[count++] = (byte) (temp | (pos >>> 4));
- temp = (pos & 0x0F) << 4;
- state = 2;
- break;
- case 2:
- buf[count++] = (byte) (temp | (pos >>> 2));
- temp = (pos & 0x03) << 6;
- state = 3;
- break;
- case 3:
- buf[count++] = (byte) (temp | pos);
- state = 0;
- break;
- }
- }
- else if (i == BASE_64_PAD)
- {
- switch (state)
- {
- case 0:
- case 1:
- throw new IOException("malformed Base-64 input");
- case 2:
- while (Character.isWhitespace((char) (i = in.read())));
- if (i != BASE_64_PAD)
- throw new IOException("malformed Base-64 input");
- case 3:
- while (Character.isWhitespace((char) (i = in.read())));
- }
- eof = true;
- break;
- }
- else // First non-Base-64 character, consider it end-of-stream.
- {
- if (state != 0)
- throw new IOException("malformed Base-64 input");
- eof = true;
- break;
- }
- }
- return count;
- }
-
- public boolean markSupported()
- {
- return false;
- }
-
- public void mark(int markLimit) { }
-
- public void reset() throws IOException
- {
- throw new IOException("reset not supported");
- }
-
- public long skip(long n) throws IOException
- {
- long skipped;
- for (skipped = 0; skipped < n; skipped++)
- if (read() == -1)
- break;
- return skipped;
- }
-}
diff --git a/libjava/gnu/java/io/ClassLoaderObjectInputStream.java b/libjava/gnu/java/io/ClassLoaderObjectInputStream.java
deleted file mode 100644
index 238ab26b1b9..00000000000
--- a/libjava/gnu/java/io/ClassLoaderObjectInputStream.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* gnu.java.io.ClassLoaderObjectInputStream
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.io;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.StreamCorruptedException;
-
-/**
- * ClassLoaderObjectInputStream is ObjectInputStream, with
- * the ability to use a specific ClassLoader.
- *
- * @author Geoff Berry
- * @version 1.1.0, 29 Jul 1998
- */
-
-public class ClassLoaderObjectInputStream extends ObjectInputStream {
- ClassLoader myClassLoader;
-
- /** Create the new ClassLoaderObjectInputStream.
- * @param in the InputStream to read the Objects from.
- * @param myClassLoader the ClassLoader to load classes
- * with.
- */
- public ClassLoaderObjectInputStream(InputStream in, ClassLoader myClassLoader) throws IOException,StreamCorruptedException {
- super(in);
- this.myClassLoader = myClassLoader;
- }
-
- /** Overriden method to use the loadClass() method from
- * the ClassLoader.
- */
- public Class resolveClass(String name) throws IOException, ClassNotFoundException {
- return myClassLoader.loadClass(name);
- }
-}
diff --git a/libjava/gnu/java/io/NullOutputStream.java b/libjava/gnu/java/io/NullOutputStream.java
deleted file mode 100644
index 526bd26e830..00000000000
--- a/libjava/gnu/java/io/NullOutputStream.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/* NullOutputStream.java -- OutputStream that does absolutely nothing
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.io;
-
-import java.io.OutputStream;
-
-/**
- This is a placeholder OutputStream that does absolutley nothing
- when written to. It is intended to be used in the same manner as
- /dev/null. None of this class's methods do anything at all.
-*/
-public class NullOutputStream extends OutputStream
-{
- public NullOutputStream() {}
- public void write( int b ) {}
- public void write( byte b[] ) {}
- public void write( byte b[], int off, int len ) {}
- public void flush() {}
- public void close() {}
-}
diff --git a/libjava/gnu/java/io/ObjectIdentityWrapper.java b/libjava/gnu/java/io/ObjectIdentityWrapper.java
deleted file mode 100644
index 6db2e3a52a6..00000000000
--- a/libjava/gnu/java/io/ObjectIdentityWrapper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ObjectIdentityWrapper.java -- Wrapper class used to override equals()
- and hashCode() to be as discriminating as possible
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.io;
-
-/**
- This class is a thin wrapper around
- * This is a bridge between NIO <-> IO character decoding.
- * UTF-8 references:
- *
- * These classes ({@link java.security.Signature} for example) can be
- * thought of as the "chrome, upholstery, and steering wheel", and the SPI
- * (service provider interface, e.g. {@link java.security.SignatureSpi})
- * classes can be thought of as the "engine" -- providing the actual
- * functionality of whatever cryptographic algorithm the instance
- * represents.
- *
- * @see Provider
- * @author Casey Marshall
- */
-public final class Engine
-{
-
- // Constants.
- // ------------------------------------------------------------------------
-
- /** Prefix for aliases. */
- private static final String ALG_ALIAS = "Alg.Alias.";
-
- /** Maximum number of aliases to try. */
- private static final int MAX_ALIASES = 5;
-
- /** Argument list for no-argument constructors. */
- private static final Object[] NO_ARGS = new Object[0];
-
- // Constructor.
- // ------------------------------------------------------------------------
-
- /** This class cannot be instantiated. */
- private Engine() { }
-
- // Class method.
- // ------------------------------------------------------------------------
-
- /**
- * Get the implementation for algorithm for service
- * service from provider. The service is e.g.
- * "Signature", and the algorithm "DSA".
- *
- * @param service The service name.
- * @param algorithm The name of the algorithm to get.
- * @param provider The provider to get the implementation from.
- * @return The engine class for the specified algorithm; the object
- * returned is typically a subclass of the SPI class for that
- * service, but callers should check that this is so.
- * @throws NoSuchAlgorithmException If the implementation cannot be
- * found or cannot be instantiated.
- * @throws InvocationTargetException If the SPI class's constructor
- * throws an exception.
- * @throws IllegalArgumentException If any of the three arguments are null.
- */
- public static Object getInstance(String service, String algorithm,
- Provider provider)
- throws InvocationTargetException, NoSuchAlgorithmException
- {
- return getInstance(service, algorithm, provider, NO_ARGS);
- }
-
- /**
- * Get the implementation for algorithm for service
- * service from provider, passing initArgs to the
- * SPI class's constructor (which cannot be null; pass a zero-length
- * array if the SPI takes no arguments). The service is e.g.
- * "Signature", and the algorithm "DSA".
- *
- * @param service The service name.
- * @param algorithm The name of the algorithm to get.
- * @param provider The provider to get the implementation from.
- * @param initArgs The arguments to pass to the SPI class's
- * constructor (cannot be null).
- * @return The engine class for the specified algorithm; the object
- * returned is typically a subclass of the SPI class for that
- * service, but callers should check that this is so.
- * @throws NoSuchAlgorithmException If the implementation cannot be
- * found or cannot be instantiated.
- * @throws InvocationTargetException If the SPI class's constructor
- * throws an exception.
- * @throws IllegalArgumentException If any of the four arguments are null.
- */
- public static Object getInstance(String service, String algorithm,
- Provider provider, Object[] initArgs)
- throws InvocationTargetException, NoSuchAlgorithmException
- {
- if (service == null || algorithm == null
- || provider == null || initArgs == null)
- throw new IllegalArgumentException();
-
- // If there is no property "service.algorithm"
- if (provider.getProperty(service + "." + algorithm) == null)
- {
- // Iterate through aliases, until we find the class name or resolve
- // too many aliases.
- String alias = null;
- int count = 0;
- while ((alias = provider.getProperty(
- ALG_ALIAS + service + "." + algorithm)) != null)
- {
- if (algorithm.equals(alias)) // Refers to itself!
- break;
- algorithm = alias;
- if (count++ > MAX_ALIASES)
- throw new NoSuchAlgorithmException("too many aliases");
- }
- if (provider.getProperty(service + "." + algorithm) == null)
- throw new NoSuchAlgorithmException(algorithm);
- }
-
- // Find and instantiate the implementation.
- Class clazz = null;
- ClassLoader loader = provider.getClass().getClassLoader();
- Constructor constructor = null;
- String error = algorithm;
-
- try
- {
- if (loader != null)
- clazz = loader.loadClass(provider.getProperty(service+"."+algorithm));
- else
- clazz = Class.forName(provider.getProperty(service+"."+algorithm));
- constructor = getCompatibleConstructor(clazz, initArgs);
- return constructor.newInstance(initArgs);
- }
- catch (ClassNotFoundException cnfe)
- {
- error = "class not found: " + algorithm;
- }
- catch (IllegalAccessException iae)
- {
- error = "illegal access: " + iae.getMessage();
- }
- catch (InstantiationException ie)
- {
- error = "instantiation exception: " + ie.getMessage();
- }
- catch (ExceptionInInitializerError eiie)
- {
- error = "exception in initializer: " + eiie.getMessage();
- }
- catch (SecurityException se)
- {
- error = "security exception: " + se.getMessage();
- }
- catch (NoSuchMethodException nsme)
- {
- error = "no appropriate constructor found";
- }
-
- throw new NoSuchAlgorithmException(error);
- }
-
- // Own methods.
- // ------------------------------------------------------------------------
-
- /**
- * Find a constructor in the given class that can take the specified
- * argument list, allowing any of which to be null.
- *
- * @param clazz The class from which to get the constructor.
- * @param initArgs The argument list to be passed to the constructor.
- * @return The constructor.
- * @throws NoSuchMethodException If no constructor of the given class
- * can take the specified argument array.
- */
- private static Constructor getCompatibleConstructor(Class clazz,
- Object[] initArgs)
- throws NoSuchMethodException
- {
- Constructor[] c = clazz.getConstructors();
- outer:for (int i = 0; i < c.length; i++)
- {
- Class[] argTypes = c[i].getParameterTypes();
- if (argTypes.length != initArgs.length)
- continue;
- for (int j = 0; j < argTypes.length; j++)
- {
- if (initArgs[j] != null &&
- !argTypes[j].isAssignableFrom(initArgs[j].getClass()))
- continue outer;
- }
- // If we reach this point, we know this constructor (c[i]) has
- // the same number of parameters as the target parameter list,
- // and all our parameters are either (1) null, or (2) assignable
- // to the target parameter type.
- return c[i];
- }
- throw new NoSuchMethodException();
- }
-}
diff --git a/libjava/gnu/java/security/OID.java b/libjava/gnu/java/security/OID.java
deleted file mode 100644
index 8cda43eeee8..00000000000
--- a/libjava/gnu/java/security/OID.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/* OID.java -- numeric representation of an object identifier
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security;
-
-import gnu.java.security.der.DEREncodingException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.StringTokenizer;
-
-/**
- * This immutable class represents an object identifier, or OID.
- *
- * OIDs are represented as a series of hierarcical tokens, each of
- * which is usually represented as a single, unsigned integer. The
- * hierarchy works so that later tokens are considered within the group
- * of earlier tokens. Thus, the OID for the Serpent block cipher,
- * 1.3.6.1.4.1.11591.13.2, is maintained by the GNU project, whose OID
- * is 1.3.6.1.4.1.11591 (which is, in turn, part of bigger, more general
- * bodies; the topmost, 1, stands for the OIDs assigned by the
- * International Standards Organization, ISO).
- *
- * OIDs can be represented in a variety of ways, including the
- * dotted-decimal form we use here.
- *
- * OIDs may be relative, in which case the first two elements of the
- * OID are omitted.
- *
- * @author Casey Marshall (csm@gnu.org)
- */
-public class OID implements Cloneable, Comparable, java.io.Serializable
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- /**
- * The numeric ID structure.
- */
- private int[] components;
-
- /**
- * The string representation of this OID, in dotted-decimal format.
- */
- private transient String strRep;
-
- /**
- * The DER encoding of this OID.
- */
- private transient byte[] der;
-
- /**
- * Whether or not this OID is relative.
- */
- private boolean relative;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new OID from the given byte array. The argument (which can
- * neither be null nor zero-length) is copied to prevent subsequent
- * modification.
- *
- * @param components The numeric IDs.
- * @throws IllegalArgumentException If components is null or empty.
- */
- public OID(int[] components)
- {
- this(components, false);
- }
-
- /**
- * Create a new OID from the given byte array. The argument (which can
- * neither be null nor zero-length) is copied to prevent subsequent
- * modification.
- *
- * @param components The numeric IDs.
- * @param relative The relative flag.
- * @throws IllegalArgumentException If components is null or empty.
- */
- public OID(int[] components, boolean relative)
- {
- if (components == null || components.length == 0)
- throw new IllegalArgumentException();
- this.components = (int[]) components.clone();
- this.relative = relative;
- }
-
- /**
- * Create a new OID from the given dotted-decimal representation.
- *
- * @param strRep The string representation of the OID.
- * @throws IllegalArgumentException If the string does not contain at
- * least one integer.
- * @throws NumberFormatException If the string does not contain only
- * numbers and periods ('.').
- */
- public OID(String strRep)
- {
- this(strRep, false);
- }
-
- /**
- * Create a new OID from the given dotted-decimal representation.
- *
- * @param strRep The string representation of the OID.
- * @param relative The relative flag.
- * @throws IllegalArgumentException If the string does not contain at
- * least one integer.
- * @throws NumberFormatException If the string does not contain only
- * numbers and periods ('.').
- */
- public OID(String strRep, boolean relative)
- {
- this.relative = relative;
- this.strRep = strRep;
- components = fromString(strRep);
- }
-
- /**
- * Construct a new OID from the DER bytes in an input stream. This method
- * does not read the tag or the length field from the input stream, so
- * the caller must supply the number of octets in this OID's encoded
- * form.
- *
- * @param derIn The DER input stream.
- * @param len The number of bytes in the encoded form.
- * @throws IOException If an error occurs reading the OID.
- */
- public OID(InputStream derIn, int len) throws IOException
- {
- this(derIn, len, false);
- }
-
- /**
- * Construct a new OID from the DER bytes in an input stream. This method
- * does not read the tag or the length field from the input stream, so
- * the caller must supply the number of octets in this OID's encoded
- * form.
- *
- * @param derIn The DER input stream.
- * @param len The number of bytes in the encoded form.
- * @param relative The relative flag.
- * @throws IOException If an error occurs reading the OID.
- */
- public OID(InputStream derIn, int len, boolean relative) throws IOException
- {
- der = new byte[len];
- derIn.read(der);
- this.relative = relative;
- try
- {
- components = fromDER(der, relative);
- }
- catch (ArrayIndexOutOfBoundsException aioobe)
- {
- aioobe.printStackTrace();
- throw aioobe;
- }
- }
-
- /**
- * Construct a new OID from the given DER bytes.
- *
- * @param encoded The DER encoded OID.
- * @throws IOException If an error occurs reading the OID.
- */
- public OID(byte[] encoded) throws IOException
- {
- this(encoded, false);
- }
-
- /**
- * Construct a new OID from the given DER bytes.
- *
- * @param root The root OID.
- * @param encoded The encoded relative OID.
- * @param relative The relative flag.
- */
- public OID(byte[] encoded, boolean relative) throws IOException
- {
- der = (byte[]) encoded.clone();
- this.relative = relative;
- try
- {
- components = fromDER(der, relative);
- }
- catch (ArrayIndexOutOfBoundsException aioobe)
- {
- aioobe.printStackTrace();
- throw aioobe;
- }
- }
-
- /**
- * Our private constructor.
- */
- private OID()
- {
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Return the numeric IDs of this OID. The value returned is copied to
- * prevent modification.
- *
- * @return The IDs in a new integer array.
- */
- public int[] getIDs()
- {
- return (int[]) components.clone();
- }
-
- /**
- * Get the DER encoding of this OID, minus the tag and length fields.
- *
- * @return The DER bytes.
- */
- public byte[] getDER()
- {
- if (der == null)
- {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- int i = 0;
- if (!relative)
- {
- int b = components[i++] * 40 + (components.length > 1
- ? components[i++] : 0);
- encodeSubID(bout, b);
- }
- for ( ; i < components.length; i++)
- encodeSubID(bout, components[i]);
- der = bout.toByteArray();
- }
- return (byte[]) der.clone();
- }
-
- /**
- * Get the parent OID of this OID. That is, if this OID is "1.2.3.4",
- * then the parent OID will be "1.2.3". If this OID is a top-level
- * OID, this method returns null.
- *
- * @return The parent OID, or null.
- */
- public OID getParent()
- {
- if (components.length == 1)
- return null;
- int[] parent = new int[components.length - 1];
- System.arraycopy(components, 0, parent, 0, parent.length);
- return new OID(parent);
- }
-
- public OID getChild(int id)
- {
- int[] child = new int[components.length + 1];
- System.arraycopy(components, 0, child, 0, components.length);
- child[child.length - 1] = id;
- return new OID(child);
- }
-
- /**
- * Get the root OID of this OID. That is, the first two components.
- *
- * @return The root OID.
- */
- public OID getRoot()
- {
- if (components.length <= 2)
- return this;
- int[] root = new int[2];
- root[0] = components[0];
- root[1] = components[1];
- return new OID(root);
- }
-
- public boolean isRelative()
- {
- return relative;
- }
-
- /**
- * Returns a copy of this OID.
- *
- * @return The copy.
- */
- public Object clone()
- {
- OID oid = new OID();
- oid.components = this.components;
- oid.strRep = this.strRep;
- return oid;
- }
-
- /* Nice idea, but possibly too expensive for whatever benefit it
- * provides.
-
- public String getShortName()
- {
- return OIDTable.getShortName(this);
- }
-
- public String getLongName()
- {
- return OIDTable.getLongName(this);
- }
-
- */
-
- /**
- * Returns the value of this OID in dotted-decimal format.
- *
- * @return The string representation.
- */
- public String toString()
- {
- if (strRep != null)
- return strRep;
- else
- {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < components.length; i++)
- {
- buf.append((long) components[i] & 0xFFFFFFFFL);
- if (i < components.length - 1)
- buf.append('.');
- }
- return (strRep = buf.toString());
- }
- }
-
- /**
- * Computes a hash code for this OID.
- *
- * @return The hash code.
- */
- public int hashCode()
- {
- int ret = 0;
- for (int i = 0; i < components.length; i++)
- ret += components[i] << (i & 31);
- return ret;
- }
-
- /**
- * Tests whether or not this OID equals another.
- *
- * @return Whether or not this OID equals the other.
- */
- public boolean equals(Object o)
- {
- if (!(o instanceof OID))
- return false;
- return java.util.Arrays.equals(components, ((OID) o).components);
- }
-
- /**
- * Compares this OID to another. The comparison is essentially
- * lexicographic, where the two OIDs are compared until their
- * first difference, then that difference is returned. If one OID is
- * shorter, but all elements equal between the two for the shorter
- * length, then the shorter OID is lesser than the longer.
- *
- * @param o The object to compare.
- * @return An integer less than, equal to, or greater than zero if
- * this object is less than, equal to, or greater than the
- * argument.
- * @throws ClassCastException If o is not an OID.
- */
- public int compareTo(Object o)
- {
- if (equals(o))
- return 0;
- int[] components2 = ((OID) o).components;
- int len = Math.min(components.length, components2.length);
- for (int i = 0; i < len; i++)
- {
- if (components[i] != components2[i])
- return (components[i] < components2[i]) ? -1 : 1;
- }
- if (components.length == components2.length)
- return 0;
- return (components.length < components2.length) ? -1 : 1;
- }
-
- // Own methods.
- // ------------------------------------------------------------------------
-
- private static int[] fromDER(byte[] der, boolean relative)
- throws DEREncodingException
- {
- // cannot be longer than this.
- int[] components = new int[der.length + 1];
- int count = 0;
- int i = 0;
- if (!relative && i < der.length)
- {
- // Non-relative OIDs have the first two arcs coded as:
- //
- // i = first_arc * 40 + second_arc;
- //
- int j = (der[i] & 0xFF);
- components[count++] = j / 40;
- components[count++] = j % 40;
- i++;
- }
- while (i < der.length)
- {
- int j = 0;
- do
- {
- j = der[i++] & 0xFF;
- components[count] <<= 7;
- components[count] |= j & 0x7F;
- if (i >= der.length && (j & 0x80) != 0)
- throw new DEREncodingException("malformed OID");
- }
- while ((j & 0x80) != 0);
- count++;
- }
- if (count == components.length)
- return components;
- int[] ret = new int[count];
- System.arraycopy(components, 0, ret, 0, count);
- return ret;
- }
-
- private static int[] fromString(String strRep) throws NumberFormatException
- {
- if (strRep.startsWith("OID.") || strRep.startsWith("oid."))
- strRep = strRep.substring(4);
- StringTokenizer tok = new StringTokenizer(strRep, ".");
- if (tok.countTokens() == 0)
- throw new IllegalArgumentException();
- int[] components = new int[tok.countTokens()];
- int i = 0;
- while (tok.hasMoreTokens())
- {
- components[i++] = Integer.parseInt(tok.nextToken());
- }
- return components;
- }
-
- private static void encodeSubID(ByteArrayOutputStream out, int id)
- {
- if (id < 128)
- {
- out.write(id);
- }
- else if (id < 16384)
- {
- out.write((id >>> 7) | 0x80);
- out.write(id & 0x7F);
- }
- else if (id < 2097152)
- {
- out.write((id >>> 14) | 0x80);
- out.write(((id >>> 7) | 0x80) & 0xFF);
- out.write(id & 0x7F);
- }
- else if (id < 268435456)
- {
- out.write( (id >>> 21) | 0x80);
- out.write(((id >>> 14) | 0x80) & 0xFF);
- out.write(((id >>> 7) | 0x80) & 0xFF);
- out.write(id & 0x7F);
- }
- }
-}
diff --git a/libjava/gnu/java/security/PolicyFile.java b/libjava/gnu/java/security/PolicyFile.java
deleted file mode 100644
index dd3a4dec4c4..00000000000
--- a/libjava/gnu/java/security/PolicyFile.java
+++ /dev/null
@@ -1,667 +0,0 @@
-/* PolicyFile.java -- policy file reader
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.security;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.StreamTokenizer;
-import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.CodeSource;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.Policy;
-import java.security.Principal;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.security.Security;
-import java.security.UnresolvedPermission;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * An implementation of a {@link java.security.Policy} object whose
- * permissions are specified by a policy file.
- *
- * The approximate syntax of policy files is: Comments are either form of Java comments. Keystore entries only
- * affect subsequent grant entries, so if a grant entry preceeds a
- * keystore entry, that grant entry is not affected by that keystore
- * entry. Certian instances of This class will load the following files when created or
- * refreshed, in order: Where the "xxx" represents three bits that should be ignored, and
- * can have any value.
- *
- * @author Casey Marshall (csm@gnu.org)
- */
-public class BitString implements Cloneable, Comparable
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- /** The bits themselves. */
- private final byte[] bytes;
-
- /**
- * The exportable byte array. This array has the ignored bits
- * removed.
- */
- private transient byte[] externBytes;
-
- /** The number of bits ignored at the end of the byte array. */
- private final int ignoredBits;
-
- /** This bit string as a boolean array. */
- private transient boolean[] boolVal;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new bit string, shifting the given byte array if needed.
- *
- * @param bytes The byte array holding the bit string.
- * @param ignoredBits The number of bits to ignore.
- * @param doShift Pass true in this parameter if the byte array has
- * not yet been shifted left by ignoredBits.
- * @throws IllegalArgumentException If ignoredBits is negative
- * or greater than 7.
- * @throws NullPointerException If bytes is null.
- */
- public BitString(byte[] bytes, int ignoredBits, boolean doShift)
- {
- this(bytes, 0, bytes.length, ignoredBits, doShift);
- }
-
- /**
- * Create a new bit string, shifting the given byte array if needed.
- *
- * @param bytes The byte array holding the bit string.
- * @param offset The offset where the meaningful bytes begin.
- * @param length The number of meaningful bytes.
- * @param ignoredBits The number of bits to ignore.
- * @param doShift Pass true in this parameter if the byte array has
- * not yet been shifted left by ignoredBits.
- * @throws IllegalArgumentException If ignoredBits is negative
- * or greater than 7.
- * @throws NullPointerException If bytes is null.
- */
- public BitString(byte[] bytes, int offset, int length,
- int ignoredBits, boolean doShift)
- {
- if (ignoredBits < 0 || ignoredBits > 7)
- throw new IllegalArgumentException();
- if (bytes == null)
- throw new NullPointerException();
- if (doShift && ignoredBits > 0)
- {
- this.externBytes = new byte[length];
- System.arraycopy(bytes, offset, externBytes, 0, length);
- this.bytes = new BigInteger(externBytes).shiftLeft(ignoredBits)
- .toByteArray();
- }
- else
- {
- this.bytes = new byte[length];
- System.arraycopy(bytes, offset, this.bytes, 0, length);
- }
- this.ignoredBits = ignoredBits;
- }
-
- /**
- * Create a new bit string.
- *
- * @param bytes The byte array holding the bit string.
- * @param offset The offset where the meaningful bytes begin.
- * @param length The number of meaningful bytes.
- * @param ignoredBits The number of bits to ignore.
- * @throws IllegalArgumentException If ignoredBits is negative
- * or greater than 7.
- * @throws NullPointerException If bytes is null.
- */
- public BitString(byte[] bytes, int offset, int length, int ignoredBits)
- {
- this(bytes, offset, length, ignoredBits, false);
- }
-
- /**
- * Create a new bit string.
- *
- * @param bytes The byte array holding the bit string.
- * @param ignoredBits The number of bits to ignore.
- * @throws IllegalArgumentException If ignoredBits is negative
- * or greater than 7.
- * @throws NullPointerException If bytes is null.
- */
- public BitString(byte[] bytes, int ignoredBits)
- {
- this(bytes, 0, bytes.length, ignoredBits, false);
- }
-
- /**
- * Create a new bit string.
- *
- * @param bytes The byte array holding the bit string.
- * @param offset The offset where the meaningful bytes begin.
- * @param length The number of meaningful bytes.
- * @throws NullPointerException If bytes is null.
- */
- public BitString(byte[] bytes, int offset, int length)
- {
- this(bytes, offset, length, 0, false);
- }
-
- /**
- * Create a new bit string.
- *
- * @param bytes The byte array holding the bit string.
- * @throws NullPointerException If bytes is null.
- */
- public BitString(byte[] bytes)
- {
- this(bytes, 0, bytes.length, 0, false);
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- /**
- * Return this bit string as a byte array, with the ignored bits
- * trimmed off. The byte array is cloned every time this method is
- * called to prevent modification.
- *
- * @return The trimmed byte array.
- */
- public byte[] toByteArray()
- {
- if (ignoredBits == 0)
- return (byte[]) bytes.clone();
- if (externBytes == null)
- externBytes = new BigInteger(bytes).shiftRight(ignoredBits).toByteArray();
- return (byte[]) externBytes.clone();
- }
-
- /**
- * Returns this bit string as a byte array, with the ignored bits
- * present. The byte array is cloned every time this method is
- * called to prevent modification.
- *
- * @return The byte array.
- */
- public byte[] getShiftedByteArray()
- {
- return (byte[]) bytes.clone();
- }
-
- /**
- * Returns the number of ignored bits.
- *
- * @return The number of ignored bits.
- */
- public int getIgnoredBits()
- {
- return ignoredBits;
- }
-
- /**
- * Returns the size, in bits, of this bit string.
- *
- * @return The size of this bit string.
- */
- public int size()
- {
- return (bytes.length << 3) - ignoredBits;
- }
-
- /**
- * Return this bit string as a boolean array. The value returned is of
- * size {@link #size()}, and each This class only defines static methods; there are no instance
- * variables needed.
- *
- * @author Casey Marshall (csm@gnu.org)
- */
-public class DERWriter implements DER
-{
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /** This class only has static methods. */
- private DERWriter()
- {
- }
-
- // Class methods.
- // ------------------------------------------------------------------------
-
- public static int write(OutputStream out, DERValue object)
- throws IOException
- {
- out.write(object.getExternalTag());
- Object value = object.getValue();
- if (value == null)
- {
- writeLength(out, 0);
- return 0;
- }
- if (value instanceof Boolean)
- return writeBoolean(out, (Boolean) value);
- else if (value instanceof BigInteger)
- return writeInteger(out, (BigInteger) value);
- else if (value instanceof Date)
- return writeDate(out, object.getExternalTag(), (Date) value);
- else if (value instanceof String)
- return writeString(out, object.getExternalTag(), (String) value);
- else if (value instanceof List)
- return writeSequence(out, (List) value);
- else if (value instanceof Set)
- return writeSet(out, (Set) value);
- else if (value instanceof BitString)
- return writeBitString(out, (BitString) value);
- else if (value instanceof OID)
- return writeOID(out, (OID) value);
- else if (value instanceof byte[])
- {
- writeLength(out, ((byte[]) value).length);
- out.write((byte[]) value);
- return ((byte[]) value).length;
- }
- else if (value instanceof DERValue)
- {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- write(bout, (DERValue) value);
- byte[] buf = bout.toByteArray();
- writeLength(out, buf.length);
- out.write(buf);
- return buf.length;
- }
- else
- throw new DEREncodingException("cannot encode " + value.getClass().getName());
- }
-
- public static int definiteEncodingSize(int length)
- {
- if (length < 128)
- return 1;
- else if (length < 256)
- return 2;
- else if (length < 65536)
- return 3;
- else if (length < 16777216)
- return 4;
- else
- return 5;
- }
-
- // Own methods.
- // ------------------------------------------------------------------------
-
- /**
- * Write a BOOLEAN type to the given output stream.
- *
- * @param out The sink output stream.
- * @param b The boolean value to write.
- */
- private static int writeBoolean(OutputStream out, Boolean b)
- throws IOException
- {
- writeLength(out, 1);
- if (b.booleanValue())
- out.write(0xFF);
- else
- out.write(0);
- return 1;
- }
-
- /**
- * Write an INTEGER type to the given output stream.
- *
- * @param out The sink output stream.
- * @param integer The integer to write.
- */
- private static int writeInteger(OutputStream out, BigInteger integer)
- throws IOException
- {
- byte[] bytes = integer.toByteArray();
- writeLength(out, bytes.length);
- out.write(bytes);
- return bytes.length;
- }
-
- private static int writeSequence(OutputStream out, List sequence)
- throws IOException
- {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- for (Iterator i = sequence.iterator(); i.hasNext(); )
- {
- write(bout, (DERValue) i.next());
- }
- byte[] buf = bout.toByteArray();
- writeLength(out, buf.length);
- out.write(buf);
- return buf.length;
- }
-
- private static int writeSet(OutputStream out, Set set)
- throws IOException
- {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- for (Iterator i = set.iterator(); i.hasNext(); )
- {
- write(bout, (DERValue) i.next());
- }
- byte[] buf = bout.toByteArray();
- writeLength(out, buf.length);
- out.write(buf);
- return buf.length;
- }
-
- private static int writeOID(OutputStream out, OID oid)
- throws IOException
- {
- byte[] der = oid.getDER();
- writeLength(out, der.length);
- out.write(der);
- return der.length;
- }
-
- private static int writeBitString(OutputStream out, BitString bs)
- throws IOException
- {
- byte[] buf = bs.getShiftedByteArray();
- out.write(buf.length + 1);
- out.write(bs.getIgnoredBits());
- out.write(buf);
- return buf.length;
- }
-
- private static int writeString(OutputStream out, int tag, String str)
- throws IOException
- {
- byte[] b = null;
- switch (tag & 0x1F)
- {
- case NUMERIC_STRING:
- case PRINTABLE_STRING:
- case T61_STRING:
- case VIDEOTEX_STRING:
- case IA5_STRING:
- case GRAPHIC_STRING:
- case ISO646_STRING:
- case GENERAL_STRING:
- b = toIso88591(str);
- break;
-
- case UNIVERSAL_STRING:
- case BMP_STRING:
- b = toUtf16Be(str);
- break;
-
- case UTF8_STRING:
- default:
- b = toUtf8(str);
- break;
- }
- writeLength(out, b.length);
- out.write(b);
- return b.length;
- }
-
- private static byte[] toIso88591(String string)
- {
- byte[] result = new byte[string.length()];
- for (int i = 0; i < string.length(); i++)
- result[i] = (byte) string.charAt(i);
- return result;
- }
-
- private static byte[] toUtf16Be(String string)
- {
- byte[] result = new byte[string.length() * 2];
- for (int i = 0; i < string.length(); i++)
- {
- result[i*2 ] = (byte) ((string.charAt(i) >>> 8) & 0xFF);
- result[i*2+1] = (byte) (string.charAt(i) & 0xFF);
- }
- return result;
- }
-
- private static byte[] toUtf8(String string)
- {
- ByteArrayOutputStream buf =
- new ByteArrayOutputStream((int)(string.length() * 1.5));
- for (int i = 0; i < string.length(); i++)
- {
- char c = string.charAt(i);
- if (c < 0x0080)
- buf.write(c & 0xFF);
- else if (c < 0x0800)
- {
- buf.write(0xC0 | ((c >>> 6) & 0x3F));
- buf.write(0x80 | (c & 0x3F));
- }
- else
- {
- buf.write(0xE0 | ((c >>> 12) & 0x0F));
- buf.write(0x80 | ((c >>> 6) & 0x3F));
- buf.write(0x80 | (c & 0x3F));
- }
- }
- return buf.toByteArray();
- }
-
- private static int writeDate(OutputStream out, int tag, Date date)
- throws IOException
- {
- SimpleDateFormat sdf = null;
- if ((tag & 0x1F) == UTC_TIME)
- sdf = new SimpleDateFormat("yyMMddHHmmss'Z'");
- else
- sdf = new SimpleDateFormat("yyyyMMddHHmmss'.'SSS'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
- byte[] b = sdf.format(date).getBytes("ISO-8859-1");
- writeLength(out, b.length);
- out.write(b);
- return b.length;
- }
-
- // Package method.
- // ------------------------------------------------------------------------
-
- static void writeLength(OutputStream out, int len) throws IOException
- {
- if (len < 128)
- out.write(len);
- else if (len < 256)
- {
- out.write(0x81);
- out.write(len);
- }
- else if (len < 65536)
- {
- out.write(0x82);
- out.write(len >> 8);
- out.write(len);
- }
- else if (len < 16777216)
- {
- out.write(0x83);
- out.write(len >> 16);
- out.write(len >> 8);
- out.write(len);
- }
- else
- {
- out.write(0x84);
- out.write(len >> 24);
- out.write(len >> 16);
- out.write(len >> 8);
- out.write(len);
- }
- }
-}
diff --git a/libjava/gnu/java/security/pkcs/PKCS7SignedData.java b/libjava/gnu/java/security/pkcs/PKCS7SignedData.java
deleted file mode 100644
index ba5efc7222f..00000000000
--- a/libjava/gnu/java/security/pkcs/PKCS7SignedData.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/* PKCS7SignedData.java -- reader for PKCS#7 signedData objects
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.security.pkcs;
-
-import gnu.java.security.OID;
-import gnu.java.security.ber.BER;
-import gnu.java.security.ber.BEREncodingException;
-import gnu.java.security.ber.BERReader;
-import gnu.java.security.ber.BERValue;
-import gnu.java.security.der.DERValue;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.math.BigInteger;
-
-import java.security.cert.CRL;
-import java.security.cert.CRLException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * The SignedData object in PKCS #7. This is a read-only implementation of
- * this format, and is used to provide signed Jar file support.
- *
- * @author Casey Marshall (csm@gnu.org)
- */
-public class PKCS7SignedData
-{
-
- public static final OID PKCS7_DATA = new OID("1.2.840.113549.1.7.1");
- public static final OID PKCS7_SIGNED_DATA = new OID("1.2.840.113549.1.7.2");
-
- private BigInteger version;
- private Set digestAlgorithms;
- private OID contentType;
- private byte[] content;
- private Certificate[] certificates;
- private CRL[] crls;
- private Set signerInfos;
-
- private static final boolean DEBUG = false;
- private static void debug(String msg)
- {
- System.err.print("PKCS7SignedData >> ");
- System.err.println(msg);
- }
-
- public PKCS7SignedData(InputStream in)
- throws CRLException, CertificateException, IOException
- {
- this(new BERReader(in));
- }
-
- /**
- * Parse an encoded PKCS#7 SignedData object. The ASN.1 format of this
- * object is:
- *
- * (Readers who are confused as to why it takes 40 levels of indirection
- * to specify "data with a signature", rest assured that the present author
- * is as confused as you are). DSA private keys (in Classpath at least) have no attributes.
- */
- public byte[] getEncoded()
- {
- if (encodedKey != null)
- return (byte[]) encodedKey.clone();
- try
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ArrayList pki = new ArrayList(3);
- pki.add(new DERValue(DER.INTEGER, BigInteger.ZERO));
- ArrayList algId = new ArrayList(2);
- algId.add(new DERValue(DER.OBJECT_IDENTIFIER,
- new OID("1.2.840.10040.4.1")));
- ArrayList algParams = new ArrayList(3);
- algParams.add(new DERValue(DER.INTEGER, p));
- algParams.add(new DERValue(DER.INTEGER, q));
- algParams.add(new DERValue(DER.INTEGER, g));
- algId.add(new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, algParams));
- pki.add(new DERValue(DER.OCTET_STRING, x.toByteArray()));
- DERWriter.write(out, new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, pki));
- return (byte[]) (encodedKey = out.toByteArray()).clone();
- }
- catch (IOException ioe)
- {
- return null;
- }
- }
-
- public DSAParams getParams()
- {
- return (DSAParams)(new DSAParameterSpec(p,q,g));
- }
-
- public BigInteger getX()
- {
- return x;
- }
-
- public String toString()
- {
- return "GnuDSAPrivateKey: x="
- + (x != null ? x.toString(16) : "null") + " p="
- + (p != null ? p.toString(16) : "null") + " q="
- + (q != null ? q.toString(16) : "null") + " g="
- + (g != null ? g.toString(16) : "null");
- }
-}
diff --git a/libjava/gnu/java/security/provider/GnuDSAPublicKey.java b/libjava/gnu/java/security/provider/GnuDSAPublicKey.java
deleted file mode 100644
index 41195fa992c..00000000000
--- a/libjava/gnu/java/security/provider/GnuDSAPublicKey.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/* GnuDSAPublicKey.java --- Gnu DSA Public Key
- Copyright (C) 1999,2003,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.BitString;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.der.DERWriter;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.interfaces.DSAParams;
-import java.security.interfaces.DSAPublicKey;
-import java.security.spec.DSAParameterSpec;
-import java.util.ArrayList;
-
-public class GnuDSAPublicKey implements DSAPublicKey
-{
- private byte[] encodedKey;
- BigInteger y;
- BigInteger p;
- BigInteger q;
- BigInteger g;
-
- public GnuDSAPublicKey(BigInteger y, BigInteger p, BigInteger q, BigInteger g )
- {
- this.y = y;
- this.p = p;
- this.q = q;
- this.g = g;
- }
-
- public String getAlgorithm()
- {
- return "DSA";
- }
-
- public String getFormat()
- {
- return "X.509";
- }
-
- /**
- * The encoded form of DSA public keys is:
- *
- * Which is in turn encoded in a PrivateKeyInfo structure from PKCS#8.
- */
- public byte[] getEncoded()
- {
- if (encodedKey != null)
- return (byte[]) encodedKey.clone();
- ArrayList key = new ArrayList(9);
- key.add(new DERValue(DER.INTEGER, BigInteger.ZERO));
- key.add(new DERValue(DER.INTEGER, getModulus()));
- key.add(new DERValue(DER.INTEGER, getPublicExponent()));
- key.add(new DERValue(DER.INTEGER, getPrivateExponent()));
- key.add(new DERValue(DER.INTEGER, getPrimeP()));
- key.add(new DERValue(DER.INTEGER, getPrimeQ()));
- key.add(new DERValue(DER.INTEGER, getPrimeExponentP()));
- key.add(new DERValue(DER.INTEGER, getPrimeExponentQ()));
- key.add(new DERValue(DER.INTEGER, getCrtCoefficient()));
- DERValue pk = new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, key);
- ArrayList pki = new ArrayList(3);
- pki.add(new DERValue(DER.INTEGER, BigInteger.ZERO));
- ArrayList alg = new ArrayList(2);
- alg.add(new DERValue(DER.OBJECT_IDENTIFIER,
- new OID("1.2.840.113549.1.1.1")));
- alg.add(new DERValue(DER.NULL, null));
- pki.add(new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, alg));
- pki.add(new DERValue(DER.OCTET_STRING, pk.getEncoded()));
- encodedKey = new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, pki).getEncoded();
- return (byte[]) encodedKey.clone();
- }
-}
diff --git a/libjava/gnu/java/security/provider/GnuRSAPublicKey.java b/libjava/gnu/java/security/provider/GnuRSAPublicKey.java
deleted file mode 100644
index a35e761c066..00000000000
--- a/libjava/gnu/java/security/provider/GnuRSAPublicKey.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* GnuRSAPublicKey.java -- GNU RSA public key.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.BitString;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERValue;
-
-import java.math.BigInteger;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.RSAPublicKeySpec;
-import java.util.ArrayList;
-
-class GnuRSAPublicKey implements RSAPublicKey
-{
-
- // Fields.
- // -------------------------------------------------------------------------
-
- private final RSAPublicKeySpec spec;
- private byte[] encodedKey;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public GnuRSAPublicKey(RSAPublicKeySpec spec)
- {
- this.spec = spec;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public BigInteger getModulus()
- {
- return spec.getModulus();
- }
-
- public BigInteger getPublicExponent()
- {
- return spec.getPublicExponent();
- }
-
- public String getAlgorithm()
- {
- return "RSA";
- }
-
- public String getFormat()
- {
- return "X.509";
- }
-
- public byte[] getEncoded()
- {
- if (encodedKey != null)
- return (byte[]) encodedKey.clone();
- ArrayList key = new ArrayList(2);
- key.add(new DERValue(DER.INTEGER, getModulus()));
- key.add(new DERValue(DER.INTEGER, getPublicExponent()));
- DERValue rsapk = new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, key);
- ArrayList alg = new ArrayList(2);
- alg.add(new DERValue(DER.OBJECT_IDENTIFIER,
- new OID("1.2.840.113549.1.1.1")));
- alg.add(new DERValue(DER.NULL, null));
- ArrayList spki = new ArrayList(2);
- spki.add(new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, alg));
- spki.add(new DERValue(DER.BIT_STRING, new BitString(rsapk.getEncoded())));
- encodedKey = new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, spki).getEncoded();
- return (byte[]) encodedKey.clone();
- }
-}
diff --git a/libjava/gnu/java/security/provider/MD2withRSA.java b/libjava/gnu/java/security/provider/MD2withRSA.java
deleted file mode 100644
index a72ae5588dc..00000000000
--- a/libjava/gnu/java/security/provider/MD2withRSA.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* MD2withRSA.java -- MD2 with RSA encryption signatures.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class MD2withRSA extends RSA
-{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public MD2withRSA() throws NoSuchAlgorithmException
- {
- super(MessageDigest.getInstance("MD2"), DIGEST_ALGORITHM.getChild(2));
- }
-}
diff --git a/libjava/gnu/java/security/provider/MD4withRSA.java b/libjava/gnu/java/security/provider/MD4withRSA.java
deleted file mode 100644
index 76a6a1ad033..00000000000
--- a/libjava/gnu/java/security/provider/MD4withRSA.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* MD4withRSA.java -- MD4 with RSA encryption signatures.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class MD4withRSA extends RSA
-{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public MD4withRSA() throws NoSuchAlgorithmException
- {
- super(MessageDigest.getInstance("MD4"), DIGEST_ALGORITHM.getChild(4));
- }
-}
diff --git a/libjava/gnu/java/security/provider/MD5.java b/libjava/gnu/java/security/provider/MD5.java
deleted file mode 100644
index 1534eb91089..00000000000
--- a/libjava/gnu/java/security/provider/MD5.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/* MD5.java -- Class implementing the MD5 algorithm as specified in RFC1321.
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-import java.security.MessageDigest;
-
-/**
- This class implements the MD5 algorithm as described in RFC1321.
-
- @see java.security.MessageDigest
-*/
-public class MD5 extends MessageDigest implements Cloneable
-{
- private final int W[] = new int[16];
- private long bytecount;
- private int A;
- private int B;
- private int C;
- private int D;
-
- public MD5()
- {
- super("MD5");
- engineReset ();
- }
-
- public Object clone()
- {
- return new MD5 (this);
- }
-
- private MD5 (MD5 copy)
- {
- this ();
- bytecount = copy.bytecount;
- A = copy.A;
- B = copy.B;
- C = copy.C;
- D = copy.D;
- System.arraycopy (copy.W, 0, W, 0, 16);
- }
-
- public int engineGetDigestLength()
- {
- return 16;
- }
-
- // Intialize the A,B,C,D needed for the hash
- public void engineReset()
- {
- bytecount = 0;
- A = 0x67452301;
- B = 0xefcdab89;
- C = 0x98badcfe;
- D = 0x10325476;
- for(int i = 0; i < 16; i++)
- W[i] = 0;
- }
-
- public void engineUpdate (byte b)
- {
- int i = (int)bytecount % 64;
- int shift = (3 - i % 4) * 8;
- int idx = i / 4;
-
- // if you could index ints, this would be: W[idx][shift/8] = b
- W[idx] = (W[idx] & ~(0xff << shift)) | ((b & 0xff) << shift);
-
- // if we've filled up a block, then process it
- if ((++ bytecount) % 64 == 0)
- munch ();
- }
-
- public void engineUpdate (byte bytes[], int off, int len)
- {
- if (len < 0)
- throw new ArrayIndexOutOfBoundsException ();
-
- int end = off + len;
- while (off < end)
- engineUpdate (bytes[off++]);
- }
-
- public byte[] engineDigest()
- {
- long bitcount = bytecount * 8;
- engineUpdate ((byte)0x80); // 10000000 in binary; the start of the padding
-
- // add the rest of the padding to fill this block out, but leave 8
- // bytes to put in the original bytecount
- while ((int)bytecount % 64 != 56)
- engineUpdate ((byte)0);
-
- // add the length of the original, unpadded block to the end of
- // the padding
- W[14] = SWAP((int)(0xffffffff & bitcount));
- W[15] = SWAP((int)(0xffffffff & (bitcount >>> 32)));
- bytecount += 8;
-
- // digest the fully padded block
- munch ();
-
- A = SWAP(A);
- B = SWAP(B);
- C = SWAP(C);
- D = SWAP(D);
- byte[] result = new byte[] {(byte)(A >>> 24), (byte)(A >>> 16),
- (byte)(A >>> 8), (byte)A,
- (byte)(B >>> 24), (byte)(B >>> 16),
- (byte)(B >>> 8), (byte)B,
- (byte)(C >>> 24), (byte)(C >>> 16),
- (byte)(C >>> 8), (byte)C,
- (byte)(D >>> 24), (byte)(D >>> 16),
- (byte)(D >>> 8), (byte)D};
-
- engineReset ();
- return result;
- }
-
- private int F( int X, int Y, int Z)
- {
- return ((X & Y) | (~X & Z));
- }
-
- private int G( int X, int Y, int Z)
- {
- return ((X & Z) | (Y & ~Z));
- }
-
- private int H( int X, int Y, int Z)
- {
- return (X ^ Y ^ Z);
- }
-
- private int I( int X, int Y, int Z)
- {
- return (Y ^ (X | ~Z));
- }
-
- private int rotateLeft( int i, int count)
- {
- //Taken from FIPS 180-1
- return ( (i << count) | (i >>> (32 - count)) ) ;
- }
-
- /* Round 1. */
- private int FF( int a, int b, int c, int d, int k, int s, int i)
- {
- /* Let [abcd k s i] denote the operation */
- a += F(b,c,d) + k + i;
- return b + rotateLeft(a, s);
- }
- /* Round 2. */
- private int GG( int a, int b, int c, int d, int k, int s, int i)
- {
- /* Let [abcd k s i] denote the operation */
- a += G(b,c,d) + k + i;
- return b + rotateLeft(a, s);
- }
- /* Round 3. */
- private int HH( int a, int b, int c, int d, int k, int s, int i)
- {
- /* Let [abcd k s t] denote the operation */
- a += H(b,c,d) + k + i;
- return b + rotateLeft(a, s);
- }
-
- /* Round 4. */
- private int II( int a, int b, int c, int d, int k, int s, int i)
- {
- /* Let [abcd k s t] denote the operation */
- a += I(b,c,d) + k + i;
- return b + rotateLeft(a, s);
- }
-
- private int SWAP(int n)
- {
- //Copied from md5.c in FSF Gnu Privacy Guard 0.9.2
- return (( (0xff & n) << 24) | ((n & 0xff00) << 8) | ((n >>> 8) & 0xff00) | (n >>> 24));
- }
-
- private void munch()
- {
- int AA,BB,CC,DD, j;
- int X[] = new int[16];
-
- /* Copy block i into X. */
- for(j = 0; j < 16; j++)
- X[j] = SWAP(W[j]);
-
- /* Save A as AA, B as BB, C as CC, and D as DD. */
- AA = A;
- BB = B;
- CC = C;
- DD = D;
-
- /* The hex constants are from md5.c
- in FSF Gnu Privacy Guard 0.9.2 */
- /* Round 1. */
- /* Let [abcd k s i] denote the operation
- a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- A = FF(A,B,C,D, X[0], 7, 0xd76aa478);
- D = FF(D,A,B,C, X[1], 12, 0xe8c7b756);
- C = FF(C,D,A,B, X[2], 17, 0x242070db);
- B = FF(B,C,D,A, X[3], 22, 0xc1bdceee);
-
- A = FF(A,B,C,D, X[4], 7, 0xf57c0faf);
- D = FF(D,A,B,C, X[5], 12, 0x4787c62a);
- C = FF(C,D,A,B, X[6], 17, 0xa8304613);
- B = FF(B,C,D,A, X[7], 22, 0xfd469501);
-
- A = FF(A,B,C,D, X[8], 7, 0x698098d8);
- D = FF(D,A,B,C, X[9], 12, 0x8b44f7af);
- C = FF(C,D,A,B, X[10], 17, 0xffff5bb1);
- B = FF(B,C,D,A, X[11], 22, 0x895cd7be);
-
- A = FF(A,B,C,D, X[12], 7, 0x6b901122);
- D = FF(D,A,B,C, X[13], 12, 0xfd987193);
- C = FF(C,D,A,B, X[14], 17, 0xa679438e);
- B = FF(B,C,D,A, X[15], 22, 0x49b40821);
-
- /* Round 2. */
- /* Let [abcd k s i] denote the operation
- a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- A = GG(A,B,C,D, X[1], 5, 0xf61e2562);
- D = GG(D,A,B,C, X[6], 9, 0xc040b340);
- C = GG(C,D,A,B, X[11], 14, 0x265e5a51);
- B = GG(B,C,D,A, X[0], 20, 0xe9b6c7aa);
-
- A = GG(A,B,C,D, X[5], 5, 0xd62f105d);
- D = GG(D,A,B,C, X[10], 9, 0x02441453);
- C = GG(C,D,A,B, X[15], 14, 0xd8a1e681);
- B = GG(B,C,D,A, X[4], 20, 0xe7d3fbc8);
-
- A = GG(A,B,C,D, X[9], 5, 0x21e1cde6);
- D = GG(D,A,B,C, X[14], 9, 0xc33707d6);
- C = GG(C,D,A,B, X[3], 14, 0xf4d50d87);
- B = GG(B,C,D,A, X[8], 20, 0x455a14ed);
-
- A = GG(A,B,C,D, X[13], 5, 0xa9e3e905);
- D = GG(D,A,B,C, X[2], 9, 0xfcefa3f8);
- C = GG(C,D,A,B, X[7], 14, 0x676f02d9);
- B = GG(B,C,D,A, X[12], 20, 0x8d2a4c8a);
-
- /* Round 3. */
- /* Let [abcd k s t] denote the operation
- a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- A = HH(A,B,C,D, X[5], 4, 0xfffa3942);
- D = HH(D,A,B,C, X[8], 11, 0x8771f681);
- C = HH(C,D,A,B, X[11], 16, 0x6d9d6122);
- B = HH(B,C,D,A, X[14], 23, 0xfde5380c);
-
- A = HH(A,B,C,D, X[1], 4, 0xa4beea44);
- D = HH(D,A,B,C, X[4], 11, 0x4bdecfa9);
- C = HH(C,D,A,B, X[7], 16, 0xf6bb4b60);
- B = HH(B,C,D,A, X[10], 23, 0xbebfbc70);
-
- A = HH(A,B,C,D, X[13], 4, 0x289b7ec6);
- D = HH(D,A,B,C, X[0], 11, 0xeaa127fa);
- C = HH(C,D,A,B, X[3], 16, 0xd4ef3085);
- B = HH(B,C,D,A, X[6], 23, 0x04881d05);
-
- A = HH(A,B,C,D, X[9], 4, 0xd9d4d039);
- D = HH(D,A,B,C, X[12], 11, 0xe6db99e5);
- C = HH(C,D,A,B, X[15], 16, 0x1fa27cf8);
- B = HH(B,C,D,A, X[2], 23, 0xc4ac5665);
-
- /* Round 4. */
- /* Let [abcd k s t] denote the operation
- a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- A = II(A,B,C,D, X[0], 6, 0xf4292244);
- D = II(D,A,B,C, X[7], 10, 0x432aff97);
- C = II(C,D,A,B, X[14], 15, 0xab9423a7);
- B = II(B,C,D,A, X[5], 21, 0xfc93a039);
-
- A = II(A,B,C,D, X[12], 6, 0x655b59c3);
- D = II(D,A,B,C, X[3], 10, 0x8f0ccc92);
- C = II(C,D,A,B, X[10], 15, 0xffeff47d);
- B = II(B,C,D,A, X[1], 21, 0x85845dd1);
-
- A = II(A,B,C,D, X[8], 6, 0x6fa87e4f);
- D = II(D,A,B,C, X[15], 10, 0xfe2ce6e0);
- C = II(C,D,A,B, X[6], 15, 0xa3014314);
- B = II(B,C,D,A, X[13], 21, 0x4e0811a1);
-
- A = II(A,B,C,D, X[4], 6, 0xf7537e82);
- D = II(D,A,B,C, X[11], 10, 0xbd3af235);
- C = II(C,D,A,B, X[2], 15, 0x2ad7d2bb);
- B = II(B,C,D,A, X[9], 21, 0xeb86d391);
-
- /* Then perform the following additions. (That is increment each
- of the four registers by the value it had before this block
- was started.) */
- A = A + AA;
- B = B + BB;
- C = C + CC;
- D = D + DD;
- }
-}
diff --git a/libjava/gnu/java/security/provider/MD5withRSA.java b/libjava/gnu/java/security/provider/MD5withRSA.java
deleted file mode 100644
index 721d897ed24..00000000000
--- a/libjava/gnu/java/security/provider/MD5withRSA.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* MD5withRSA.java -- MD5 with RSA encryption signatures.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class MD5withRSA extends RSA
-{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public MD5withRSA() throws NoSuchAlgorithmException
- {
- super(MessageDigest.getInstance("MD5"), DIGEST_ALGORITHM.getChild(5));
- }
-}
diff --git a/libjava/gnu/java/security/provider/PKIXCertPathValidatorImpl.java b/libjava/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
deleted file mode 100644
index 1268b169d9b..00000000000
--- a/libjava/gnu/java/security/provider/PKIXCertPathValidatorImpl.java
+++ /dev/null
@@ -1,701 +0,0 @@
-/* PKIXCertPathValidatorImpl.java -- PKIX certificate path validator.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import gnu.java.security.OID;
-import gnu.java.security.x509.GnuPKIExtension;
-import gnu.java.security.x509.PolicyNodeImpl;
-import gnu.java.security.x509.X509CRLSelectorImpl;
-import gnu.java.security.x509.X509CertSelectorImpl;
-import gnu.java.security.x509.ext.BasicConstraints;
-import gnu.java.security.x509.ext.CertificatePolicies;
-import gnu.java.security.x509.ext.Extension;
-import gnu.java.security.x509.ext.KeyUsage;
-import gnu.java.security.x509.ext.PolicyConstraint;
-
-import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.PublicKey;
-import java.security.cert.CRL;
-import java.security.cert.CertPath;
-import java.security.cert.CertPathParameters;
-import java.security.cert.CertPathValidatorException;
-import java.security.cert.CertPathValidatorResult;
-import java.security.cert.CertPathValidatorSpi;
-import java.security.cert.CertStore;
-import java.security.cert.CertStoreException;
-import java.security.cert.CertificateException;
-import java.security.cert.PKIXCertPathChecker;
-import java.security.cert.PKIXCertPathValidatorResult;
-import java.security.cert.PKIXParameters;
-import java.security.cert.TrustAnchor;
-import java.security.cert.X509CRL;
-import java.security.cert.X509Certificate;
-import java.security.interfaces.DSAParams;
-import java.security.interfaces.DSAPublicKey;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * An implementation of the Public Key Infrastructure's X.509
- * certificate path validation algorithm.
- *
- * See RFC 3280:
- * Internet X.509 Public Key Infrastructure Certificate and
- * Certificate Revocation List (CRL) Profile.
- *
- * @author Casey Marshall (rsdio@metastatic.org)
- */
-public class PKIXCertPathValidatorImpl extends CertPathValidatorSpi
-{
-
- // Constants.
- // -------------------------------------------------------------------------
-
- private static final boolean DEBUG = false;
- private static void debug (String msg)
- {
- System.err.print (">> PKIXCertPathValidatorImpl: ");
- System.err.println (msg);
- }
-
- public static final String ANY_POLICY = "2.5.29.32.0";
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public PKIXCertPathValidatorImpl()
- {
- super();
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public CertPathValidatorResult engineValidate(CertPath path,
- CertPathParameters params)
- throws CertPathValidatorException, InvalidAlgorithmParameterException
- {
- if (!(params instanceof PKIXParameters))
- throw new InvalidAlgorithmParameterException("not a PKIXParameters object");
-
- // First check if the certificate path is valid.
- //
- // This means that:
- //
- // (a) for all x in {1, ..., n-1}, the subject of certificate x is
- // the issuer of certificate x+1;
- //
- // (b) for all x in {1, ..., n}, the certificate was valid at the
- // time in question.
- //
- // Because this is the X.509 algorithm, we also check if all
- // cerificates are of type X509Certificate.
-
- PolicyNodeImpl rootNode = new PolicyNodeImpl();
- Set initPolicies = ((PKIXParameters) params).getInitialPolicies();
- rootNode.setValidPolicy(ANY_POLICY);
- rootNode.setCritical(false);
- rootNode.setDepth(0);
- if (initPolicies != null)
- rootNode.addAllExpectedPolicies(initPolicies);
- else
- rootNode.addExpectedPolicy(ANY_POLICY);
- List checks = ((PKIXParameters) params).getCertPathCheckers();
- List l = path.getCertificates();
- if (l == null || l.size() == 0)
- throw new CertPathValidatorException();
- X509Certificate[] p = null;
- try
- {
- p = (X509Certificate[]) l.toArray(new X509Certificate[l.size()]);
- }
- catch (ClassCastException cce)
- {
- throw new CertPathValidatorException("invalid certificate path");
- }
-
- String sigProvider = ((PKIXParameters) params).getSigProvider();
- PublicKey prevKey = null;
- Date now = ((PKIXParameters) params).getDate();
- if (now == null)
- now = new Date();
- LinkedList policyConstraints = new LinkedList();
- for (int i = p.length - 1; i >= 0; i--)
- {
- try
- {
- p[i].checkValidity(now);
- }
- catch (CertificateException ce)
- {
- throw new CertPathValidatorException(ce.toString());
- }
- Set uce = getCritExts(p[i]);
- for (Iterator check = checks.iterator(); check.hasNext(); )
- {
- try
- {
- ((PKIXCertPathChecker) check.next()).check(p[i], uce);
- }
- catch (Exception x)
- {
- }
- }
-
- PolicyConstraint constr = null;
- if (p[i] instanceof GnuPKIExtension)
- {
- Extension pcx =
- ((GnuPKIExtension) p[i]).getExtension (PolicyConstraint.ID);
- if (pcx != null)
- constr = (PolicyConstraint) pcx.getValue();
- }
- else
- {
- byte[] pcx = p[i].getExtensionValue (PolicyConstraint.ID.toString());
- if (pcx != null)
- {
- try
- {
- constr = new PolicyConstraint (pcx);
- }
- catch (Exception x)
- {
- }
- }
- }
- if (constr != null && constr.getRequireExplicitPolicy() >= 0)
- {
- policyConstraints.add (new int[]
- { p.length-i, constr.getRequireExplicitPolicy() });
- }
-
- updatePolicyTree(p[i], rootNode, p.length-i, (PKIXParameters) params,
- checkExplicitPolicy (p.length-i, policyConstraints));
-
- // The rest of the tests involve this cert's relationship with the
- // next in the path. If this cert is the end entity, we can stop.
- if (i == 0)
- break;
-
- basicSanity(p, i);
- PublicKey pubKey = null;
- try
- {
- pubKey = p[i].getPublicKey();
- if (pubKey instanceof DSAPublicKey)
- {
- DSAParams dsa = ((DSAPublicKey) pubKey).getParams();
- // If the DSA public key is missing its parameters, use those
- // from the previous cert's key.
- if (dsa == null || dsa.getP() == null || dsa.getG() == null
- || dsa.getQ() == null)
- {
- if (prevKey == null)
- throw new InvalidKeyException("DSA keys not chainable");
- if (!(prevKey instanceof DSAPublicKey))
- throw new InvalidKeyException("DSA keys not chainable");
- dsa = ((DSAPublicKey) prevKey).getParams();
- pubKey = new GnuDSAPublicKey(((DSAPublicKey) pubKey).getY(),
- dsa.getP(), dsa.getQ(), dsa.getG());
- }
- }
- if (sigProvider == null)
- p[i-1].verify(pubKey);
- else
- p[i-1].verify(pubKey, sigProvider);
- prevKey = pubKey;
- }
- catch (Exception e)
- {
- throw new CertPathValidatorException(e.toString());
- }
- if (!p[i].getSubjectDN().equals(p[i-1].getIssuerDN()))
- throw new CertPathValidatorException("issuer DN mismatch");
- boolean[] issuerUid = p[i-1].getIssuerUniqueID();
- boolean[] subjectUid = p[i].getSubjectUniqueID();
- if (issuerUid != null && subjectUid != null)
- if (!Arrays.equals(issuerUid, subjectUid))
- throw new CertPathValidatorException("UID mismatch");
-
- // Check the certificate against the revocation lists.
- if (((PKIXParameters) params).isRevocationEnabled())
- {
- X509CRLSelectorImpl selector = new X509CRLSelectorImpl();
- try
- {
- selector.addIssuerName(p[i].getSubjectDN());
- }
- catch (IOException ioe)
- {
- throw new CertPathValidatorException("error selecting CRLs");
- }
- List certStores = ((PKIXParameters) params).getCertStores();
- List crls = new LinkedList();
- for (Iterator it = certStores.iterator(); it.hasNext(); )
- {
- CertStore cs = (CertStore) it.next();
- try
- {
- Collection c = cs.getCRLs(selector);
- crls.addAll(c);
- }
- catch (CertStoreException cse)
- {
- }
- }
- if (crls.isEmpty())
- throw new CertPathValidatorException("no CRLs for issuer");
- boolean certOk = false;
- for (Iterator it = crls.iterator(); it.hasNext(); )
- {
- CRL crl = (CRL) it.next();
- if (!(crl instanceof X509CRL))
- continue;
- X509CRL xcrl = (X509CRL) crl;
- if (!checkCRL(xcrl, p, now, p[i], pubKey, certStores))
- continue;
- if (xcrl.isRevoked(p[i-1]))
- throw new CertPathValidatorException("certificate is revoked");
- else
- certOk = true;
- }
- if (!certOk)
- throw new CertPathValidatorException("certificate's validity could not be determined");
- }
- }
- rootNode.setReadOnly();
-
- // Now ensure that the first certificate in the chain was issued
- // by a trust anchor.
- Exception cause = null;
- Set anchors = ((PKIXParameters) params).getTrustAnchors();
- for (Iterator i = anchors.iterator(); i.hasNext(); )
- {
- TrustAnchor anchor = (TrustAnchor) i.next();
- X509Certificate anchorCert = null;
- PublicKey anchorKey = null;
- if (anchor.getTrustedCert() != null)
- {
- anchorCert = anchor.getTrustedCert();
- anchorKey = anchorCert.getPublicKey();
- }
- else
- anchorKey = anchor.getCAPublicKey();
- if (anchorKey == null)
- continue;
- try
- {
- if (anchorCert == null)
- anchorCert.checkValidity(now);
- p[p.length-1].verify(anchorKey);
- if (anchorCert != null && anchorCert.getBasicConstraints() >= 0
- && anchorCert.getBasicConstraints() < p.length)
- continue;
-
- if (((PKIXParameters) params).isRevocationEnabled())
- {
- X509CRLSelectorImpl selector = new X509CRLSelectorImpl();
- if (anchorCert != null)
- try
- {
- selector.addIssuerName(anchorCert.getSubjectDN());
- }
- catch (IOException ioe)
- {
- }
- else
- selector.addIssuerName(anchor.getCAName());
- List certStores = ((PKIXParameters) params).getCertStores();
- List crls = new LinkedList();
- for (Iterator it = certStores.iterator(); it.hasNext(); )
- {
- CertStore cs = (CertStore) it.next();
- try
- {
- Collection c = cs.getCRLs(selector);
- crls.addAll(c);
- }
- catch (CertStoreException cse)
- {
- }
- }
- if (crls.isEmpty())
- continue;
- for (Iterator it = crls.iterator(); it.hasNext(); )
- {
- CRL crl = (CRL) it.next();
- if (!(crl instanceof X509CRL))
- continue;
- X509CRL xcrl = (X509CRL) crl;
- try
- {
- xcrl.verify(anchorKey);
- }
- catch (Exception x)
- {
- continue;
- }
- Date nextUpdate = xcrl.getNextUpdate();
- if (nextUpdate != null && nextUpdate.compareTo(now) < 0)
- continue;
- if (xcrl.isRevoked(p[p.length-1]))
- throw new CertPathValidatorException("certificate is revoked");
- }
- }
-
- // The chain is valid; return the result.
- return new PKIXCertPathValidatorResult(anchor, rootNode,
- p[0].getPublicKey());
- }
- catch (Exception ignored)
- {
- cause = ignored;
- continue;
- }
- }
-
- // The path is not valid.
- CertPathValidatorException cpve =
- new CertPathValidatorException("path validation failed");
- if (cause != null)
- cpve.initCause (cause);
- throw cpve;
- }
-
- // Own methods.
- // -------------------------------------------------------------------------
-
- /**
- * Check if a given CRL is acceptable for checking the revocation status
- * of certificates in the path being checked.
- *
- * The CRL is accepted iff: The printable bytes show up as-is if they are printable and
- * not a newline character, otherwise showing as '.'.
- *
- * @param buf The bytes to format.
- * @param off The offset to start at.
- * @param len The number of bytes to encode.
- * @return The formatted string.
- */
- public static String hexDump(byte[] buf, int off, int len, String prefix)
- {
- String nl = System.getProperty("line.separator");
- StringBuffer str = new StringBuffer();
- int i = 0;
- while (i < len)
- {
- str.append(prefix);
- str.append(Util.formatInt(i+off, 16, 8));
- str.append(" ");
- String s = Util.toHexString(buf, i+off, Math.min(16, len-i), ' ');
- str.append(s);
- for (int j = 56 - (56 - s.length()); j < 56; j++)
- str.append(" ");
- for (int j = 0; j < Math.min(16, len - i); j++)
- {
- if ((buf[i+off+j] & 0xFF) < 0x20 || (buf[i+off+j] & 0xFF) > 0x7E)
- str.append('.');
- else
- str.append((char) (buf[i+off+j] & 0xFF));
- }
- str.append(nl);
- i += 16;
- }
- return str.toString();
- }
-
- /**
- * See {@link #hexDump(byte[],int,int)}.
- */
- public static String hexDump(byte[] buf, String prefix)
- {
- return hexDump(buf, 0, buf.length, prefix);
- }
-
- /**
- * Format an integer into the specified radix, zero-filled.
- *
- * @param i The integer to format.
- * @param radix The radix to encode to.
- * @param len The target length of the string. The string is
- * zero-padded to this length, but may be longer.
- * @return The formatted integer.
- */
- public static String formatInt(int i, int radix, int len)
- {
- String s = Integer.toString(i, radix);
- StringBuffer buf = new StringBuffer();
- for (int j = 0; j < len - s.length(); j++)
- buf.append("0");
- buf.append(s);
- return buf.toString();
- }
-
- /**
- * Convert a hexadecimal string into its byte representation.
- *
- * @param hex The hexadecimal string.
- * @return The converted bytes.
- */
- public static byte[] toByteArray(String hex)
- {
- hex = hex.toLowerCase();
- byte[] buf = new byte[hex.length() / 2];
- int j = 0;
- for (int i = 0; i < buf.length; i++)
- {
- buf[i] = (byte) ((Character.digit(hex.charAt(j++), 16) << 4) |
- Character.digit(hex.charAt(j++), 16));
- }
- return buf;
- }
-}
diff --git a/libjava/gnu/java/security/x509/X500DistinguishedName.java b/libjava/gnu/java/security/x509/X500DistinguishedName.java
deleted file mode 100644
index daf746f5dc5..00000000000
--- a/libjava/gnu/java/security/x509/X500DistinguishedName.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/* X500DistinguishedName.java -- X.500 distinguished name.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class X500DistinguishedName implements Principal
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID CN = new OID("2.5.4.3");
- public static final OID C = new OID("2.5.4.6");
- public static final OID L = new OID("2.5.4.7");
- public static final OID ST = new OID("2.5.4.8");
- public static final OID STREET = new OID("2.5.4.9");
- public static final OID O = new OID("2.5.4.10");
- public static final OID OU = new OID("2.5.4.11");
- public static final OID T = new OID("2.5.4.12");
- public static final OID DNQ = new OID("2.5.4.46");
- public static final OID NAME = new OID("2.5.4.41");
- public static final OID GIVENNAME = new OID("2.5.4.42");
- public static final OID INITIALS = new OID("2.5.4.43");
- public static final OID GENERATION = new OID("2.5.4.44");
- public static final OID EMAIL = new OID("1.2.840.113549.1.9.1");
- public static final OID DC = new OID("0.9.2342.19200300.100.1.25");
- public static final OID UID = new OID("0.9.2342.19200300.100.1.1");
-
- private List components;
- private Map currentRdn;
- private boolean fixed;
- private String stringRep;
- private byte[] encoded;
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public X500DistinguishedName()
- {
- components = new LinkedList();
- currentRdn = new LinkedHashMap();
- components.add(currentRdn);
- }
-
- public X500DistinguishedName(String name)
- {
- this();
- try
- {
- parseString(name);
- }
- catch (IOException ioe)
- {
- throw new IllegalArgumentException(ioe.toString());
- }
- }
-
- public X500DistinguishedName(byte[] encoded) throws IOException
- {
- this();
- parseDer(new DERReader(encoded));
- }
-
- public X500DistinguishedName(InputStream encoded) throws IOException
- {
- this();
- parseDer(new DERReader(encoded));
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public String getName()
- {
- return toString();
- }
-
- public void newRelativeDistinguishedName()
- {
- if (fixed || currentRdn.isEmpty()) return;
- currentRdn = new LinkedHashMap();
- components.add(currentRdn);
- }
-
- public int size()
- {
- return components.size();
- }
-
- public int countComponents()
- {
- int count = 0;
- for (Iterator it = components.iterator(); it.hasNext(); )
- {
- count += ((Map) it.next()).size();
- }
- return count;
- }
-
- public boolean containsComponent(OID oid, String value)
- {
- for (Iterator it = components.iterator(); it.hasNext(); )
- {
- Map rdn = (Map) it.next();
- String s = (String) rdn.get(oid);
- if (s == null)
- continue;
- if (compressWS(value).equalsIgnoreCase(compressWS(s)))
- return true;
- }
- return false;
- }
-
- public String getComponent(OID oid)
- {
- for (Iterator it = components.iterator(); it.hasNext(); )
- {
- Map rdn = (Map) it.next();
- if (rdn.containsKey(oid))
- return (String) rdn.get(oid);
- }
- return null;
- }
-
- public String getComponent(OID oid, int rdn)
- {
- if (rdn >= size())
- return null;
- return (String) ((Map) components.get(rdn)).get(oid);
- }
-
- public void putComponent(OID oid, String value)
- {
- currentRdn.put(oid, value);
- }
-
- public void putComponent(String name, String value)
- {
- name = name.trim().toLowerCase();
- if (name.equals("cn"))
- putComponent(CN, value);
- else if (name.equals("c"))
- putComponent(C, value);
- else if (name.equals("l"))
- putComponent(L, value);
- else if (name.equals("street"))
- putComponent(STREET, value);
- else if (name.equals("st"))
- putComponent(ST, value);
- else if (name.equals("t"))
- putComponent(T, value);
- else if (name.equals("dnq"))
- putComponent(DNQ, value);
- else if (name.equals("name"))
- putComponent(NAME, value);
- else if (name.equals("givenname"))
- putComponent(GIVENNAME, value);
- else if (name.equals("initials"))
- putComponent(INITIALS, value);
- else if (name.equals("generation"))
- putComponent(GENERATION, value);
- else if (name.equals("email"))
- putComponent(EMAIL, value);
- else if (name.equals("dc"))
- putComponent(DC, value);
- else if (name.equals("uid"))
- putComponent(UID, value);
- else
- putComponent(new OID(name), value);
- }
-
- public void setUnmodifiable()
- {
- if (fixed) return;
- fixed = true;
- List newComps = new ArrayList(components.size());
- for (Iterator it = components.iterator(); it.hasNext(); )
- {
- Map rdn = (Map) it.next();
- rdn = Collections.unmodifiableMap(rdn);
- newComps.add(rdn);
- }
- components = Collections.unmodifiableList(newComps);
- currentRdn = Collections.EMPTY_MAP;
- }
-
- public int hashCode()
- {
- int sum = 0;
- for (Iterator it = components.iterator(); it.hasNext(); )
- {
- Map m = (Map) it.next();
- for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); )
- {
- Map.Entry e = (Map.Entry) it2.next();
- sum += e.getKey().hashCode();
- sum += e.getValue().hashCode();
- }
- }
- return sum;
- }
-
- public boolean equals(Object o)
- {
- if (!(o instanceof X500DistinguishedName))
- return false;
- if (size() != ((X500DistinguishedName) o).size())
- return false;
- for (int i = 0; i < size(); i++)
- {
- Map m = (Map) components.get(i);
- for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); )
- {
- Map.Entry e = (Map.Entry) it2.next();
- OID oid = (OID) e.getKey();
- String v1 = (String) e.getValue();
- String v2 = ((X500DistinguishedName) o).getComponent(oid, i);
- if (!compressWS(v1).equalsIgnoreCase(compressWS(v2)))
- return false;
- }
- }
- return true;
- }
-
- public String toString()
- {
- if (fixed && stringRep != null)
- return stringRep;
- StringBuffer str = new StringBuffer();
- for (Iterator it = components.iterator(); it.hasNext(); )
- {
- Map m = (Map) it.next();
- for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) it2.next();
- OID oid = (OID) entry.getKey();
- String value = (String) entry.getValue();
- if (oid.equals(CN))
- str.append("CN");
- else if (oid.equals(C))
- str.append("C");
- else if (oid.equals(L))
- str.append("L");
- else if (oid.equals(ST))
- str.append("ST");
- else if (oid.equals(STREET))
- str.append("STREET");
- else if (oid.equals(O))
- str.append("O");
- else if (oid.equals(OU))
- str.append("OU");
- else if (oid.equals(T))
- str.append("T");
- else if (oid.equals(DNQ))
- str.append("DNQ");
- else if (oid.equals(NAME))
- str.append("NAME");
- else
- str.append(oid.toString());
- str.append('=');
- str.append(value);
- if (it2.hasNext())
- str.append("+");
- }
- if (it.hasNext())
- str.append(',');
- }
- return (stringRep = str.toString());
- }
-
- public byte[] getDer()
- {
- if (fixed && encoded != null)
- return (byte[]) encoded.clone();
- ArrayList name = new ArrayList(components.size());
- for (Iterator it = components.iterator(); it.hasNext(); )
- {
- Map m = (Map) it.next();
- if (m.isEmpty())
- continue;
- Set rdn = new HashSet();
- for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); )
- {
- Map.Entry e = (Map.Entry) it.next();
- ArrayList atav = new ArrayList(2);
- atav.add(new DERValue(DER.OBJECT_IDENTIFIER, e.getKey()));
- atav.add(new DERValue(DER.UTF8_STRING, e.getValue()));
- rdn.add(new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, atav));
- }
- name.add(new DERValue(DER.SET|DER.CONSTRUCTED, rdn));
- }
- DERValue val = new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, name);
- return (byte[]) (encoded = val.getEncoded()).clone();
- }
-
- // Own methods.
- // -------------------------------------------------------------------------
-
- private int sep;
-
- private void parseString(String str) throws IOException
- {
- Reader in = new StringReader(str);
- while (true)
- {
- String key = readAttributeType(in);
- if (key == null)
- break;
- String value = readAttributeValue(in);
- putComponent(key, value);
- if (sep == ',')
- newRelativeDistinguishedName();
- }
- setUnmodifiable();
- }
-
- private String readAttributeType(Reader in) throws IOException
- {
- StringBuffer buf = new StringBuffer();
- int ch;
- while ((ch = in.read()) != '=')
- {
- if (ch == -1)
- {
- if (buf.length() > 0)
- throw new EOFException();
- return null;
- }
- if (ch > 127)
- throw new IOException("Invalid char: " + (char) ch);
- if (Character.isLetterOrDigit((char) ch) || ch == '-' || ch == '.')
- buf.append((char) ch);
- else
- throw new IOException("Invalid char: " + (char) ch);
- }
- return buf.toString();
- }
-
- private String readAttributeValue(Reader in) throws IOException
- {
- StringBuffer buf = new StringBuffer();
- int ch = in.read();
- if (ch == '#')
- {
- while (true)
- {
- ch = in.read();
- if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F')
- || Character.isDigit((char) ch))
- buf.append((char) ch);
- else if (ch == '+' || ch == ',')
- {
- sep = ch;
- String hex = buf.toString();
- return new String(Util.toByteArray(hex));
- }
- else
- throw new IOException("illegal character: " + (char) ch);
- }
- }
- else if (ch == '"')
- {
- while (true)
- {
- ch = in.read();
- if (ch == '"')
- break;
- else if (ch == '\\')
- {
- ch = in.read();
- if (ch == -1)
- throw new EOFException();
- if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F')
- || Character.isDigit((char) ch))
- {
- int i = Character.digit((char) ch, 16) << 4;
- ch = in.read();
- if (!(('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F')
- || Character.isDigit((char) ch)))
- throw new IOException("illegal hex char");
- i |= Character.digit((char) ch, 16);
- buf.append((char) i);
- }
- else
- buf.append((char) ch);
- }
- else
- buf.append((char) ch);
- }
- sep = in.read();
- if (sep != '+' || sep != ',')
- throw new IOException("illegal character: " + (char) ch);
- return buf.toString();
- }
- else
- {
- while (true)
- {
- switch (ch)
- {
- case '+':
- case ',':
- sep = ch;
- return buf.toString();
- case '\\':
- ch = in.read();
- if (ch == -1)
- throw new EOFException();
- if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F')
- || Character.isDigit((char) ch))
- {
- int i = Character.digit((char) ch, 16) << 4;
- ch = in.read();
- if (!(('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F')
- || Character.isDigit((char) ch)))
- throw new IOException("illegal hex char");
- i |= Character.digit((char) ch, 16);
- buf.append((char) i);
- }
- else
- buf.append((char) ch);
- break;
- case '=':
- case '<':
- case '>':
- case '#':
- case ';':
- throw new IOException("illegal character: " + (char) ch);
- case -1:
- throw new EOFException();
- default:
- buf.append((char) ch);
- }
- }
- }
- }
-
- private void parseDer(DERReader der) throws IOException
- {
- DERValue name = der.read();
- if (!name.isConstructed())
- throw new IOException("malformed Name");
- encoded = name.getEncoded();
- int len = 0;
- while (len < name.getLength())
- {
- DERValue rdn = der.read();
- if (!rdn.isConstructed())
- throw new IOException("badly formed RDNSequence");
- int len2 = 0;
- while (len2 < rdn.getLength())
- {
- DERValue atav = der.read();
- if (!atav.isConstructed())
- throw new IOException("badly formed AttributeTypeAndValue");
- DERValue val = der.read();
- if (val.getTag() != DER.OBJECT_IDENTIFIER)
- throw new IOException("badly formed AttributeTypeAndValue");
- OID oid = (OID) val.getValue();
- val = der.read();
- if (!(val.getValue() instanceof String))
- throw new IOException("badly formed AttributeTypeAndValue");
- String value = (String) val.getValue();
- putComponent(oid, value);
- len2 += atav.getEncodedLength();
- }
- len += rdn.getEncodedLength();
- if (len < name.getLength())
- newRelativeDistinguishedName();
- }
- setUnmodifiable();
- }
-
- private static String compressWS(String str)
- {
- StringBuffer buf = new StringBuffer();
- char lastChar = 0;
- for (int i = 0; i < str.length(); i++)
- {
- char c = str.charAt(i);
- if (Character.isWhitespace(c))
- {
- if (!Character.isWhitespace(lastChar))
- buf.append(' ');
- }
- else
- buf.append(c);
- lastChar = c;
- }
- return buf.toString().trim();
- }
-}
diff --git a/libjava/gnu/java/security/x509/X509CRL.java b/libjava/gnu/java/security/x509/X509CRL.java
deleted file mode 100644
index 5b2d3b14130..00000000000
--- a/libjava/gnu/java/security/x509/X509CRL.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/* X509CRL.java -- X.509 certificate revocation list.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.BitString;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.x509.ext.Extension;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Principal;
-import java.security.PublicKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CRLException;
-import java.security.cert.Certificate;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.security.auth.x500.X500Principal;
-
-/**
- * X.509 certificate revocation lists.
- *
- * @author Casey Marshall (rsdio@metastatic.org)
- */
-public class X509CRL extends java.security.cert.X509CRL
- implements GnuPKIExtension
-{
-
- // Constants and fields.
- // ------------------------------------------------------------------------
-
- private static final boolean DEBUG = false;
- private static void debug(String msg)
- {
- if (DEBUG)
- {
- System.err.print(">> X509CRL: ");
- System.err.println(msg);
- }
- }
-
- private static final OID ID_DSA = new OID("1.2.840.10040.4.1");
- private static final OID ID_DSA_WITH_SHA1 = new OID("1.2.840.10040.4.3");
- private static final OID ID_RSA = new OID("1.2.840.113549.1.1.1");
- private static final OID ID_RSA_WITH_MD2 = new OID("1.2.840.113549.1.1.2");
- private static final OID ID_RSA_WITH_MD5 = new OID("1.2.840.113549.1.1.4");
- private static final OID ID_RSA_WITH_SHA1 = new OID("1.2.840.113549.1.1.5");
-
- private byte[] encoded;
-
- private byte[] tbsCRLBytes;
- private int version;
- private OID algId;
- private byte[] algParams;
- private Date thisUpdate;
- private Date nextUpdate;
- private X500DistinguishedName issuerDN;
- private HashMap revokedCerts;
- private HashMap extensions;
-
- private OID sigAlg;
- private byte[] sigAlgParams;
- private byte[] rawSig;
- private byte[] signature;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new X.509 CRL.
- *
- * @param encoded The DER encoded CRL.
- * @throws CRLException If the input bytes are incorrect.
- * @throws IOException If the input bytes cannot be read.
- */
- public X509CRL(InputStream encoded) throws CRLException, IOException
- {
- super();
- revokedCerts = new HashMap();
- extensions = new HashMap();
- try
- {
- parse(encoded);
- }
- catch (IOException ioe)
- {
- ioe.printStackTrace();
- throw ioe;
- }
- catch (Exception x)
- {
- x.printStackTrace();
- throw new CRLException(x.toString());
- }
- }
-
- // X509CRL methods.
- // ------------------------------------------------------------------------
-
- public boolean equals(Object o)
- {
- if (!(o instanceof X509CRL))
- return false;
- return ((X509CRL) o).getRevokedCertificates().equals(revokedCerts.values());
- }
-
- public int hashCode()
- {
- return revokedCerts.hashCode();
- }
-
- public byte[] getEncoded() throws CRLException
- {
- return (byte[]) encoded.clone();
- }
-
- public void verify(PublicKey key)
- throws CRLException, NoSuchAlgorithmException, InvalidKeyException,
- NoSuchProviderException, SignatureException
- {
- Signature sig = Signature.getInstance(sigAlg.toString());
- doVerify(sig, key);
- }
-
- public void verify(PublicKey key, String provider)
- throws CRLException, NoSuchAlgorithmException, InvalidKeyException,
- NoSuchProviderException, SignatureException
- {
- Signature sig = Signature.getInstance(sigAlg.toString(), provider);
- doVerify(sig, key);
- }
-
- public int getVersion()
- {
- return version;
- }
-
- public Principal getIssuerDN()
- {
- return issuerDN;
- }
-
- public X500Principal getIssuerX500Principal()
- {
- return new X500Principal(issuerDN.getDer());
- }
-
- public Date getThisUpdate()
- {
- return (Date) thisUpdate.clone();
- }
-
- public Date getNextUpdate()
- {
- if (nextUpdate != null)
- return (Date) nextUpdate.clone();
- return null;
- }
-
- public java.security.cert.X509CRLEntry getRevokedCertificate(BigInteger serialNo)
- {
- return (java.security.cert.X509CRLEntry) revokedCerts.get(serialNo);
- }
-
- public Set getRevokedCertificates()
- {
- return Collections.unmodifiableSet(new HashSet(revokedCerts.values()));
- }
-
- public byte[] getTBSCertList() throws CRLException
- {
- return (byte[]) tbsCRLBytes.clone();
- }
-
- public byte[] getSignature()
- {
- return (byte[]) rawSig.clone();
- }
-
- public String getSigAlgName()
- {
- if (sigAlg.equals(ID_DSA_WITH_SHA1))
- return "SHA1withDSA";
- if (sigAlg.equals(ID_RSA_WITH_MD2))
- return "MD2withRSA";
- if (sigAlg.equals(ID_RSA_WITH_MD5))
- return "MD5withRSA";
- if (sigAlg.equals(ID_RSA_WITH_SHA1))
- return "SHA1withRSA";
- return "unknown";
- }
-
- public String getSigAlgOID()
- {
- return sigAlg.toString();
- }
-
- public byte[] getSigAlgParams()
- {
- if (sigAlgParams != null)
- return (byte[]) sigAlgParams.clone();
- return null;
- }
-
- // X509Extension methods.
- // ------------------------------------------------------------------------
-
- public boolean hasUnsupportedCriticalExtension()
- {
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (e.isCritical() && !e.isSupported())
- return true;
- }
- return false;
- }
-
- public Set getCriticalExtensionOIDs()
- {
- HashSet s = new HashSet();
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (e.isCritical())
- s.add(e.getOid().toString());
- }
- return Collections.unmodifiableSet(s);
- }
-
- public Set getNonCriticalExtensionOIDs()
- {
- HashSet s = new HashSet();
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (!e.isCritical())
- s.add(e.getOid().toString());
- }
- return Collections.unmodifiableSet(s);
- }
-
- public byte[] getExtensionValue(String oid)
- {
- Extension e = getExtension(new OID(oid));
- if (e != null)
- {
- return e.getValue().getEncoded();
- }
- return null;
- }
-
- // GnuPKIExtension method.
- // -------------------------------------------------------------------------
-
- public Extension getExtension(OID oid)
- {
- return (Extension) extensions.get(oid);
- }
-
- public Collection getExtensions()
- {
- return extensions.values();
- }
-
- // CRL methods.
- // -------------------------------------------------------------------------
-
- public String toString()
- {
- return X509CRL.class.getName();
- }
-
- public boolean isRevoked(Certificate cert)
- {
- if (!(cert instanceof java.security.cert.X509Certificate))
- throw new IllegalArgumentException("not a X.509 certificate");
- BigInteger certSerial =
- ((java.security.cert.X509Certificate) cert).getSerialNumber();
- X509CRLEntry ent = (X509CRLEntry) revokedCerts.get(certSerial);
- if (ent == null)
- return false;
- return ent.getRevocationDate().compareTo(new Date()) < 0;
- }
-
- // Own methods.
- // ------------------------------------------------------------------------
-
- private void doVerify(Signature sig, PublicKey key)
- throws CRLException, InvalidKeyException, SignatureException
- {
- sig.initVerify(key);
- sig.update(tbsCRLBytes);
- if (!sig.verify(signature))
- throw new CRLException("signature not verified");
- }
-
- private void parse(InputStream in) throws Exception
- {
- // CertificateList ::= SEQUENCE {
- DERReader der = new DERReader(in);
- DERValue val = der.read();
- debug("start CertificateList len == " + val.getLength());
- if (!val.isConstructed())
- throw new IOException("malformed CertificateList");
- encoded = val.getEncoded();
-
- // tbsCertList ::= SEQUENCE { -- TBSCertList
- val = der.read();
- if (!val.isConstructed())
- throw new IOException("malformed TBSCertList");
- debug("start tbsCertList len == " + val.getLength());
- tbsCRLBytes = val.getEncoded();
-
- // version Version OPTIONAL,
- // -- If present must be v2
- val = der.read();
- if (val.getValue() instanceof BigInteger)
- {
- version = ((BigInteger) val.getValue()).intValue() + 1;
- val = der.read();
- }
- else
- version = 1;
- debug("read version == " + version);
-
- // signature AlgorithmIdentifier,
- debug("start AlgorithmIdentifier len == " + val.getLength());
- if (!val.isConstructed())
- throw new IOException("malformed AlgorithmIdentifier");
- DERValue algIdVal = der.read();
- algId = (OID) algIdVal.getValue();
- debug("read object identifier == " + algId);
- if (val.getLength() > algIdVal.getEncodedLength())
- {
- val = der.read();
- debug("read parameters len == " + val.getEncodedLength());
- algParams = val.getEncoded();
- if (val.isConstructed())
- in.skip(val.getLength());
- }
-
- // issuer Name,
- val = der.read();
- issuerDN = new X500DistinguishedName(val.getEncoded());
- der.skip(val.getLength());
- debug("read issuer == " + issuerDN);
-
- // thisUpdate Time,
- thisUpdate = (Date) der.read().getValue();
- debug("read thisUpdate == " + thisUpdate);
-
- // nextUpdate Time OPTIONAL,
- val = der.read();
- if (val.getValue() instanceof Date)
- {
- nextUpdate = (Date) val.getValue();
- debug("read nextUpdate == " + nextUpdate);
- val = der.read();
- }
-
- // revokedCertificates SEQUENCE OF SEQUENCE {
- // -- X509CRLEntry objects...
- // } OPTIONAL,
- if (val.getTag() != 0)
- {
- int len = 0;
- while (len < val.getLength())
- {
- X509CRLEntry entry = new X509CRLEntry(version, der);
- revokedCerts.put(entry.getSerialNumber(), entry);
- len += entry.getEncoded().length;
- }
- val = der.read();
- }
-
- // crlExtensions [0] EXPLICIT Extensions OPTIONAL
- // -- if present MUST be v2
- if (val.getTagClass() != DER.UNIVERSAL && val.getTag() == 0)
- {
- if (version < 2)
- throw new IOException("extra data in CRL");
- DERValue exts = der.read();
- if (!exts.isConstructed())
- throw new IOException("malformed Extensions");
- debug("start Extensions len == " + exts.getLength());
- int len = 0;
- while (len < exts.getLength())
- {
- DERValue ext = der.read();
- if (!ext.isConstructed())
- throw new IOException("malformed Extension");
- Extension e = new Extension(ext.getEncoded());
- extensions.put(e.getOid(), e);
- der.skip(ext.getLength());
- len += ext.getEncodedLength();
- debug("current count == " + len);
- }
- val = der.read();
- }
-
- debug("read tag == " + val.getTag());
- if (!val.isConstructed())
- throw new IOException("malformed AlgorithmIdentifier");
- debug("start AlgorithmIdentifier len == " + val.getLength());
- DERValue sigAlgVal = der.read();
- debug("read tag == " + sigAlgVal.getTag());
- if (sigAlgVal.getTag() != DER.OBJECT_IDENTIFIER)
- throw new IOException("malformed AlgorithmIdentifier");
- sigAlg = (OID) sigAlgVal.getValue();
- debug("signature id == " + sigAlg);
- debug("sigAlgVal length == " + sigAlgVal.getEncodedLength());
- if (val.getLength() > sigAlgVal.getEncodedLength())
- {
- val = der.read();
- debug("sig params tag = " + val.getTag() + " len == " + val.getEncodedLength());
- sigAlgParams = (byte[]) val.getEncoded();
- if (val.isConstructed())
- in.skip(val.getLength());
- }
- val = der.read();
- debug("read tag = " + val.getTag());
- rawSig = val.getEncoded();
- signature = ((BitString) val.getValue()).toByteArray();
- }
-}
diff --git a/libjava/gnu/java/security/x509/X509CRLEntry.java b/libjava/gnu/java/security/x509/X509CRLEntry.java
deleted file mode 100644
index a3bcfdea823..00000000000
--- a/libjava/gnu/java/security/x509/X509CRLEntry.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/* X509CRLEntry.java -- an entry in a X.509 CRL.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.x509.ext.Extension;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.cert.CRLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * A single entry in a X.509 certificate revocation list.
- *
- * @see X509CRL
- * @author Casey Marshall
- */
-class X509CRLEntry extends java.security.cert.X509CRLEntry
- implements GnuPKIExtension
-{
-
- // Constants and fields.
- // ------------------------------------------------------------------------
-
- private static final boolean DEBUG = false;
- private static void debug(String msg)
- {
- if (DEBUG)
- {
- System.err.print(">> X509CRLEntry: ");
- System.err.println(msg);
- }
- }
-
- /** The DER encoded form of this CRL entry. */
- private byte[] encoded;
-
- /** The revoked certificate's serial number. */
- private BigInteger serialNo;
-
- /** The date the certificate was revoked. */
- private Date revocationDate;
-
- /** The CRL entry extensions. */
- private HashMap extensions;
-
- // Constructor.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new X.509 certificate revocation list entry from the given
- * input stream and CRL version number.
- *
- * @param version The CRL version.
- * @param encoded The stream of DER bytes.
- * @throws CRLException If the ASN.1 structure is invalid.
- * @throws IOException If the bytes cannot be read.
- */
- X509CRLEntry(int version, DERReader encoded)
- throws CRLException, IOException
- {
- super();
- extensions = new HashMap();
- try
- {
- parse(version, encoded);
- }
- catch (IOException ioe)
- {
- throw ioe;
- }
- catch (Exception x)
- {
- throw new CRLException(x.toString());
- }
- }
-
- // X509CRLEntry methods.
- // ------------------------------------------------------------------------
-
- public boolean equals(Object o)
- {
- if (!(o instanceof X509CRLEntry))
- return false;
- return ((X509CRLEntry) o).getSerialNumber().equals(serialNo) &&
- ((X509CRLEntry) o).getRevocationDate().equals(revocationDate);
- }
-
- public int hashCode()
- {
- return serialNo.hashCode();
- }
-
- public byte[] getEncoded() throws CRLException
- {
- return (byte[]) encoded.clone();
- }
-
- public BigInteger getSerialNumber()
- {
- return serialNo;
- }
-
- public Date getRevocationDate()
- {
- return (Date) revocationDate.clone();
- }
-
- public boolean hasExtensions()
- {
- return ! extensions.isEmpty();
- }
-
- public String toString()
- {
- return "X509CRLEntry serial=" + serialNo + " revocation date="
- + revocationDate + " ext=" + extensions;
- }
-
- // X509Extension methods.
- // -------------------------------------------------------------------------
-
- public boolean hasUnsupportedCriticalExtension()
- {
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (e.isCritical() && !e.isSupported())
- return true;
- }
- return false;
- }
-
- public Set getCriticalExtensionOIDs()
- {
- HashSet s = new HashSet();
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (e.isCritical())
- s.add(e.getOid().toString());
- }
- return Collections.unmodifiableSet(s);
- }
-
- public Set getNonCriticalExtensionOIDs()
- {
- HashSet s = new HashSet();
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (!e.isCritical())
- s.add(e.getOid().toString());
- }
- return Collections.unmodifiableSet(s);
- }
-
- public byte[] getExtensionValue(String oid)
- {
- Extension e = getExtension(new OID(oid));
- if (e != null)
- {
- return e.getValue().getEncoded();
- }
- return null;
- }
-
- // GnuPKIExtension method.
- // -------------------------------------------------------------------------
-
- public Extension getExtension(OID oid)
- {
- return (Extension) extensions.get(oid);
- }
-
- public Collection getExtensions()
- {
- return extensions.values();
- }
-
- // Own methods.
- // -------------------------------------------------------------------------
-
- private void parse(int version, DERReader der) throws Exception
- {
- // RevokedCertificate ::= SEQUENCE {
- DERValue entry = der.read();
- debug("start CRL entry len == " + entry.getLength());
- if (!entry.isConstructed())
- throw new IOException("malformed revokedCertificate");
- encoded = entry.getEncoded();
- int len = 0;
-
- debug("encoded entry:\n" + Util.hexDump(encoded, ">>>> "));
-
- // userCertificate CertificateSerialNumber,
- DERValue val = der.read();
- serialNo = (BigInteger) val.getValue();
- len += val.getEncodedLength();
- debug("userCertificate == " + serialNo + " current count == " + len);
-
- // revocationDate Time,
- val = der.read();
- revocationDate = (Date) val.getValue();
- len += val.getEncodedLength();
- debug("revocationDate == " + revocationDate + " current count == " + len);
-
- // crlEntryExtensions Extensions OPTIONAL
- // -- if present MUST be v2
- if (len < entry.getLength())
- {
- if (version < 2)
- throw new IOException("extra data in CRL entry");
- DERValue exts = der.read();
- if (!exts.isConstructed())
- throw new IOException("malformed Extensions");
- debug("start Extensions len == " + exts.getLength());
- len = 0;
- while (len < exts.getLength())
- {
- val = der.read();
- if (!val.isConstructed())
- throw new IOException("malformed Extension");
- debug("start Extension len == " + val.getLength());
- Extension e = new Extension(val.getEncoded());
- extensions.put(e.getOid(), e);
- der.skip(val.getLength());
- len += val.getEncodedLength();
- debug("current count == " + len);
- }
- }
- }
-}
diff --git a/libjava/gnu/java/security/x509/X509CRLSelectorImpl.java b/libjava/gnu/java/security/x509/X509CRLSelectorImpl.java
deleted file mode 100644
index 0ada5501689..00000000000
--- a/libjava/gnu/java/security/x509/X509CRLSelectorImpl.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/* X509CRLSelectorImpl.java -- implementation of an X509CRLSelector.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import java.io.IOException;
-
-import java.security.Principal;
-import java.security.cert.CRL;
-import java.security.cert.CRLSelector;
-import java.security.cert.X509CRL;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.security.auth.x500.X500Principal;
-
-/**
- * Sun's implementation of X509CRLSelector sucks. This one tries to work
- * better.
- */
-public class X509CRLSelectorImpl implements CRLSelector
-{
-
- // Fields.
- // -------------------------------------------------------------------------
-
- private Set issuerNames;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public X509CRLSelectorImpl()
- {
- issuerNames = new HashSet();
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public void addIssuerName(byte[] issuerName) throws IOException
- {
- issuerNames.add(new X500DistinguishedName(issuerName));
- }
-
- public void addIssuerName(String issuerName)
- {
- issuerNames.add(new X500DistinguishedName(issuerName));
- }
-
- public void addIssuerName(Principal issuerName) throws IOException
- {
- if (issuerName instanceof X500DistinguishedName)
- issuerNames.add(issuerName);
- else if (issuerName instanceof X500Principal)
- issuerNames.add(new X500DistinguishedName(((X500Principal) issuerName).getEncoded()));
- else
- issuerNames.add(new X500DistinguishedName(issuerName.getName()));
- }
-
- public Collection getIssuerNames()
- {
- return Collections.unmodifiableSet(issuerNames);
- }
-
- public Object clone()
- {
- X509CRLSelectorImpl copy = new X509CRLSelectorImpl();
- copy.issuerNames.addAll(issuerNames);
- return copy;
- }
-
- public boolean match(CRL crl)
- {
- if (!(crl instanceof X509CRL))
- return false;
- try
- {
- Principal p = ((X509CRL) crl).getIssuerDN();
- X500DistinguishedName thisName = null;
- if (p instanceof X500DistinguishedName)
- thisName = (X500DistinguishedName) p;
- else if (p instanceof X500Principal)
- thisName = new X500DistinguishedName(((X500Principal) p).getEncoded());
- else
- thisName = new X500DistinguishedName(p.getName());
- for (Iterator it = issuerNames.iterator(); it.hasNext(); )
- {
- X500DistinguishedName name = (X500DistinguishedName) it.next();
- if (thisName.equals(name))
- return true;
- }
- }
- catch (Exception x)
- {
- }
- return false;
- }
-}
-
diff --git a/libjava/gnu/java/security/x509/X509CertPath.java b/libjava/gnu/java/security/x509/X509CertPath.java
deleted file mode 100644
index e8ed6bf35d1..00000000000
--- a/libjava/gnu/java/security/x509/X509CertPath.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/* X509CertPath.java -- an X.509 certificate path.
- Copyright (C) 2004 Free Software Fonudation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DEREncodingException;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.security.cert.CertPath;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * A certificate path (or certificate chain) of X509Certificates.
- *
- * @author Casey Marshall (rsdio@metastatic.org)
- */
-public class X509CertPath extends CertPath
-{
-
- // Fields.
- // -------------------------------------------------------------------------
-
- public static final List ENCODINGS = Collections.unmodifiableList(
- Arrays.asList(new String[] { "PkiPath", "PKCS7" }));
-
- private static final OID PKCS7_SIGNED_DATA = new OID("1.2.840.113549.1.7.2");
- private static final OID PKCS7_DATA = new OID("1.2.840.113549.1.7.1");
-
- /** The certificate path. */
- private List path;
-
- /** The cached PKCS #7 encoded bytes. */
- private byte[] pkcs_encoded;
-
- /** The cached PkiPath encoded bytes. */
- private byte[] pki_encoded;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public X509CertPath(List path)
- {
- super("X.509");
- this.path = Collections.unmodifiableList(path);
- }
-
- public X509CertPath(InputStream in) throws CertificateEncodingException
- {
- this(in, (String) ENCODINGS.get(0));
- }
-
- public X509CertPath(InputStream in, String encoding)
- throws CertificateEncodingException
- {
- super("X.509");
- try
- {
- parse(in, encoding);
- }
- catch (IOException ioe)
- {
- throw new CertificateEncodingException();
- }
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public List getCertificates()
- {
- return path; // already unmodifiable
- }
-
- public byte[] getEncoded() throws CertificateEncodingException
- {
- return getEncoded((String) ENCODINGS.get(0));
- }
-
- public byte[] getEncoded(String encoding) throws CertificateEncodingException
- {
- if (encoding.equalsIgnoreCase("PkiPath"))
- {
- if (pki_encoded == null)
- {
- try
- {
- pki_encoded = encodePki();
- }
- catch (IOException ioe)
- {
- throw new CertificateEncodingException();
- }
- }
- return (byte[]) pki_encoded.clone();
- }
- else if (encoding.equalsIgnoreCase("PKCS7"))
- {
- if (pkcs_encoded == null)
- {
- try
- {
- pkcs_encoded = encodePKCS();
- }
- catch (IOException ioe)
- {
- throw new CertificateEncodingException();
- }
- }
- return (byte[]) pkcs_encoded.clone();
- }
- else
- throw new CertificateEncodingException("unknown encoding: " + encoding);
- }
-
- public Iterator getEncodings()
- {
- return ENCODINGS.iterator(); // already unmodifiable
- }
-
- // Own methods.
- // -------------------------------------------------------------------------
-
- private void parse(InputStream in, String encoding)
- throws CertificateEncodingException, IOException
- {
- DERReader der = new DERReader(in);
- DERValue path = null;
- if (encoding.equalsIgnoreCase("PkiPath"))
- {
- // PKI encoding is just a SEQUENCE of X.509 certificates.
- path = der.read();
- if (!path.isConstructed())
- throw new DEREncodingException("malformed PkiPath");
- }
- else if (encoding.equalsIgnoreCase("PKCS7"))
- {
- // PKCS #7 encoding means that the certificates are contained in a
- // SignedData PKCS #7 type.
- //
- // ContentInfo ::= SEQUENCE {
- // contentType ::= ContentType,
- // content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
- //
- // ContentType ::= OBJECT IDENTIFIER
- //
- // SignedData ::= SEQUENCE {
- // version Version,
- // digestAlgorithms DigestAlgorithmIdentifiers,
- // contentInfo ContentInfo,
- // certificates [0] IMPLICIT ExtendedCertificatesAndCertificates
- // OPTIONAL,
- // crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
- // signerInfos SignerInfos }
- //
- // Version ::= INTEGER
- //
- DERValue value = der.read();
- if (!value.isConstructed())
- throw new DEREncodingException("malformed ContentInfo");
- value = der.read();
- if (!(value.getValue() instanceof OID) ||
- ((OID) value.getValue()).equals(PKCS7_SIGNED_DATA))
- throw new DEREncodingException("not a SignedData");
- value = der.read();
- if (!value.isConstructed() || value.getTag() != 0)
- throw new DEREncodingException("malformed content");
- value = der.read();
- if (value.getTag() != DER.INTEGER)
- throw new DEREncodingException("malformed Version");
- value = der.read();
- if (!value.isConstructed() || value.getTag() != DER.SET)
- throw new DEREncodingException("malformed DigestAlgorithmIdentifiers");
- der.skip(value.getLength());
- value = der.read();
- if (!value.isConstructed())
- throw new DEREncodingException("malformed ContentInfo");
- der.skip(value.getLength());
- path = der.read();
- if (!path.isConstructed() || path.getTag() != 0)
- throw new DEREncodingException("no certificates");
- }
- else
- throw new CertificateEncodingException("unknown encoding: " + encoding);
-
- LinkedList certs = new LinkedList();
- int len = 0;
- while (len < path.getLength())
- {
- DERValue cert = der.read();
- try
- {
- certs.add(new X509Certificate(new ByteArrayInputStream(cert.getEncoded())));
- }
- catch (CertificateException ce)
- {
- throw new CertificateEncodingException(ce.getMessage());
- }
- len += cert.getEncodedLength();
- der.skip(cert.getLength());
- }
-
- this.path = Collections.unmodifiableList(certs);
- }
-
- private byte[] encodePki()
- throws CertificateEncodingException, IOException
- {
- synchronized (path)
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- for (Iterator i = path.iterator(); i.hasNext(); )
- {
- out.write(((Certificate) i.next()).getEncoded());
- }
- byte[] b = out.toByteArray();
- DERValue val = new DERValue(DER.CONSTRUCTED | DER.SEQUENCE,
- b.length, b, null);
- return val.getEncoded();
- }
- }
-
- private byte[] encodePKCS()
- throws CertificateEncodingException, IOException
- {
- synchronized (path)
- {
- ArrayList signedData = new ArrayList(5);
- signedData.add(new DERValue(DER.INTEGER, BigInteger.ONE));
- signedData.add(new DERValue(DER.CONSTRUCTED | DER.SET,
- Collections.EMPTY_SET));
- signedData.add(new DERValue(DER.CONSTRUCTED | DER.SEQUENCE,
- Collections.singletonList(
- new DERValue(DER.OBJECT_IDENTIFIER, PKCS7_DATA))));
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- for (Iterator i = path.iterator(); i.hasNext(); )
- {
- out.write(((Certificate) i.next()).getEncoded());
- }
- byte[] b = out.toByteArray();
- signedData.add(new DERValue(DER.CONSTRUCTED | DER.CONTEXT,
- b.length, b, null));
- DERValue sdValue = new DERValue(DER.CONSTRUCTED | DER.SEQUENCE,
- signedData);
-
- ArrayList contentInfo = new ArrayList(2);
- contentInfo.add(new DERValue(DER.OBJECT_IDENTIFIER, PKCS7_SIGNED_DATA));
- contentInfo.add(new DERValue(DER.CONSTRUCTED | DER.CONTEXT, sdValue));
- return new DERValue(DER.CONSTRUCTED | DER.SEQUENCE,
- contentInfo).getEncoded();
- }
- }
-}
diff --git a/libjava/gnu/java/security/x509/X509CertSelectorImpl.java b/libjava/gnu/java/security/x509/X509CertSelectorImpl.java
deleted file mode 100644
index 36187ad8e64..00000000000
--- a/libjava/gnu/java/security/x509/X509CertSelectorImpl.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/* X509CertSelectorImpl.java -- implementation of an X509CertSelector.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import java.io.IOException;
-import java.security.Principal;
-import java.security.cert.CertSelector;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.security.auth.x500.X500Principal;
-
-/**
- * Sun's implementation of X509CertSelector sucks. This one tries to work
- * better.
- */
-public class X509CertSelectorImpl implements CertSelector
-{
-
- // Fields.
- // -------------------------------------------------------------------------
-
- private Set issuerNames;
- private Set subjectNames;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public X509CertSelectorImpl()
- {
- issuerNames = new HashSet();
- subjectNames = new HashSet();
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public void addIssuerName(byte[] issuerName) throws IOException
- {
- issuerNames.add(new X500DistinguishedName(issuerName));
- }
-
- public void addIssuerName(String issuerName)
- {
- issuerNames.add(new X500DistinguishedName(issuerName));
- }
-
- public void addIssuerName(Principal issuerName) throws IOException
- {
- if (issuerName instanceof X500DistinguishedName)
- issuerNames.add(issuerName);
- else if (issuerName instanceof X500Principal)
- issuerNames.add(new X500DistinguishedName(((X500Principal) issuerName).getEncoded()));
- else
- issuerNames.add(new X500DistinguishedName(issuerName.getName()));
- }
-
- public Collection getIssuerNames()
- {
- return Collections.unmodifiableSet(issuerNames);
- }
-
- public void addSubjectName(byte[] subjectName) throws IOException
- {
- subjectNames.add(new X500DistinguishedName(subjectName));
- }
-
- public void addSubjectName(String subjectName) throws IOException
- {
- subjectNames.add(new X500DistinguishedName(subjectName));
- }
-
- public void addSubjectName(Principal subjectName) throws IOException
- {
- if (subjectName instanceof X500DistinguishedName)
- subjectNames.add(subjectName);
- else if (subjectName instanceof X500Principal)
- subjectNames.add(new X500DistinguishedName(((X500Principal) subjectName).getEncoded()));
- else
- subjectNames.add(new X500DistinguishedName(subjectName.getName()));
- }
-
- public Collection getSubjectNames()
- {
- return Collections.unmodifiableSet(subjectNames);
- }
-
- public Object clone()
- {
- X509CertSelectorImpl copy = new X509CertSelectorImpl();
- copy.issuerNames.addAll(issuerNames);
- copy.subjectNames.addAll(subjectNames);
- return copy;
- }
-
- public boolean match(Certificate cert)
- {
- if (!(cert instanceof X509Certificate))
- return false;
- boolean matchIssuer = false;
- boolean matchSubject = false;
- try
- {
- Principal p = ((X509Certificate) cert).getIssuerDN();
- X500DistinguishedName thisName = null;
- if (p instanceof X500DistinguishedName)
- thisName = (X500DistinguishedName) p;
- else if (p instanceof X500Principal)
- thisName = new X500DistinguishedName(((X500Principal) p).getEncoded());
- else
- thisName = new X500DistinguishedName(p.getName());
- if (issuerNames.isEmpty())
- matchIssuer = true;
- else
- {
- for (Iterator it = issuerNames.iterator(); it.hasNext(); )
- {
- X500DistinguishedName name = (X500DistinguishedName) it.next();
- if (thisName.equals(name))
- {
- matchIssuer = true;
- break;
- }
- }
- }
-
- p = ((X509Certificate) cert).getSubjectDN();
- thisName = null;
- if (p instanceof X500DistinguishedName)
- thisName = (X500DistinguishedName) p;
- else if (p instanceof X500Principal)
- thisName = new X500DistinguishedName(((X500Principal) p).getEncoded());
- else
- thisName = new X500DistinguishedName(p.getName());
- if (subjectNames.isEmpty())
- matchSubject = true;
- else
- {
- for (Iterator it = subjectNames.iterator(); it.hasNext(); )
- {
- X500DistinguishedName name = (X500DistinguishedName) it.next();
- if (thisName.equals(name))
- {
- matchSubject = true;
- break;
- }
- }
- }
- }
- catch (Exception x)
- {
- }
- return matchIssuer && matchSubject;
- }
-}
-
diff --git a/libjava/gnu/java/security/x509/X509Certificate.java b/libjava/gnu/java/security/x509/X509Certificate.java
deleted file mode 100644
index 94a02aa72c9..00000000000
--- a/libjava/gnu/java/security/x509/X509Certificate.java
+++ /dev/null
@@ -1,743 +0,0 @@
-/* X509Certificate.java -- X.509 certificate.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.BitString;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.x509.ext.BasicConstraints;
-import gnu.java.security.x509.ext.ExtendedKeyUsage;
-import gnu.java.security.x509.ext.Extension;
-import gnu.java.security.x509.ext.IssuerAlternativeNames;
-import gnu.java.security.x509.ext.KeyUsage;
-import gnu.java.security.x509.ext.SubjectAlternativeNames;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.math.BigInteger;
-import java.security.AlgorithmParameters;
-import java.security.InvalidKeyException;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Principal;
-import java.security.PublicKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.CertificateNotYetValidException;
-import java.security.cert.CertificateParsingException;
-import java.security.interfaces.DSAParams;
-import java.security.interfaces.DSAPublicKey;
-import java.security.spec.DSAParameterSpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.security.auth.x500.X500Principal;
-
-/**
- * An implementation of X.509 certificates.
- *
- * @author Casey Marshall (rsdio@metastatic.org)
- */
-public class X509Certificate extends java.security.cert.X509Certificate
- implements Serializable, GnuPKIExtension
-{
-
- // Constants and fields.
- // ------------------------------------------------------------------------
-
- private static final boolean DEBUG = false;
- private static void debug(String msg)
- {
- if (DEBUG)
- {
- System.err.print(">> X509Certificate: ");
- System.err.println(msg);
- }
- }
- private static void debug(Throwable t)
- {
- if (DEBUG)
- {
- System.err.print(">> X509Certificate: ");
- t.printStackTrace();
- }
- }
-
- protected static final OID ID_DSA = new OID ("1.2.840.10040.4.1");
- protected static final OID ID_DSA_WITH_SHA1 = new OID ("1.2.840.10040.4.3");
- protected static final OID ID_RSA = new OID ("1.2.840.113549.1.1.1");
- protected static final OID ID_RSA_WITH_MD2 = new OID ("1.2.840.113549.1.1.2");
- protected static final OID ID_RSA_WITH_MD5 = new OID ("1.2.840.113549.1.1.4");
- protected static final OID ID_RSA_WITH_SHA1 = new OID ("1.2.840.113549.1.1.5");
- protected static final OID ID_ECDSA_WITH_SHA1 = new OID ("1.2.840.10045.4.1");
-
- // This object SHOULD be serialized with an instance of
- // java.security.cert.Certificate.CertificateRep, thus all fields are
- // transient.
-
- // The encoded certificate.
- protected transient byte[] encoded;
-
- // TBSCertificate part.
- protected transient byte[] tbsCertBytes;
- protected transient int version;
- protected transient BigInteger serialNo;
- protected transient OID algId;
- protected transient byte[] algVal;
- protected transient X500DistinguishedName issuer;
- protected transient Date notBefore;
- protected transient Date notAfter;
- protected transient X500DistinguishedName subject;
- protected transient PublicKey subjectKey;
- protected transient BitString issuerUniqueId;
- protected transient BitString subjectUniqueId;
- protected transient Map extensions;
-
- // Signature.
- protected transient OID sigAlgId;
- protected transient byte[] sigAlgVal;
- protected transient byte[] signature;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new X.509 certificate from the encoded data. The input
- * data are expected to be the ASN.1 DER encoding of the certificate.
- *
- * @param encoded The encoded certificate data.
- * @throws IOException If the certificate cannot be read, possibly
- * from a formatting error.
- * @throws CertificateException If the data read is not an X.509
- * certificate.
- */
- public X509Certificate(InputStream encoded)
- throws CertificateException, IOException
- {
- super();
- extensions = new HashMap();
- try
- {
- parse(encoded);
- }
- catch (IOException ioe)
- {
- debug(ioe);
- throw ioe;
- }
- catch (Exception e)
- {
- debug(e);
- CertificateException ce = new CertificateException(e.getMessage());
- ce.initCause (e);
- throw ce;
- }
- }
-
- protected X509Certificate()
- {
- extensions = new HashMap();
- }
-
- // X509Certificate methods.
- // ------------------------------------------------------------------------
-
- public void checkValidity()
- throws CertificateExpiredException, CertificateNotYetValidException
- {
- checkValidity(new Date());
- }
-
- public void checkValidity(Date date)
- throws CertificateExpiredException, CertificateNotYetValidException
- {
- if (date.compareTo(notBefore) < 0)
- {
- throw new CertificateNotYetValidException();
- }
- if (date.compareTo(notAfter) > 0)
- {
- throw new CertificateExpiredException();
- }
- }
-
- public int getVersion()
- {
- return version;
- }
-
- public BigInteger getSerialNumber()
- {
- return serialNo;
- }
-
- public Principal getIssuerDN()
- {
- return issuer;
- }
-
- public X500Principal getIssuerX500Principal()
- {
- return new X500Principal(issuer.getDer());
- }
-
- public Principal getSubjectDN()
- {
- return subject;
- }
-
- public X500Principal getSubjectX500Principal()
- {
- return new X500Principal(subject.getDer());
- }
-
- public Date getNotBefore()
- {
- return (Date) notBefore.clone();
- }
-
- public Date getNotAfter()
- {
- return (Date) notAfter.clone();
- }
-
- public byte[] getTBSCertificate() throws CertificateEncodingException
- {
- return (byte[]) tbsCertBytes.clone();
- }
-
- public byte[] getSignature()
- {
- return (byte[]) signature.clone();
- }
-
- public String getSigAlgName()
- {
- if (sigAlgId.equals(ID_DSA_WITH_SHA1))
- {
- return "SHA1withDSA";
- }
- if (sigAlgId.equals(ID_RSA_WITH_MD2))
- {
- return "MD2withRSA";
- }
- if (sigAlgId.equals(ID_RSA_WITH_MD5))
- {
- return "MD5withRSA";
- }
- if (sigAlgId.equals(ID_RSA_WITH_SHA1))
- {
- return "SHA1withRSA";
- }
- return "unknown";
- }
-
- public String getSigAlgOID()
- {
- return sigAlgId.toString();
- }
-
- public byte[] getSigAlgParams()
- {
- return (byte[]) sigAlgVal.clone();
- }
-
- public boolean[] getIssuerUniqueID()
- {
- if (issuerUniqueId != null)
- {
- return issuerUniqueId.toBooleanArray();
- }
- return null;
- }
-
- public boolean[] getSubjectUniqueID()
- {
- if (subjectUniqueId != null)
- {
- return subjectUniqueId.toBooleanArray();
- }
- return null;
- }
-
- public boolean[] getKeyUsage()
- {
- Extension e = getExtension(KeyUsage.ID);
- if (e != null)
- {
- KeyUsage ku = (KeyUsage) e.getValue();
- boolean[] result = new boolean[9];
- boolean[] b = ku.getKeyUsage().toBooleanArray();
- System.arraycopy(b, 0, result, 0, b.length);
- return result;
- }
- return null;
- }
-
- public List getExtendedKeyUsage() throws CertificateParsingException
- {
- Extension e = getExtension(ExtendedKeyUsage.ID);
- if (e != null)
- {
- List a = ((ExtendedKeyUsage) e.getValue()).getPurposeIds();
- List b = new ArrayList(a.size());
- for (Iterator it = a.iterator(); it.hasNext(); )
- {
- b.add(it.next().toString());
- }
- return Collections.unmodifiableList(b);
- }
- return null;
- }
-
- public int getBasicConstraints()
- {
- Extension e = getExtension(BasicConstraints.ID);
- if (e != null)
- {
- return ((BasicConstraints) e.getValue()).getPathLengthConstraint();
- }
- return -1;
- }
-
- public Collection getSubjectAlternativeNames()
- throws CertificateParsingException
- {
- Extension e = getExtension(SubjectAlternativeNames.ID);
- if (e != null)
- {
- return ((SubjectAlternativeNames) e.getValue()).getNames();
- }
- return null;
- }
-
- public Collection getIssuerAlternativeNames()
- throws CertificateParsingException
- {
- Extension e = getExtension(IssuerAlternativeNames.ID);
- if (e != null)
- {
- return ((IssuerAlternativeNames) e.getValue()).getNames();
- }
- return null;
- }
-
-// X509Extension methods.
- // ------------------------------------------------------------------------
-
- public boolean hasUnsupportedCriticalExtension()
- {
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (e.isCritical() && !e.isSupported())
- return true;
- }
- return false;
- }
-
- public Set getCriticalExtensionOIDs()
- {
- HashSet s = new HashSet();
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (e.isCritical())
- s.add(e.getOid().toString());
- }
- return Collections.unmodifiableSet(s);
- }
-
- public Set getNonCriticalExtensionOIDs()
- {
- HashSet s = new HashSet();
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- Extension e = (Extension) it.next();
- if (!e.isCritical())
- s.add(e.getOid().toString());
- }
- return Collections.unmodifiableSet(s);
- }
-
- public byte[] getExtensionValue(String oid)
- {
- Extension e = getExtension(new OID(oid));
- if (e != null)
- {
- return e.getValue().getEncoded();
- }
- return null;
- }
-
- // GnuPKIExtension method.
- // -------------------------------------------------------------------------
-
- public Extension getExtension(OID oid)
- {
- return (Extension) extensions.get(oid);
- }
-
- public Collection getExtensions()
- {
- return extensions.values();
- }
-
- // Certificate methods.
- // -------------------------------------------------------------------------
-
- public byte[] getEncoded() throws CertificateEncodingException
- {
- return (byte[]) encoded.clone();
- }
-
- public void verify(PublicKey key)
- throws CertificateException, NoSuchAlgorithmException,
- InvalidKeyException, NoSuchProviderException, SignatureException
- {
- Signature sig = Signature.getInstance(sigAlgId.toString());
- doVerify(sig, key);
- }
-
- public void verify(PublicKey key, String provider)
- throws CertificateException, NoSuchAlgorithmException,
- InvalidKeyException, NoSuchProviderException, SignatureException
- {
- Signature sig = Signature.getInstance(sigAlgId.toString(), provider);
- doVerify(sig, key);
- }
-
- public String toString()
- {
- StringWriter str = new StringWriter();
- PrintWriter out = new PrintWriter(str);
- out.println(X509Certificate.class.getName() + " {");
- out.println(" TBSCertificate {");
- out.println(" version = " + version + ";");
- out.println(" serialNo = " + serialNo + ";");
- out.println(" signature = {");
- out.println(" algorithm = " + getSigAlgName() + ";");
- out.print(" parameters =");
- if (sigAlgVal != null)
- {
- out.println();
- out.print(Util.hexDump(sigAlgVal, " "));
- }
- else
- {
- out.println(" null;");
- }
- out.println(" }");
- out.println(" issuer = " + issuer.getName() + ";");
- out.println(" validity = {");
- out.println(" notBefore = " + notBefore + ";");
- out.println(" notAfter = " + notAfter + ";");
- out.println(" }");
- out.println(" subject = " + subject.getName() + ";");
- out.println(" subjectPublicKeyInfo = {");
- out.println(" algorithm = " + subjectKey.getAlgorithm());
- out.println(" key =");
- out.print(Util.hexDump(subjectKey.getEncoded(), " "));
- out.println(" };");
- out.println(" issuerUniqueId = " + issuerUniqueId + ";");
- out.println(" subjectUniqueId = " + subjectUniqueId + ";");
- out.println(" extensions = {");
- for (Iterator it = extensions.values().iterator(); it.hasNext(); )
- {
- out.println(" " + it.next());
- }
- out.println(" }");
- out.println(" }");
- out.println(" signatureAlgorithm = " + getSigAlgName() + ";");
- out.println(" signatureValue =");
- out.print(Util.hexDump(signature, " "));
- out.println("}");
- return str.toString();
- }
-
- public PublicKey getPublicKey()
- {
- return subjectKey;
- }
-
- public boolean equals(Object other)
- {
- if (!(other instanceof X509Certificate))
- return false;
- try
- {
- if (other instanceof X509Certificate)
- return Arrays.equals(encoded, ((X509Certificate) other).encoded);
- byte[] enc = ((X509Certificate) other).getEncoded();
- if (enc == null)
- return false;
- return Arrays.equals(encoded, enc);
- }
- catch (CertificateEncodingException cee)
- {
- return false;
- }
- }
-
- // Own methods.
- // ------------------------------------------------------------------------
-
- /**
- * Verify this certificate's signature.
- */
- private void doVerify(Signature sig, PublicKey key)
- throws CertificateException, InvalidKeyException, SignatureException
- {
- debug("verifying sig=" + sig + " key=" + key);
- sig.initVerify(key);
- sig.update(tbsCertBytes);
- if (!sig.verify(signature))
- {
- throw new CertificateException("signature not validated");
- }
- }
-
- /**
- * Parse a DER stream into an X.509 certificate.
- *
- * @param encoded The encoded bytes.
- */
- 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, ">>>> "));
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java b/libjava/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java
deleted file mode 100644
index a94b76f093e..00000000000
--- a/libjava/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/* AuthorityKeyIdentifier.java -- Authority key identifier extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.x509.Util;
-
-import java.io.IOException;
-import java.math.BigInteger;
-
-public class AuthorityKeyIdentifier extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.35");
-
- private final byte[] keyIdentifier;
- private final GeneralNames authorityCertIssuer;
- private final BigInteger authorityCertSerialNumber;
-
- // Contstructor.
- // -------------------------------------------------------------------------
-
- public AuthorityKeyIdentifier(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERReader der = new DERReader(encoded);
-
- // AuthorityKeyIdentifier ::= SEQUENCE {
- DERValue val = der.read();
- if (!val.isConstructed())
- throw new IOException("malformed AuthorityKeyIdentifier");
- if (val.getLength() > 0)
- val = der.read();
-
- // keyIdentifier [0] KeyIdentifier OPTIONAL,
- // KeyIdentifier ::= OCTET STRING
- if (val.getTagClass() == DER.APPLICATION && val.getTag() == 0)
- {
- keyIdentifier = (byte[]) val.getValue();
- val = der.read();
- }
- else
- keyIdentifier = null;
-
- // authorityCertIssuer [1] GeneralNames OPTIONAL,
- if (val.getTagClass() == DER.APPLICATION && val.getTag() == 1)
- {
- byte[] b = val.getEncoded();
- b[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE);
- authorityCertIssuer = new GeneralNames(b);
- der.skip(val.getLength());
- val = der.read();
- }
- else
- authorityCertIssuer = null;
-
- // authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL }
- if (val.getTagClass() == DER.APPLICATION && val.getTag() == 2)
- {
- authorityCertSerialNumber = new BigInteger((byte[]) val.getValue());
- }
- else
- authorityCertSerialNumber = null;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public byte[] getKeyIdentifier()
- {
- return keyIdentifier != null ? (byte[]) keyIdentifier.clone() : null;
- }
-
- public GeneralNames getAuthorityCertIssuer()
- {
- return authorityCertIssuer;
- }
-
- public BigInteger getAuthorityCertSerialNumber()
- {
- return authorityCertSerialNumber;
- }
-
- public String toString()
- {
- return AuthorityKeyIdentifier.class.getName() + " [ keyId=" +
- (keyIdentifier != null ? Util.toHexString (keyIdentifier, ':') : "nil") +
- " authorityCertIssuer=" + authorityCertIssuer +
- " authorityCertSerialNumbe=" + authorityCertSerialNumber + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/BasicConstraints.java b/libjava/gnu/java/security/x509/ext/BasicConstraints.java
deleted file mode 100644
index 00f7a6ed220..00000000000
--- a/libjava/gnu/java/security/x509/ext/BasicConstraints.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/* BasicConstraints.java -- the basic constraints extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
-public class BasicConstraints extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.19");
-
- private final boolean ca;
- private final int pathLenConstraint;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public BasicConstraints(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERReader der = new DERReader(encoded);
- DERValue bc = der.read();
- if (!bc.isConstructed())
- throw new IOException("malformed BasicConstraints");
- DERValue val = bc;
- if (bc.getLength() > 0)
- val = der.read();
- if (val.getTag() == DER.BOOLEAN)
- {
- ca = ((Boolean) val.getValue()).booleanValue();
- if (val.getEncodedLength() < bc.getLength())
- val = der.read();
- }
- else
- ca = false;
- if (val.getTag() == DER.INTEGER)
- {
- pathLenConstraint = ((BigInteger) val.getValue()).intValue();
- }
- else
- pathLenConstraint = -1;
- }
-
- public BasicConstraints (final boolean ca, final int pathLenConstraint)
- {
- this.ca = ca;
- this.pathLenConstraint = pathLenConstraint;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public boolean isCA()
- {
- return ca;
- }
-
- public int getPathLengthConstraint()
- {
- return pathLenConstraint;
- }
-
- public byte[] getEncoded()
- {
- if (encoded == null)
- {
- List bc = new ArrayList (2);
- bc.add (new DERValue (DER.BOOLEAN, new Boolean (ca)));
- if (pathLenConstraint >= 0)
- bc.add (new DERValue (DER.INTEGER,
- BigInteger.valueOf ((long) pathLenConstraint)));
- encoded = new DERValue (DER.CONSTRUCTED|DER.SEQUENCE, bc).getEncoded();
- }
- return (byte[]) encoded.clone();
- }
-
- public String toString()
- {
- return BasicConstraints.class.getName() + " [ isCA=" + ca +
- " pathLen=" + pathLenConstraint + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/CRLNumber.java b/libjava/gnu/java/security/x509/ext/CRLNumber.java
deleted file mode 100644
index 36b1c7b5f1d..00000000000
--- a/libjava/gnu/java/security/x509/ext/CRLNumber.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/* CRLNumber.java -- CRL number extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.math.BigInteger;
-
-public class CRLNumber extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.20");
-
- private final BigInteger number;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public CRLNumber(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERValue val = DERReader.read(encoded);
- if (val.getTag() != DER.INTEGER)
- throw new IOException("malformed CRLNumber");
- number = (BigInteger) val.getValue();
- }
-
- public CRLNumber (final BigInteger number)
- {
- this.number = number;
- }
-
- // Instance method.
- // -------------------------------------------------------------------------
-
- public BigInteger getNumber()
- {
- return number;
- }
-
- public byte[] getEncoded()
- {
- if (encoded == null)
- {
- encoded = new DERValue (DER.INTEGER, number).getEncoded();
- }
- return (byte[]) encoded.clone();
- }
-
- public String toString()
- {
- return CRLNumber.class.getName() + " [ " + number + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/CertificatePolicies.java b/libjava/gnu/java/security/x509/ext/CertificatePolicies.java
deleted file mode 100644
index 50bc6d367d7..00000000000
--- a/libjava/gnu/java/security/x509/ext/CertificatePolicies.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/* CertificatePolicies.java -- certificate policy extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.security.cert.PolicyQualifierInfo;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public class CertificatePolicies extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.32");
-
- private final List policies;
- private final Map policyQualifierInfos;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public CertificatePolicies(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERReader der = new DERReader(encoded);
- DERValue pol = der.read();
- if (!pol.isConstructed())
- throw new IOException("malformed CertificatePolicies");
-
- int len = 0;
- LinkedList policyList = new LinkedList();
- HashMap qualifierMap = new HashMap();
- while (len < pol.getLength())
- {
- DERValue policyInfo = der.read();
- if (!policyInfo.isConstructed())
- throw new IOException("malformed PolicyInformation");
- DERValue val = der.read();
- if (val.getTag() != DER.OBJECT_IDENTIFIER)
- throw new IOException("malformed CertPolicyId");
- OID policyId = (OID) val.getValue();
- policyList.add(policyId);
- if (val.getEncodedLength() < policyInfo.getLength())
- {
- DERValue qual = der.read();
- int len2 = 0;
- LinkedList quals = new LinkedList();
- while (len2 < qual.getLength())
- {
- val = der.read();
- quals.add(new PolicyQualifierInfo(val.getEncoded()));
- der.skip(val.getLength());
- len2 += val.getEncodedLength();
- }
- qualifierMap.put(policyId, quals);
- }
- len += policyInfo.getEncodedLength();
- }
-
- policies = Collections.unmodifiableList(policyList);
- policyQualifierInfos = Collections.unmodifiableMap(qualifierMap);
- }
-
- public CertificatePolicies (final List policies,
- final Map policyQualifierInfos)
- {
- for (Iterator it = policies.iterator(); it.hasNext(); )
- if (!(it.next() instanceof OID))
- throw new IllegalArgumentException ("policies must be OIDs");
- for (Iterator it = policyQualifierInfos.entrySet().iterator(); it.hasNext();)
- {
- Map.Entry e = (Map.Entry) it.next();
- if (!(e.getKey() instanceof OID) || !policies.contains (e.getKey()))
- throw new IllegalArgumentException
- ("policyQualifierInfos keys must be OIDs");
- if (!(e.getValue() instanceof List))
- throw new IllegalArgumentException
- ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
- for (Iterator it2 = ((List) e.getValue()).iterator(); it.hasNext(); )
- if (!(it2.next() instanceof PolicyQualifierInfo))
- throw new IllegalArgumentException
- ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
- }
- this.policies = Collections.unmodifiableList (new ArrayList (policies));
- this.policyQualifierInfos = Collections.unmodifiableMap
- (new HashMap (policyQualifierInfos));
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public List getPolicies()
- {
- return policies;
- }
-
- public List getPolicyQualifierInfos(OID oid)
- {
- return (List) policyQualifierInfos.get(oid);
- }
-
- public byte[] getEncoded()
- {
- if (encoded == null)
- {
- List pol = new ArrayList (policies.size());
- for (Iterator it = policies.iterator(); it.hasNext(); )
- {
- OID policy = (OID) it.next();
- List qualifiers = getPolicyQualifierInfos (policy);
- List l = new ArrayList (qualifiers == null ? 1 : 2);
- l.add (new DERValue (DER.OBJECT_IDENTIFIER, policy));
- if (qualifiers != null)
- {
- List ll = new ArrayList (qualifiers.size());
- for (Iterator it2 = qualifiers.iterator(); it.hasNext(); )
- {
- PolicyQualifierInfo info = (PolicyQualifierInfo) it2.next();
- try
- {
- ll.add (DERReader.read (info.getEncoded()));
- }
- catch (IOException ioe)
- {
- }
- }
- l.add (new DERValue (DER.CONSTRUCTED|DER.SEQUENCE, ll));
- }
- pol.add (new DERValue (DER.CONSTRUCTED|DER.SEQUENCE, l));
- }
- encoded = new DERValue (DER.CONSTRUCTED|DER.SEQUENCE, pol).getEncoded();
- }
- return (byte[]) encoded.clone();
- }
-
- public String toString()
- {
- return CertificatePolicies.class.getName() + " [ policies=" + policies +
- " policyQualifierInfos=" + policyQualifierInfos + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/ExtendedKeyUsage.java b/libjava/gnu/java/security/x509/ext/ExtendedKeyUsage.java
deleted file mode 100644
index 37b08acf43e..00000000000
--- a/libjava/gnu/java/security/x509/ext/ExtendedKeyUsage.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* ExtendedKeyUsage.java -- the extended key usage extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-public class ExtendedKeyUsage extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.37");
-
- private final List purposeIds;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public ExtendedKeyUsage(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERReader der = new DERReader(encoded);
- DERValue usageList = der.read();
- if (!usageList.isConstructed())
- throw new IOException("malformed ExtKeyUsageSyntax");
- int len = 0;
- purposeIds = new LinkedList();
- while (len < usageList.getLength())
- {
- DERValue val = der.read();
- if (val.getTag() != DER.OBJECT_IDENTIFIER)
- throw new IOException("malformed KeyPurposeId");
- purposeIds.add(val.getValue());
- len += val.getEncodedLength();
- }
- }
-
- // Instance method.
- // -------------------------------------------------------------------------
-
- public List getPurposeIds()
- {
- return Collections.unmodifiableList(purposeIds);
- }
-
- public String toString()
- {
- return ExtendedKeyUsage.class.getName() + " [ " + purposeIds + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/Extension.java b/libjava/gnu/java/security/x509/ext/Extension.java
deleted file mode 100644
index 5ca9ac3a91d..00000000000
--- a/libjava/gnu/java/security/x509/ext/Extension.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/* Extension.java -- an X.509 certificate or CRL extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.x509.Util;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class Extension
-{
-
- // Fields.
- // -------------------------------------------------------------------------
-
- private static final boolean DEBUG = false;
- private static void debug(String msg)
- {
- System.err.print(">> Extension: ");
- System.err.println(msg);
- }
-
- /**
- * This extension's object identifier.
- */
- protected final OID oid;
-
- /**
- * The criticality flag.
- */
- protected final boolean critical;
-
- /**
- * Whether or not this extension is locally supported.
- */
- protected boolean isSupported;
-
- /**
- * The extension value.
- */
- protected final Value value;
-
- /**
- * The DER encoded form.
- */
- protected byte[] encoded;
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public Extension(byte[] encoded) throws IOException
- {
- this.encoded = (byte[]) encoded.clone();
- DERReader der = new DERReader(encoded);
-
- // Extension ::= SEQUENCE {
- DERValue val = der.read();
- if (DEBUG) debug("read val tag == " + val.getTag() + " len == " + val.getLength());
- if (!val.isConstructed())
- throw new IOException("malformed Extension");
-
- // extnID OBJECT IDENTIFIER,
- val = der.read();
- if (val.getTag() != DER.OBJECT_IDENTIFIER)
- throw new IOException("expecting OBJECT IDENTIFIER");
- oid = (OID) val.getValue();
- if (DEBUG) debug("read oid == " + oid);
-
- // critical BOOLEAN DEFAULT FALSE,
- val = der.read();
- if (val.getTag() == DER.BOOLEAN)
- {
- critical = ((Boolean) val.getValue()).booleanValue();
- val = der.read();
- }
- else
- critical = false;
- if (DEBUG) debug("is critical == " + critical);
-
- // extnValue OCTET STRING }
- if (val.getTag() != DER.OCTET_STRING)
- throw new IOException("expecting OCTET STRING");
- byte[] encval = (byte[]) val.getValue();
- isSupported = true;
- if (oid.equals(AuthorityKeyIdentifier.ID))
- {
- value = new AuthorityKeyIdentifier(encval);
- }
- else if (oid.equals(SubjectKeyIdentifier.ID))
- {
- value = new SubjectKeyIdentifier(encval);
- }
- else if (oid.equals(KeyUsage.ID))
- {
- value = new KeyUsage(encval);
- }
- else if (oid.equals(PrivateKeyUsagePeriod.ID))
- {
- value = new PrivateKeyUsagePeriod(encval);
- }
- else if (oid.equals(CertificatePolicies.ID))
- {
- value = new CertificatePolicies(encval);
- }
- else if (oid.equals (PolicyConstraint.ID))
- {
- value = new PolicyConstraint (encval);
- }
- else if (oid.equals(PolicyMappings.ID))
- {
- value = new PolicyMappings(encval);
- }
- else if (oid.equals(SubjectAlternativeNames.ID))
- {
- value = new SubjectAlternativeNames(encval);
- }
- else if (oid.equals(IssuerAlternativeNames.ID))
- {
- value = new IssuerAlternativeNames(encval);
- }
- else if (oid.equals(BasicConstraints.ID))
- {
- value = new BasicConstraints(encval);
- }
- else if (oid.equals(ExtendedKeyUsage.ID))
- {
- value = new ExtendedKeyUsage(encval);
- }
- else if (oid.equals(CRLNumber.ID))
- {
- value = new CRLNumber(encval);
- }
- else if (oid.equals(ReasonCode.ID))
- {
- value = new ReasonCode(encval);
- }
- else
- {
- value = new Value(encval);
- isSupported = false;
- }
- if (DEBUG) debug("read value == " + value);
- }
-
- public Extension (final OID oid, final Value value, final boolean critical)
- {
- this.oid = oid;
- this.value = value;
- this.critical = critical;
- isSupported = true;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public OID getOid()
- {
- return oid;
- }
-
- public boolean isCritical()
- {
- return critical;
- }
-
- public boolean isSupported()
- {
- return isSupported;
- }
-
- public Value getValue()
- {
- return value;
- }
-
- public byte[] getEncoded()
- {
- if (encoded == null)
- encode();
- return (byte[]) encoded.clone();
- }
-
- public String toString()
- {
- return Extension.class.getName() + " [ id=" + oid + " critical=" +
- critical + " value=" + value + " ]";
- }
-
- public DERValue getDerValue()
- {
- List ext = new ArrayList (3);
- ext.add (new DERValue (DER.OBJECT_IDENTIFIER, oid));
- ext.add (new DERValue (DER.BOOLEAN, new Boolean (critical)));
- ext.add (new DERValue (DER.OCTET_STRING, value.getEncoded()));
- return new DERValue (DER.CONSTRUCTED|DER.SEQUENCE, ext);
- }
-
- // Own methods.
- // -------------------------------------------------------------------------
-
- private void encode()
- {
- encoded = getDerValue().getEncoded();
- }
-
- // Inner class.
- // -------------------------------------------------------------------------
-
- public static class Value
- {
-
- // Fields.
- // -----------------------------------------------------------------------
-
- protected byte[] encoded;
-
- // Constructor.
- // -----------------------------------------------------------------------
-
- public Value(byte[] encoded)
- {
- this.encoded = (byte[]) encoded.clone();
- }
-
- protected Value() { }
-
- // Instance methods.
- // -----------------------------------------------------------------------
-
- public byte[] getEncoded()
- {
- return (byte[]) encoded;
- }
-
- public boolean equals(Object o)
- {
- if (!(o instanceof Value))
- return false;
- return Arrays.equals(encoded, ((Value) o).encoded);
- }
-
- public String toString()
- {
- return Util.toHexString(encoded, ':');
- }
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/GeneralNames.java b/libjava/gnu/java/security/x509/ext/GeneralNames.java
deleted file mode 100644
index e92aedaefd0..00000000000
--- a/libjava/gnu/java/security/x509/ext/GeneralNames.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/* GeneralNames.java -- the GeneralNames object
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.x509.X500DistinguishedName;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-public class GeneralNames
-{
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public static final int OTHER_NAME = 0;
- public static final int RFC822_NAME = 1;
- public static final int DNS_NAME = 2;
- public static final int X400_ADDRESS = 3;
- public static final int DIRECTORY_NAME = 4;
- public static final int EDI_PARTY_NAME = 5;
- public static final int URI = 6;
- public static final int IP_ADDRESS = 7;
- public static final int REGISTERED_ID = 8;
-
- private List names;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- 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();
- }
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public List getNames()
- {
- List l = new ArrayList(names.size());
- for (Iterator it = names.iterator(); it.hasNext(); )
- {
- List ll = (List) it.next();
- List pair = new ArrayList(2);
- pair.add(ll.get(0));
- if (ll.get(1) instanceof byte[])
- pair.add(((byte[]) ll.get(1)).clone());
- else
- pair.add(ll.get(1));
- l.add(Collections.unmodifiableList(pair));
- }
- return Collections.unmodifiableList(l);
- }
-
- public String toString()
- {
- return GeneralNames.class.getName() + " [ " + names + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/IssuerAlternativeNames.java b/libjava/gnu/java/security/x509/ext/IssuerAlternativeNames.java
deleted file mode 100644
index 8b017dc62d8..00000000000
--- a/libjava/gnu/java/security/x509/ext/IssuerAlternativeNames.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* IssuerAlternatuveNames.java -- issuer alternative names extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-
-import java.io.IOException;
-import java.util.List;
-
-public class IssuerAlternativeNames extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.18");
-
- private final GeneralNames names;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public IssuerAlternativeNames(final byte[] encoded) throws IOException
- {
- super(encoded);
- names = new GeneralNames(encoded);
- }
-
- // Instance method.
- // -------------------------------------------------------------------------
-
- public List getNames()
- {
- return names.getNames();
- }
-
- public String toString()
- {
- return IssuerAlternativeNames.class.getName() + " [ " + names + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/KeyUsage.java b/libjava/gnu/java/security/x509/ext/KeyUsage.java
deleted file mode 100644
index dcd98181e12..00000000000
--- a/libjava/gnu/java/security/x509/ext/KeyUsage.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* KeyUsage.java -- the key usage extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.BitString;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-
-public class KeyUsage extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.15");
- public static final int DIGITAL_SIGNATURE = 0;
- public static final int NON_REPUDIATION = 1;
- public static final int KEY_ENCIPHERMENT = 2;
- public static final int DATA_ENCIPHERMENT = 3;
- public static final int KEY_AGREEMENT = 4;
- public static final int KEY_CERT_SIGN = 5;
- public static final int CRL_SIGN = 6;
- public static final int ENCIPHER_ONLY = 7;
- public static final int DECIPHER_ONLY = 8;
-
- private final BitString keyUsage;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public KeyUsage(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERValue val = DERReader.read(encoded);
- if (val.getTag() != DER.BIT_STRING)
- throw new IOException("malformed KeyUsage");
- keyUsage = (BitString) val.getValue();
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public BitString getKeyUsage()
- {
- return keyUsage;
- }
-
- public String toString()
- {
- return KeyUsage.class.getName() + " [ " + keyUsage + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/PolicyConstraint.java b/libjava/gnu/java/security/x509/ext/PolicyConstraint.java
deleted file mode 100644
index 20cf552a0fe..00000000000
--- a/libjava/gnu/java/security/x509/ext/PolicyConstraint.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* PolicyConstraint.java -- policyConstraint extension
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.math.BigInteger;
-
-public class PolicyConstraint extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID ("2.5.29.36");
-
- private final int requireExplicitPolicy;
- private final int inhibitPolicyMapping;
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public PolicyConstraint (final byte[] encoded) throws IOException
- {
- super (encoded);
- int rpc = -1, ipm = -1;
- DERReader der = new DERReader(encoded);
- DERValue pc = der.read();
- if (!pc.isConstructed())
- throw new IOException("malformed PolicyConstraints");
- DERValue val;
- int len = pc.getLength();
- while (len > 0)
- {
- val = der.read();
- if (val.getTag() == 0)
- rpc = new BigInteger ((byte[]) val.getValue()).intValue();
- else if (val.getTag() == 1)
- ipm = new BigInteger ((byte[]) val.getValue()).intValue();
- else
- throw new IOException ("invalid policy constraint");
- len -= val.getEncodedLength();
- }
-
- requireExplicitPolicy = rpc;
- inhibitPolicyMapping = ipm;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public int getRequireExplicitPolicy()
- {
- return requireExplicitPolicy;
- }
-
- public int getInhibitPolicyMapping()
- {
- return inhibitPolicyMapping;
- }
-
- public String toString()
- {
- return PolicyConstraint.class.getName() + " [ requireExplicitPolicy=" +
- requireExplicitPolicy + " inhibitPolicyMapping=" + inhibitPolicyMapping
- + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/PolicyMappings.java b/libjava/gnu/java/security/x509/ext/PolicyMappings.java
deleted file mode 100644
index 0493ed89dd4..00000000000
--- a/libjava/gnu/java/security/x509/ext/PolicyMappings.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/* PolicyMappings.java -- policy mappings extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class PolicyMappings extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.33");
-
- private final Map mappings;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public PolicyMappings(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERReader der = new DERReader(encoded);
- DERValue maps = der.read();
- if (!maps.isConstructed())
- throw new IOException("malformed PolicyMappings");
- int len = 0;
- HashMap _mappings = new HashMap();
- while (len < maps.getLength())
- {
- DERValue map = der.read();
- if (!map.isConstructed())
- throw new IOException("malformed PolicyMapping");
- DERValue val = der.read();
- if (val.getTag() != DER.OBJECT_IDENTIFIER)
- throw new IOException("malformed PolicyMapping");
- OID issuerPolicy = (OID) val.getValue();
- val = der.read();
- if (val.getTag() != DER.OBJECT_IDENTIFIER)
- throw new IOException("malformed PolicyMapping");
- OID subjectPolicy = (OID) val.getValue();
- _mappings.put(issuerPolicy, subjectPolicy);
- len += map.getEncodedLength();
- }
- mappings = Collections.unmodifiableMap(_mappings);
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public OID getSubjectDomainPolicy(OID issuerDomainPolicy)
- {
- return (OID) mappings.get(issuerDomainPolicy);
- }
-
- public String toString()
- {
- return PolicyMappings.class.getName() + " [ " + mappings + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java b/libjava/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java
deleted file mode 100644
index 3b531c05517..00000000000
--- a/libjava/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/* PrivateKeyUsagePeriod.java -- private key usage period extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.util.Date;
-
-public class PrivateKeyUsagePeriod extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.16");
-
- private final Date notBefore;
- private final Date notAfter;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public PrivateKeyUsagePeriod(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERReader der = new DERReader(encoded);
- DERValue val = der.read();
- if (!val.isConstructed())
- throw new IOException("malformed PrivateKeyUsagePeriod");
- if (val.getLength() > 0)
- val = der.read();
- if (val.getTagClass() == DER.APPLICATION || val.getTag() == 0)
- {
- notBefore = (Date) val.getValueAs (DER.GENERALIZED_TIME);
- val = der.read();
- }
- else
- notBefore = null;
- if (val.getTagClass() == DER.APPLICATION || val.getTag() == 1)
- {
- notAfter = (Date) val.getValueAs (DER.GENERALIZED_TIME);
- }
- else
- notAfter = null;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public Date getNotBefore()
- {
- return notBefore != null ? (Date) notBefore.clone() : null;
- }
-
- public Date getNotAfter()
- {
- return notAfter != null ? (Date) notAfter.clone() : null;
- }
-
- public String toString()
- {
- return PrivateKeyUsagePeriod.class.getName() + " [ notBefore=" + notBefore
- + " notAfter=" + notAfter + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/ReasonCode.java b/libjava/gnu/java/security/x509/ext/ReasonCode.java
deleted file mode 100644
index a6d59e43ae8..00000000000
--- a/libjava/gnu/java/security/x509/ext/ReasonCode.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ReasonCode.java -- a reason code for a certificate revocation.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.IOException;
-import java.math.BigInteger;
-
-public class ReasonCode extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.21");
-
- public final int reason;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public ReasonCode(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERValue val = DERReader.read(encoded);
- if (val.getTag() != DER.ENUMERATED)
- throw new IOException("malformed CRLReason");
- reason = ((BigInteger) val.getValue()).intValue();
- if (reason < 0 || reason == 7 || reason > 10)
- throw new IOException("illegal reason: " + reason);
- }
-
- // Instance method.
- // -------------------------------------------------------------------------
-
- public int getReasonCode()
- {
- return reason;
- }
-
- public String toString()
- {
- return ReasonCode.class.getName() + " [ " + reason + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/SubjectAlternativeNames.java b/libjava/gnu/java/security/x509/ext/SubjectAlternativeNames.java
deleted file mode 100644
index f88e854965f..00000000000
--- a/libjava/gnu/java/security/x509/ext/SubjectAlternativeNames.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* SubjectAlternatuveNames.java -- subject alternative names extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-
-import java.io.IOException;
-import java.util.List;
-
-public class SubjectAlternativeNames extends Extension.Value
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.17");
-
- private final GeneralNames names;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public SubjectAlternativeNames(final byte[] encoded) throws IOException
- {
- super(encoded);
- names = new GeneralNames(encoded);
- }
-
- // Instance method.
- // -------------------------------------------------------------------------
-
- public List getNames()
- {
- return names.getNames();
- }
-
- public String toString()
- {
- return SubjectAlternativeNames.class.getName() + " [ " + names + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/x509/ext/SubjectKeyIdentifier.java b/libjava/gnu/java/security/x509/ext/SubjectKeyIdentifier.java
deleted file mode 100644
index fc65abe211c..00000000000
--- a/libjava/gnu/java/security/x509/ext/SubjectKeyIdentifier.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* SubjectKeyIdentifier.java -- subject key identifier extension.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509.ext;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.x509.Util;
-
-import java.io.IOException;
-
-public class SubjectKeyIdentifier extends Extension.Value
-{
-
- // Constant.
- // -------------------------------------------------------------------------
-
- public static final OID ID = new OID("2.5.29.14");
-
- private final byte[] keyIdentifier;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public SubjectKeyIdentifier(final byte[] encoded) throws IOException
- {
- super(encoded);
- DERValue val = DERReader.read(encoded);
- if (val.getTag() != DER.OCTET_STRING)
- throw new IOException("malformed SubjectKeyIdentifier");
- keyIdentifier = (byte[]) val.getValue();
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public byte[] getKeyIdentifier()
- {
- return (byte[]) keyIdentifier.clone();
- }
-
- public String toString()
- {
- return SubjectKeyIdentifier.class.getName() + " [ " +
- Util.toHexString (keyIdentifier, ':') + " ]";
- }
-}
diff --git a/libjava/gnu/java/text/AttributedFormatBuffer.java b/libjava/gnu/java/text/AttributedFormatBuffer.java
deleted file mode 100644
index 8cfc8f56ddb..00000000000
--- a/libjava/gnu/java/text/AttributedFormatBuffer.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/* AttributedFormatBuffer.java -- Implements an attributed FormatBuffer.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-package gnu.java.text;
-
-import java.text.AttributedCharacterIterator;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-/**
- * This class is an implementation of a FormatBuffer with attributes.
- *
- * @author Guilhem Lavaux
- * The class is derived from {@link gnu.javax.swing.text.html.parser.DTD }
- * making structure creation methods public. This is required when
- * creating the DTD by SGML parser that must have access to the structure.
- *
- * SGML DTD representation. Provides basis for describing a syntax of the
- * HTML documents. The fields of this class are NOT initialized in
- * constructor. You need to do this separately before passing this data
- * structure to the parser constructor. This implementation also provides you the derived class
- * Use {@link javax.swing.HTML.HTMLEditorKit.Parser#parse }
- * for parsing in accordance with "-//W3C//DTD HTML 4.01 Frameset//EN"
- * without specifying DTD separately. The HTML content validator, is responsible for opening and
- * closing elements with optional start/end tags, detecting
- * the wrongly placed html tags and reporting errors. The working instance
- * is the inner class inside the {@link javax.swing.text.html.parser.Parser }
- * This class could potentially
- * provide basis for automated closing and insertion of the html tags,
- * correcting the found html errors.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public abstract class htmlValidator
-{
- /**
- * The tag reference, holding additional information that the tag
- * has been forcibly closed.
- */
- protected class hTag
- {
- protected final Element element;
- protected final HTML.Tag tag;
- protected final TagElement tgElement;
- protected boolean forcibly_closed;
- protected node validationTrace;
-
- protected hTag(TagElement an_element)
- {
- element = an_element.getElement();
- tag = an_element.getHTMLTag();
- tgElement = an_element;
-
- if (element.content != null)
- validationTrace = transformer.transform(element.content, dtd);
- }
-
- /**
- * This is called when the tag must be forcibly closed because
- * it would make the newly appearing tag invalid.
- * The parser is not notified about such event (just the error
- * is reported). For such tags, the closing message does not
- * appear when later reaching the end of stream. The exception is
- * the <head> tag: the parser is notified about its silent closing
- * when <body> or other html content appears.
- */
- protected void forciblyCloseDueContext()
- {
- forcibly_closed = true;
- }
-
- /**
- * This is called when the tag must be forcibly closed after
- * reaching the end of stream. The parser is notified as if
- * closing the tag explicitly.
- */
- protected void forciblyCloseDueEndOfStream()
- {
- forcibly_closed = true;
- handleSupposedEndTag(element);
- }
- }
-
- /**
- * The DTD, providing information about the valid document structure.
- */
- protected final DTD dtd;
-
- /**
- * The stack, holding the current tag context.
- */
- protected final LinkedList stack = new LinkedList();
-
- /**
- * Creates a new tag stack, using the given DTD.
- * @param a_dtd A DTD, providing the information about the valid
- * tag content.
- */
- public htmlValidator(DTD a_dtd)
- {
- dtd = a_dtd;
- }
-
- /**
- * Close all opened tags (called at the end of parsing).
- */
- public void closeAll()
- {
- hTag h;
- while (!stack.isEmpty())
- {
- h = (hTag) stack.getLast();
- if (!h.forcibly_closed && !h.element.omitEnd())
- s_error("Unclosed <" + h.tag + ">, closing at the end of stream");
-
- handleSupposedEndTag(h.element);
-
- closeTag(h.tgElement);
- }
- }
-
- /**
- * Remove the given tag from the stack or (if found) from the list
- * of the forcibly closed tags.
- */
- public void closeTag(TagElement tElement)
- {
- HTML.Tag tag = tElement.getHTMLTag();
- hTag x;
- hTag close;
-
- if (!stack.isEmpty())
- {
- ListIterator iter = stack.listIterator(stack.size());
-
- while (iter.hasPrevious())
- {
- x = (hTag) iter.previous();
- if (tag.equals(x.tag))
- {
- if (x.forcibly_closed && !x.element.omitEnd())
- s_error("The tag <" + x.tag +
- "> has already been forcibly closed"
- );
-
-
- // If the tag has a content model defined, forcibly close all
- // tags that were opened after the tag being currently closed.
- closing:
- if (x.element.content != null)
- {
- iter = stack.listIterator(stack.size());
- while (iter.hasPrevious())
- {
- close = (hTag) iter.previous();
- if (close == x)
- break closing;
- handleSupposedEndTag(close.element);
- iter.remove();
- }
- }
-
- stack.remove(x);
- return;
- }
- }
- }
- s_error("Closing unopened <" + tag + ">");
- }
-
- /**
- * Add the given HTML tag to the stack of the opened tags. Forcibly closes
- * all tags in the stack that does not allow this tag in they content (error
- * is reported).
- * @param element
- */
- public void openTag(TagElement tElement, htmlAttributeSet parameters)
- {
- // If this is a fictional call, the message from the parser
- // has recursively returned - ignore.
- if (tElement.fictional())
- return;
-
- validateParameters(tElement, parameters);
-
- // If the stack is empty, start from HTML
- if (stack.isEmpty() && tElement.getHTMLTag() != HTML.Tag.HTML)
- {
- Element html = dtd.getElement(HTML.Tag.HTML.toString());
- openFictionalTag(html);
- }
-
- Object v = tagIsValidForContext(tElement);
- if (v != Boolean.TRUE)
- {
- // The tag is not valid for context, the content
- // model suggest to open another tag.
- if (v instanceof Element)
- {
- int n = 0;
- while (v instanceof Element && (n++ < 100))
- {
- Element fe = (Element) v;
-
- // notify the content model that we add the proposed tag
- getCurrentContentModel().show(fe);
- openFictionalTag(fe);
-
- Object vv = tagIsValidForContext(tElement);
- if (vv instanceof Element) // One level of nesting is supported.
- {
- openFictionalTag((Element) vv);
-
- Object vx = tagIsValidForContext(tElement);
- if (vx instanceof Element)
- openFictionalTag((Element) vx);
- }
- else if (vv == Boolean.FALSE)
- {
- // The tag is still not valid for the current
- // content after opening a fictional element.
- if (fe.omitEnd())
- {
- // close the previously opened fictional tag.
- closeLast();
- vv = tagIsValidForContext(tElement);
- if (vv instanceof Element)
-
- // another tag was suggested by the content model
- openFictionalTag((Element) vv);
- }
- }
- v = tagIsValidForContext(tElement);
- }
- }
- else // If the current element has the optional end tag, close it.
- {
- if (!stack.isEmpty())
- {
- closing:
- do
- {
- hTag last = (hTag) stack.getLast();
- if (last.element.omitEnd())
- {
- closeLast();
- v = tagIsValidForContext(tElement);
- if (v instanceof Element) // another tag was suggested by the content model
- {
- openFictionalTag((Element) v);
- break closing;
- }
- }
- else
- break closing;
- }
- while (v == Boolean.FALSE && !stack.isEmpty());
- }
- }
- }
-
- stack.add(new hTag(tElement));
- }
-
- /**
- * Clear the stack.
- */
- public void restart()
- {
- stack.clear();
- }
-
- /**
- * Check if this tag is valid for the current context.
- * Return Boolean.True if it is OK, Boolean.False
- * if it is surely not OK or the Element that the
- * content model recommends to insert making the situation
- * ok. If Boolean.True is returned, the content model current
- * position is moved forward. Otherwise this position remains
- * the same.
- * @param tElement
- * @return
- */
- public Object tagIsValidForContext(TagElement tElement)
- {
- // Check the current content model, if one is available.
- node cv = getCurrentContentModel();
-
- if (cv != null)
- return cv.show(tElement.getElement());
-
- // Check exclusions and inclusions.
- ListIterator iter = stack.listIterator(stack.size());
- hTag t;
- final int idx = tElement.getElement().index;
-
- // Check only known tags.
- if (idx >= 0)
- {
- BitSet inclusions = new BitSet();
- while (iter.hasPrevious())
- {
- t = (hTag) iter.previous();
- if (!t.forcibly_closed)
- {
- if (t.element.exclusions != null &&
- t.element.exclusions.get(idx)
- )
- return Boolean.FALSE;
-
- if (t.element.inclusions != null)
- inclusions.or(t.element.inclusions);
- }
- }
- if (!inclusions.get(idx))
- return Boolean.FALSE;
- }
- return Boolean.TRUE;
- }
-
- /**
- * Validate tag without storing in into the tag stack. This is called
- * for the empty tags and results the subsequent calls to the openTag
- * and closeTag.
- */
- public void validateTag(TagElement tElement, htmlAttributeSet parameters)
- {
- openTag(tElement, parameters);
- closeTag(tElement);
- }
-
- /**
- * Check for mandatory elements, subsequent to the last tag:
- * @param tElement The element that will be inserted next.
- */
- protected void checkContentModel(TagElement tElement, boolean first)
- {
- if (stack.isEmpty())
- return;
-
- hTag last = (hTag) stack.getLast();
- if (last.validationTrace == null)
- return;
-
- Object r = last.validationTrace.show(tElement.getElement());
- if (r == Boolean.FALSE)
- s_error("The <" + last.element + "> does not match the content model " +
- last.validationTrace
- );
- else if (r instanceof Element) // The content model recommends insertion of this element
- {
- if (!first)
- closeTag(last.tgElement);
- handleSupposedStartTag((Element) r);
- openTag(new TagElement((Element) r), null);
- }
- }
-
- /**
- * The method is called when the tag must be closed because
- * it does not allow the subsequent elements inside its context
- * or the end of stream has been reached. The parser is only
- * informed if the element being closed does not require the
- * end tag (the "omitEnd" flag is set).
- * The closing message must be passed to the parser mechanism
- * before passing message about the opening the next tag.
- *
- * @param element The tag being fictionally (forcibly) closed.
- */
- protected abstract void handleSupposedEndTag(Element element);
-
- /**
- * The method is called when the validator decides to open the
- * tag on its own initiative. This may happen if the content model
- * includes the element with the optional (supposed) start tag.
- *
- * @param element The tag being opened.
- */
- protected abstract void handleSupposedStartTag(Element element);
-
- /**
- * Handles the error message. This method must be overridden to pass
- * the message where required.
- * @param msg The message text.
- */
- protected abstract void s_error(String msg);
-
- /**
- * Validate the parameters, report the error if the given parameter is
- * not in the parameter set, valid for the given attribute. The information
- * about the valid parameter set is taken from the Element, enclosed
- * inside the tag. The method does not validate the default parameters.
- * @param tag The tag
- * @param parameters The parameters of this tag.
- */
- protected void validateParameters(TagElement tag, htmlAttributeSet parameters)
- {
- if (parameters == null ||
- parameters == htmlAttributeSet.EMPTY_HTML_ATTRIBUTE_SET ||
- parameters == SimpleAttributeSet.EMPTY
- )
- return;
-
- Enumeration enumeration = parameters.getAttributeNames();
-
- while (enumeration.hasMoreElements())
- {
- validateAttribute(tag, parameters, enumeration);
- }
-
- // Check for missing required values.
- AttributeList a = tag.getElement().getAttributes();
-
- while (a != null)
- {
- if (a.getModifier() == DTDConstants.REQUIRED)
- if (parameters.getAttribute(a.getName()) == null)
- {
- s_error("Missing required attribute '" + a.getName() + "' for <" +
- tag.getHTMLTag() + ">"
- );
- }
- a = a.next;
- }
- }
-
- private node getCurrentContentModel()
- {
- if (!stack.isEmpty())
- {
- hTag last = (hTag) stack.getLast();
- return last.validationTrace;
- }
- else
- return null;
- }
-
- private void closeLast()
- {
- handleSupposedEndTag(((hTag) stack.getLast()).element);
- stack.removeLast();
- }
-
- private void openFictionalTag(Element e)
- {
- handleSupposedStartTag(e);
- stack.add(new hTag(new TagElement(e, true)));
- if (!e.omitStart())
- s_error("<" + e + "> is expected (supposing it)");
- }
-
- private void validateAttribute(TagElement tag, htmlAttributeSet parameters,
- Enumeration enumeration
- )
- {
- Object foundAttribute;
- AttributeList dtdAttribute;
- foundAttribute = enumeration.nextElement();
- dtdAttribute = tag.getElement().getAttribute(foundAttribute.toString());
- if (dtdAttribute == null)
- {
- StringBuffer valid =
- new StringBuffer("The tag <" + tag.getHTMLTag() +
- "> cannot contain the attribute '" + foundAttribute +
- "'. The valid attributes for this tag are: "
- );
-
- AttributeList a = tag.getElement().getAttributes();
-
- while (a != null)
- {
- valid.append(a.name.toUpperCase());
- valid.append(' ');
- a = a.next;
- }
- s_error(valid.toString());
- }
-
- else
- {
- String value = parameters.getAttribute(foundAttribute).toString();
-
- if (dtdAttribute.type == DTDConstants.NUMBER)
- validateNumberAttribute(tag, foundAttribute, value);
-
- if (dtdAttribute.type == DTDConstants.NAME ||
- dtdAttribute.type == DTDConstants.ID
- )
- validateNameOrIdAttribute(tag, foundAttribute, value);
-
- if (dtdAttribute.values != null)
- validateAttributeWithValueList(tag, foundAttribute, dtdAttribute,
- value
- );
- }
- }
-
- private void validateAttributeWithValueList(TagElement tag,
- Object foundAttribute,
- AttributeList dtdAttribute,
- String value
- )
- {
- if (!dtdAttribute.values.contains(value.toLowerCase()) &&
- !dtdAttribute.values.contains(value.toUpperCase())
- )
- {
- StringBuffer valid;
- if (dtdAttribute.values.size() == 1)
- valid =
- new StringBuffer("The attribute '" + foundAttribute +
- "' of the tag <" + tag.getHTMLTag() +
- "> cannot have the value '" + value +
- "'. The only valid value is "
- );
- else
- valid =
- new StringBuffer("The attribute '" + foundAttribute +
- "' of the tag <" + tag.getHTMLTag() +
- "> cannot have the value '" + value + "'. The " +
- dtdAttribute.values.size() +
- " valid values are: "
- );
-
- Enumeration vv = dtdAttribute.values.elements();
- while (vv.hasMoreElements())
- {
- valid.append('"');
- valid.append(vv.nextElement());
- valid.append("\" ");
- }
- s_error(valid.toString());
- }
- }
-
- private void validateNameOrIdAttribute(TagElement tag, Object foundAttribute,
- String value
- )
- {
- boolean ok = true;
-
- if (!Character.isLetter(value.charAt(0)))
- ok = false;
-
- char c;
- for (int i = 0; i < value.length(); i++)
- {
- c = value.charAt(i);
- if (!(
- Character.isLetter(c) || Character.isDigit(c) ||
- "".indexOf(c) >= 0
- )
- )
- ok = false;
- }
- if (!ok)
- s_error("The '" + foundAttribute + "' attribute of the tag <" +
- tag.getHTMLTag() + "> must start from letter and consist of " +
- "letters, digits, hypens, colons, underscores and periods. " +
- "It cannot be '" + value + "'"
- );
- }
-
- private void validateNumberAttribute(TagElement tag, Object foundAttribute,
- String value
- )
- {
- try
- {
- Integer.parseInt(value);
- }
- catch (NumberFormatException ex)
- {
- s_error("The '" + foundAttribute + "' attribute of the tag <" +
- tag.getHTMLTag() + "> must be a valid number and not '" +
- value + "'"
- );
- }
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java b/libjava/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java
deleted file mode 100755
index 5a19a1bc13c..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* PCDATAonly_model.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-/**
- * The model, allowing only PCDATA in it (like for element OPTION).
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class PCDATAonly_model
- extends node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
-
- public PCDATAonly_model()
- {
- super((char) 0, (char) 0, null);
- }
-
- public Object show(Object x)
- {
- return x.toString().equalsIgnoreCase("#pcdata") ? Boolean.TRUE : Boolean.FALSE;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java b/libjava/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java
deleted file mode 100755
index 14514d58458..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* TableRowContentModel.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-import javax.swing.text.html.parser.DTD;
-import javax.swing.text.html.parser.Element;
-
-/**
- * Table row content model.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class TableRowContentModel
- extends node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
- final Element TD;
-
- public TableRowContentModel(DTD dtd)
- {
- super((char) 0, (char) 0, null);
- TD = dtd.getElement("TD");
- }
-
- public Object show(Object x)
- {
- // Always accept TD and TH
- String s = x.toString();
- if (s.equalsIgnoreCase("TD") || s.equalsIgnoreCase("TH"))
- return Boolean.TRUE;
-
- // Suggest closing in response to TR:
- if (s.equalsIgnoreCase("TR"))
- return Boolean.FALSE;
-
- // Recommend TD for other cases:
- return TD;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/list.java b/libjava/gnu/javax/swing/text/html/parser/models/list.java
deleted file mode 100755
index b77ef7fd850..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/list.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/* list.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-/**
- * Part of the internal representation of the content model.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class list
- extends node
- implements Serializable
-{
- private static final long serialVersionUID = 1;
-
- /**
- * Setting to true means that the list nodes must always be connected
- * by the same operation. This is far safer and clearer, but not
- * required by default standard.
- */
- public static boolean CLEAR;
-
- /**
- * A list of nodes.
- */
- public final node[] nodes;
-
- /**
- * Creates a new model list that is a member of some enclosing list.
- * @param binary_operator An operator with that this list is connected
- * with other members of the enclosing list.
- * @param unary_operator The unary operator for this list.
- * @param a_nodes The nodes inside this list.
- */
- public list(char binary_operator, char unary_operator, node[] a_nodes)
- {
- super(binary_operator, unary_operator, a_nodes);
- nodes = a_nodes;
- }
-
- /**
- * Creates a new model list. Assigns the previous field.
- * @param a_nodes The nodes for this list.
- * @throws an error if the node elements are connected by the
- * different operations. This is not supported, use grouping.
- */
- public list(node[] a_nodes)
- throws Error
- {
- this(',', (char) 0, a_nodes);
-
- int operation = nodes [ 0 ].binary;
-
- for (int i = 0; i < nodes.length; i++)
- {
- if (CLEAR && nodes [ i ].binary != operation)
- throw new Error("List members can only be connected by " +
- "the same operation, use grouping"
- );
-
- if (i > 0)
- nodes [ i ].previous = nodes [ i - 1 ];
- }
- }
-
- /**
- * Returns true if all members in the list are closed.
- */
- public boolean isClosed()
- {
- if (super.isClosed())
- return true;
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].isClosed())
- return false;
- }
- return true;
- }
-
- /**
- * Find the token that could match as the next token in
- * the token list.
- *
- * @return Such token object or null if none is found.
- */
- public Object findFreeNode()
- {
- Object fn;
- for (int j = 0; j < nodes.length; j++)
- {
- if (!nodes [ j ].isClosed())
- {
- fn = nodes [ j ].findFreeNode();
- if (fn != null)
- return fn;
- }
- }
- return null;
- }
-
- /**
- * Tries to match this list agains the given token sequence.
- * @param tokens the sequence of the tokens to match.
- * @return true if the valid match is found.
- */
- public boolean matches(Object[] tokens)
- {
- reset();
-
- Object x;
- boolean m;
- boolean matched = false;
-
- for (int i = 0; i < tokens.length; i++)
- {
- matched = false;
- x = tokens [ i ];
-
- nodescan:
- for (int j = 0; j < nodes.length; j++)
- {
- if (!nodes [ j ].isClosed())
- {
- m = nodes [ j ].performMatch(x);
-
- if (m)
- {
- matched = true;
- break nodescan;
- }
- }
- }
- if (!matched)
- return false;
- }
-
- boolean valid = true;
-
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].valid())
- valid = false;
- }
-
- return valid;
- }
-
- /**
- * The list never closes, despite it is trated as closed
- * if all members in the list are closed.
- * @return false.
- */
- public boolean mustClose()
- {
- return false;
- }
-
- /**
- * Perform a match operation for the single token
- * against this list.
- * @param token a token to match.
- * @return true if the match is found.
- */
- public boolean performMatch(Object token)
- {
- boolean ok = false;
- Matching:
- for (int i = 0; i < nodes.length; i++)
- {
- ok = nodes [ i ].performMatch(token);
-
- if (ok)
- break Matching;
- }
-
- if (ok)
- matches();
-
- return ok;
- }
-
- /**
- * Prepeares the list for the next matching operation.
- */
- public void reset()
- {
- super.reset();
- for (int i = 0; i < nodes.length; i++)
- nodes [ i ].reset();
- }
-
- /**
- * Check if the provided token can match as a next token in the
- * list. In the case of match, the list state changes, moving
- * current position after the matched token. However if this method
- * returns a suggested new token to insert before the provided one,
- * the state of the list does not change.
- * @return Boolean.TRUE if the match is found,
- * Boolean.FALSE if the match is not possible and no token can be
- * inserted to make the match valid. Otherwise, returns the
- * token object that can be inserted before the last token in the
- * list, probably (not for sure) making the match valid.
- * If the object is an instance of Element or TagElement,
- * it is first ensured that the object flag "omit start" is set.
- */
- public Object show(Object x)
- {
- boolean m;
- boolean matched = false;
-
- nodescan:
- for (int j = 0; j < nodes.length; j++)
- {
- if (!nodes [ j ].isClosed())
- {
- m = nodes [ j ].performMatch(x);
-
- if (m)
- {
- matched = true;
- break nodescan;
- }
- else
- {
- // For comma operation, only first not closed
- // node must be tested for a match.
- // unless it allows matching zero times.
- if (binary == ',' &&
- !(nodes [ j ].unary == '?' || nodes [ j ].unary == '*')
- )
- break nodescan;
- }
- }
- }
-
- if (!matched)
- {
- // Find and return that would be matched.
- Object freeNode = findFreeNode();
- if (freeNode == null)
- return Boolean.FALSE;
- else
- return freeNode;
- }
-
- for (int i = 0; i < nodes.length; i++)
- if (!nodes [ i ].validPreliminary())
- {
- return Boolean.FALSE;
- }
-
- return Boolean.TRUE;
- }
-
- /**
- * Returns a string representation of the list.
- * @return String representation, similar to BNF expression.
- */
- public String toString()
- {
- StringBuffer b = new StringBuffer();
- b.append(" ( ");
- for (int i = 0; i < nodes.length; i++)
- {
- if (i > 0)
- b.append(" " + (char) nodes [ i ].binary + " ");
- b.append(nodes [ i ]);
- }
-
- b.append(" )");
- if (unary != 0)
- b.append((char) unary);
- else
- b.append(' ');
- return b.toString();
- }
-
- /**
- * Returns true if all memebers in the list are valid.
- */
- public boolean valid()
- {
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].valid())
- return false;
- }
- return true;
- }
-
- /**
- * Returns true if all memebers in the list are either valid
- * or unvisited. The unvisited members can become valid after
- * more tokens will be shown.
- */
- public boolean validPreliminary()
- {
- if (silenceAllowed())
- {
- boolean everVisited = false;
- for (int i = 0; i < nodes.length; i++)
- {
- if (nodes [ i ].visits > 0)
- {
- everVisited = true;
- break;
- }
- }
- if (!everVisited)
- return true;
- }
-
- for (int i = 0; i < nodes.length; i++)
- {
- if (!nodes [ i ].validPreliminary())
- return false;
- }
- return true;
- }
-
- /**
- * Closes all members in the list.
- */
- protected void close()
- {
- super.close();
- for (int i = 0; i < nodes.length; i++)
- {
- nodes [ i ].close();
- }
- }
-
- /**
- * Compare given token with the token of this node.
- * If the token represents a @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) A simple error-tolerant HTML parser that uses a DTD document
- * to access data on the possible tokens, arguments and syntax. The parser reads an HTML content from a Reader and calls various
- * notifying methods (which should be overridden in a subclass)
- * when tags or data are encountered. Some HTML elements need no opening or closing tags. The
- * task of this parser is to invoke the tag handling methods also when
- * the tags are not explicitly specified and must be supposed using
- * information, stored in the DTD.
- * For example, parsing the document
- * <table><tr><td>a<td>b<td>c</tr>
- *
- * If you need more information about SGML insertions in HTML documents,
- * the author suggests to read SGML tutorial on
- * {@link http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html}.
- * We also recommend Goldfarb C.F (1991) The SGML Handbook,
- * Oxford University Press, 688 p, ISBN: 0198537379.
- * For non-preformatted section, the parser replaces
- * \t, \r and \n by spaces and then multiple spaces
- * by a single space. Additionaly, all whitespace around
- * tags is discarded.
- * For pre-formatted text (inside TEXAREA and PRE), the parser preserves
- * all tabs and spaces, but removes one bounding \r, \n or \r\n,
- * if it is present. Additionally, it replaces each occurence of \r or \r\n
- * by a single \n. @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- * A regular expression object (class RE) is compiled by constructing it
- * from a String, StringBuffer or character array, with optional
- * compilation flags (below)
- * and an optional syntax specification (see RESyntax; if not specified,
- *
- * Once compiled, a regular expression object is reusable as well as
- * threadsafe: multiple threads can use the RE instance simultaneously
- * to match against different input text.
- *
- * Various methods attempt to match input text against a compiled
- * regular expression. These methods are:
- *
- *
- * These methods all have similar argument lists. The input can be a
- * String, a character array, a StringBuffer, or an
- * InputStream of some sort. Note that when using an
- * InputStream, the stream read position cannot be guaranteed after
- * attempting a match (this is not a bug, but a consequence of the way
- * regular expressions work). Using an REMatchEnumeration can
- * eliminate most positioning problems.
- *
- *
- *
- * The optional index argument specifies the offset from the beginning
- * of the text at which the search should start (see the descriptions
- * of some of the execution flags for how this can affect positional
- * pattern operators). For an InputStream, this means an
- * offset from the current read position, so subsequent calls with the
- * same index argument on an InputStream will not
- * necessarily access the same position on the stream, whereas
- * repeated searches at a given index in a fixed string will return
- * consistent results.
- *
- *
- * You can optionally affect the execution environment by using a
- * combination of execution flags (constants listed below).
- *
- *
- * All operations on a regular expression are performed in a
- * thread-safe manner.
- *
- * @author Wes Biggs
- * @version 1.1.5-dev, to be released
- */
-
-public class RE extends REToken {
-
- private static final class IntPair implements Serializable {
- public int first, second;
- }
-
- private static final class CharUnit implements Serializable {
- public char ch;
- public boolean bk;
- }
-
- // This String will be returned by getVersion()
- private static final String VERSION = "1.1.5-dev";
-
- // The localized strings are kept in a separate file
- private static ResourceBundle messages = PropertyResourceBundle.getBundle("gnu/regexp/MessagesBundle", Locale.getDefault());
-
- // These are, respectively, the first and last tokens in our linked list
- // If there is only one token, firstToken == lastToken
- private REToken firstToken, lastToken;
-
- // This is the number of subexpressions in this regular expression,
- // with a minimum value of zero. Returned by getNumSubs()
- private int numSubs;
-
- /** Minimum length, in characters, of any possible match. */
- private int minimumLength;
-
- /**
- * Compilation flag. Do not differentiate case. Subsequent
- * searches using this RE will be case insensitive.
- */
- public static final int REG_ICASE = 2;
-
- /**
- * Compilation flag. The match-any-character operator (dot)
- * will match a newline character. When set this overrides the syntax
- * bit RE_DOT_NEWLINE (see RESyntax for details). This is equivalent to
- * the "/s" operator in Perl.
- */
- public static final int REG_DOT_NEWLINE = 4;
-
- /**
- * Compilation flag. Use multiline mode. In this mode, the ^ and $
- * anchors will match based on newlines within the input. This is
- * equivalent to the "/m" operator in Perl.
- */
- public static final int REG_MULTILINE = 8;
-
- /**
- * Execution flag.
- * The match-beginning operator (^) will not match at the beginning
- * of the input string. Useful for matching on a substring when you
- * know the context of the input is such that position zero of the
- * input to the match test is not actually position zero of the text.
- *
- * This example demonstrates the results of various ways of matching on
- * a substring.
- *
- *
- * // Results:
- *
- *
- * can be viewed (given that myMatch is not null) by creating
- *
- *
- * But you can save yourself that work, since the
- *
- * REMatchEnumeration does lazy computation; that is, it will not
- * search for a match until it needs to. If you'd rather just get all
- * the matches at once in a big array, use the
- *
- *
- * The enumerated type is especially useful when searching on a Reader
- * or InputStream, because the InputStream read position cannot be
- * guaranteed after calling
- * Note that this makes UncheckedRE dangerous if constructed with
- * dynamic data. Do not use UncheckedRE unless you are completely sure
- * that all input being passed to it contains valid, well-formed
- * regular expressions for the syntax specified.
- *
- * @author Wes Biggs
- * @see gnu.regexp.RE
- * @since gnu.regexp 1.1.4
- */
-
-public final class UncheckedRE extends RE {
- /**
- * Constructs a regular expression pattern buffer without any compilation
- * flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @exception RuntimeException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public UncheckedRE(Object pattern) {
- this(pattern,0,RESyntax.RE_SYNTAX_PERL5);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags in the RE class.
- * @exception RuntimeException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public UncheckedRE(Object pattern, int cflags) {
- this(pattern,cflags,RESyntax.RE_SYNTAX_PERL5);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and regular expression syntax.
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags in the RE class.
- * @param syntax The type of regular expression syntax to use.
- * @exception RuntimeException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public UncheckedRE(Object pattern, int cflags, RESyntax syntax) {
- try {
- initialize(pattern,cflags,syntax,0,0);
- } catch (REException e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-}
-
-
diff --git a/libjava/gnu/xml/aelfred2/ContentHandler2.java b/libjava/gnu/xml/aelfred2/ContentHandler2.java
deleted file mode 100644
index 15161383592..00000000000
--- a/libjava/gnu/xml/aelfred2/ContentHandler2.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ContentHandler2.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.aelfred2;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-/**
- * Extension to the SAX ContentHandler interface to report parsing events
- * and parameters required by DOM Level 3 but not supported by SAX.
- *
- * @author Chris Burdess
- */
-public interface ContentHandler2
- extends ContentHandler
-{
-
- /**
- * Reports the XML declaration.
- * @param version the value of the version attribute in the XML
- * declaration
- * @param encoding the encoding specified in the XML declaration, if any
- * @param standalone the standalone attribute from the XML declaration
- * @param inputEncoding the encoding of the XML input
- */
- void xmlDecl(String version, String encoding, boolean standalone,
- String inputEncoding)
- throws SAXException;
-
-}
diff --git a/libjava/gnu/xml/aelfred2/JAXPFactory.java b/libjava/gnu/xml/aelfred2/JAXPFactory.java
deleted file mode 100644
index 37e8cc9c120..00000000000
--- a/libjava/gnu/xml/aelfred2/JAXPFactory.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/* JAXPFactory.java --
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.aelfred2;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import org.xml.sax.Parser;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.helpers.XMLReaderAdapter;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-
-/**
- * Configurable factory to create an Ælfred2 JAXP parser; required
- * to bootstrap using JAXP. You should use SAX2 directly where possible,
- * rather than through JAXP, since that gives you better control.
- * This class would normally be configured as a platform default factory.
- *
- * @author David Brownell
- */
-public final class JAXPFactory
- extends SAXParserFactory
-{
-
- private Hashtable flags = new Hashtable();
-
- /**
- * Constructs a factory which normally returns a non-validating
- * parser.
- */
- public JAXPFactory()
- {
- }
-
- public SAXParser newSAXParser()
- throws ParserConfigurationException, SAXException
- {
- JaxpParser jaxp = new JaxpParser();
- Enumeration e = flags.keys();
- XMLReader parser = jaxp.getXMLReader();
-
- parser.setFeature(SAXDriver.FEATURE + "namespaces",
- isNamespaceAware());
- parser.setFeature(SAXDriver.FEATURE + "validation",
- isValidating());
- // that makes SAX2 feature flags trump JAXP
-
- while (e.hasMoreElements())
- {
- String uri = (String) e.nextElement();
- Boolean value = (Boolean) flags.get(uri);
- parser.setFeature(uri, value.booleanValue());
- }
-
- return jaxp;
- }
-
- // yes, this "feature transfer" mechanism doesn't play well
-
- public void setFeature(String name, boolean value)
- throws ParserConfigurationException, SAXNotRecognizedException,
- SAXNotSupportedException
- {
- try
- {
- // force "early" detection of errors where possible
- // (flags can't necessarily be set before parsing)
- new JaxpParser().getXMLReader().setFeature(name, value);
-
- flags.put(name, new Boolean(value));
- }
- catch (SAXNotRecognizedException e)
- {
- throw new SAXNotRecognizedException(name);
- }
- catch (SAXNotSupportedException e)
- {
- throw new SAXNotSupportedException(name);
- }
- catch (Exception e)
- {
- throw new ParserConfigurationException(e.getClass().getName()
- + ": "
- + e.getMessage());
- }
- }
-
- public boolean getFeature(String name)
- throws ParserConfigurationException, SAXNotRecognizedException,
- SAXNotSupportedException
- {
- Boolean value = (Boolean) flags.get(name);
-
- if (value != null)
- {
- return value.booleanValue();
- }
- else
- {
- try
- {
- return new JaxpParser().getXMLReader().getFeature(name);
- }
- catch (SAXNotRecognizedException e)
- {
- throw new SAXNotRecognizedException(name);
- }
- catch (SAXNotSupportedException e)
- {
- throw new SAXNotSupportedException(name);
- }
- catch (SAXException e)
- {
- throw new ParserConfigurationException(e.getClass().getName()
- + ": "
- + e.getMessage());
- }
- }
- }
-
- private static class JaxpParser
- extends SAXParser
- {
-
- private XmlReader ae2 = new XmlReader();
- private XMLReaderAdapter parser = null;
-
- JaxpParser()
- {
- }
-
- public void setProperty(String id, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- ae2.setProperty(id, value);
- }
-
- public Object getProperty(String id)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- return ae2.getProperty(id);
- }
-
- public Parser getParser()
- throws SAXException
- {
- if (parser == null)
- {
- parser = new XMLReaderAdapter(ae2);
- }
- return parser;
- }
-
- public XMLReader getXMLReader ()
- throws SAXException
- {
- return ae2;
- }
-
- public boolean isNamespaceAware()
- {
- try
- {
- return ae2.getFeature(SAXDriver.FEATURE + "namespaces");
- }
- catch (Exception e)
- {
- throw new Error();
- }
- }
-
- public boolean isValidating()
- {
- try
- {
- return ae2.getFeature(SAXDriver.FEATURE + "validation");
- }
- catch (Exception e)
- {
- throw new Error();
- }
- }
-
- // TODO isXIncludeAware()
-
- }
-
-}
-
diff --git a/libjava/gnu/xml/aelfred2/SAXDriver.java b/libjava/gnu/xml/aelfred2/SAXDriver.java
deleted file mode 100644
index 7e950ce042a..00000000000
--- a/libjava/gnu/xml/aelfred2/SAXDriver.java
+++ /dev/null
@@ -1,1622 +0,0 @@
-/* SAXDriver.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version.
-
-Portions derived from code which carried the following notice:
-
- Copyright (c) 1997, 1998 by Microstar Software Ltd.
-
- AElfred is free for both commercial and non-commercial use and
- redistribution, provided that Microstar's copyright and disclaimer are
- retained intact. You are free to modify AElfred for your own use and
- to redistribute AElfred with your modifications, provided that the
- modifications are clearly documented.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- merchantability or fitness for a particular purpose. Please use it AT
- YOUR OWN RISK.
-*/
-
-package gnu.xml.aelfred2;
-
-import java.io.*;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Locale;
-import java.util.Stack;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.NamespaceSupport;
-
-
-/**
- * An enhanced SAX2 version of Microstar's Ælfred XML parser.
- * The enhancements primarily relate to significant improvements in
- * conformance to the XML specification, and SAX2 support. Performance
- * has been improved. See the package level documentation for more
- * information.
- *
- * This parser currently implements the SAX1 Parser API, but
- * it may not continue to do so in the future.
- *
- * @author Written by David Megginson (version 1.2a from Microstar)
- * @author Updated by David Brownell <dbrownell@users.sourceforge.net>
- * @see org.xml.sax.Parser
- */
-final public class SAXDriver
- implements Locator, Attributes2, XMLReader, Parser, AttributeList
-{
-
- private final DefaultHandler2 base = new DefaultHandler2();
- private XmlParser parser;
-
- private EntityResolver entityResolver = base;
- private EntityResolver2 resolver2 = null;
- private ContentHandler contentHandler = base;
- private DTDHandler dtdHandler = base;
- private ErrorHandler errorHandler = base;
- private DeclHandler declHandler = base;
- private LexicalHandler lexicalHandler = base;
-
- private String elementName;
- private Stack entityStack;
-
- // one vector (of object/struct): faster, smaller
- private List attributesList;
-
- private boolean namespaces = true;
- private boolean xmlNames = false;
- private boolean extGE = true;
- private boolean extPE = true;
- private boolean resolveAll = true;
- private boolean useResolver2 = true;
-
- // package private to allow (read-only) access in XmlParser
- boolean stringInterning = true;
-
- private int attributeCount;
- private boolean attributes;
- private String[] nsTemp;
- private NamespaceSupport prefixStack;
-
- //
- // Constructor.
- //
-
- /**
- * Constructs a SAX Parser.
- */
- public SAXDriver()
- {
- reset();
- }
-
- private void reset()
- {
- elementName = null;
- entityStack = new Stack();
- attributesList = Collections.synchronizedList(new ArrayList());
- attributeCount = 0;
- attributes = false;
- nsTemp = new String[3];
- prefixStack = null;
- }
-
-
- //
- // Implementation of org.xml.sax.Parser.
- //
-
- /**
- * SAX1: Sets the locale used for diagnostics; currently,
- * only locales using the English language are supported.
- * @param locale The locale for which diagnostics will be generated
- */
- public void setLocale(Locale locale)
- throws SAXException
- {
- if ("en".equals(locale.getLanguage()))
- {
- return;
- }
- throw new SAXException ("AElfred2 only supports English locales.");
- }
-
- /**
- * SAX2: Returns the object used when resolving external
- * entities during parsing (both general and parameter entities).
- */
- public EntityResolver getEntityResolver()
- {
- return (entityResolver == base) ? null : entityResolver;
- }
-
- /**
- * SAX1, SAX2: Set the entity resolver for this parser.
- * @param handler The object to receive entity events.
- */
- public void setEntityResolver(EntityResolver resolver)
- {
- if (resolver instanceof EntityResolver2)
- {
- resolver2 = (EntityResolver2) resolver;
- }
- else
- {
- resolver2 = null;
- }
- if (resolver == null)
- {
- resolver = base;
- }
- entityResolver = resolver;
- }
-
- /**
- * SAX2: Returns the object used to process declarations related
- * to notations and unparsed entities.
- */
- public DTDHandler getDTDHandler()
- {
- return (dtdHandler == base) ? null : dtdHandler;
- }
-
- /**
- * SAX1, SAX2: Set the DTD handler for this parser.
- * @param handler The object to receive DTD events.
- */
- public void setDTDHandler(DTDHandler handler)
- {
- if (handler == null)
- {
- handler = base;
- }
- this.dtdHandler = handler;
- }
-
-
- /**
- * SAX1: Set the document handler for this parser. If a
- * content handler was set, this document handler will supplant it.
- * The parser is set to report all XML 1.0 names rather than to
- * filter out "xmlns" attributes (the "namespace-prefixes" feature
- * is set to true).
- *
- * @deprecated SAX2 programs should use the XMLReader interface
- * and a ContentHandler.
- *
- * @param handler The object to receive document events.
- */
- public void setDocumentHandler(DocumentHandler handler)
- {
- contentHandler = new Adapter(handler);
- xmlNames = true;
- }
-
- /**
- * SAX2: Returns the object used to report the logical
- * content of an XML document.
- */
- public ContentHandler getContentHandler()
- {
- return (contentHandler == base) ? null : contentHandler;
- }
-
- /**
- * SAX2: Assigns the object used to report the logical
- * content of an XML document. If a document handler was set,
- * this content handler will supplant it (but XML 1.0 style name
- * reporting may remain enabled).
- */
- public void setContentHandler(ContentHandler handler)
- {
- if (handler == null)
- {
- handler = base;
- }
- contentHandler = handler;
- }
-
- /**
- * SAX1, SAX2: Set the error handler for this parser.
- * @param handler The object to receive error events.
- */
- public void setErrorHandler(ErrorHandler handler)
- {
- if (handler == null)
- {
- handler = base;
- }
- this.errorHandler = handler;
- }
-
- /**
- * SAX2: Returns the object used to receive callbacks for XML
- * errors of all levels (fatal, nonfatal, warning); this is never null;
- */
- public ErrorHandler getErrorHandler()
- {
- return (errorHandler == base) ? null : errorHandler;
- }
-
- /**
- * SAX1, SAX2: Auxiliary API to parse an XML document, used mostly
- * when no URI is available.
- * If you want anything useful to happen, you should set
- * at least one type of handler.
- * @param source The XML input source. Don't set 'encoding' unless
- * you know for a fact that it's correct.
- * @see #setEntityResolver
- * @see #setDTDHandler
- * @see #setContentHandler
- * @see #setErrorHandler
- * @exception SAXException The handlers may throw any SAXException,
- * and the parser normally throws SAXParseException objects.
- * @exception IOException IOExceptions are normally through through
- * the parser if there are problems reading the source document.
- */
- public void parse(InputSource source)
- throws SAXException, IOException
- {
- synchronized (base)
- {
- parser = new XmlParser();
- if (namespaces)
- {
- prefixStack = new NamespaceSupport();
- }
- else if (!xmlNames)
- {
- throw new IllegalStateException();
- }
- parser.setHandler(this);
-
- try
- {
- Reader r = source.getCharacterStream();
- InputStream in = source.getByteStream();
-
- parser.doParse(source.getSystemId(),
- source.getPublicId(),
- r,
- in,
- source.getEncoding());
- }
- catch (SAXException e)
- {
- throw e;
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new SAXParseException(e.getMessage(), this, e);
- }
- finally
- {
- contentHandler.endDocument();
- reset();
- }
- }
- }
-
- /**
- * SAX1, SAX2: Preferred API to parse an XML document, using a
- * system identifier (URI).
- */
- public void parse(String systemId)
- throws SAXException, IOException
- {
- parse(new InputSource(systemId));
- }
-
- //
- // Implementation of SAX2 "XMLReader" interface
- //
- static final String FEATURE = "http://xml.org/sax/features/";
- static final String PROPERTY = "http://xml.org/sax/properties/";
-
- /**
- * SAX2: Tells the value of the specified feature flag.
- *
- * @exception SAXNotRecognizedException thrown if the feature flag
- * is neither built in, nor yet assigned.
- */
- public boolean getFeature(String featureId)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if ((FEATURE + "validation").equals(featureId))
- {
- return false;
- }
-
- // external entities (both types) are optionally included
- if ((FEATURE + "external-general-entities").equals(featureId))
- {
- return extGE;
- }
- if ((FEATURE + "external-parameter-entities").equals(featureId))
- {
- return extPE;
- }
-
- // element/attribute names are as written in document; no mangling
- if ((FEATURE + "namespace-prefixes").equals(featureId))
- {
- return xmlNames;
- }
-
- // report element/attribute namespaces?
- if ((FEATURE + "namespaces").equals(featureId))
- {
- return namespaces;
- }
-
- // all PEs and GEs are reported
- if ((FEATURE + "lexical-handler/parameter-entities").equals(featureId))
- {
- return true;
- }
-
- // default is true
- if ((FEATURE + "string-interning").equals(featureId))
- {
- return stringInterning;
- }
-
- // EXTENSIONS 1.1
-
- // always returns isSpecified info
- if ((FEATURE + "use-attributes2").equals(featureId))
- {
- return true;
- }
-
- // meaningful between startDocument/endDocument
- if ((FEATURE + "is-standalone").equals(featureId))
- {
- if (parser == null)
- {
- throw new SAXNotSupportedException(featureId);
- }
- return parser.isStandalone();
- }
-
- // optionally don't absolutize URIs in declarations
- if ((FEATURE + "resolve-dtd-uris").equals(featureId))
- {
- return resolveAll;
- }
-
- // optionally use resolver2 interface methods, if possible
- if ((FEATURE + "use-entity-resolver2").equals(featureId))
- {
- return useResolver2;
- }
-
- throw new SAXNotRecognizedException(featureId);
- }
-
- // package private
- DeclHandler getDeclHandler()
- {
- return declHandler;
- }
-
- // package private
- boolean resolveURIs()
- {
- return resolveAll;
- }
-
- /**
- * SAX2: Returns the specified property.
- *
- * @exception SAXNotRecognizedException thrown if the property value
- * is neither built in, nor yet stored.
- */
- public Object getProperty(String propertyId)
- throws SAXNotRecognizedException
- {
- if ((PROPERTY + "declaration-handler").equals(propertyId))
- {
- return (declHandler == base) ? null : declHandler;
- }
-
- if ((PROPERTY + "lexical-handler").equals(propertyId))
- {
- return (lexicalHandler == base) ? null : lexicalHandler;
- }
-
- // unknown properties
- throw new SAXNotRecognizedException(propertyId);
- }
-
- /**
- * SAX2: Sets the state of feature flags in this parser. Some
- * built-in feature flags are mutable.
- */
- public void setFeature(String featureId, boolean value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- boolean state;
-
- // Features with a defined value, we just change it if we can.
- state = getFeature (featureId);
-
- if (state == value)
- {
- return;
- }
- if (parser != null)
- {
- throw new SAXNotSupportedException("not while parsing");
- }
-
- if ((FEATURE + "namespace-prefixes").equals(featureId))
- {
- // in this implementation, this only affects xmlns reporting
- xmlNames = value;
- // forcibly prevent illegal parser state
- if (!xmlNames)
- {
- namespaces = true;
- }
- return;
- }
-
- if ((FEATURE + "namespaces").equals(featureId))
- {
- namespaces = value;
- // forcibly prevent illegal parser state
- if (!namespaces)
- {
- xmlNames = true;
- }
- return;
- }
-
- if ((FEATURE + "external-general-entities").equals(featureId))
- {
- extGE = value;
- return;
- }
- if ((FEATURE + "external-parameter-entities").equals(featureId))
- {
- extPE = value;
- return;
- }
- if ((FEATURE + "resolve-dtd-uris").equals(featureId))
- {
- resolveAll = value;
- return;
- }
-
- if ((FEATURE + "use-entity-resolver2").equals(featureId))
- {
- useResolver2 = value;
- return;
- }
-
- throw new SAXNotRecognizedException(featureId);
- }
-
- /**
- * SAX2: Assigns the specified property. Like SAX1 handlers,
- * these may be changed at any time.
- */
- public void setProperty(String propertyId, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- // see if the property is recognized
- getProperty(propertyId);
-
- // Properties with a defined value, we just change it if we can.
-
- if ((PROPERTY + "declaration-handler").equals(propertyId))
- {
- if (value == null)
- {
- declHandler = base;
- }
- else if (!(value instanceof DeclHandler))
- {
- throw new SAXNotSupportedException(propertyId);
- }
- else
- {
- declHandler = (DeclHandler) value;
- }
- return ;
- }
-
- if ((PROPERTY + "lexical-handler").equals(propertyId))
- {
- if (value == null)
- {
- lexicalHandler = base;
- }
- else if (!(value instanceof LexicalHandler))
- {
- throw new SAXNotSupportedException(propertyId);
- }
- else
- {
- lexicalHandler = (LexicalHandler) value;
- }
- return;
- }
-
- throw new SAXNotSupportedException(propertyId);
- }
-
- //
- // This is where the driver receives XmlParser callbacks and translates
- // them into SAX callbacks. Some more callbacks have been added for
- // SAX2 support.
- //
-
- void startDocument()
- throws SAXException
- {
- contentHandler.setDocumentLocator(this);
- contentHandler.startDocument();
- attributesList.clear();
- }
-
- void xmlDecl(String version,
- String encoding,
- boolean standalone,
- String inputEncoding)
- throws SAXException
- {
- if (contentHandler instanceof ContentHandler2)
- {
- ((ContentHandler2) contentHandler).xmlDecl(version,
- encoding,
- standalone,
- inputEncoding);
- }
- }
-
- void skippedEntity(String name)
- throws SAXException
- {
- contentHandler.skippedEntity(name);
- }
-
- InputSource getExternalSubset(String name, String baseURI)
- throws SAXException, IOException
- {
- if (resolver2 == null || !useResolver2 || !extPE)
- {
- return null;
- }
- return resolver2.getExternalSubset(name, baseURI);
- }
-
- InputSource resolveEntity(boolean isPE, String name,
- InputSource in, String baseURI)
- throws SAXException, IOException
- {
- InputSource source;
-
- // external entities might be skipped
- if (isPE && !extPE)
- {
- return null;
- }
- if (!isPE && !extGE)
- {
- return null;
- }
-
- // ... or not
- lexicalHandler.startEntity(name);
- if (resolver2 != null && useResolver2)
- {
- source = resolver2.resolveEntity(name, in.getPublicId(),
- baseURI, in.getSystemId());
- if (source == null)
- {
- in.setSystemId(absolutize(baseURI,
- in.getSystemId(), false));
- source = in;
- }
- }
- else
- {
- in.setSystemId(absolutize(baseURI, in.getSystemId(), false));
- source = entityResolver.resolveEntity(in.getPublicId(),
- in.getSystemId());
- if (source == null)
- {
- source = in;
- }
- }
- startExternalEntity(name, source.getSystemId(), true);
- return source;
- }
-
- // absolutize a system ID relative to the specified base URI
- // (temporarily) package-visible for external entity decls
- String absolutize(String baseURI, String systemId, boolean nice)
- throws MalformedURLException, SAXException
- {
- // FIXME normalize system IDs -- when?
- // - Convert to UTF-8
- // - Map reserved and non-ASCII characters to %HH
-
- try
- {
- if (baseURI == null)
- {
- if (XmlParser.uriWarnings)
- {
- warn ("No base URI; hope this SYSTEM id is absolute: "
- + systemId);
- }
- return new URL(systemId).toString();
- }
- else
- {
- return new URL(new URL(baseURI), systemId).toString();
- }
- }
- catch (MalformedURLException e)
- {
- // Let unknown URI schemes pass through unless we need
- // the JVM to map them to i/o streams for us...
- if (!nice)
- {
- throw e;
- }
-
- // sometimes sysids for notations or unparsed entities
- // aren't really URIs...
- warn("Can't absolutize SYSTEM id: " + e.getMessage());
- return systemId;
- }
- }
-
- void startExternalEntity(String name, String systemId, boolean stackOnly)
- throws SAXException
- {
- // The following warning was deleted because the application has the
- // option of not setting systemId. Sun's JAXP or Xerces seems to
- // ignore this case.
- /*
- if (systemId == null)
- warn ("URI was not reported to parser for entity " + name);
- */
- if (!stackOnly) // spliced [dtd] needs startEntity
- {
- lexicalHandler.startEntity(name);
- }
- entityStack.push(systemId);
- }
-
- void endExternalEntity(String name)
- throws SAXException
- {
- if (!"[document]".equals(name))
- {
- lexicalHandler.endEntity(name);
- }
- entityStack.pop();
- }
-
- void startInternalEntity(String name)
- throws SAXException
- {
- lexicalHandler.startEntity(name);
- }
-
- void endInternalEntity(String name)
- throws SAXException
- {
- lexicalHandler.endEntity(name);
- }
-
- void doctypeDecl(String name, String publicId, String systemId)
- throws SAXException
- {
- lexicalHandler.startDTD(name, publicId, systemId);
-
- // ... the "name" is a declaration and should be given
- // to the DeclHandler (but sax2 doesn't).
-
- // the IDs for the external subset are lexical details,
- // as are the contents of the internal subset; but sax2
- // doesn't provide the internal subset "pre-parse"
- }
-
- void notationDecl(String name, String publicId, String systemId,
- String baseUri)
- throws SAXException
- {
- try
- {
- dtdHandler.notationDecl(name, publicId,
- (resolveAll && systemId != null)
- ? absolutize(baseUri, systemId, true)
- : systemId);
- }
- catch (IOException e)
- {
- // "can't happen"
- throw new SAXParseException(e.getMessage(), this, e);
- }
- }
-
- void unparsedEntityDecl(String name, String publicId, String systemId,
- String baseUri, String notation)
- throws SAXException
- {
- try
- {
- dtdHandler.unparsedEntityDecl(name, publicId,
- resolveAll
- ? absolutize(baseUri, systemId, true)
- : systemId,
- notation);
- }
- catch (IOException e)
- {
- // "can't happen"
- throw new SAXParseException(e.getMessage(), this, e);
- }
- }
-
- void endDoctype()
- throws SAXException
- {
- lexicalHandler.endDTD();
- }
-
- private void declarePrefix(String prefix, String uri)
- throws SAXException
- {
- int index = uri.indexOf(':');
-
- // many versions of nwalsh docbook stylesheets
- // have bogus URLs; so this can't be an error...
- if (index < 1 && uri.length() != 0)
- {
- warn("relative URI for namespace: " + uri);
- }
-
- // FIXME: char [0] must be ascii alpha; chars [1..index]
- // must be ascii alphanumeric or in "+-." [RFC 2396]
-
- //Namespace Constraints
- //name for xml prefix must be http://www.w3.org/XML/1998/namespace
- boolean prefixEquality = prefix.equals("xml");
- boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace");
- if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality))
- {
- fatal("xml is by definition bound to the namespace name " +
- "http://www.w3.org/XML/1998/namespace");
- }
-
- //xmlns prefix declaration is illegal but xml prefix declaration is llegal...
- if (prefixEquality && uriEquality)
- {
- return;
- }
-
- //name for xmlns prefix must be http://www.w3.org/2000/xmlns/
- prefixEquality = prefix.equals("xmlns");
- uriEquality = uri.equals("http://www.w3.org/2000/xmlns/");
- if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality))
- {
- fatal("http://www.w3.org/2000/xmlns/ is by definition bound" +
- " to prefix xmlns");
- }
-
- //even if the uri is http://www.w3.org/2000/xmlns/
- // it is illegal to declare it
- if (prefixEquality && uriEquality)
- {
- fatal ("declaring the xmlns prefix is illegal");
- }
-
- uri = uri.intern();
- prefixStack.declarePrefix(prefix, uri);
- contentHandler.startPrefixMapping(prefix, uri);
- }
-
- void attribute(String qname, String value, boolean isSpecified)
- throws SAXException
- {
- if (!attributes)
- {
- attributes = true;
- if (namespaces)
- {
- prefixStack.pushContext();
- }
- }
-
- // process namespace decls immediately;
- // then maybe forget this as an attribute
- if (namespaces)
- {
- int index;
-
- // default NS declaration?
- if (stringInterning)
- {
- if ("xmlns" == qname)
- {
- declarePrefix("", value);
- if (!xmlNames)
- {
- return;
- }
- }
- // NS prefix declaration?
- else if ((index = qname.indexOf(':')) == 5
- && qname.startsWith("xmlns"))
- {
- String prefix = qname.substring(6);
-
- if (prefix.equals(""))
- {
- fatal("missing prefix " +
- "in namespace declaration attribute");
- }
- if (value.length() == 0)
- {
- verror("missing URI in namespace declaration attribute: "
- + qname);
- }
- else
- {
- declarePrefix(prefix, value);
- }
- if (!xmlNames)
- {
- return;
- }
- }
- }
- else
- {
- if ("xmlns".equals(qname))
- {
- declarePrefix("", value);
- if (!xmlNames)
- {
- return;
- }
- }
- // NS prefix declaration?
- else if ((index = qname.indexOf(':')) == 5
- && qname.startsWith("xmlns"))
- {
- String prefix = qname.substring(6);
-
- if (value.length() == 0)
- {
- verror("missing URI in namespace decl attribute: "
- + qname);
- }
- else
- {
- declarePrefix(prefix, value);
- }
- if (!xmlNames)
- {
- return;
- }
- }
- }
- }
- // remember this attribute ...
- attributeCount++;
-
- // attribute type comes from querying parser's DTD records
- attributesList.add(new Attribute(qname, value, isSpecified));
-
- }
-
- void startElement(String elname)
- throws SAXException
- {
- ContentHandler handler = contentHandler;
-
- //
- // NOTE: this implementation of namespace support adds something
- // like six percent to parsing CPU time, in a large (~50 MB)
- // document that doesn't use namespaces at all. (Measured by PC
- // sampling, with a bug where endElement processing was omitted.)
- // [Measurement referred to older implementation, older JVM ...]
- //
- // It ought to become notably faster in such cases. Most
- // costs are the prefix stack calling Hashtable.get() (2%),
- // String.hashCode() (1.5%) and about 1.3% each for pushing
- // the context, and two chunks of name processing.
- //
-
- if (!attributes)
- {
- if (namespaces)
- {
- prefixStack.pushContext();
- }
- }
- else if (namespaces)
- {
-
- // now we can patch up namespace refs; we saw all the
- // declarations, so now we'll do the Right Thing
- Iterator itt = attributesList.iterator();
- while (itt.hasNext())
- {
- Attribute attribute = (Attribute) itt.next();
- String qname = attribute.name;
- int index;
-
- // default NS declaration?
- if (stringInterning)
- {
- if ("xmlns" == qname)
- {
- continue;
- }
- }
- else
- {
- if ("xmlns".equals(qname))
- {
- continue;
- }
- }
- //Illegal in the new Namespaces Draft
- //should it be only in 1.1 docs??
- if (qname.equals (":"))
- {
- fatal("namespace names consisting of a single colon " +
- "character are invalid");
- }
- index = qname.indexOf(':');
-
- // NS prefix declaration?
- if (index == 5 && qname.startsWith("xmlns"))
- {
- continue;
- }
-
- // it's not a NS decl; patch namespace info items
- if (prefixStack.processName(qname, nsTemp, true) == null)
- {
- fatal("undeclared attribute prefix in: " + qname);
- }
- else
- {
- attribute.nameSpace = nsTemp[0];
- attribute.localName = nsTemp[1];
- }
- }
- }
-
- // save element name so attribute callbacks work
- elementName = elname;
- if (namespaces)
- {
- if (prefixStack.processName(elname, nsTemp, false) == null)
- {
- fatal("undeclared element prefix in: " + elname);
- nsTemp[0] = nsTemp[1] = "";
- }
- handler.startElement(nsTemp[0], nsTemp[1], elname, this);
- }
- else
- {
- handler.startElement("", "", elname, this);
- }
- // elementName = null;
-
- // elements with no attributes are pretty common!
- if (attributes)
- {
- attributesList.clear();
- attributeCount = 0;
- attributes = false;
- }
- }
-
- void endElement(String elname)
- throws SAXException
- {
- ContentHandler handler = contentHandler;
-
- if (!namespaces)
- {
- handler.endElement("", "", elname);
- return;
- }
- prefixStack.processName(elname, nsTemp, false);
- handler.endElement(nsTemp[0], nsTemp[1], elname);
-
- Enumeration prefixes = prefixStack.getDeclaredPrefixes();
-
- while (prefixes.hasMoreElements())
- {
- handler.endPrefixMapping((String) prefixes.nextElement());
- }
- prefixStack.popContext();
- }
-
- void startCDATA()
- throws SAXException
- {
- lexicalHandler.startCDATA();
- }
-
- void charData(char[] ch, int start, int length)
- throws SAXException
- {
- contentHandler.characters(ch, start, length);
- }
-
- void endCDATA()
- throws SAXException
- {
- lexicalHandler.endCDATA();
- }
-
- void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException
- {
- contentHandler.ignorableWhitespace(ch, start, length);
- }
-
- void processingInstruction(String target, String data)
- throws SAXException
- {
- contentHandler.processingInstruction(target, data);
- }
-
- void comment(char[] ch, int start, int length)
- throws SAXException
- {
- if (lexicalHandler != base)
- {
- lexicalHandler.comment(ch, start, length);
- }
- }
-
- void fatal(String message)
- throws SAXException
- {
- SAXParseException fatal;
-
- fatal = new SAXParseException(message, this);
- errorHandler.fatalError(fatal);
-
- // Even if the application can continue ... we can't!
- throw fatal;
- }
-
- // We can safely report a few validity errors that
- // make layered SAX2 DTD validation more conformant
- void verror(String message)
- throws SAXException
- {
- SAXParseException err;
-
- err = new SAXParseException(message, this);
- errorHandler.error(err);
- }
-
- void warn(String message)
- throws SAXException
- {
- SAXParseException err;
-
- err = new SAXParseException(message, this);
- errorHandler.warning(err);
- }
-
- //
- // Implementation of org.xml.sax.Attributes.
- //
-
- /**
- * SAX1 AttributeList, SAX2 Attributes method
- * (don't invoke on parser);
- */
- public int getLength()
- {
- return attributesList.size();
- }
-
- /**
- * SAX2 Attributes method (don't invoke on parser);
- */
- public String getURI(int index)
- {
- if (index < 0 || index >= attributesList.size())
- {
- return null;
- }
- return ((Attribute) attributesList.get(index)).nameSpace;
- }
-
- /**
- * SAX2 Attributes method (don't invoke on parser);
- */
- public String getLocalName(int index)
- {
- if (index < 0 || index >= attributesList.size())
- {
- return null;
- }
- Attribute attr = (Attribute) attributesList.get(index);
- // FIXME attr.localName is sometimes null, why?
- if (namespaces && attr.localName == null)
- {
- // XXX fix this here for now
- int ci = attr.name.indexOf(':');
- attr.localName = (ci == -1) ? attr.name :
- attr.name.substring(ci + 1);
- }
- return (attr.localName == null) ? "" : attr.localName;
- }
-
- /**
- * SAX2 Attributes method (don't invoke on parser);
- */
- public String getQName(int index)
- {
- if (index < 0 || index >= attributesList.size())
- {
- return null;
- }
- Attribute attr = (Attribute) attributesList.get(index);
- return (attr.name == null) ? "" : attr.name;
- }
-
- /**
- * SAX1 AttributeList method (don't invoke on parser);
- */
- public String getName(int index)
- {
- return getQName(index);
- }
-
- /**
- * SAX1 AttributeList, SAX2 Attributes method
- * (don't invoke on parser);
- */
- public String getType(int index)
- {
- if (index < 0 || index >= attributesList.size())
- {
- return null;
- }
- String type = parser.getAttributeType(elementName, getQName(index));
- if (type == null)
- {
- return "CDATA";
- }
- // ... use DeclHandler.attributeDecl to see enumerations
- if (type == "ENUMERATION")
- {
- return "NMTOKEN";
- }
- return type;
- }
-
- /**
- * SAX1 AttributeList, SAX2 Attributes method
- * (don't invoke on parser);
- */
- public String getValue(int index)
- {
- if (index < 0 || index >= attributesList.size())
- {
- return null;
- }
- return ((Attribute) attributesList.get(index)).value;
- }
-
- /**
- * SAX2 Attributes method (don't invoke on parser);
- */
- public int getIndex(String uri, String local)
- {
- int length = getLength();
-
- for (int i = 0; i < length; i++)
- {
- if (!getURI(i).equals(uri))
- {
- continue;
- }
- if (getLocalName(i).equals(local))
- {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * SAX2 Attributes method (don't invoke on parser);
- */
- public int getIndex(String xmlName)
- {
- int length = getLength();
-
- for (int i = 0; i < length; i++)
- {
- if (getQName(i).equals(xmlName))
- {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * SAX2 Attributes method (don't invoke on parser);
- */
- public String getType(String uri, String local)
- {
- int index = getIndex(uri, local);
-
- if (index < 0)
- {
- return null;
- }
- return getType(index);
- }
-
- /**
- * SAX1 AttributeList, SAX2 Attributes method
- * (don't invoke on parser);
- */
- public String getType(String xmlName)
- {
- int index = getIndex(xmlName);
-
- if (index < 0)
- {
- return null;
- }
- return getType(index);
- }
-
- /**
- * SAX Attributes method (don't invoke on parser);
- */
- public String getValue(String uri, String local)
- {
- int index = getIndex(uri, local);
-
- if (index < 0)
- {
- return null;
- }
- return getValue(index);
- }
-
- /**
- * SAX1 AttributeList, SAX2 Attributes method
- * (don't invoke on parser);
- */
- public String getValue(String xmlName)
- {
- int index = getIndex(xmlName);
-
- if (index < 0)
- {
- return null;
- }
- return getValue(index);
- }
-
- //
- // Implementation of org.xml.sax.ext.Attributes2
- //
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.ArrayIndexOutOfBoundsException
- * When the supplied index does not identify an attribute.
- */
- public boolean isDeclared(int index)
- {
- if (index < 0 || index >= attributeCount)
- {
- throw new ArrayIndexOutOfBoundsException();
- }
- String type = parser.getAttributeType(elementName, getQName(index));
- return (type != null);
- }
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared(String qName)
- {
- int index = getIndex(qName);
- if (index < 0)
- {
- throw new IllegalArgumentException();
- }
- String type = parser.getAttributeType(elementName, qName);
- return (type != null);
- }
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared(String uri, String localName)
- {
- int index = getIndex(uri, localName);
- return isDeclared(index);
- }
-
- /**
- * SAX-ext Attributes2 method (don't invoke on parser);
- */
- public boolean isSpecified(int index)
- {
- return ((Attribute) attributesList.get(index)).specified;
- }
-
- /**
- * SAX-ext Attributes2 method (don't invoke on parser);
- */
- public boolean isSpecified(String uri, String local)
- {
- int index = getIndex (uri, local);
- return isSpecified(index);
- }
-
- /**
- * SAX-ext Attributes2 method (don't invoke on parser);
- */
- public boolean isSpecified(String xmlName)
- {
- int index = getIndex (xmlName);
- return isSpecified(index);
- }
-
- //
- // Implementation of org.xml.sax.Locator.
- //
-
- /**
- * SAX Locator method (don't invoke on parser);
- */
- public String getPublicId()
- {
- return null; // FIXME track public IDs too
- }
-
- /**
- * SAX Locator method (don't invoke on parser);
- */
- public String getSystemId()
- {
- if (entityStack.empty())
- {
- return null;
- }
- else
- {
- return (String) entityStack.peek();
- }
- }
-
- /**
- * SAX Locator method (don't invoke on parser);
- */
- public int getLineNumber()
- {
- return parser.getLineNumber();
- }
-
- /**
- * SAX Locator method (don't invoke on parser);
- */
- public int getColumnNumber()
- {
- return parser.getColumnNumber();
- }
-
- // adapter between SAX2 content handler and SAX1 document handler callbacks
- private static class Adapter
- implements ContentHandler
- {
-
- private DocumentHandler docHandler;
-
- Adapter(DocumentHandler dh)
- {
- docHandler = dh;
- }
-
- public void setDocumentLocator(Locator l)
- {
- docHandler.setDocumentLocator(l);
- }
-
- public void startDocument()
- throws SAXException
- {
- docHandler.startDocument();
- }
-
- public void processingInstruction(String target, String data)
- throws SAXException
- {
- docHandler.processingInstruction(target, data);
- }
-
- public void startPrefixMapping(String prefix, String uri)
- {
- /* ignored */
- }
-
- public void startElement(String namespace,
- String local,
- String name,
- Attributes attrs)
- throws SAXException
- {
- docHandler.startElement(name, (AttributeList) attrs);
- }
-
- public void characters(char[] buf, int offset, int len)
- throws SAXException
- {
- docHandler.characters(buf, offset, len);
- }
-
- public void ignorableWhitespace(char[] buf, int offset, int len)
- throws SAXException
- {
- docHandler.ignorableWhitespace(buf, offset, len);
- }
-
- public void skippedEntity(String name)
- {
- /* ignored */
- }
-
- public void endElement(String u, String l, String name)
- throws SAXException
- {
- docHandler.endElement(name);
- }
-
- public void endPrefixMapping(String prefix)
- {
- /* ignored */
- }
-
- public void endDocument()
- throws SAXException
- {
- docHandler.endDocument();
- }
- }
-
- private static class Attribute
- {
-
- String name;
- String value;
- String nameSpace;
- String localName;
- boolean specified;
-
- Attribute(String name, String value, boolean specified)
- {
- this.name = name;
- this.value = value;
- this.nameSpace = "";
- this.specified = specified;
- }
-
- }
-
-}
diff --git a/libjava/gnu/xml/aelfred2/XmlParser.java b/libjava/gnu/xml/aelfred2/XmlParser.java
deleted file mode 100644
index 15d730ff4a7..00000000000
--- a/libjava/gnu/xml/aelfred2/XmlParser.java
+++ /dev/null
@@ -1,5835 +0,0 @@
-/* XmlParser.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version.
-
-Partly derived from code which carried the following notice:
-
- Copyright (c) 1997, 1998 by Microstar Software Ltd.
-
- AElfred is free for both commercial and non-commercial use and
- redistribution, provided that Microstar's copyright and disclaimer are
- retained intact. You are free to modify AElfred for your own use and
- to redistribute AElfred with your modifications, provided that the
- modifications are clearly documented.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- merchantability or fitness for a particular purpose. Please use it AT
- YOUR OWN RISK.
-*/
-
-package gnu.xml.aelfred2;
-
-import gnu.java.security.action.GetPropertyAction;
-
-import java.io.BufferedInputStream;
-import java.io.CharConversionException;
-import java.io.EOFException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.LinkedList;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- * Parse XML documents and return parse events through call-backs.
- * Use the Only one thread at a time may use this parser; since it is
- * private to this package, post-parse cleanup is done by the caller,
- * which MUST NOT REUSE the parser (just null it).
- *
- * @param systemId Absolute URI of the document; should never be null,
- * but may be so iff a reader or a stream is provided.
- * @param publicId The public identifier of the document, or null.
- * @param reader A character stream; must be null if stream isn't.
- * @param stream A byte input stream; must be null if reader isn't.
- * @param encoding The suggested encoding, or null if unknown.
- * @exception java.lang.Exception Basically SAXException or IOException
- */
- // package private
- 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", "&");
- setInternalEntity("lt", "<");
- setInternalEntity("gt", ">");
- setInternalEntity("apos", "'");
- setInternalEntity("quot", """);
-
- 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 ExternalIdentifiers(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 */
- }
- }
- scratch = null;
- }
- }
-
- //////////////////////////////////////////////////////////////////////
- // Error reporting.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Report an error.
- * @param message The error message.
- * @param textFound The text that caused the error (or null).
- * @see SAXDriver#error
- * @see #line
- */
- private void error(String message, String textFound, String textExpected)
- throws SAXException
- {
- if (textFound != null)
- {
- message = message + " (found \"" + textFound + "\")";
- }
- if (textExpected != null)
- {
- message = message + " (expected \"" + textExpected + "\")";
- }
- handler.fatal(message);
-
- // "can't happen"
- throw new SAXException(message);
- }
-
- /**
- * Report a serious error.
- * @param message The error message.
- * @param textFound The text that caused the error (or null).
- */
- private void error(String message, char textFound, String textExpected)
- throws SAXException
- {
- error(message, new Character(textFound).toString(), textExpected);
- }
-
- /**
- * Report typical case fatal errors.
- */
- private void error(String message)
- throws SAXException
- {
- handler.fatal(message);
- }
-
- //////////////////////////////////////////////////////////////////////
- // Major syntactic productions.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Parse an XML document.
- * This is the top-level parsing function for a single XML
- * document. As a minimum, a well-formed document must have
- * a document element, and a valid document must have a prolog
- * (one with doctype) as well.
- */
- private void parseDocument()
- throws Exception
- {
- try
- { // added by MHK
- boolean sawDTD = parseProlog();
- require('<');
- parseElement(!sawDTD);
- }
- catch (EOFException ee)
- { // added by MHK
- error("premature end of file", "[EOF]", null);
- }
-
- try
- {
- parseMisc(); //skip all white, PIs, and comments
- char c = readCh(); //if this doesn't throw an exception...
- error("unexpected characters after document end", c, null);
- }
- catch (EOFException e)
- {
- return;
- }
- }
-
- static final char[] startDelimComment = { '<', '!', '-', '-' };
- static final char[] endDelimComment = { '-', '-' };
-
- /**
- * Skip a comment.
- * (The (The (The '<![CDATA[' has already been read.)
- */
- private void parseCDSect()
- throws Exception
- {
- parseUntil(endDelimCDATA);
- dataBufferFlush();
- }
-
- /**
- * Parse the prolog of an XML document.
- * We do not look for the XML declaration here, because it was
- * handled by pushURL ().
- * @see pushURL
- * @return true if a DTD was read.
- */
- private boolean parseProlog()
- throws Exception
- {
- parseMisc();
-
- if (tryRead("
- * [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
- * [24] VersionInfo ::= S 'version' Eq
- * ("'" VersionNum "'" | '"' VersionNum '"' )
- * [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')*
- * [32] SDDecl ::= S 'standalone' Eq
- * ( "'"" ('yes' | 'no') "'"" | '"' ("yes" | "no") '"' )
- * [80] EncodingDecl ::= S 'encoding' Eq
- * ( "'" EncName "'" | "'" EncName "'" )
- * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
- *
- * (The (The It is also used after autodetection, at which point only very
- * limited adjustments to the encoding may be used (switching between
- * related builtin decoders).
- *
- * @param encodingName The name of the encoding specified by the user.
- * @exception IOException if the encoding isn't supported either
- * internally to this parser, or by the hosting JVM.
- * @see #parseXMLDecl
- * @see #parseTextDecl
- */
- private void setupDecoding(String encodingName)
- throws SAXException, IOException
- {
- encodingName = encodingName.toUpperCase();
-
- // ENCODING_EXTERNAL indicates an encoding that wasn't
- // autodetected ... we can use builtin decoders, or
- // ones from the JVM (InputStreamReader).
-
- // Otherwise we can only tweak what was autodetected, and
- // only for single byte (ASCII derived) builtin encodings.
-
- // ASCII-derived encodings
- if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL)
- {
- if (encodingName.equals("ISO-8859-1")
- || encodingName.equals("8859_1")
- || encodingName.equals("ISO8859_1"))
- {
- encoding = ENCODING_ISO_8859_1;
- return;
- }
- else if (encodingName.equals("US-ASCII")
- || encodingName.equals("ASCII"))
- {
- encoding = ENCODING_ASCII;
- return;
- }
- else if (encodingName.equals("UTF-8")
- || encodingName.equals("UTF8"))
- {
- encoding = ENCODING_UTF_8;
- return;
- }
- else if (encoding != ENCODING_EXTERNAL)
- {
- // used to start with a new reader ...
- throw new UnsupportedEncodingException(encodingName);
- }
- // else fallthrough ...
- // it's ASCII-ish and something other than a builtin
- }
-
- // Unicode and such
- if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21)
- {
- if (!(encodingName.equals("ISO-10646-UCS-2")
- || encodingName.equals("UTF-16")
- || encodingName.equals("UTF-16BE")
- || encodingName.equals("UTF-16LE")))
- {
- error("unsupported Unicode encoding", encodingName, "UTF-16");
- }
- return;
- }
-
- // four byte encodings
- if (encoding == ENCODING_UCS_4_1234
- || encoding == ENCODING_UCS_4_4321
- || encoding == ENCODING_UCS_4_2143
- || encoding == ENCODING_UCS_4_3412)
- {
- // Strictly: "UCS-4" == "UTF-32BE"; also, "UTF-32LE" exists
- if (!encodingName.equals("ISO-10646-UCS-4"))
- {
- error("unsupported 32-bit encoding", encodingName,
- "ISO-10646-UCS-4");
- }
- return;
- }
-
- // assert encoding == ENCODING_EXTERNAL
- // if (encoding != ENCODING_EXTERNAL)
- // throw new RuntimeException ("encoding = " + encoding);
-
- if (encodingName.equals("UTF-16BE"))
- {
- encoding = ENCODING_UCS_2_12;
- return;
- }
- if (encodingName.equals("UTF-16LE"))
- {
- encoding = ENCODING_UCS_2_21;
- return;
- }
-
- // We couldn't use the builtin decoders at all. But we can try to
- // create a reader, since we haven't messed up buffering. Tweak
- // the encoding name if necessary.
-
- if (encodingName.equals("UTF-16")
- || encodingName.equals("ISO-10646-UCS-2"))
- {
- encodingName = "Unicode";
- }
- // Ignoring all the EBCDIC aliases here
-
- reader = new InputStreamReader(is, encodingName);
- sourceType = INPUT_READER;
- }
-
- /**
- * Parse miscellaneous markup outside the document element and DOCTYPE
- * declaration.
- * (The Reading toplevel PE references is handled as a lexical issue
- * by the caller, as is whitespace.
- */
- private void parseMarkupdecl()
- throws Exception
- {
- char[] saved = null;
- boolean savedPE = expandPE;
-
- // prevent "<%foo;" and ensures saved entity is right
- require('<');
- unread('<');
- expandPE = false;
-
- if (tryRead(" 0)
- {
- parseConditionalSect(saved);
- }
- else
- {
- error("conditional sections illegal in internal subset");
- }
- }
- else
- {
- error("expected markup declaration");
- }
-
- // VC: Proper Decl/PE Nesting
- if (readBuffer != saved)
- {
- handler.verror("Illegal Declaration/PE nesting");
- }
- }
-
- /**
- * Parse an element, with its tags.
- * (The '<' has already been read.)
- * NOTE: this method actually chains onto parseContent (), if necessary,
- * and parseContent () will take care of calling parseETag ().
- */
- private void parseElement(boolean maybeGetSubset)
- throws Exception
- {
- String gi;
- char c;
- int oldElementContent = currentElementContent;
- String oldElement = currentElement;
- ElementDecl element;
-
- // This is the (global) counter for the
- // array of specified attributes.
- tagAttributePos = 0;
-
- // Read the element type name.
- gi = readNmtoken(true);
-
- // If we saw no DTD, and this is the document root element,
- // let the application modify the input stream by providing one.
- if (maybeGetSubset)
- {
- InputSource subset = handler.getExternalSubset(gi,
- handler.getSystemId());
- if (subset != null)
- {
- String publicId = subset.getPublicId();
- String systemId = subset.getSystemId();
-
- handler.warn("modifying document by adding DTD");
- handler.doctypeDecl(gi, publicId, systemId);
- pushString(null, ">");
-
- // NOTE: [dtd] is so we say what SAX2 expects,
- // though it's misleading (subset, not entire dtd)
- pushURL(true, "[dtd]",
- new ExternalIdentifiers(publicId, systemId, null),
- subset.getCharacterStream(),
- subset.getByteStream(),
- subset.getEncoding(),
- false);
-
- // Loop until we end up back at '>'
- while (true)
- {
- doReport = expandPE = true;
- skipWhitespace();
- doReport = expandPE = false;
- if (tryRead('>'))
- {
- break;
- }
- else
- {
- expandPE = true;
- parseMarkupdecl();
- expandPE = false;
- }
- }
-
- // the ">" string isn't popped yet
- if (inputStack.size() != 1)
- {
- error("external subset has unmatched '>'");
- }
-
- handler.endDoctype();
- }
- }
-
- // Determine the current content type.
- currentElement = gi;
- element = (ElementDecl) elementInfo.get(gi);
- currentElementContent = getContentType(element, CONTENT_ANY);
-
- // Read the attributes, if any.
- // After this loop, "c" is the closing delimiter.
- boolean white = tryWhitespace();
- c = readCh();
- while (c != '/' && c != '>')
- {
- unread(c);
- if (!white)
- {
- error("need whitespace between attributes");
- }
- parseAttribute(gi);
- white = tryWhitespace();
- c = readCh();
- }
-
- // Supply any defaulted attributes.
- Iterator atts = declaredAttributes(element);
- if (atts != null)
- {
- String aname;
-loop:
- while (atts.hasNext())
- {
- aname = (String) atts.next();
- // See if it was specified.
- for (int i = 0; i < tagAttributePos; i++)
- {
- if (tagAttributes[i] == aname)
- {
- continue loop;
- }
- }
- // ... or has a default
- String value = getAttributeDefaultValue(gi, aname);
-
- if (value == null)
- {
- continue;
- }
- handler.attribute(aname, value, false);
- }
- }
-
- // Figure out if this is a start tag
- // or an empty element, and dispatch an
- // event accordingly.
- switch (c)
- {
- case '>':
- handler.startElement(gi);
- parseContent();
- break;
- case '/':
- require('>');
- handler.startElement(gi);
- handler.endElement(gi);
- break;
- }
-
- // Restore the previous state.
- currentElement = oldElement;
- currentElementContent = oldElementContent;
- }
-
- /**
- * Parse an attribute assignment.
- * NOTE: parseContent () chains to here, we already read the
- * "</".
- */
- private void parseETag()
- throws Exception
- {
- require(currentElement);
- skipWhitespace();
- require('>');
- handler.endElement(currentElement);
- // not re-reporting any SAXException re bogus end tags,
- // even though that diagnostic might be clearer ...
- }
-
- /**
- * Parse the content of an element.
- * NOTE: consumes ETtag.
- */
- private void parseContent()
- throws Exception
- {
- char c;
-
- while (true)
- {
- // consume characters (or ignorable whitspace) until delimiter
- parseCharData();
-
- // Handle delimiters
- c = readCh();
- switch (c)
- {
- case '&': // Found "&"
- c = readCh();
- if (c == '#')
- {
- parseCharRef();
- }
- else
- {
- unread(c);
- parseEntityRef(true);
- }
- isDirtyCurrentElement = true;
- break;
-
- case '<': // Found "<"
- dataBufferFlush();
- c = readCh();
- switch (c)
- {
- case '!': // Found "
- * [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'
- *
- * NOTE: the '<!ELEMENT' has already been read.
- */
- private void parseElementDecl()
- throws Exception
- {
- String name;
-
- requireWhitespace();
- // Read the element type name.
- name = readNmtoken(true);
-
- requireWhitespace();
- // Read the content model.
- parseContentspec(name);
-
- skipWhitespace();
- require('>');
- }
-
- /**
- * Content specification.
- * NOTE: the opening '(' and S have already been read.
- *
- * @param saved Buffer for entity that should have the terminal ')'
- */
- private void parseElements(char[] saved)
- throws Exception
- {
- char c;
- char sep;
-
- // Parse the first content particle
- skipWhitespace();
- parseCp();
-
- // Check for end or for a separator.
- skipWhitespace();
- c = readCh();
- switch (c)
- {
- case ')':
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- {
- handler.verror("Illegal Group/PE nesting");
- }
-
- dataBufferAppend(')');
- c = readCh();
- switch (c)
- {
- case '*':
- case '+':
- case '?':
- dataBufferAppend(c);
- break;
- default:
- unread(c);
- }
- return;
- case ',': // Register the separator.
- case '|':
- sep = c;
- dataBufferAppend(c);
- break;
- default:
- error("bad separator in content model", c, null);
- return;
- }
-
- // Parse the rest of the content model.
- while (true)
- {
- skipWhitespace();
- parseCp();
- skipWhitespace();
- c = readCh();
- if (c == ')')
- {
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- {
- handler.verror("Illegal Group/PE nesting");
- }
-
- dataBufferAppend(')');
- break;
- }
- else if (c != sep)
- {
- error("bad separator in content model", c, null);
- return;
- }
- else
- {
- dataBufferAppend(c);
- }
- }
-
- // Check for the occurrence indicator.
- c = readCh();
- switch (c)
- {
- case '?':
- case '*':
- case '+':
- dataBufferAppend(c);
- return;
- default:
- unread(c);
- return;
- }
- }
-
- /**
- * Parse a content particle.
- * NOTE: the '<!ATTLIST' has already been read.
- */
- private void parseAttlistDecl()
- throws Exception
- {
- String elementName;
-
- requireWhitespace();
- elementName = readNmtoken(true);
- boolean white = tryWhitespace();
- while (!tryRead('>'))
- {
- if (!white)
- {
- error("whitespace required before attribute definition");
- }
- parseAttDef(elementName);
- white = tryWhitespace();
- }
- }
-
- /**
- * Parse a single attribute definition.
- * NOTE: the '(' has already been read.
- */
- private void parseEnumeration(boolean isNames)
- throws Exception
- {
- dataBufferAppend('(');
-
- // Read the first token.
- skipWhitespace();
- dataBufferAppend(readNmtoken(isNames));
- // Read the remaining tokens.
- skipWhitespace();
- while (!tryRead(')'))
- {
- require('|');
- dataBufferAppend('|');
- skipWhitespace();
- dataBufferAppend(readNmtoken (isNames));
- skipWhitespace();
- }
- dataBufferAppend(')');
- }
-
- /**
- * Parse a notation type for an attribute.
- * NOTE: the 'NOTATION' has already been read
- */
- private void parseNotationType()
- throws Exception
- {
- requireWhitespace();
- require('(');
-
- parseEnumeration(true);
- }
-
- /**
- * Parse the default value for an attribute.
- * NOTE: the '>![' has already been read.
- */
- private void parseConditionalSect(char[] saved)
- throws Exception
- {
- skipWhitespace();
- if (tryRead("INCLUDE"))
- {
- skipWhitespace();
- require('[');
- // VC: Proper Conditional Section/PE Nesting
- if (readBuffer != saved)
- {
- handler.verror("Illegal Conditional Section/PE nesting");
- }
- skipWhitespace();
- while (!tryRead("]]>"))
- {
- parseMarkupdecl();
- skipWhitespace();
- }
- }
- else if (tryRead("IGNORE"))
- {
- skipWhitespace();
- require('[');
- // VC: Proper Conditional Section/PE Nesting
- if (readBuffer != saved)
- {
- handler.verror("Illegal Conditional Section/PE nesting");
- }
- int nesting = 1;
- char c;
- expandPE = false;
- for (int nest = 1; nest > 0; )
- {
- c = readCh();
- switch (c)
- {
- case '<':
- if (tryRead("!["))
- {
- nest++;
- }
- case ']':
- if (tryRead("]>"))
- {
- nest--;
- }
- }
- }
- expandPE = true;
- }
- else
- {
- error("conditional section must begin with INCLUDE or IGNORE");
- }
- }
-
- private void parseCharRef()
- throws SAXException, IOException
- {
- parseCharRef(true /* do flushDataBuffer by default */);
- }
-
- /**
- * Try to read a character reference without consuming data from buffer.
- * NOTE: the '' has already been read.
- */
- private void tryReadCharRef()
- throws SAXException, IOException
- {
- int value = 0;
- char c;
-
- if (tryRead('x'))
- {
-loop1:
- while (true)
- {
- c = readCh();
- if (c == ';')
- {
- break loop1;
- }
- else
- {
- int n = Character.digit(c, 16);
- if (n == -1)
- {
- error("illegal character in character reference", c, null);
- break loop1;
- }
- value *= 16;
- value += n;
- }
- }
- }
- else
- {
-loop2:
- while (true)
- {
- c = readCh();
- if (c == ';')
- {
- break loop2;
- }
- else
- {
- int n = Character.digit(c, 10);
- if (n == -1)
- {
- error("illegal character in character reference", c, null);
- break loop2;
- }
- value *= 10;
- value += n;
- }
- }
- }
-
- // check for character refs being legal XML
- if ((value < 0x0020
- && ! (value == '\n' || value == '\t' || value == '\r'))
- || (value >= 0xD800 && value <= 0xDFFF)
- || value == 0xFFFE || value == 0xFFFF
- || value > 0x0010ffff)
- {
- error("illegal XML character reference U+"
- + Integer.toHexString(value));
- }
-
- // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz
- // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz:
- if (value > 0x0010ffff)
- {
- // too big for surrogate
- error("character reference " + value + " is too large for UTF-16",
- new Integer(value).toString(), null);
- }
-
- }
-
- /**
- * Read and interpret a character reference.
- * NOTE: the '' has already been read.
- */
- private void parseCharRef(boolean doFlush)
- throws SAXException, IOException
- {
- int value = 0;
- char c;
-
- if (tryRead('x'))
- {
-loop1:
- while (true)
- {
- c = readCh();
- if (c == ';')
- {
- break loop1;
- }
- else
- {
- int n = Character.digit(c, 16);
- if (n == -1)
- {
- error("illegal character in character reference", c, null);
- break loop1;
- }
- value *= 16;
- value += n;
- }
- }
- }
- else
- {
-loop2:
- while (true)
- {
- c = readCh();
- if (c == ';')
- {
- break loop2;
- }
- else
- {
- int n = Character.digit(c, 10);
- if (n == -1)
- {
- error("illegal character in character reference", c, null);
- break loop2;
- }
- value *= 10;
- value += c - '0';
- }
- }
- }
-
- // check for character refs being legal XML
- if ((value < 0x0020
- && ! (value == '\n' || value == '\t' || value == '\r'))
- || (value >= 0xD800 && value <= 0xDFFF)
- || value == 0xFFFE || value == 0xFFFF
- || value > 0x0010ffff)
- {
- error("illegal XML character reference U+"
- + Integer.toHexString(value));
- }
-
- // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz
- // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz:
- if (value <= 0x0000ffff)
- {
- // no surrogates needed
- dataBufferAppend((char) value);
- }
- else if (value <= 0x0010ffff)
- {
- value -= 0x10000;
- // > 16 bits, surrogate needed
- dataBufferAppend((char) (0xd800 | (value >> 10)));
- dataBufferAppend((char) (0xdc00 | (value & 0x0003ff)));
- }
- else
- {
- // too big for surrogate
- error("character reference " + value + " is too large for UTF-16",
- new Integer(value).toString(), null);
- }
- if (doFlush)
- {
- dataBufferFlush();
- }
- }
-
- /**
- * Parse and expand an entity reference.
- * NOTE: the '&' has already been read.
- * @param externalAllowed External entities are allowed here.
- */
- private void parseEntityRef(boolean externalAllowed)
- throws SAXException, IOException
- {
- String name;
-
- name = readNmtoken(true);
- require(';');
- switch (getEntityType(name))
- {
- case ENTITY_UNDECLARED:
- // NOTE: XML REC describes amazingly convoluted handling for
- // this case. Nothing as meaningful as being a WFness error
- // unless the processor might _legitimately_ not have seen a
- // declaration ... which is what this implements.
- String message;
-
- message = "reference to undeclared general entity " + name;
- if (skippedPE && !docIsStandalone)
- {
- handler.verror(message);
- // we don't know this entity, and it might be external...
- if (externalAllowed)
- {
- handler.skippedEntity(name);
- }
- }
- else
- {
- error(message);
- }
- break;
- case ENTITY_INTERNAL:
- pushString(name, getEntityValue(name));
-
- //workaround for possible input pop before marking
- //the buffer reading position
- char t = readCh();
- unread(t);
- int bufferPosMark = readBufferPos;
-
- int end = readBufferPos + getEntityValue(name).length();
- for (int k = readBufferPos; k < end; k++)
- {
- t = readCh();
- if (t == '&')
- {
- t = readCh();
- if (t == '#')
- {
- //try to match a character ref
- tryReadCharRef();
-
- //everything has been read
- if (readBufferPos >= end)
- {
- break;
- }
- k = readBufferPos;
- continue;
- }
- else if (Character.isLetter(t))
- {
- //looks like an entity ref
- unread(t);
- readNmtoken(true);
- require(';');
-
- //everything has been read
- if (readBufferPos >= end)
- {
- break;
- }
- k = readBufferPos;
- continue;
- }
- error(" malformed entity reference");
- }
-
- }
- readBufferPos = bufferPosMark;
- break;
- case ENTITY_TEXT:
- if (externalAllowed)
- {
- pushURL(false, name, getEntityIds(name),
- null, null, null, true);
- }
- else
- {
- error("reference to external entity in attribute value.",
- name, null);
- }
- break;
- case ENTITY_NDATA:
- if (externalAllowed)
- {
- error("unparsed entity reference in content", name, null);
- }
- else
- {
- error("reference to external entity in attribute value.",
- name, null);
- }
- break;
- default:
- throw new RuntimeException();
- }
- }
-
- /**
- * Parse and expand a parameter entity reference.
- * NOTE: the '%' has already been read.
- */
- private void parsePEReference()
- throws SAXException, IOException
- {
- String name;
-
- name = "%" + readNmtoken(true);
- require(';');
- switch (getEntityType(name))
- {
- case ENTITY_UNDECLARED:
- // VC: Entity Declared
- handler.verror("reference to undeclared parameter entity " + name);
-
- // we should disable handling of all subsequent declarations
- // unless this is a standalone document (info discarded)
- break;
- case ENTITY_INTERNAL:
- if (inLiteral)
- {
- pushString(name, getEntityValue(name));
- }
- else
- {
- pushString(name, ' ' + getEntityValue(name) + ' ');
- }
- break;
- case ENTITY_TEXT:
- if (!inLiteral)
- {
- pushString(null, " ");
- }
- pushURL(true, name, getEntityIds(name), null, null, null, true);
- if (!inLiteral)
- {
- pushString(null, " ");
- }
- break;
- }
- }
-
- /**
- * Parse an entity declaration.
- * NOTE: the '<!ENTITY' has already been read.
- */
- private void parseEntityDecl()
- throws Exception
- {
- boolean peFlag = false;
- int flags = 0;
-
- // Check for a parameter entity.
- expandPE = false;
- requireWhitespace();
- if (tryRead('%'))
- {
- peFlag = true;
- requireWhitespace();
- }
- expandPE = true;
-
- // Read the entity name, and prepend
- // '%' if necessary.
- String name = readNmtoken(true);
- //NE08
- if (name.indexOf(':') >= 0)
- {
- error("Illegal character(':') in entity name ", name, null);
- }
- if (peFlag)
- {
- name = "%" + name;
- }
-
- // Read the entity value.
- requireWhitespace();
- char c = readCh();
- unread (c);
- if (c == '"' || c == '\'')
- {
- // Internal entity ... replacement text has expanded refs
- // to characters and PEs, but not to general entities
- String value = readLiteral(flags);
- setInternalEntity(name, value);
- }
- else
- {
- // Read the external IDs
- ExternalIdentifiers ids = readExternalIds(false, false);
-
- // Check for NDATA declaration.
- boolean white = tryWhitespace();
- if (!peFlag && tryRead("NDATA"))
- {
- if (!white)
- {
- error("whitespace required before NDATA");
- }
- requireWhitespace();
- String notationName = readNmtoken(true);
- if (!skippedPE)
- {
- setExternalEntity(name, ENTITY_NDATA, ids, notationName);
- handler.unparsedEntityDecl(name, ids.publicId, ids.systemId,
- ids.baseUri, notationName);
- }
- }
- else if (!skippedPE)
- {
- setExternalEntity(name, ENTITY_TEXT, ids, null);
- handler.getDeclHandler()
- .externalEntityDecl(name, ids.publicId,
- handler.resolveURIs()
- // FIXME: ASSUMES not skipped
- // "false" forces error on bad URI
- ? handler.absolutize(ids.baseUri,
- ids.systemId,
- false)
- : ids.systemId);
- }
- }
-
- // Finish the declaration.
- skipWhitespace();
- require('>');
- }
-
- /**
- * Parse a notation declaration.
- * NOTE: the '<!NOTATION' has already been read.
- */
- private void parseNotationDecl()
- throws Exception
- {
- String nname;
- ExternalIdentifiers ids;
-
- requireWhitespace();
- nname = readNmtoken(true);
- //NE08
- if (nname.indexOf(':') >= 0)
- {
- error("Illegal character(':') in notation name ", nname, null);
- }
- requireWhitespace();
-
- // Read the external identifiers.
- ids = readExternalIds(true, false);
-
- // Register the notation.
- setNotation(nname, ids);
-
- skipWhitespace();
- require('>');
- }
-
- /**
- * Parse character data.
- * Precondition: Entity expansion is not required.
- * Precondition: data buffer has no characters that
- * will get sent to the application.
- */
- private void require(String delim)
- throws SAXException, IOException
- {
- int length = delim.length();
- char[] ch;
-
- if (length < dataBuffer.length)
- {
- ch = dataBuffer;
- delim.getChars(0, length, ch, 0);
- }
- else
- {
- ch = delim.toCharArray();
- }
-
- if (USE_CHEATS && length <= (readBufferLength - readBufferPos))
- {
- int offset = readBufferPos;
-
- for (int i = 0; i < length; i++, offset++)
- {
- if (ch[i] != readBuffer[offset])
- {
- error ("required string", null, delim);
- }
- }
- readBufferPos = offset;
-
- }
- else
- {
- for (int i = 0; i < length; i++)
- {
- require(ch[i]);
- }
- }
- }
-
- /**
- * Require a character to appear, or throw an exception.
- */
- private void require(char delim)
- throws SAXException, IOException
- {
- char c = readCh();
-
- if (c != delim)
- {
- error("required character", c, new Character(delim).toString());
- }
- }
-
- /**
- * Create an interned string from a character array.
- * Ælfred uses this method to create an interned version
- * of all names and name tokens, so that it can test equality
- * with This is much more efficient than constructing a non-interned
- * string first, and then interning it.
- *
- * @param ch an array of characters for building the string.
- * @param start the starting position in the array.
- * @param length the number of characters to place in the string.
- * @return an interned string.
- * @see #intern (String)
- * @see java.lang.String#intern
- */
- public String intern(char[] ch, int start, int length)
- {
- int index = 0;
- int hash = 0;
- Object[] bucket;
-
- // Generate a hash code. This is a widely used string hash,
- // often attributed to Brian Kernighan.
- for (int i = start; i < start + length; i++)
- {
- hash = 31 * hash + ch[i];
- }
- hash = (hash & 0x7fffffff) % SYMBOL_TABLE_LENGTH;
-
- // Get the bucket -- consists of {array,String} pairs
- if ((bucket = symbolTable[hash]) == null)
- {
- // first string in this bucket
- bucket = new Object[8];
-
- // Search for a matching tuple, and
- // return the string if we find one.
- }
- else
- {
- while (index < bucket.length)
- {
- char[] chFound = (char[]) bucket[index];
-
- // Stop when we hit an empty entry.
- if (chFound == null)
- {
- break;
- }
-
- // If they're the same length, check for a match.
- if (chFound.length == length)
- {
- for (int i = 0; i < chFound.length; i++)
- {
- // continue search on failure
- if (ch[start + i] != chFound[i])
- {
- break;
- }
- else if (i == length - 1)
- {
- // That's it, we have a match!
- return (String) bucket[index + 1];
- }
- }
- }
- index += 2;
- }
- // Not found -- we'll have to add it.
-
- // Do we have to grow the bucket?
- bucket = (Object[]) extendArray(bucket, bucket.length, index);
- }
- symbolTable[hash] = bucket;
-
- // OK, add it to the end of the bucket -- "local" interning.
- // Intern "globally" to let applications share interning benefits.
- // That is, "!=" and "==" work on our strings, not just equals().
- String s = new String(ch, start, length).intern();
- bucket[index] = s.toCharArray();
- bucket[index + 1] = s;
- return s;
- }
-
- /**
- * Ensure the capacity of an array, allocating a new one if
- * necessary. Usually extends only for name hash collisions.
- */
- private Object extendArray(Object array, int currentSize, int requiredSize)
- {
- if (requiredSize < currentSize)
- {
- return array;
- }
- else
- {
- Object newArray = null;
- int newSize = currentSize * 2;
-
- if (newSize <= requiredSize)
- {
- newSize = requiredSize + 1;
- }
-
- if (array instanceof char[])
- {
- newArray = new char[newSize];
- }
- else if (array instanceof Object[])
- {
- newArray = new Object[newSize];
- }
- else
- {
- throw new RuntimeException();
- }
-
- System.arraycopy(array, 0, newArray, 0, currentSize);
- return newArray;
- }
- }
-
- //////////////////////////////////////////////////////////////////////
- // XML query routines.
- //////////////////////////////////////////////////////////////////////
-
- boolean isStandalone()
- {
- return docIsStandalone;
- }
-
- //
- // Elements
- //
-
- private int getContentType(ElementDecl element, int defaultType)
- {
- int retval;
-
- if (element == null)
- {
- return defaultType;
- }
- retval = element.contentType;
- if (retval == CONTENT_UNDECLARED)
- {
- retval = defaultType;
- }
- return retval;
- }
-
- /**
- * Look up the content type of an element.
- * @param name The element type name.
- * @return An integer constant representing the content type.
- * @see #CONTENT_UNDECLARED
- * @see #CONTENT_ANY
- * @see #CONTENT_EMPTY
- * @see #CONTENT_MIXED
- * @see #CONTENT_ELEMENTS
- */
- public int getElementContentType(String name)
- {
- ElementDecl element = (ElementDecl) elementInfo.get(name);
- return getContentType(element, CONTENT_UNDECLARED);
- }
-
- /**
- * Register an element.
- * Array format:
- * [0] element type name
- * [1] content model (mixed, elements only)
- * [2] attribute hash table
- */
- private void setElement(String name, int contentType,
- String contentModel, HashMap attributes)
- throws SAXException
- {
- if (skippedPE)
- {
- return;
- }
-
- ElementDecl element = (ElementDecl) elementInfo.get(name);
-
- // first or for this type?
- if (element == null)
- {
- element = new ElementDecl();
- element.contentType = contentType;
- element.contentModel = contentModel;
- element.attributes = attributes;
- elementInfo.put(name, element);
- return;
- }
-
- // declaration?
- if (contentType != CONTENT_UNDECLARED)
- {
- // ... following an associated
- if (element.contentType == CONTENT_UNDECLARED)
- {
- element.contentType = contentType;
- element.contentModel = contentModel;
- }
- else
- {
- // VC: Unique Element Type Declaration
- handler.verror("multiple declarations for element type: "
- + name);
- }
- }
-
- // first , before ?
- else if (attributes != null)
- {
- element.attributes = attributes;
- }
- }
-
- /**
- * Look up the attribute hash table for an element.
- * The hash table is the second item in the element array.
- */
- private HashMap getElementAttributes(String name)
- {
- ElementDecl element = (ElementDecl) elementInfo.get(name);
- return (element == null) ? null : element.attributes;
- }
-
- //
- // Attributes
- //
-
- /**
- * Get the declared attributes for an element type.
- * @param elname The name of the element type.
- * @return An iterator over all the attributes declared for
- * a specific element type. The results will be valid only
- * after the DTD (if any) has been parsed.
- * @see #getAttributeType
- * @see #getAttributeEnumeration
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- * @see #getAttributeExpandedValue
- */
- private Iterator declaredAttributes(ElementDecl element)
- {
- HashMap attlist;
-
- if (element == null)
- {
- return null;
- }
- if ((attlist = element.attributes) == null)
- {
- return null;
- }
- return attlist.keySet().iterator();
- }
-
- /**
- * Get the declared attributes for an element type.
- * @param elname The name of the element type.
- * @return An iterator over all the attributes declared for
- * a specific element type. The results will be valid only
- * after the DTD (if any) has been parsed.
- * @see #getAttributeType
- * @see #getAttributeEnumeration
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- * @see #getAttributeExpandedValue
- */
- public Iterator declaredAttributes(String elname)
- {
- return declaredAttributes((ElementDecl) elementInfo.get(elname));
- }
-
- /**
- * Retrieve the declared type of an attribute.
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return An interend string denoting the type, or null
- * indicating an undeclared attribute.
- */
- public String getAttributeType(String name, String aname)
- {
- AttributeDecl attribute = getAttribute(name, aname);
- return (attribute == null) ? null : attribute.type;
- }
-
- /**
- * Retrieve the allowed values for an enumerated attribute type.
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return A string containing the token list.
- */
- public String getAttributeEnumeration(String name, String aname)
- {
- AttributeDecl attribute = getAttribute(name, aname);
- // assert: attribute.enumeration is "ENUMERATION" or "NOTATION"
- return (attribute == null) ? null : attribute.enumeration;
- }
-
- /**
- * Retrieve the default value of a declared attribute.
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return The default value, or null if the attribute was
- * #IMPLIED or simply undeclared and unspecified.
- * @see #getAttributeExpandedValue
- */
- public String getAttributeDefaultValue(String name, String aname)
- {
- AttributeDecl attribute = getAttribute(name, aname);
- return (attribute == null) ? null : attribute.value;
- }
-
- /*
-
-// FIXME: Leaving this in, until W3C finally resolves the confusion
-// between parts of the XML 2nd REC about when entity declararations
-// are guaranteed to be known. Current code matches what section 5.1
-// (conformance) describes, but some readings of the self-contradicting
-// text in 4.1 (the "Entity Declared" WFC and VC) seem to expect that
-// attribute expansion/normalization must be deferred in some cases
-// (just TRY to identify them!).
-
- * Retrieve the expanded value of a declared attribute.
- * General entities (and char refs) will be expanded (once).
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return The expanded default value, or null if the attribute was
- * #IMPLIED or simply undeclared
- * @see #getAttributeDefaultValue
- public String getAttributeExpandedValue (String name, String aname)
- throws Exception
- {
- AttributeDecl attribute = getAttribute (name, aname);
-
- if (attribute == null) {
- return null;
- } else if (attribute.defaultValue == null && attribute.value != null) {
- // we MUST use the same buf for both quotes else the literal
- // can't be properly terminated
- char buf [] = new char [1];
- int flags = LIT_ENTITY_REF | LIT_ATTRIBUTE;
- String type = getAttributeType (name, aname);
-
- if (type != "CDATA" && type != null)
- flags |= LIT_NORMALIZE;
- buf [0] = '"';
- pushCharArray (null, buf, 0, 1);
- pushString (null, attribute.value);
- pushCharArray (null, buf, 0, 1);
- attribute.defaultValue = readLiteral (flags);
- }
- return attribute.defaultValue;
- }
- */
-
- /**
- * Retrieve the default value mode of a declared attribute.
- * @see #ATTRIBUTE_DEFAULT_SPECIFIED
- * @see #ATTRIBUTE_DEFAULT_IMPLIED
- * @see #ATTRIBUTE_DEFAULT_REQUIRED
- * @see #ATTRIBUTE_DEFAULT_FIXED
- */
- public int getAttributeDefaultValueType(String name, String aname)
- {
- AttributeDecl attribute = getAttribute(name, aname);
- return (attribute == null) ? ATTRIBUTE_DEFAULT_UNDECLARED :
- attribute.valueType;
- }
-
- /**
- * Register an attribute declaration for later retrieval.
- * Format:
- * - String type
- * - String default value
- * - int value type
- * - enumeration
- * - processed default value
- */
- private void setAttribute(String elName, String name, String type,
- String enumeration, String value, int valueType)
- throws Exception
- {
- HashMap attlist;
-
- if (skippedPE)
- {
- return;
- }
-
- // Create a new hashtable if necessary.
- attlist = getElementAttributes(elName);
- if (attlist == null)
- {
- attlist = new HashMap();
- }
-
- // ignore multiple attribute declarations!
- if (attlist.get(name) != null)
- {
- // warn ...
- return;
- }
- else
- {
- AttributeDecl attribute = new AttributeDecl();
- attribute.type = type;
- attribute.value = value;
- attribute.valueType = valueType;
- attribute.enumeration = enumeration;
- attlist.put(name, attribute);
-
- // save; but don't overwrite any existing
- setElement(elName, CONTENT_UNDECLARED, null, attlist);
- }
- }
-
- /**
- * Retrieve the attribute declaration for the given element name and name.
- */
- private AttributeDecl getAttribute(String elName, String name)
- {
- HashMap attlist = getElementAttributes(elName);
- return (attlist == null) ? null : (AttributeDecl) attlist.get(name);
- }
-
- //
- // Entities
- //
-
- /**
- * Find the type of an entity.
- * @returns An integer constant representing the entity type.
- * @see #ENTITY_UNDECLARED
- * @see #ENTITY_INTERNAL
- * @see #ENTITY_NDATA
- * @see #ENTITY_TEXT
- */
- public int getEntityType(String ename)
- {
- EntityInfo entity = (EntityInfo) entityInfo.get(ename);
- return (entity == null) ? ENTITY_UNDECLARED : entity.type;
- }
-
- /**
- * Return an external entity's identifiers.
- * @param ename The name of the external entity.
- * @return The entity's public identifier, system identifier, and base URI.
- * Null if the entity was not declared as an external entity.
- * @see #getEntityType
- */
- public ExternalIdentifiers getEntityIds(String ename)
- {
- EntityInfo entity = (EntityInfo) entityInfo.get(ename);
- return (entity == null) ? null : entity.ids;
- }
-
- /**
- * Return an internal entity's replacement text.
- * @param ename The name of the internal entity.
- * @return The entity's replacement text, or null if
- * the entity was not declared as an internal entity.
- * @see #getEntityType
- */
- public String getEntityValue(String ename)
- {
- EntityInfo entity = (EntityInfo) entityInfo.get(ename);
- return (entity == null) ? null : entity.value;
- }
-
- /**
- * Register an entity declaration for later retrieval.
- */
- private void setInternalEntity(String eName, String value)
- throws SAXException
- {
- if (skippedPE)
- {
- return;
- }
-
- if (entityInfo.get(eName) == null)
- {
- EntityInfo entity = new EntityInfo();
- entity.type = ENTITY_INTERNAL;
- entity.value = value;
- entityInfo.put(eName, entity);
- }
- if (handler.stringInterning)
- {
- if ("lt" == eName || "gt" == eName || "quot" == eName
- || "apos" == eName || "amp" == eName)
- {
- return;
- }
- }
- else
- {
- if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName)
- || "apos".equals(eName) || "amp".equals(eName))
- {
- return;
- }
- }
- handler.getDeclHandler().internalEntityDecl(eName, value);
- }
-
- /**
- * Register an external entity declaration for later retrieval.
- */
- private void setExternalEntity(String eName, int eClass,
- ExternalIdentifiers ids, String nName)
- {
- if (entityInfo.get(eName) == null)
- {
- EntityInfo entity = new EntityInfo();
- entity.type = eClass;
- entity.ids = ids;
- entity.notationName = nName;
- entityInfo.put(eName, entity);
- }
- }
-
- //
- // Notations.
- //
-
- /**
- * Report a notation declaration, checking for duplicates.
- */
- private void setNotation(String nname, ExternalIdentifiers ids)
- throws SAXException
- {
- if (skippedPE)
- {
- return;
- }
-
- handler.notationDecl(nname, ids.publicId, ids.systemId, ids.baseUri);
- if (notationInfo.get(nname) == null)
- {
- notationInfo.put(nname, nname);
- }
- else
- {
- // VC: Unique Notation Name
- handler.verror("Duplicate notation name decl: " + nname);
- }
- }
-
- //
- // Location.
- //
-
- /**
- * Return the current line number.
- */
- public int getLineNumber()
- {
- return line;
- }
-
- /**
- * Return the current column number.
- */
- public int getColumnNumber()
- {
- return column;
- }
-
- //////////////////////////////////////////////////////////////////////
- // High-level I/O.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Read a single character from the readBuffer.
- * The readDataChunk () method maintains the buffer.
- * If we hit the end of an entity, try to pop the stack and
- * keep going.
- * (This approach doesn't really enforce XML's rules about
- * entity boundaries, but this is not currently a validating
- * parser).
- * This routine also attempts to keep track of the current
- * position in external entities, but it's not entirely accurate.
- * @return The next available input character.
- * @see #unread (char)
- * @see #readDataChunk
- * @see #readBuffer
- * @see #line
- * @return The next character from the current input source.
- */
- private char readCh()
- throws SAXException, IOException
- {
- // As long as there's nothing in the
- // read buffer, try reading more data
- // (for an external entity) or popping
- // the entity stack (for either).
- while (readBufferPos >= readBufferLength)
- {
- switch (sourceType)
- {
- case INPUT_READER:
- case INPUT_STREAM:
- readDataChunk();
- while (readBufferLength < 1)
- {
- popInput();
- if (readBufferLength < 1)
- {
- readDataChunk();
- }
- }
- break;
-
- default:
-
- popInput();
- break;
- }
- }
-
- char c = readBuffer[readBufferPos++];
-
- if (c == '\n')
- {
- line++;
- column = 0;
- }
- else
- {
- if (c == '<')
- {
- /* the most common return to parseContent () ... NOP */
- }
- else if (((c < 0x0020 && (c != '\t') && (c != '\r')) || c > 0xFFFD)
- || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085)
- && xmlVersion == XML_11))
- {
- error("illegal XML character U+" + Integer.toHexString(c));
- }
-
- // If we're in the DTD and in a context where PEs get expanded,
- // do so ... 1/14/2000 errata identify those contexts. There
- // are also spots in the internal subset where PE refs are fatal
- // errors, hence yet another flag.
- else if (c == '%' && expandPE)
- {
- if (peIsError)
- {
- error("PE reference within decl in internal subset.");
- }
- parsePEReference();
- return readCh();
- }
- column++;
- }
-
- return c;
- }
-
- /**
- * Push a single character back onto the current input stream.
- * This method usually pushes the character back onto
- * the readBuffer.
- * I don't think that this would ever be called with
- * readBufferPos = 0, because the methods always reads a character
- * before unreading it, but just in case, I've added a boundary
- * condition.
- * @param c The character to push back.
- * @see #readCh
- * @see #unread (char[])
- * @see #readBuffer
- */
- private void unread(char c)
- throws SAXException
- {
- // Normal condition.
- if (c == '\n')
- {
- line--;
- column = -1;
- }
- if (readBufferPos > 0)
- {
- readBuffer[--readBufferPos] = c;
- }
- else
- {
- pushString(null, new Character(c).toString());
- }
- }
-
- /**
- * Push a char array back onto the current input stream.
- * NOTE: you must never push back characters that you
- * haven't actually read: use pushString () instead.
- * @see #readCh
- * @see #unread (char)
- * @see #readBuffer
- * @see #pushString
- */
- private void unread(char[] ch, int length)
- throws SAXException
- {
- for (int i = 0; i < length; i++)
- {
- if (ch[i] == '\n')
- {
- line--;
- column = -1;
- }
- }
- if (length < readBufferPos)
- {
- readBufferPos -= length;
- }
- else
- {
- pushCharArray(null, ch, 0, length);
- }
- }
-
- /**
- * Push, or skip, a new external input source.
- * The source will be some kind of parsed entity, such as a PE
- * (including the external DTD subset) or content for the body.
- *
- * @param url The java.net.URL object for the entity.
- * @see SAXDriver#resolveEntity
- * @see #pushString
- * @see #sourceType
- * @see #pushInput
- * @see #detectEncoding
- * @see #sourceType
- * @see #readBuffer
- */
- private void pushURL(boolean isPE,
- String ename,
- ExternalIdentifiers ids,
- Reader reader,
- InputStream stream,
- String encoding,
- boolean doResolve)
- throws SAXException, IOException
- {
- boolean ignoreEncoding;
- String systemId;
- InputSource source;
-
- if (!isPE)
- {
- dataBufferFlush();
- }
-
- scratch.setPublicId(ids.publicId);
- scratch.setSystemId(ids.systemId);
-
- // See if we should skip or substitute the entity.
- // If we're not skipping, resolving reports startEntity()
- // and updates the (handler's) stack of URIs.
- if (doResolve)
- {
- // assert (stream == null && reader == null && encoding == null)
- source = handler.resolveEntity(isPE, ename, scratch, ids.baseUri);
- if (source == null)
- {
- handler.warn("skipping entity: " + ename);
- handler.skippedEntity(ename);
- if (isPE)
- {
- skippedPE = true;
- }
- return;
- }
-
- // we might be using alternate IDs/encoding
- systemId = source.getSystemId();
- // The following warning and setting systemId was deleted bcause
- // the application has the option of not setting systemId
- // provided that it has set the characte/byte stream.
- /*
- if (systemId == null) {
- handler.warn ("missing system ID, using " + ids.systemId);
- systemId = ids.systemId;
- }
- */
- }
- else
- {
- // "[document]", or "[dtd]" via getExternalSubset()
- scratch.setCharacterStream(reader);
- scratch.setByteStream(stream);
- scratch.setEncoding(encoding);
- source = scratch;
- systemId = ids.systemId;
- if (handler.stringInterning)
- {
- handler.startExternalEntity(ename, systemId,
- "[document]" == ename);
- }
- else
- {
- handler.startExternalEntity(ename, systemId,
- "[document]".equals(ename));
- }
- }
-
- // we may have been given I/O streams directly
- if (source.getCharacterStream() != null)
- {
- if (source.getByteStream() != null)
- error("InputSource has two streams!");
- reader = source.getCharacterStream();
- }
- else if (source.getByteStream() != null)
- {
- encoding = source.getEncoding();
- if (encoding == null)
- {
- stream = source.getByteStream();
- }
- else
- {
- try
- {
- reader = new InputStreamReader(source.getByteStream(),
- encoding);
- }
- catch (IOException e)
- {
- stream = source.getByteStream();
- }
- }
- }
- else if (systemId == null)
- {
- error("InputSource has no URI!");
- }
- scratch.setCharacterStream(null);
- scratch.setByteStream(null);
- scratch.setEncoding(null);
-
- // Push the existing status.
- pushInput(ename);
-
- // Create a new read buffer.
- // (Note the four-character margin)
- readBuffer = new char[READ_BUFFER_MAX + 4];
- readBufferPos = 0;
- readBufferLength = 0;
- readBufferOverflow = -1;
- is = null;
- line = 1;
- column = 0;
- currentByteCount = 0;
-
- // If there's an explicit character stream, just
- // ignore encoding declarations.
- if (reader != null)
- {
- sourceType = INPUT_READER;
- this.reader = reader;
- tryEncodingDecl(true);
- return;
- }
-
- // Else we handle the conversion, and need to ensure
- // it's done right.
- sourceType = INPUT_STREAM;
- if (stream != null)
- {
- is = stream;
- }
- else
- {
- // We have to open our own stream to the URL.
- URL url = new URL(systemId);
-
- externalEntity = url.openConnection();
- externalEntity.connect();
- is = externalEntity.getInputStream();
- }
-
- // If we get to here, there must be
- // an InputStream available.
- if (!is.markSupported())
- {
- is = new BufferedInputStream(is);
- }
-
- // Get any external encoding label.
- if (encoding == null && externalEntity != null)
- {
- // External labels can be untrustworthy; filesystems in
- // particular often have the wrong default for content
- // that wasn't locally originated. Those we autodetect.
- if (!"file".equals(externalEntity.getURL().getProtocol()))
- {
- int temp;
-
- // application/xml;charset=something;otherAttr=...
- // ... with many variants on 'something'
- encoding = externalEntity.getContentType();
-
- // MHK code (fix for Saxon 5.5.1/007):
- // protect against encoding==null
- if (encoding == null)
- {
- temp = -1;
- }
- else
- {
- temp = encoding.indexOf("charset");
- }
-
- // RFC 2376 sez MIME text defaults to ASCII, but since the
- // JDK will create a MIME type out of thin air, we always
- // autodetect when there's no explicit charset attribute.
- if (temp < 0)
- {
- encoding = null; // autodetect
- }
- else
- {
- // only this one attribute
- if ((temp = encoding.indexOf(';')) > 0)
- {
- encoding = encoding.substring(0, temp);
- }
-
- if ((temp = encoding.indexOf('=', temp + 7)) > 0)
- {
- encoding = encoding.substring(temp + 1);
-
- // attributes can have comment fields (RFC 822)
- if ((temp = encoding.indexOf('(')) > 0)
- {
- encoding = encoding.substring(0, temp);
- }
- // ... and values may be quoted
- if ((temp = encoding.indexOf('"')) > 0)
- {
- encoding =
- encoding.substring(temp + 1,
- encoding.indexOf('"', temp + 2));
- }
- encoding.trim();
- }
- else
- {
- handler.warn("ignoring illegal MIME attribute: "
- + encoding);
- encoding = null;
- }
- }
- }
- }
-
- // if we got an external encoding label, use it ...
- if (encoding != null)
- {
- this.encoding = ENCODING_EXTERNAL;
- setupDecoding(encoding);
- ignoreEncoding = true;
-
- // ... else autodetect from first bytes.
- }
- else
- {
- detectEncoding();
- ignoreEncoding = false;
- }
-
- // Read any XML or text declaration.
- // If we autodetected, it may tell us the "real" encoding.
- try
- {
- tryEncodingDecl(ignoreEncoding);
- }
- catch (UnsupportedEncodingException x)
- {
- encoding = x.getMessage();
-
- // if we don't handle the declared encoding,
- // try letting a JVM InputStreamReader do it
- try
- {
- if (sourceType != INPUT_STREAM)
- {
- throw x;
- }
-
- is.reset();
- readBufferPos = 0;
- readBufferLength = 0;
- readBufferOverflow = -1;
- line = 1;
- currentByteCount = column = 0;
-
- sourceType = INPUT_READER;
- this.reader = new InputStreamReader(is, encoding);
- is = null;
-
- tryEncodingDecl(true);
-
- }
- catch (IOException e)
- {
- error("unsupported text encoding",
- encoding,
- null);
- }
- }
- }
-
- /**
- * Check for an encoding declaration. This is the second part of the
- * XML encoding autodetection algorithm, relying on detectEncoding to
- * get to the point that this part can read any encoding declaration
- * in the document (using only US-ASCII characters).
- *
- * Because this part starts to fill parser buffers with this data,
- * it's tricky to setup a reader so that Java's built-in decoders can be
- * used for the character encodings that aren't built in to this parser
- * (such as EUC-JP, KOI8-R, Big5, etc).
- *
- * @return any encoding in the declaration, uppercased; or null
- * @see detectEncoding
- */
- private String tryEncodingDecl(boolean ignoreEncoding)
- throws SAXException, IOException
- {
- // Read the XML/text declaration.
- if (tryRead(" 0)
- {
- return parseTextDecl(ignoreEncoding);
- }
- else
- {
- return parseXMLDecl(ignoreEncoding);
- }
- }
- else
- {
- // or similar
- unread('l');
- unread('m');
- unread('x');
- unread('?');
- unread('<');
- }
- }
- return null;
- }
-
- /**
- * Attempt to detect the encoding of an entity.
- * The trick here (as suggested in the XML standard) is that
- * any entity not in UTF-8, or in UCS-2 with a byte-order mark,
- * must begin with an XML declaration or an encoding
- * declaration; we simply have to look for "<?xml" in various
- * encodings.
- * This method has no way to distinguish among 8-bit encodings.
- * Instead, it sets up for UTF-8, then (possibly) revises its assumption
- * later in setupDecoding (). Any ASCII-derived 8-bit encoding
- * should work, but most will be rejected later by setupDecoding ().
- * @see #tryEncoding (byte[], byte, byte, byte, byte)
- * @see #tryEncoding (byte[], byte, byte)
- * @see #setupDecoding
- */
- private void detectEncoding()
- throws SAXException, IOException
- {
- byte[] signature = new byte[4];
-
- // Read the first four bytes for
- // autodetection.
- is.mark(4);
- is.read(signature);
- is.reset();
-
- //
- // FIRST: four byte encodings (who uses these?)
- //
- if (tryEncoding(signature, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x3c))
- {
- // UCS-4 must begin with "Utility routine for detectEncoding ().
- * Always looks for some part of "Looks for a UCS-2 byte-order mark.
- * Utility routine for detectEncoding ().
- * @param sig The first four bytes read.
- * @param b1 The first byte of the signature
- * @param b2 The second byte of the signature
- * @see #detectEncoding
- */
- private static boolean tryEncoding(byte[] sig, byte b1, byte b2)
- {
- return ((sig[0] == b1) && (sig[1] == b2));
- }
-
- /**
- * This method pushes a string back onto input.
- * It is useful either as the expansion of an internal entity,
- * or for backtracking during the parse.
- * Call pushCharArray () to do the actual work.
- * @param s The string to push back onto input.
- * @see #pushCharArray
- */
- private void pushString(String ename, String s)
- throws SAXException
- {
- char[] ch = s.toCharArray();
- pushCharArray(ename, ch, 0, ch.length);
- }
-
- /**
- * Push a new internal input source.
- * This method is useful for expanding an internal entity,
- * or for unreading a string of characters. It creates a new
- * readBuffer containing the characters in the array, instead
- * of characters converted from an input byte stream.
- * @param ch The char array to push.
- * @see #pushString
- * @see #pushURL
- * @see #readBuffer
- * @see #sourceType
- * @see #pushInput
- */
- private void pushCharArray(String ename, char[] ch, int start, int length)
- throws SAXException
- {
- // Push the existing status
- pushInput(ename);
- if (ename != null && doReport)
- {
- dataBufferFlush();
- handler.startInternalEntity(ename);
- }
- sourceType = INPUT_INTERNAL;
- readBuffer = ch;
- readBufferPos = start;
- readBufferLength = length;
- readBufferOverflow = -1;
- }
-
- /**
- * Save the current input source onto the stack.
- * This method saves all of the global variables associated with
- * the current input source, so that they can be restored when a new
- * input source has finished. It also tests for entity recursion.
- * The method saves the following global variables onto a stack
- * using a fixed-length array:
- * This method restores all of the global variables associated with
- * the current input source.
- * @exception java.io.EOFException
- * If there are no more entries on the input stack.
- * @see #pushInput
- * @see #sourceType
- * @see #externalEntity
- * @see #readBuffer
- * @see #readBufferPos
- * @see #readBufferLength
- * @see #line
- * @see #encoding
- */
- private void popInput()
- throws SAXException, IOException
- {
- String ename = (String) entityStack.removeLast();
-
- if (ename != null && doReport)
- {
- dataBufferFlush();
- }
- switch (sourceType)
- {
- case INPUT_STREAM:
- handler.endExternalEntity(ename);
- is.close();
- break;
- case INPUT_READER:
- handler.endExternalEntity(ename);
- reader.close();
- break;
- case INPUT_INTERNAL:
- if (ename != null && doReport)
- {
- handler.endInternalEntity(ename);
- }
- break;
- }
-
- // Throw an EOFException if there
- // is nothing else to pop.
- if (inputStack.isEmpty())
- {
- throw new EOFException("no more input");
- }
-
- Input input = (Input) inputStack.removeLast();
-
- sourceType = input.sourceType;
- externalEntity = input.externalEntity;
- readBuffer = input.readBuffer;
- readBufferPos = input.readBufferPos;
- readBufferLength = input.readBufferLength;
- line = input.line;
- encoding = input.encoding;
- readBufferOverflow = input.readBufferOverflow;
- is = input.is;
- currentByteCount = input.currentByteCount;
- column = input.column;
- reader = input.reader;
- }
-
- /**
- * Return true if we can read the expected character.
- * Note that the character will be removed from the input stream
- * on success, but will be put back on failure. Do not attempt to
- * read the character again if the method succeeds.
- * @param delim The character that should appear next. For a
- * insensitive match, you must supply this in upper-case.
- * @return true if the character was successfully read, or false if
- * it was not.
- * @see #tryRead (String)
- */
- private boolean tryRead(char delim)
- throws SAXException, IOException
- {
- char c;
-
- // Read the character
- c = readCh();
-
- // Test for a match, and push the character
- // back if the match fails.
- if (c == delim)
- {
- return true;
- }
- else
- {
- unread(c);
- return false;
- }
- }
-
- /**
- * Return true if we can read the expected string.
- * This is simply a convenience method.
- * Note that the string will be removed from the input stream
- * on success, but will be put back on failure. Do not attempt to
- * read the string again if the method succeeds.
- * This method will push back a character rather than an
- * array whenever possible (probably the majority of cases).
- * @param delim The string that should appear next.
- * @return true if the string was successfully read, or false if
- * it was not.
- * @see #tryRead (char)
- */
- private boolean tryRead(String delim)
- throws SAXException, IOException
- {
- return tryRead(delim.toCharArray());
- }
-
- private boolean tryRead(char[] ch)
- throws SAXException, IOException
- {
- char c;
-
- // Compare the input, character-
- // by character.
-
- for (int i = 0; i < ch.length; i++)
- {
- c = readCh();
- if (c != ch[i])
- {
- unread(c);
- if (i != 0)
- {
- unread(ch, i);
- }
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return true if we can read some whitespace.
- * This is simply a convenience method.
- * This method will push back a character rather than an
- * array whenever possible (probably the majority of cases).
- * @return true if whitespace was found.
- */
- private boolean tryWhitespace()
- throws SAXException, IOException
- {
- char c;
- c = readCh();
- if (isWhitespace(c))
- {
- skipWhitespace();
- return true;
- }
- else
- {
- unread(c);
- return false;
- }
- }
-
- /**
- * Read all data until we find the specified string.
- * This is useful for scanning CDATA sections and PIs.
- * This is inefficient right now, since it calls tryRead ()
- * for every character.
- * @param delim The string delimiter
- * @see #tryRead (String, boolean)
- * @see #readCh
- */
- private void parseUntil(String delim)
- throws SAXException, IOException
- {
- parseUntil(delim.toCharArray());
- }
-
- private void parseUntil(char[] delim)
- throws SAXException, IOException
- {
- char c;
- int startLine = line;
-
- try
- {
- while (!tryRead(delim))
- {
- c = readCh();
- dataBufferAppend(c);
- }
- }
- catch (EOFException e)
- {
- error("end of input while looking for delimiter "
- + "(started on line " + startLine
- + ')', null, new String(delim));
- }
- }
-
- //////////////////////////////////////////////////////////////////////
- // Low-level I/O.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Prefetch US-ASCII XML/text decl from input stream into read buffer.
- * Doesn't buffer more than absolutely needed, so that when an encoding
- * decl says we need to create an InputStreamReader, we can discard our
- * buffer and reset(). Caller knows the first chars of the decl exist
- * in the input stream.
- */
- private void prefetchASCIIEncodingDecl()
- throws SAXException, IOException
- {
- int ch;
- readBufferPos = readBufferLength = 0;
-
- is.mark(readBuffer.length);
- while (true)
- {
- ch = is.read();
- readBuffer[readBufferLength++] = (char) ch;
- switch (ch)
- {
- case (int) '>':
- return;
- case -1:
- error("file ends before end of XML or encoding declaration.",
- null, "?>");
- }
- if (readBuffer.length == readBufferLength)
- {
- error("unfinished XML or encoding declaration");
- }
- }
- }
-
- /**
- * Read a chunk of data from an external input source.
- * This is simply a front-end that fills the rawReadBuffer
- * with bytes, then calls the appropriate encoding handler.
- * @see #encoding
- * @see #rawReadBuffer
- * @see #readBuffer
- * @see #filterCR
- * @see #copyUtf8ReadBuffer
- * @see #copyIso8859_1ReadBuffer
- * @see #copyUcs_2ReadBuffer
- * @see #copyUcs_4ReadBuffer
- */
- private void readDataChunk()
- throws SAXException, IOException
- {
- int count;
-
- // See if we have any overflow (filterCR sets for CR at end)
- if (readBufferOverflow > -1)
- {
- readBuffer[0] = (char) readBufferOverflow;
- readBufferOverflow = -1;
- readBufferPos = 1;
- sawCR = true;
- }
- else
- {
- readBufferPos = 0;
- sawCR = false;
- }
-
- // input from a character stream.
- if (sourceType == INPUT_READER)
- {
- count = reader.read(readBuffer,
- readBufferPos, READ_BUFFER_MAX - readBufferPos);
- if (count < 0)
- {
- readBufferLength = readBufferPos;
- }
- else
- {
- readBufferLength = readBufferPos + count;
- }
- if (readBufferLength > 0)
- {
- filterCR(count >= 0);
- }
- sawCR = false;
- return;
- }
-
- // Read as many bytes as possible into the raw buffer.
- count = is.read(rawReadBuffer, 0, READ_BUFFER_MAX);
-
- // Dispatch to an encoding-specific reader method to populate
- // the readBuffer. In most parser speed profiles, these routines
- // show up at the top of the CPU usage chart.
- if (count > 0)
- {
- switch (encoding)
- {
- // one byte builtins
- case ENCODING_ASCII:
- copyIso8859_1ReadBuffer(count, (char) 0x0080);
- break;
- case ENCODING_UTF_8:
- copyUtf8ReadBuffer(count);
- break;
- case ENCODING_ISO_8859_1:
- copyIso8859_1ReadBuffer(count, (char) 0);
- break;
-
- // two byte builtins
- case ENCODING_UCS_2_12:
- copyUcs2ReadBuffer(count, 8, 0);
- break;
- case ENCODING_UCS_2_21:
- copyUcs2ReadBuffer(count, 0, 8);
- break;
-
- // four byte builtins
- case ENCODING_UCS_4_1234:
- copyUcs4ReadBuffer(count, 24, 16, 8, 0);
- break;
- case ENCODING_UCS_4_4321:
- copyUcs4ReadBuffer(count, 0, 8, 16, 24);
- break;
- case ENCODING_UCS_4_2143:
- copyUcs4ReadBuffer(count, 16, 24, 0, 8);
- break;
- case ENCODING_UCS_4_3412:
- copyUcs4ReadBuffer(count, 8, 0, 24, 16);
- break;
- }
- }
- else
- {
- readBufferLength = readBufferPos;
- }
-
- readBufferPos = 0;
-
- // Filter out all carriage returns if we've seen any
- // (including any saved from a previous read)
- if (sawCR)
- {
- filterCR(count >= 0);
- sawCR = false;
-
- // must actively report EOF, lest some CRs get lost.
- if (readBufferLength == 0 && count >= 0)
- {
- readDataChunk();
- }
- }
-
- if (count > 0)
- {
- currentByteCount += count;
- }
- }
-
- /**
- * Filter carriage returns in the read buffer.
- * CRLF becomes LF; CR becomes LF.
- * @param moreData true iff more data might come from the same source
- * @see #readDataChunk
- * @see #readBuffer
- * @see #readBufferOverflow
- */
- private void filterCR(boolean moreData)
- {
- int i, j;
-
- readBufferOverflow = -1;
-
-loop:
- for (i = j = readBufferPos; j < readBufferLength; i++, j++)
- {
- switch (readBuffer[j])
- {
- case '\r':
- if (j == readBufferLength - 1)
- {
- if (moreData)
- {
- readBufferOverflow = '\r';
- readBufferLength--;
- }
- else // CR at end of buffer
- {
- readBuffer[i++] = '\n';
- }
- break loop;
- }
- else if (readBuffer[j + 1] == '\n')
- {
- j++;
- }
- readBuffer[i] = '\n';
- break;
-
- case '\n':
- default:
- readBuffer[i] = readBuffer[j];
- break;
- }
- }
- readBufferLength = i;
- }
-
- /**
- * Convert a buffer of UTF-8-encoded bytes into UTF-16 characters.
- * When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- * Note that as of Unicode 3.1, good practice became a requirement,
- * so that each Unicode character has exactly one UTF-8 representation.
- * @param count The number of bytes to convert.
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- * @see #getNextUtf8Byte
- */
- private void copyUtf8ReadBuffer(int count)
- throws SAXException, IOException
- {
- int i = 0;
- int j = readBufferPos;
- int b1;
- char c = 0;
-
- /*
- // check once, so the runtime won't (if it's smart enough)
- if (count < 0 || count > rawReadBuffer.length)
- throw new ArrayIndexOutOfBoundsException (Integer.toString (count));
- */
-
- while (i < count)
- {
- b1 = rawReadBuffer[i++];
-
- // Determine whether we are dealing
- // with a one-, two-, three-, or four-
- // byte sequence.
- if (b1 < 0)
- {
- if ((b1 & 0xe0) == 0xc0)
- {
- // 2-byte sequence: 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx
- c = (char) (((b1 & 0x1f) << 6)
- | getNextUtf8Byte(i++, count));
- if (c < 0x0080)
- {
- encodingError("Illegal two byte UTF-8 sequence",
- c, 0);
- }
-
- //Sec 2.11
- // [1] the two-character sequence #xD #xA
- // [2] the two-character sequence #xD #x85
- if ((c == 0x0085 || c == 0x000a) && sawCR)
- {
- continue;
- }
-
- // Sec 2.11
- // [3] the single character #x85
-
- if (c == 0x0085 && xmlVersion == XML_11)
- {
- readBuffer[j++] = '\r';
- }
- }
- else if ((b1 & 0xf0) == 0xe0)
- {
- // 3-byte sequence:
- // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx
- // most CJKV characters
- c = (char) (((b1 & 0x0f) << 12) |
- (getNextUtf8Byte(i++, count) << 6) |
- getNextUtf8Byte(i++, count));
- //sec 2.11
- //[4] the single character #x2028
- if (c == 0x2028 && xmlVersion == XML_11)
- {
- readBuffer[j++] = '\r';
- sawCR = true;
- continue;
- }
- if (c < 0x0800 || (c >= 0xd800 && c <= 0xdfff))
- {
- encodingError("Illegal three byte UTF-8 sequence",
- c, 0);
- }
- }
- else if ((b1 & 0xf8) == 0xf0)
- {
- // 4-byte sequence: 11101110wwwwzzzzyy + 110111yyyyxxxxxx
- // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx
- // (uuuuu = wwww + 1)
- // "Surrogate Pairs" ... from the "Astral Planes"
- // Unicode 3.1 assigned the first characters there
- int iso646 = b1 & 07;
- iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count);
- iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count);
- iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count);
-
- if (iso646 <= 0xffff)
- {
- encodingError("Illegal four byte UTF-8 sequence",
- iso646, 0);
- }
- else
- {
- if (iso646 > 0x0010ffff)
- {
- encodingError("UTF-8 value out of range for Unicode",
- iso646, 0);
- }
- iso646 -= 0x010000;
- readBuffer[j++] = (char) (0xd800 | (iso646 >> 10));
- readBuffer[j++] = (char) (0xdc00 | (iso646 & 0x03ff));
- continue;
- }
- }
- else
- {
- // The five and six byte encodings aren't supported;
- // they exceed the Unicode (and XML) range.
- encodingError("unsupported five or six byte UTF-8 sequence",
- 0xff & b1, i);
- // NOTREACHED
- c = 0;
- }
- }
- else
- {
- // 1-byte sequence: 000000000xxxxxxx = 0xxxxxxx
- // (US-ASCII character, "common" case, one branch to here)
- c = (char) b1;
- }
- readBuffer[j++] = c;
- if (c == '\r')
- {
- sawCR = true;
- }
- }
- // How many characters have we read?
- readBufferLength = j;
- }
-
- /**
- * Return the next byte value in a UTF-8 sequence.
- * If it is not possible to get a byte from the current
- * entity, throw an exception.
- * @param pos The current position in the rawReadBuffer.
- * @param count The number of bytes in the rawReadBuffer
- * @return The significant six bits of a non-initial byte in
- * a UTF-8 sequence.
- * @exception EOFException If the sequence is incomplete.
- */
- private int getNextUtf8Byte(int pos, int count)
- throws SAXException, IOException
- {
- int val;
-
- // Take a character from the buffer
- // or from the actual input stream.
- if (pos < count)
- {
- val = rawReadBuffer[pos];
- }
- else
- {
- val = is.read();
- if (val == -1)
- {
- encodingError("unfinished multi-byte UTF-8 sequence at EOF",
- -1, pos);
- }
- }
-
- // Check for the correct bits at the start.
- if ((val & 0xc0) != 0x80)
- {
- encodingError("bad continuation of multi-byte UTF-8 sequence",
- val, pos + 1);
- }
-
- // Return the significant bits.
- return (val & 0x3f);
- }
-
- /**
- * Convert a buffer of US-ASCII or ISO-8859-1-encoded bytes into
- * UTF-16 characters.
- *
- * When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- *
- * @param count The number of bytes to convert.
- * @param mask For ASCII conversion, 0x7f; else, 0xff.
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- */
- private void copyIso8859_1ReadBuffer(int count, char mask)
- throws IOException
- {
- int i, j;
- for (i = 0, j = readBufferPos; i < count; i++, j++)
- {
- char c = (char) (rawReadBuffer[i] & 0xff);
- if ((c & mask) != 0)
- {
- throw new CharConversionException("non-ASCII character U+"
- + Integer.toHexString(c));
- }
- if (c == 0x0085 && xmlVersion == XML_11)
- {
- c = '\r';
- }
- readBuffer[j] = c;
- if (c == '\r')
- {
- sawCR = true;
- }
- }
- readBufferLength = j;
- }
-
- /**
- * Convert a buffer of UCS-2-encoded bytes into UTF-16 characters
- * (as used in Java string manipulation).
- *
- * When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- * @param count The number of bytes to convert.
- * @param shift1 The number of bits to shift byte 1.
- * @param shift2 The number of bits to shift byte 2
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- */
- private void copyUcs2ReadBuffer(int count, int shift1, int shift2)
- throws SAXException
- {
- int j = readBufferPos;
-
- if (count > 0 && (count % 2) != 0)
- {
- encodingError("odd number of bytes in UCS-2 encoding", -1, count);
- }
- // The loops are faster with less internal brancing; hence two
- if (shift1 == 0)
- { // "UTF-16-LE"
- for (int i = 0; i < count; i += 2)
- {
- char c = (char) (rawReadBuffer[i + 1] << 8);
- c |= 0xff & rawReadBuffer[i];
- readBuffer[j++] = c;
- if (c == '\r')
- {
- sawCR = true;
- }
- }
- }
- else
- { // "UTF-16-BE"
- for (int i = 0; i < count; i += 2)
- {
- char c = (char) (rawReadBuffer[i] << 8);
- c |= 0xff & rawReadBuffer[i + 1];
- readBuffer[j++] = c;
- if (c == '\r')
- {
- sawCR = true;
- }
- }
- }
- readBufferLength = j;
- }
-
- /**
- * Convert a buffer of UCS-4-encoded bytes into UTF-16 characters.
- *
- * When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- * Java has Unicode chars, and this routine uses surrogate pairs
- * for ISO-10646 values between 0x00010000 and 0x000fffff. An
- * exception is thrown if the ISO-10646 character has no Unicode
- * representation.
- *
- * @param count The number of bytes to convert.
- * @param shift1 The number of bits to shift byte 1.
- * @param shift2 The number of bits to shift byte 2
- * @param shift3 The number of bits to shift byte 2
- * @param shift4 The number of bits to shift byte 2
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- */
- private void copyUcs4ReadBuffer(int count, int shift1, int shift2,
- int shift3, int shift4)
- throws SAXException
- {
- int j = readBufferPos;
-
- if (count > 0 && (count % 4) != 0)
- {
- encodingError("number of bytes in UCS-4 encoding " +
- "not divisible by 4",
- -1, count);
- }
- for (int i = 0; i < count; i += 4)
- {
- int value = (((rawReadBuffer [i] & 0xff) << shift1) |
- ((rawReadBuffer [i + 1] & 0xff) << shift2) |
- ((rawReadBuffer [i + 2] & 0xff) << shift3) |
- ((rawReadBuffer [i + 3] & 0xff) << shift4));
- if (value < 0x0000ffff)
- {
- readBuffer [j++] = (char) value;
- if (value == (int) '\r')
- {
- sawCR = true;
- }
- }
- else if (value < 0x0010ffff)
- {
- value -= 0x010000;
- readBuffer[j++] = (char) (0xd8 | ((value >> 10) & 0x03ff));
- readBuffer[j++] = (char) (0xdc | (value & 0x03ff));
- }
- else
- {
- encodingError("UCS-4 value out of range for Unicode",
- value, i);
- }
- }
- readBufferLength = j;
- }
-
- /**
- * Report a character encoding error.
- */
- private void encodingError(String message, int value, int offset)
- throws SAXException
- {
- if (value != -1)
- {
- message = message + " (character code: 0x" +
- Integer.toHexString(value) + ')';
- error(message);
- }
- }
-
- //////////////////////////////////////////////////////////////////////
- // Local Variables.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Re-initialize the variables for each parse.
- */
- private void initializeVariables()
- {
- // First line
- line = 1;
- column = 0;
-
- // Set up the buffers for data and names
- dataBufferPos = 0;
- dataBuffer = new char[DATA_BUFFER_INITIAL];
- nameBufferPos = 0;
- nameBuffer = new char[NAME_BUFFER_INITIAL];
-
- // Set up the DTD hash tables
- elementInfo = new HashMap();
- entityInfo = new HashMap();
- notationInfo = new HashMap();
- skippedPE = false;
-
- // Set up the variables for the current
- // element context.
- currentElement = null;
- currentElementContent = CONTENT_UNDECLARED;
-
- // Set up the input variables
- sourceType = INPUT_NONE;
- inputStack = new LinkedList();
- entityStack = new LinkedList();
- externalEntity = null;
- tagAttributePos = 0;
- tagAttributes = new String[100];
- rawReadBuffer = new byte[READ_BUFFER_MAX];
- readBufferOverflow = -1;
-
- scratch = new InputSource();
-
- inLiteral = false;
- expandPE = false;
- peIsError = false;
-
- doReport = false;
-
- inCDATA = false;
-
- symbolTable = new Object[SYMBOL_TABLE_LENGTH][];
- }
-
- static class ExternalIdentifiers
- {
-
- String publicId;
- String systemId;
- String baseUri;
-
- ExternalIdentifiers()
- {
- }
-
- ExternalIdentifiers(String publicId, String systemId, String baseUri)
- {
- this.publicId = publicId;
- this.systemId = systemId;
- this.baseUri = baseUri;
- }
-
- }
-
- static class EntityInfo
- {
-
- int type;
- ExternalIdentifiers ids;
- String value;
- String notationName;
-
- }
-
- static class AttributeDecl
- {
-
- String type;
- String value;
- int valueType;
- String enumeration;
- String defaultValue;
-
- }
-
- static class ElementDecl
- {
-
- int contentType;
- String contentModel;
- HashMap attributes;
-
- }
-
- static class Input
- {
-
- int sourceType;
- URLConnection externalEntity;
- char[] readBuffer;
- int readBufferPos;
- int readBufferLength;
- int line;
- int encoding;
- int readBufferOverflow;
- InputStream is;
- int currentByteCount;
- int column;
- Reader reader;
-
- }
-
-}
-
diff --git a/libjava/gnu/xml/aelfred2/XmlReader.java b/libjava/gnu/xml/aelfred2/XmlReader.java
deleted file mode 100644
index a3bd03a8644..00000000000
--- a/libjava/gnu/xml/aelfred2/XmlReader.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/* XmlReader.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.aelfred2;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-
-import gnu.xml.pipeline.EventFilter;
-import gnu.xml.pipeline.ValidationConsumer;
-
-
-/**
- * This SAX2 parser optionally layers a validator over the Ælfred2
- * SAX2 parser. While this will not evaluate every XML validity constraint,
- * it does support all the validity constraints that are of any real utility
- * outside the strict SGML-compatible world. See the documentation for the
- * SAXDriver class for information about the SAX2 features and properties
- * that are supported, and documentation for the ValidationConsumer for
- * information about what validity constraints may not be supported.
- * (Ælfred2 tests some of those, even in non-validating mode, to
- * achieve better conformance.)
- *
- * Note that due to its internal construction, you can't change most
- * handlers until parse() returns. This diverges slightly from SAX, which
- * expects later binding to be supported. Early binding involves less
- * runtime overhead, which is an issue for event pipelines as used inside
- * this parser. Rather than relying on the parser to handle late binding
- * to your own handlers, do it yourself.
- *
- * @see SAXDriver
- * @see gnu.xml.pipeline.ValidationConsumer
- *
- * @author David Brownell
- */
-public final class XmlReader
- implements XMLReader
-{
-
- static class FatalErrorHandler
- extends DefaultHandler2
- {
-
- public void error(SAXParseException e)
- throws SAXException
- {
- throw e;
- }
-
- }
-
- private SAXDriver aelfred2 = new SAXDriver();
- private EventFilter filter = new EventFilter();
- private boolean isValidating;
- private boolean active;
-
- /**
- * Constructs a SAX Parser.
- */
- public XmlReader()
- {
- }
-
- /**
- * Constructs a SAX Parser, optionally treating validity errors
- * as if they were fatal errors.
- */
- public XmlReader(boolean invalidIsFatal)
- {
- if (invalidIsFatal)
- {
- setErrorHandler(new FatalErrorHandler());
- }
- }
-
- /**
- * SAX2: Returns the object used to report the logical
- * content of an XML document.
- */
- public ContentHandler getContentHandler()
- {
- return filter.getContentHandler();
- }
-
- /**
- * SAX2: Assigns the object used to report the logical
- * content of an XML document.
- * @exception IllegalStateException if called mid-parse
- */
- public void setContentHandler(ContentHandler handler)
- {
- if (active)
- {
- throw new IllegalStateException("already parsing");
- }
- filter.setContentHandler(handler);
- }
-
- /**
- * SAX2: Returns the object used to process declarations related
- * to notations and unparsed entities.
- */
- public DTDHandler getDTDHandler()
- {
- return filter.getDTDHandler();
- }
-
- /**
- * SAX1 Assigns DTD handler
- * @exception IllegalStateException if called mid-parse
- */
- public void setDTDHandler(DTDHandler handler)
- {
- if (active)
- {
- throw new IllegalStateException("already parsing");
- }
- filter.setDTDHandler(handler);
- }
-
- /**
- * SAX2: Returns the object used when resolving external
- * entities during parsing (both general and parameter entities).
- */
- public EntityResolver getEntityResolver()
- {
- return aelfred2.getEntityResolver();
- }
-
- /**
- * SAX1 Assigns parser's entity resolver
- */
- public void setEntityResolver(EntityResolver handler)
- {
- aelfred2.setEntityResolver(handler);
- }
-
- /**
- * SAX2: Returns the object used to receive callbacks for XML
- * errors of all levels (fatal, nonfatal, warning); this is never null;
- */
- public ErrorHandler getErrorHandler()
- {
- return aelfred2.getErrorHandler();
- }
-
- /**
- * SAX1 Assigns error handler
- * @exception IllegalStateException if called mid-parse
- */
- public void setErrorHandler(ErrorHandler handler)
- {
- if (active)
- {
- throw new IllegalStateException("already parsing");
- }
- aelfred2.setErrorHandler(handler);
- }
-
- /**
- * SAX2: Assigns the specified property.
- * @exception IllegalStateException if called mid-parse
- */
- public void setProperty(String propertyId, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (active)
- {
- throw new IllegalStateException("already parsing");
- }
- if (getProperty(propertyId) != value)
- {
- filter.setProperty(propertyId, value);
- }
- }
-
- /**
- * SAX2: Returns the specified property.
- */
- public Object getProperty(String propertyId)
- throws SAXNotRecognizedException
- {
- if ((SAXDriver.PROPERTY + "declaration-handler").equals(propertyId)
- || (SAXDriver.PROPERTY + "lexical-handler").equals(propertyId))
- {
- return filter.getProperty(propertyId);
- }
- throw new SAXNotRecognizedException(propertyId);
- }
-
- private void forceValidating()
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- aelfred2.setFeature(SAXDriver.FEATURE + "namespace-prefixes",
- true);
- aelfred2.setFeature(SAXDriver.FEATURE + "external-general-entities",
- true);
- aelfred2.setFeature(SAXDriver.FEATURE + "external-parameter-entities",
- true);
- }
-
- /**
- * SAX2: Sets the state of features supported in this parser.
- * Note that this parser requires reporting of namespace prefixes when
- * validating.
- */
- public void setFeature(String featureId, boolean state)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- boolean value = getFeature(featureId);
-
- if (state == value)
- {
- return;
- }
-
- if ((SAXDriver.FEATURE + "validation").equals(featureId))
- {
- if (active)
- {
- throw new SAXNotSupportedException("already parsing");
- }
- if (state)
- {
- forceValidating();
- }
- isValidating = state;
- }
- else
- {
- aelfred2.setFeature(featureId, state);
- }
- }
-
- /**
- * SAX2: Tells whether this parser supports the specified feature.
- * At this time, this directly parallels the underlying SAXDriver,
- * except that validation is optionally supported.
- *
- * @see SAXDriver
- */
- public boolean getFeature(String featureId)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if ((SAXDriver.FEATURE + "validation").equals(featureId))
- {
- return isValidating;
- }
-
- return aelfred2.getFeature(featureId);
- }
-
- /**
- * SAX1: Sets the locale used for diagnostics; currently,
- * only locales using the English language are supported.
- * @param locale The locale for which diagnostics will be generated
- */
- public void setLocale(Locale locale)
- throws SAXException
- {
- aelfred2.setLocale(locale);
- }
-
- /**
- * SAX1: Preferred API to parse an XML document, using a
- * system identifier (URI).
- */
- public void parse(String systemId)
- throws SAXException, IOException
- {
- parse(new InputSource(systemId));
- }
-
- /**
- * SAX1: Underlying API to parse an XML document, used
- * directly when no URI is available. When this is invoked,
- * and the parser is set to validate, some features will be
- * automatically reset to appropriate values: for reporting
- * namespace prefixes, and incorporating external entities.
- *
- * @param source The XML input source.
- *
- * @exception IllegalStateException if called mid-parse
- * @exception SAXException The handlers may throw any SAXException,
- * and the parser normally throws SAXParseException objects.
- * @exception IOException IOExceptions are normally through through
- * the parser if there are problems reading the source document.
- */
- public void parse(InputSource source)
- throws SAXException, IOException
- {
- EventFilter next;
- boolean nsdecls;
-
- synchronized (aelfred2)
- {
- if (active)
- {
- throw new IllegalStateException("already parsing");
- }
- active = true;
- }
-
- // set up the output pipeline
- if (isValidating)
- {
- forceValidating();
- next = new ValidationConsumer(filter);
- }
- else
- {
- next = filter;
- }
-
- // connect pipeline and error handler
- // don't let _this_ call to bind() affect xmlns* attributes
- nsdecls = aelfred2.getFeature(SAXDriver.FEATURE + "namespace-prefixes");
- EventFilter.bind(aelfred2, next);
- if (!nsdecls)
- {
- aelfred2.setFeature(SAXDriver.FEATURE + "namespace-prefixes",
- false);
- }
-
- // parse, clean up
- try
- {
- aelfred2.parse(source);
- }
- finally
- {
- active = false;
- }
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/Consumer.java b/libjava/gnu/xml/dom/Consumer.java
deleted file mode 100644
index f99e221e998..00000000000
--- a/libjava/gnu/xml/dom/Consumer.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/* Consumer.java --
- Copyright (C) 2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.Attributes2;
-
-import gnu.xml.pipeline.DomConsumer;
-import gnu.xml.pipeline.EventConsumer;
-
-
-/**
- * Event consumer which constructs DOM documents using the implementation
- * in this package, using SAX2 events. This packages various backdoors
- * into this DOM implementation, as needed to address DOM requirements
- * that can't be met by strictly conforming implementations of DOM.
- *
- * These requirements all relate to {@link DocumentType} nodes and
- * features of that node type. These features are normally not used,
- * because that interface only exposes a subset of the information found
- * in DTDs. More, that subset does not include the most important typing
- * information. For example, it excludes element content models and
- * attribute typing. It does expose some entity management issues,
- * although entity management doesn't relate to document typing.
- *
- * Note that SAX2 does not expose the literal text of the DTD's
- * internal subset, so it will not be present in DOM trees constructed
- * using this API. (Though with a good SAX2 implementation, it could
- * be partially recreated...)
- *
- * @author David Brownell
- */
-public class Consumer extends DomConsumer
-{
- /**
- * Constructs an unconfigured event consumer,
- * as a terminus in a SAX event pipeline.
- */
- // used by PipelineFactory [terminus]
- public Consumer ()
- throws SAXException
- {
- super (DomDocument.class);
- setHandler (new Backdoor (this));
- }
-
- /**
- * Constructs an unconfigured event consumer,
- * as a stage in a SAX event pipeline.
- */
- // used by PipelineFactory [filter]
- public Consumer (EventConsumer next)
- throws SAXException
- {
- super (DomDocument.class, next);
- setHandler (new Backdoor (this));
- }
-
- /**
- * Implements the backdoors needed by DOM.
- * All methods in this class use implementation-specific APIs that are
- * implied by the DOM specification (needed to implement testable
- * behavior) but which are excluded from the DOM specification.
- */
- public static class Backdoor extends DomConsumer.Handler
- {
- /**
- * Constructor.
- * @param consumer must have been initialized to use the
- * {@link DomDocument} class (or a subclass) for
- * constructing DOM trees
- */
- protected Backdoor (DomConsumer consumer)
- throws SAXException
- { super (consumer); }
-
- // helper routine
- private DomDoctype getDoctype ()
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
- DocumentType dt = doc.getDoctype ();
-
- if (dt == null)
- throw new SAXException ("doctype missing!");
- return (DomDoctype) dt;
- }
-
- // SAX2 "lexical" event
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
-
- super.startDTD (name, publicId, systemId);
- // DOM L2 doctype creation model is bizarre
- DomDoctype dt = new DomDoctype (doc, name, publicId, systemId);
- doc.appendChild (dt);
- }
-
- // SAX2 "lexical" event
- public void endDTD ()
- throws SAXException
- {
- super.endDTD ();
- // DOM L2 has no way to make things readonly
- getDoctype ().makeReadonly ();
- }
-
- // SAX1 DTD event
- public void notationDecl (
- String name,
- String publicId, String systemId
- ) throws SAXException
- {
- // DOM L2 can't create/save notation nodes
- getDoctype ().declareNotation (name, publicId, systemId);
- }
-
- // SAX1 DTD event
- public void unparsedEntityDecl (
- String name,
- String publicId, String systemId,
- String notationName
- ) throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- getDoctype ().declareEntity (name, publicId, systemId,
- notationName);
- }
-
- // SAX2 declaration event
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- // NOTE: this doesn't save the value as a child of this
- // node, though it could realistically do so.
- getDoctype ().declareEntity (name, null, null, null);
- }
-
- // SAX2 declaration event
- public void externalEntityDecl (
- String name,
- String publicId,
- String systemId
- ) throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- // NOTE: DOM allows for these to have children, if
- // they don't have unbound namespace references.
- getDoctype ().declareEntity (name, publicId, systemId, null);
- }
-
- // SAX2 element
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- Node top;
-
- super.startElement (uri, localName, qName, atts);
-
- // might there be more work?
- top = getTop ();
- if (!top.hasAttributes () || !(atts instanceof Attributes2))
- return;
-
- // remember any attributes that got defaulted
- DomNamedNodeMap map = (DomNamedNodeMap) top.getAttributes ();
- Attributes2 attrs = (Attributes2) atts;
- int length = atts.getLength ();
-
- //map.compact ();
- for (int i = 0; i < length; i++) {
- if (attrs.isSpecified (i))
- continue;
-
- // value was defaulted.
- String temp = attrs.getQName (i);
- DomAttr attr;
-
- if ("".equals (temp))
- attr = (DomAttr) map.getNamedItemNS (attrs.getURI (i),
- atts.getLocalName (i));
- else
- attr = (DomAttr) map.getNamedItem (temp);
-
- // DOM L2 can't write this flag, only read it
- attr.setSpecified (false);
- }
- }
-
- public void endElement (
- String uri,
- String localName,
- String qName
- ) throws SAXException
- {
- DomNode top = (DomNode) getTop ();
- top.compact ();
- super.endElement (uri, localName, qName);
- }
-
- protected Text createText (
- boolean isCDATA,
- char buf [],
- int off,
- int len
- ) {
- DomDocument doc = (DomDocument) getDocument ();
-
- if (isCDATA)
- return doc.createCDATASection (buf, off, len);
- else
- return doc.createTextNode (buf, off, len);
- }
-
- public void elementDecl(String name, String model)
- throws SAXException
- {
- getDoctype().elementDecl(name, model);
- }
-
- public void attributeDecl (
- String ename,
- String aname,
- String type,
- String mode,
- String value
- ) throws SAXException
- {
- getDoctype().attributeDecl(ename, aname, type, mode, value);
- /*
- if (value == null && !"ID".equals (type))
- return;
-
- DomDoctype.ElementInfo info;
-
- info = getDoctype ().getElementInfo (ename);
- if (value != null)
- info.setAttrDefault (aname, value);
- if ("ID".equals (type))
- info.setIdAttr (aname);
- */
-
- }
-
- // force duplicate name checking off while we're
- // using parser output (don't duplicate the work)
- public void startDocument () throws SAXException
- {
- super.startDocument ();
-
- DomDocument doc = (DomDocument) getDocument ();
- doc.setStrictErrorChecking(false);
- doc.setBuilding(true);
- }
-
- /**
- * Required by DOM Level 3 to report document parameters
- */
- public void xmlDecl(String version,
- String encoding,
- boolean standalone,
- String inputEncoding)
- throws SAXException
- {
- super.xmlDecl(version, encoding, standalone, inputEncoding);
-
- DomDocument doc = (DomDocument) getDocument();
- doc.setXmlEncoding(encoding);
- doc.setInputEncoding(inputEncoding);
- }
-
- public void endDocument ()
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
- doc.setStrictErrorChecking(true);
- doc.setBuilding(false);
- doc.compact ();
- DomDoctype doctype = (DomDoctype) doc.getDoctype();
- if (doctype != null)
- {
- doctype.makeReadonly();
- }
- super.endDocument ();
- }
-
- // these three methods collaborate to populate entity
- // refs, marking contents readonly on end-of-entity
-
- public boolean canPopulateEntityRefs ()
- { return true; }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- super.startEntity (name);
-
- DomNode top = (DomNode) getTop ();
-
- if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE)
- top.readonly = false;
- }
-
- public void endEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- DomNode top = (DomNode) getTop ();
-
- if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE) {
- top.compact ();
- top.makeReadonly ();
- }
- super.endEntity (name);
- }
- }
-}
diff --git a/libjava/gnu/xml/dom/DTDAttributeTypeInfo.java b/libjava/gnu/xml/dom/DTDAttributeTypeInfo.java
deleted file mode 100644
index e3c69c43ecb..00000000000
--- a/libjava/gnu/xml/dom/DTDAttributeTypeInfo.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* DTDAttributeTypeInfo.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.TypeInfo;
-
-/**
- * Attribute type information supplied by a DTD attribute declaration.
- *
- * @author Chris Burdess
- */
-class DTDAttributeTypeInfo
- implements TypeInfo
-{
-
- final String elementName;
- final String name;
- final String type;
- final String mode;
- final String value;
-
- DTDAttributeTypeInfo(String elementName, String name, String type,
- String mode, String value)
- {
- this.elementName = elementName;
- this.name = name;
- this.type = type;
- this.mode = mode;
- this.value = value;
- }
-
- public final String getTypeName()
- {
- return type;
- }
-
- public final String getTypeNamespace()
- {
- return "http://www.w3.org/TR/REC-xml";
- }
-
- public final boolean isDerivedFrom(String typeNamespace, String typeName,
- int derivationMethod)
- {
- return false;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DTDElementTypeInfo.java b/libjava/gnu/xml/dom/DTDElementTypeInfo.java
deleted file mode 100644
index c5553e20e62..00000000000
--- a/libjava/gnu/xml/dom/DTDElementTypeInfo.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/* DTDElementTypeInfo.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import org.w3c.dom.TypeInfo;
-
-/**
- * Element type information provided by a DTD element declaration.
- *
- * @author Chris Burdess
- */
-class DTDElementTypeInfo
- implements TypeInfo
-{
-
- final String name;
- String model;
- HashMap attributes;
- String idAttrName;
-
- DTDElementTypeInfo(String name, String model)
- {
- this.name = name;
- this.model = model;
- }
-
- public final String getTypeName()
- {
- return null;
- }
-
- public final String getTypeNamespace()
- {
- return "http://www.w3.org/TR/REC-xml";
- }
-
- public final boolean isDerivedFrom(String typeNamespace, String typeName,
- int derivationMethod)
- {
- return false;
- }
-
- DTDAttributeTypeInfo getAttributeTypeInfo(String name)
- {
- if (attributes == null)
- {
- return null;
- }
- return (DTDAttributeTypeInfo) attributes.get(name);
- }
-
- void setAttributeTypeInfo(String name, DTDAttributeTypeInfo info)
- {
- if (attributes == null)
- {
- attributes = new HashMap();
- }
- attributes.put(name, info);
- if ("ID".equals(info.type))
- {
- idAttrName = name;
- }
- }
-
- Iterator attributes()
- {
- if (attributes == null)
- {
- return null;
- }
- return attributes.values().iterator();
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomAttr.java b/libjava/gnu/xml/dom/DomAttr.java
deleted file mode 100644
index 8673a796161..00000000000
--- a/libjava/gnu/xml/dom/DomAttr.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/* DomAttr.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.TypeInfo;
-import org.w3c.dom.events.MutationEvent;
-
-
-/**
- * "Attr" implementation. In DOM, attributes cost quite a lot of
- * memory because their values are complex structures rather than just
- * simple strings. To reduce your costs, avoid having more than one
- * child of an attribute; stick to a single Text node child, and ignore
- * even that by using the attribute's "nodeValue" property. As a bit of general advice, only look at attribute modification
- * events through the DOMAttrModified event (sent to the associated
- * element). Implementations are not guaranteed to report other events
- * in the same order, so you're very likely to write nonportable code if
- * you monitor events at the "children of Attr" level. At this writing, not all attribute modifications will cause the
- * DOMAttrModified event to be triggered ... only the ones using the string
- * methods (setNodeValue, setValue, and Element.setAttribute) to modify
- * those values. That is, if you manipulate those children directly,
- * elements won't get notified that attribute values have changed.
- * The natural fix for that will report other modifications, but won't
- * be able to expose "previous" attribute value; it'll need to be cached
- * or something (at which point why bother using child nodes). You are strongly advised not to use "children" of any attribute
- * nodes you work with. This constructor should only be invoked by a Document as part of
- * its createAttribute functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this node is associated
- * @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of attribute
- * @param name Name of this attribute, which may include a prefix
- */
- protected DomAttr(DomDocument owner, String namespaceURI, String name)
- {
- super(ATTRIBUTE_NODE, owner, namespaceURI, name);
- specified = true;
- length = 1;
-
- // XXX register self to get insertion/removal events
- // and character data change events and when they happen,
- // report self-mutation
- }
-
- /**
- * DOM L1
- * Returns the attribute name (same as getNodeName)
- */
- public final String getName()
- {
- return getNodeName();
- }
-
- /**
- * DOM L1
- * Returns true if a parser reported this was in the source text.
- */
- public final boolean getSpecified()
- {
- return specified;
- }
-
- /**
- * Records whether this attribute was in the source text.
- */
- public final void setSpecified(boolean value)
- {
- specified = value;
- }
-
- /**
- * DOM L1
- * Returns the attribute value, with character and entity
- * references substituted.
- * NOTE: entity refs as children aren't currently handled.
- */
- public String getNodeValue()
- {
- // If we have a simple node-value, use that
- if (first == null)
- {
- return (value == null) ? "" : value;
- }
- // Otherwise collect child node-values
- StringBuffer buf = new StringBuffer();
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- switch (ctx.nodeType)
- {
- case Node.TEXT_NODE:
- buf.append(ctx.getNodeValue());
- break;
- case Node.ENTITY_REFERENCE_NODE:
- // TODO
- break;
- }
- }
- return buf.toString();
- }
-
- /**
- * DOM L1
- * Assigns the value of the attribute; it will have one child,
- * which is a text node with the specified value (same as
- * setNodeValue).
- */
- public final void setValue(String value)
- {
- setNodeValue(value);
- }
-
- /**
- * DOM L1
- * Returns the value of the attribute as a non-null string; same
- * as getNodeValue.
- * NOTE: entity refs as children aren't currently handled.
- */
- public final String getValue()
- {
- return getNodeValue();
- }
-
- /**
- * DOM L1
- * Assigns the attribute value; using this API, no entity or
- * character references will exist.
- * Causes a DOMAttrModified mutation event to be sent.
- */
- public void setNodeValue(String value)
- {
- if (readonly)
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- if (value == null)
- {
- value = "";
- }
- String oldValue = getNodeValue();
- while (last != null)
- {
- removeChild(last);
- }
- // don't create a new node just for this...
- /*
- Node text = owner.createTextNode(value);
- appendChild(text);
- */
- this.value = value;
- length = 1;
- specified = true;
-
- mutating(oldValue, value, MutationEvent.MODIFICATION);
- }
-
- public final Node getFirstChild()
- {
- // Create a child text node if necessary
- if (first == null)
- {
- length = 0;
- Node text = owner.createTextNode((value == null) ? "" : value);
- appendChild(text);
- }
- return first;
- }
-
- public final Node getLastChild()
- {
- // Create a child text node if necessary
- if (last == null)
- {
- length = 0;
- Node text = owner.createTextNode((value == null) ? "" : value);
- appendChild(text);
- }
- return last;
- }
-
- public Node item(int index)
- {
- // Create a child text node if necessary
- if (first == null)
- {
- length = 0;
- Node text = owner.createTextNode((value == null) ? "" : value);
- appendChild(text);
- }
- return super.item(index);
- }
-
- /**
- * DOM L2
- * Returns the element with which this attribute is associated.
- */
- public final Element getOwnerElement()
- {
- return (Element) parent;
- }
-
- public final Node getNextSibling()
- {
- return null;
- }
-
- public final Node getPreviousSibling()
- {
- return null;
- }
-
- public Node getParentNode()
- {
- return null;
- }
-
- /**
- * Records the element with which this attribute is associated.
- */
- public final void setOwnerElement(Element e)
- {
- if (parent != null)
- {
- throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR);
- }
- if (!(e instanceof DomElement))
- {
- throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR);
- }
- parent = (DomElement) e;
- depth = parent.depth + 1;
- }
-
- /**
- * The base URI of an Attr is always "CDATASection" implementation.
- * This is a non-core DOM class, supporting the "XML" feature.
- * CDATA sections are just ways to represent text using different
- * delimeters. You are strongly advised not to use CDATASection nodes.
- * The advantage of having slightly prettier ways to print text that may
- * have lots of embedded XML delimiters, such as "&" and "<",
- * can be dwarfed by the cost of dealing with multiple kinds of text
- * nodes in all your algorithms. This constructor should only be invoked by a Document as part of
- * its createCDATASection functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- */
- protected DomCDATASection(DomDocument owner, String value)
- {
- super(CDATA_SECTION_NODE, owner, value);
- }
-
- protected DomCDATASection(DomDocument owner, char buf [], int off, int len)
- {
- super(CDATA_SECTION_NODE, owner, buf, off, len);
- }
-
- /**
- * DOM L1
- * Returns the string "#cdata-section".
- */
- final public String getNodeName()
- {
- return "#cdata-section";
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomCharacterData.java b/libjava/gnu/xml/dom/DomCharacterData.java
deleted file mode 100644
index e94dcc4ecf9..00000000000
--- a/libjava/gnu/xml/dom/DomCharacterData.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/* DomCharacterData.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.CharacterData;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.events.MutationEvent;
-
-
-/**
- * Abstract "CharacterData" implementation. This
- * facilitates reusing code in classes implementing subtypes of that DOM
- * interface (Text, Comment, CDATASection). "Comment" implementation.
- * Comments hold data intended for direct consumption by people;
- * programs should only use ProcessingInstruction nodes. Note that
- * since SAX makes comment reporting optional, XML systems that
- * rely on comments (such as by using this class) will often lose
- * those comments at some point in the processing pipeline. This constructor should only be invoked by a Document as part of
- * its createComment functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- */
- protected DomComment(DomDocument owner, String value)
- {
- super(COMMENT_NODE, owner, value);
- }
-
- /**
- * DOM L1
- * Returns the string "#comment".
- */
- final public String getNodeName()
- {
- return "#comment";
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomDOMException.java b/libjava/gnu/xml/dom/DomDOMException.java
deleted file mode 100644
index cf93fcf9749..00000000000
--- a/libjava/gnu/xml/dom/DomDOMException.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/* DomDOMException.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-
-/**
- * DOMException implementation. The version that
- * is provided by the W3C is abstract, so it can't be instantiated.
- *
- * This also provides a bit more information about the error
- * that is being reported, in terms of the relevant DOM structures
- * and data.
- *
- * @author David Brownell
- */
-public class DomDOMException
- extends DOMException
-{
-
- /** @serial Data that caused an error to be reported */
- private String data;
-
- /** @serial Node associated with the error. */
- private Node node;
-
- /** @serial Data associated with the error. */
- private int value;
-
- /**
- * Constructs an exception, with the diagnostic message
- * corresponding to the specified code.
- */
- public DomDOMException(short code)
- {
- super(code, diagnostic(code));
- }
-
- /**
- * Constructs an exception, with the diagnostic message
- * corresponding to the specified code and additional
- * information as provided.
- */
- public DomDOMException(short code, String data, Node node, int value)
- {
- super(code, diagnostic(code));
- this.data = data;
- this.node = node;
- this.value = value;
- }
-
- /** Returns the node to which the diagnotic applies, or null. */
- final public Node getNode()
- {
- return node;
- }
-
- /** Returns data to which the diagnotic applies, or null. */
- final public String getData()
- {
- return data;
- }
-
- /** Returns data to which the diagnotic applies, or null. */
- final public int getValue()
- {
- return value;
- }
-
- /**
- * Returns a diagnostic message that may be slightly more useful
- * than the generic one, where possible.
- */
- public String getMessage()
- {
- String retval = super.getMessage();
-
- if (data != null)
- {
- retval += "\nMore Information: " + data;
- }
- if (value != 0)
- {
- retval += "\nNumber: " + value;
- }
- if (node != null)
- {
- retval += "\nNode Name: " + node.getNodeName();
- }
- return retval;
- }
-
- // these strings should be localizable.
-
- private static String diagnostic(short code)
- {
- switch (code)
- {
- // DOM L1:
- case INDEX_SIZE_ERR:
- return "An index or size is out of range.";
- case DOMSTRING_SIZE_ERR:
- return "A string is too big.";
- case HIERARCHY_REQUEST_ERR:
- return "The node doesn't belong here.";
- case WRONG_DOCUMENT_ERR:
- return "The node belongs in another document.";
- case INVALID_CHARACTER_ERR:
- return "That character is not permitted.";
- case NO_DATA_ALLOWED_ERR:
- return "This node does not permit data.";
- case NO_MODIFICATION_ALLOWED_ERR:
- return "No changes are allowed.";
- case NOT_FOUND_ERR:
- return "The node was not found in that context.";
- case NOT_SUPPORTED_ERR:
- return "That object is not supported.";
- case INUSE_ATTRIBUTE_ERR:
- return "The attribute belongs to a different element.";
-
- // DOM L2:
- case INVALID_STATE_ERR:
- return "The object is not usable.";
- case SYNTAX_ERR:
- return "An illegal string was provided.";
- case INVALID_MODIFICATION_ERR:
- return "An object's type may not be changed.";
- case NAMESPACE_ERR:
- return "The operation violates XML Namespaces.";
- case INVALID_ACCESS_ERR:
- return "Parameter or operation isn't supported by this node.";
- case TYPE_MISMATCH_ERR:
- return "The type of the argument is incompatible with the expected type.";
- }
- return "Reserved exception number: " + code;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomDoctype.java b/libjava/gnu/xml/dom/DomDoctype.java
deleted file mode 100644
index d35eedc7f75..00000000000
--- a/libjava/gnu/xml/dom/DomDoctype.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/* DomDoctype.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.HashMap;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Entity;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.Notation;
-
-/**
- * "DocumentType" implementation (with no extensions for supporting
- * any document typing information). This is a non-core DOM class,
- * supporting the "XML" feature. Few XML applications will actually care about this partial
- * DTD support, since it doesn't expose any (!) of the data typing
- * facilities which can motivate applications to use DTDs. It does not
- * expose element content models, or information about attribute typing
- * rules. Plus the information it exposes isn't very useful; as one example,
- * DOM exposes information about unparsed ENTITY objects, which is only used
- * with certain element attributes, but does not expose the information about
- * those attributes which is needed to apply that data! Also, note that there are no nonportable ways to associate even the
- * notation and entity information exposed by DOM with a DocumentType. While
- * there is a DOM L2 method to construct a DocumentType, it only gives access
- * to the textual content of the <!DOCTYPE ...> declaration. In short, you are strongly advised not to rely on this incomplete
- * DTD functionality in your application code. This constructor should only be invoked by a DOMImplementation as
- * part of its createDocumentType functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
- *
- * Note that at this time there is no standard SAX API granting
- * access to the internal subset text, so that relying on that value
- * is not currently portable.
- *
- * @param impl The implementation with which this object is associated
- * @param name Name of this root element
- * @param publicId If non-null, provides the external subset's
- * PUBLIC identifier
- * @param systemId If non-null, provides the external subset's
- * SYSTEM identifier
- * @param internalSubset Provides the literal value (unparsed, no
- * entities expanded) of the DTD's internal subset.
- */
- protected DomDoctype(DOMImplementation impl,
- String name,
- String publicId,
- String systemId,
- String internalSubset)
- {
- super(DOCUMENT_TYPE_NODE, null, name, publicId, systemId);
- implementation = impl;
- subset = internalSubset;
- }
-
- /**
- * JAXP builder constructor.
- * @param doc the document
- * @param name the name of the document element
- * @param publicId the public ID of the document type declaration
- * @param systemId the system ID of the document type declaration
- */
- public DomDoctype(DomDocument doc,
- String name,
- String publicId,
- String systemId)
- {
- super(DOCUMENT_TYPE_NODE, doc, name, publicId, systemId);
- implementation = doc.getImplementation();
- }
-
- /**
- * DOM L1
- * Returns the root element's name (just like getNodeName).
- */
- final public String getName()
- {
- return getNodeName();
- }
-
- /**
- * DOM L1
- * Returns information about any general entities declared
- * in the DTD.
- *
- * Note: DOM L1 doesn't throw a DOMException here, but
- * then it doesn't have the strange construction rules of L2.
- *
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public NamedNodeMap getEntities()
- {
- if (entities == null)
- {
- entities = new DomNamedNodeMap(this, Node.ENTITY_NODE);
- }
- return entities;
- }
-
- /**
- * Records the declaration of a general entity in this DocumentType.
- *
- * @param name Name of the entity
- * @param publicId If non-null, provides the entity's PUBLIC identifier
- * @param systemId Provides the entity's SYSTEM identifier
- * @param notation If non-null, provides the entity's notation
- * (indicating an unparsed entity)
- * @return The Entity that was declared, or null if the entity wasn't
- * recorded (because it's a parameter entity or because an entity with
- * this name was already declared).
- *
- * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
- * DocumentType is no longer writable.
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public Entity declareEntity(String name,
- String publicId,
- String systemId,
- String notation)
- {
- DomEntity entity;
-
- if (name.charAt(0) == '%' || "[dtd]".equals(name))
- {
- return null;
- }
- if (isReadonly())
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- getEntities();
-
- DomDocument.checkName(name, (owner != null) ?
- "1.1".equals(owner.getXmlVersion()) : false);
- if (entities.getNamedItem(name) != null)
- {
- return null;
- }
-
- entity = new DomEntity(owner, name, publicId, systemId, notation);
- entities.setNamedItem(entity);
- return entity;
- }
-
- /**
- * DOM L1
- * Returns information about any notations declared in the DTD.
- *
- * Note: DOM L1 doesn't throw a DOMException here, but
- * then it doesn't have the strange construction rules of L2.
- *
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public NamedNodeMap getNotations()
- {
- if (notations == null)
- {
- notations = new DomNamedNodeMap(this, Node.NOTATION_NODE);
- }
- return notations;
- }
-
- /**
- * Records the declaration of a notation in this DocumentType.
- *
- * @param name Name of the notation
- * @param publicId If non-null, provides the notation's PUBLIC identifier
- * @param systemId If non-null, provides the notation's SYSTEM identifier
- * @return The notation that was declared.
- *
- * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
- * DocumentType is no longer writable.
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public Notation declareNotation(String name,
- String publicId,
- String systemId)
- {
- DomNotation notation;
-
- if (isReadonly())
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- getNotations();
-
- DomDocument.checkName(name, (owner != null) ?
- "1.1".equals(owner.getXmlVersion()) : false);
-
- notation = new DomNotation(owner, name, publicId, systemId);
- notations.setNamedItem(notation);
- return notation;
- }
-
- /**
- * DOM L2
- * Returns the internal subset of the document, as a string of unparsed
- * XML declarations (and comments, PIs, whitespace); or returns null if
- * there is no such subset. There is no vendor-independent expectation
- * that this attribute be set, or that declarations found in it be
- * reflected in the entities or notations attributes
- * of this Document "Type" object.
- *
- * Some application-specific XML profiles require that documents
- * only use specific PUBLIC identifiers, without an internal subset
- * to modify the interperetation of the declarations associated with
- * that PUBLIC identifier through some standard.
- */
- public String getInternalSubset()
- {
- return subset;
- }
-
- /**
- * The base URI of a DocumentType is always "Document" and "DocumentTraversal" implementation.
- *
- * Note that when this checks names for legality, it uses an
- * approximation of the XML rules, not the real ones. Specifically,
- * it uses Unicode rules, with sufficient tweaks to pass a majority
- * of basic XML conformance tests. (The huge XML character tables are
- * hairy to implement.)
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public class DomDocument
- extends DomNode
- implements Document, DocumentTraversal, XPathEvaluator
-{
-
- private final DOMImplementation implementation;
- private boolean checkingCharacters = true;
- boolean checkingWellformedness = true;
-
- boolean building; // if true, skip mutation events in the tree
-
- DomDocumentConfiguration config;
-
- String inputEncoding;
- String encoding;
- String version = "1.0";
- boolean standalone;
- String systemId;
-
- /**
- * Constructs a Document node, associating it with an instance
- * of the DomImpl class.
- *
- * Note that this constructor disables character checking.
- * It is normally used when connecting a DOM to an XML parser,
- * and duplicating such checks is undesirable. When used for
- * purposes other than connecting to a parser, you should
- * re-enable that checking.
- *
- * @see #setCheckingCharacters
- */
- public DomDocument()
- {
- this(new DomImpl());
- }
-
- /**
- * Constructs a Document node, associating it with the specified
- * implementation. This should only be used in conjunction with
- * a specialized implementation; it will normally be called by
- * that implementation.
- *
- * @see DomImpl
- * @see #setCheckingCharacters
- */
- protected DomDocument(DOMImplementation impl)
- {
- super(DOCUMENT_NODE, null);
- implementation = impl;
- }
-
- /**
- * Sets the Returns null unless {@link Consumer} was used to populate internal
- * DTD declaration information, using package-private APIs. If that
- * internal DTD information is available, the document may be searched for
- * the element with that ID.
- */
- public Element getElementById(String id)
- {
- DomDoctype doctype = (DomDoctype) getDoctype();
-
- if (doctype == null || !doctype.hasIds()
- || id == null || id.length() == 0)
- {
- return null;
- }
-
- // yes, this is linear in size of document.
- // it'd be easy enough to maintain a hashtable.
- Node current = getDocumentElement();
- Node temp;
-
- if (current == null)
- {
- return null;
- }
- while (current != this)
- {
- // done?
- if (current.getNodeType() == ELEMENT_NODE)
- {
- DomElement element = (DomElement) current;
- DTDElementTypeInfo info =
- doctype.getElementTypeInfo(current.getNodeName());
- if (info != null &&
- id.equals(element.getAttribute(info.idAttrName)))
- {
- return element;
- }
- else if (element.userIdAttrs != null)
- {
- for (Iterator i = element.userIdAttrs.iterator();
- i.hasNext(); )
- {
- Node idAttr = (Node) i.next();
- if (id.equals(idAttr.getNodeValue()))
- {
- return element;
- }
- }
- }
- }
-
- // descend?
- if (current.hasChildNodes())
- {
- current = current.getFirstChild();
- continue;
- }
-
- // lateral?
- temp = current.getNextSibling();
- if (temp != null)
- {
- current = temp;
- continue;
- }
-
- // back up ...
- do
- {
- temp = current.getParentNode();
- if (temp == null)
- {
- return null;
- }
- current = temp;
- temp = current.getNextSibling();
- }
- while (temp == null);
- current = temp;
- }
- return null;
- }
-
- private void checkNewChild(Node newChild)
- {
- if (newChild.getNodeType() == ELEMENT_NODE
- && getDocumentElement() != null)
- {
- throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR,
- "document element already present: " +
- getDocumentElement(), newChild, 0);
- }
- if (newChild.getNodeType() == DOCUMENT_TYPE_NODE
- && getDoctype() != null)
- {
- throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR,
- "document type already present: " +
- getDoctype(), newChild, 0);
- }
- }
-
- /**
- * DOM L1
- * Appends the specified node to this node's list of children,
- * enforcing the constraints that there be only one root element
- * and one document type child.
- */
- public Node appendChild(Node newChild)
- {
- if (checkingWellformedness)
- {
- checkNewChild(newChild);
- }
- return super.appendChild(newChild);
- }
-
- /**
- * DOM L1
- * Inserts the specified node in this node's list of children,
- * enforcing the constraints that there be only one root element
- * and one document type child.
- */
- public Node insertBefore(Node newChild, Node refChild)
- {
- if (checkingWellformedness)
- {
- checkNewChild(newChild);
- }
- return super.insertBefore(newChild, refChild);
- }
-
- /**
- * DOM L1
- * Replaces the specified node in this node's list of children,
- * enforcing the constraints that there be only one root element
- * and one document type child.
- */
- public Node replaceChild(Node newChild, Node refChild)
- {
- if (checkingWellformedness &&
- ((newChild.getNodeType() == ELEMENT_NODE &&
- refChild.getNodeType() != ELEMENT_NODE) ||
- (newChild.getNodeType() == DOCUMENT_TYPE_NODE &&
- refChild.getNodeType() != DOCUMENT_TYPE_NODE)))
- {
- checkNewChild(newChild);
- }
- return super.replaceChild(newChild, refChild);
- }
-
- // NOTE: DOM can't really tell when the name of an entity,
- // notation, or PI must follow the namespace rules (excluding
- // colons) instead of the XML rules (which allow them without
- // much restriction). That's an API issue. verifyXmlName
- // aims to enforce the XML rules, not the namespace rules.
-
- /**
- * Throws a DOM exception if the specified name is not a legal XML 1.0
- * Name.
- * @deprecated This method is deprecated and may be removed in future
- * versions of GNU JAXP
- */
- public static void verifyXmlName(String name)
- {
- // XXX why is this public?
- checkName(name, false);
- }
-
- static void checkName(String name, boolean xml11)
- {
- if (name == null)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0);
- }
- int len = name.length();
- if (len == 0)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0);
- }
-
- // dog: rewritten to use the rules for XML 1.0 and 1.1
-
- // Name start character
- char c = name.charAt(0);
- if (xml11)
- {
- // XML 1.1
- if ((c < 0x0041 || c > 0x005a) &&
- (c < 0x0061 || c > 0x007a) &&
- c != ':' && c != '_' &&
- (c < 0x00c0 || c > 0x00d6) &&
- (c < 0x00d8 || c > 0x00f6) &&
- (c < 0x00f8 || c > 0x02ff) &&
- (c < 0x0370 || c > 0x037d) &&
- (c < 0x037f || c > 0x1fff) &&
- (c < 0x200c || c > 0x200d) &&
- (c < 0x2070 || c > 0x218f) &&
- (c < 0x2c00 || c > 0x2fef) &&
- (c < 0x3001 || c > 0xd7ff) &&
- (c < 0xf900 || c > 0xfdcf) &&
- (c < 0xfdf0 || c > 0xfffd) &&
- (c < 0x10000 || c > 0xeffff))
- {
- throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR,
- name, null, c);
- }
- }
- else
- {
- // XML 1.0
- int type = Character.getType(c);
- switch (type)
- {
- case Character.LOWERCASE_LETTER: // Ll
- case Character.UPPERCASE_LETTER: // Lu
- case Character.OTHER_LETTER: // Lo
- case Character.TITLECASE_LETTER: // Lt
- case Character.LETTER_NUMBER: // Nl
- if ((c > 0xf900 && c < 0xfffe) ||
- (c >= 0x20dd && c <= 0x20e0))
- {
- // Compatibility area and Unicode 2.0 exclusions
- throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR,
- name, null, c);
- }
- break;
- default:
- if (c != ':' && c != '_' && (c < 0x02bb || c > 0x02c1) &&
- c != 0x0559 && c != 0x06e5 && c != 0x06e6)
- {
- throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR,
- name, null, c);
- }
- }
- }
-
- // Subsequent characters
- for (int i = 1; i < len; i++)
- {
- c = name.charAt(i);
- if (xml11)
- {
- // XML 1.1
- if ((c < 0x0041 || c > 0x005a) &&
- (c < 0x0061 || c > 0x007a) &&
- (c < 0x0030 || c > 0x0039) &&
- c != ':' && c != '_' && c != '-' && c != '.' &&
- (c < 0x00c0 || c > 0x00d6) &&
- (c < 0x00d8 || c > 0x00f6) &&
- (c < 0x00f8 || c > 0x02ff) &&
- (c < 0x0370 || c > 0x037d) &&
- (c < 0x037f || c > 0x1fff) &&
- (c < 0x200c || c > 0x200d) &&
- (c < 0x2070 || c > 0x218f) &&
- (c < 0x2c00 || c > 0x2fef) &&
- (c < 0x3001 || c > 0xd7ff) &&
- (c < 0xf900 || c > 0xfdcf) &&
- (c < 0xfdf0 || c > 0xfffd) &&
- (c < 0x10000 || c > 0xeffff) &&
- c != 0x00b7 &&
- (c < 0x0300 || c > 0x036f) &&
- (c < 0x203f || c > 0x2040))
- {
- throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, name,
- null, c);
- }
- }
- else
- {
- // XML 1.0
- int type = Character.getType(c);
- switch (type)
- {
- case Character.LOWERCASE_LETTER: // Ll
- case Character.UPPERCASE_LETTER: // Lu
- case Character.DECIMAL_DIGIT_NUMBER: // Nd
- case Character.OTHER_LETTER: // Lo
- case Character.TITLECASE_LETTER: // Lt
- case Character.LETTER_NUMBER: // Nl
- case Character.COMBINING_SPACING_MARK: // Mc
- case Character.ENCLOSING_MARK: // Me
- case Character.NON_SPACING_MARK: // Mn
- case Character.MODIFIER_LETTER: // Lm
- if ((c > 0xf900 && c < 0xfffe) ||
- (c >= 0x20dd && c <= 0x20e0))
- {
- // Compatibility area and Unicode 2.0 exclusions
- throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR,
- name, null, c);
- }
- break;
- default:
- if (c != '-' && c != '.' && c != ':' && c != '_' &&
- c != 0x0387 && (c < 0x02bb || c > 0x02c1) &&
- c != 0x0559 && c != 0x06e5 && c != 0x06e6 && c != 0x00b7)
- {
- throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR,
- name, null, c);
- }
- }
- }
- }
-
- // FIXME characters with a font or compatibility decomposition (i.e.
- // those with a "compatibility formatting tag" in field 5 of the
- // database -- marked by field 5 beginning with a "<") are not allowed.
- }
-
- // package private
- static void checkNCName(String name, boolean xml11)
- {
- checkName(name, xml11);
- int len = name.length();
- int index = name.indexOf(':');
- if (index != -1)
- {
- if (index == 0 || index == (len - 1) ||
- name.lastIndexOf(':') != index)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- name, null, 0);
- }
- }
- }
-
- // package private
- static void checkChar(String value, boolean xml11)
- {
- char[] chars = value.toCharArray();
- checkChar(chars, 0, chars.length, xml11);
- }
-
- static void checkChar(char[] buf, int off, int len, boolean xml11)
- {
- for (int i = 0; i < len; i++)
- {
- char c = buf[i];
-
- // assume surrogate pairing checks out OK, for simplicity
- if ((c >= 0x0020 && c <= 0xd7ff) ||
- (c == 0x000a || c == 0x000d || c == 0x0009) ||
- (c >= 0xe000 && c <= 0xfffd) ||
- (c >= 0x10000 && c <= 0x10ffff))
- {
- continue;
- }
- if (xml11)
- {
- if ((c >= 0x0001 && c <= 0x001f) ||
- (c >= 0x007f && c <= 0x0084) ||
- (c >= 0x0086 && c <= 0x009f))
- {
- continue;
- }
- }
- throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR,
- new String(buf, off, len), null, c);
- }
- }
-
- /**
- * DOM L1
- * Returns a newly created element with the specified name.
- */
- public Element createElement(String name)
- {
- Element element;
-
- if (checkingCharacters)
- {
- checkName(name, "1.1".equals(version));
- }
- if (name.startsWith("xml:"))
- {
- element = createElementNS(null, name);
- }
- else
- {
- element = new DomElement(this, null, name);
- }
- defaultAttributes(element, name);
- return element;
- }
-
- /**
- * DOM L2
- * Returns a newly created element with the specified name
- * and namespace information.
- */
- public Element createElementNS(String namespaceURI, String name)
- {
- if (checkingCharacters)
- {
- checkNCName(name, "1.1".equals(version));
- }
-
- if ("".equals(namespaceURI))
- {
- namespaceURI = null;
- }
- if (name.startsWith("xml:"))
- {
- if (namespaceURI != null
- && !XMLConstants.XML_NS_URI.equals(namespaceURI))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xml namespace is always " +
- XMLConstants.XML_NS_URI, this, 0);
- }
- namespaceURI = XMLConstants.XML_NS_URI;
- }
- else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) ||
- name.startsWith("xmlns:"))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xmlns is reserved", this, 0);
- }
- else if (namespaceURI == null && name.indexOf(':') != -1)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "prefixed name '" + name +
- "' needs a URI", this, 0);
- }
-
- Element element = new DomElement(this, namespaceURI, name);
- defaultAttributes(element, name);
- return element;
- }
-
- private void defaultAttributes(Element element, String name)
- {
- DomDoctype doctype = (DomDoctype) getDoctype();
- if (doctype == null)
- {
- return;
- }
-
- // default any attributes that need it
- DTDElementTypeInfo info = doctype.getElementTypeInfo(name);
- if (info != null)
- {
- for (Iterator i = info.attributes(); i != null && i.hasNext(); )
- {
- DTDAttributeTypeInfo attr = (DTDAttributeTypeInfo) i.next();
- DomAttr node = (DomAttr) createAttribute(attr.name);
-
- String value = attr.value;
- if (value == null)
- {
- value = "";
- }
- node.setValue(value);
- node.setSpecified(false);
- element.setAttributeNode(node);
- }
- }
- }
-
- /**
- * DOM L1
- * Returns a newly created document fragment.
- */
- public DocumentFragment createDocumentFragment()
- {
- return new DomDocumentFragment(this);
- }
-
- /**
- * DOM L1
- * Returns a newly created text node with the specified value.
- */
- public Text createTextNode(String value)
- {
- if (checkingCharacters)
- {
- checkChar(value, "1.1".equals(version));
- }
- return new DomText(this, value);
- }
-
- /**
- * Returns a newly created text node with the specified value.
- */
- public Text createTextNode(char[] buf, int off, int len)
- {
- if (checkingCharacters)
- {
- checkChar(buf, off, len, "1.1".equals(version));
- }
- return new DomText(this, buf, off, len);
- }
-
- /**
- * DOM L1
- * Returns a newly created comment node with the specified value.
- */
- public Comment createComment(String value)
- {
- if (checkingCharacters)
- {
- checkChar(value, "1.1".equals(version));
- }
- return new DomComment(this, value);
- }
-
- /**
- * DOM L1
- * Returns a newly created CDATA section node with the specified value.
- */
- public CDATASection createCDATASection(String value)
- {
- if (checkingCharacters)
- {
- checkChar(value, "1.1".equals(version));
- }
- return new DomCDATASection(this, value);
- }
-
- /**
- * Returns a newly created CDATA section node with the specified value.
- */
- public CDATASection createCDATASection(char[] buf, int off, int len)
- {
- if (checkingCharacters)
- {
- checkChar(buf, off, len, "1.1".equals(version));
- }
- return new DomCDATASection(this, buf, off, len);
- }
-
- /**
- * DOM L1
- * Returns a newly created processing instruction.
- */
- public ProcessingInstruction createProcessingInstruction(String target,
- String data)
- {
- if (checkingCharacters)
- {
- boolean xml11 = "1.1".equals(version);
- checkName(target, xml11);
- if ("xml".equalsIgnoreCase(target))
- {
- throw new DomDOMException(DOMException.SYNTAX_ERR,
- "illegal PI target name",
- this, 0);
- }
- checkChar(data, xml11);
- }
- return new DomProcessingInstruction(this, target, data);
- }
-
- /**
- * DOM L1
- * Returns a newly created attribute with the specified name.
- */
- public Attr createAttribute(String name)
- {
- if (checkingCharacters)
- {
- checkName(name, "1.1".equals(version));
- }
- if (name.startsWith("xml:"))
- {
- return createAttributeNS(XMLConstants.XML_NS_URI, name);
- }
- else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) ||
- name.startsWith("xmlns:"))
- {
- return createAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, name);
- }
- else
- {
- return new DomAttr(this, null, name);
- }
- }
-
- /**
- * DOM L2
- * Returns a newly created attribute with the specified name
- * and namespace information.
- */
- public Attr createAttributeNS(String namespaceURI, String name)
- {
- if (checkingCharacters)
- {
- checkNCName(name, "1.1".equals(version));
- }
-
- if ("".equals(namespaceURI))
- {
- namespaceURI = null;
- }
- if (name.startsWith ("xml:"))
- {
- if (namespaceURI == null)
- {
- namespaceURI = XMLConstants.XML_NS_URI;
- }
- else if (!XMLConstants.XML_NS_URI.equals(namespaceURI))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xml namespace is always " +
- XMLConstants.XML_NS_URI,
- this, 0);
- }
- }
- else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) ||
- name.startsWith("xmlns:"))
- {
- if (namespaceURI == null)
- {
- namespaceURI = XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
- }
- else if (!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xmlns namespace must be " +
- XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
- this, 0);
- }
- }
- else if (namespaceURI == null && name.indexOf(':') != -1)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "prefixed name needs a URI: " + name, this, 0);
- }
- return new DomAttr(this, namespaceURI, name);
- }
-
- /**
- * DOM L1
- * Returns a newly created reference to the specified entity.
- * The caller should populate this with the appropriate children
- * and then mark it as readonly.
- *
- * @see DomNode#makeReadonly
- */
- public EntityReference createEntityReference(String name)
- {
- DomEntityReference ret = new DomEntityReference(this, name);
- DocumentType doctype = getDoctype();
- if (doctype != null)
- {
- DomEntity ent = (DomEntity) doctype.getEntities().getNamedItem(name);
- if (ent != null)
- {
- for (DomNode ctx = ent.first; ctx != null; ctx = ctx.next)
- {
- ret.appendChild(ctx.cloneNode(true));
- }
- }
- }
- ret.makeReadonly();
- return ret;
- }
-
- /**
- * DOM L2
- * Makes a copy of the specified node, with all nodes "owned" by
- * this document and with children optionally copied. This type
- * of standard utility has become, well, a standard utility.
- *
- * Note that EntityReference nodes created through this method (either
- * directly, or recursively) never have children, and that there is no
- * portable way to associate them with such children.
- *
- * Note also that there is no requirement that the specified node
- * be associated with a different document. This differs from the
- * cloneNode operation in that the node itself is not given
- * an opportunity to participate, so that any information managed
- * by node subclasses will be lost.
- */
- public Node importNode(Node src, boolean deep)
- {
- Node dst = null;
- switch (src.getNodeType())
- {
- case TEXT_NODE:
- dst = createTextNode(src.getNodeValue());
- break;
- case CDATA_SECTION_NODE:
- dst = createCDATASection(src.getNodeValue());
- break;
- case COMMENT_NODE:
- dst = createComment(src.getNodeValue());
- break;
- case PROCESSING_INSTRUCTION_NODE:
- dst = createProcessingInstruction(src.getNodeName(),
- src.getNodeValue());
- break;
- case NOTATION_NODE:
- // NOTE: There's no standard way to create
- // these, or add them to a doctype. Useless.
- Notation notation = (Notation) src;
- dst = new DomNotation(this, notation.getNodeName(),
- notation.getPublicId(),
- notation.getSystemId());
- break;
- case ENTITY_NODE:
- // NOTE: There's no standard way to create
- // these, or add them to a doctype. Useless.
- Entity entity = (Entity) src;
- dst = new DomEntity(this, entity.getNodeName(),
- entity.getPublicId(),
- entity.getSystemId(),
- entity.getNotationName());
- if (deep)
- {
- for (Node ctx = src.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- dst.appendChild(importNode(ctx, deep));
- }
- }
- break;
- case ENTITY_REFERENCE_NODE:
- dst = createEntityReference(src.getNodeName());
- break;
- case DOCUMENT_FRAGMENT_NODE:
- dst = new DomDocumentFragment(this);
- if (deep)
- {
- for (Node ctx = src.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- dst.appendChild(importNode(ctx, deep));
- }
- }
- break;
- case ATTRIBUTE_NODE:
- String attr_nsuri = src.getNamespaceURI();
- if (attr_nsuri != null)
- {
- dst = createAttributeNS(attr_nsuri, src.getNodeName());
- }
- else
- {
- dst = createAttribute(src.getNodeName());
- }
- // this is _always_ done regardless of "deep" setting
- for (Node ctx = src.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- dst.appendChild(importNode(ctx, false));
- }
- break;
- case ELEMENT_NODE:
- String elem_nsuri = src.getNamespaceURI();
- if (elem_nsuri != null)
- {
- dst = createElementNS(elem_nsuri, src.getNodeName());
- }
- else
- {
- dst = createElement(src.getNodeName());
- }
- NamedNodeMap srcAttrs = src.getAttributes();
- NamedNodeMap dstAttrs = dst.getAttributes();
- int len = srcAttrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Attr a = (Attr) srcAttrs.item(i);
- Attr dflt;
-
- // maybe update defaulted attributes
- dflt = (Attr) dstAttrs.getNamedItem(a.getNodeName());
- if (dflt != null)
- {
- String newval = a.getNodeValue();
- if (!dflt.getNodeValue().equals(newval)
- || a.getSpecified () == true)
- {
- dflt.setNodeValue (newval);
- }
- continue;
- }
-
- dstAttrs.setNamedItem((Attr) importNode(a, false));
- }
- if (deep)
- {
- for (Node ctx = src.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- dst.appendChild(importNode(ctx, true));
- }
- }
- break;
- // can't import document or doctype nodes
- case DOCUMENT_NODE:
- case DOCUMENT_TYPE_NODE:
- // FALLTHROUGH
- // can't import unrecognized or nonstandard nodes
- default:
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, src, 0);
- }
-
- // FIXME cleanup a bit -- for deep copies, copy those
- // children in one place, here (code sharing is healthy)
-
- if (src instanceof DomNode)
- {
- ((DomNode) src).notifyUserDataHandlers(UserDataHandler.NODE_IMPORTED,
- src, dst);
- }
- return dst;
- }
-
- /**
- * DOM L2 (Traversal)
- * Returns a newly created node iterator. Don't forget to detach
- * this iterator when you're done using it!
- *
- * @see DomIterator
- */
- public NodeIterator createNodeIterator(Node root,
- int whatToShow,
- NodeFilter filter,
- boolean expandEntities)
- {
- return new DomNodeIterator(root, whatToShow, filter, expandEntities,
- false);
- }
-
- public TreeWalker createTreeWalker(Node root,
- int whatToShow,
- NodeFilter filter,
- boolean expandEntities)
- {
- return new DomNodeIterator(root, whatToShow, filter, expandEntities,
- true);
- }
-
- // DOM Level 3 methods
-
- /**
- * DOM L3
- */
- public String getInputEncoding()
- {
- return inputEncoding;
- }
-
- public void setInputEncoding(String inputEncoding)
- {
- this.inputEncoding = inputEncoding;
- }
-
- /**
- * DOM L3
- */
- public String getXmlEncoding()
- {
- return encoding;
- }
-
- public void setXmlEncoding(String encoding)
- {
- this.encoding = encoding;
- }
-
- public boolean getXmlStandalone()
- {
- return standalone;
- }
-
- public void setXmlStandalone(boolean xmlStandalone)
- {
- standalone = xmlStandalone;
- }
-
- public String getXmlVersion()
- {
- return version;
- }
-
- public void setXmlVersion(String xmlVersion)
- {
- if (xmlVersion == null)
- {
- xmlVersion = "1.0";
- }
- if ("1.0".equals(xmlVersion) ||
- "1.1".equals(xmlVersion))
- {
- version = xmlVersion;
- }
- else
- {
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- }
-
- public boolean getStrictErrorChecking()
- {
- return checkingCharacters;
- }
-
- public void setStrictErrorChecking(boolean strictErrorChecking)
- {
- checkingCharacters = strictErrorChecking;
- }
-
- public String lookupPrefix(String namespaceURI)
- {
- Node root = getDocumentElement();
- return (root == null) ? null : root.lookupPrefix(namespaceURI);
- }
-
- public boolean isDefaultNamespace(String namespaceURI)
- {
- Node root = getDocumentElement();
- return (root == null) ? false : root.isDefaultNamespace(namespaceURI);
- }
-
- public String lookupNamespaceURI(String prefix)
- {
- Node root = getDocumentElement();
- return (root == null) ? null : root.lookupNamespaceURI(prefix);
- }
-
- public String getBaseURI()
- {
- return getDocumentURI();
- /*
- Node root = getDocumentElement();
- if (root != null)
- {
- NamedNodeMap attrs = root.getAttributes();
- Node xmlBase = attrs.getNamedItemNS(XMLConstants.XML_NS_URI, "base");
- if (xmlBase != null)
- {
- return xmlBase.getNodeValue();
- }
- }
- return systemId;
- */
- }
-
- public String getDocumentURI()
- {
- return systemId;
- }
-
- public void setDocumentURI(String documentURI)
- {
- systemId = documentURI;
- }
-
- public Node adoptNode(Node source)
- {
- switch (source.getNodeType())
- {
- case DOCUMENT_NODE:
- case DOCUMENT_TYPE_NODE:
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- case ENTITY_NODE:
- case NOTATION_NODE:
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- if (source instanceof DomNode)
- {
- DomNode src = (DomNode) source;
- DomNode dst = src;
- if (dst.parent != null)
- {
- dst = (DomNode) dst.cloneNode(true);
- }
- dst.setOwner(this);
- src.notifyUserDataHandlers(UserDataHandler.NODE_ADOPTED, src, dst);
- return dst;
- }
- return null;
- }
-
- public DOMConfiguration getDomConfig()
- {
- if (config == null)
- {
- config = new DomDocumentConfiguration();
- }
- return config;
- }
-
- public void normalizeDocument()
- {
- boolean save = building;
- building = true;
- normalizeNode(this);
- building = save;
- }
-
- void normalizeNode(DomNode node)
- {
- node.normalize();
- if (config != null)
- {
- switch (node.nodeType)
- {
- case CDATA_SECTION_NODE:
- if (!config.cdataSections)
- {
- // replace CDATA section with text node
- Text text = createTextNode(node.getNodeValue());
- node.parent.insertBefore(text, node);
- node.parent.removeChild(node);
- // merge adjacent text nodes
- String data = text.getWholeText();
- node = (DomNode) text.replaceWholeText(data);
- }
- else if (config.splitCdataSections)
- {
- String value = node.getNodeValue();
- int i = value.indexOf("]]>");
- while (i != -1)
- {
- Node node2 = createCDATASection(value.substring(0, i));
- node.parent.insertBefore(node2, node);
- value = value.substring(i + 3);
- node.setNodeValue(value);
- i = value.indexOf("]]>");
- }
- }
- break;
- case COMMENT_NODE:
- if (!config.comments)
- {
- node.parent.removeChild(node);
- }
- break;
- case TEXT_NODE:
- if (!config.elementContentWhitespace &&
- ((Text) node).isElementContentWhitespace())
- {
- node.parent.removeChild(node);
- }
- break;
- case ENTITY_REFERENCE_NODE:
- if (!config.entities)
- {
- for (DomNode ctx = node.first; ctx != null; )
- {
- DomNode ctxNext = ctx.next;
- node.parent.insertBefore(ctx, node);
- ctx = ctxNext;
- }
- node.parent.removeChild(node);
- }
- break;
- case ELEMENT_NODE:
- if (!config.namespaceDeclarations)
- {
- DomNamedNodeMap attrs =
- (DomNamedNodeMap) node.getAttributes();
- boolean aro = attrs.readonly;
- attrs.readonly = false; // Ensure we can delete if necessary
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String namespace = attr.getNamespaceURI();
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespace))
- {
- attrs.removeNamedItemNS(namespace,
- attr.getLocalName());
- i--;
- len--;
- }
- }
- attrs.readonly = aro;
- }
- break;
- }
- }
- for (DomNode ctx = node.first; ctx != null; )
- {
- DomNode ctxNext = ctx.next;
- normalizeNode(ctx);
- ctx = ctxNext;
- }
- }
-
- public Node renameNode(Node n, String namespaceURI, String qualifiedName)
- throws DOMException
- {
- if (n instanceof DomNsNode)
- {
- DomNsNode src = (DomNsNode) n;
- if (src == null)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR);
- }
- if (src.owner != this)
- {
- throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR,
- null, src, 0);
- }
- boolean xml11 = "1.1".equals(version);
- checkName(qualifiedName, xml11);
- int ci = qualifiedName.indexOf(':');
- if ("".equals(namespaceURI))
- {
- namespaceURI = null;
- }
- if (namespaceURI != null)
- {
- checkNCName(qualifiedName, xml11);
- String prefix = (ci == -1) ? "" :
- qualifiedName.substring(0, ci);
- if (XMLConstants.XML_NS_PREFIX.equals(prefix) &&
- !XMLConstants.XML_NS_URI.equals(namespaceURI))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xml namespace must be " +
- XMLConstants.XML_NS_URI, src, 0);
- }
- else if (src.nodeType == ATTRIBUTE_NODE &&
- (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName)) &&
- !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xmlns namespace must be " +
- XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0);
- }
- if (XMLConstants.XML_NS_URI.equals(namespaceURI) &&
- !XMLConstants.XML_NS_PREFIX.equals(prefix))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xml namespace must be " +
- XMLConstants.XML_NS_URI, src, 0);
- }
- else if (src.nodeType == ATTRIBUTE_NODE &&
- XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI) &&
- !(XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName)))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xmlns namespace must be " +
- XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0);
- }
-
- }
- src.setNodeName(qualifiedName);
- src.setNamespaceURI(namespaceURI);
- src.notifyUserDataHandlers(UserDataHandler.NODE_RENAMED, src, src);
- // TODO MutationNameEvents
- // DOMElementNameChanged or DOMAttributeNameChanged
- return src;
- }
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, n, 0);
- }
-
- // -- XPathEvaluator --
-
- public XPathExpression createExpression(String expression,
- XPathNSResolver resolver)
- throws XPathException, DOMException
- {
- return new DomXPathExpression(this, expression, resolver);
- }
-
- public XPathNSResolver createNSResolver(Node nodeResolver)
- {
- return new DomXPathNSResolver(nodeResolver);
- }
-
- public Object evaluate(String expression,
- Node contextNode,
- XPathNSResolver resolver,
- short type,
- Object result)
- throws XPathException, DOMException
- {
- XPathExpression xpe =
- new DomXPathExpression(this, expression, resolver);
- return xpe.evaluate(contextNode, type, result);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomDocumentBuilder.java b/libjava/gnu/xml/dom/DomDocumentBuilder.java
deleted file mode 100644
index 66dd2b0edfa..00000000000
--- a/libjava/gnu/xml/dom/DomDocumentBuilder.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/* DomDocumentBuilder.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.io.InputStream;
-import java.io.IOException;
-import javax.xml.parsers.DocumentBuilder;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSInput;
-import org.w3c.dom.ls.LSParser;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Document builder using the GNU DOM Load & Save implementation.
- *
- * @author Chris Burdess
- */
-class DomDocumentBuilder
- extends DocumentBuilder
-{
-
- final DOMImplementation impl;
- final DOMImplementationLS ls;
- final LSParser parser;
-
- DomDocumentBuilder(DOMImplementation impl,
- DOMImplementationLS ls,
- LSParser parser)
- {
- this.impl = impl;
- this.ls = ls;
- this.parser = parser;
- }
-
- public boolean isNamespaceAware()
- {
- DOMConfiguration config = parser.getDomConfig();
- return ((Boolean) config.getParameter("namespaces")).booleanValue();
- }
-
- public boolean isValidating()
- {
- DOMConfiguration config = parser.getDomConfig();
- return ((Boolean) config.getParameter("validating")).booleanValue();
- }
-
- public boolean isXIncludeAware()
- {
- DOMConfiguration config = parser.getDomConfig();
- return ((Boolean) config.getParameter("xinclude-aware")).booleanValue();
- }
-
- public void setEntityResolver(EntityResolver resolver)
- {
- DOMConfiguration config = parser.getDomConfig();
- config.setParameter("entity-resolver", resolver);
- }
-
- public void setErrorHandler(ErrorHandler handler)
- {
- DOMConfiguration config = parser.getDomConfig();
- config.setParameter("error-handler", handler);
- }
-
- public DOMImplementation getDOMImplementation()
- {
- return impl;
- }
-
- public Document newDocument()
- {
- return impl.createDocument(null, null, null);
- }
-
- public Document parse(InputStream in)
- throws SAXException, IOException
- {
- LSInput input = ls.createLSInput();
- input.setByteStream(in);
- return parser.parse(input);
- }
-
- public Document parse(InputStream in, String systemId)
- throws SAXException, IOException
- {
- LSInput input = ls.createLSInput();
- input.setByteStream(in);
- input.setSystemId(systemId);
- return parser.parse(input);
- }
-
- public Document parse(String systemId)
- throws SAXException, IOException
- {
- return parser.parseURI(systemId);
- }
-
- public Document parse(InputSource is)
- throws SAXException, IOException
- {
- LSInput input = ls.createLSInput();
- InputStream in = is.getByteStream();
- if (in != null)
- {
- input.setByteStream(in);
- }
- else
- {
- input.setCharacterStream(is.getCharacterStream());
- }
- input.setPublicId(is.getPublicId());
- input.setSystemId(is.getSystemId());
- input.setEncoding(is.getEncoding());
- return parser.parse(input);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomDocumentBuilderFactory.java b/libjava/gnu/xml/dom/DomDocumentBuilderFactory.java
deleted file mode 100644
index 814141c9441..00000000000
--- a/libjava/gnu/xml/dom/DomDocumentBuilderFactory.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/* DomDocumentBuilderFactory.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.bootstrap.DOMImplementationRegistry;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSParser;
-
-/**
- * Document builder factory that uses a DOM Level 3 Load & Save
- * implementation.
- *
- * @author Chris Burdess
- */
-public class DomDocumentBuilderFactory
- extends DocumentBuilderFactory
-{
-
- final DOMImplementation impl;
- final DOMImplementationLS ls;
-
- public DomDocumentBuilderFactory()
- {
- try
- {
- DOMImplementationRegistry reg =
- DOMImplementationRegistry.newInstance();
- impl = reg.getDOMImplementation("LS 3.0");
- if (impl == null)
- {
- throw new FactoryConfigurationError("no LS implementations found");
- }
- ls = (DOMImplementationLS) impl;
- }
- catch (Exception e)
- {
- throw new FactoryConfigurationError(e);
- }
- }
-
- public DocumentBuilder newDocumentBuilder()
- throws ParserConfigurationException
- {
- LSParser parser = ls.createLSParser(DOMImplementationLS.MODE_ASYNCHRONOUS,
- "http://www.w3.org/TR/REC-xml");
- DOMConfiguration config = parser.getDomConfig();
- setParameter(config, "namespaces",
- isNamespaceAware() ? Boolean.TRUE : Boolean.FALSE);
- setParameter(config, "element-content-whitespace",
- isIgnoringElementContentWhitespace() ? Boolean.FALSE :
- Boolean.TRUE);
- setParameter(config, "comments",
- isIgnoringComments() ? Boolean.FALSE : Boolean.TRUE);
- setParameter(config, "expand-entity-references",
- isExpandEntityReferences() ? Boolean.TRUE : Boolean.FALSE);
- setParameter(config, "coalescing",
- isCoalescing() ? Boolean.TRUE : Boolean.FALSE);
- setParameter(config, "validating",
- isValidating() ? Boolean.TRUE : Boolean.FALSE);
- setParameter(config, "xinclude-aware",
- isXIncludeAware() ? Boolean.TRUE : Boolean.FALSE);
- return new DomDocumentBuilder(impl, ls, parser);
- }
-
- void setParameter(DOMConfiguration config, String name, Object value)
- throws ParserConfigurationException
- {
- if (!config.canSetParameter(name, value))
- {
- throw new ParserConfigurationException(name);
- }
- config.setParameter(name, value);
- }
-
- public Object getAttribute(String name)
- {
- // TODO
- return null;
- }
-
- public void setAttribute(String name, Object value)
- {
- // TODO
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomDocumentConfiguration.java b/libjava/gnu/xml/dom/DomDocumentConfiguration.java
deleted file mode 100644
index 5c589f82fe2..00000000000
--- a/libjava/gnu/xml/dom/DomDocumentConfiguration.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/* DomDocumentConfiguration.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.Arrays;
-import java.util.List;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMErrorHandler;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMStringList;
-
-/**
- * Document configuration, used to store normalization and other parameters.
- *
- * @author Chris Burdess
- */
-class DomDocumentConfiguration
- implements DOMConfiguration, DOMStringList
-{
-
- private static final List SUPPORTED_PARAMETERS =
- Arrays.asList(new String[] { "cdata-sections",
- "comments",
- "element-content-whitespace",
- "entities",
- "error-handler",
- "namespace-declarations",
- "split-cdata-sections",
- "infoset"});
-
- boolean cdataSections = true;
- boolean comments = true;
- boolean elementContentWhitespace = true;
- boolean entities = true;
- DOMErrorHandler errorHandler;
- boolean namespaceDeclarations = true;
- boolean splitCdataSections = true;
-
- public void setParameter(String name, Object value)
- throws DOMException
- {
- name = name.toLowerCase();
- if ("cdata-sections".equals(name))
- {
- cdataSections = "true".equals(value.toString());
- }
- else if ("comments".equals(name))
- {
- comments = "true".equals(value.toString());
- }
- else if ("element-content-whitespace".equals(name))
- {
- elementContentWhitespace = "true".equals(value.toString());
- }
- else if ("entities".equals(name))
- {
- entities = "true".equals(value.toString());
- }
- else if ("error-handler".equals(name))
- {
- try
- {
- errorHandler = (DOMErrorHandler) value;
- }
- catch (ClassCastException e)
- {
- throw new DomDOMException(DOMException.TYPE_MISMATCH_ERR,
- value.getClass().getName(), null, 0);
- }
- }
- else if ("namespace-declarations".equals(name))
- {
- namespaceDeclarations = "true".equals(value.toString());
- }
- else if ("split-cdata-sections".equals(name))
- {
- comments = "true".equals(value.toString());
- }
- else if ("infoset".equals(name))
- {
- if ("true".equals(value.toString()))
- {
- entities = false;
- cdataSections = false;
- namespaceDeclarations = true;
- elementContentWhitespace = true;
- comments = true;
- }
- }
- else if (("canonical-form".equals(name) ||
- "check-character-normalization".equals(name) ||
- "datatype-normalization".equals(name) ||
- "normalize-characters".equals(name) ||
- "validate".equals(name) ||
- "validate-if-schema".equals(name)) &&
- "false".equals(value.toString()))
- {
- // NOOP
- }
- else if (("namespaces".equals(name) ||
- "well-formed".equals(name)) &&
- "true".equals(value.toString()))
- {
- // NOOP
- }
- else
- {
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR,
- name, null, 0);
- }
- }
-
- public Object getParameter(String name)
- throws DOMException
- {
- name = name.toLowerCase();
- if ("cdata-sections".equals(name))
- {
- return cdataSections ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("comments".equals(name))
- {
- return comments ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("element-content-whitespace".equals(name))
- {
- return elementContentWhitespace ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("entities".equals(name))
- {
- return entities ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("error-handler".equals(name))
- {
- return errorHandler;
- }
- else if ("namespace-declarations".equals(name))
- {
- return namespaceDeclarations ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("split-cdata-sections".equals(name))
- {
- return comments ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("canonical-form".equals(name) ||
- "check-character-normalization".equals(name) ||
- "datatype-normalization".equals(name) ||
- "normalize-characters".equals(name) ||
- "validate".equals(name) ||
- "validate-if-schema".equals(name))
- {
- return Boolean.FALSE;
- }
- else if ("namespaces".equals(name) ||
- "well-formed".equals(name))
- {
- return Boolean.TRUE;
- }
- else if ("infoset".equals(name))
- {
- return (entities == false &&
- cdataSections == false &&
- namespaceDeclarations == true &&
- comments == true) ? Boolean.TRUE : Boolean.FALSE;
- }
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, name, null, 0);
- }
-
- public boolean canSetParameter(String name, Object value)
- {
- name = name.toLowerCase();
- if ("error-handler".equals(name))
- {
- return (value == null || value instanceof DOMErrorHandler);
- }
- else if (contains(name))
- {
- return true;
- }
- else if ("canonical-form".equals(name) ||
- "check-character-normalization".equals(name) ||
- "datatype-normalization".equals(name) ||
- "normalize-characters".equals(name) ||
- "validate".equals(name) ||
- "validate-if-schema".equals(name))
- {
- return "false".equals(value.toString());
- }
- else if ("namespaces".equals(name) ||
- "well-formed".equals(name))
- {
- return "true".equals(value.toString());
- }
- return false;
- }
-
- public DOMStringList getParameterNames()
- {
- return this;
- }
-
- public String item(int i)
- {
- try
- {
- return (String) SUPPORTED_PARAMETERS.get(i);
- }
- catch (IndexOutOfBoundsException e)
- {
- return null;
- }
- }
-
- public int getLength()
- {
- return SUPPORTED_PARAMETERS.size();
- }
-
- public boolean contains(String str)
- {
- str = str.toLowerCase();
- return SUPPORTED_PARAMETERS.contains(str);
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomDocumentFragment.java b/libjava/gnu/xml/dom/DomDocumentFragment.java
deleted file mode 100644
index 8d260377821..00000000000
--- a/libjava/gnu/xml/dom/DomDocumentFragment.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* DomDocumentFragment.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DocumentFragment;
-
-/**
- * "DocumentFragment" implementation. This constructor should only be invoked by a Document as part of
- * its createDocumentFragment functionality, or through a subclass which
- * is similarly used in a "Sub-DOM" style layer.
- */
- protected DomDocumentFragment(DomDocument owner)
- {
- super(DOCUMENT_FRAGMENT_NODE, owner);
- }
-
- /**
- * DOM L1
- * Returns the string "#document-fragment".
- */
- final public String getNodeName()
- {
- return "#document-fragment";
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomElement.java b/libjava/gnu/xml/dom/DomElement.java
deleted file mode 100644
index 34509f647bc..00000000000
--- a/libjava/gnu/xml/dom/DomElement.java
+++ /dev/null
@@ -1,523 +0,0 @@
-/* DomElement.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.xml.XMLConstants;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.TypeInfo;
-
-/**
- * "Element" implementation.
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public class DomElement
- extends DomNsNode
- implements Element
-{
-
- /**
- * User-defined ID attributes.
- * Used by DomAttr.isId and DomDocument.getElementById
- */
- Set userIdAttrs;
-
- // Attributes are VERY expensive in DOM, and not just for
- // this implementation. Avoid creating them.
- private DomNamedNodeMap attributes;
-
- // xml:space cache
- String xmlSpace = "";
-
- /**
- * Constructs an Element node associated with the specified document.
- *
- * This constructor should only be invoked by a Document as part
- * of its createElement functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this node is associated
- * @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of element
- * @param name Name of this element, which may include a prefix
- */
- protected DomElement(DomDocument owner, String namespaceURI, String name)
- {
- super(ELEMENT_NODE, owner, namespaceURI, name);
- }
-
- /**
- * DOM L1
- * Returns the element's attributes
- */
- public NamedNodeMap getAttributes()
- {
- if (attributes == null)
- {
- attributes = new DomNamedNodeMap(this, Node.ATTRIBUTE_NODE);
- }
- return attributes;
- }
-
- /**
- * DOM L2>
- * Returns true iff this is an element node with attributes.
- */
- public boolean hasAttributes()
- {
- return attributes != null && attributes.length != 0;
- }
-
- /**
- * Shallow clone of the element, except that associated
- * attributes are (deep) cloned.
- */
- public Object clone()
- {
- DomElement node = (DomElement) super.clone();
-
- if (attributes != null)
- {
- node.attributes = new DomNamedNodeMap(node, Node.ATTRIBUTE_NODE);
- for (DomNode ctx = attributes.first; ctx != null; ctx = ctx.next)
- {
- node.attributes.setNamedItemNS(ctx.cloneNode(true));
- }
- }
- return node;
- }
-
- void setOwner(DomDocument doc)
- {
- if (attributes != null)
- {
- for (DomNode ctx = attributes.first; ctx != null; ctx = ctx.next)
- {
- ctx.setOwner(doc);
- }
- }
- super.setOwner(doc);
- }
-
- /**
- * Marks this element, its children, and its associated attributes as
- * readonly.
- */
- public void makeReadonly()
- {
- super.makeReadonly();
- if (attributes != null)
- {
- attributes.makeReadonly();
- }
- }
-
- /**
- * DOM L1
- * Returns the element name (same as getNodeName).
- */
- final public String getTagName()
- {
- return getNodeName();
- }
-
- /**
- * DOM L1
- * Returns the value of the specified attribute, or an
- * empty string.
- */
- public String getAttribute(String name)
- {
- if ("xml:space" == name) // NB only works on interned string
- {
- // Use cached value
- return xmlSpace;
- }
- Attr attr = getAttributeNode(name);
- return (attr == null) ? "" : attr.getValue();
- }
-
- /**
- * DOM L2
- * Returns true if the element has an attribute with the
- * specified name (specified or DTD defaulted).
- */
- public boolean hasAttribute(String name)
- {
- return getAttributeNode(name) != null;
- }
-
- /**
- * DOM L2
- * Returns true if the element has an attribute with the
- * specified name (specified or DTD defaulted).
- */
- public boolean hasAttributeNS(String namespaceURI, String local)
- {
- return getAttributeNodeNS(namespaceURI, local) != null;
- }
-
- /**
- * DOM L2
- * Returns the value of the specified attribute, or an
- * empty string.
- */
- public String getAttributeNS(String namespaceURI, String local)
- {
- Attr attr = getAttributeNodeNS(namespaceURI, local);
- return (attr == null) ? "" : attr.getValue();
- }
-
- /**
- * DOM L1
- * Returns the appropriate attribute node; the name is the
- * nodeName property of the attribute.
- */
- public Attr getAttributeNode(String name)
- {
- return (attributes == null) ? null :
- (Attr) attributes.getNamedItem(name);
- }
-
- /**
- * DOM L2
- * Returns the appropriate attribute node; the name combines
- * the namespace name and the local part.
- */
- public Attr getAttributeNodeNS(String namespace, String localPart)
- {
- return (attributes == null) ? null :
- (Attr) attributes.getNamedItemNS(namespace, localPart);
- }
-
- /**
- * DOM L1
- * Modifies an existing attribute to have the specified value,
- * or creates a new one with that value. The name used is the
- * nodeName value.
- */
- public void setAttribute(String name, String value)
- {
- Attr attr = getAttributeNode(name);
- if (attr != null)
- {
- attr.setNodeValue(value);
- ((DomAttr) attr).setSpecified(true);
- return;
- }
- attr = owner.createAttribute(name);
- attr.setNodeValue(value);
- setAttributeNode(attr);
- }
-
- /**
- * DOM L2
- * Modifies an existing attribute to have the specified value,
- * or creates a new one with that value.
- */
- public void setAttributeNS(String uri, String aname, String value)
- {
- if (("xmlns".equals (aname) || aname.startsWith ("xmlns:"))
- && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals (uri))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "setting xmlns attribute to illegal value", this, 0);
- }
-
- Attr attr = getAttributeNodeNS(uri, aname);
- if (attr != null)
- {
- attr.setNodeValue(value);
- return;
- }
- attr = owner.createAttributeNS(uri, aname);
- attr.setNodeValue(value);
- setAttributeNodeNS(attr);
- }
-
- /**
- * DOM L1
- * Stores the specified attribute, optionally overwriting any
- * existing one with that name.
- */
- public Attr setAttributeNode(Attr attr)
- {
- return (Attr) getAttributes().setNamedItem(attr);
- }
-
- /**
- * DOM L2
- * Stores the specified attribute, optionally overwriting any
- * existing one with that name.
- */
- public Attr setAttributeNodeNS(Attr attr)
- {
- return (Attr) getAttributes().setNamedItemNS(attr);
- }
-
- /**
- * DOM L1
- * Removes the appropriate attribute node.
- * If there is no such node, this is (bizarrely enough) a NOP so you
- * won't see exceptions if your code deletes non-existent attributes.
- *
- * Note that since there is no portable way for DOM to record
- * DTD information, default values for attributes will never be
- * provided automatically.
- */
- public void removeAttribute(String name)
- {
- if (attributes == null)
- {
- return;
- }
-
- try
- {
- attributes.removeNamedItem(name);
- }
- catch (DomDOMException e)
- {
- if (e.code != DOMException.NOT_FOUND_ERR)
- {
- throw e;
- }
- }
- }
-
- /**
- * DOM L1
- * Removes the appropriate attribute node; the name is the
- * nodeName property of the attribute.
- *
- * Note that since there is no portable way for DOM to record
- * DTD information, default values for attributes will never be
- * provided automatically.
- */
- public Attr removeAttributeNode(Attr node)
- {
- if (attributes == null)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR, null, node, 0);
- }
- return (Attr) attributes.removeNamedItem(node.getNodeName());
- }
-
- /**
- * DOM L2
- * Removes the appropriate attribute node; the name combines
- * the namespace name and the local part.
- *
- * Note that since there is no portable way for DOM to record
- * DTD information, default values for attributes will never be
- * provided automatically.
- */
- public void removeAttributeNS(String namespace, String localPart)
- {
- if (attributes == null)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR, localPart, null, 0);
- }
- attributes.removeNamedItemNS (namespace, localPart);
- }
-
- // DOM Level 3 methods
-
- public String lookupPrefix(String namespaceURI)
- {
- if (namespaceURI == null)
- {
- return null;
- }
- String namespace = getNamespaceURI();
- if (namespace != null && namespace.equals(namespaceURI))
- {
- return getPrefix();
- }
- if (attributes != null)
- {
- for (DomNode ctx = attributes.first; ctx != null; ctx = ctx.next)
- {
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI
- .equals(ctx.getNamespaceURI()))
- {
- String value = ctx.getNodeValue();
- if (value.equals(namespaceURI))
- {
- return ctx.getLocalName();
- }
- }
- }
- }
- return super.lookupPrefix(namespaceURI);
- }
-
- public boolean isDefaultNamespace(String namespaceURI)
- {
- String namespace = getNamespaceURI();
- if (namespace != null && namespace.equals(namespaceURI))
- {
- return getPrefix() == null;
- }
- if (attributes != null)
- {
- for (DomNode ctx = attributes.first; ctx != null; ctx = ctx.next)
- {
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI
- .equals(ctx.getNamespaceURI()))
- {
- String qName = ctx.getNodeName();
- return (XMLConstants.XMLNS_ATTRIBUTE.equals(qName));
- }
- }
- }
- return super.isDefaultNamespace(namespaceURI);
- }
-
- public String lookupNamespaceURI(String prefix)
- {
- String namespace = getNamespaceURI();
- if (namespace != null && equal(prefix, getPrefix()))
- {
- return namespace;
- }
- if (attributes != null)
- {
- for (DomNode ctx = attributes.first; ctx != null; ctx = ctx.next)
- {
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI
- .equals(ctx.getNamespaceURI()))
- {
- if (prefix == null)
- {
- if (XMLConstants.XMLNS_ATTRIBUTE.equals(ctx.getNodeName()))
- {
- return ctx.getNodeValue();
- }
- }
- else
- {
- if (prefix.equals(ctx.getLocalName()))
- {
- return ctx.getNodeValue();
- }
- }
- }
- }
- }
- return super.lookupNamespaceURI(prefix);
- }
-
- public String getBaseURI()
- {
- if (attributes != null)
- {
- Node xmlBase =
- attributes.getNamedItemNS(XMLConstants.XML_NS_URI, "base");
- if (xmlBase != null)
- {
- return xmlBase.getNodeValue();
- }
- }
- return super.getBaseURI();
- }
-
- public TypeInfo getSchemaTypeInfo()
- {
- // DTD implementation
- DomDoctype doctype = (DomDoctype) owner.getDoctype();
- if (doctype != null)
- {
- return doctype.getElementTypeInfo(getNodeName());
- }
- // TODO XML Schema implementation
- return null;
- }
-
- public void setIdAttribute(String name, boolean isId)
- {
- NamedNodeMap attrs = getAttributes();
- Attr attr = (Attr) attrs.getNamedItem(name);
- setIdAttributeNode(attr, isId);
- }
-
- public void setIdAttributeNode(Attr attr, boolean isId)
- {
- if (readonly)
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- if (attr == null || attr.getOwnerElement() != this)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR);
- }
- if (isId)
- {
- if (userIdAttrs == null)
- {
- userIdAttrs = new HashSet();
- }
- userIdAttrs.add(attr);
- }
- else if (userIdAttrs != null)
- {
- userIdAttrs.remove(attr);
- if (userIdAttrs.isEmpty())
- {
- userIdAttrs = null;
- }
- }
- }
-
- public void setIdAttributeNS(String namespaceURI, String localName,
- boolean isId)
- {
- NamedNodeMap attrs = getAttributes();
- Attr attr = (Attr) attrs.getNamedItemNS(namespaceURI, localName);
- setIdAttributeNode(attr, isId);
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomEntity.java b/libjava/gnu/xml/dom/DomEntity.java
deleted file mode 100644
index 3a76479a389..00000000000
--- a/libjava/gnu/xml/dom/DomEntity.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/* DomEntity.java --
- Copyright (C) 1999,2000,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.Entity;
-
-/**
- * "Entity" implementation. This is a non-core DOM class, supporting the
- * "XML" feature. There are two types of entities, neither of which works
- * particularly well in this API: In short, avoid using this DOM functionality.
- *
- * @see DomDoctype
- * @see DomEntityReference
- * @see DomNotation
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public class DomEntity
- extends DomExtern
- implements Entity
-{
-
- private String notation;
-
- /**
- * Constructs an Entity node associated with the specified document,
- * with the specified descriptive data.
- *
- * This constructor should only be invoked by a DomDoctype as part
- * of its declareEntity functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this entity is associated
- * @param name Name of this entity
- * @param publicId If non-null, provides the entity's PUBLIC identifier
- * @param systemId Provides the entity's SYSTEM identifier (URI)
- * @param notation If non-null, provides the unparsed entity's notation.
- */
- protected DomEntity(DomDocument owner,
- String name,
- String publicId,
- String systemId,
- String notation)
- {
- super(ENTITY_NODE, owner, name, publicId, systemId);
- this.notation = notation;
-
- // NOTE: if notation == null, this is a parsed entity
- // which could reasonably be given child nodes ...
- makeReadonly();
- }
-
- /**
- * DOM L1
- * Returns the NOTATION identifier associated with this entity, if any.
- */
- final public String getNotationName()
- {
- return notation;
- }
-
- // DOM Level 3 methods
-
- public String getInputEncoding()
- {
- // TODO
- return null;
- }
-
- public String getXmlEncoding()
- {
- // TODO
- return null;
- }
-
- public String getXmlVersion()
- {
- // TODO
- return null;
- }
-
- /**
- * The base URI of an external entity is its system ID.
- * The base URI of an internal entity is the parent document's base URI.
- * @since DOM Level 3 Core
- */
- public String getBaseURI()
- {
- String systemId = getSystemId();
- return (systemId == null) ? owner.getBaseURI() : systemId;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomEntityReference.java b/libjava/gnu/xml/dom/DomEntityReference.java
deleted file mode 100644
index d4596b405d4..00000000000
--- a/libjava/gnu/xml/dom/DomEntityReference.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/* DomEntityReference.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Entity;
-import org.w3c.dom.EntityReference;
-
-/**
- * "EntityReference" implementation (reference to parsed entity).
- * This is a non-core DOM class, supporting the "XML" feature.
- * It does not represent builtin entities (such as "&")
- * or character references, which are always directly expanded in
- * DOM trees. Note that while the DOM specification permits these nodes to have
- * a readonly set of children, this is not required. Similarly, it does
- * not require a DOM to couple EntityReference nodes with any Entity nodes
- * that have the same entity name (and equivalent children). It also
- * effectively guarantees that references created directly or indirectly
- * through the Document.ImportNode method will not have children.
- * The level of functionality you may get is extremely variable.
- *
- * Also significant is that even at their most functional level, the fact
- * that EntityReference children must be readonly has caused significant
- * problems when modifying work products held in DOM trees. Other problems
- * include issues related to undeclared namespace prefixes (and references
- * to the current default namespace) that may be found in the text of such
- * parsed entities nodes. These must be contextually bound as part of DOM
- * tree construction. When such nodes are moved, the namespace associated
- * with a given prefix (or default) may change to be in conflict with the
- * namespace bound to the node at creation time.
- *
- * In short, avoid using this DOM functionality.
- *
- * @see DomDoctype
- * @see DomEntity
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public class DomEntityReference
- extends DomNode
- implements EntityReference
-{
-
- private String name;
-
- /**
- * Constructs an EntityReference node associated with the specified
- * document. The creator should populate this with whatever contents
- * are appropriate, and then mark it as readonly.
- *
- * This constructor should only be invoked by a Document as part of
- * its createEntityReference functionality, or through a subclass which
- * is similarly used in a "Sub-DOM" style layer.
- *
- * @see DomNode#makeReadonly
- */
- protected DomEntityReference(DomDocument owner, String name)
- {
- super(ENTITY_REFERENCE_NODE, owner);
- this.name = name;
- }
-
- /**
- * Returns the name of the referenced entity.
- * @since DOM Level 1 Core
- */
- public final String getNodeName()
- {
- return name;
- }
-
- /**
- * The base URI of an entity reference is the base URI where the entity
- * declaration occurs.
- * @since DOM Level 3 Core
- */
- public final String getBaseURI()
- {
- DocumentType doctype = owner.getDoctype();
- if (doctype == null)
- {
- return null;
- }
- Entity entity = (Entity) doctype.getEntities().getNamedItem(name);
- if (entity == null)
- {
- return null;
- }
- return entity.getBaseURI();
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomEvent.java b/libjava/gnu/xml/dom/DomEvent.java
deleted file mode 100644
index d57eac0e445..00000000000
--- a/libjava/gnu/xml/dom/DomEvent.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/* DomEvent.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-import org.w3c.dom.events.*;
-import org.w3c.dom.views.AbstractView; // used by UIEvent
-
-/**
- * "Event" implementation. Events are
- * created (through DocumentEvent interface methods on the document object),
- * and are sent to any target node in the document.
- *
- * Applications may define application specific event subclasses, but
- * should otherwise use the DocumentTraversal interface to acquire
- * event objects.
- *
- * @author David Brownell
- */
-public class DomEvent
- implements Event
-{
-
- String type; // init
- EventTarget target;
- EventTarget currentNode;
- short eventPhase;
- boolean bubbles; // init
- boolean cancelable; // init
- long timeStamp; // ?
-
- /** Returns the event's type (name) as initialized */
- public final String getType()
- {
- return type;
- }
-
- /**
- * Returns event's target; delivery of an event is initiated
- * by a target.dispatchEvent(event) invocation.
- */
- public final EventTarget getTarget()
- {
- return target;
- }
-
- /**
- * Returns the target to which events are currently being
- * delivered. When capturing or bubbling, this will not
- * be what getTarget returns.
- */
- public final EventTarget getCurrentTarget()
- {
- return currentNode;
- }
-
- /**
- * Returns CAPTURING_PHASE, AT_TARGET, or BUBBLING;
- * only meaningful within EventListener.handleEvent
- */
- public final short getEventPhase()
- {
- return eventPhase;
- }
-
- /**
- * Returns true if the news of the event bubbles to tree tops
- * (as specified during initialization).
- */
- public final boolean getBubbles()
- {
- return bubbles;
- }
-
- /**
- * Returns true if the default handling may be canceled
- * (as specified during initialization).
- */
- public final boolean getCancelable()
- {
- return cancelable;
- }
-
- /**
- * Returns the event's timestamp.
- */
- public final long getTimeStamp()
- {
- return timeStamp;
- }
-
- boolean stop;
- boolean doDefault;
-
- /**
- * Requests the event no longer be captured or bubbled; only
- * listeners on the event target will see the event, if they
- * haven't yet been notified.
- *
- * Avoid using this except for application-specific
- * events, for which you the protocol explicitly "blesses" the use
- * of this with some event types. Otherwise, you are likely to break
- * algorithms which depend on event notification either directly or
- * through bubbling or capturing. Note that this method is not final, specifically to enable
- * enforcing of policies about events always propagating. Abstract implemention of nodes describing external DTD-related
- * objects. This facilitates reusing code for Entity, Notation, and
- * DocumentType (really, external subset) nodes. Such support is not
- * part of the core DOM; it's for the "XML" feature. Note that you are strongly advised to avoid using the DOM
- * features that take advantage of this class, since (as of L2) none
- * of them is defined fully enough to permit full use of the
- * XML feature they partially expose. "DOMImplementation" implementation. At this writing, the following features are supported:
- * "XML" (L1, L2, L3),
- * "Events" (L2), "MutationEvents" (L2), "USER-Events" (a conformant extension),
- * "HTMLEvents" (L2), "UIEvents" (L2), "Traversal" (L2), "XPath" (L3),
- * "LS" (L3) "LS-Async" (L3).
- * It is possible to compile the package so it doesn't support some of these
- * features (notably, Traversal).
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public class DomImpl
- implements DOMImplementation, DOMImplementationLS
-{
-
- /**
- * Constructs a DOMImplementation object which supports
- * "XML" and other DOM Level 2 features.
- */
- public DomImpl()
- {
- }
-
- /**
- * DOM L1
- * Returns true if the specified feature and version are
- * supported. Note that the case of the feature name is ignored.
- */
- public boolean hasFeature(String name, String version)
- {
- if (name.length() == 0)
- {
- return false;
- }
- name = name.toLowerCase();
- if (name.charAt(0) == '+')
- {
- name = name.substring(1);
- }
-
- if ("xml".equals(name) || "core".equals(name))
- {
- return (version == null ||
- "".equals(version) ||
- "1.0".equals(version) ||
- "2.0".equals(version) ||
- "3.0".equals(version));
-
- }
- else if ("ls".equals(name) || "ls-async".equals(name))
- {
- return (version == null ||
- "".equals(version) ||
- "3.0".equals(version));
- }
- else if ("events".equals(name)
- || "mutationevents".equals(name)
- || "uievents".equals(name)
- // || "mouseevents".equals(name)
- || "htmlevents".equals(name))
- {
- return (version == null ||
- "".equals(version) ||
- "2.0".equals(version));
-
- // Extension: "USER-" prefix event types can
- // be created and passed through the DOM.
-
- }
- else if ("user-events".equals(name))
- {
- return (version == null ||
- "".equals(version) ||
- "0.1".equals(version));
-
- // NOTE: "hasFeature" for events is here interpreted to
- // mean the DOM can manufacture those sorts of events,
- // since actually choosing to report the events is more
- // often part of the environment or application. It's
- // only really an issue for mutation events.
-
- }
- else if (DomNode.reportMutations
- && "traversal".equals(name))
- {
- return (version == null ||
- "".equals(version) ||
- "2.0".equals(version));
- }
- else if ("xpath".equals(name))
- {
- return (version == null ||
- "".equals(version) ||
- "3.0".equals(version));
- }
- else if ("html".equals(name) || "xhtml".equals(name))
- {
- return (version == null ||
- "".equals(version) ||
- "2.0".equals(version));
- }
-
- // views
- // stylesheets
- // css, css2
- // range
-
- return false;
- }
-
- /**
- * DOM L2
- * Creates and returns a DocumentType, associated with this
- * implementation. This DocumentType can have no associated
- * objects(notations, entities) until the DocumentType is
- * first associated with a document.
- *
- * Note that there is no implication that this DTD will
- * be parsed by the DOM, or ever have contents. Moreover, the
- * DocumentType created here can only be added to a document by
- * the createDocument method(below). That means that the only
- * portable way to create a Document object is to start parsing,
- * queue comment and processing instruction (PI) nodes, and then only
- * create a DOM Document after (a) it's known if a DocumentType
- * object is needed, and (b) the name and namespace of the root
- * element is known. Queued comment and PI nodes would then be
- * inserted appropriately in the document prologue, both before and
- * after the DTD node, and additional attributes assigned to the
- * root element.
- *(One hopes that the final DOM REC fixes this serious botch.)
- */
- public DocumentType createDocumentType(String rootName,
- String publicId,
- String systemId)
- // CR2 deleted internal subset, ensuring DocumentType
- // is 100% useless instead of just 90% so.
- {
- DomDocument.checkNCName(rootName, false);
- return new DomDoctype(this, rootName, publicId, systemId, null);
- }
-
- /**
- * DOM L2
- * Creates and returns a Document, populated only with a root element and
- * optionally a document type(if that was provided).
- */
- public Document createDocument(String namespaceURI,
- String rootName,
- DocumentType doctype)
- {
- Document doc = createDocument();
- Element root = null;
-
- if (rootName != null)
- {
- root = doc.createElementNS(namespaceURI, rootName);
- if (rootName.startsWith("xmlns:"))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xmlns is reserved", null, 0);
- }
- }
- // Bleech -- L2 seemingly _requires_ omission of xmlns attributes.
- if (doctype != null)
- {
- doc.appendChild(doctype); // handles WRONG_DOCUMENT error
- }
- if (root != null)
- {
- doc.appendChild(root);
- }
- return doc;
- }
-
- protected Document createDocument()
- {
- return new DomDocument(this);
- }
-
- // DOM Level 3
-
- public Object getFeature(String feature, String version)
- {
- if (hasFeature(feature, version))
- {
- if ("html".equalsIgnoreCase(feature) ||
- "xhtml".equalsIgnoreCase(feature))
- {
- return new DomHTMLImpl();
- }
- return this;
- }
- return null;
- }
-
- // -- DOMImplementationLS --
-
- public LSParser createLSParser(short mode, String schemaType)
- throws DOMException
- {
- return new DomLSParser(mode, schemaType);
- }
-
- public LSSerializer createLSSerializer()
- {
- return new DomLSSerializer();
- }
-
- public LSInput createLSInput()
- {
- return new DomLSInput();
- }
-
- public LSOutput createLSOutput()
- {
- return new DomLSOutput();
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomIterator.java b/libjava/gnu/xml/dom/DomIterator.java
deleted file mode 100644
index 472c6e80585..00000000000
--- a/libjava/gnu/xml/dom/DomIterator.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/* DomIterator.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.events.Event;
-import org.w3c.dom.events.EventListener;
-import org.w3c.dom.events.EventTarget;
-import org.w3c.dom.events.MutationEvent;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-
-/**
- * "NodeIterator" implementation, usable with any L2 DOM which
- * supports MutationEvents. This version works by watching removal events as they
- * bubble up. So, don't prevent them from bubbling.
- */
- public void handleEvent(Event e)
- {
- MutationEvent event;
- Node ancestor, removed;
-
- if (reference == null
- || !"DOMNodeRemoved".equals(e.getType())
- || e.getEventPhase() != Event.BUBBLING_PHASE)
- {
- return;
- }
-
- event = (MutationEvent) e;
- removed = (Node) event.getTarget();
-
- // See if the removal will cause trouble for this iterator
- // by being the reference node or an ancestor of it.
- for (ancestor = reference;
- ancestor != null && ancestor != root;
- ancestor = ancestor.getParentNode())
- {
- if (ancestor == removed)
- {
- break;
- }
- }
- if (ancestor != removed)
- {
- return;
- }
-
- // OK, it'll cause trouble. We want to make the "next"
- // node in our current traversal direction seem right.
- // So we pick the nearest node that's not getting removed,
- // but go in the _opposite_ direction from our current
- // traversal ... so the "next" doesn't skip anything.
- Node candidate;
-
-search:
- while ((candidate = walk(!right)) != null)
- {
- for (ancestor = candidate;
- ancestor != null && ancestor != root;
- ancestor = ancestor.getParentNode())
- {
- if (ancestor == removed)
- {
- continue search;
- }
- }
- return;
- }
-
- // The current DOM WD talks about a special case here;
- // I've not yet seen it.
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomNSResolverContext.java b/libjava/gnu/xml/dom/DomNSResolverContext.java
deleted file mode 100644
index 4cf57772e9b..00000000000
--- a/libjava/gnu/xml/dom/DomNSResolverContext.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/* DomNSResolverContext.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.Iterator;
-import javax.xml.namespace.NamespaceContext;
-import org.w3c.dom.xpath.XPathNSResolver;
-
-/**
- * Namespace content wrapper for an XPathNSResolver.
- *
- * @author Chris Burdess
- */
-class DomNSResolverContext
- implements NamespaceContext, Iterator
-{
-
- final XPathNSResolver resolver;
-
- DomNSResolverContext(XPathNSResolver resolver)
- {
- this.resolver = resolver;
- }
-
- public String getNamespaceURI(String prefix)
- {
- return resolver.lookupNamespaceURI(prefix);
- }
-
- public String getPrefix(String namespaceURI)
- {
- return null;
- }
-
- public Iterator getPrefixes(String namespaceURI)
- {
- return this;
- }
-
- public boolean hasNext()
- {
- return false;
- }
-
- public Object next()
- {
- return null;
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomNamedNodeMap.java b/libjava/gnu/xml/dom/DomNamedNodeMap.java
deleted file mode 100644
index fa5ac964b8a..00000000000
--- a/libjava/gnu/xml/dom/DomNamedNodeMap.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/* DomNamedNodeMap.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * "NamedNodeMap" implementation. "Node", "EventTarget", and "DocumentEvent" implementation.
- * This provides most of the core DOM functionality; only more
- * specialized features are provided by subclasses. Those subclasses may
- * have some particular constraints they must implement, by overriding
- * methods defined here. Such constraints are noted here in the method
- * documentation. Note that you can create events with type names prefixed with "USER-",
- * and pass them through this DOM. This lets you use the DOM event scheme
- * for application specific purposes, although you must use a predefined event
- * structure (such as MutationEvent) to pass data along with those events.
- * Test for existence of this feature with the "USER-Events" DOM feature
- * name. Other kinds of events you can send include the "html" events,
- * like "load", "unload", "abort", "error", and "blur"; and the mutation
- * events. If this DOM has been compiled with mutation event support
- * enabled, it will send mutation events when you change parts of the
- * tree; otherwise you may create and send such events yourself, but
- * they won't be generated by the DOM itself. Note that there is a namespace-aware name comparison method,
- * nameAndTypeEquals, which compares the names (and types) of
- * two nodes in conformance with the "Namespaces in XML" specification.
- * While mostly intended for use with elements and attributes, this should
- * also be helpful for ProcessingInstruction nodes and some others which
- * do not have namespace URIs.
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public abstract class DomNode
- implements Node, NodeList, EventTarget, DocumentEvent, Cloneable, Comparable
-{
-
- // package private
- //final static String xmlNamespace = "http://www.w3.org/XML/1998/namespace";
- //final static String xmlnsURI = "http://www.w3.org/2000/xmlns/";
-
- // tunable
- // NKIDS_* affects arrays of children (which grow)
- // (currently) fixed size:
- // ANCESTORS_* is for event capture/bubbling, # ancestors
- // NOTIFICATIONS_* is for per-node event delivery, # events
- private static final int NKIDS_DELTA = 8;
- private static final int ANCESTORS_INIT = 20;
- private static final int NOTIFICATIONS_INIT = 10;
-
- // tunable: enable mutation events or not? Enabling it costs about
- // 10-15% in DOM construction time, last time it was measured.
-
- // package private !!!
- static final boolean reportMutations = true;
-
- // locking protocol changeable only within this class
- private static final Object lockNode = new Object();
-
- // NON-FINAL class data
-
- // Optimize event dispatch by not allocating memory each time
- private static boolean dispatchDataLock;
- private static DomNode[] ancestors = new DomNode[ANCESTORS_INIT];
- private static ListenerRecord[] notificationSet
- = new ListenerRecord[NOTIFICATIONS_INIT];
-
- // Ditto for the (most common) event object itself!
- private static boolean eventDataLock;
- private static DomEvent.DomMutationEvent mutationEvent
- = new DomEvent.DomMutationEvent(null);
-
- //
- // PER-INSTANCE DATA
- //
-
- DomDocument owner;
- DomNode parent; // parent node;
- DomNode previous; // previous sibling node
- DomNode next; // next sibling node
- DomNode first; // first child node
- DomNode last; // last child node
- int index; // index of this node in its parent's children
- int depth; // depth of the node in the document
- int length; // number of children
- final short nodeType;
-
- // Bleech ... "package private" so a builder can populate entity refs.
- // writable during construction. DOM spec is nasty.
- boolean readonly;
-
- // event registrations
- private ListenerRecord[] listeners;
- private int nListeners;
-
- // DOM Level 3 userData dictionary.
- private HashMap userData;
- private HashMap userDataHandlers;
-
- //
- // Some of the methods here are declared 'final' because
- // knowledge about their implementation is built into this
- // class -- for both integrity and performance.
- //
-
- /**
- * Reduces space utilization for this node.
- */
- public void compact()
- {
- if (listeners != null && listeners.length != nListeners)
- {
- if (nListeners == 0)
- {
- listeners = null;
- }
- else
- {
- ListenerRecord[] l = new ListenerRecord[nListeners];
- System.arraycopy(listeners, 0, l, 0, nListeners);
- listeners = l;
- }
- }
- }
-
- /**
- * Constructs a node and associates it with its owner. Only
- * Document and DocumentType nodes may be created with no owner,
- * and DocumentType nodes get an owner as soon as they are
- * associated with a document.
- */
- protected DomNode(short nodeType, DomDocument owner)
- {
- this.nodeType = nodeType;
-
- if (owner == null)
- {
- // DOM calls never go down this path
- if (nodeType != DOCUMENT_NODE && nodeType != DOCUMENT_TYPE_NODE)
- {
- throw new IllegalArgumentException ("no owner!");
- }
- }
- this.owner = owner;
- }
-
-
- /**
- * DOM L1
- * Returns null; Element subclasses must override this method.
- */
- public NamedNodeMap getAttributes()
- {
- return null;
- }
-
- /**
- * DOM L2>
- * Returns true iff this is an element node with attributes.
- */
- public boolean hasAttributes()
- {
- return false;
- }
-
- /**
- * DOM L1
- * Returns a list, possibly empty, of the children of this node.
- * In this implementation, to conserve memory, nodes are the same
- * as their list of children. This can have ramifications for
- * subclasses, which may need to provide their own getLength method
- * for reasons unrelated to the NodeList method of the same name.
- */
- public NodeList getChildNodes()
- {
- return this;
- }
-
- /**
- * DOM L1
- * Returns the first child of this node, or null if there are none.
- */
- public Node getFirstChild()
- {
- return first;
- }
-
- /**
- * DOM L1
- * Returns the last child of this node, or null if there are none.
- */
- public Node getLastChild()
- {
- return last;
- }
-
- /**
- * DOM L1
- * Returns true if this node has children.
- */
- public boolean hasChildNodes()
- {
- return length != 0;
- }
-
-
- /**
- * Exposes the internal "readonly" flag. In DOM, children of
- * entities and entity references are readonly, as are the
- * objects associated with DocumentType objets.
- */
- public final boolean isReadonly()
- {
- return readonly;
- }
-
- /**
- * Sets the internal "readonly" flag so this subtree can't be changed.
- * Subclasses need to override this method for any associated content
- * that's not a child node, such as an element's attributes or the
- * (few) declarations associated with a DocumentType.
- */
- public void makeReadonly()
- {
- readonly = true;
- for (DomNode child = first; child != null; child = child.next)
- {
- child.makeReadonly();
- }
- }
-
- /**
- * Used to adopt a node to a new document.
- */
- void setOwner(DomDocument doc)
- {
- this.owner = doc;
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- ctx.setOwner(doc);
- }
- }
-
- // just checks the node for inclusion -- may be called many
- // times (docfrag) before anything is allowed to change
- private void checkMisc(DomNode child)
- {
- if (readonly && !owner.building)
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- null, this, 0);
- }
- for (DomNode ctx = this; ctx != null; ctx = ctx.parent)
- {
- if (child == ctx)
- {
- throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR,
- "can't make ancestor into a child",
- this, 0);
- }
- }
-
- DomDocument owner = (nodeType == DOCUMENT_NODE) ? (DomDocument) this :
- this.owner;
- DomDocument childOwner = child.owner;
- short childNodeType = child.nodeType;
-
- if (childOwner != owner)
- {
- // new in DOM L2, this case -- patch it up later, in reparent()
- if (!(childNodeType == DOCUMENT_TYPE_NODE && childOwner == null))
- {
- throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR,
- null, child, 0);
- }
- }
-
- // enforce various structural constraints
- switch (nodeType)
- {
- case DOCUMENT_NODE:
- switch (childNodeType)
- {
- case ELEMENT_NODE:
- case PROCESSING_INSTRUCTION_NODE:
- case COMMENT_NODE:
- case DOCUMENT_TYPE_NODE:
- return;
- }
- break;
-
- case ATTRIBUTE_NODE:
- switch (childNodeType)
- {
- case TEXT_NODE:
- case ENTITY_REFERENCE_NODE:
- return;
- }
- break;
-
- case DOCUMENT_FRAGMENT_NODE:
- case ENTITY_REFERENCE_NODE:
- case ELEMENT_NODE:
- case ENTITY_NODE:
- switch (childNodeType)
- {
- case ELEMENT_NODE:
- case TEXT_NODE:
- case COMMENT_NODE:
- case PROCESSING_INSTRUCTION_NODE:
- case CDATA_SECTION_NODE:
- case ENTITY_REFERENCE_NODE:
- return;
- }
- break;
- }
- if (owner.checkingWellformedness)
- {
- throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR,
- "can't append " +
- nodeTypeToString(childNodeType) +
- " to node of type " +
- nodeTypeToString(nodeType),
- this, 0);
- }
- }
-
- // Here's hoping a good optimizer will detect the case when the
- // next several methods are never called, and won't allocate
- // object code space of any kind. (Case: not reporting any
- // mutation events. We can also remove some static variables
- // listed above.)
-
- private void insertionEvent(DomEvent.DomMutationEvent event,
- DomNode target)
- {
- if (owner == null || owner.building)
- {
- return;
- }
- boolean doFree = false;
-
- if (event == null)
- {
- event = getMutationEvent();
- }
- if (event != null)
- {
- doFree = true;
- }
- else
- {
- event = new DomEvent.DomMutationEvent(null);
- }
- event.initMutationEvent("DOMNodeInserted",
- true /* bubbles */, false /* nocancel */,
- this /* related */, null, null, null, (short) 0);
- target.dispatchEvent(event);
-
- // XXX should really visit every descendant of 'target'
- // and sent a DOMNodeInsertedIntoDocument event to it...
- // bleech, there's no way to keep that acceptably fast.
-
- if (doFree)
- {
- event.target = null;
- event.relatedNode = null;
- event.currentNode = null;
- eventDataLock = false;
- } // else we created work for the GC
- }
-
- private void removalEvent(DomEvent.DomMutationEvent event,
- DomNode target)
- {
- if (owner == null || owner.building)
- {
- return;
- }
- boolean doFree = false;
-
- if (event == null)
- {
- event = getMutationEvent();
- }
- if (event != null)
- {
- doFree = true;
- }
- else
- {
- event = new DomEvent.DomMutationEvent(null);
- }
- event.initMutationEvent("DOMNodeRemoved",
- true /* bubbles */, false /* nocancel */,
- this /* related */, null, null, null, (short) 0);
- target.dispatchEvent(event);
-
- // XXX should really visit every descendant of 'target'
- // and sent a DOMNodeRemovedFromDocument event to it...
- // bleech, there's no way to keep that acceptably fast.
-
- event.target = null;
- event.relatedNode = null;
- event.currentNode = null;
- if (doFree)
- {
- eventDataLock = false;
- }
- // else we created more work for the GC
- }
-
- //
- // Avoid creating lots of memory management work, by using a simple
- // allocation strategy for the mutation event objects that get used
- // at least once per tree modification. We can't use stack allocation,
- // so we do the next simplest thing -- more or less, static allocation.
- // Concurrent notifications should be rare, anyway.
- //
- // Returns the preallocated object, which needs to be carefully freed,
- // or null to indicate the caller needs to allocate their own.
- //
- static private DomEvent.DomMutationEvent getMutationEvent()
- {
- synchronized (lockNode)
- {
- if (eventDataLock)
- {
- return null;
- }
- eventDataLock = true;
- return mutationEvent;
- }
- }
-
- // NOTE: this is manually inlined in the insertion
- // and removal event methods above; change in sync.
- static private void freeMutationEvent()
- {
- // clear fields to enable GC
- mutationEvent.clear();
- eventDataLock = false;
- }
-
- void setDepth(int depth)
- {
- this.depth = depth;
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- ctx.setDepth(depth + 1);
- }
- }
-
- /**
- * DOM L1
- * Appends the specified node to this node's list of children.
- * Document subclasses must override this to enforce the restrictions
- * that there be only one element and document type child.
- *
- * Causes a DOMNodeInserted mutation event to be reported.
- * Will first cause a DOMNodeRemoved event to be reported if the
- * parameter already has a parent. If the new child is a document
- * fragment node, both events will be reported for each child of
- * the fragment; the order in which children are removed and
- * inserted is implementation-specific.
- *
- * If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node appendChild(Node newChild)
- {
- try
- {
- DomNode child = (DomNode) newChild;
-
- if (child.nodeType == DOCUMENT_FRAGMENT_NODE)
- {
- // Append all nodes in the fragment to this node
- for (DomNode ctx = child.first; ctx != null; ctx = ctx.next)
- {
- checkMisc(ctx);
- }
- for (DomNode ctx = child.first; ctx != null; )
- {
- DomNode ctxNext = ctx.next;
- appendChild(ctx);
- ctx = ctxNext;
- }
- }
- else
- {
- checkMisc(child);
- if (child.parent != null)
- {
- child.parent.removeChild(child);
- }
- child.parent = this;
- child.index = length++;
- child.setDepth(depth + 1);
- child.next = null;
- if (last == null)
- {
- first = child;
- child.previous = null;
- }
- else
- {
- last.next = child;
- child.previous = last;
- }
- last = child;
-
- if (reportMutations)
- {
- insertionEvent(null, child);
- }
- }
-
- return child;
- }
- catch (ClassCastException e)
- {
- throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR,
- null, newChild, 0);
- }
- }
-
- /**
- * DOM L1
- * Inserts the specified node in this node's list of children.
- * Document subclasses must override this to enforce the restrictions
- * that there be only one element and document type child.
- *
- * Causes a DOMNodeInserted mutation event to be reported. Will
- * first cause a DOMNodeRemoved event to be reported if the newChild
- * parameter already has a parent. If the new child is a document
- * fragment node, both events will be reported for each child of
- * the fragment; the order in which children are removed and inserted
- * is implementation-specific.
- *
- * If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node insertBefore(Node newChild, Node refChild)
- {
- if (refChild == null)
- {
- return appendChild(newChild);
- }
-
- try
- {
- DomNode child = (DomNode) newChild;
- DomNode ref = (DomNode) refChild;
-
- if (child.nodeType == DOCUMENT_FRAGMENT_NODE)
- {
- // Append all nodes in the fragment to this node
- for (DomNode ctx = child.first; ctx != null; ctx = ctx.next)
- {
- checkMisc(ctx);
- }
- for (DomNode ctx = child.first; ctx != null; )
- {
- DomNode ctxNext = ctx.next;
- insertBefore(ctx, ref);
- ctx = ctxNext;
- }
- }
- else
- {
- checkMisc(child);
- if (ref == null || ref.parent != this)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR,
- null, ref, 0);
- }
- if (ref == child)
- {
- throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR,
- "can't insert node before itself",
- ref, 0);
- }
-
- if (child.parent != null)
- {
- child.parent.removeChild(child);
- }
- child.parent = this;
- int i = ref.index;
- child.setDepth(depth + 1);
- child.next = ref;
- if (ref.previous != null)
- {
- ref.previous.next = child;
- }
- child.previous = ref.previous;
- ref.previous = child;
- if (first == ref)
- {
- first = child;
- }
- // index renumbering
- for (DomNode ctx = child; ctx != null; ctx = ctx.next)
- {
- ctx.index = i++;
- }
-
- if (reportMutations)
- {
- insertionEvent(null, child);
- }
- }
-
- return child;
- }
- catch (ClassCastException e)
- {
- throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR,
- null, newChild, 0);
- }
- }
-
- /**
- * DOM L1
- * Replaces the specified node in this node's list of children.
- * Document subclasses must override this to test the restrictions
- * that there be only one element and document type child.
- *
- * Causes DOMNodeRemoved and DOMNodeInserted mutation event to be
- * reported. Will cause another DOMNodeRemoved event to be reported if
- * the newChild parameter already has a parent. These events may be
- * delivered in any order, except that the event reporting removal
- * from such an existing parent will always be delivered before the
- * event reporting its re-insertion as a child of some other node.
- * The order in which children are removed and inserted is implementation
- * specific.
- *
- * If your application needs to depend on the in which those removal
- * and insertion events are delivered, don't use this API. Instead,
- * invoke the removeChild and insertBefore methods directly, to guarantee
- * a specific delivery order. Similarly, don't use document fragments,
- * Otherwise your application code may not work on a DOM which implements
- * this method differently.
- *
- * If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node replaceChild(Node newChild, Node refChild)
- {
- try
- {
- DomNode child = (DomNode) newChild;
- DomNode ref = (DomNode) refChild;
-
- DomEvent.DomMutationEvent event = getMutationEvent();
- boolean doFree = (event != null);
-
- if (child.nodeType == DOCUMENT_FRAGMENT_NODE)
- {
- // Append all nodes in the fragment to this node
- for (DomNode ctx = child.first; ctx != null; ctx = ctx.next)
- {
- checkMisc(ctx);
- }
- if (ref == null || ref.parent != this)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR,
- null, ref, 0);
- }
-
- if (reportMutations)
- {
- removalEvent(event, ref);
- }
- length--;
- length += child.length;
-
- if (child.length == 0)
- {
- // Removal
- if (ref.previous != null)
- {
- ref.previous.next = ref.next;
- }
- if (ref.next != null)
- {
- ref.next.previous = ref.previous;
- }
- if (first == ref)
- {
- first = ref.next;
- }
- if (last == ref)
- {
- last = ref.previous;
- }
- }
- else
- {
- int i = ref.index;
- for (DomNode ctx = child.first; ctx != null; ctx = ctx.next)
- {
- // Insertion
- ctx.parent = this;
- ctx.index = i++;
- ctx.setDepth(ref.depth);
- if (ctx == child.first)
- {
- ctx.previous = ref.previous;
- }
- if (ctx == child.last)
- {
- ctx.next = ref.next;
- }
- }
- if (first == ref)
- {
- first = child.first;
- }
- if (last == ref)
- {
- last = child.last;
- }
- }
- }
- else
- {
- checkMisc(child);
- if (ref == null || ref.parent != this)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR,
- null, ref, 0);
- }
-
- if (reportMutations)
- {
- removalEvent(event, ref);
- }
-
- if (child.parent != null)
- {
- child.parent.removeChild(child);
- }
- child.parent = this;
- child.index = ref.index;
- child.setDepth(ref.depth);
- if (ref.previous != null)
- {
- ref.previous.next = child;
- }
- child.previous = ref.previous;
- if (ref.next != null)
- {
- ref.next.previous = child;
- }
- child.next = ref.next;
- if (first == ref)
- {
- first = child;
- }
- if (last == ref)
- {
- last = child;
- }
-
- if (reportMutations)
- {
- insertionEvent(event, child);
- }
- if (doFree)
- {
- freeMutationEvent();
- }
- }
- ref.parent = null;
- ref.index = 0;
- ref.setDepth(0);
- ref.previous = null;
- ref.next = null;
-
- return ref;
- }
- catch (ClassCastException e)
- {
- throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR,
- null, newChild, 0);
- }
- }
-
- /**
- * DOM L1
- * Removes the specified child from this node's list of children,
- * or else reports an exception.
- *
- * Causes a DOMNodeRemoved mutation event to be reported.
- *
- * If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node removeChild(Node refChild)
- {
- try
- {
- DomNode ref = (DomNode) refChild;
-
- if (ref == null || ref.parent != this)
- {
- throw new DomDOMException(DOMException.NOT_FOUND_ERR,
- null, ref, 0);
- }
- if (readonly && !owner.building)
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- null, this, 0);
- }
-
- for (DomNode child = first; child != null; child = child.next)
- {
- if (child == ref)
- {
- if (reportMutations)
- {
- removalEvent(null, child);
- }
-
- length--;
- if (ref.previous != null)
- {
- ref.previous.next = ref.next;
- }
- if (ref.next != null)
- {
- ref.next.previous = ref.previous;
- }
- if (first == ref)
- {
- first = ref.next;
- }
- if (last == ref)
- {
- last = ref.previous;
- }
- // renumber indices
- int i = 0;
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- ctx.index = i++;
- }
- ref.parent = null;
- ref.setDepth(0);
- ref.index = 0;
- ref.previous = null;
- ref.next = null;
-
- return ref;
- }
- }
- throw new DomDOMException(DOMException.NOT_FOUND_ERR,
- "that's no child of mine", refChild, 0);
- }
- catch (ClassCastException e)
- {
- throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR,
- null, refChild, 0);
- }
- }
-
- /**
- * DOM L1 (NodeList)
- * Returns the item with the specified index in this NodeList,
- * else null.
- */
- public Node item(int index)
- {
- DomNode child = first;
- int count = 0;
- while (child != null && count < index)
- {
- child = child.next;
- count++;
- }
- return child;
- }
-
- /**
- * DOM L1 (NodeList)
- * Returns the number of elements in this NodeList.
- * (Note that many interfaces have a "Length" property, not just
- * NodeList, and if a node subtype must implement one of those,
- * it will also need to override getChildNodes.)
- */
- public int getLength()
- {
- return length;
- }
-
- /**
- * Minimize extra space consumed by this node to hold children and event
- * listeners.
- */
- public void trimToSize()
- {
- if (listeners != null && listeners.length != nListeners)
- {
- ListenerRecord[] newKids = new ListenerRecord[length];
- System.arraycopy(listeners, 0, newKids, 0, nListeners);
- listeners = newKids;
- }
- }
-
- /**
- * DOM L1
- * Returns the previous sibling, if one is known.
- */
- public Node getNextSibling()
- {
- return next;
- }
-
- /**
- * DOM L1
- * Returns the previous sibling, if one is known.
- */
- public Node getPreviousSibling()
- {
- return previous;
- }
-
- /**
- * DOM L1
- * Returns the parent node, if one is known.
- */
- public Node getParentNode()
- {
- return parent;
- }
-
- /**
- * DOM L2
- * Consults the DOM implementation to determine if the requested
- * feature is supported. DocumentType subclasses must override
- * this method, and associate themselves directly with the
- * DOMImplementation node used. (This method relies on being able
- * to access the DOMImplementation from the owner document, but
- * DocumentType nodes can be created without an owner.)
- */
- public boolean isSupported(String feature, String version)
- {
- Document doc = owner;
- DOMImplementation impl = null;
-
- if (doc == null && nodeType == DOCUMENT_NODE)
- {
- doc = (Document) this;
- }
-
- if (doc == null)
- {
- // possible for DocumentType
- throw new IllegalStateException ("unbound ownerDocument");
- }
-
- impl = doc.getImplementation();
- return impl.hasFeature(feature, version);
- }
-
- /**
- * DOM L1 (modified in L2)
- * Returns the owner document. This is only null for Document nodes,
- * and (new in L2) for DocumentType nodes which have not yet been
- * associated with the rest of their document.
- */
- final public Document getOwnerDocument()
- {
- return owner;
- }
-
- /**
- * DOM L1
- * Does nothing; this must be overridden (along with the
- * getNodeValue method) for nodes with a non-null defined value.
- */
- public void setNodeValue(String value)
- {
- }
-
- /**
- * DOM L1
- * Returns null; this must be overridden for nodes types with
- * a defined value, along with the setNodeValue method.
- */
- public String getNodeValue()
- {
- return null;
- }
-
- /** This forces GCJ compatibility.
- * Without this method GCJ is unable to compile to byte code.
- */
- public final short getNodeType()
- {
- return nodeType;
- }
-
- /** This forces GCJ compatibility.
- * Without this method GCJ seems unable to natively compile GNUJAXP.
- */
- public abstract String getNodeName();
-
- /**
- * DOM L2
- * Does nothing; this must be overridden (along with the
- * getPrefix method) for element and attribute nodes.
- */
- public void setPrefix(String prefix)
- {
- }
-
- /**
- * DOM L2
- * Returns null; this must be overridden for element and
- * attribute nodes.
- */
- public String getPrefix()
- {
- return null;
- }
-
- /**
- * DOM L2
- * Returns null; this must be overridden for element and
- * attribute nodes.
- */
- public String getNamespaceURI()
- {
- return null;
- }
-
- /**
- * DOM L2
- * Returns the node name; this must be overridden for element and
- * attribute nodes.
- */
- public String getLocalName()
- {
- return null;
- }
-
- /**
- * DOM L1
- * Returns a clone of this node which optionally includes cloned
- * versions of child nodes. Clones are always mutable, except for
- * entity reference nodes.
- */
- public Node cloneNode(boolean deep)
- {
- DomNode node = (DomNode) clone();
-
- if (deep)
- {
- DomDocument doc = (nodeType == DOCUMENT_NODE) ?
- (DomDocument) node : node.owner;
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- DomNode newChild = (DomNode) ctx.cloneNode(deep);
- newChild.setOwner(doc);
- node.appendChild(newChild);
- }
- }
-
- if (nodeType == ENTITY_REFERENCE_NODE)
- {
- node.makeReadonly();
- }
- notifyUserDataHandlers(UserDataHandler.NODE_CLONED, this, node);
- return node;
- }
-
- void notifyUserDataHandlers(short op, Node src, Node dst)
- {
- if (userDataHandlers != null)
- {
- for (Iterator i = userDataHandlers.entrySet().iterator(); i.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) i.next();
- String key = (String) entry.getKey();
- UserDataHandler handler = (UserDataHandler) entry.getValue();
- Object data = userData.get(key);
- handler.handle(op, key, data, src, dst);
- }
- }
- }
-
- /**
- * Clones this node; roughly equivalent to cloneNode(false).
- * Element subclasses must provide a new implementation which
- * invokes this method to handle the basics, and then arranges
- * to clone any element attributes directly. Attribute subclasses
- * must make similar arrangements, ensuring that existing ties to
- * elements are broken by cloning.
- */
- public Object clone()
- {
- try
- {
- DomNode node = (DomNode) super.clone();
-
- node.parent = null;
- node.depth = 0;
- node.index = 0;
- node.length = 0;
- node.first = null;
- node.last = null;
- node.previous = null;
- node.next = null;
-
- node.readonly = false;
- node.listeners = null;
- node.nListeners = 0;
- return node;
-
- }
- catch (CloneNotSupportedException x)
- {
- throw new Error("clone didn't work");
- }
- }
-
- // the elements-by-tagname stuff is needed for both
- // elements and documents ... this is in lieu of a
- // common base class between Node and NodeNS.
-
- /**
- * DOM L1
- * Creates a NodeList giving array-style access to elements with
- * the specified name. Access is fastest if indices change by
- * small values, and the DOM is not modified.
- */
- public NodeList getElementsByTagName(String tag)
- {
- return new ShadowList(null, tag);
- }
-
- /**
- * DOM L2
- * Creates a NodeList giving array-style access to elements with
- * the specified namespace and local name. Access is fastest if
- * indices change by small values, and the DOM is not modified.
- */
- public NodeList getElementsByTagNameNS(String namespace, String local)
- {
- return new ShadowList(namespace, local);
- }
-
-
- //
- // This shadow class is GC-able even when the live list it shadows
- // can't be, because of event registration hookups. Its finalizer
- // makes that live list become GC-able.
- //
- final class ShadowList
- implements NodeList
- {
-
- private LiveNodeList liveList;
-
- ShadowList(String ns, String local)
- {
- liveList = new LiveNodeList(ns, local);
- }
-
- public void finalize()
- {
- liveList.detach();
- liveList = null;
- }
-
- public Node item(int index)
- {
- return liveList.item(index);
- }
-
- public int getLength()
- {
- return liveList.getLength();
- }
- }
-
- final class LiveNodeList
- implements NodeList, EventListener, NodeFilter
- {
-
- private final boolean matchAnyURI;
- private final boolean matchAnyName;
- private final String elementURI;
- private final String elementName;
-
- private DomIterator current;
- private int lastIndex;
-
- LiveNodeList(String uri, String name)
- {
- elementURI = uri;
- elementName = name;
- matchAnyURI = "*".equals(uri);
- matchAnyName = "*".equals(name);
-
- DomNode.this.addEventListener("DOMNodeInserted", this, true);
- DomNode.this.addEventListener("DOMNodeRemoved", this, true);
- }
-
- void detach()
- {
- current.detach();
- current = null;
-
- DomNode.this.removeEventListener("DOMNodeInserted", this, true);
- DomNode.this.removeEventListener("DOMNodeRemoved", this, true);
- }
-
- public short acceptNode(Node element)
- {
- if (element == DomNode.this)
- {
- return FILTER_SKIP;
- }
-
- // use namespace-aware matching ...
- if (elementURI != null)
- {
- if (!(matchAnyURI
- || elementURI.equals(element.getNamespaceURI())))
- {
- return FILTER_SKIP;
- }
- if (!(matchAnyName
- || elementName.equals(element.getLocalName())))
- {
- return FILTER_SKIP;
- }
-
- // ... or qName-based kind.
- }
- else
- {
- if (!(matchAnyName
- || elementName.equals(element.getNodeName())))
- {
- return FILTER_SKIP;
- }
- }
- return FILTER_ACCEPT;
- }
-
- private DomIterator createIterator()
- {
- return new DomIterator(DomNode.this,
- NodeFilter.SHOW_ELEMENT,
- this, /* filter */
- true /* expand entity refs */
- );
- }
-
- public void handleEvent(Event e)
- {
- MutationEvent mutation = (MutationEvent) e;
- Node related = mutation.getRelatedNode();
-
- // XXX if it's got children ... check all kids too, they
- // will invalidate our saved index
-
- if (related.getNodeType() != Node.ELEMENT_NODE ||
- related.getNodeName() != elementName ||
- related.getNamespaceURI() != elementURI)
- {
- return;
- }
-
- current = null;
- }
-
- public Node item(int index)
- {
- if (current == null)
- {
- current = createIterator();
- lastIndex = -1;
- }
-
- // last node or before? go backwards
- if (index <= lastIndex) {
- while (index != lastIndex) {
- current.previousNode ();
- lastIndex--;
- }
- Node ret = current.previousNode ();
- current = null;
- return ret;
- }
-
- // somewhere after last node
- while (++lastIndex != index)
- current.nextNode ();
- Node ret = current.nextNode ();
- current = null;
- return ret;
- }
-
- public int getLength()
- {
- int retval = 0;
- NodeIterator iter = createIterator();
-
- while (iter.nextNode() != null)
- {
- retval++;
- }
- current = null;
- return retval;
- }
-
- }
-
- //
- // EventTarget support
- //
- static final class ListenerRecord
- {
-
- String type;
- EventListener listener;
- boolean useCapture;
-
- // XXX use JDK 1.2 java.lang.ref.WeakReference to listener,
- // and we can both get rid of "shadow" classes and remove
- // the need for applications to apply similar trix ... but
- // JDK 1.2 support isn't generally available yet
-
- ListenerRecord(String type, EventListener listener, boolean useCapture)
- {
- this.type = type.intern();
- this.listener = listener;
- this.useCapture = useCapture;
- }
-
- boolean equals(ListenerRecord rec)
- {
- return listener == rec.listener
- && useCapture == rec.useCapture
- && type == rec.type;
- }
-
- }
-
- /**
- * DOM L2 (Events)
- * Returns an instance of the specified type of event object.
- * Understands about DOM Mutation, HTML, and UI events.
- *
- * If the name of the event type begins with "USER-", then an object
- * implementing the "Event" class will be returned; this provides a
- * limited facility for application-defined events to use the DOM event
- * infrastructure. Alternatively, use one of the standard DOM event
- * classes and initialize it using use such a "USER-" event type name;
- * or defin, instantiate, and initialize an application-specific subclass
- * of DomEvent and pass that to dispatchEvent().
- *
- * @param eventType Identifies the particular DOM feature module
- * defining the type of event, such as "MutationEvents".
- * The event "name" is a different kind of "type".
- */
- public Event createEvent(String eventType)
- {
- eventType = eventType.toLowerCase();
-
- if ("mutationevents".equals(eventType))
- {
- return new DomEvent.DomMutationEvent(null);
- }
-
- if ("htmlevents".equals(eventType)
- || "events".equals(eventType)
- || "user-events".equals(eventType))
- {
- return new DomEvent(null);
- }
-
- if ("uievents".equals(eventType))
- {
- return new DomEvent.DomUIEvent(null);
- }
-
- // mouse events
-
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR,
- eventType, null, 0);
- }
-
- /**
- * DOM L2 (Events)
- * Registers an event listener's interest in a class of events.
- */
- public final void addEventListener(String type,
- EventListener listener,
- boolean useCapture)
- {
- if (listeners == null)
- {
- listeners = new ListenerRecord[1];
- }
- else if (nListeners == listeners.length)
- {
- ListenerRecord[] newListeners =
- new ListenerRecord[listeners.length + NKIDS_DELTA];
- System.arraycopy(listeners, 0, newListeners, 0, nListeners);
- listeners = newListeners;
- }
-
- // prune duplicates
- ListenerRecord record;
-
- record = new ListenerRecord(type, listener, useCapture);
- for (int i = 0; i < nListeners; i++)
- {
- if (record.equals(listeners[i]))
- {
- return;
- }
- }
- listeners [nListeners++] = record;
- }
-
- // XXX this exception should be discarded from DOM
-
- // this class can be instantiated, unlike the one in the spec
- static final class DomEventException
- extends EventException
- {
-
- DomEventException()
- {
- super(UNSPECIFIED_EVENT_TYPE_ERR, "unspecified event type");
- }
-
- }
-
- /**
- * DOM L2 (Events)
- * Delivers an event to all relevant listeners, returning true if the
- * caller should perform their default action. Note that the event
- * must have been provided by the createEvent() method on this
- * class, else it can't be dispatched.
- *
- * @see #createEvent
- *
- * @exception NullPointerException When a null event is passed.
- * @exception ClassCastException When the event wasn't provided by
- * the createEvent method, or otherwise isn't a DomEvent.
- * @exception EventException If the event type wasn't specified
- */
- public final boolean dispatchEvent(Event event)
- throws EventException
- {
- DomEvent e = (DomEvent) event;
- DomNode[] ancestors = null;
- int ancestorMax = 0;
- boolean haveDispatchDataLock = false;
-
- if (e.type == null)
- {
- throw new DomEventException();
- }
-
- e.doDefault = true;
- e.target = this;
-
- //
- // Typical case: one nonrecursive dispatchEvent call at a time
- // for this class. If that's our case, we can avoid allocating
- // garbage, which is overall a big win. Even with advanced GCs
- // that deal well with short-lived garbage, and wayfast allocators,
- // it still helps.
- //
- // Remember -- EVERY mutation goes though here at least once.
- //
- // When populating a DOM tree, trying to send mutation events is
- // the primary cost; this dominates the critical path.
- //
- try
- {
- DomNode current;
- int index;
- boolean haveAncestorRegistrations = false;
- ListenerRecord[] notificationSet;
- int ancestorLen;
-
- synchronized (lockNode)
- {
- if (!dispatchDataLock)
- {
- haveDispatchDataLock = dispatchDataLock = true;
- notificationSet = DomNode.notificationSet;
- ancestors = DomNode.ancestors;
- }
- else
- {
- notificationSet = new ListenerRecord[NOTIFICATIONS_INIT];
- ancestors = new DomNode[ANCESTORS_INIT];
- }
- ancestorLen = ancestors.length;
- }
-
- // XXX autogrow ancestors ... based on statistics
-
- // Climb to the top of this subtree and handle capture, letting
- // each node (from the top down) capture until one stops it or
- // until we get to this one.
-
- for (index = 0, current = parent;
- current != null && index < ancestorLen;
- index++, current = current.parent)
- {
- if (current.nListeners != 0)
- {
- haveAncestorRegistrations = true;
- }
- ancestors [index] = current;
- }
- if (current != null)
- {
- throw new RuntimeException("dispatchEvent capture stack size");
- }
-
- ancestorMax = index;
- e.stop = false;
-
- if (haveAncestorRegistrations)
- {
- e.eventPhase = Event.CAPTURING_PHASE;
- while (!e.stop && index-- > 0)
- {
- current = ancestors [index];
- if (current.nListeners != 0)
- {
- notifyNode(e, current, true, notificationSet);
- }
- }
- }
-
- // Always deliver events to the target node (this)
- // unless stopPropagation was called. If we saw
- // no registrations yet (typical!), we never will.
- if (!e.stop && nListeners != 0)
- {
- e.eventPhase = Event.AT_TARGET;
- notifyNode (e, this, false, notificationSet);
- }
- else if (!haveAncestorRegistrations)
- {
- e.stop = true;
- }
-
- // If the event bubbles and propagation wasn't halted,
- // walk back up the ancestor list. Stop bubbling when
- // any bubbled event handler stops it.
-
- if (!e.stop && e.bubbles)
- {
- e.eventPhase = Event.BUBBLING_PHASE;
- for (index = 0;
- !e.stop
- && index < ancestorMax
- && (current = ancestors[index]) != null;
- index++)
- {
- if (current.nListeners != 0)
- {
- notifyNode(e, current, false, notificationSet);
- }
- }
- }
- e.eventPhase = 0;
-
- // Caller chooses whether to perform the default
- // action based on return from this method.
- return e.doDefault;
-
- }
- finally
- {
- if (haveDispatchDataLock)
- {
- // synchronize to force write ordering
- synchronized (lockNode)
- {
- // null out refs to ensure they'll be GC'd
- for (int i = 0; i < ancestorMax; i++)
- {
- ancestors [i] = null;
- }
- // notificationSet handled by notifyNode
-
- dispatchDataLock = false;
- }
- }
- }
- }
-
- private void notifyNode(DomEvent e,
- DomNode current,
- boolean capture,
- ListenerRecord[] notificationSet)
- {
- int count = 0;
-
- // do any of this set of listeners get notified?
- for (int i = 0; i < current.nListeners; i++)
- {
- ListenerRecord rec = current.listeners[i];
-
- if (rec.useCapture != capture)
- {
- continue;
- }
- if (!e.type.equals (rec.type))
- {
- continue;
- }
- if (count >= notificationSet.length)
- {
- // very simple growth algorithm
- int len = Math.max(notificationSet.length, 1);
- ListenerRecord[] tmp = new ListenerRecord[len * 2];
- System.arraycopy(notificationSet, 0, tmp, 0,
- notificationSet.length);
- notificationSet = tmp;
- }
- notificationSet[count++] = rec;
- }
-
- // Notify just those listeners
- e.currentNode = current;
- for (int i = 0; i < count; i++)
- {
- try
- {
- // Late in the DOM CR process (3rd or 4th CR?) the
- // removeEventListener spec became asymmetric with respect
- // to addEventListener ... effect is now immediate.
- for (int j = 0; j < current.nListeners; j++)
- {
- if (current.listeners[j].equals(notificationSet[i]))
- {
- notificationSet[i].listener.handleEvent(e);
- break;
- }
- }
-
- }
- catch (Exception x)
- {
- // ignore all exceptions
- }
- notificationSet[i] = null; // free for GC
- }
- }
-
- /**
- * DOM L2 (Events)
- * Unregisters an event listener.
- */
- public final void removeEventListener(String type,
- EventListener listener,
- boolean useCapture)
- {
- for (int i = 0; i < nListeners; i++)
- {
- if (listeners[i].listener != listener)
- {
- continue;
- }
- if (listeners[i].useCapture != useCapture)
- {
- continue;
- }
- if (!listeners[i].type.equals(type))
- {
- continue;
- }
-
- if (nListeners == 1)
- {
- listeners = null;
- nListeners = 0;
- }
- else
- {
- for (int j = i + 1; j < nListeners; j++)
- {
- listeners[i++] = listeners[j++];
- }
- listeners[--nListeners] = null;
- }
- break;
- }
- // no exceptions reported
- }
-
- /**
- * DOM L1 (relocated in DOM L2)
- * In this node and all contained nodes (including attributes if
- * relevant) merge adjacent text nodes. This is done while ignoring
- * text which happens to use CDATA delimiters).
- */
- public final void normalize()
- {
- // Suspend readonly status
- boolean saved = readonly;
- readonly = false;
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- switch (ctx.nodeType)
- {
- case TEXT_NODE:
- while (ctx.next != null && ctx.next.nodeType == TEXT_NODE)
- {
- Text text = (Text) ctx;
- text.appendData(ctx.next.getNodeValue());
- removeChild(ctx.next);
- }
- break;
- case ELEMENT_NODE:
- NamedNodeMap attrs = ctx.getAttributes();
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- attrs.item(i).normalize();
- }
- // Fall through
- case DOCUMENT_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- case ATTRIBUTE_NODE:
- case ENTITY_REFERENCE_NODE:
- ctx.normalize();
- break;
- }
- }
- readonly = saved;
- }
-
- /**
- * Returns true iff node types match, and either (a) both nodes have no
- * namespace and their getNodeName() values are the same, or (b) both
- * nodes have the same getNamespaceURI() and same getLocalName() values.
- *
- * Note that notion of a "Per-Element-Type" attribute name scope, as
- * found in a non-normative appendix of the XML Namespaces specification,
- * is not supported here. Your application must implement that notion,
- * typically by not bothering to check nameAndTypeEquals for attributes
- * without namespace URIs unless you already know their elements are
- * nameAndTypeEquals.
- */
- public boolean nameAndTypeEquals(Node other)
- {
- if (other == this)
- {
- return true;
- }
- // node types must match
- if (nodeType != other.getNodeType())
- {
- return false;
- }
-
- // if both have namespaces, do a "full" comparision
- // this is a "global" partition
- String ns1 = this.getNamespaceURI();
- String ns2 = other.getNamespaceURI();
-
- if (ns1 != null && ns2 != null)
- {
- return ns1.equals(ns2) &&
- getLocalName().equals(other.getLocalName());
- }
-
- // if neither has a namespace, this is a "no-namespace" name.
- if (ns1 == null && ns2 == null)
- {
- if (!getNodeName().equals(other.getNodeName()))
- {
- return false;
- }
- // can test the non-normative "per-element-type" scope here.
- // if this is an attribute node and both nodes have been bound
- // to elements (!!), then return the nameAndTypeEquals()
- // comparison of those elements.
- return true;
- }
-
- // otherwise they're unequal: one scoped, one not.
- return false;
- }
-
- // DOM Level 3 methods
-
- public String getBaseURI()
- {
- return (parent != null) ? parent.getBaseURI() : null;
- }
-
- public short compareDocumentPosition(Node other)
- throws DOMException
- {
- return (short) compareTo(other);
- }
-
- /**
- * DOM nodes have a natural ordering: document order.
- */
- public final int compareTo(Object other)
- {
- if (other instanceof DomNode)
- {
- DomNode n1 = this;
- DomNode n2 = (DomNode) other;
- if (n1.owner != n2.owner)
- {
- return 0;
- }
- int d1 = n1.depth, d2 = n2.depth;
- int delta = d1 - d2;
- while (d1 > d2)
- {
- n1 = n1.parent;
- d1--;
- }
- while (d2 > d1)
- {
- n2 = n2.parent;
- d2--;
- }
- int c = compareTo2(n1, n2);
- return (c != 0) ? c : delta;
- }
- return 0;
- }
-
- /**
- * Compare two nodes at the same depth.
- */
- final int compareTo2(DomNode n1, DomNode n2)
- {
- if (n1 == n2 || n1.depth == 0 || n2.depth == 0)
- {
- return 0;
- }
- int c = compareTo2(n1.parent, n2.parent);
- return (c != 0) ? c : n1.index - n2.index;
- }
-
- public final String getTextContent()
- throws DOMException
- {
- return getTextContent(true);
- }
-
- final String getTextContent(boolean topLevel)
- throws DOMException
- {
- switch (nodeType)
- {
- case ELEMENT_NODE:
- case ENTITY_NODE:
- case ENTITY_REFERENCE_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- StringBuffer buffer = new StringBuffer();
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- String textContent = ctx.getTextContent(false);
- if (textContent != null)
- {
- buffer.append(textContent);
- }
- }
- return buffer.toString();
- case TEXT_NODE:
- case CDATA_SECTION_NODE:
- if (((Text) this).isElementContentWhitespace())
- {
- return "";
- }
- return getNodeValue();
- case ATTRIBUTE_NODE:
- return getNodeValue();
- case COMMENT_NODE:
- case PROCESSING_INSTRUCTION_NODE:
- return topLevel ? getNodeValue() : "";
- default:
- return null;
- }
- }
-
- public void setTextContent(String textContent)
- throws DOMException
- {
- switch (nodeType)
- {
- case ELEMENT_NODE:
- case ATTRIBUTE_NODE:
- case ENTITY_NODE:
- case ENTITY_REFERENCE_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- for (DomNode ctx = first; ctx != null; )
- {
- DomNode n = ctx.next;
- removeChild(ctx);
- ctx = n;
- }
- if (textContent != null)
- {
- Text text = owner.createTextNode(textContent);
- appendChild(text);
- }
- break;
- case TEXT_NODE:
- case CDATA_SECTION_NODE:
- case COMMENT_NODE:
- case PROCESSING_INSTRUCTION_NODE:
- setNodeValue(textContent);
- break;
- }
- }
-
- public boolean isSameNode(Node other)
- {
- return this == other;
- }
-
- public String lookupPrefix(String namespaceURI)
- {
- return (parent == null || parent == owner) ? null :
- parent.lookupPrefix(namespaceURI);
- }
-
- public boolean isDefaultNamespace(String namespaceURI)
- {
- return (parent == null || parent == owner) ? false :
- parent.isDefaultNamespace(namespaceURI);
- }
-
- public String lookupNamespaceURI(String prefix)
- {
- return (parent == null || parent == owner) ? null :
- parent.lookupNamespaceURI(prefix);
- }
-
- public boolean isEqualNode(Node arg)
- {
- if (this == arg)
- {
- return true;
- }
- if (arg == null)
- {
- return false;
- }
- if (nodeType != arg.getNodeType() ||
- !equal(getNodeName(), arg.getNodeName()) ||
- !equal(getLocalName(), arg.getLocalName()) ||
- !equal(getNamespaceURI(), arg.getNamespaceURI()) ||
- !equal(getPrefix(), arg.getPrefix()) ||
- !equal(getNodeValue(), arg.getNodeValue()))
- {
- return false;
- }
- // Children
- Node argCtx = arg.getFirstChild();
- getFirstChild(); // because of DomAttr lazy children
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- if (!ctx.isEqualNode(argCtx))
- {
- return false;
- }
- argCtx = argCtx.getNextSibling();
- }
- if (argCtx != null)
- {
- return false;
- }
-
- // TODO Attr NamedNodeMap
- // TODO DocumentType
- return true;
- }
-
- boolean equal(String arg1, String arg2)
- {
- return ((arg1 == null && arg2 == null) ||
- (arg1 != null && arg1.equals(arg2)));
- }
-
- public Object getFeature(String feature, String version)
- {
- DOMImplementation impl = (nodeType == DOCUMENT_NODE) ?
- ((Document) this).getImplementation() : owner.getImplementation();
- if (impl.hasFeature(feature, version))
- {
- return this;
- }
- return null;
- }
-
- public Object setUserData(String key, Object data, UserDataHandler handler)
- {
- if (userData == null)
- {
- userData = new HashMap();
- }
- if (handler != null)
- {
- if (userDataHandlers == null)
- {
- userDataHandlers = new HashMap();
- }
- userDataHandlers.put(key, handler);
- }
- return userData.put(key, data);
- }
-
- public Object getUserData(String key)
- {
- if (userData == null)
- {
- return null;
- }
- return userData.get(key);
- }
-
- public String toString()
- {
- String nodeName = getNodeName();
- String nodeValue = getNodeValue();
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- if (nodeName != null)
- {
- buf.append(nodeName);
- }
- if (nodeValue != null)
- {
- if (nodeName != null)
- {
- buf.append('=');
- }
- buf.append('\'');
- buf.append(encode(nodeValue));
- buf.append('\'');
- }
- buf.append(']');
- return buf.toString();
- }
-
- String encode(String value)
- {
- StringBuffer buf = null;
- int len = value.length();
- for (int i = 0; i < len; i++)
- {
- char c = value.charAt(i);
- if (c == '\n')
- {
- if (buf == null)
- {
- buf = new StringBuffer(value.substring(0, i));
- }
- buf.append("\\n");
- }
- else if (c == '\r')
- {
- if (buf == null)
- {
- buf = new StringBuffer(value.substring(0, i));
- }
- buf.append("\\r");
- }
- else if (buf != null)
- {
- buf.append(c);
- }
- }
- return (buf != null) ? buf.toString() : value;
- }
-
- String nodeTypeToString(short nodeType)
- {
- switch (nodeType)
- {
- case ELEMENT_NODE:
- return "ELEMENT_NODE";
- case ATTRIBUTE_NODE:
- return "ATTRIBUTE_NODE";
- case TEXT_NODE:
- return "TEXT_NODE";
- case CDATA_SECTION_NODE:
- return "CDATA_SECTION_NODE";
- case DOCUMENT_NODE:
- return "DOCUMENT_NODE";
- case DOCUMENT_TYPE_NODE:
- return "DOCUMENT_TYPE_NODE";
- case COMMENT_NODE:
- return "COMMENT_NODE";
- case PROCESSING_INSTRUCTION_NODE:
- return "PROCESSING_INSTRUCTION_NODE";
- case DOCUMENT_FRAGMENT_NODE:
- return "DOCUMENT_FRAGMENT_NODE";
- case ENTITY_NODE:
- return "ENTITY_NODE";
- case ENTITY_REFERENCE_NODE:
- return "ENTITY_REFERENCE_NODE";
- case NOTATION_NODE:
- return "NOTATION_NODE";
- default:
- return "UNKNOWN";
- }
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomNodeIterator.java b/libjava/gnu/xml/dom/DomNodeIterator.java
deleted file mode 100644
index 6079f7a126a..00000000000
--- a/libjava/gnu/xml/dom/DomNodeIterator.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/* DomNodeIterator.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-package gnu.xml.dom;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-import org.w3c.dom.traversal.TreeWalker;
-
-/**
- * Node iterator and tree walker.
- *
- * @author Chris Burdess
- */
-public class DomNodeIterator
- implements NodeIterator, TreeWalker
-{
-
- Node root;
- final int whatToShow;
- final NodeFilter filter;
- final boolean entityReferenceExpansion;
- final boolean walk;
- Node current;
-
- public DomNodeIterator(Node root, int whatToShow, NodeFilter filter,
- boolean entityReferenceExpansion, boolean walk)
- {
- if (root == null)
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "null root");
- }
- this.root = root;
- this.whatToShow = whatToShow;
- this.filter = filter;
- this.entityReferenceExpansion = entityReferenceExpansion;
- this.walk = walk;
- current = root;
- }
-
- public Node getRoot()
- {
- return root;
- }
-
- public int getWhatToShow()
- {
- return whatToShow;
- }
-
- public NodeFilter getFilter()
- {
- return filter;
- }
-
- public boolean getExpandEntityReferences()
- {
- return entityReferenceExpansion;
- }
-
- public Node nextNode()
- throws DOMException
- {
- if (root == null)
- {
- throw new DOMException(DOMException.INVALID_STATE_ERR, "null root");
- }
- Node ret;
- do
- {
- if (current.equals(root))
- {
- ret = root.getFirstChild();
- }
- else if (walk)
- {
- ret = current.getFirstChild();
- if (ret == null)
- {
- ret = current.getNextSibling();
- }
- if (ret == null)
- {
- Node tmp = current;
- ret = tmp.getParentNode();
- while (!ret.equals(root) && tmp.equals(ret.getLastChild()))
- {
- tmp = ret;
- ret = tmp.getParentNode();
- }
- if (ret.equals(root))
- {
- ret = null;
- }
- else
- {
- ret = ret.getNextSibling();
- }
- }
- }
- else
- {
- ret = current.getNextSibling();
- }
- }
- while (!accept(ret));
- current = (ret == null) ? current : ret;
- return ret;
- }
-
- public Node previousNode()
- throws DOMException
- {
- if (root == null)
- {
- throw new DOMException(DOMException.INVALID_STATE_ERR, "null root");
- }
- Node ret;
- do
- {
- if (current.equals(root))
- {
- ret = current.getLastChild();
- }
- else if (walk)
- {
- ret = current.getLastChild();
- if (ret == null)
- {
- ret = current.getPreviousSibling();
- }
- if (ret == null)
- {
- Node tmp = current;
- ret = tmp.getParentNode();
- while (!ret.equals(root) && tmp.equals(ret.getFirstChild()))
- {
- tmp = ret;
- ret = tmp.getParentNode();
- }
- if (ret.equals(root))
- {
- ret = null;
- }
- else
- {
- ret = ret.getPreviousSibling();
- }
- }
- }
- else
- {
- ret = current.getPreviousSibling();
- }
- }
- while (!accept(ret));
- current = (ret == null) ? current : ret;
- return ret;
- }
-
- public Node getCurrentNode()
- {
- return current;
- }
-
- public void setCurrentNode(Node current)
- throws DOMException
- {
- if (current == null)
- {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "null root");
- }
- this.current = current;
- }
-
- public Node parentNode()
- {
- Node ret = current.getParentNode();
- if (!accept (ret))
- {
- ret = null;
- }
- current = (ret == null) ? current : ret;
- return ret;
- }
-
- public Node firstChild ()
- {
- Node ret = current.getFirstChild();
- while (!accept(ret))
- {
- ret = ret.getNextSibling();
- }
- current = (ret == null) ? current : ret;
- return ret;
- }
-
- public Node lastChild()
- {
- Node ret = current.getLastChild();
- while (!accept(ret))
- {
- ret = ret.getPreviousSibling();
- }
- current = (ret == null) ? current : ret;
- return ret;
- }
-
- public Node previousSibling()
- {
- Node ret = current.getPreviousSibling();
- while (!accept(ret))
- {
- ret = ret.getPreviousSibling();
- }
- current = (ret == null) ? current : ret;
- return ret;
- }
-
- public Node nextSibling()
- {
- Node ret = current.getNextSibling();
- while (!accept(ret))
- {
- ret = ret.getNextSibling();
- }
- current = (ret == null) ? current : ret;
- return ret;
- }
-
- public void detach()
- {
- root = null;
- }
-
- boolean accept(Node node)
- {
- if (node == null)
- {
- return true;
- }
- boolean ret;
- switch (node.getNodeType())
- {
- case Node.ATTRIBUTE_NODE:
- ret = (whatToShow & NodeFilter.SHOW_ATTRIBUTE) != 0;
- break;
- case Node.CDATA_SECTION_NODE:
- ret = (whatToShow & NodeFilter.SHOW_CDATA_SECTION) != 0;
- break;
- case Node.COMMENT_NODE:
- ret = (whatToShow & NodeFilter.SHOW_COMMENT) != 0;
- break;
- case Node.DOCUMENT_NODE:
- ret = (whatToShow & NodeFilter.SHOW_DOCUMENT) != 0;
- break;
- case Node.DOCUMENT_FRAGMENT_NODE:
- ret = (whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT) != 0;
- break;
- case Node.DOCUMENT_TYPE_NODE:
- ret = (whatToShow & NodeFilter.SHOW_DOCUMENT_TYPE) != 0;
- break;
- case Node.ELEMENT_NODE:
- ret = (whatToShow & NodeFilter.SHOW_ELEMENT) != 0;
- break;
- case Node.ENTITY_NODE:
- ret = (whatToShow & NodeFilter.SHOW_ENTITY) != 0;
- break;
- case Node.ENTITY_REFERENCE_NODE:
- ret = (whatToShow & NodeFilter.SHOW_ENTITY_REFERENCE) != 0;
- ret = ret && entityReferenceExpansion;
- break;
- case Node.NOTATION_NODE:
- ret = (whatToShow & NodeFilter.SHOW_NOTATION) != 0;
- break;
- case Node.PROCESSING_INSTRUCTION_NODE:
- ret = (whatToShow & NodeFilter.SHOW_PROCESSING_INSTRUCTION) != 0;
- break;
- case Node.TEXT_NODE:
- ret = (whatToShow & NodeFilter.SHOW_TEXT) != 0;
- break;
- default:
- ret = true;
- }
- if (ret && filter != null)
- {
- ret = (filter.acceptNode(node) == NodeFilter.FILTER_ACCEPT);
- }
- return ret;
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomNotation.java b/libjava/gnu/xml/dom/DomNotation.java
deleted file mode 100644
index 26e78724f27..00000000000
--- a/libjava/gnu/xml/dom/DomNotation.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/* DomNotation.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.Notation;
-
-/**
- * "Notation" implementation. This is a non-core DOM class, supporting
- * the "XML" feature. Although unparsed entities using this notation can be detected using
- * DOM, neither NOTATIONS nor ENTITY/ENTITIES attributes can be so detected.
- * More, there is no portable way to construct a Notation node, so there's
- * no way that vendor-neutral DOM construction APIs could even report a
- * NOTATION used to identify the intended meaning of a ProcessingInstruction.
- * In short, avoid using this DOM functionality.
- *
- * @see DomDoctype
- * @see DomEntity
- * @see DomPI
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public class DomNotation
- extends DomExtern
- implements Notation
-{
-
- /**
- * Constructs a Notation node associated with the specified document,
- * with the specified descriptive data. Note that at least one of
- * the PUBLIC and SYSTEM identifiers must be provided; unlike other
- * external objects in XML, notations may have only a PUBLIC identifier.
- *
- * This constructor should only be invoked by a DomDoctype object
- * as part of its declareNotation functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this notation is associated
- * @param name Name of this notation
- * @param publicId If non-null, provides the notation's PUBLIC identifier
- * @param systemId If non-null, rovides the notation's SYSTEM identifier
- */
- protected DomNotation(DomDocument owner,
- String name,
- String publicId,
- String systemId)
- {
- super(NOTATION_NODE, owner, name, publicId, systemId);
- makeReadonly();
- }
-
- /**
- * The base URI of an external entity is its system ID.
- * The base URI of an internal entity is the parent document's base URI.
- * @since DOM Level 3 Core
- */
- public String getBaseURI()
- {
- String systemId = getSystemId();
- return (systemId == null) ? owner.getBaseURI() : systemId;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomNsNode.java b/libjava/gnu/xml/dom/DomNsNode.java
deleted file mode 100644
index 4dec5af21d7..00000000000
--- a/libjava/gnu/xml/dom/DomNsNode.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/* DomNsNode.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import javax.xml.XMLConstants;
-import org.w3c.dom.DOMException;
-
-/**
- * Abstract implemention of namespace support. This facilitates
- * sharing code for attribute and element nodes.
- *
- * @author David Brownell
- * @author Chris Burdess
- */
-public abstract class DomNsNode
- extends DomNode
-{
-
- private String name;
- private String namespace;
- private String prefix;
- private String localName;
-
- /**
- * Constructs a node associated with the specified document, and
- * with the specified namespace information.
- *
- * @param owner The document with which this entity is associated
- * @param namespaceURI Combined with the local part of the name,
- * this identifies a type of element or attribute; may be null.
- * If this is the empty string, it is reassigned as null so that
- * applications only need to test that case.
- * @param name Name of this node, which may include a prefix
- */
- // package private
- DomNsNode(short nodeType, DomDocument owner, String namespaceURI, String name)
- {
- super(nodeType, owner);
- setNodeName(name);
- setNamespaceURI(namespaceURI);
- }
-
- /**
- * DOM L1
- * Returns the node's name, including any namespace prefix.
- */
- public final String getNodeName()
- {
- return name;
- }
-
- final void setNodeName(String name)
- {
- this.name = name.intern();
- int index = name.indexOf(':');
- if (index == -1)
- {
- prefix = null;
- localName = this.name;
- }
- else
- {
- prefix = name.substring(0, index).intern();
- localName = name.substring(index + 1).intern();
- }
- }
-
- /**
- * DOM L2
- * Returns the node's namespace URI
- * or null if the node name is not namespace scoped.
- */
- public final String getNamespaceURI()
- {
- return namespace;
- }
-
- final void setNamespaceURI(String namespaceURI)
- {
- if ("".equals(namespaceURI))
- {
- namespaceURI = null;
- }
- namespace = (namespaceURI == null) ? null : namespaceURI.intern();
- }
-
- /**
- * DOM L2
- * Returns any prefix part of the node's name (before any colon).
- */
- public final String getPrefix()
- {
- return prefix;
- }
-
- /**
- * DOM L2
- * Assigns the prefix part of the node's name (before any colon).
- */
- public final void setPrefix(String prefix)
- {
- if (readonly)
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
-
- if (prefix == null)
- {
- name = localName;
- return;
- }
- else if (namespace == null)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "can't set prefix, node has no namespace URI",
- this, 0);
- }
-
- DomDocument.checkName(prefix, "1.1".equals(owner.getXmlVersion()));
- if (prefix.indexOf (':') != -1)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "illegal prefix " + prefix, this, 0);
- }
-
- if (XMLConstants.XML_NS_PREFIX.equals(prefix)
- && !XMLConstants.XML_NS_URI.equals(namespace))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xml namespace is always " +
- XMLConstants.XML_NS_URI, this, 0);
- }
-
- if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix))
- {
- if (namespace != null || getNodeType() != ATTRIBUTE_NODE)
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "xmlns attribute prefix is reserved",
- this, 0);
- }
- }
- else if (getNodeType () == ATTRIBUTE_NODE
- && (XMLConstants.XMLNS_ATTRIBUTE.equals(name) ||
- name.startsWith("xmlns:")))
- {
- throw new DomDOMException(DOMException.NAMESPACE_ERR,
- "namespace declarations can't change names",
- this, 0);
- }
-
- this.prefix = prefix.intern();
- }
-
- /**
- * DOM L2
- * Returns the local part of the node's name (after any colon).
- */
- public final String getLocalName()
- {
- return localName;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomProcessingInstruction.java b/libjava/gnu/xml/dom/DomProcessingInstruction.java
deleted file mode 100644
index 2c90967d00f..00000000000
--- a/libjava/gnu/xml/dom/DomProcessingInstruction.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/* DomProcessingInstruction.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.ProcessingInstruction;
-
-/**
- * "ProcessingInstruction" (PI) implementation.
- * This is a non-core DOM class, supporting the "XML" feature. Unlike other DOM APIs in the "XML" feature, this one fully
- * exposes the functionality it describes. So there is no reason
- * inherent in DOM to avoid using this API, unless you want to rely
- * on NOTATION declarations to associate meaning with your PIs;
- * there is no vendor-neutal way to record those notations in DOM. Also of note is that PI support is part of SAX, so that XML
- * systems using PIs can choose among multiple APIs. This constructor should only be invoked by a Document object as
- * part of its createProcessingInstruction functionality, or through
- * a subclass which is similarly used in a "Sub-DOM" style layer.
- */
- protected DomProcessingInstruction(DomDocument owner,
- String target, String data)
- {
- super(PROCESSING_INSTRUCTION_NODE, owner);
- this.target = target;
- this.data = data;
- }
-
- /**
- * DOM L1
- * Returns the target of the processing instruction.
- */
- public final String getTarget()
- {
- return target;
- }
-
- /**
- * DOM L1
- * Returns the target of the processing instruction
- * (same as getTarget).
- */
- public final String getNodeName()
- {
- return target;
- }
-
- /**
- * DOM L1
- * Returns the data associated with the processing instruction.
- */
- public final String getData()
- {
- return data;
- }
-
- /**
- * DOM L1
- * Returns the data associated with the processing instruction
- * (same as getData).
- */
- public final String getNodeValue()
- {
- return data;
- }
-
- /**
- * DOM L1
- * Assigns the data associated with the processing instruction;
- * same as setNodeValue.
- */
- public final void setData(String data)
- {
- setNodeValue(data);
- }
-
- /**
- * DOM L1
- * Assigns the data associated with the processing instruction.
- */
- public final void setNodeValue(String data)
- {
- if (isReadonly())
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- this.data = data;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomText.java b/libjava/gnu/xml/dom/DomText.java
deleted file mode 100644
index 3ca17dc9b87..00000000000
--- a/libjava/gnu/xml/dom/DomText.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/* DomText.java --
- Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Text;
-
-/**
- * "Text" implementation. This constructor should only be invoked by a Document object
- * as part of its createTextNode functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
- */
- protected DomText(DomDocument owner, String value)
- {
- super(TEXT_NODE, owner, value);
- }
-
- protected DomText(DomDocument owner, char[] buf, int off, int len)
- {
- super(TEXT_NODE, owner, buf, off, len);
- }
-
- // Used by DomCDATA
- DomText(short nodeType, DomDocument owner, String value)
- {
- super(nodeType, owner, value);
- }
-
- DomText(short nodeType, DomDocument owner, char[] buf, int off, int len)
- {
- super(nodeType, owner, buf, off, len);
- }
-
- /**
- * DOM L1
- * Returns the string "#text".
- */
- // can't be 'final' with CDATA subclassing
- public String getNodeName()
- {
- return "#text";
- }
-
- /**
- * DOM L1
- * Splits this text node in two parts at the offset, returning
- * the new text node (the sibling with the second part).
- */
- public Text splitText(int offset)
- {
- if (isReadonly())
- {
- throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- try
- {
- String text = getNodeValue();
- String before = text.substring(0, offset);
- String after = text.substring(offset);
- Text next;
-
- if (getNodeType() == TEXT_NODE)
- {
- next = owner.createTextNode(after);
- }
- else // CDATA_SECTION_NODE
- {
- next = owner.createCDATASection(after);
- }
-
- if (this.next != null)
- {
- parent.insertBefore(next, this.next);
- }
- else
- {
- parent.appendChild(next);
- }
- setNodeValue(before);
- return next;
-
- }
- catch (IndexOutOfBoundsException x)
- {
- throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
- }
- }
-
- // DOM Level 3
-
- public boolean isElementContentWhitespace()
- {
- if (parent != null)
- {
- DomDoctype doctype = (DomDoctype) owner.getDoctype();
- if (doctype != null)
- {
- DTDElementTypeInfo info =
- doctype.getElementTypeInfo(parent.getNodeName());
- if (info != null)
- {
- if (info.model == null && info.model.indexOf("#PCDATA") != -1)
- {
- return false;
- }
- return getNodeValue().trim().length() == 0;
- }
- }
- }
- return false;
- }
-
- public String getWholeText()
- {
- DomNode ref = this;
- DomNode ctx;
- for (ctx = previous; ctx != null &&
- (ctx.nodeType == TEXT_NODE || ctx.nodeType == CDATA_SECTION_NODE);
- ctx = ctx.previous)
- {
- ref = ctx;
- }
- StringBuffer buf = new StringBuffer(ref.getNodeValue());
- for (ctx = ref.next; ctx != null &&
- (ctx.nodeType == TEXT_NODE || ctx.nodeType == CDATA_SECTION_NODE);
- ctx = ctx.next)
- {
- buf.append(ctx.getNodeValue());
- }
- return buf.toString ();
- }
-
- public Text replaceWholeText(String content)
- throws DOMException
- {
- boolean isEmpty = (content == null || content.length () == 0);
- if (!isEmpty)
- {
- setNodeValue(content);
- }
-
- DomNode ref = this;
- DomNode ctx;
- for (ctx = previous; ctx != null &&
- (ctx.nodeType == TEXT_NODE || ctx.nodeType == CDATA_SECTION_NODE);
- ctx = ctx.previous)
- {
- ref = ctx;
- }
- ctx = ref.next;
- if ((isEmpty || ref != this) && parent != null)
- {
- parent.removeChild(ref);
- }
- for (; ctx != null &&
- (ctx.nodeType == TEXT_NODE || ctx.nodeType == CDATA_SECTION_NODE);
- ctx = ref)
- {
- ref = ctx.next;
- if ((isEmpty || ctx != this) && parent != null)
- {
- parent.removeChild(ctx);
- }
- }
- return (isEmpty) ? null : this;
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomXPathExpression.java b/libjava/gnu/xml/dom/DomXPathExpression.java
deleted file mode 100644
index 25187520c0f..00000000000
--- a/libjava/gnu/xml/dom/DomXPathExpression.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/* DomXPathExpression.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.xpath.XPathException;
-import org.w3c.dom.xpath.XPathNSResolver;
-import org.w3c.dom.xpath.XPathResult;
-import gnu.xml.xpath.DocumentOrderComparator;
-
-/**
- * An XPath expression.
- *
- * @author Chris Burdess
- */
-class DomXPathExpression
-implements org.w3c.dom.xpath.XPathExpression
-{
-
- final DomDocument doc;
- final XPathExpression expression;
- final XPathNSResolver resolver;
-
- DomXPathExpression(DomDocument doc, String expression,
- XPathNSResolver resolver)
- throws XPathException
- {
- this.doc = doc;
- this.resolver = resolver;
-
- XPathFactory factory = XPathFactory.newInstance();
- XPath xpath = factory.newXPath();
- if (resolver != null)
- {
- xpath.setNamespaceContext(new DomNSResolverContext(resolver));
- }
- try
- {
- this.expression = xpath.compile(expression);
- }
- catch (XPathExpressionException e)
- {
- throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,
- e.getMessage ());
- }
- }
-
- public Object evaluate(Node contextNode, short type, Object result)
- throws XPathException, DOMException
- {
- try
- {
- QName typeName = null;
- switch (type)
- {
- case XPathResult.BOOLEAN_TYPE:
- typeName = XPathConstants.BOOLEAN;
- break;
- case XPathResult.NUMBER_TYPE:
- typeName = XPathConstants.NUMBER;
- break;
- case XPathResult.STRING_TYPE:
- typeName = XPathConstants.STRING;
- break;
- case XPathResult.ANY_UNORDERED_NODE_TYPE:
- case XPathResult.FIRST_ORDERED_NODE_TYPE:
- typeName = XPathConstants.NODE;
- break;
- case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- typeName = XPathConstants.NODESET;
- break;
- default:
- throw new XPathException(XPathException.TYPE_ERR, null);
- }
- Object val = expression.evaluate(contextNode, typeName);
- switch (type)
- {
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- // Sort the nodes
- List ns = new ArrayList((Collection) val);
- Collections.sort(ns, new DocumentOrderComparator());
- val = ns;
- }
- return new DomXPathResult(val, type);
- }
- catch (javax.xml.xpath.XPathException e)
- {
- throw new XPathException(XPathException.TYPE_ERR, e.getMessage());
- }
- }
-
- public String toString ()
- {
- return getClass ().getName () + "[expression=" + expression + "]";
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomXPathNSResolver.java b/libjava/gnu/xml/dom/DomXPathNSResolver.java
deleted file mode 100644
index 96dfd97d46a..00000000000
--- a/libjava/gnu/xml/dom/DomXPathNSResolver.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* DomXPathNSResolver.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.xpath.XPathNSResolver;
-
-/**
- * Generic XPath namespace resolver using a DOM Node.
- *
- * @author Chris Burdess
- */
-class DomXPathNSResolver
-implements XPathNSResolver
-{
-
- Node node;
-
- DomXPathNSResolver (Node node)
- {
- this.node = node;
- }
-
- public String lookupNamespaceURI (String prefix)
- {
- return node.lookupNamespaceURI (prefix);
- }
-
-}
diff --git a/libjava/gnu/xml/dom/DomXPathResult.java b/libjava/gnu/xml/dom/DomXPathResult.java
deleted file mode 100644
index bed249624f9..00000000000
--- a/libjava/gnu/xml/dom/DomXPathResult.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/* DomXPathResult.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.Collection;
-import java.util.Iterator;
-import org.w3c.dom.Node;
-import org.w3c.dom.xpath.XPathException;
-import org.w3c.dom.xpath.XPathResult;
-
-/**
- * An XPath result object.
- *
- * @author Chris Burdess
- */
-class DomXPathResult
-implements XPathResult
-{
-
- final Object value;
- final short type;
- Iterator iterator;
-
- DomXPathResult (Object value, short requestedType)
- {
- this.value = value;
- if (value instanceof Boolean)
- {
- type = XPathResult.BOOLEAN_TYPE;
- }
- else if (value instanceof Double)
- {
- type = XPathResult.NUMBER_TYPE;
- }
- else if (value instanceof String)
- {
- type = XPathResult.STRING_TYPE;
- }
- else if (value instanceof Collection)
- {
- Collection ns = (Collection) value;
- switch (requestedType)
- {
- case XPathResult.ANY_TYPE:
- case XPathResult.ANY_UNORDERED_NODE_TYPE:
- type = (ns.size () == 1) ? XPathResult.FIRST_ORDERED_NODE_TYPE :
- XPathResult.ORDERED_NODE_ITERATOR_TYPE;
- break;
- default:
- type = requestedType;
- }
- iterator = ns.iterator ();
- }
- else
- {
- throw new IllegalArgumentException ();
- }
- }
-
- public boolean getBooleanValue()
- {
- if (type == XPathResult.BOOLEAN_TYPE)
- {
- return ((Boolean) value).booleanValue ();
- }
- throw new XPathException (XPathException.TYPE_ERR, value.toString ());
- }
-
- public boolean getInvalidIteratorState()
- {
- return iterator == null;
- }
-
- public double getNumberValue()
- {
- if (type == XPathResult.NUMBER_TYPE)
- {
- return ((Double) value).doubleValue ();
- }
- throw new XPathException (XPathException.TYPE_ERR, value.toString ());
- }
-
- public short getResultType()
- {
- return type;
- }
-
- public Node getSingleNodeValue()
- {
- switch (type)
- {
- case XPathResult.FIRST_ORDERED_NODE_TYPE:
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
- Collection ns = (Collection) value;
- if (ns.isEmpty ())
- {
- return null;
- }
- else
- {
- return (Node) ns.iterator ().next ();
- }
- }
- throw new XPathException (XPathException.TYPE_ERR, value.toString ());
- }
-
- public int getSnapshotLength()
- {
- switch (type)
- {
- case XPathResult.FIRST_ORDERED_NODE_TYPE:
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
- return ((Collection) value).size ();
- }
- throw new XPathException (XPathException.TYPE_ERR, value.toString ());
- }
-
- public String getStringValue()
- {
- if (type == XPathResult.STRING_TYPE)
- {
- return (String) value;
- }
- throw new XPathException (XPathException.TYPE_ERR, value.toString ());
- }
-
- public Node iterateNext()
- {
- if (iterator != null)
- {
- if (iterator.hasNext ())
- {
- return (Node) iterator.next ();
- }
- else
- {
- iterator = null;
- return null;
- }
- }
- throw new XPathException (XPathException.TYPE_ERR, value.toString ());
- }
-
- public Node snapshotItem(int index)
- {
- switch (type)
- {
- case XPathResult.FIRST_ORDERED_NODE_TYPE:
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
- case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
- Collection ns = (Collection) value;
- Node[] nodes = new Node[ns.size ()];
- ns.toArray (nodes);
- return nodes[index];
- }
- throw new XPathException (XPathException.TYPE_ERR, value.toString ());
- }
-
- public String toString ()
- {
- return getClass ().getName () + "[type=" + typeName (type) + ",value=" +
- value + ']';
- }
-
- private String typeName (short type)
- {
- switch (type)
- {
- case XPathResult.BOOLEAN_TYPE:
- return "BOOLEAN_TYPE";
- case XPathResult.NUMBER_TYPE:
- return "NUMBER_TYPE";
- case XPathResult.STRING_TYPE:
- return "STRING_TYPE";
- case XPathResult.FIRST_ORDERED_NODE_TYPE:
- return "FIRST_ORDERED_NODE_TYPE";
- case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
- return "ORDERED_NODE_ITERATOR_TYPE";
- case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
- return "ORDERED_NODE_SNAPSHOT_TYPE";
- case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
- return "UNORDERED_NODE_ITERATOR_TYPE";
- case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
- return "UNORDERED_NODE_SNAPSHOT_TYPE";
- default:
- return "(unknown)";
- }
- }
-
-}
diff --git a/libjava/gnu/xml/dom/ImplementationList.java b/libjava/gnu/xml/dom/ImplementationList.java
deleted file mode 100644
index 8c0f4491610..00000000000
--- a/libjava/gnu/xml/dom/ImplementationList.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ImplementationList.java --
- Copyright (C) 2004 Free Software Foundation, Inc..
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-package gnu.xml.dom;
-
-import java.util.List;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DOMImplementationList;
-
-/**
- * Implementation list for GNU JAXP.
- *
- * @author Chris Burdess
- */
-public class ImplementationList
- implements DOMImplementationList
-{
-
- private List list;
-
- ImplementationList(List list)
- {
- this.list = list;
- }
-
- public int getLength()
- {
- return list.size();
- }
-
- public DOMImplementation item(int index)
- {
- return (DOMImplementation) list.get(index);
- }
-
-}
diff --git a/libjava/gnu/xml/dom/ImplementationSource.java b/libjava/gnu/xml/dom/ImplementationSource.java
deleted file mode 100644
index 913079cd0c3..00000000000
--- a/libjava/gnu/xml/dom/ImplementationSource.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/* ImplementationSource.java --
- Copyright (C) 2004 Free Software Foundation, Inc..
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-package gnu.xml.dom;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DOMImplementationList;
-import org.w3c.dom.DOMImplementationSource;
-
-/**
- * Implementation source for GNU JAXP.
- *
- * @author Chris Burdess
- */
-public class ImplementationSource
- implements DOMImplementationSource
-{
-
- private static final String DIGITS = "1234567890";
-
- /*
- * GNU DOM implementations.
- */
- private static final DOMImplementation[] implementations;
-
- static
- {
- List acc = new ArrayList();
- acc.add(new gnu.xml.dom.DomImpl());
- try
- {
- Class t = Class.forName("gnu.xml.libxmlj.dom.GnomeDocumentBuilder");
- acc.add(t.newInstance());
- }
- catch (Exception e)
- {
- // libxmlj not available
- }
- catch (UnsatisfiedLinkError e)
- {
- // libxmlj not available
- }
- implementations = new DOMImplementation[acc.size()];
- acc.toArray(implementations);
- }
-
- public DOMImplementation getDOMImplementation(String features)
- {
- List available = getImplementations(features);
- if (available.isEmpty())
- {
- return null;
- }
- return (DOMImplementation) available.get(0);
- }
-
- public DOMImplementationList getDOMImplementationList(String features)
- {
- List available = getImplementations(features);
- return new ImplementationList(available);
- }
-
- /**
- * Returns a list of the implementations that support the specified
- * features.
- */
- private final List getImplementations(String features)
- {
- List available = new ArrayList(Arrays.asList(implementations));
- for (Iterator i = parseFeatures(features).iterator(); i.hasNext(); )
- {
- String feature = (String) i.next();
- String version = null;
- int si = feature.indexOf(' ');
- if (si != -1)
- {
- version = feature.substring(si + 1);
- feature = feature.substring(0, si);
- }
- for (Iterator j = available.iterator(); j.hasNext(); )
- {
- DOMImplementation impl = (DOMImplementation) j.next();
- if (!impl.hasFeature(feature, version))
- {
- j.remove();
- }
- }
- }
- return available;
- }
-
- /**
- * Parses the feature list into feature tokens.
- */
- final List parseFeatures(String features)
- {
- List list = new ArrayList();
- int pos = 0, start = 0;
- int len = features.length();
- for (; pos < len; pos++)
- {
- char c = features.charAt(pos);
- if (c == ' ')
- {
- if (pos + 1 < len &&
- DIGITS.indexOf(features.charAt(pos + 1)) == -1)
- {
- list.add(getFeature(features, start, pos));
- start = pos + 1;
- }
- }
- }
- if (pos > start)
- {
- list.add(getFeature(features, start, len));
- }
- return list;
- }
-
- final String getFeature(String features, int start, int end)
- {
- if (features.length() > 0 && features.charAt(start) == '+')
- {
- return features.substring(start + 1, end);
- }
- return features.substring(start, end);
- }
-
-}
diff --git a/libjava/gnu/xml/dom/JAXPFactory.java b/libjava/gnu/xml/dom/JAXPFactory.java
deleted file mode 100644
index 8f481fad643..00000000000
--- a/libjava/gnu/xml/dom/JAXPFactory.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/* JAXPFactory.java --
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.io.IOException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMImplementation;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-
-/**
- * DOM bootstrapping API, for use with JAXP.
- *
- * @see Consumer
- *
- * @author David Brownell
- */
-public final class JAXPFactory
- extends DocumentBuilderFactory
-{
-
- private static final String PROPERTY = "http://xml.org/sax/properties/";
- private static final String FEATURE = "http://xml.org/sax/features/";
-
- private SAXParserFactory pf;
-
- /**
- * Default constructor.
- */
- public JAXPFactory()
- {
- }
-
- /**
- * Constructs a JAXP document builder which uses the default
- * JAXP SAX2 parser and the DOM implementation in this package.
- */
- public DocumentBuilder newDocumentBuilder()
- throws ParserConfigurationException
- {
- if (pf == null)
- {
- // Force use of AElfred2 since not all JAXP parsers
- // conform very well to the SAX2 API spec ...
- pf = new gnu.xml.aelfred2.JAXPFactory();
- // pf = SAXParserFactory.newInstance ();
- }
-
- // JAXP default: false
- pf.setValidating(isValidating());
-
- // FIXME: this namespace setup may cause errors in some
- // conformant SAX2 parsers, which we CAN patch up by
- // splicing a "NSFilter" stage up front ...
-
- // JAXP default: false
- pf.setNamespaceAware(isNamespaceAware());
-
- try
- {
- // undo rude "namespace-prefixes=false" default
- pf.setFeature(FEATURE + "namespace-prefixes", true);
-
- return new JAXPBuilder(pf.newSAXParser().getXMLReader(), this);
- }
- catch (SAXException e)
- {
- String msg = "can't create JAXP DocumentBuilder: " + e.getMessage();
- throw new ParserConfigurationException(msg);
- }
- }
-
- /** There seems to be no useful specification for attribute names */
- public void setAttribute(String name, Object value)
- throws IllegalArgumentException
- {
- if ("http://java.sun.com/xml/jaxp/properties/schemaLanguage".equals(name))
- {
- // TODO
- }
- else
- {
- throw new IllegalArgumentException(name);
- }
- }
-
- /** There seems to be no useful specification for attribute names */
- public Object getAttribute(String name)
- throws IllegalArgumentException
- {
- throw new IllegalArgumentException(name);
- }
-
- static final class JAXPBuilder
- extends DocumentBuilder
- implements ErrorHandler
- {
-
- private Consumer consumer;
- private XMLReader producer;
- private DomImpl impl;
-
- JAXPBuilder(XMLReader parser, JAXPFactory factory)
- throws ParserConfigurationException
- {
- impl = new DomImpl();
-
- // set up consumer side
- try
- {
- consumer = new Consumer();
- }
- catch (SAXException e)
- {
- throw new ParserConfigurationException(e.getMessage());
- }
-
- // JAXP defaults: true, noise nodes are good (bleech)
- consumer.setHidingReferences(factory.isExpandEntityReferences());
- consumer.setHidingComments(factory.isIgnoringComments());
- consumer.setHidingWhitespace(factory.isIgnoringElementContentWhitespace());
- consumer.setHidingCDATA(factory.isCoalescing());
-
- // set up producer side
- producer = parser;
- producer.setContentHandler(consumer.getContentHandler());
- producer.setDTDHandler(consumer.getDTDHandler());
-
- try
- {
- String id;
-
- // if validating, report validity errors, and default
- // to treating them as fatal
- if (factory.isValidating ())
- {
- producer.setFeature(FEATURE + "validation", true);
- producer.setErrorHandler(this);
- }
-
- // always save prefix info, maybe do namespace processing
- producer.setFeature(FEATURE + "namespace-prefixes", true);
- producer.setFeature(FEATURE + "namespaces",
- factory.isNamespaceAware());
-
- // set important handlers
- id = PROPERTY + "lexical-handler";
- producer.setProperty(id, consumer.getProperty(id));
-
- id = PROPERTY + "declaration-handler";
- producer.setProperty(id, consumer.getProperty(id));
-
- }
- catch (SAXException e)
- {
- throw new ParserConfigurationException(e.getMessage());
- }
- }
-
- public Document parse(InputSource source)
- throws SAXException, IOException
- {
- producer.parse(source);
- Document doc = consumer.getDocument();
- // TODO inputEncoding
- doc.setDocumentURI(source.getSystemId());
- return doc;
- }
-
- public boolean isNamespaceAware()
- {
- try
- {
- return producer.getFeature(FEATURE + "namespaces");
- }
- catch (SAXException e)
- {
- // "can't happen"
- throw new RuntimeException(e.getMessage());
- }
- }
-
- public boolean isValidating()
- {
- try
- {
- return producer.getFeature(FEATURE + "validation");
- }
- catch (SAXException e)
- {
- // "can't happen"
- throw new RuntimeException(e.getMessage());
- }
- }
-
- public void setEntityResolver(EntityResolver resolver)
- {
- producer.setEntityResolver(resolver);
- }
-
- public void setErrorHandler(ErrorHandler handler)
- {
- producer.setErrorHandler(handler);
- consumer.setErrorHandler(handler);
- }
-
- public DOMImplementation getDOMImplementation()
- {
- return impl;
- }
-
- public Document newDocument()
- {
- return new DomDocument();
- }
-
- // implementation of error handler that's used when validating
- public void fatalError(SAXParseException e)
- throws SAXException
- {
- throw e;
- }
-
- public void error(SAXParseException e)
- throws SAXException
- {
- throw e;
- }
-
- public void warning(SAXParseException e)
- throws SAXException
- {
- /* ignore */
- }
-
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLAnchorElement.java b/libjava/gnu/xml/dom/html2/DomHTMLAnchorElement.java
deleted file mode 100644
index 5da91330604..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLAnchorElement.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/* DomHTMLAnchorElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLAnchorElement;
-
-/**
- * An HTML 'A' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLAnchorElement
- extends DomHTMLElement
- implements HTMLAnchorElement
-{
-
- protected DomHTMLAnchorElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAccessKey()
- {
- return getHTMLAttribute("accesskey");
- }
-
- public void setAccessKey(String accessKey)
- {
- setHTMLAttribute("accesskey", accessKey);
- }
-
- public String getCharset()
- {
- return getHTMLAttribute("charset");
- }
-
- public void setCharset(String charset)
- {
- setHTMLAttribute("charset", charset);
- }
-
- public String getCoords()
- {
- return getHTMLAttribute("coords");
- }
-
- public void setCoords(String coords)
- {
- setHTMLAttribute("coords", coords);
- }
-
- public String getHref()
- {
- return getHTMLAttribute("href");
- }
-
- public void setHref(String href)
- {
- setHTMLAttribute("href", href);
- }
-
- public String getHreflang()
- {
- return getHTMLAttribute("hreflang");
- }
-
- public void setHreflang(String hreflang)
- {
- setHTMLAttribute("hreflang", hreflang);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getRel()
- {
- return getHTMLAttribute("rel");
- }
-
- public void setRel(String rel)
- {
- setHTMLAttribute("rel", rel);
- }
-
- public String getRev()
- {
- return getHTMLAttribute("rev");
- }
-
- public void setRev(String rev)
- {
- setHTMLAttribute("rev", rev);
- }
-
- public String getShape()
- {
- return getHTMLAttribute("shape");
- }
-
- public void setShape(String shape)
- {
- setHTMLAttribute("shape", shape);
- }
-
- public int getTabIndex()
- {
- return getIntHTMLAttribute("tabindex");
- }
-
- public void setTabIndex(int tabIndex)
- {
- setIntHTMLAttribute("tabindex", tabIndex);
- }
-
- public String getTarget()
- {
- return getHTMLAttribute("target");
- }
-
- public void setTarget(String target)
- {
- setHTMLAttribute("target", target);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
- public void blur()
- {
- dispatchUIEvent("blur");
- }
-
- public void focus()
- {
- dispatchUIEvent("focus");
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLAppletElement.java b/libjava/gnu/xml/dom/html2/DomHTMLAppletElement.java
deleted file mode 100644
index 8ec4d3c83bb..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLAppletElement.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/* DomHTMLAppletElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLAppletElement;
-
-/**
- * An HTML 'APPLET' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLAppletElement
- extends DomHTMLElement
- implements HTMLAppletElement
-{
-
- protected DomHTMLAppletElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getAlt()
- {
- return getHTMLAttribute("alt");
- }
-
- public void setAlt(String alt)
- {
- setHTMLAttribute("alt", alt);
- }
-
- public String getArchive()
- {
- return getHTMLAttribute("archive");
- }
-
- public void setArchive(String archive)
- {
- setHTMLAttribute("archive", archive);
- }
-
- public String getCode()
- {
- return getHTMLAttribute("code");
- }
-
- public void setCode(String code)
- {
- setHTMLAttribute("code", code);
- }
-
- public String getCodeBase()
- {
- return getHTMLAttribute("codebase");
- }
-
- public void setCodeBase(String codeBase)
- {
- setHTMLAttribute("codebase", codeBase);
- }
-
- public String getHeight()
- {
- return getHTMLAttribute("height");
- }
-
- public void setHeight(String height)
- {
- setHTMLAttribute("height", height);
- }
-
- public int getHspace()
- {
- return getIntHTMLAttribute("hspace");
- }
-
- public void setHspace(int hspace)
- {
- setIntHTMLAttribute("hspace", hspace);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getObject()
- {
- return getHTMLAttribute("object");
- }
-
- public void setObject(String object)
- {
- setHTMLAttribute("object", object);
- }
-
- public int getVspace()
- {
- return getIntHTMLAttribute("vspace");
- }
-
- public void setVspace(int vspace)
- {
- setIntHTMLAttribute("vspace", vspace);
- }
-
- public String getWidth()
- {
- return getHTMLAttribute("width");
- }
-
- public void setWidth(String width)
- {
- setHTMLAttribute("width", width);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLAreaElement.java b/libjava/gnu/xml/dom/html2/DomHTMLAreaElement.java
deleted file mode 100644
index d7eed07dd1f..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLAreaElement.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/* DomHTMLAreaElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLAreaElement;
-
-/**
- * An HTML 'AREA' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLAreaElement
- extends DomHTMLElement
- implements HTMLAreaElement
-{
-
- protected DomHTMLAreaElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAccessKey()
- {
- return getHTMLAttribute("accesskey");
- }
-
- public void setAccessKey(String accessKey)
- {
- setHTMLAttribute("accesskey", accessKey);
- }
-
- public String getAlt()
- {
- return getHTMLAttribute("alt");
- }
-
- public void setAlt(String alt)
- {
- setHTMLAttribute("alt", alt);
- }
-
- public String getCoords()
- {
- return getHTMLAttribute("coords");
- }
-
- public void setCoords(String coords)
- {
- setHTMLAttribute("coords", coords);
- }
-
- public String getHref()
- {
- return getHTMLAttribute("href");
- }
-
- public void setHref(String href)
- {
- setHTMLAttribute("href", href);
- }
-
- public boolean getNoHref()
- {
- return getBooleanHTMLAttribute("nohref");
- }
-
- public void setNoHref(boolean nohref)
- {
- setBooleanHTMLAttribute("nohref", nohref);
- }
-
- public String getShape()
- {
- return getHTMLAttribute("shape");
- }
-
- public void setShape(String shape)
- {
- setHTMLAttribute("shape", shape);
- }
-
- public int getTabIndex()
- {
- return getIntHTMLAttribute("tabindex");
- }
-
- public void setTabIndex(int tabIndex)
- {
- setIntHTMLAttribute("tabindex", tabIndex);
- }
-
- public String getTarget()
- {
- return getHTMLAttribute("target");
- }
-
- public void setTarget(String target)
- {
- setHTMLAttribute("target", target);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLBRElement.java b/libjava/gnu/xml/dom/html2/DomHTMLBRElement.java
deleted file mode 100644
index 673699d527a..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLBRElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLBRElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLBRElement;
-
-/**
- * An HTML 'BR' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLBRElement
- extends DomHTMLElement
- implements HTMLBRElement
-{
-
- protected DomHTMLBRElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getClear()
- {
- return getHTMLAttribute("clear");
- }
-
- public void setClear(String clear)
- {
- setHTMLAttribute("clear", clear);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLBaseElement.java b/libjava/gnu/xml/dom/html2/DomHTMLBaseElement.java
deleted file mode 100644
index ddc8053079f..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLBaseElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* DomHTMLBaseElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLBaseElement;
-
-/**
- * An HTML 'BASE' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLBaseElement
- extends DomHTMLElement
- implements HTMLBaseElement
-{
-
- protected DomHTMLBaseElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getHref()
- {
- return getHTMLAttribute("href");
- }
-
- public void setHref(String href)
- {
- setHTMLAttribute("href", href);
- }
-
- public String getTarget()
- {
- return getHTMLAttribute("target");
- }
-
- public void setTarget(String target)
- {
- setHTMLAttribute("target", target);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLBaseFontElement.java b/libjava/gnu/xml/dom/html2/DomHTMLBaseFontElement.java
deleted file mode 100644
index 73172d3bf11..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLBaseFontElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* DomHTMLBaseFontElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLBaseFontElement;
-
-/**
- * An HTML 'BASEFONT' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLBaseFontElement
- extends DomHTMLElement
- implements HTMLBaseFontElement
-{
-
- protected DomHTMLBaseFontElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getColor()
- {
- return getHTMLAttribute("color");
- }
-
- public void setColor(String color)
- {
- setHTMLAttribute("color", color);
- }
-
- public String getFace()
- {
- return getHTMLAttribute("face");
- }
-
- public void setFace(String face)
- {
- setHTMLAttribute("face", face);
- }
-
- public int getSize()
- {
- return getIntHTMLAttribute("size");
- }
-
- public void setSize(int size)
- {
- setIntHTMLAttribute("size", size);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLBodyElement.java b/libjava/gnu/xml/dom/html2/DomHTMLBodyElement.java
deleted file mode 100644
index 44fbcf23cc5..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLBodyElement.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/* DomHTMLBodyElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLBodyElement;
-
-/**
- * An HTML 'BODY' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLBodyElement
- extends DomHTMLElement
- implements HTMLBodyElement
-{
-
- protected DomHTMLBodyElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getALink()
- {
- return getHTMLAttribute("alink");
- }
-
- public void setALink(String alink)
- {
- setHTMLAttribute("alink", alink);
- }
-
- public String getBackground()
- {
- return getHTMLAttribute("background");
- }
-
- public void setBackground(String background)
- {
- setHTMLAttribute("background", background);
- }
-
- public String getBgColor()
- {
- return getHTMLAttribute("bgcolor");
- }
-
- public void setBgColor(String bgcolor)
- {
- setHTMLAttribute("bgcolor", bgcolor);
- }
-
- public String getLink()
- {
- return getHTMLAttribute("link");
- }
-
- public void setLink(String link)
- {
- setHTMLAttribute("link", link);
- }
-
- public String getText()
- {
- return getHTMLAttribute("text");
- }
-
- public void setText(String text)
- {
- setHTMLAttribute("text", text);
- }
-
- public String getVLink()
- {
- return getHTMLAttribute("vlink");
- }
-
- public void setVLink(String vlink)
- {
- setHTMLAttribute("vlink", vlink);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLButtonElement.java b/libjava/gnu/xml/dom/html2/DomHTMLButtonElement.java
deleted file mode 100644
index 5aff5f8c1a9..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLButtonElement.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/* DomHTMLButtonElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.html2.HTMLButtonElement;
-import org.w3c.dom.html2.HTMLFormElement;
-
-/**
- * An HTML 'BUTTON' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLButtonElement
- extends DomHTMLElement
- implements HTMLButtonElement
-{
-
- protected DomHTMLButtonElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public String getAccessKey()
- {
- return getHTMLAttribute("accesskey");
- }
-
- public void setAccessKey(String accessKey)
- {
- setHTMLAttribute("accesskey", accessKey);
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public int getTabIndex()
- {
- return getIntHTMLAttribute("tabindex");
- }
-
- public void setTabIndex(int tabIndex)
- {
- setIntHTMLAttribute("tabindex", tabIndex);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public String getValue()
- {
- return getHTMLAttribute("value");
- }
-
- public void setValue(String value)
- {
- setHTMLAttribute("value", value);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLCollection.java b/libjava/gnu/xml/dom/html2/DomHTMLCollection.java
deleted file mode 100644
index 05dc99a271b..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLCollection.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/* DomHTMLCollection.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomDOMException;
-import gnu.xml.dom.DomElement;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.html2.HTMLCollection;
-import org.w3c.dom.html2.HTMLOptionsCollection;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-
-/**
- * An HTML element collection.
- *
- * @author Chris Burdess
- */
-class DomHTMLCollection
- implements HTMLCollection, HTMLOptionsCollection, NodeList, NodeFilter
-{
-
- final DomHTMLDocument doc;
- final Node root;
- List nodeNames;
- List attributeNames;
- List results;
-
- DomHTMLCollection(DomHTMLDocument doc, Node root)
- {
- this.doc = doc;
- this.root = root;
- }
-
- // -- Node name and attribute filtering --
-
- void addNodeName(String name)
- {
- if (nodeNames == null)
- {
- nodeNames = new LinkedList();
- }
- nodeNames.add(name);
- }
-
- void addAttributeName(String name)
- {
- if (attributeNames == null)
- {
- attributeNames = new LinkedList();
- }
- attributeNames.add(name);
- }
-
- public short acceptNode(Node n)
- {
- if (n.getNodeType() != Node.ELEMENT_NODE)
- {
- return NodeFilter.FILTER_SKIP;
- }
- if (nodeNames != null && !acceptName(n.getLocalName()))
- {
- return NodeFilter.FILTER_SKIP;
- }
- if (attributeNames != null && !acceptAttributes(n.getAttributes()))
- {
- return NodeFilter.FILTER_SKIP;
- }
- return NodeFilter.FILTER_ACCEPT;
- }
-
- private boolean acceptName(String name)
- {
- for (Iterator i = nodeNames.iterator(); i.hasNext(); )
- {
- String nodeName = (String) i.next();
- if (nodeName.equalsIgnoreCase(name))
- {
- return true;
- }
- }
- return false;
- }
-
- private boolean acceptAttributes(NamedNodeMap attrs)
- {
- for (Iterator i = attributeNames.iterator(); i.hasNext(); )
- {
- String attributeName = (String) i.next();
- Node attr = getNamedItem(attrs, attributeName);
- if (attr != null)
- {
- // Check that attribute has a non-null value
- String nodeValue = attr.getNodeValue();
- if (nodeValue != null && nodeValue.length() > 0)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Case-insensitive version of getNamedItem.
- */
- private Node getNamedItem(NamedNodeMap attrs, String name)
- {
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String attrName = attr.getLocalName();
- if (name.equalsIgnoreCase(attrName))
- {
- return attr;
- }
- }
- return null;
- }
-
- // -- Perform query --
-
- void evaluate()
- {
- NodeIterator i = doc.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
- this, true);
- results = new ArrayList();
- for (Node node = i.nextNode(); node != null; node = i.nextNode())
- {
- results.add(node);
- }
- }
-
- // -- HTMLCollection/NodeList interface --
-
- public int getLength()
- {
- return results.size();
- }
-
- public void setLength(int length)
- {
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
-
- public Node item(int index)
- {
- return (Node) results.get(index);
- }
-
- public Node namedItem(String name)
- {
- boolean xhtml = false; // FIXME detect XHTML document
- for (Iterator i = results.iterator(); i.hasNext(); )
- {
- Node node = (Node) i.next();
- NamedNodeMap attrs = node.getAttributes();
- Node attr = getNamedItem(attrs, "id");
- if (name.equals(attr.getTextContent()))
- {
- return node;
- }
- if (!xhtml)
- {
- attr = getNamedItem(attrs, "name");
- if (name.equals(attr.getTextContent()))
- {
- return node;
- }
- }
- }
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLDListElement.java b/libjava/gnu/xml/dom/html2/DomHTMLDListElement.java
deleted file mode 100644
index 2b9dbf23623..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLDListElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLDListElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLDListElement;
-
-/**
- * An HTML 'DL' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLDListElement
- extends DomHTMLElement
- implements HTMLDListElement
-{
-
- protected DomHTMLDListElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getCompact()
- {
- return getBooleanHTMLAttribute("compact");
- }
-
- public void setCompact(boolean compact)
- {
- setBooleanHTMLAttribute("compact", compact);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLDirectoryElement.java b/libjava/gnu/xml/dom/html2/DomHTMLDirectoryElement.java
deleted file mode 100644
index 26af97e781b..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLDirectoryElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLDirectoryElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLDirectoryElement;
-
-/**
- * An HTML 'DIR' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLDirectoryElement
- extends DomHTMLElement
- implements HTMLDirectoryElement
-{
-
- protected DomHTMLDirectoryElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getCompact()
- {
- return getBooleanHTMLAttribute("compact");
- }
-
- public void setCompact(boolean compact)
- {
- setBooleanHTMLAttribute("compact", compact);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLDivElement.java b/libjava/gnu/xml/dom/html2/DomHTMLDivElement.java
deleted file mode 100644
index 462069dcf1a..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLDivElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLDivElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLDivElement;
-
-/**
- * An HTML 'DIV' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLDivElement
- extends DomHTMLElement
- implements HTMLDivElement
-{
-
- protected DomHTMLDivElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLDocument.java b/libjava/gnu/xml/dom/html2/DomHTMLDocument.java
deleted file mode 100644
index 10ee9e74767..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLDocument.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/* DomHTMLDocument.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomDocument;
-import gnu.xml.dom.DomDOMException;
-import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.html2.HTMLCollection;
-import org.w3c.dom.html2.HTMLDocument;
-import org.w3c.dom.html2.HTMLElement;
-
-/**
- * An HTML document.
- * This is the factory object used to create HTML elements.
- *
- * @author Chris Burdess
- */
-public class DomHTMLDocument
- extends DomDocument
- implements HTMLDocument
-{
-
- private static final Class[] ELEMENT_PT = new Class[] {
- DomHTMLDocument.class,
- String.class,
- String.class
- };
-
- private static Map ELEMENT_CLASSES;
- static
- {
- Map map = new HashMap();
- map.put("a", DomHTMLAnchorElement.class);
- map.put("applet", DomHTMLAppletElement.class);
- map.put("area", DomHTMLAreaElement.class);
- map.put("base", DomHTMLBaseElement.class);
- map.put("basefont", DomHTMLBaseFontElement.class);
- map.put("body", DomHTMLBodyElement.class);
- map.put("br", DomHTMLBRElement.class);
- map.put("button", DomHTMLButtonElement.class);
- map.put("dir", DomHTMLDirectoryElement.class);
- map.put("div", DomHTMLDivElement.class);
- map.put("dlist", DomHTMLDListElement.class);
- map.put("fieldset", DomHTMLFieldSetElement.class);
- map.put("font", DomHTMLFontElement.class);
- map.put("form", DomHTMLFormElement.class);
- map.put("frame", DomHTMLFrameElement.class);
- map.put("frameset", DomHTMLFrameSetElement.class);
- map.put("head", DomHTMLHeadElement.class);
- map.put("h1", DomHTMLHeadingElement.class);
- map.put("h2", DomHTMLHeadingElement.class);
- map.put("h3", DomHTMLHeadingElement.class);
- map.put("h4", DomHTMLHeadingElement.class);
- map.put("h5", DomHTMLHeadingElement.class);
- map.put("h6", DomHTMLHeadingElement.class);
- map.put("html", DomHTMLHtmlElement.class);
- map.put("iframe", DomHTMLIFrameElement.class);
- map.put("img", DomHTMLImageElement.class);
- map.put("input", DomHTMLInputElement.class);
- map.put("isindex", DomHTMLIsIndexElement.class);
- map.put("label", DomHTMLLabelElement.class);
- map.put("legend", DomHTMLLegendElement.class);
- map.put("li", DomHTMLLIElement.class);
- map.put("link", DomHTMLLinkElement.class);
- map.put("map", DomHTMLMapElement.class);
- map.put("menu", DomHTMLMenuElement.class);
- map.put("meta", DomHTMLMetaElement.class);
- map.put("ins", DomHTMLModElement.class);
- map.put("del", DomHTMLModElement.class);
- map.put("object", DomHTMLObjectElement.class);
- map.put("ol", DomHTMLOListElement.class);
- map.put("optgroup", DomHTMLOptGroupElement.class);
- map.put("option", DomHTMLOptionElement.class);
- map.put("p", DomHTMLParagraphElement.class);
- map.put("param", DomHTMLParamElement.class);
- map.put("pre", DomHTMLPreElement.class);
- map.put("q", DomHTMLQuoteElement.class);
- map.put("blockquote", DomHTMLQuoteElement.class);
- map.put("script", DomHTMLScriptElement.class);
- map.put("select", DomHTMLSelectElement.class);
- map.put("style", DomHTMLStyleElement.class);
- map.put("caption", DomHTMLTableCaptionElement.class);
- map.put("th", DomHTMLTableCellElement.class);
- map.put("td", DomHTMLTableCellElement.class);
- map.put("col", DomHTMLTableColElement.class);
- map.put("colgroup", DomHTMLTableColElement.class);
- map.put("table", DomHTMLTableElement.class);
- map.put("tr", DomHTMLTableRowElement.class);
- map.put("thead", DomHTMLTableSectionElement.class);
- map.put("tfoot", DomHTMLTableSectionElement.class);
- map.put("tbody", DomHTMLTableSectionElement.class);
- map.put("textarea", DomHTMLTextAreaElement.class);
- map.put("title", DomHTMLTitleElement.class);
- map.put("ul", DomHTMLUListElement.class);
- ELEMENT_CLASSES = Collections.unmodifiableMap(map);
- }
-
- private static Set HTML_NS_URIS;
- static
- {
- Set set = new HashSet();
- set.add("http://www.w3.org/TR/html4/strict");
- set.add("http://www.w3.org/TR/html4/loose");
- set.add("http://www.w3.org/TR/html4/frameset");
- set.add("http://www.w3.org/1999/xhtml");
- set.add("http://www.w3.org/TR/xhtml1/strict");
- set.add("http://www.w3.org/TR/xhtml1/loose");
- set.add("http://www.w3.org/TR/xhtml1/frameset");
- HTML_NS_URIS = Collections.unmodifiableSet(set);
- }
-
- /**
- * Convenience constructor.
- */
- public DomHTMLDocument()
- {
- this(new DomHTMLImpl());
- }
-
- /**
- * Constructor.
- * This is called by the DOMImplementation.
- */
- public DomHTMLDocument(DomHTMLImpl impl)
- {
- super(impl);
- }
-
- private Node getChildNodeByName(Node parent, String name)
- {
- for (Node ctx = parent.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (name.equalsIgnoreCase(ctx.getNodeName()))
- {
- return ctx;
- }
- }
- return null;
- }
-
- public String getTitle()
- {
- Node html = getDocumentElement();
- if (html != null)
- {
- Node head = getChildNodeByName(html, "head");
- if (head != null)
- {
- Node title = getChildNodeByName(head, "title");
- if (title != null)
- {
- return title.getTextContent();
- }
- }
- }
- return null;
- }
-
- public void setTitle(String title)
- {
- Node html = getDocumentElement();
- if (html == null)
- {
- html = createElement("html");
- appendChild(html);
- }
- Node head = getChildNodeByName(html, "head");
- if (head == null)
- {
- head = createElement("head");
- Node first = html.getFirstChild();
- if (first != null)
- {
- html.insertBefore(first, head);
- }
- else
- {
- html.appendChild(head);
- }
- }
- Node titleNode = getChildNodeByName(head, "title");
- if (titleNode == null)
- {
- titleNode = createElement("title");
- Node first = head.getFirstChild();
- if (first != null)
- {
- head.insertBefore(first, titleNode);
- }
- else
- {
- head.appendChild(titleNode);
- }
- }
- titleNode.setTextContent(title);
- }
-
- public String getReferrer()
- {
- // TODO getReferrer
- return null;
- }
-
- public String getDomain()
- {
- try
- {
- URL url = new URL(getDocumentURI());
- return url.getHost();
- }
- catch (MalformedURLException e)
- {
- return null;
- }
- }
-
- public String getURL()
- {
- return getDocumentURI();
- }
-
- public HTMLElement getBody()
- {
- Node html = getDocumentElement();
- if (html != null)
- {
- Node body = getChildNodeByName(html, "body");
- if (body == null)
- {
- body = getChildNodeByName(html, "frameset");
- }
- return (HTMLElement) body;
- }
- return null;
- }
-
- public void setBody(HTMLElement body)
- {
- Node html = getDocumentElement();
- if (html == null)
- {
- html = createElement("html");
- appendChild(html);
- }
- Node ref = getBody();
- if (ref == null)
- {
- html.appendChild(body);
- }
- else
- {
- html.replaceChild(body, ref);
- }
- }
-
- public HTMLCollection getImages()
- {
- DomHTMLCollection ret = new DomHTMLCollection(this, this);
- ret.addNodeName("img");
- ret.evaluate();
- return ret;
- }
-
- public HTMLCollection getApplets()
- {
- DomHTMLCollection ret = new DomHTMLCollection(this, this);
- ret.addNodeName("object");
- ret.addNodeName("applet");
- ret.evaluate();
- return ret;
- }
-
- public HTMLCollection getLinks()
- {
- DomHTMLCollection ret = new DomHTMLCollection(this, this);
- ret.addNodeName("area");
- ret.addNodeName("a");
- ret.evaluate();
- return ret;
- }
-
- public HTMLCollection getForms()
- {
- DomHTMLCollection ret = new DomHTMLCollection(this, this);
- ret.addNodeName("form");
- ret.evaluate();
- return ret;
- }
-
- public HTMLCollection getAnchors()
- {
- DomHTMLCollection ret = new DomHTMLCollection(this, this);
- ret.addNodeName("a");
- ret.addAttributeName("name");
- ret.evaluate();
- return ret;
- }
-
- public String getCookie()
- {
- // TODO getCookie
- return null;
- }
-
- public void setCookie(String cookie)
- {
- // TODO setCookie
- }
-
- public void open()
- {
- // TODO open
- }
-
- public void close()
- {
- // TODO close
- }
-
- public void write(String text)
- {
- // TODO write
- }
-
- public void writeln(String text)
- {
- // TODO write
- }
-
- public NodeList getElementsByName(String name)
- {
- DomHTMLCollection ret = new DomHTMLCollection(this, this);
- ret.addNodeName(name);
- ret.evaluate();
- return ret;
- // TODO xhtml: return only form controls (?)
- }
-
- public Element createElement(String tagName)
- {
- return createElementNS(null, tagName);
- }
-
- public Element createElementNS(String uri, String qName)
- {
- /* If a non-HTML element, use the default implementation. */
- if (uri != null && !HTML_NS_URIS.contains(uri))
- {
- return super.createElementNS(uri, qName);
- }
- String localName = qName.toLowerCase();
- int ci = qName.indexOf(':');
- if (ci != -1)
- {
- localName = qName.substring(ci + 1);
- }
- Class t = (Class) ELEMENT_CLASSES.get(localName);
- /* If a non-HTML element, use the default implementation. */
- if (t == null)
- {
- return super.createElementNS(uri, qName);
- }
- try
- {
- Constructor c = t.getDeclaredConstructor(ELEMENT_PT);
- Object[] args = new Object[] { this, uri, qName };
- return (Element) c.newInstance(args);
- }
- catch (Exception e)
- {
- DOMException e2 = new DomDOMException(DOMException.TYPE_MISMATCH_ERR);
- e2.initCause(e);
- throw e2;
- }
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLElement.java b/libjava/gnu/xml/dom/html2/DomHTMLElement.java
deleted file mode 100644
index 844ffefe49c..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLElement.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/* DomHTMLElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomDOMException;
-import gnu.xml.dom.DomElement;
-import gnu.xml.dom.DomEvent;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.events.UIEvent;
-import org.w3c.dom.html2.HTMLElement;
-
-/**
- * Abstract implementation of an HTML element node.
- *
- * @author Chris Burdess
- */
-public abstract class DomHTMLElement
- extends DomElement
- implements HTMLElement
-{
-
- protected DomHTMLElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- /**
- * Returns the value of the specified attribute.
- * The attribute name is case insensitive.
- */
- protected String getHTMLAttribute(String name)
- {
- if (hasAttributes())
- {
- NamedNodeMap attrs = getAttributes();
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String attrName = attr.getLocalName();
- if (attrName.equalsIgnoreCase(name))
- {
- return attr.getNodeValue();
- }
- }
- }
- return "";
- }
-
- protected int getIntHTMLAttribute(String name)
- {
- String value = getHTMLAttribute(name);
- if (value == null)
- {
- return -1;
- }
- try
- {
- return Integer.parseInt(value);
- }
- catch (NumberFormatException e)
- {
- return -1;
- }
- }
-
- protected boolean getBooleanHTMLAttribute(String name)
- {
- String value = getHTMLAttribute(name);
- return value != null;
- }
-
- /**
- * Sets the value of the specified attribute.
- * The attribute name is case insensitive.
- */
- protected void setHTMLAttribute(String name, String value)
- {
- Node attr;
- NamedNodeMap attrs = getAttributes();
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- attr = attrs.item(i);
- String attrName = attr.getLocalName();
- if (attrName.equalsIgnoreCase(name))
- {
- if (value != null)
- {
- attr.setNodeValue(value);
- }
- else
- {
- attrs.removeNamedItem(attr.getNodeName());
- }
- return;
- }
- }
- if (value != null)
- {
- // Create a new attribute
- DomHTMLDocument doc = (DomHTMLDocument) getOwnerDocument();
- // XXX namespace URI for attribute?
- attr = doc.createAttribute(name);
- attr.setNodeValue(value);
- }
- }
-
- protected void setIntHTMLAttribute(String name, int value)
- {
- setHTMLAttribute(name, Integer.toString(value));
- }
-
- protected void setBooleanHTMLAttribute(String name, boolean value)
- {
- setHTMLAttribute(name, value ? name : null);
- }
-
- /**
- * Returns the first parent element with the specified name.
- */
- protected Node getParentElement(String name)
- {
- for (Node parent = getParentNode(); parent != null;
- parent = parent.getParentNode())
- {
- if (name.equalsIgnoreCase(parent.getLocalName()))
- {
- return parent;
- }
- }
- return null;
- }
-
- /**
- * Returns the first child element with the specified name.
- */
- protected Node getChildElement(String name)
- {
- for (Node child = getFirstChild(); child != null;
- child = child.getNextSibling())
- {
- if (name.equalsIgnoreCase(child.getLocalName()))
- {
- return child;
- }
- }
- return null;
- }
-
- /**
- * Returns the index of this element among elements of the same name,
- * relative to its parent.
- */
- protected int getIndex()
- {
- int index = 0;
- Node parent = getParentNode();
- if (parent != null)
- {
- for (Node ctx = parent.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx == this)
- {
- return index;
- }
- index++;
- }
- }
- throw new DomDOMException(DOMException.NOT_FOUND_ERR);
- }
-
- protected void dispatchUIEvent(String name)
- {
- UIEvent event = new DomEvent.DomUIEvent(name);
- dispatchEvent(event);
- }
-
- public String getId()
- {
- return getHTMLAttribute("id");
- }
-
- public void setId(String id)
- {
- setHTMLAttribute("id", id);
- }
-
- public String getTitle()
- {
- return getHTMLAttribute("title");
- }
-
- public void setTitle(String title)
- {
- setHTMLAttribute("title", title);
- }
-
- public String getLang()
- {
- return getHTMLAttribute("lang");
- }
-
- public void setLang(String lang)
- {
- setHTMLAttribute("lang", lang);
- }
-
- public String getDir()
- {
- return getHTMLAttribute("dir");
- }
-
- public void setDir(String dir)
- {
- setHTMLAttribute("dir", dir);
- }
-
- public String getClassName()
- {
- return getHTMLAttribute("class");
- }
-
- public void setClassName(String className)
- {
- setHTMLAttribute("class", className);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLFieldSetElement.java b/libjava/gnu/xml/dom/html2/DomHTMLFieldSetElement.java
deleted file mode 100644
index 2c857721947..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLFieldSetElement.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* DomHTMLFieldSetElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFieldSetElement;
-import org.w3c.dom.html2.HTMLFormElement;
-
-/**
- * An HTML 'FIELDSET' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLFieldSetElement
- extends DomHTMLElement
- implements HTMLFieldSetElement
-{
-
- protected DomHTMLFieldSetElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLFontElement.java b/libjava/gnu/xml/dom/html2/DomHTMLFontElement.java
deleted file mode 100644
index 08bd349fa62..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLFontElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* DomHTMLFontElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFontElement;
-
-/**
- * An HTML 'FONT' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLFontElement
- extends DomHTMLElement
- implements HTMLFontElement
-{
-
- protected DomHTMLFontElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getColor()
- {
- return getHTMLAttribute("color");
- }
-
- public void setColor(String color)
- {
- setHTMLAttribute("color", color);
- }
-
- public String getFace()
- {
- return getHTMLAttribute("face");
- }
-
- public void setFace(String face)
- {
- setHTMLAttribute("face", face);
- }
-
- public String getSize()
- {
- return getHTMLAttribute("size");
- }
-
- public void setSize(String size)
- {
- setHTMLAttribute("size", size);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLFormElement.java b/libjava/gnu/xml/dom/html2/DomHTMLFormElement.java
deleted file mode 100644
index 119d97eb885..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLFormElement.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/* DomHTMLFormElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLCollection;
-import org.w3c.dom.html2.HTMLFormElement;
-
-/**
- * An HTML 'FORM' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLFormElement
- extends DomHTMLElement
- implements HTMLFormElement
-{
-
- protected DomHTMLFormElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLCollection getElements()
- {
- DomHTMLCollection ret =
- new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
- ret.addNodeName("input");
- ret.addNodeName("button");
- ret.addNodeName("select");
- ret.addNodeName("textarea");
- ret.addNodeName("isindex");
- ret.addNodeName("label");
- ret.addNodeName("option");
- ret.evaluate();
- return ret;
- }
-
- public int getLength()
- {
- return getElements().getLength();
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getAcceptCharset()
- {
- return getHTMLAttribute("accept-charset");
- }
-
- public void setAcceptCharset(String acceptCharset)
- {
- setHTMLAttribute("accept-charset", acceptCharset);
- }
-
- public String getAction()
- {
- return getHTMLAttribute("action");
- }
-
- public void setAction(String action)
- {
- setHTMLAttribute("action", action);
- }
-
- public String getEnctype()
- {
- return getHTMLAttribute("enctype");
- }
-
- public void setEnctype(String enctype)
- {
- setHTMLAttribute("enctype", enctype);
- }
-
- public String getMethod()
- {
- return getHTMLAttribute("method");
- }
-
- public void setMethod(String method)
- {
- setHTMLAttribute("method", method);
- }
-
- public String getTarget()
- {
- return getHTMLAttribute("target");
- }
-
- public void setTarget(String target)
- {
- setHTMLAttribute("target", target);
- }
-
- public void submit()
- {
- dispatchUIEvent("submit");
- }
-
- public void reset()
- {
- dispatchUIEvent("reset");
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLFrameElement.java b/libjava/gnu/xml/dom/html2/DomHTMLFrameElement.java
deleted file mode 100644
index 124f35268e8..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLFrameElement.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/* DomHTMLFrameElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.html2.HTMLFrameElement;
-
-/**
- * An HTML 'FRAME' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLFrameElement
- extends DomHTMLElement
- implements HTMLFrameElement
-{
-
- protected DomHTMLFrameElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getFrameBorder()
- {
- return getHTMLAttribute("frameborder");
- }
-
- public void setFrameBorder(String frameBorder)
- {
- setHTMLAttribute("frameborder", frameBorder);
- }
-
- public String getLongDesc()
- {
- return getHTMLAttribute("longdesc");
- }
-
- public void setLongDesc(String longDesc)
- {
- setHTMLAttribute("longdesc", longDesc);
- }
-
- public String getMarginHeight()
- {
- return getHTMLAttribute("marginheight");
- }
-
- public void setMarginHeight(String marginHeight)
- {
- setHTMLAttribute("marginheight", marginHeight);
- }
-
- public String getMarginWidth()
- {
- return getHTMLAttribute("marginwidth");
- }
-
- public void setMarginWidth(String marginWidth)
- {
- setHTMLAttribute("marginwidth", marginWidth);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public boolean getNoResize()
- {
- return getBooleanHTMLAttribute("noresize");
- }
-
- public void setNoResize(boolean noResize)
- {
- setBooleanHTMLAttribute("noresize", noResize);
- }
-
- public String getScrolling()
- {
- return getHTMLAttribute("scrolling");
- }
-
- public void setScrolling(String scrolling)
- {
- setHTMLAttribute("scrolling", scrolling);
- }
-
- public String getSrc()
- {
- return getHTMLAttribute("src");
- }
-
- public void setSrc(String src)
- {
- setHTMLAttribute("src", src);
- }
-
- public Document getContentDocument()
- {
- // TODO getContentDocument
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLFrameSetElement.java b/libjava/gnu/xml/dom/html2/DomHTMLFrameSetElement.java
deleted file mode 100644
index 44d317f64a3..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLFrameSetElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* DomHTMLFrameSetElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFrameSetElement;
-
-/**
- * An HTML 'FRAMESET' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLFrameSetElement
- extends DomHTMLElement
- implements HTMLFrameSetElement
-{
-
- protected DomHTMLFrameSetElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getCols()
- {
- return getHTMLAttribute("cols");
- }
-
- public void setCols(String cols)
- {
- setHTMLAttribute("cols", cols);
- }
-
- public String getRows()
- {
- return getHTMLAttribute("rows");
- }
-
- public void setRows(String rows)
- {
- setHTMLAttribute("rows", rows);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLHRElement.java b/libjava/gnu/xml/dom/html2/DomHTMLHRElement.java
deleted file mode 100644
index d1b48012175..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLHRElement.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* DomHTMLHRElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLHRElement;
-
-/**
- * An HTML 'HR' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLHRElement
- extends DomHTMLElement
- implements HTMLHRElement
-{
-
- protected DomHTMLHRElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public boolean getNoShade()
- {
- return getBooleanHTMLAttribute("noshade");
- }
-
- public void setNoShade(boolean noShade)
- {
- setBooleanHTMLAttribute("noshade", noShade);
- }
-
- public String getSize()
- {
- return getHTMLAttribute("size");
- }
-
- public void setSize(String size)
- {
- setHTMLAttribute("size", size);
- }
-
- public String getWidth()
- {
- return getHTMLAttribute("width");
- }
-
- public void setWidth(String width)
- {
- setHTMLAttribute("width", width);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLHeadElement.java b/libjava/gnu/xml/dom/html2/DomHTMLHeadElement.java
deleted file mode 100644
index f68e8c7fad3..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLHeadElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLHeadElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLHeadElement;
-
-/**
- * An HTML 'HEAD' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLHeadElement
- extends DomHTMLElement
- implements HTMLHeadElement
-{
-
- protected DomHTMLHeadElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getProfile()
- {
- return getHTMLAttribute("profile");
- }
-
- public void setProfile(String profile)
- {
- setHTMLAttribute("profile", profile);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLHeadingElement.java b/libjava/gnu/xml/dom/html2/DomHTMLHeadingElement.java
deleted file mode 100644
index f1427ad89e6..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLHeadingElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLHeadingElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLHeadingElement;
-
-/**
- * An HTML 'H1', 'H2', 'H3', 'H4', 'H5', or 'H6' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLHeadingElement
- extends DomHTMLElement
- implements HTMLHeadingElement
-{
-
- protected DomHTMLHeadingElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLHtmlElement.java b/libjava/gnu/xml/dom/html2/DomHTMLHtmlElement.java
deleted file mode 100644
index 95d45264eee..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLHtmlElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLHtmlElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLHtmlElement;
-
-/**
- * An HTML 'HTML' top-level element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLHtmlElement
- extends DomHTMLElement
- implements HTMLHtmlElement
-{
-
- protected DomHTMLHtmlElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getVersion()
- {
- return getHTMLAttribute("version");
- }
-
- public void setVersion(String version)
- {
- setHTMLAttribute("version", version);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLIFrameElement.java b/libjava/gnu/xml/dom/html2/DomHTMLIFrameElement.java
deleted file mode 100644
index c5ca75d8c21..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLIFrameElement.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/* DomHTMLIFrameElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.html2.HTMLIFrameElement;
-
-/**
- * An HTML 'IFRAME' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLIFrameElement
- extends DomHTMLElement
- implements HTMLIFrameElement
-{
-
- protected DomHTMLIFrameElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getFrameBorder()
- {
- return getHTMLAttribute("frameborder");
- }
-
- public void setFrameBorder(String frameBorder)
- {
- setHTMLAttribute("frameborder", frameBorder);
- }
-
- public String getHeight()
- {
- return getHTMLAttribute("height");
- }
-
- public void setHeight(String height)
- {
- setHTMLAttribute("height", height);
- }
-
- public String getLongDesc()
- {
- return getHTMLAttribute("longdesc");
- }
-
- public void setLongDesc(String longDesc)
- {
- setHTMLAttribute("longdesc", longDesc);
- }
-
- public String getMarginHeight()
- {
- return getHTMLAttribute("marginheight");
- }
-
- public void setMarginHeight(String marginHeight)
- {
- setHTMLAttribute("marginheight", marginHeight);
- }
-
- public String getMarginWidth()
- {
- return getHTMLAttribute("marginwidth");
- }
-
- public void setMarginWidth(String marginWidth)
- {
- setHTMLAttribute("marginwidth", marginWidth);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getScrolling()
- {
- return getHTMLAttribute("scrolling");
- }
-
- public void setScrolling(String scrolling)
- {
- setHTMLAttribute("scrolling", scrolling);
- }
-
- public String getSrc()
- {
- return getHTMLAttribute("src");
- }
-
- public void setSrc(String src)
- {
- setHTMLAttribute("src", src);
- }
-
- public String getWidth()
- {
- return getHTMLAttribute("width");
- }
-
- public void setWidth(String width)
- {
- setHTMLAttribute("width", width);
- }
-
- public Document getContentDocument()
- {
- // TODO getContentDocument
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLImageElement.java b/libjava/gnu/xml/dom/html2/DomHTMLImageElement.java
deleted file mode 100644
index c96e5fede4d..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLImageElement.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/* DomHTMLImageElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLImageElement;
-
-/**
- * An HTML 'IMG' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLImageElement
- extends DomHTMLElement
- implements HTMLImageElement
-{
-
- protected DomHTMLImageElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getAlt()
- {
- return getHTMLAttribute("alt");
- }
-
- public void setAlt(String alt)
- {
- setHTMLAttribute("alt", alt);
- }
-
- public String getBorder()
- {
- return getHTMLAttribute("border");
- }
-
- public void setBorder(String border)
- {
- setHTMLAttribute("border", border);
- }
-
- public int getHeight()
- {
- return getIntHTMLAttribute("height");
- }
-
- public void setHeight(int height)
- {
- setIntHTMLAttribute("height", height);
- }
-
- public int getHspace()
- {
- return getIntHTMLAttribute("hspace");
- }
-
- public void setHspace(int hspace)
- {
- setIntHTMLAttribute("hspace", hspace);
- }
-
- public boolean getIsMap()
- {
- return getBooleanHTMLAttribute("ismap");
- }
-
- public void setIsMap(boolean isMap)
- {
- setBooleanHTMLAttribute("ismap", isMap);
- }
-
- public String getLongDesc()
- {
- return getHTMLAttribute("longdesc");
- }
-
- public void setLongDesc(String longDesc)
- {
- setHTMLAttribute("longdesc", longDesc);
- }
-
- public String getSrc()
- {
- return getHTMLAttribute("src");
- }
-
- public void setSrc(String src)
- {
- setHTMLAttribute("src", src);
- }
-
- public String getUseMap()
- {
- return getHTMLAttribute("usemap");
- }
-
- public void setUseMap(String useMap)
- {
- setHTMLAttribute("usemap", useMap);
- }
-
- public int getVspace()
- {
- return getIntHTMLAttribute("vspace");
- }
-
- public void setVspace(int vspace)
- {
- setIntHTMLAttribute("vspace", vspace);
- }
-
- public int getWidth()
- {
- return getIntHTMLAttribute("width");
- }
-
- public void setWidth(int width)
- {
- setIntHTMLAttribute("width", width);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLImpl.java b/libjava/gnu/xml/dom/html2/DomHTMLImpl.java
deleted file mode 100644
index 9f0db085040..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* DomHTMLImpl.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomImpl;
-import org.w3c.dom.Document;
-
-/**
- * Specialised DOMImplementation for creating HTML documents.
- *
- * @author Chris Burdess
- */
-public class DomHTMLImpl
- extends DomImpl
-{
-
- protected Document createDocument()
- {
- return new DomHTMLDocument(this);
- }
-
- public Object getFeature(String feature, String version)
- {
- if (hasFeature(feature, version))
- {
- return this;
- }
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLInputElement.java b/libjava/gnu/xml/dom/html2/DomHTMLInputElement.java
deleted file mode 100644
index 1dbc9c28de0..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLInputElement.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/* DomHTMLInputElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLInputElement;
-
-/**
- * An HTML 'INPUT' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLInputElement
- extends DomHTMLElement
- implements HTMLInputElement
-{
-
- protected String value;
- protected Boolean checked;
-
- protected DomHTMLInputElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getDefaultValue()
- {
- return getHTMLAttribute("value");
- }
-
- public void setDefaultValue(String defaultValue)
- {
- setHTMLAttribute("value", defaultValue);
- }
-
- public boolean getDefaultChecked()
- {
- return getBooleanHTMLAttribute("checked");
- }
-
- public void setDefaultChecked(boolean defaultChecked)
- {
- setBooleanHTMLAttribute("checked", defaultChecked);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public String getAccept()
- {
- return getHTMLAttribute("accept");
- }
-
- public void setAccept(String accept)
- {
- setHTMLAttribute("accept", accept);
- }
-
- public String getAccessKey()
- {
- return getHTMLAttribute("accesskey");
- }
-
- public void setAccessKey(String accessKey)
- {
- setHTMLAttribute("accesskey", accessKey);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getAlt()
- {
- return getHTMLAttribute("alt");
- }
-
- public void setAlt(String alt)
- {
- setHTMLAttribute("alt", alt);
- }
-
- public boolean getChecked()
- {
- if (checked == null)
- {
- checked = Boolean.valueOf(getDefaultChecked());
- }
- return checked.booleanValue();
- }
-
- public void setChecked(boolean checked)
- {
- this.checked = Boolean.valueOf(checked);
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public int getMaxLength()
- {
- return getIntHTMLAttribute("maxLength");
- }
-
- public void setMaxLength(int maxLength)
- {
- setIntHTMLAttribute("maxLength", maxLength);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public boolean getReadOnly()
- {
- return getBooleanHTMLAttribute("readonly");
- }
-
- public void setReadOnly(boolean readOnly)
- {
- setBooleanHTMLAttribute("readonly", readOnly);
- }
-
- public int getSize()
- {
- return getIntHTMLAttribute("size");
- }
-
- public void setSize(int size)
- {
- setIntHTMLAttribute("size", size);
- }
-
- public String getSrc()
- {
- return getHTMLAttribute("src");
- }
-
- public void setSrc(String src)
- {
- setHTMLAttribute("src", src);
- }
-
- public int getTabIndex()
- {
- return getIntHTMLAttribute("tabindex");
- }
-
- public void setTabIndex(int tabIndex)
- {
- setIntHTMLAttribute("tabindex", tabIndex);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
- public String getUseMap()
- {
- return getHTMLAttribute("usemap");
- }
-
- public void setUseMap(String useMap)
- {
- setHTMLAttribute("usemap", useMap);
- }
-
- public String getValue()
- {
- if (value == null)
- {
- value = getDefaultValue();
- }
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public void blur()
- {
- dispatchUIEvent("blur");
- }
-
- public void focus()
- {
- dispatchUIEvent("focus");
- }
-
- public void select()
- {
- dispatchUIEvent("select");
- }
-
- public void click()
- {
- dispatchUIEvent("click");
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLIsIndexElement.java b/libjava/gnu/xml/dom/html2/DomHTMLIsIndexElement.java
deleted file mode 100644
index 087f4a0cd79..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLIsIndexElement.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* DomHTMLIsIndexElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLIsIndexElement;
-
-/**
- * An HTML 'ISINDEX' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLIsIndexElement
- extends DomHTMLElement
- implements HTMLIsIndexElement
-{
-
- protected DomHTMLIsIndexElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public String getPrompt()
- {
- return getHTMLAttribute("prompt");
- }
-
- public void setPrompt(String prompt)
- {
- setHTMLAttribute("prompt", prompt);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLLIElement.java b/libjava/gnu/xml/dom/html2/DomHTMLLIElement.java
deleted file mode 100644
index 11eccdf5df3..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLLIElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* DomHTMLLIElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLLIElement;
-
-/**
- * An HTML 'LI' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLLIElement
- extends DomHTMLElement
- implements HTMLLIElement
-{
-
- protected DomHTMLLIElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
- public int getValue()
- {
- return getIntHTMLAttribute("value");
- }
-
- public void setValue(int value)
- {
- setIntHTMLAttribute("value", value);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLLabelElement.java b/libjava/gnu/xml/dom/html2/DomHTMLLabelElement.java
deleted file mode 100644
index c0cc39f8e96..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLLabelElement.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* DomHTMLLabelElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLLabelElement;
-
-/**
- * An HTML 'LABEL' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLLabelElement
- extends DomHTMLElement
- implements HTMLLabelElement
-{
-
- protected DomHTMLLabelElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public String getAccessKey()
- {
- return getHTMLAttribute("accesskey");
- }
-
- public void setAccessKey(String accessKey)
- {
- setHTMLAttribute("accesskey", accessKey);
- }
-
- public String getHtmlFor()
- {
- return getHTMLAttribute("for");
- }
-
- public void setHtmlFor(String htmlFor)
- {
- setHTMLAttribute("for", htmlFor);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLLegendElement.java b/libjava/gnu/xml/dom/html2/DomHTMLLegendElement.java
deleted file mode 100644
index a500f8fa14c..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLLegendElement.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* DomHTMLLegendElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLLegendElement;
-
-/**
- * An HTML 'LEGEND' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLLegendElement
- extends DomHTMLElement
- implements HTMLLegendElement
-{
-
- protected DomHTMLLegendElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public String getAccessKey()
- {
- return getHTMLAttribute("accesskey");
- }
-
- public void setAccessKey(String accessKey)
- {
- setHTMLAttribute("accesskey", accessKey);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLLinkElement.java b/libjava/gnu/xml/dom/html2/DomHTMLLinkElement.java
deleted file mode 100644
index 127726ef7e3..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLLinkElement.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/* DomHTMLLinkElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLLinkElement;
-
-/**
- * An HTML 'LINK' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLLinkElement
- extends DomHTMLElement
- implements HTMLLinkElement
-{
-
- protected DomHTMLLinkElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public String getCharset()
- {
- return getHTMLAttribute("charset");
- }
-
- public void setCharset(String charset)
- {
- setHTMLAttribute("charset", charset);
- }
-
- public String getHref()
- {
- return getHTMLAttribute("href");
- }
-
- public void setHref(String href)
- {
- setHTMLAttribute("href", href);
- }
-
- public String getHreflang()
- {
- return getHTMLAttribute("hreflang");
- }
-
- public void setHreflang(String hreflang)
- {
- setHTMLAttribute("hreflang", hreflang);
- }
-
- public String getMedia()
- {
- return getHTMLAttribute("media");
- }
-
- public void setMedia(String media)
- {
- setHTMLAttribute("media", media);
- }
-
- public String getRel()
- {
- return getHTMLAttribute("rel");
- }
-
- public void setRel(String rel)
- {
- setHTMLAttribute("rel", rel);
- }
-
- public String getRev()
- {
- return getHTMLAttribute("rev");
- }
-
- public void setRev(String rev)
- {
- setHTMLAttribute("rev", rev);
- }
-
- public String getTarget()
- {
- return getHTMLAttribute("target");
- }
-
- public void setTarget(String target)
- {
- setHTMLAttribute("target", target);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLMapElement.java b/libjava/gnu/xml/dom/html2/DomHTMLMapElement.java
deleted file mode 100644
index 1f7182f4f29..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLMapElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* DomHTMLMapElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLCollection;
-import org.w3c.dom.html2.HTMLMapElement;
-
-/**
- * An HTML 'MAP' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLMapElement
- extends DomHTMLElement
- implements HTMLMapElement
-{
-
- protected DomHTMLMapElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLCollection getAreas()
- {
- DomHTMLCollection ret =
- new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
- ret.addNodeName("area");
- ret.evaluate();
- return ret;
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLMenuElement.java b/libjava/gnu/xml/dom/html2/DomHTMLMenuElement.java
deleted file mode 100644
index 17f6f589f9a..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLMenuElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLMenuElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLMenuElement;
-
-/**
- * An HTML 'MENU' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLMenuElement
- extends DomHTMLElement
- implements HTMLMenuElement
-{
-
- protected DomHTMLMenuElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getCompact()
- {
- return getBooleanHTMLAttribute("compact");
- }
-
- public void setCompact(boolean compact)
- {
- setBooleanHTMLAttribute("compact", compact);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLMetaElement.java b/libjava/gnu/xml/dom/html2/DomHTMLMetaElement.java
deleted file mode 100644
index 1a0440504de..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLMetaElement.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* DomHTMLMetaElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLMetaElement;
-
-/**
- * An HTML 'META' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLMetaElement
- extends DomHTMLElement
- implements HTMLMetaElement
-{
-
- protected DomHTMLMetaElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getContent()
- {
- return getHTMLAttribute("content");
- }
-
- public void setContent(String content)
- {
- setHTMLAttribute("content", content);
- }
-
- public String getHttpEquiv()
- {
- return getHTMLAttribute("http-equiv");
- }
-
- public void setHttpEquiv(String httpEquiv)
- {
- setHTMLAttribute("http-equiv", httpEquiv);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getScheme()
- {
- return getHTMLAttribute("scheme");
- }
-
- public void setScheme(String scheme)
- {
- setHTMLAttribute("scheme", scheme);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLModElement.java b/libjava/gnu/xml/dom/html2/DomHTMLModElement.java
deleted file mode 100644
index 493f7242ba1..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLModElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* DomHTMLModElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLModElement;
-
-/**
- * An HTML 'INS' or 'DEL' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLModElement
- extends DomHTMLElement
- implements HTMLModElement
-{
-
- protected DomHTMLModElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getCite()
- {
- return getHTMLAttribute("cite");
- }
-
- public void setCite(String cite)
- {
- setHTMLAttribute("cite", cite);
- }
-
- public String getDateTime()
- {
- return getHTMLAttribute("datetime");
- }
-
- public void setDateTime(String dateTime)
- {
- setHTMLAttribute("datetime", dateTime);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLOListElement.java b/libjava/gnu/xml/dom/html2/DomHTMLOListElement.java
deleted file mode 100644
index fb98cf40d79..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLOListElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* DomHTMLOListElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLOListElement;
-
-/**
- * An HTML 'OL' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLOListElement
- extends DomHTMLElement
- implements HTMLOListElement
-{
-
- protected DomHTMLOListElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getCompact()
- {
- return getBooleanHTMLAttribute("compact");
- }
-
- public void setCompact(boolean compact)
- {
- setBooleanHTMLAttribute("compact", compact);
- }
-
- public int getStart()
- {
- return getIntHTMLAttribute("start");
- }
-
- public void setStart(int start)
- {
- setIntHTMLAttribute("start", start);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLObjectElement.java b/libjava/gnu/xml/dom/html2/DomHTMLObjectElement.java
deleted file mode 100644
index fdea9b15373..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLObjectElement.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/* DomHTMLObjectElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLObjectElement;
-
-/**
- * An HTML 'OBJECT' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLObjectElement
- extends DomHTMLElement
- implements HTMLObjectElement
-{
-
- protected DomHTMLObjectElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public String getCode()
- {
- return getHTMLAttribute("code");
- }
-
- public void setCode(String code)
- {
- setHTMLAttribute("code", code);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getArchive()
- {
- return getHTMLAttribute("archive");
- }
-
- public void setArchive(String archive)
- {
- setHTMLAttribute("archive", archive);
- }
-
- public String getBorder()
- {
- return getHTMLAttribute("border");
- }
-
- public void setBorder(String border)
- {
- setHTMLAttribute("border", border);
- }
-
- public String getCodeBase()
- {
- return getHTMLAttribute("codebase");
- }
-
- public void setCodeBase(String codeBase)
- {
- setHTMLAttribute("codebase", codeBase);
- }
-
- public String getCodeType()
- {
- return getHTMLAttribute("codetype");
- }
-
- public void setCodeType(String codeType)
- {
- setHTMLAttribute("codetype", codeType);
- }
-
- public String getData()
- {
- return getHTMLAttribute("data");
- }
-
- public void setData(String data)
- {
- setHTMLAttribute("data", data);
- }
-
- public boolean getDeclare()
- {
- return getBooleanHTMLAttribute("declare");
- }
-
- public void setDeclare(boolean declare)
- {
- setBooleanHTMLAttribute("declare", declare);
- }
-
- public String getHeight()
- {
- return getHTMLAttribute("height");
- }
-
- public void setHeight(String height)
- {
- setHTMLAttribute("height", height);
- }
-
- public int getHspace()
- {
- return getIntHTMLAttribute("hspace");
- }
-
- public void setHspace(int hspace)
- {
- setIntHTMLAttribute("hspace", hspace);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getStandby()
- {
- return getHTMLAttribute("standby");
- }
-
- public void setStandby(String standby)
- {
- setHTMLAttribute("standby", standby);
- }
-
- public int getTabIndex()
- {
- return getIntHTMLAttribute("tabindex");
- }
-
- public void setTabIndex(int tabIndex)
- {
- setIntHTMLAttribute("tabindex", tabIndex);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
- public String getUseMap()
- {
- return getHTMLAttribute("usemap");
- }
-
- public void setUseMap(String useMap)
- {
- setHTMLAttribute("usemap", useMap);
- }
-
- public int getVspace()
- {
- return getIntHTMLAttribute("vspace");
- }
-
- public void setVspace(int vspace)
- {
- setIntHTMLAttribute("vspace", vspace);
- }
-
- public String getWidth()
- {
- return getHTMLAttribute("width");
- }
-
- public void setWidth(String width)
- {
- setHTMLAttribute("width", width);
- }
-
- public Document getContentDocument()
- {
- // TODO getContentDocument
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLOptGroupElement.java b/libjava/gnu/xml/dom/html2/DomHTMLOptGroupElement.java
deleted file mode 100644
index 76545e130cb..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLOptGroupElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* DomHTMLOptGroupElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLOptGroupElement;
-
-/**
- * An HTML 'OPTGROUP' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLOptGroupElement
- extends DomHTMLElement
- implements HTMLOptGroupElement
-{
-
- protected DomHTMLOptGroupElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public String getLabel()
- {
- return getHTMLAttribute("label");
- }
-
- public void setLabel(String label)
- {
- setHTMLAttribute("label", label);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLOptionElement.java b/libjava/gnu/xml/dom/html2/DomHTMLOptionElement.java
deleted file mode 100644
index 69c059d9d43..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLOptionElement.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* DomHTMLOptionElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLOptionElement;
-
-/**
- * An HTML 'OPTION' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLOptionElement
- extends DomHTMLElement
- implements HTMLOptionElement
-{
-
- protected Boolean selected;
-
- protected DomHTMLOptionElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public boolean getDefaultSelected()
- {
- return getBooleanHTMLAttribute("selected");
- }
-
- public void setDefaultSelected(boolean defaultSelected)
- {
- setBooleanHTMLAttribute("selected", defaultSelected);
- }
-
- public String getText()
- {
- return getTextContent();
- }
-
- public int getIndex()
- {
- return super.getIndex();
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public String getLabel()
- {
- return getHTMLAttribute("label");
- }
-
- public void setLabel(String label)
- {
- setHTMLAttribute("label", label);
- }
-
- public boolean getSelected()
- {
- if (selected == null)
- {
- selected = Boolean.valueOf(getDefaultSelected());
- }
- return selected.booleanValue();
- }
-
- public void setSelected(boolean selected)
- {
- this.selected = Boolean.valueOf(selected);
- }
-
- public String getValue()
- {
- return getHTMLAttribute("value");
- }
-
- public void setValue(String value)
- {
- setHTMLAttribute("value", value);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLParagraphElement.java b/libjava/gnu/xml/dom/html2/DomHTMLParagraphElement.java
deleted file mode 100644
index 2a8c4f6fb11..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLParagraphElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLParagraphElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLParagraphElement;
-
-/**
- * An HTML 'P' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLParagraphElement
- extends DomHTMLElement
- implements HTMLParagraphElement
-{
-
- protected DomHTMLParagraphElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLParamElement.java b/libjava/gnu/xml/dom/html2/DomHTMLParamElement.java
deleted file mode 100644
index 81c6559529e..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLParamElement.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* DomHTMLParamElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLParamElement;
-
-/**
- * An HTML 'PARAM' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLParamElement
- extends DomHTMLElement
- implements HTMLParamElement
-{
-
- protected DomHTMLParamElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
- public String getValue()
- {
- return getHTMLAttribute("value");
- }
-
- public void setValue(String value)
- {
- setHTMLAttribute("value", value);
- }
-
- public String getValueType()
- {
- return getHTMLAttribute("valuetype");
- }
-
- public void setValueType(String valueType)
- {
- setHTMLAttribute("valuetype", valueType);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLParser.java b/libjava/gnu/xml/dom/html2/DomHTMLParser.java
deleted file mode 100644
index 7b445622509..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLParser.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/* DomHTMLParser.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.xml.dom.html2;
-
-import gnu.javax.swing.text.html.parser.support.Parser;
-
-import java.io.IOException;
-import java.io.Reader;
-
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import javax.swing.text.AttributeSet;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.parser.DTD;
-import javax.swing.text.html.parser.TagElement;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.html2.HTMLDocument;
-
-/**
- * This parser reads HTML from the given stream and stores into
- * {@link HTMLDocument}. The HTML tag becomes the {@link Node}.
- * The tag attributes become the node attributes. The text inside
- * HTML tag is inserted as one or several text nodes. The nested
- * HTML tags are inserted as child nodes.
- *
- * If the strict tree structure, closing the tag means closing all
- * nested tags. To work around this, this parser closes the nested
- * tags and immediately reopens them after the closed tag.
- * In this way, In effect, this makes a remote procedure call to the URI, with the
- * request and response document syntax as chosen by the application.
- * Note that all the input events must be seen, and sent to the URI,
- * before the first output event can be seen. Clients are delayed
- * at least by waiting for the server to respond, constraining concurrency.
- * Services can thus be used to synchronize concurrent activities, and
- * even to prioritize service among different clients.
- *
- * You are advised to avoid restricting yourself to an "RPC" model
- * for distributed computation. With a World Wide Web, network latencies
- * and failures (e.g. non-availability)
- * are significant; adopting a "procedure" model, rather than a workflow
- * model where bulk requests are sent and worked on asynchronously, is not
- * generally an optimal system-wide architecture. When the messages may
- * need authentication, such as with an OpenPGP signature, or when server
- * loads don't argue in favor of immediate responses, non-RPC models can
- * be advantageous. (So-called "peer to peer" computing models are one
- * additional type of model, though too often that term is applied to
- * systems that still have a centralized control structure.)
- *
- * Be strict in what you send, liberal in what you accept, as
- * the Internet tradition goes. Strictly conformant data should never cause
- * problems to its receiver; make your request pipeline be very strict, and
- * don't compromise on that. Make your response pipeline strict as well,
- * but be ready to tolerate specific mild, temporary, and well-documented
- * variations from specific communications peers.
- *
- * @see XmlServlet
- *
- * @author David Brownell
- */
-final public class CallFilter implements EventConsumer
-{
- private Requestor req;
- private EventConsumer next;
- private URL target;
- private URLConnection conn;
- private ErrorHandler errHandler;
-
-
- /**
- * Initializes a call filter so that its inputs are sent to the
- * specified URI, and its outputs are sent to the next consumer
- * provided.
- *
- * @exception IOException if the URI isn't accepted as a URL
- */
- // constructor used by PipelineFactory
- public CallFilter (String uri, EventConsumer next)
- throws IOException
- {
- this.next = next;
- req = new Requestor ();
- setCallTarget (uri);
- }
-
- /**
- * Assigns the URI of the call target to be used.
- * Does not affect calls currently being made.
- */
- final public void setCallTarget (String uri)
- throws IOException
- {
- target = new URL (uri);
- }
-
- /**
- * Assigns the error handler to be used to present most fatal
- * errors.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- req.setErrorHandler (handler);
- }
-
-
- /**
- * Returns the call target's URI.
- */
- final public String getCallTarget ()
- {
- return target.toString ();
- }
-
- /** Returns the content handler currently in use. */
- final public org.xml.sax.ContentHandler getContentHandler ()
- {
- return req;
- }
-
- /** Returns the DTD handler currently in use. */
- final public DTDHandler getDTDHandler ()
- {
- return req;
- }
-
-
- /**
- * Returns the declaration or lexical handler currently in
- * use, or throws an exception for other properties.
- */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- if (EventFilter.DECL_HANDLER.equals (id))
- return req;
- if (EventFilter.LEXICAL_HANDLER.equals (id))
- return req;
- throw new SAXNotRecognizedException (id);
- }
-
-
- // JDK 1.1 seems to need it to be done this way, sigh
- ErrorHandler getErrorHandler () { return errHandler; }
-
- //
- // Takes input and echoes to server as POST input.
- // Then sends the POST reply to the next pipeline element.
- //
- final class Requestor extends XMLWriter
- {
- Requestor ()
- {
- super ((Writer)null);
- }
-
- public synchronized void startDocument () throws SAXException
- {
- // Connect to remote object and set up to send it XML text
- try {
- if (conn != null)
- throw new IllegalStateException ("call is being made");
-
- conn = target.openConnection ();
- conn.setDoOutput (true);
- conn.setRequestProperty ("Content-Type",
- "application/xml;charset=UTF-8");
-
- setWriter (new OutputStreamWriter (
- conn.getOutputStream (),
- "UTF8"), "UTF-8");
-
- } catch (IOException e) {
- fatal ("can't write (POST) to URI: " + target, e);
- }
-
- // NOW base class can safely write that text!
- super.startDocument ();
- }
-
- public void endDocument () throws SAXException
- {
- //
- // Finish writing the request (for HTTP, a POST);
- // this closes the output stream.
- //
- super.endDocument ();
-
- //
- // Receive the response.
- // Produce events for the next stage.
- //
- InputSource source;
- XMLReader producer;
- String encoding;
-
- try {
-
- source = new InputSource (conn.getInputStream ());
-
-// FIXME if status is anything but success, report it!! It'd be good to
-// save the request data just in case we need to deal with a forward.
-
- encoding = Resolver.getEncoding (conn.getContentType ());
- if (encoding != null)
- source.setEncoding (encoding);
-
- producer = XMLReaderFactory.createXMLReader ();
- producer.setErrorHandler (getErrorHandler ());
- EventFilter.bind (producer, next);
- producer.parse (source);
- conn = null;
-
- } catch (IOException e) {
- fatal ("I/O Exception reading response, " + e.getMessage (), e);
- }
- }
- }
-}
diff --git a/libjava/gnu/xml/pipeline/DomConsumer.java b/libjava/gnu/xml/pipeline/DomConsumer.java
deleted file mode 100644
index 389e02bb387..00000000000
--- a/libjava/gnu/xml/pipeline/DomConsumer.java
+++ /dev/null
@@ -1,982 +0,0 @@
-/* DomConsumer.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import gnu.xml.aelfred2.ContentHandler2;
-import gnu.xml.util.DomParser;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.LexicalHandler;
-import org.xml.sax.helpers.AttributesImpl;
-import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.CharacterData;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Element;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.Node;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-
-/**
- * This consumer builds a DOM Document from its input, acting either as a
- * pipeline terminus or as an intermediate buffer. When a document's worth
- * of events has been delivered to this consumer, that document is read with
- * a {@link DomParser} and sent to the next consumer. It is also available
- * as a read-once property.
- *
- * The DOM tree is constructed as faithfully as possible. There are some
- * complications since a DOM should expose behaviors that can't be implemented
- * without API backdoors into that DOM, and because some SAX parsers don't
- * report all the information that DOM permits to be exposed. The general
- * problem areas involve information from the Document Type Declaration (DTD).
- * DOM only represents a limited subset, but has some behaviors that depend
- * on much deeper knowledge of a document's DTD. You shouldn't have much to
- * worry about unless you change handling of "noise" nodes from its default
- * setting (which ignores them all); note if you use JAXP to populate your
- * DOM trees, it wants to save "noise" nodes by default. (Such nodes include
- * ignorable whitespace, comments, entity references and CDATA boundaries.)
- * Otherwise, your
- * main worry will be if you use a SAX parser that doesn't flag ignorable
- * whitespace unless it's validating (few don't).
- *
- * The SAX2 events used as input must contain XML Names for elements
- * and attributes, with original prefixes. In SAX2,
- * this is optional unless the "namespace-prefixes" parser feature is set.
- * Moreover, many application components won't provide completely correct
- * structures anyway. Before you convert a DOM to an output document,
- * you should plan to postprocess it to create or repair such namespace
- * information. The {@link NSFilter} pipeline stage does such work.
- *
- * Note: changes late in DOM L2 process made it impractical to
- * attempt to create the DocumentType node in any implementation-neutral way,
- * much less to populate it (L1 didn't support even creating such nodes).
- * To create and populate such a node, subclass the inner
- * {@link DomConsumer.Handler} class and teach it about the backdoors into
- * whatever DOM implementation you want. It's possible that some revised
- * DOM API (L3?) will make this problem solvable again.
- *
- * @see DomParser
- *
- * @author David Brownell
- */
-public class DomConsumer implements EventConsumer
-{
- private Class domImpl;
-
- private boolean hidingCDATA = true;
- private boolean hidingComments = true;
- private boolean hidingWhitespace = true;
- private boolean hidingReferences = true;
-
- private Handler handler;
- private ErrorHandler errHandler;
-
- private EventConsumer next;
-
- // FIXME: this can't be a generic pipeline stage just now,
- // since its input became a Class not a String (to be turned
- // into a class, using the right class loader)
-
-
- /**
- * Configures this pipeline terminus to use the specified implementation
- * of DOM when constructing its result value.
- *
- * @param impl class implementing {@link org.w3c.dom.Document Document}
- * which publicly exposes a default constructor
- *
- * @exception SAXException when there is a problem creating an
- * empty DOM document using the specified implementation
- */
- public DomConsumer (Class impl)
- throws SAXException
- {
- domImpl = impl;
- handler = new Handler (this);
- }
-
- /**
- * This is the hook through which a subclass provides a handler
- * which knows how to access DOM extensions, specific to some
- * implementation, to record additional data in a DOM.
- * Treat this as part of construction; don't call it except
- * before (or between) parses.
- */
- protected void setHandler (Handler h)
- {
- handler = h;
- }
-
-
- private Document emptyDocument ()
- throws SAXException
- {
- try {
- return (Document) domImpl.newInstance ();
- } catch (IllegalAccessException e) {
- throw new SAXException ("can't access constructor: "
- + e.getMessage ());
- } catch (InstantiationException e) {
- throw new SAXException ("can't instantiate Document: "
- + e.getMessage ());
- }
- }
-
-
- /**
- * Configures this consumer as a buffer/filter, using the specified
- * DOM implementation when constructing its result value.
- *
- * This event consumer acts as a buffer and filter, in that it
- * builds a DOM tree and then writes it out when endDocument
- * is invoked. Because of the limitations of DOM, much information
- * will as a rule not be seen in that replay. To get a full fidelity
- * copy of the input event stream, use a {@link TeeConsumer}.
- *
- * @param impl class implementing {@link org.w3c.dom.Document Document}
- * which publicly exposes a default constructor
- * @param next receives a "replayed" sequence of parse events when
- * the endDocument method is invoked.
- *
- * @exception SAXException when there is a problem creating an
- * empty DOM document using the specified DOM implementation
- */
- public DomConsumer (Class impl, EventConsumer n)
- throws SAXException
- {
- this (impl);
- next = n;
- }
-
-
- /**
- * Returns the document constructed from the preceding
- * sequence of events. This method should not be
- * used again until another sequence of events has been
- * given to this EventConsumer.
- */
- final public Document getDocument ()
- {
- return handler.clearDocument ();
- }
-
- public void setErrorHandler (ErrorHandler handler)
- {
- errHandler = handler;
- }
-
-
- /**
- * Returns true if the consumer is hiding entity references nodes
- * (the default), and false if EntityReference nodes should
- * instead be created. Such EntityReference nodes will normally be
- * empty, unless an implementation arranges to populate them and then
- * turn them back into readonly objects.
- *
- * @see #setHidingReferences
- */
- final public boolean isHidingReferences ()
- { return hidingReferences; }
-
- /**
- * Controls whether the consumer will hide entity expansions,
- * or will instead mark them with entity reference nodes.
- *
- * @see #isHidingReferences
- * @param flag False if entity reference nodes will appear
- */
- final public void setHidingReferences (boolean flag)
- { hidingReferences = flag; }
-
-
- /**
- * Returns true if the consumer is hiding comments (the default),
- * and false if they should be placed into the output document.
- *
- * @see #setHidingComments
- */
- public final boolean isHidingComments ()
- { return hidingComments; }
-
- /**
- * Controls whether the consumer is hiding comments.
- *
- * @see #isHidingComments
- */
- public final void setHidingComments (boolean flag)
- { hidingComments = flag; }
-
-
- /**
- * Returns true if the consumer is hiding ignorable whitespace
- * (the default), and false if such whitespace should be placed
- * into the output document as children of element nodes.
- *
- * @see #setHidingWhitespace
- */
- public final boolean isHidingWhitespace ()
- { return hidingWhitespace; }
-
- /**
- * Controls whether the consumer hides ignorable whitespace
- *
- * @see #isHidingComments
- */
- public final void setHidingWhitespace (boolean flag)
- { hidingWhitespace = flag; }
-
-
- /**
- * Returns true if the consumer is saving CDATA boundaries, or
- * false (the default) otherwise.
- *
- * @see #setHidingCDATA
- */
- final public boolean isHidingCDATA ()
- { return hidingCDATA; }
-
- /**
- * Controls whether the consumer will save CDATA boundaries.
- *
- * @see #isHidingCDATA
- * @param flag True to treat CDATA text differently from other
- * text nodes
- */
- final public void setHidingCDATA (boolean flag)
- { hidingCDATA = flag; }
-
-
-
- /** Returns the document handler being used. */
- final public ContentHandler getContentHandler ()
- { return handler; }
-
- /** Returns the DTD handler being used. */
- final public DTDHandler getDTDHandler ()
- { return handler; }
-
- /**
- * Returns the lexical handler being used.
- * (DOM construction can't really use declaration handlers.)
- */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- if ("http://xml.org/sax/properties/lexical-handler".equals (id))
- return handler;
- if ("http://xml.org/sax/properties/declaration-handler".equals (id))
- return handler;
- throw new SAXNotRecognizedException (id);
- }
-
- EventConsumer getNext () { return next; }
-
- ErrorHandler getErrorHandler () { return errHandler; }
-
- /**
- * Class used to intercept various parsing events and use them to
- * populate a DOM document. Subclasses would typically know and use
- * backdoors into specific DOM implementations, used to implement
- * DTD-related functionality.
- *
- * Note that if this ever throws a DOMException (runtime exception)
- * that will indicate a bug in the DOM (e.g. doesn't support something
- * per specification) or the parser (e.g. emitted an illegal name, or
- * accepted illegal input data). Two important categories of consumers include filters, which
- * process events and pass them on to other consumers, and terminus
- * (or terminal) stages, which don't pass events on. Filters are not
- * necessarily derived from the {@link EventFilter} class, although that
- * class can substantially simplify their construction by automating the
- * most common activities.
- *
- * Event consumers which follow certain conventions for the signatures
- * of their constructors can be automatically assembled into pipelines
- * by the {@link PipelineFactory} class.
- *
- * @author David Brownell
- */
-public interface EventConsumer
-{
- /** Most stages process these core SAX callbacks. */
- public ContentHandler getContentHandler ();
-
- /** Few stages will use unparsed entities. */
- public DTDHandler getDTDHandler ();
-
- /**
- * This method works like the SAX2 XMLReader method of the same name,
- * and is used to retrieve the optional lexical and declaration handlers
- * in a pipeline.
- *
- * @param id This is a URI identifying the type of property desired.
- * @return The value of that property, if it is defined.
- *
- * @exception SAXNotRecognizedException Thrown if the particular
- * pipeline stage does not understand the specified identifier.
- */
- public Object getProperty (String id)
- throws SAXNotRecognizedException;
-
- /**
- * This method provides a filter stage with a handler that abstracts
- * presentation of warnings and both recoverable and fatal errors.
- * Most pipeline stages should share a single policy and mechanism
- * for such reports, since application components require consistency
- * in such activities. Accordingly, typical responses to this method
- * invocation involve saving the handler for use; filters will pass
- * it on to any other consumers they use.
- *
- * @param handler encapsulates error handling policy for this stage
- */
- public void setErrorHandler (ErrorHandler handler);
-}
diff --git a/libjava/gnu/xml/pipeline/EventFilter.java b/libjava/gnu/xml/pipeline/EventFilter.java
deleted file mode 100644
index 6600271718a..00000000000
--- a/libjava/gnu/xml/pipeline/EventFilter.java
+++ /dev/null
@@ -1,809 +0,0 @@
-/* EventFilter.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-import gnu.xml.aelfred2.ContentHandler2;
-
-/**
- * A customizable event consumer, used to assemble various kinds of filters
- * using SAX handlers and an optional second consumer. It can be constructed
- * in two ways: Additionally, SAX handlers may be assigned, which completely replace
- * the "upstream" view (through {@link EventConsumer}) of handlers, initially
- * null or the "next" consumer provided to the constructor. To make
- * it easier to build specialized filter classes, this class implements
- * all the standard SAX consumer handlers, and those implementations
- * delegate "downstream" to the consumer accessed by {@link #getNext}.
- *
- * The simplest way to create a custom a filter class is to create a
- * subclass which overrides one or more handler interface methods. The
- * constructor for that subclass then registers itself as a handler for
- * those interfaces using a call such as setContentHandler(this),
- * so the "upstream" view of event delivery is modified from the state
- * established in the base class constructor. That way,
- * the overridden methods intercept those event callbacks
- * as they go "downstream", and
- * all other event callbacks will pass events to any next consumer.
- * Overridden methods may invoke superclass methods (perhaps after modifying
- * parameters) if they wish to delegate such calls. Such subclasses
- * should use {@link #getErrorHandler} to report errors using the
- * common error reporting mechanism.
- *
- * Another important technique is to construct a filter consisting
- * of only a few specific types of handler. For example, one could easily
- * prune out lexical events or various declarations by providing handlers
- * which don't pass those events downstream, or by providing null handlers.
- *
- * This may be viewed as the consumer oriented analogue of the SAX2
- * {@link org.xml.sax.helpers.XMLFilterImpl XMLFilterImpl} class.
- * Key differences include: The {@link #chainTo chainTo()} convenience routine supports chaining to
- * an XMLFilterImpl, in its role as a limited functionality event
- * consumer. Its event producer role ({@link XMLFilter}) is ignored.
- *
- * The {@link #bind bind()} routine may be used associate event pipelines
- * with any kind of {@link XMLReader} that will produce the events.
- * Such pipelines don't necessarily need to have any members which are
- * implemented using this class. That routine has some intelligence
- * which supports automatic changes to parser feature flags, letting
- * event piplines become largely independent of the particular feature
- * sets of parsers.
- *
- * @author David Brownell
- */
-public class EventFilter
- implements EventConsumer, ContentHandler2, DTDHandler,
- LexicalHandler, DeclHandler
-{
- // SAX handlers
- private ContentHandler docHandler, docNext;
- private DTDHandler dtdHandler, dtdNext;
- private LexicalHandler lexHandler, lexNext;
- private DeclHandler declHandler, declNext;
- // and ideally, one more for the stuff SAX2 doesn't show
-
- private Locator locator;
- private EventConsumer next;
- private ErrorHandler errHandler;
-
-
- /** SAX2 URI prefix for standard feature flags. */
- public static final String FEATURE_URI
- = "http://xml.org/sax/features/";
- /** SAX2 URI prefix for standard properties (mostly for handlers). */
- public static final String PROPERTY_URI
- = "http://xml.org/sax/properties/";
-
- /** SAX2 property identifier for {@link DeclHandler} events */
- public static final String DECL_HANDLER
- = PROPERTY_URI + "declaration-handler";
- /** SAX2 property identifier for {@link LexicalHandler} events */
- public static final String LEXICAL_HANDLER
- = PROPERTY_URI + "lexical-handler";
-
- //
- // These class objects will be null if the relevant class isn't linked.
- // Small configurations (pJava and some kinds of embedded systems) need
- // to facilitate smaller executables. So "instanceof" is undesirable
- // when bind() sees if it can remove some stages.
- //
- // SECURITY NOTE: assuming all these classes are part of the same sealed
- // package, there's no problem saving these in the instance of this class
- // that's associated with "this" class loader. But that wouldn't be true
- // for classes in another package.
- //
- private static boolean loaded;
- private static Class nsClass;
- private static Class validClass;
- private static Class wfClass;
- private static Class xincClass;
-
- static ClassLoader getClassLoader ()
- {
- Method m = null;
-
- try {
- m = Thread.class.getMethod("getContextClassLoader", null);
- } catch (NoSuchMethodException e) {
- // Assume that we are running JDK 1.1, use the current ClassLoader
- return EventFilter.class.getClassLoader();
- }
-
- try {
- return (ClassLoader) m.invoke(Thread.currentThread(), null);
- } catch (IllegalAccessException e) {
- // assert(false)
- throw new UnknownError(e.getMessage());
- } catch (InvocationTargetException e) {
- // assert(e.getTargetException() instanceof SecurityException)
- throw new UnknownError(e.getMessage());
- }
- }
-
- static Class loadClass (ClassLoader classLoader, String className)
- {
- try {
- if (classLoader == null)
- return Class.forName(className);
- else
- return classLoader.loadClass(className);
- } catch (Exception e) {
- return null;
- }
- }
-
- static private void loadClasses ()
- {
- ClassLoader loader = getClassLoader ();
-
- nsClass = loadClass (loader, "gnu.xml.pipeline.NSFilter");
- validClass = loadClass (loader, "gnu.xml.pipeline.ValidationConsumer");
- wfClass = loadClass (loader, "gnu.xml.pipeline.WellFormednessFilter");
- xincClass = loadClass (loader, "gnu.xml.pipeline.XIncludeFilter");
- loaded = true;
- }
-
-
- /**
- * Binds the standard SAX2 handlers from the specified consumer
- * pipeline to the specified producer. These handlers include the core
- * {@link ContentHandler} and {@link DTDHandler}, plus the extension
- * {@link DeclHandler} and {@link LexicalHandler}. Any additional
- * application-specific handlers need to be bound separately.
- * The {@link ErrorHandler} is handled differently: the producer's
- * error handler is passed through to the consumer pipeline.
- * The producer is told to include namespace prefix information if it
- * can, since many pipeline stages need that Infoset information to
- * work well.
- *
- * At the head of the pipeline, certain standard event filters are
- * recognized and handled specially. This facilitates construction
- * of processing pipelines that work regardless of the capabilities
- * of the XMLReader implementation in use; for example, it permits
- * validating output of a {@link gnu.xml.util.DomParser}. Other than that, this method works with any kind of event consumer,
- * not just event filters. Note that in all cases, the standard handlers
- * are assigned; any previous handler assignments for the handler will
- * be overridden.
- *
- * @param producer will deliver events to the specified consumer
- * @param consumer pipeline supplying event handlers to be associated
- * with the producer (may not be null)
- */
- public static void bind (XMLReader producer, EventConsumer consumer)
- {
- Class klass = null;
- boolean prefixes;
-
- if (!loaded)
- loadClasses ();
-
- // DOM building, printing, layered validation, and other
- // things don't work well when prefix info is discarded.
- // Include it by default, whenever possible.
- try {
- producer.setFeature (FEATURE_URI + "namespace-prefixes",
- true);
- prefixes = true;
- } catch (SAXException e) {
- prefixes = false;
- }
-
- // NOTE: This loop doesn't use "instanceof", since that
- // would prevent compiling/linking without those classes
- // being present.
- while (consumer != null) {
- klass = consumer.getClass ();
-
- // we might have already changed this problematic SAX2 default.
- if (nsClass != null && nsClass.isAssignableFrom (klass)) {
- if (!prefixes)
- break;
- consumer = ((EventFilter)consumer).getNext ();
-
- // the parser _might_ do DTD validation by default ...
- // if not, maybe we can change this setting.
- } else if (validClass != null
- && validClass.isAssignableFrom (klass)) {
- try {
- producer.setFeature (FEATURE_URI + "validation",
- true);
- consumer = ((ValidationConsumer)consumer).getNext ();
- } catch (SAXException e) {
- break;
- }
-
- // parsers are required not to have such bugs
- } else if (wfClass != null && wfClass.isAssignableFrom (klass)) {
- consumer = ((WellFormednessFilter)consumer).getNext ();
-
- // stop on the first pipeline stage we can't remove
- } else
- break;
-
- if (consumer == null)
- klass = null;
- }
-
- // the actual setting here doesn't matter as much
- // as that producer and consumer agree
- if (xincClass != null && klass != null
- && xincClass.isAssignableFrom (klass))
- ((XIncludeFilter)consumer).setSavingPrefixes (prefixes);
-
- // Some SAX parsers can't handle null handlers -- bleech
- DefaultHandler2 h = new DefaultHandler2 ();
-
- if (consumer != null && consumer.getContentHandler () != null)
- producer.setContentHandler (consumer.getContentHandler ());
- else
- producer.setContentHandler (h);
- if (consumer != null && consumer.getDTDHandler () != null)
- producer.setDTDHandler (consumer.getDTDHandler ());
- else
- producer.setDTDHandler (h);
-
- try {
- Object dh;
-
- if (consumer != null)
- dh = consumer.getProperty (DECL_HANDLER);
- else
- dh = null;
- if (dh == null)
- dh = h;
- producer.setProperty (DECL_HANDLER, dh);
- } catch (Exception e) { /* ignore */ }
- try {
- Object lh;
-
- if (consumer != null)
- lh = consumer.getProperty (LEXICAL_HANDLER);
- else
- lh = null;
- if (lh == null)
- lh = h;
- producer.setProperty (LEXICAL_HANDLER, lh);
- } catch (Exception e) { /* ignore */ }
-
- // this binding goes the other way around
- if (producer.getErrorHandler () == null)
- producer.setErrorHandler (h);
- if (consumer != null)
- consumer.setErrorHandler (producer.getErrorHandler ());
- }
-
- /**
- * Initializes all handlers to null.
- */
- // constructor used by PipelineFactory
- public EventFilter () { }
-
-
- /**
- * Handlers that are not otherwise set will default to those from
- * the specified consumer, making it easy to pass events through.
- * If the consumer is null, all handlers are initialzed to null.
- */
- // constructor used by PipelineFactory
- public EventFilter (EventConsumer consumer)
- {
- if (consumer == null)
- return;
-
- next = consumer;
-
- // We delegate through the "xxNext" handlers, and
- // report the "xxHandler" ones on our input side.
-
- // Normally a subclass would both override handler
- // methods and register itself as the "xxHandler".
-
- docHandler = docNext = consumer.getContentHandler ();
- dtdHandler = dtdNext = consumer.getDTDHandler ();
- try {
- declHandler = declNext = (DeclHandler)
- consumer.getProperty (DECL_HANDLER);
- } catch (SAXException e) { /* leave value null */ }
- try {
- lexHandler = lexNext = (LexicalHandler)
- consumer.getProperty (LEXICAL_HANDLER);
- } catch (SAXException e) { /* leave value null */ }
- }
-
- /**
- * Treats the XMLFilterImpl as a limited functionality event consumer,
- * by arranging to deliver events to it; this lets such classes be
- * "wrapped" as pipeline stages.
- *
- * Upstream Event Setup:
- * If no handlers have been assigned to this EventFilter, then the
- * handlers from specified XMLFilterImpl are returned from this
- * {@link EventConsumer}: the XMLFilterImpl is just "wrapped".
- * Otherwise the specified handlers will be returned.
- *
- * Downstream Event Setup:
- * Subclasses may chain event delivery to the specified XMLFilterImpl
- * by invoking the appropiate superclass methods,
- * as if their constructor passed a "next" EventConsumer to the
- * constructor for this class.
- * If this EventFilter has an ErrorHandler, it is assigned as
- * the error handler for the XMLFilterImpl, just as would be
- * done for a next stage implementing {@link EventConsumer}.
- *
- * @param next the next downstream component of the pipeline.
- * @exception IllegalStateException if the "next" consumer has
- * already been set through the constructor.
- */
- public void chainTo (XMLFilterImpl next)
- {
- if (this.next != null)
- throw new IllegalStateException ();
-
- docNext = next.getContentHandler ();
- if (docHandler == null)
- docHandler = docNext;
- dtdNext = next.getDTDHandler ();
- if (dtdHandler == null)
- dtdHandler = dtdNext;
-
- try {
- declNext = (DeclHandler) next.getProperty (DECL_HANDLER);
- if (declHandler == null)
- declHandler = declNext;
- } catch (SAXException e) { /* leave value null */ }
- try {
- lexNext = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);
- if (lexHandler == null)
- lexHandler = lexNext;
- } catch (SAXException e) { /* leave value null */ }
-
- if (errHandler != null)
- next.setErrorHandler (errHandler);
- }
-
- /**
- * Records the error handler that should be used by this stage, and
- * passes it "downstream" to any subsequent stage.
- */
- final public void setErrorHandler (ErrorHandler handler)
- {
- errHandler = handler;
- if (next != null)
- next.setErrorHandler (handler);
- }
-
- /**
- * Returns the error handler assigned this filter stage, or null
- * if no such assigment has been made.
- */
- final public ErrorHandler getErrorHandler ()
- {
- return errHandler;
- }
-
-
- /**
- * Returns the next event consumer in sequence; or null if there
- * is no such handler.
- */
- final public EventConsumer getNext ()
- { return next; }
-
-
- /**
- * Assigns the content handler to use; a null handler indicates
- * that these events will not be forwarded.
- * This overrides the previous settting for this handler, which was
- * probably pointed to the next consumer by the base class constructor.
- */
- final public void setContentHandler (ContentHandler h)
- {
- docHandler = h;
- }
-
- /** Returns the content handler being used. */
- final public ContentHandler getContentHandler ()
- {
- return docHandler;
- }
-
- /**
- * Assigns the DTD handler to use; a null handler indicates
- * that these events will not be forwarded.
- * This overrides the previous settting for this handler, which was
- * probably pointed to the next consumer by the base class constructor.
- */
- final public void setDTDHandler (DTDHandler h)
- { dtdHandler = h; }
-
- /** Returns the dtd handler being used. */
- final public DTDHandler getDTDHandler ()
- {
- return dtdHandler;
- }
-
- /**
- * Stores the property, normally a handler; a null handler indicates
- * that these events will not be forwarded.
- * This overrides the previous handler settting, which was probably
- * pointed to the next consumer by the base class constructor.
- */
- final public void setProperty (String id, Object o)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- try {
- Object value = getProperty (id);
-
- if (value == o)
- return;
- if (DECL_HANDLER.equals (id)) {
- declHandler = (DeclHandler) o;
- return;
- }
- if (LEXICAL_HANDLER.equals (id)) {
- lexHandler = (LexicalHandler) o;
- return;
- }
- throw new SAXNotSupportedException (id);
-
- } catch (ClassCastException e) {
- throw new SAXNotSupportedException (id);
- }
- }
-
- /** Retrieves a property of unknown intent (usually a handler) */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- if (DECL_HANDLER.equals (id))
- return declHandler;
- if (LEXICAL_HANDLER.equals (id))
- return lexHandler;
-
- throw new SAXNotRecognizedException (id);
- }
-
- /**
- * Returns any locator provided to the next consumer, if this class
- * (or a subclass) is handling {@link ContentHandler } events.
- */
- public Locator getDocumentLocator ()
- { return locator; }
-
-
- // CONTENT HANDLER DELEGATIONS
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- if (docNext != null)
- docNext.setDocumentLocator (locator);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void startDocument () throws SAXException
- {
- if (docNext != null)
- docNext.startDocument ();
- }
-
- public void xmlDecl(String version, String encoding, boolean standalone,
- String inputEncoding)
- throws SAXException
- {
- if (docNext != null && docNext instanceof ContentHandler2)
- {
- ((ContentHandler2) docNext).xmlDecl(version, encoding, standalone,
- inputEncoding);
- }
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void skippedEntity (String name) throws SAXException
- {
- if (docNext != null)
- docNext.skippedEntity (name);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (docNext != null)
- docNext.processingInstruction (target, data);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- if (docNext != null)
- docNext.characters (ch, start, length);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (docNext != null)
- docNext.ignorableWhitespace (ch, start, length);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (docNext != null)
- docNext.startPrefixMapping (prefix, uri);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void startElement (
- String uri, String localName,
- String qName, Attributes atts
- ) throws SAXException
- {
- if (docNext != null)
- docNext.startElement (uri, localName, qName, atts);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (docNext != null)
- docNext.endElement (uri, localName, qName);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void endPrefixMapping (String prefix) throws SAXException
- {
- if (docNext != null)
- docNext.endPrefixMapping (prefix);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void endDocument () throws SAXException
- {
- if (docNext != null)
- docNext.endDocument ();
- locator = null;
- }
-
-
- // DTD HANDLER DELEGATIONS
-
- /** SAX1: passes this callback to the next consumer, if any */
- public void unparsedEntityDecl (
- String name,
- String publicId,
- String systemId,
- String notationName
- ) throws SAXException
- {
- if (dtdNext != null)
- dtdNext.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
- /** SAX1: passes this callback to the next consumer, if any */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- if (dtdNext != null)
- dtdNext.notationDecl (name, publicId, systemId);
- }
-
-
- // LEXICAL HANDLER DELEGATIONS
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.startDTD (name, publicId, systemId);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void endDTD ()
- throws SAXException
- {
- if (lexNext != null)
- lexNext.endDTD ();
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.comment (ch, start, length);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void startCDATA ()
- throws SAXException
- {
- if (lexNext != null)
- lexNext.startCDATA ();
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void endCDATA ()
- throws SAXException
- {
- if (lexNext != null)
- lexNext.endCDATA ();
- }
-
- /**
- * SAX2: passes this callback to the next consumer, if any.
- */
- public void startEntity (String name)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.startEntity (name);
- }
-
- /**
- * SAX2: passes this callback to the next consumer, if any.
- */
- public void endEntity (String name)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.endEntity (name);
- }
-
-
- // DECLARATION HANDLER DELEGATIONS
-
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void elementDecl (String name, String model)
- throws SAXException
- {
- if (declNext != null)
- declNext.elementDecl (name, model);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
- throws SAXException
- {
- if (declNext != null)
- declNext.attributeDecl (eName, aName, type, mode, value);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (declNext != null)
- declNext.externalEntityDecl (name, publicId, systemId);
- }
-
- /** SAX2: passes this callback to the next consumer, if any */
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- if (declNext != null)
- declNext.internalEntityDecl (name, value);
- }
-}
diff --git a/libjava/gnu/xml/pipeline/LinkFilter.java b/libjava/gnu/xml/pipeline/LinkFilter.java
deleted file mode 100644
index ddb9fda2e75..00000000000
--- a/libjava/gnu/xml/pipeline/LinkFilter.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/* LinkFilter.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-
-/**
- * Pipeline filter to remember XHTML links found in a document,
- * so they can later be crawled. Fragments are not counted, and duplicates
- * are ignored. Callers are responsible for filtering out URLs they aren't
- * interested in. Events are passed through unmodified.
- *
- * Input MUST include a setDocumentLocator() call, as it's used to
- * resolve relative links in the absence of a "base" element. Input MUST
- * also include namespace identifiers, since it is the XHTML namespace
- * identifier which is used to identify the relevant elements.
- *
- * FIXME: handle xml:base attribute ... in association with
- * a stack of base URIs. Similarly, recognize/support XLink data.
- *
- * @author David Brownell
- */
-public class LinkFilter extends EventFilter
-{
- // for storing URIs
- private Vector vector = new Vector ();
-
- // struct for "full" link record (tbd)
- // these for troubleshooting original source:
- // original uri
- // uri as resolved (base, relative, etc)
- // URI of originating doc
- // line #
- // original element + attrs (img src, desc, etc)
-
- // XLink model of the link ... for inter-site pairups ?
-
- private String baseURI;
-
- private boolean siteRestricted = false;
-
- //
- // XXX leverage blacklist info (like robots.txt)
- //
- // XXX constructor w/param ... pipeline for sending link data
- // probably XHTML --> XLink, providing info as sketched above
- //
-
-
- /**
- * Constructs a new event filter, which collects links in private data
- * structure for later enumeration.
- */
- // constructor used by PipelineFactory
- public LinkFilter ()
- {
- super.setContentHandler (this);
- }
-
-
- /**
- * Constructs a new event filter, which collects links in private data
- * structure for later enumeration and passes all events, unmodified,
- * to the next consumer.
- */
- // constructor used by PipelineFactory
- public LinkFilter (EventConsumer next)
- {
- super (next);
- super.setContentHandler (this);
- }
-
-
- /**
- * Returns an enumeration of the links found since the filter
- * was constructed, or since removeAllLinks() was called.
- *
- * @return enumeration of strings.
- */
- public Enumeration getLinks ()
- {
- return vector.elements ();
- }
-
- /**
- * Removes records about all links reported to the event
- * stream, as if the filter were newly created.
- */
- public void removeAllLinks ()
- {
- vector = new Vector ();
- }
-
-
- /**
- * Collects URIs for (X)HTML content from elements which hold them.
- */
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- String link;
-
- // Recognize XHTML links.
- if ("http://www.w3.org/1999/xhtml".equals (uri)) {
-
- if ("a".equals (localName) || "base".equals (localName)
- || "area".equals (localName))
- link = atts.getValue ("href");
- else if ("iframe".equals (localName) || "frame".equals (localName))
- link = atts.getValue ("src");
- else if ("blockquote".equals (localName) || "q".equals (localName)
- || "ins".equals (localName) || "del".equals (localName))
- link = atts.getValue ("cite");
- else
- link = null;
- link = maybeAddLink (link);
-
- // "base" modifies designated baseURI
- if ("base".equals (localName) && link != null)
- baseURI = link;
-
- if ("iframe".equals (localName) || "img".equals (localName))
- maybeAddLink (atts.getValue ("longdesc"));
- }
-
- super.startElement (uri, localName, qName, atts);
- }
-
- private String maybeAddLink (String link)
- {
- int index;
-
- // ignore empty links and fragments inside docs
- if (link == null)
- return null;
- if ((index = link.indexOf ("#")) >= 0)
- link = link.substring (0, index);
- if (link.equals (""))
- return null;
-
- try {
- // get the real URI
- URL base = new URL ((baseURI != null)
- ? baseURI
- : getDocumentLocator ().getSystemId ());
- URL url = new URL (base, link);
-
- link = url.toString ();
-
- // ignore duplicates
- if (vector.contains (link))
- return link;
-
- // other than what "base" does, stick to original site:
- if (siteRestricted) {
- // don't switch protocols
- if (!base.getProtocol ().equals (url.getProtocol ()))
- return link;
- // don't switch servers
- if (base.getHost () != null
- && !base.getHost ().equals (url.getHost ()))
- return link;
- }
-
- vector.addElement (link);
-
- return link;
-
- } catch (IOException e) {
- // bad URLs we don't want
- }
- return null;
- }
-
- /**
- * Reports an error if no Locator has been made available.
- */
- public void startDocument ()
- throws SAXException
- {
- if (getDocumentLocator () == null)
- throw new SAXException ("no Locator!");
- }
-
- /**
- * Forgets about any base URI information that may be recorded.
- * Applications will often want to call removeAllLinks(), likely
- * after examining the links which were reported.
- */
- public void endDocument ()
- throws SAXException
- {
- baseURI = null;
- super.endDocument ();
- }
-}
diff --git a/libjava/gnu/xml/pipeline/NSFilter.java b/libjava/gnu/xml/pipeline/NSFilter.java
deleted file mode 100644
index db875e1debf..00000000000
--- a/libjava/gnu/xml/pipeline/NSFilter.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/* NSFilter.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.util.Enumeration;
-import java.util.Stack;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.NamespaceSupport;
-
-/**
- * This filter ensures that element and attribute names are properly prefixed,
- * and that such prefixes are declared. Such data is critical for operations
- * like writing XML text, and validating against DTDs: names or their prefixes
- * may have been discarded, although they are essential to the exchange of
- * information using XML. There are various common ways that such data
- * gets discarded: This filter uses a heuristic to choose the prefix to assign to any
- * particular name which wasn't already corectly prefixed. The associated
- * namespace will be correct, and the prefix will be declared. Original
- * structures facilitating text editing, such as conventions about use of
- * mnemonic prefix names or the scoping of prefixes, can't always be
- * reconstructed after they are discarded, as strongly encouraged by the
- * current SAX2 defaults.
- *
- * Note that this can't possibly know whether values inside attribute
- * value or document content involve prefixed names. If your application
- * requires using prefixed names in such locations you'll need to add some
- * appropriate logic (perhaps adding additional heuristics in a subclass).
- *
- * @author David Brownell
- */
-public class NSFilter extends EventFilter
-{
- private NamespaceSupport nsStack = new NamespaceSupport ();
- private Stack elementStack = new Stack ();
-
- private boolean pushedContext;
- private String nsTemp [] = new String [3];
- private AttributesImpl attributes = new AttributesImpl ();
- private boolean usedDefault;
-
- // gensymmed prefixes use this root name
- private static final String prefixRoot = "prefix-";
-
-
- /**
- * Passes events through to the specified consumer, after first
- * processing them.
- *
- * @param next the next event consumer to receive events.
- */
- // constructor used by PipelineFactory
- public NSFilter (EventConsumer next)
- {
- super (next);
-
- setContentHandler (this);
- }
-
- private void fatalError (String message)
- throws SAXException
- {
- SAXParseException e;
- ErrorHandler handler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
-
- if (locator == null)
- e = new SAXParseException (message, null, null, -1, -1);
- else
- e = new SAXParseException (message, locator);
- if (handler != null)
- handler.fatalError (e);
- throw e;
- }
-
-
- public void startDocument () throws SAXException
- {
- elementStack.removeAllElements ();
- nsStack.reset ();
- pushedContext = false;
- super.startDocument ();
- }
-
- /**
- * This call is not passed to the next consumer in the chain.
- * Prefix declarations and scopes are only exposed in the form
- * of attributes; this callback just records a declaration that
- * will be exposed as an attribute.
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (pushedContext == false) {
- nsStack.pushContext ();
- pushedContext = true;
- }
-
- // this check is awkward, but the paranoia prevents big trouble
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */ ) {
- String declared = (String) e.nextElement ();
-
- if (!declared.equals (prefix))
- continue;
- if (uri.equals (nsStack.getURI (prefix)))
- return;
- fatalError ("inconsistent binding for prefix '" + prefix
- + "' ... " + uri + " (was " + nsStack.getURI (prefix) + ")");
- }
-
- if (!nsStack.declarePrefix (prefix, uri))
- fatalError ("illegal prefix declared: " + prefix);
- }
-
- private String fixName (String ns, String l, String name, boolean isAttr)
- throws SAXException
- {
- if ("".equals (name) || name == null) {
- name = l;
- if ("".equals (name) || name == null)
- fatalError ("empty/null name");
- }
-
- // can we correctly process the name as-is?
- // handles "element scope" attribute names here.
- if (nsStack.processName (name, nsTemp, isAttr) != null
- && nsTemp [0].equals (ns)
- ) {
- return nsTemp [2];
- }
-
- // nope, gotta modify the name or declare a default mapping
- int temp;
-
- // get rid of any current prefix
- if ((temp = name.indexOf (':')) >= 0) {
- name = name.substring (temp + 1);
-
- // ... maybe that's enough (use/prefer default namespace) ...
- if (!isAttr && nsStack.processName (name, nsTemp, false) != null
- && nsTemp [0].equals (ns)
- ) {
- return nsTemp [2];
- }
- }
-
- // must we define and use the default/undefined prefix?
- if ("".equals (ns)) {
- if (isAttr)
- fatalError ("processName bug");
- if (attributes.getIndex ("xmlns") != -1)
- fatalError ("need to undefine default NS, but it's bound: "
- + attributes.getValue ("xmlns"));
-
- nsStack.declarePrefix ("", "");
- attributes.addAttribute ("", "", "xmlns", "CDATA", "");
- return name;
- }
-
- // is there at least one non-null prefix we can use?
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
- String uri = nsStack.getURI (prefix);
-
- if (uri == null || !uri.equals (ns))
- continue;
- return prefix + ":" + name;
- }
-
- // no such luck. create a prefix name, declare it, use it.
- for (temp = 0; temp >= 0; temp++) {
- String prefix = prefixRoot + temp;
-
- if (nsStack.getURI (prefix) == null) {
- nsStack.declarePrefix (prefix, ns);
- attributes.addAttribute ("", "", "xmlns:" + prefix,
- "CDATA", ns);
- return prefix + ":" + name;
- }
- }
- fatalError ("too many prefixes genned");
- // NOTREACHED
- return null;
- }
-
- public void startElement (
- String uri, String localName,
- String qName, Attributes atts
- ) throws SAXException
- {
- if (!pushedContext)
- nsStack.pushContext ();
- pushedContext = false;
-
- // make sure we have all NS declarations handy before we start
- int length = atts.getLength ();
-
- for (int i = 0; i < length; i++) {
- String aName = atts.getQName (i);
-
- if (!aName.startsWith ("xmlns"))
- continue;
-
- String prefix;
-
- if ("xmlns".equals (aName))
- prefix = "";
- else if (aName.indexOf (':') == 5)
- prefix = aName.substring (6);
- else // "xmlnsfoo" etc.
- continue;
- startPrefixMapping (prefix, atts.getValue (i));
- }
-
- // put namespace decls at the start of our regenned attlist
- attributes.clear ();
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
-
- attributes.addAttribute ("", "",
- ("".equals (prefix)
- ? "xmlns"
- : "xmlns:" + prefix),
- "CDATA",
- nsStack.getURI (prefix));
- }
-
- // name fixups: element, then attributes.
- // fixName may declare a new prefix or, for the element,
- // redeclare the default (if element name needs it).
- qName = fixName (uri, localName, qName, false);
-
- for (int i = 0; i < length; i++) {
- String aName = atts.getQName (i);
- String aNS = atts.getURI (i);
- String aLocal = atts.getLocalName (i);
- String aType = atts.getType (i);
- String aValue = atts.getValue (i);
-
- if (aName.startsWith ("xmlns"))
- continue;
- aName = fixName (aNS, aLocal, aName, true);
- attributes.addAttribute (aNS, aLocal, aName, aType, aValue);
- }
-
- elementStack.push (qName);
-
- // pass event along, with cleaned-up names and decls.
- super.startElement (uri, localName, qName, attributes);
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- nsStack.popContext ();
- qName = (String) elementStack.pop ();
- super.endElement (uri, localName, qName);
- }
-
- /**
- * This call is not passed to the next consumer in the chain.
- * Prefix declarations and scopes are only exposed in their
- * attribute form.
- */
- public void endPrefixMapping (String prefix)
- throws SAXException
- { }
-
- public void endDocument () throws SAXException
- {
- elementStack.removeAllElements ();
- nsStack.reset ();
- super.endDocument ();
- }
-}
diff --git a/libjava/gnu/xml/pipeline/PipelineFactory.java b/libjava/gnu/xml/pipeline/PipelineFactory.java
deleted file mode 100644
index f88ab164311..00000000000
--- a/libjava/gnu/xml/pipeline/PipelineFactory.java
+++ /dev/null
@@ -1,723 +0,0 @@
-/* PipelineFactory.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.reflect.Constructor;
-import java.util.StringTokenizer;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-
-
-/**
- * This provides static factory methods for creating simple event pipelines.
- * These pipelines are specified by strings, suitable for passing on
- * command lines or embedding in element attributes. For example, one way
- * to write a pipeline that restores namespace syntax, validates (stopping
- * the pipeline on validity errors) and then writes valid data to standard
- * output is this: In this syntax, the tokens are always separated by whitespace, and each
- * stage of the pipeline may optionally have a parameter (which can be a
- * pipeline) in parentheses. Interior stages are called filters, and the
- * rightmost end of a pipeline is called a terminus.
- *
- * Stages are usually implemented by a single class, which may not be
- * able to act as both a filter and a terminus; but any terminus can be
- * automatically turned into a filter, through use of a {@link TeeConsumer}.
- * The stage identifiers are either class names, or are one of the following
- * short identifiers built into this class. (Most of these identifiers are
- * no more than aliases for classes.) The built-in identifiers include: Note that {@link EventFilter#bind} can automatically eliminate
- * some filters by setting SAX2 parser features appropriately. This means
- * that you can routinely put filters like "nsfix", "validate", or "wf" at the
- * front of a pipeline (for components that need inputs conditioned to match
- * that level of correctness), and know that it won't actually be used unless
- * it's absolutely necessary.
- *
- * @author David Brownell
- */
-public class PipelineFactory
-{
- /**
- * Creates a simple pipeline according to the description string passed in.
- */
- public static EventConsumer createPipeline (String description)
- throws IOException
- {
- return createPipeline (description, null);
- }
-
- /**
- * Extends an existing pipeline by prepending the filter pipeline to the
- * specified consumer. Some pipelines need more customization than can
- * be done through this simplified syntax. When they are set up with
- * direct API calls, use this method to merge more complex pipeline
- * segments with easily configured ones.
- */
- public static EventConsumer createPipeline (
- String description,
- EventConsumer next
- ) throws IOException
- {
- // tokens are (for now) what's separated by whitespace;
- // very easy to parse, but IDs never have spaces.
-
- StringTokenizer tokenizer;
- String tokens [];
-
- tokenizer = new StringTokenizer (description);
- tokens = new String [tokenizer.countTokens ()];
- for (int i = 0; i < tokens.length; i++)
- tokens [i] = tokenizer.nextToken ();
-
- PipelineFactory factory = new PipelineFactory ();
- Pipeline pipeline = factory.parsePipeline (tokens, next);
-
- return pipeline.createPipeline ();
- }
-
-
- private PipelineFactory () { /* NYET */ }
-
-
- /**
- * Extends an existing pipeline by prepending a pre-tokenized filter
- * pipeline to the specified consumer. Tokens are class names (or the
- * predefined aliases) left and right parenthesis, and the vertical bar.
- */
- public static EventConsumer createPipeline (
- String tokens [],
- EventConsumer next
- ) throws IOException
- {
- PipelineFactory factory = new PipelineFactory ();
- Pipeline pipeline = factory.parsePipeline (tokens, next);
-
- return pipeline.createPipeline ();
- }
-
-
- private String tokens [];
- private int index;
-
- private Pipeline parsePipeline (String toks [], EventConsumer next)
- {
- tokens = toks;
- index = 0;
-
- Pipeline retval = parsePipeline (next);
-
- if (index != toks.length)
- throw new ArrayIndexOutOfBoundsException (
- "extra token: " + tokens [index]);
- return retval;
- }
-
- // pipeline ::= stage | stage '|' pipeline
- private Pipeline parsePipeline (EventConsumer next)
- {
- Pipeline retval = new Pipeline (parseStage ());
-
- // minimal pipelines: "stage" and "... | id"
- if (index > (tokens.length - 2)
- || !"|".equals (tokens [index])
- ) {
- retval.next = next;
- return retval;
- }
- index++;
- retval.rest = parsePipeline (next);
- return retval;
- }
-
- // stage ::= id | id '(' pipeline ')'
- private Stage parseStage ()
- {
- Stage retval = new Stage (tokens [index++]);
-
- // minimal stages: "id" and "id ( id )"
- if (index > (tokens.length - 2)
- || !"(".equals (tokens [index]) /*)*/
- )
- return retval;
-
- index++;
- retval.param = parsePipeline (null);
- if (index >= tokens.length)
- throw new ArrayIndexOutOfBoundsException (
- "missing right paren");
- if (/*(*/ !")".equals (tokens [index++]))
- throw new ArrayIndexOutOfBoundsException (
- "required right paren, not: " + tokens [index - 1]);
- return retval;
- }
-
-
- //
- // these classes obey the conventions for constructors, so they're
- // only built in to this table of shortnames
- //
- // - filter (one or two types of arglist)
- // * last constructor is 'next' element
- // * optional (first) string parameter
- //
- // - terminus (one or types of arglist)
- // * optional (only) string parameter
- //
- // terminus stages are transformed into filters if needed, by
- // creating a "tee". filter stages aren't turned to terminus
- // stages though; either eliminate such stages, or add some
- // terminus explicitly.
- //
- private static final String builtinStages [][] = {
- { "dom", "gnu.xml.dom.Consumer" },
- { "nsfix", "gnu.xml.pipeline.NSFilter" },
- { "null", "gnu.xml.pipeline.EventFilter" },
- { "server", "gnu.xml.pipeline.CallFilter" },
- { "tee", "gnu.xml.pipeline.TeeConsumer" },
- { "validate", "gnu.xml.pipeline.ValidationConsumer" },
- { "wf", "gnu.xml.pipeline.WellFormednessFilter" },
- { "xinclude", "gnu.xml.pipeline.XIncludeFilter" },
- { "xslt", "gnu.xml.pipeline.XsltFilter" },
-
-// XXX want: option for validate, to preload external part of a DTD
-
- // xhtml, write ... nyet generic-ready
- };
-
- private static class Stage
- {
- String id;
- Pipeline param;
-
- Stage (String name)
- { id = name; }
-
- public String toString ()
- {
- if (param == null)
- return id;
- return id + " ( " + param + " )";
- }
-
- private void fail (String message)
- throws IOException
- {
- throw new IOException ("in '" + id
- + "' stage of pipeline, " + message);
- }
-
- EventConsumer createStage (EventConsumer next)
- throws IOException
- {
- String name = id;
-
- // most builtins are just class aliases
- for (int i = 0; i < builtinStages.length; i++) {
- if (id.equals (builtinStages [i][0])) {
- name = builtinStages [i][1];
- break;
- }
- }
-
- // Save output as XML or XHTML text
- if ("write".equals (name) || "xhtml".equals (name)) {
- String filename;
- boolean isXhtml = "xhtml".equals (name);
- OutputStream out = null;
- TextConsumer consumer;
-
- if (param == null)
- fail ("parameter is required");
-
- filename = param.toString ();
- if ("stdout".equals (filename))
- out = System.out;
- else if ("stderr".equals (filename))
- out = System.err;
- else {
- File f = new File (filename);
-
-/*
- if (!f.isAbsolute ())
- fail ("require absolute file paths");
- */
- if (f.exists ())
- fail ("file already exists: " + f.getName ());
-
-// XXX this races against the existence test
- out = new FileOutputStream (f);
- }
-
- if (!isXhtml)
- consumer = new TextConsumer (out);
- else
- consumer = new TextConsumer (
- new OutputStreamWriter (out, "8859_1"),
- true);
-
- consumer.setPrettyPrinting (true);
- if (next == null)
- return consumer;
- return new TeeConsumer (consumer, next);
-
- } else {
- //
- // Here go all the builtins that are just aliases for
- // classes, and all stage IDs that started out as such
- // class names. The following logic relies on several
- // documented conventions for constructor invocation.
- //
- String msg = null;
-
- try {
- Class klass = Class.forName (name);
- Class argTypes [] = null;
- Constructor constructor = null;
- boolean filter = false;
- Object params [] = null;
- Object obj = null;
-
- // do we need a filter stage?
- if (next != null) {
- // "next" consumer is always passed, with
- // or without the optional string param
- if (param == null) {
- argTypes = new Class [1];
- argTypes [0] = EventConsumer.class;
-
- params = new Object [1];
- params [0] = next;
-
- msg = "no-param filter";
- } else {
- argTypes = new Class [2];
- argTypes [0] = String.class;
- argTypes [1] = EventConsumer.class;
-
- params = new Object [2];
- params [0] = param.toString ();
- params [1] = next;
-
- msg = "one-param filter";
- }
-
-
- try {
- constructor = klass.getConstructor (argTypes);
- } catch (NoSuchMethodException e) {
- // try creating a filter from a
- // terminus and a tee
- filter = true;
- msg += " built from ";
- }
- }
-
- // build from a terminus stage, with or
- // without the optional string param
- if (constructor == null) {
- String tmp;
-
- if (param == null) {
- argTypes = new Class [0];
- params = new Object [0];
-
- tmp = "no-param terminus";
- } else {
- argTypes = new Class [1];
- argTypes [0] = String.class;
-
- params = new Object [1];
- params [0] = param.toString ();
-
- tmp = "one-param terminus";
- }
- if (msg == null)
- msg = tmp;
- else
- msg += tmp;
- constructor = klass.getConstructor (argTypes);
- // NOT creating terminus by dead-ending
- // filters ... users should think about
- // that one, something's likely wrong
- }
-
- obj = constructor.newInstance (params);
-
- // return EventConsumers directly, perhaps after
- // turning them into a filter
- if (obj instanceof EventConsumer) {
- if (filter)
- return new TeeConsumer ((EventConsumer) obj, next);
- return (EventConsumer) obj;
- }
-
- // if it's not a handler, it's an error
- // we can wrap handlers in a filter
- EventFilter retval = new EventFilter ();
- boolean updated = false;
-
- if (obj instanceof ContentHandler) {
- retval.setContentHandler ((ContentHandler) obj);
- updated = true;
- }
- if (obj instanceof DTDHandler) {
- retval.setDTDHandler ((DTDHandler) obj);
- updated = true;
- }
- if (obj instanceof LexicalHandler) {
- retval.setProperty (
- EventFilter.PROPERTY_URI + "lexical-handler",
- obj);
- updated = true;
- }
- if (obj instanceof DeclHandler) {
- retval.setProperty (
- EventFilter.PROPERTY_URI + "declaration-handler",
- obj);
- updated = true;
- }
-
- if (!updated)
- fail ("class is neither Consumer nor Handler");
-
- if (filter)
- return new TeeConsumer (retval, next);
- return retval;
-
- } catch (IOException e) {
- throw e;
-
- } catch (NoSuchMethodException e) {
- fail (name + " constructor missing -- " + msg);
-
- } catch (ClassNotFoundException e) {
- fail (name + " class not found");
-
- } catch (Exception e) {
- // e.printStackTrace ();
- fail ("stage not available: " + e.getMessage ());
- }
- }
- // NOTREACHED
- return null;
- }
- }
-
- private static class Pipeline
- {
- Stage stage;
-
- // rest may be null
- Pipeline rest;
- EventConsumer next;
-
- Pipeline (Stage s)
- { stage = s; }
-
- public String toString ()
- {
- if (rest == null && next == null)
- return stage.toString ();
- if (rest != null)
- return stage + " | " + rest;
- throw new IllegalArgumentException ("next");
- }
-
- EventConsumer createPipeline ()
- throws IOException
- {
- if (next == null) {
- if (rest == null)
- next = stage.createStage (null);
- else
- next = stage.createStage (rest.createPipeline ());
- }
- return next;
- }
- }
-
-/*
- public static void main (String argv [])
- {
- try {
- // three basic terminus cases
- createPipeline ("null");
- createPipeline ("validate");
- createPipeline ("write ( stdout )");
-
- // four basic filters
- createPipeline ("nsfix | write ( stderr )");
- createPipeline ("wf | null");
- createPipeline ("null | null");
- createPipeline (
-"call ( http://www.example.com/services/xml-1a ) | xhtml ( stdout )");
-
- // tee junctions
- createPipeline ("tee ( validate ) | write ( stdout )");
- createPipeline ("tee ( nsfix | write ( stdout ) ) | validate");
-
- // longer pipeline
- createPipeline ("nsfix | tee ( validate ) | write ( stdout )");
- createPipeline (
- "null | wf | nsfix | tee ( validate ) | write ( stdout )");
-
- // try some parsing error cases
- try {
- createPipeline ("null ("); // extra token '('
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("nsfix |"); // extra token '|'
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("xhtml ( foo"); // missing right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("xhtml ( foo bar"); // required right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("tee ( nsfix | validate");// missing right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- // try some construction error cases
-
- try {
- createPipeline ("call"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("call ( foobar )"); // broken param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("nsfix ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("null ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("wf ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("xhtml ( foobar.html )");
- new File ("foobar.html").delete ();
- // now supported
- } catch (Exception e) {
- System.err.println ("** err: " + e.getMessage ()); }
- try {
- createPipeline ("xhtml"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("write ( stdout ) | null"); // nonterminal
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("validate | null");
- // now supported
- } catch (Exception e) {
- System.err.println ("** err: " + e.getMessage ()); }
- try {
- createPipeline ("validate ( foo )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("tee"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- // only builtins so far
- createPipeline ("com.example.xml.FilterClass");
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- } catch (Exception e) {
- e.printStackTrace ();
- }
- }
-/**/
-
-}
diff --git a/libjava/gnu/xml/pipeline/TeeConsumer.java b/libjava/gnu/xml/pipeline/TeeConsumer.java
deleted file mode 100644
index 8186de4df66..00000000000
--- a/libjava/gnu/xml/pipeline/TeeConsumer.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/* TeeConsumer.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.LexicalHandler;
-
-/**
- * Fans its events out to two other consumers, a "tee" filter stage in an
- * event pipeline. Networks can be assembled with multiple output points.
- *
- * Error handling should be simple if you remember that exceptions
- * you throw will cancel later stages in that callback's pipeline, and
- * generally the producer will stop if it sees such an exception. You
- * may want to protect your pipeline against such backflows, making a
- * kind of reverse filter (or valve?) so that certain exceptions thrown by
- * your pipeline will caught and handled before the producer sees them.
- * Just use a "try/catch" block, rememebering that really important
- * cleanup tasks should be in "finally" clauses.
- *
- * That issue isn't unique to "tee" consumers, but tee consumers have
- * the additional twist that exceptions thrown by the first consumer
- * will cause the second consumer not to see the callback (except for
- * the endDocument callback, which signals state cleanup).
- *
- * @author David Brownell
- */
-final public class TeeConsumer
- implements EventConsumer,
- ContentHandler, DTDHandler,
- LexicalHandler,DeclHandler
-{
- private EventConsumer first, rest;
-
- // cached to minimize time overhead
- private ContentHandler docFirst, docRest;
- private DeclHandler declFirst, declRest;
- private LexicalHandler lexFirst, lexRest;
-
-
- /**
- * Constructs a consumer which sends all its events to the first
- * consumer, and then the second one. If the first consumer throws
- * an exception, the second one will not see the event which
- * caused that exception to be reported.
- *
- * @param car The first consumer to get the events
- * @param cdr The second consumer to get the events
- */
- public TeeConsumer (EventConsumer car, EventConsumer cdr)
- {
- if (car == null || cdr == null)
- throw new NullPointerException ();
- first = car;
- rest = cdr;
-
- //
- // Cache the handlers.
- //
- docFirst = first.getContentHandler ();
- docRest = rest.getContentHandler ();
- // DTD handler isn't cached (rarely needed)
-
- try {
- declFirst = null;
- declFirst = (DeclHandler) first.getProperty (
- EventFilter.DECL_HANDLER);
- } catch (SAXException e) {}
- try {
- declRest = null;
- declRest = (DeclHandler) rest.getProperty (
- EventFilter.DECL_HANDLER);
- } catch (SAXException e) {}
-
- try {
- lexFirst = null;
- lexFirst = (LexicalHandler) first.getProperty (
- EventFilter.LEXICAL_HANDLER);
- } catch (SAXException e) {}
- try {
- lexRest = null;
- lexRest = (LexicalHandler) rest.getProperty (
- EventFilter.LEXICAL_HANDLER);
- } catch (SAXException e) {}
- }
-
-/* FIXME
- /**
- * Constructs a pipeline, and is otherwise a shorthand for the
- * two-consumer constructor for this class.
- *
- * @param first Description of the first pipeline to get events,
- * which will be passed to {@link PipelineFactory#createPipeline}
- * @param rest The second pipeline to get the events
- * /
- // constructor used by PipelineFactory
- public TeeConsumer (String first, EventConsumer rest)
- throws IOException
- {
- this (PipelineFactory.createPipeline (first), rest);
- }
-*/
-
- /** Returns the first pipeline to get event calls. */
- public EventConsumer getFirst ()
- { return first; }
-
- /** Returns the second pipeline to get event calls. */
- public EventConsumer getRest ()
- { return rest; }
-
- /** Returns the content handler being used. */
- final public ContentHandler getContentHandler ()
- {
- if (docRest == null)
- return docFirst;
- if (docFirst == null)
- return docRest;
- return this;
- }
-
- /** Returns the dtd handler being used. */
- final public DTDHandler getDTDHandler ()
- {
- // not cached (hardly used)
- if (rest.getDTDHandler () == null)
- return first.getDTDHandler ();
- if (first.getDTDHandler () == null)
- return rest.getDTDHandler ();
- return this;
- }
-
- /** Returns the declaration or lexical handler being used. */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- //
- // in degenerate cases, we have no work to do.
- //
- Object firstProp = null, restProp = null;
-
- try { firstProp = first.getProperty (id); }
- catch (SAXNotRecognizedException e) { /* ignore */ }
- try { restProp = rest.getProperty (id); }
- catch (SAXNotRecognizedException e) { /* ignore */ }
-
- if (restProp == null)
- return firstProp;
- if (firstProp == null)
- return restProp;
-
- //
- // we've got work to do; handle two builtin cases.
- //
- if (EventFilter.DECL_HANDLER.equals (id))
- return this;
- if (EventFilter.LEXICAL_HANDLER.equals (id))
- return this;
-
- //
- // non-degenerate, handled by both consumers, but we don't know
- // how to handle this.
- //
- throw new SAXNotRecognizedException ("can't tee: " + id);
- }
-
- /**
- * Provides the error handler to both subsequent nodes of
- * this filter stage.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- first.setErrorHandler (handler);
- rest.setErrorHandler (handler);
- }
-
-
- //
- // ContentHandler
- //
- public void setDocumentLocator (Locator locator)
- {
- // this call is not made by all parsers
- docFirst.setDocumentLocator (locator);
- docRest.setDocumentLocator (locator);
- }
-
- public void startDocument ()
- throws SAXException
- {
- docFirst.startDocument ();
- docRest.startDocument ();
- }
-
- public void endDocument ()
- throws SAXException
- {
- try {
- docFirst.endDocument ();
- } finally {
- docRest.endDocument ();
- }
- }
-
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- docFirst.startPrefixMapping (prefix, uri);
- docRest.startPrefixMapping (prefix, uri);
- }
-
- public void endPrefixMapping (String prefix)
- throws SAXException
- {
- docFirst.endPrefixMapping (prefix);
- docRest.endPrefixMapping (prefix);
- }
-
- public void skippedEntity (String name)
- throws SAXException
- {
- docFirst.skippedEntity (name);
- docRest.skippedEntity (name);
- }
-
- public void startElement (String uri, String localName,
- String qName, Attributes atts)
- throws SAXException
- {
- docFirst.startElement (uri, localName, qName, atts);
- docRest.startElement (uri, localName, qName, atts);
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- docFirst.endElement (uri, localName, qName);
- docRest.endElement (uri, localName, qName);
- }
-
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- docFirst.processingInstruction (target, data);
- docRest.processingInstruction (target, data);
- }
-
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- docFirst.characters (ch, start, length);
- docRest.characters (ch, start, length);
- }
-
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- docFirst.ignorableWhitespace (ch, start, length);
- docRest.ignorableWhitespace (ch, start, length);
- }
-
-
- //
- // DTDHandler
- //
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- DTDHandler l1 = first.getDTDHandler ();
- DTDHandler l2 = rest.getDTDHandler ();
-
- l1.notationDecl (name, publicId, systemId);
- l2.notationDecl (name, publicId, systemId);
- }
-
- public void unparsedEntityDecl (String name,
- String publicId, String systemId,
- String notationName
- ) throws SAXException
- {
- DTDHandler l1 = first.getDTDHandler ();
- DTDHandler l2 = rest.getDTDHandler ();
-
- l1.unparsedEntityDecl (name, publicId, systemId, notationName);
- l2.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
-
- //
- // DeclHandler
- //
- public void attributeDecl (String eName, String aName,
- String type,
- String mode, String value)
- throws SAXException
- {
- declFirst.attributeDecl (eName, aName, type, mode, value);
- declRest.attributeDecl (eName, aName, type, mode, value);
- }
-
- public void elementDecl (String name, String model)
- throws SAXException
- {
- declFirst.elementDecl (name, model);
- declRest.elementDecl (name, model);
- }
-
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- declFirst.externalEntityDecl (name, publicId, systemId);
- declRest.externalEntityDecl (name, publicId, systemId);
- }
-
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- declFirst.internalEntityDecl (name, value);
- declRest.internalEntityDecl (name, value);
- }
-
-
- //
- // LexicalHandler
- //
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- lexFirst.comment (ch, start, length);
- lexRest.comment (ch, start, length);
- }
-
- public void startCDATA ()
- throws SAXException
- {
- lexFirst.startCDATA ();
- lexRest.startCDATA ();
- }
-
- public void endCDATA ()
- throws SAXException
- {
- lexFirst.endCDATA ();
- lexRest.endCDATA ();
- }
-
- public void startEntity (String name)
- throws SAXException
- {
- lexFirst.startEntity (name);
- lexRest.startEntity (name);
- }
-
- public void endEntity (String name)
- throws SAXException
- {
- lexFirst.endEntity (name);
- lexRest.endEntity (name);
- }
-
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- lexFirst.startDTD (name, publicId, systemId);
- lexRest.startDTD (name, publicId, systemId);
- }
-
- public void endDTD ()
- throws SAXException
- {
- lexFirst.endDTD ();
- lexRest.endDTD ();
- }
-}
diff --git a/libjava/gnu/xml/pipeline/TextConsumer.java b/libjava/gnu/xml/pipeline/TextConsumer.java
deleted file mode 100644
index 67bd23b00d6..00000000000
--- a/libjava/gnu/xml/pipeline/TextConsumer.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/* TextConsumer.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.io.*;
-
-import org.xml.sax.*;
-
-import gnu.xml.util.XMLWriter;
-
-
-/**
- * Terminates a pipeline, consuming events to print them as well formed
- * XML (or XHTML) text.
- *
- * Input must be well formed, and must include XML names (e.g. the
- * prefixes and prefix declarations must be present), or the output of
- * this class is undefined.
- *
- * @see NSFilter
- * @see WellFormednessFilter
- *
- * @author David Brownell
- */
-public class TextConsumer extends XMLWriter implements EventConsumer
-{
- /**
- * Constructs an event consumer which echoes its input as text,
- * optionally adhering to some basic XHTML formatting options
- * which increase interoperability with old (v3) browsers.
- *
- * For the best interoperability, when writing as XHTML only
- * ASCII characters are emitted; other characters are turned to
- * entity or character references as needed, and no XML declaration
- * is provided in the document.
- */
- public TextConsumer (Writer w, boolean isXhtml)
- throws IOException
- {
- super (w, isXhtml ? "US-ASCII" : null);
- setXhtml (isXhtml);
- }
-
- /**
- * Constructs a consumer that writes its input as XML text.
- * XHTML rules are not followed.
- */
- public TextConsumer (Writer w)
- throws IOException
- {
- this (w, false);
- }
-
- /**
- * Constructs a consumer that writes its input as XML text,
- * encoded in UTF-8. XHTML rules are not followed.
- */
- public TextConsumer (OutputStream out)
- throws IOException
- {
- this (new OutputStreamWriter (out, "UTF8"), false);
- }
-
- /** EventConsumer Returns the document handler being used. */
- public ContentHandler getContentHandler ()
- { return this; }
-
- /** EventConsumer Returns the dtd handler being used. */
- public DTDHandler getDTDHandler ()
- { return this; }
-
- /** XMLReaderRetrieves a property (lexical and decl handlers) */
- public Object getProperty (String propertyId)
- throws SAXNotRecognizedException
- {
- if (EventFilter.LEXICAL_HANDLER.equals (propertyId))
- return this;
- if (EventFilter.DECL_HANDLER.equals (propertyId))
- return this;
- throw new SAXNotRecognizedException (propertyId);
- }
-}
diff --git a/libjava/gnu/xml/pipeline/ValidationConsumer.java b/libjava/gnu/xml/pipeline/ValidationConsumer.java
deleted file mode 100644
index 2510c768cfb..00000000000
--- a/libjava/gnu/xml/pipeline/ValidationConsumer.java
+++ /dev/null
@@ -1,1929 +0,0 @@
-/* ValidationConsumer.java --
- Copyright (C) 1999,2000,2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.EmptyStackException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Stack;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * This class checks SAX2 events to report validity errors; it works as
- * both a filter and a terminus on an event pipeline. It relies on the
- * producer of SAX events to: At this writing, the major SAX2 parsers (such as Ælfred2,
- * Crimson, and Xerces) meet these requirements, and this validation
- * module is used by the optional Ælfred2 validation support.
- * Note that because this is a layered validator, it has to duplicate some
- * work that the parser is doing; there are also other cost to layering.
- * However, because of layering it doesn't need a parser in order
- * to work! You can use it with anything that generates SAX events, such
- * as an application component that wants to detect invalid content in
- * a changed area without validating an entire document, or which wants to
- * ensure that it doesn't write invalid data to a communications partner. Also, note that because this is a layered validator, the line numbers
- * reported for some errors may seem strange. For example, if an element does
- * not permit character content, the validator
- * will use the locator provided to it.
- * That might reflect the last character of a characters event
- * callback, rather than the first non-whitespace character. Current limitations of the validation performed are in roughly three
- * categories. The first category represents constraints which demand violations
- * of software layering: exposing lexical details, one of the first things
- * that application programming interfaces (APIs) hide. These
- * invariably relate to XML entity handling, and to historical oddities
- * of the XML validation semantics. Curiously,
- * recent (Autumn 1999) conformance testing showed that these constraints are
- * among those handled worst by existing XML validating parsers. Arguments
- * have been made that each of these VCs should be turned into WFCs (most
- * of them) or discarded (popular for the standalone declaration); in short,
- * that these are bugs in the XML specification (not all via SGML): The second category of limitations on this validation represent
- * constraints associated with information that is not guaranteed to be
- * available (or in one case, is guaranteed not to be available,
- * through the SAX2 API: A third category relates to ease of implementation. (Think of this
- * as "bugs".) The most notable issue here is character handling. Rather
- * than attempting to implement the voluminous character tables in the XML
- * specification (Appendix B), Unicode rules are used directly from
- * the java.lang.Character class. Recent JVMs have begun to diverge from
- * the original specification for that class (Unicode 2.0), meaning that
- * different JVMs may handle that aspect of conformance differently.
- * Note that for some of the validity errors that SAX2 does not
- * expose, a nonvalidating parser is permitted (by the XML specification)
- * to report validity errors. When used with a parser that does so for
- * the validity constraints mentioned above (or any other SAX2 event
- * stream producer that does the same thing), overall conformance is
- * substantially improved.
- *
- * @see gnu.xml.aelfred2.SAXDriver
- * @see gnu.xml.aelfred2.XmlReader
- *
- * @author David Brownell
- */
-public final class ValidationConsumer extends EventFilter
-{
- // report error if we happen to notice a non-deterministic choice?
- // we won't report buggy content models; just buggy instances
- private static final boolean warnNonDeterministic = false;
-
- // for tracking active content models
- private String rootName;
- private Stack contentStack = new Stack ();
-
- // flags for "saved DTD" processing
- private boolean disableDeclarations;
- private boolean disableReset;
-
- //
- // most VCs get tested when we see element start tags. the per-element
- // info (including attributes) recorded here duplicates that found inside
- // many nonvalidating parsers, hence dual lookups etc ... that's why a
- // layered validator isn't going to be as fast as a non-layered one.
- //
-
- // key = element name; value = ElementInfo
- private Hashtable elements = new Hashtable ();
-
- // some VCs relate to ID/IDREF/IDREFS attributes
- // key = id; value = boolean true (defd) or false (refd)
- private Hashtable ids = new Hashtable ();
-
- // we just record declared notation and unparsed entity names.
- // the implementation here is simple/slow; these features
- // are seldom used, one hopes they'll wither away soon
- private Vector notations = new Vector (5, 5);
- private Vector nDeferred = new Vector (5, 5);
- private Vector unparsed = new Vector (5, 5);
- private Vector uDeferred = new Vector (5, 5);
-
- // note: DocBk 3.1.7 XML defines over 2 dozen notations,
- // used when defining unparsed entities for graphics
- // (and maybe in other places)
-
-
-
- /**
- * Creates a pipeline terminus which consumes all events passed to
- * it; this will report validity errors as if they were fatal errors,
- * unless an error handler is assigned.
- *
- * @see #setErrorHandler
- */
- // constructor used by PipelineFactory
- // ... and want one taking system ID of an external subset
- public ValidationConsumer ()
- {
- this (null);
- }
-
- /**
- * Creates a pipeline filter which reports validity errors and then
- * passes events on to the next consumer if they were not fatal.
- *
- * @see #setErrorHandler
- */
- // constructor used by PipelineFactory
- // ... and want one taking system ID of an external subset
- // (which won't send declaration events)
- public ValidationConsumer (EventConsumer next)
- {
- super (next);
-
- setContentHandler (this);
- setDTDHandler (this);
- try { setProperty (DECL_HANDLER, this); }
- catch (Exception e) { /* "can't happen" */ }
- try { setProperty (LEXICAL_HANDLER, this); }
- catch (Exception e) { /* "can't happen" */ }
- }
-
-
- private static final String fakeRootName
- = ":Nobody:in:their_Right.Mind_would:use:this-name:1x:";
-
- /**
- * Creates a validation consumer which is preloaded with the DTD provided.
- * It does this by constructing a document with that DTD, then parsing
- * that document and recording its DTD declarations. Then it arranges
- * not to modify that information.
- *
- * The resulting validation consumer will only validate against
- * the specified DTD, regardless of whether some other DTD is found
- * in a document being parsed.
- *
- * @param rootName The name of the required root element; if this is
- * null, any root element name will be accepted.
- * @param publicId If non-null and there is a non-null systemId, this
- * identifier provides an alternate access identifier for the DTD's
- * external subset.
- * @param systemId If non-null, this is a URI (normally URL) that
- * may be used to access the DTD's external subset.
- * @param internalSubset If non-null, holds literal markup declarations
- * comprising the DTD's internal subset.
- * @param resolver If non-null, this will be provided to the parser for
- * use when resolving parameter entities (including any external subset).
- * @param resolver If non-null, this will be provided to the parser for
- * use when resolving parameter entities (including any external subset).
- * @param minimalElement If non-null, a minimal valid document.
- *
- * @exception SAXNotSupportedException If the default SAX parser does
- * not support the standard lexical or declaration handlers.
- * @exception SAXParseException If the specified DTD has either
- * well-formedness or validity errors
- * @exception IOException If the specified DTD can't be read for
- * some reason
- */
- public ValidationConsumer (
- String rootName,
- String publicId,
- String systemId,
- String internalSubset,
- EntityResolver resolver,
- String minimalDocument
- ) throws SAXException, IOException
- {
- this (null);
-
- disableReset = true;
- if (rootName == null)
- rootName = fakeRootName;
-
- //
- // Synthesize document with that DTD; is it possible to do
- // better for the declaration of the root element?
- //
- // NOTE: can't use SAX2 to write internal subsets.
- //
- StringWriter writer = new StringWriter ();
-
- writer.write ("");
- }
- if (internalSubset != null)
- writer.write (internalSubset);
- writer.write ("\n ]>");
-
- if (minimalDocument != null) {
- writer.write ("\n");
- writer.write (minimalDocument);
- writer.write ("\n");
- } else {
- writer.write (" <");
- writer.write (rootName);
- writer.write ("/>\n");
- }
- minimalDocument = writer.toString ();
-
- //
- // OK, load it
- //
- XMLReader producer;
-
- producer = XMLReaderFactory.createXMLReader ();
- bind (producer, this);
-
- if (resolver != null)
- producer.setEntityResolver (resolver);
-
- InputSource in;
-
- in = new InputSource (new StringReader (minimalDocument));
- producer.parse (in);
-
- disableDeclarations = true;
- if (rootName == fakeRootName)
- this.rootName = null;
- }
-
- private void resetState ()
- {
- if (!disableReset) {
- rootName = null;
- contentStack.removeAllElements ();
- elements.clear ();
- ids.clear ();
-
- notations.removeAllElements ();
- nDeferred.removeAllElements ();
- unparsed.removeAllElements ();
- uDeferred.removeAllElements ();
- }
- }
-
-
- private void warning (String description)
- throws SAXException
- {
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (errHandler == null)
- return;
-
- if (locator == null)
- err = new SAXParseException (description, null, null, -1, -1);
- else
- err = new SAXParseException (description, locator);
- errHandler.warning (err);
- }
-
- // package private (for ChildrenRecognizer)
- private void error (String description)
- throws SAXException
- {
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (locator == null)
- err = new SAXParseException (description, null, null, -1, -1);
- else
- err = new SAXParseException (description, locator);
- if (errHandler != null)
- errHandler.error (err);
- else // else we always treat it as fatal!
- throw err;
- }
-
- private void fatalError (String description)
- throws SAXException
- {
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (locator != null)
- err = new SAXParseException (description, locator);
- else
- err = new SAXParseException (description, null, null, -1, -1);
- if (errHandler != null)
- errHandler.fatalError (err);
- // we always treat this as fatal, regardless of the handler
- throw err;
- }
-
-
- private static boolean isExtender (char c)
- {
- // [88] Extender ::= ...
- return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387
- || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005
- || (c >= 0x3031 && c <= 0x3035)
- || (c >= 0x309d && c <= 0x309e)
- || (c >= 0x30fc && c <= 0x30fe);
- }
-
-
- // use augmented Unicode rules, not full XML rules
- private boolean isName (String name, String context, String id)
- throws SAXException
- {
- char buf [] = name.toCharArray ();
- boolean pass = true;
-
- if (!Character.isUnicodeIdentifierStart (buf [0])
- && ":_".indexOf (buf [0]) == -1)
- pass = false;
- else {
- int max = buf.length;
- for (int i = 1; pass && i < max; i++) {
- char c = buf [i];
- if (!Character.isUnicodeIdentifierPart (c)
- && ":-_.".indexOf (c) == -1
- && !isExtender (c))
- pass = false;
- }
- }
-
- if (!pass)
- error ("In " + context + " for " + id
- + ", '" + name + "' is not a name");
- return pass; // true == OK
- }
-
- // use augmented Unicode rules, not full XML rules
- private boolean isNmtoken (String nmtoken, String context, String id)
- throws SAXException
- {
- char buf [] = nmtoken.toCharArray ();
- boolean pass = true;
- int max = buf.length;
-
- // XXX make this share code with isName
-
- for (int i = 0; pass && i < max; i++) {
- char c = buf [i];
- if (!Character.isUnicodeIdentifierPart (c)
- && ":-_.".indexOf (c) == -1
- && !isExtender (c))
- pass = false;
- }
-
- if (!pass)
- error ("In " + context + " for " + id
- + ", '" + nmtoken + "' is not a name token");
- return pass; // true == OK
- }
-
- private void checkEnumeration (String value, String type, String name)
- throws SAXException
- {
- if (!hasMatch (value, type))
- // VC: Enumeration
- error ("Value '" + value
- + "' for attribute '" + name
- + "' is not permitted: " + type);
- }
-
- // used to test enumerated attributes and mixed content models
- // package private
- static boolean hasMatch (String value, String orList)
- {
- int len = value.length ();
- int max = orList.length () - len;
-
- for (int start = 0;
- (start = orList.indexOf (value, start)) != -1;
- start++) {
- char c;
-
- if (start > max)
- break;
- c = orList.charAt (start - 1);
- if (c != '|' && c != '('/*)*/)
- continue;
- c = orList.charAt (start + len);
- if (c != '|' && /*(*/ c != ')')
- continue;
- return true;
- }
- return false;
- }
-
- /**
- * LexicalHandler Records the declaration of the root
- * element, so it can be verified later.
- * Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- rootName = name;
- super.startDTD (name, publicId, systemId);
- }
-
- /**
- * LexicalHandler Verifies that all referenced notations
- * and unparsed entities have been declared.
- * Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void endDTD ()
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- // this is a convenient hook for end-of-dtd checks, but we
- // could also trigger it in the first startElement call.
- // locator info is more appropriate here though.
-
- // VC: Notation Declared (NDATA can refer to them before decls,
- // as can NOTATION attribute enumerations and defaults)
- int length = nDeferred.size ();
- for (int i = 0; i < length; i++) {
- String notation = (String) nDeferred.elementAt (i);
- if (!notations.contains (notation)) {
- error ("A declaration referred to notation '" + notation
- + "' which was never declared");
- }
- }
- nDeferred.removeAllElements ();
-
- // VC: Entity Name (attribute values can refer to them
- // before they're declared); VC Attribute Default Legal
- length = uDeferred.size ();
- for (int i = 0; i < length; i++) {
- String entity = (String) uDeferred.elementAt (i);
- if (!unparsed.contains (entity)) {
- error ("An attribute default referred to entity '" + entity
- + "' which was never declared");
- }
- }
- uDeferred.removeAllElements ();
- super.endDTD ();
- }
-
-
- // These are interned, so we can rely on "==" to find the type of
- // all attributes except enumerations ...
- // "(this|or|that|...)" and "NOTATION (this|or|that|...)"
- static final String types [] = {
- "CDATA",
- "ID", "IDREF", "IDREFS",
- "NMTOKEN", "NMTOKENS",
- "ENTITY", "ENTITIES"
- };
-
-
- /**
- * DecllHandler Records attribute declaration for later use
- * in validating document content, and checks validity constraints
- * that are applicable to attribute declarations.
- * Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void attributeDecl (
- String eName,
- String aName,
- String type,
- String mode,
- String value
- ) throws SAXException
- {
- if (disableDeclarations)
- return;
-
- ElementInfo info = (ElementInfo) elements.get (eName);
- AttributeInfo ainfo = new AttributeInfo ();
- boolean checkOne = false;
- boolean interned = false;
-
- // cheap interning of type names and #FIXED, #REQUIRED
- // for faster startElement (we can use "==")
- for (int i = 0; i < types.length; i++) {
- if (types [i].equals (type)) {
- type = types [i];
- interned = true;
- break;
- }
- }
- if ("#FIXED".equals (mode))
- mode = "#FIXED";
- else if ("#REQUIRED".equals (mode))
- mode = "#REQUIRED";
-
- ainfo.type = type;
- ainfo.mode = mode;
- ainfo.value = value;
-
- // we might not have seen the content model yet
- if (info == null) {
- info = new ElementInfo (eName);
- elements.put (eName, info);
- }
- if ("ID" == type) {
- checkOne = true;
- if (!("#REQUIRED" == mode || "#IMPLIED".equals (mode))) {
- // VC: ID Attribute Default
- error ("ID attribute '" + aName
- + "' must be #IMPLIED or #REQUIRED");
- }
-
- } else if (!interned && type.startsWith ("NOTATION ")) {
- checkOne = true;
-
- // VC: Notation Attributes (notations must be declared)
- StringTokenizer tokens = new StringTokenizer (
- type.substring (10, type.lastIndexOf (')')),
- "|");
- while (tokens.hasMoreTokens ()) {
- String token = tokens.nextToken ();
- if (!notations.contains (token))
- nDeferred.addElement (token);
- }
- }
- if (checkOne) {
- for (Enumeration e = info.attributes.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String name;
- AttributeInfo ainfo2;
-
- name = (String) e.nextElement ();
- ainfo2 = (AttributeInfo) info.attributes.get (name);
- if (type == ainfo2.type || !interned /* NOTATION */) {
- // VC: One ID per Element Type
- // VC: One Notation per Element TYpe
- error ("Element '" + eName
- + "' already has an attribute of type "
- + (interned ? "NOTATION" : type)
- + " ('" + name
- + "') so '" + aName
- + "' is a validity error");
- }
- }
- }
-
- // VC: Attribute Default Legal
- if (value != null) {
-
- if ("CDATA" == type) {
- // event source rejected '<'
-
- } else if ("NMTOKEN" == type) {
- // VC: Name Token (is a nmtoken)
- isNmtoken (value, "attribute default", aName);
-
- } else if ("NMTOKENS" == type) {
- // VC: Name Token (is a nmtoken; at least one value)
- StringTokenizer tokens = new StringTokenizer (value);
- if (!tokens.hasMoreTokens ())
- error ("Default for attribute '" + aName
- + "' must have at least one name token.");
- else do {
- String token = tokens.nextToken ();
- isNmtoken (token, "attribute default", aName);
- } while (tokens.hasMoreTokens ());
-
- } else if ("IDREF" == type || "ENTITY" == type) {
- // VC: Entity Name (is a name)
- // VC: IDREF (is a name) (is declared)
- isName (value, "attribute default", aName);
- if ("ENTITY" == type && !unparsed.contains (value))
- uDeferred.addElement (value);
-
- } else if ("IDREFS" == type || "ENTITIES" == type) {
- // VC: Entity Name (is a name; at least one value)
- // VC: IDREF (is a name; at least one value)
- StringTokenizer names = new StringTokenizer (value);
- if (!names.hasMoreTokens ())
- error ("Default for attribute '" + aName
- + "' must have at least one name.");
- else do {
- String name = names.nextToken ();
- isName (name, "attribute default", aName);
- if ("ENTITIES" == type && !unparsed.contains (name))
- uDeferred.addElement (value);
- } while (names.hasMoreTokens ());
-
- } else if (type.charAt (0) == '(' /*)*/ ) {
- // VC: Enumeration (must match)
- checkEnumeration (value, type, aName);
-
- } else if (!interned && checkOne) { /* NOTATION */
- // VC: Notation attributes (must be names)
- isName (value, "attribute default", aName);
-
- // VC: Notation attributes (must be declared)
- if (!notations.contains (value))
- nDeferred.addElement (value);
-
- // VC: Enumeration (must match)
- checkEnumeration (value, type, aName);
-
- } else if ("ID" != type)
- throw new RuntimeException ("illegal attribute type: " + type);
- }
-
- if (info.attributes.get (aName) == null)
- info.attributes.put (aName, ainfo);
- /*
- else
- warning ("Element '" + eName
- + "' already has an attribute named '" + aName + "'");
- */
-
- if ("xml:space".equals (aName)) {
- if (!("(default|preserve)".equals (type)
- || "(preserve|default)".equals (type)
- // these next two are arguable; XHTML's DTD doesn't
- // deserve errors. After all, it's not like any
- // illegal _value_ could pass ...
- || "(preserve)".equals (type)
- || "(default)".equals (type)
- ))
- error (
- "xml:space attribute type must be like '(default|preserve)'"
- + " not '" + type + "'"
- );
-
- }
- super.attributeDecl (eName, aName, type, mode, value);
- }
-
- /**
- * DecllHandler Records the element declaration for later use
- * when checking document content, and checks validity constraints that
- * apply to element declarations. Passed to the next consumer, unless
- * this one was preloaded with a particular DTD.
- */
- public void elementDecl (String name, String model)
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- ElementInfo info = (ElementInfo) elements.get (name);
-
- // we might have seen an attribute decl already
- if (info == null) {
- info = new ElementInfo (name);
- elements.put (name, info);
- }
- if (info.model != null) {
- // NOTE: not all parsers can report such duplicates.
- // VC: Unique Element Type Declaration
- error ("Element type '" + name
- + "' was already declared.");
- } else {
- info.model = model;
-
- // VC: No Duplicate Types (in mixed content models)
- if (model.charAt (1) == '#') // (#PCDATA...
- info.getRecognizer (this);
- }
- super.elementDecl (name, model);
- }
-
- /**
- * DecllHandler passed to the next consumer, unless this
- * one was preloaded with a particular DTD
- */
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- if (!disableDeclarations)
- super.internalEntityDecl (name, value);
- }
-
- /**
- * DecllHandler passed to the next consumer, unless this
- * one was preloaded with a particular DTD
- */
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (!disableDeclarations)
- super.externalEntityDecl (name, publicId, systemId);
- }
-
-
- /**
- * DTDHandler Records the notation name, for checking
- * NOTATIONS attribute values and declararations of unparsed
- * entities. Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- notations.addElement (name);
- super.notationDecl (name, publicId, systemId);
- }
-
- /**
- * DTDHandler Records the entity name, for checking
- * ENTITY and ENTITIES attribute values; records the notation
- * name if it hasn't yet been declared. Passed to the next consumer,
- * unless this one was preloaded with a particular DTD.
- */
- public void unparsedEntityDecl (
- String name,
- String publicId,
- String systemId,
- String notationName
- ) throws SAXException
- {
- if (disableDeclarations)
- return;
-
- unparsed.addElement (name);
- if (!notations.contains (notationName))
- nDeferred.addElement (notationName);
- super.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
-
- /**
- * ContentHandler Ensures that state from any previous parse
- * has been deleted.
- * Passed to the next consumer.
- */
- public void startDocument ()
- throws SAXException
- {
- resetState ();
- super.startDocument ();
- }
-
-
- private static boolean isAsciiLetter (char c)
- {
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
- }
-
-
- /**
- * ContentHandler Reports a fatal exception. Validating
- * XML processors may not skip any entities.
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- fatalError ("may not skip entities");
- }
-
- /*
- * SAX2 doesn't expand non-PE refs in attribute defaults...
- */
- private String expandDefaultRefs (String s)
- throws SAXException
- {
- if (s.indexOf ('&') < 0)
- return s;
-
-// FIXME: handle nn; nn; &name;
- String message = "Can't expand refs in attribute default: " + s;
- warning (message);
-
- return s;
- }
-
- /**
- * ContentHandler Performs validity checks against element
- * (and document) content models, and attribute values.
- * Passed to the next consumer.
- */
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- //
- // First check content model for the enclosing scope.
- //
- if (contentStack.isEmpty ()) {
- // VC: Root Element Type
- if (!qName.equals (rootName)) {
- if (rootName == null)
- warning ("This document has no DTD, can't be valid");
- else
- error ("Root element type '" + qName
- + "' was declared to be '" + rootName + "'");
- }
- } else {
- Recognizer state = (Recognizer) contentStack.peek ();
-
- if (state != null) {
- Recognizer newstate = state.acceptElement (qName);
-
- if (newstate == null)
- error ("Element type '" + qName
- + "' in element '" + state.type.name
- + "' violates content model " + state.type.model
- );
- if (newstate != state) {
- contentStack.pop ();
- contentStack.push (newstate);
- }
- }
- }
-
- //
- // Then check that this element was declared, and push the
- // object used to validate its content model onto our stack.
- //
- // This is where the recognizer gets created, if needed; if
- // it's a "children" (elements) content model, an NDFA is
- // created. (One recognizer is used per content type, no
- // matter how complex that recognizer is.)
- //
- ElementInfo info;
-
- info = (ElementInfo) elements.get (qName);
- if (info == null || info.model == null) {
- // VC: Element Valid (base clause)
- error ("Element type '" + qName + "' was not declared");
- contentStack.push (null);
-
- // for less diagnostic noise, fake a declaration.
- elementDecl (qName, "ANY");
- } else
- contentStack.push (info.getRecognizer (this));
-
- //
- // Then check each attribute present
- //
- int len;
- String aname;
- AttributeInfo ainfo;
-
- if (atts != null)
- len = atts.getLength ();
- else
- len = 0;
-
- for (int i = 0; i < len; i++) {
- aname = atts.getQName (i);
-
- if (info == null
- || (ainfo = (AttributeInfo) info.attributes.get (aname))
- == null) {
- // VC: Attribute Value Type
- error ("Attribute '" + aname
- + "' was not declared for element type " + qName);
- continue;
- }
-
- String value = atts.getValue (i);
-
- // note that "==" for type names and "#FIXED" is correct
- // (and fast) since we've interned those literals.
-
- if ("#FIXED" == ainfo.mode) {
- String expanded = expandDefaultRefs (ainfo.value);
-
- // VC: Fixed Attribute Default
- if (!value.equals (expanded)) {
- error ("Attribute '" + aname
- + "' must match " + expanded
- );
- continue;
- }
- }
-
- if ("CDATA" == ainfo.type)
- continue;
-
- //
- // For all other attribute types, there are various
- // rules to follow.
- //
-
- if ("ID" == ainfo.type) {
- // VC: ID (must be a name)
- if (isName (value, "ID attribute", aname)) {
- if (Boolean.TRUE == ids.get (value))
- // VC: ID (appears once)
- error ("ID attribute " + aname
- + " uses an ID value '" + value
- + "' which was already declared.");
- else
- // any forward refs are no longer problems
- ids.put (value, Boolean.TRUE);
- }
- continue;
- }
-
- if ("IDREF" == ainfo.type) {
- // VC: IDREF (value must be a name)
- if (isName (value, "IDREF attribute", aname)) {
- // VC: IDREF (must match some ID attribute)
- if (ids.get (value) == null)
- // new -- assume it's a forward ref
- ids.put (value, Boolean.FALSE);
- }
- continue;
- }
-
- if ("IDREFS" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: IDREF (one or more values)
- error ("IDREFS attribute " + aname
- + " must have at least one ID ref");
- } else do {
- String id = tokens.nextToken ();
-
- // VC: IDREF (value must be a name)
- if (isName (id, "IDREFS attribute", aname)) {
- // VC: IDREF (must match some ID attribute)
- if (ids.get (id) == null)
- // new -- assume it's a forward ref
- ids.put (id, Boolean.FALSE);
- }
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- if ("NMTOKEN" == ainfo.type) {
- // VC: Name Token (is a name token)
- isNmtoken (value, "NMTOKEN attribute", aname);
- continue;
- }
-
- if ("NMTOKENS" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: Name Token (one or more values)
- error ("NMTOKENS attribute " + aname
- + " must have at least one name token");
- } else do {
- String token = tokens.nextToken ();
-
- // VC: Name Token (is a name token)
- isNmtoken (token, "NMTOKENS attribute", aname);
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- if ("ENTITY" == ainfo.type) {
- if (!unparsed.contains (value))
- // VC: Entity Name
- error ("Value of attribute '" + aname
- + "' refers to unparsed entity '" + value
- + "' which was not declared.");
- continue;
- }
-
- if ("ENTITIES" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: Entity Name (one or more values)
- error ("ENTITIES attribute " + aname
- + " must have at least one name token");
- } else do {
- String entity = tokens.nextToken ();
-
- if (!unparsed.contains (entity))
- // VC: Entity Name
- error ("Value of attribute '" + aname
- + "' refers to unparsed entity '" + entity
- + "' which was not declared.");
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- //
- // check for enumerations last; more expensive
- //
- if (ainfo.type.charAt (0) == '(' /*)*/
- || ainfo.type.startsWith ("NOTATION ")
- ) {
- // VC: Enumeration (value must be defined)
- checkEnumeration (value, ainfo.type, aname);
- continue;
- }
- }
-
- //
- // Last, check that all #REQUIRED attributes were provided
- //
- if (info != null) {
- Hashtable table = info.attributes;
-
- if (table.size () != 0) {
- Enumeration e = table.keys ();
-
- // XXX table.keys uses the heap, bleech -- slows things
-
- while (e.hasMoreElements ()) {
- aname = (String) e.nextElement ();
- ainfo = (AttributeInfo) table.get (aname);
-
- // "#REQUIRED" mode was interned in attributeDecl
- if ("#REQUIRED" == ainfo.mode
- && atts.getValue (aname) == null) {
- // VC: Required Attribute
- error ("Attribute '" + aname + "' must be specified "
- + "for element type " + qName);
- }
- }
- }
- }
- super.startElement (uri, localName, qName, atts);
- }
-
- /**
- * ContentHandler Reports a validity error if the element's content
- * model does not permit character data.
- * Passed to the next consumer.
- */
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- Recognizer state;
-
- if (contentStack.empty ())
- state = null;
- else
- state = (Recognizer) contentStack.peek ();
-
- // NOTE: if this ever supports with SAX parsers that don't
- // report ignorable whitespace as such (only XP?), this class
- // needs to morph it into ignorableWhitespace() as needed ...
-
- if (state != null && !state.acceptCharacters ())
- // VC: Element Valid (clauses three, four -- see recognizer)
- error ("Character content not allowed in element "
- + state.type.name);
-
- super.characters (ch, start, length);
- }
-
-
- /**
- * ContentHandler Reports a validity error if the element's content
- * model does not permit end-of-element yet, or a well formedness error
- * if there was no matching startElement call.
- * Passed to the next consumer.
- */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- try {
- Recognizer state = (Recognizer) contentStack.pop ();
-
- if (state != null && !state.completed ())
- // VC: Element valid (clauses two, three, four; see Recognizer)
- error ("Premature end for element '"
- + state.type.name
- + "', content model "
- + state.type.model);
-
- // could insist on match of start element, but that's
- // something the input stream must to guarantee.
-
- } catch (EmptyStackException e) {
- fatalError ("endElement without startElement: " + qName
- + ((uri == null)
- ? ""
- : ( " { '" + uri + "', " + localName + " }")));
- }
- super.endElement (uri, localName, qName);
- }
-
- /**
- * ContentHandler Checks whether all ID values that were
- * referenced have been declared, and releases all resources.
- * Passed to the next consumer.
- *
- * @see #setDocumentLocator
- */
- public void endDocument ()
- throws SAXException
- {
- for (Enumeration idNames = ids.keys ();
- idNames.hasMoreElements ();
- /* NOP */) {
- String id = (String) idNames.nextElement ();
-
- if (Boolean.FALSE == ids.get (id)) {
- // VC: IDREF (must match ID)
- error ("Undeclared ID value '" + id
- + "' was referred to by an IDREF/IDREFS attribute");
- }
- }
-
- resetState ();
- super.endDocument ();
- }
-
-
- /** Holds per-element declarations */
- static private final class ElementInfo
- {
- String name;
- String model;
-
- // key = attribute name; value = AttributeInfo
- Hashtable attributes = new Hashtable (11);
-
- ElementInfo (String n) { name = n; }
-
- private Recognizer recognizer;
-
- // for validating content models: one per type, shared,
- // and constructed only on demand ... so unused elements do
- // not need to consume resources.
- Recognizer getRecognizer (ValidationConsumer consumer)
- throws SAXException
- {
- if (recognizer == null) {
- if ("ANY".equals (model))
- recognizer = ANY;
- else if ("EMPTY".equals (model))
- recognizer = new EmptyRecognizer (this);
- else if ('#' == model.charAt (1))
- // n.b. this constructor does a validity check
- recognizer = new MixedRecognizer (this, consumer);
- else
- recognizer = new ChildrenRecognizer (this, consumer);
- }
- return recognizer;
- }
- }
-
- /** Holds per-attribute declarations */
- static private final class AttributeInfo
- {
- String type;
- String mode; // #REQUIRED, etc (or null)
- String value; // or null
- }
-
-
- //
- // Content model validation
- //
-
- // GCJ LOCAL: package private to work around gcj bug.
- static final Recognizer ANY = new Recognizer (null);
-
-
- // Base class defines the calls used to validate content,
- // and supports the "ANY" content model
- static private class Recognizer
- {
- final ElementInfo type;
-
- Recognizer (ElementInfo t) { type = t; }
-
- // return true iff character data is legal here
- boolean acceptCharacters ()
- throws SAXException
- // VC: Element Valid (third and fourth clauses)
- { return true; }
-
- // null return = failure
- // otherwise, next state (like an FSM)
- // prerequisite: tested that name was declared
- Recognizer acceptElement (String name)
- throws SAXException
- // VC: Element Valid (fourth clause)
- { return this; }
-
- // return true iff model is completed, can finish
- boolean completed ()
- throws SAXException
- // VC: Element Valid (fourth clause)
- { return true; }
-
- public String toString ()
- // n.b. "children" is the interesting case!
- { return (type == null) ? "ANY" : type.model; }
- }
-
- // "EMPTY" content model -- no characters or elements
- private static final class EmptyRecognizer extends Recognizer
- {
- public EmptyRecognizer (ElementInfo type)
- { super (type); }
-
- // VC: Element Valid (first clause)
- boolean acceptCharacters ()
- { return false; }
-
- // VC: Element Valid (first clause)
- Recognizer acceptElement (String name)
- { return null; }
- }
-
- // "Mixed" content model -- ANY, but restricts elements
- private static final class MixedRecognizer extends Recognizer
- {
- private String permitted [];
-
- // N.B. constructor tests for duplicated element names (VC)
- public MixedRecognizer (ElementInfo t, ValidationConsumer v)
- throws SAXException
- {
- super (t);
-
- // (#PCDATA...)* or (#PCDATA) ==> ... or empty
- // with the "..." being "|elname|..."
- StringTokenizer tokens = new StringTokenizer (
- t.model.substring (8, t.model.lastIndexOf (')')),
- "|");
- Vector vec = new Vector ();
-
- while (tokens.hasMoreTokens ()) {
- String token = tokens.nextToken ();
-
- if (vec.contains (token))
- v.error ("element " + token
- + " is repeated in mixed content model: "
- + t.model);
- else
- vec.addElement (token.intern ());
- }
- permitted = new String [vec.size ()];
- for (int i = 0; i < permitted.length; i++)
- permitted [i] = (String) vec.elementAt (i);
-
- // in one large machine-derived DTD sample, most of about
- // 250 mixed content models were empty, and 25 had ten or
- // more entries. 2 had over a hundred elements. Linear
- // search isn't obviously wrong.
- }
-
- // VC: Element Valid (third clause)
- Recognizer acceptElement (String name)
- {
- int length = permitted.length;
-
- // first pass -- optimistic w.r.t. event source interning
- // (and document validity)
- for (int i = 0; i < length; i++)
- if (permitted [i] == name)
- return this;
- // second pass -- pessimistic w.r.t. event source interning
- for (int i = 0; i < length; i++)
- if (permitted [i].equals (name))
- return this;
- return null;
- }
- }
-
-
- // recognizer loop flags, see later
- private static final int F_LOOPHEAD = 0x01;
- private static final int F_LOOPNEXT = 0x02;
-
- // for debugging -- used to label/count nodes in toString()
- private static int nodeCount;
-
- /**
- * "Children" content model -- these are nodes in NDFA state graphs.
- * They work in fixed space. Note that these graphs commonly have
- * cycles, handling features such as zero-or-more and one-or-more.
- *
- * It's readonly, so only one copy is ever needed. The content model
- * stack may have any number of pointers into each graph, when a model
- * happens to be needed more than once due to element nesting. Since
- * traversing the graph just moves to another node, and never changes
- * it, traversals never interfere with each other.
- *
- * There is an option to report non-deterministic models. These are
- * always XML errors, but ones which are not often reported despite the
- * fact that they can lead to different validating parsers giving
- * different results for the same input. (The XML spec doesn't require
- * them to be reported.)
- *
- * FIXME There's currently at least one known bug here, in that
- * it's not actually detecting the non-determinism it tries to detect.
- * (Of the "optional.xml" test, the once-or-twice-2* tests are all non-D;
- * maybe some others.) This may relate to the issue flagged below as
- * "should not" happen (but it was), which showed up when patching the
- * graph to have one exit node (or more EMPTY nodes).
- */
- private static final class ChildrenRecognizer extends Recognizer
- implements Cloneable
- {
- // for reporting non-deterministic content models
- // ... a waste of space if we're not reporting those!
- // ... along with the 'model' member (in base class)
- private ValidationConsumer consumer;
-
- // for CHOICE nodes -- each component is an arc that
- // accepts a different NAME (or is EMPTY indicating
- // NDFA termination).
- private Recognizer components [];
-
- // for NAME/SEQUENCE nodes -- accepts that NAME and
- // then goes to the next node (CHOICE, NAME, EMPTY).
- private String name;
- private Recognizer next;
-
- // loops always point back to a CHOICE node. we mark such choice
- // nodes (F_LOOPHEAD) for diagnostics and faster deep cloning.
- // We also mark nodes before back pointers (F_LOOPNEXT), to ensure
- // termination when we patch sequences and loops.
- private int flags;
-
-
- // prevent a needless indirection between 'this' and 'node'
- private void copyIn (ChildrenRecognizer node)
- {
- // model & consumer are already set
- components = node.components;
- name = node.name;
- next = node.next;
- flags = node.flags;
- }
-
- // used to construct top level "children" content models,
- public ChildrenRecognizer (ElementInfo type, ValidationConsumer vc)
- {
- this (vc, type);
- populate (type.model.toCharArray (), 0);
- patchNext (new EmptyRecognizer (type), null);
- }
-
- // used internally; populating is separate
- private ChildrenRecognizer (ValidationConsumer vc, ElementInfo type)
- {
- super (type);
- consumer = vc;
- }
-
-
- //
- // When rewriting some graph nodes we need deep clones in one case;
- // mostly shallow clones (what the JVM handles for us) are fine.
- //
- private ChildrenRecognizer shallowClone ()
- {
- try {
- return (ChildrenRecognizer) clone ();
- } catch (CloneNotSupportedException e) {
- throw new Error ("clone");
- }
- }
-
- private ChildrenRecognizer deepClone ()
- {
- return deepClone (new Hashtable (37));
- }
-
- private ChildrenRecognizer deepClone (Hashtable table)
- {
- ChildrenRecognizer retval;
-
- if ((flags & F_LOOPHEAD) != 0) {
- retval = (ChildrenRecognizer) table.get (this);
- if (retval != null)
- return this;
-
- retval = shallowClone ();
- table.put (this, retval);
- } else
- retval = shallowClone ();
-
- if (next != null) {
- if (next instanceof ChildrenRecognizer)
- retval.next = ((ChildrenRecognizer)next)
- .deepClone (table);
- else if (!(next instanceof EmptyRecognizer))
- throw new RuntimeException ("deepClone");
- }
-
- if (components != null) {
- retval.components = new Recognizer [components.length];
- for (int i = 0; i < components.length; i++) {
- Recognizer temp = components [i];
-
- if (temp == null)
- retval.components [i] = null;
- else if (temp instanceof ChildrenRecognizer)
- retval.components [i] = ((ChildrenRecognizer)temp)
- .deepClone (table);
- else if (!(temp instanceof EmptyRecognizer))
- throw new RuntimeException ("deepClone");
- }
- }
-
- return retval;
- }
-
- // connect subgraphs, first to next (sequencing)
- private void patchNext (Recognizer theNext, Hashtable table)
- {
- // backpointers must not be repatched or followed
- if ((flags & F_LOOPNEXT) != 0)
- return;
-
- // XXX this table "shouldn't" be needed, right?
- // but some choice nodes looped if it isn't there.
- if (table != null && table.get (this) != null)
- return;
- if (table == null)
- table = new Hashtable ();
-
- // NAME/SEQUENCE
- if (name != null) {
- if (next == null)
- next = theNext;
- else if (next instanceof ChildrenRecognizer) {
- ((ChildrenRecognizer)next).patchNext (theNext, table);
- } else if (!(next instanceof EmptyRecognizer))
- throw new RuntimeException ("patchNext");
- return;
- }
-
- // CHOICE
- for (int i = 0; i < components.length; i++) {
- if (components [i] == null)
- components [i] = theNext;
- else if (components [i] instanceof ChildrenRecognizer) {
- ((ChildrenRecognizer)components [i])
- .patchNext (theNext, table);
- } else if (!(components [i] instanceof EmptyRecognizer))
- throw new RuntimeException ("patchNext");
- }
-
- if (table != null && (flags | F_LOOPHEAD) != 0)
- table.put (this, this);
- }
-
- /**
- * Parses a 'children' spec (or recursively 'cp') and makes this
- * become a regular graph node.
- *
- * @return index after this particle
- */
- private int populate (char parseBuf [], int startPos)
- {
- int nextPos = startPos + 1;
- char c;
-
- if (nextPos < 0 || nextPos >= parseBuf.length)
- throw new IndexOutOfBoundsException ();
-
- // Grammar of the string is from the XML spec, but
- // with whitespace removed by the SAX parser.
-
- // children ::= (choice | seq) ('?' | '*' | '+')?
- // cp ::= (Name | choice | seq) ('?' | '*' | '+')?
- // choice ::= '(' cp ('|' choice)* ')'
- // seq ::= '(' cp (',' choice)* ')'
-
- // interior nodes only
- // cp ::= name ...
- if (parseBuf [startPos] != '('/*)*/) {
- boolean done = false;
- do {
- switch (c = parseBuf [nextPos]) {
- case '?': case '*': case '+':
- case '|': case ',':
- case /*(*/ ')':
- done = true;
- continue;
- default:
- nextPos++;
- continue;
- }
- } while (!done);
- name = new String (parseBuf, startPos, nextPos - startPos);
-
- // interior OR toplevel nodes
- // cp ::= choice ..
- // cp ::= seq ..
- } else {
- // collect everything as a separate list, and merge it
- // into "this" later if we can (SEQUENCE or singleton)
- ChildrenRecognizer first;
-
- first = new ChildrenRecognizer (consumer, type);
- nextPos = first.populate (parseBuf, nextPos);
- c = parseBuf [nextPos++];
-
- if (c == ',' || c == '|') {
- ChildrenRecognizer current = first;
- char separator = c;
- Vector v = null;
-
- if (separator == '|') {
- v = new Vector ();
- v.addElement (first);
- }
-
- do {
- ChildrenRecognizer link;
-
- link = new ChildrenRecognizer (consumer, type);
- nextPos = link.populate (parseBuf, nextPos);
-
- if (separator == ',') {
- current.patchNext (link, null);
- current = link;
- } else
- v.addElement (link);
-
- c = parseBuf [nextPos++];
- } while (c == separator);
-
- // choice ... collect everything into one array.
- if (separator == '|') {
- // assert v.size() > 1
- components = new Recognizer [v.size ()];
- for (int i = 0; i < components.length; i++) {
- components [i] = (Recognizer)
- v.elementAt (i);
- }
- // assert flags == 0
-
- // sequence ... merge into "this" to be smaller.
- } else
- copyIn (first);
-
- // treat singletons like one-node sequences.
- } else
- copyIn (first);
-
- if (c != /*(*/ ')')
- throw new RuntimeException ("corrupt content model");
- }
-
- //
- // Arity is optional, and the root of all fun. We keep the
- // FSM state graph simple by only having NAME/SEQUENCE and
- // CHOICE nodes (or EMPTY to terminate a model), easily
- // evaluated. So we rewrite each node that has arity, using
- // those primitives. We create loops here, if needed.
- //
- if (nextPos < parseBuf.length) {
- c = parseBuf [nextPos];
- if (c == '?' || c == '*' || c == '+') {
- nextPos++;
-
- // Rewrite 'zero-or-one' "?" arity to a CHOICE:
- // - SEQUENCE (clone, what's next)
- // - or, what's next
- // Size cost: N --> N + 1
- if (c == '?') {
- Recognizer once = shallowClone ();
-
- components = new Recognizer [2];
- components [0] = once;
- // components [1] initted to null
- name = null;
- next = null;
- flags = 0;
-
-
- // Rewrite 'zero-or-more' "*" arity to a CHOICE.
- // - LOOP (clone, back to this CHOICE)
- // - or, what's next
- // Size cost: N --> N + 1
- } else if (c == '*') {
- ChildrenRecognizer loop = shallowClone ();
-
- loop.patchNext (this, null);
- loop.flags |= F_LOOPNEXT;
- flags = F_LOOPHEAD;
-
- components = new Recognizer [2];
- components [0] = loop;
- // components [1] initted to null
- name = null;
- next = null;
-
-
- // Rewrite 'one-or-more' "+" arity to a SEQUENCE.
- // Basically (a)+ --> ((a),(a)*).
- // - this
- // - CHOICE
- // * LOOP (clone, back to the CHOICE)
- // * or, whatever's next
- // Size cost: N --> 2N + 1
- } else if (c == '+') {
- ChildrenRecognizer loop = deepClone ();
- ChildrenRecognizer choice;
-
- choice = new ChildrenRecognizer (consumer, type);
- loop.patchNext (choice, null);
- loop.flags |= F_LOOPNEXT;
- choice.flags = F_LOOPHEAD;
-
- choice.components = new Recognizer [2];
- choice.components [0] = loop;
- // choice.components [1] initted to null
- // choice.name, choice.next initted to null
-
- patchNext (choice, null);
- }
- }
- }
-
- return nextPos;
- }
-
- // VC: Element Valid (second clause)
- boolean acceptCharacters ()
- { return false; }
-
- // VC: Element Valid (second clause)
- Recognizer acceptElement (String type)
- throws SAXException
- {
- // NAME/SEQUENCE
- if (name != null) {
- if (name.equals (type))
- return next;
- return null;
- }
-
- // CHOICE ... optionally reporting nondeterminism we
- // run across. we won't check out every transition
- // for nondeterminism; only the ones we follow.
- Recognizer retval = null;
-
- for (int i = 0; i < components.length; i++) {
- Recognizer temp = components [i].acceptElement (type);
-
- if (temp == null)
- continue;
- else if (!warnNonDeterministic)
- return temp;
- else if (retval == null)
- retval = temp;
- else if (retval != temp)
- consumer.error ("Content model " + this.type.model
- + " is non-deterministic for " + type);
- }
- return retval;
- }
-
- // VC: Element Valid (second clause)
- boolean completed ()
- throws SAXException
- {
- // expecting a specific element
- if (name != null)
- return false;
-
- // choice, some sequences
- for (int i = 0; i < components.length; i++) {
- if (components [i].completed ())
- return true;
- }
-
- return false;
- }
-
-/** /
- // FOR DEBUGGING ... flattens the graph for printing.
-
- public String toString ()
- {
- StringBuffer buf = new StringBuffer ();
-
- // only one set of loop labels can be generated
- // at a time...
- synchronized (ANY) {
- nodeCount = 0;
-
- toString (buf, new Hashtable ());
- return buf.toString ();
- }
- }
-
- private void toString (StringBuffer buf, Hashtable table)
- {
- // When we visit a node, label and count it.
- // Nodes are never visited/counted more than once.
- // For small models labels waste space, but if arity
- // mappings were used the savings are substantial.
- // (Plus, the output can be more readily understood.)
- String temp = (String) table.get (this);
-
- if (temp != null) {
- buf.append ('{');
- buf.append (temp);
- buf.append ('}');
- return;
- } else {
- StringBuffer scratch = new StringBuffer (15);
-
- if ((flags & F_LOOPHEAD) != 0)
- scratch.append ("loop");
- else
- scratch.append ("node");
- scratch.append ('-');
- scratch.append (++nodeCount);
- temp = scratch.toString ();
-
- table.put (this, temp);
- buf.append ('[');
- buf.append (temp);
- buf.append (']');
- buf.append (':');
- }
-
- // NAME/SEQUENCE
- if (name != null) {
- // n.b. some output encodings turn some name chars into '?'
- // e.g. with Japanese names and ASCII output
- buf.append (name);
- if (components != null) // bug!
- buf.append ('$');
- if (next == null)
- buf.append (",*");
- else if (next instanceof EmptyRecognizer) // patch-to-next
- buf.append (",{}");
- else if (next instanceof ChildrenRecognizer) {
- buf.append (',');
- ((ChildrenRecognizer)next).toString (buf, table);
- } else // bug!
- buf.append (",+");
- return;
- }
-
- // CHOICE
- buf.append ("<");
- for (int i = 0; i < components.length; i++) {
- if (i != 0)
- buf.append ("|");
- if (components [i] instanceof EmptyRecognizer) {
- buf.append ("{}");
- } else if (components [i] == null) { // patch-to-next
- buf.append ('*');
- } else {
- ChildrenRecognizer r;
-
- r = (ChildrenRecognizer) components [i];
- r.toString (buf, table);
- }
- }
- buf.append (">");
- }
-/**/
- }
-}
diff --git a/libjava/gnu/xml/pipeline/WellFormednessFilter.java b/libjava/gnu/xml/pipeline/WellFormednessFilter.java
deleted file mode 100644
index ef430165203..00000000000
--- a/libjava/gnu/xml/pipeline/WellFormednessFilter.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/* WellFormednessFilter.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.util.EmptyStackException;
-import java.util.Stack;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-/**
- * This filter reports fatal exceptions in the case of event streams that
- * are not well formed. The rules currently tested include: Other checks for event stream correctness may be provided in
- * the future. For example, insisting that
- * entity boundaries nest correctly,
- * namespace scopes nest correctly,
- * namespace values never contain relative URIs,
- * attributes don't have "<" characters;
- * and more.
- *
- * @author David Brownell
- */
-public final class WellFormednessFilter extends EventFilter
-{
- private boolean startedDoc;
- private Stack elementStack = new Stack ();
- private boolean startedCDATA;
- private String dtdState = "before";
-
-
- /**
- * Swallows all events after performing well formedness checks.
- */
- // constructor used by PipelineFactory
- public WellFormednessFilter ()
- { this (null); }
-
-
- /**
- * Passes events through to the specified consumer, after first
- * processing them.
- */
- // constructor used by PipelineFactory
- public WellFormednessFilter (EventConsumer consumer)
- {
- super (consumer);
-
- setContentHandler (this);
- setDTDHandler (this);
-
- try {
- setProperty (LEXICAL_HANDLER, this);
- } catch (SAXException e) { /* can't happen */ }
- }
-
- /**
- * Resets state as if any preceding event stream was well formed.
- * Particularly useful if it ended through some sort of error,
- * and the endDocument call wasn't made.
- */
- public void reset ()
- {
- startedDoc = false;
- startedCDATA = false;
- elementStack.removeAllElements ();
- }
-
-
- private SAXParseException getException (String message)
- {
- SAXParseException e;
- Locator locator = getDocumentLocator ();
-
- if (locator == null)
- return new SAXParseException (message, null, null, -1, -1);
- else
- return new SAXParseException (message, locator);
- }
-
- private void fatalError (String message)
- throws SAXException
- {
- SAXParseException e = getException (message);
- ErrorHandler handler = getErrorHandler ();
-
- if (handler != null)
- handler.fatalError (e);
- throw e;
- }
-
- /**
- * Throws an exception when called after startDocument.
- *
- * @param locator the locator, to be used in error reporting or relative
- * URI resolution.
- *
- * @exception IllegalStateException when called after the document
- * has already been started
- */
- public void setDocumentLocator (Locator locator)
- {
- if (startedDoc)
- throw new IllegalStateException (
- "setDocumentLocator called after startDocument");
- super.setDocumentLocator (locator);
- }
-
- public void startDocument () throws SAXException
- {
- if (startedDoc)
- fatalError ("startDocument called more than once");
- startedDoc = true;
- startedCDATA = false;
- elementStack.removeAllElements ();
- super.startDocument ();
- }
-
- public void startElement (
- String uri, String localName,
- String qName, Attributes atts
- ) throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("inside".equals (dtdState))
- fatalError ("element inside DTD?");
- else
- dtdState = "after";
- if (startedCDATA)
- fatalError ("element inside CDATA section");
- if (qName == null || "".equals (qName))
- fatalError ("startElement name missing");
- elementStack.push (qName);
- super.startElement (uri, localName, qName, atts);
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("element inside CDATA section");
- if (qName == null || "".equals (qName))
- fatalError ("endElement name missing");
-
- try {
- String top = (String) elementStack.pop ();
-
- if (!qName.equals (top))
- fatalError ("<" + top + " ...>..." + qName + ">");
- // XXX could record/test namespace info
- } catch (EmptyStackException e) {
- fatalError ("endElement without startElement: " + qName + ">");
- }
- super.endElement (uri, localName, qName);
- }
-
- public void endDocument () throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- dtdState = "before";
- startedDoc = false;
- super.endDocument ();
- }
-
-
- public void startDTD (String root, String publicId, String systemId)
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("before" != dtdState)
- fatalError ("two DTDs?");
- if (!elementStack.empty ())
- fatalError ("DTD must precede root element");
- dtdState = "inside";
- super.startDTD (root, publicId, systemId);
- }
-
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
-// FIXME: not all parsers will report startDTD() ...
-// we'd rather insist we're "inside".
- if ("after" == dtdState)
- fatalError ("not inside DTD");
- super.notationDecl (name, publicId, systemId);
- }
-
- public void unparsedEntityDecl (String name,
- String publicId, String systemId, String notationName)
- throws SAXException
- {
-// FIXME: not all parsers will report startDTD() ...
-// we'd rather insist we're "inside".
- if ("after" == dtdState)
- fatalError ("not inside DTD");
- super.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
- // FIXME: add the four DeclHandler calls too
-
- public void endDTD ()
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("inside" != dtdState)
- fatalError ("DTD ends without start?");
- dtdState = "after";
- super.endDTD ();
- }
-
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- int here = start, end = start + length;
- if (elementStack.empty ())
- fatalError ("characters must be in an element");
- while (here < end) {
- if (ch [here++] != ']')
- continue;
- if (here == end) // potential problem ...
- continue;
- if (ch [here++] != ']')
- continue;
- if (here == end) // potential problem ...
- continue;
- if (ch [here++] == '>')
- fatalError ("character data can't contain \"]]>\"");
- }
- super.characters (ch, start, length);
- }
-
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- int here = start, end = start + length;
- if (elementStack.empty ())
- fatalError ("characters must be in an element");
- while (here < end) {
- if (ch [here++] == '\r')
- fatalError ("whitespace can't contain CR");
- }
- super.ignorableWhitespace (ch, start, length);
- }
-
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (data.indexOf ('\r') > 0)
- fatalError ("PIs can't contain CR");
- if (data.indexOf ("?>") > 0)
- fatalError ("PIs can't contain \"?>\"");
- }
-
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("comments can't nest in CDATA");
- int here = start, end = start + length;
- while (here < end) {
- if (ch [here] == '\r')
- fatalError ("comments can't contain CR");
- if (ch [here++] != '-')
- continue;
- if (here == end)
- fatalError ("comments can't end with \"--->\"");
- if (ch [here++] == '-')
- fatalError ("comments can't contain \"--\"");
- }
- super.comment (ch, start, length);
- }
-
- public void startCDATA ()
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("CDATA starts can't nest");
- startedCDATA = true;
- super.startCDATA ();
- }
-
- public void endCDATA ()
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (!startedCDATA)
- fatalError ("CDATA end without start?");
- startedCDATA = false;
- super.endCDATA ();
- }
-}
diff --git a/libjava/gnu/xml/pipeline/XIncludeFilter.java b/libjava/gnu/xml/pipeline/XIncludeFilter.java
deleted file mode 100644
index 02607a4e06d..00000000000
--- a/libjava/gnu/xml/pipeline/XIncludeFilter.java
+++ /dev/null
@@ -1,579 +0,0 @@
-/* XIncludeFilter.java --
- Copyright (C) 2001,2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Hashtable;
-import java.util.Stack;
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import gnu.xml.util.Resolver;
-
-
-
-/**
- * Filter to process an XPointer-free subset of
- * XInclude, supporting its
- * use as a kind of replacement for parsed general entities.
- * XInclude works much like the XML documents that are included will normally be processed using
- * the default SAX namespace rules, meaning that prefix information may
- * be discarded. This may be changed with {@link #setSavingPrefixes
- * setSavingPrefixes()}. You are strongly advised to do this.
- *
- * Note that XInclude allows highly incompatible implementations, which
- * are specialized to handle application-specific infoset extensions. Some
- * such implementations can be implemented by subclassing this one, but
- * they may only be substituted in applications at "user option".
- *
- * TBD: "IURI" handling.
- *
- * @author David Brownell
- */
-public class XIncludeFilter extends EventFilter implements Locator
-{
- private Hashtable extEntities = new Hashtable (5, 5);
- private int ignoreCount;
- private Stack uris = new Stack ();
- private Locator locator;
- private Vector inclusions = new Vector (5, 5);
- private boolean savingPrefixes;
-
- /**
- */
- public XIncludeFilter (EventConsumer next)
- throws SAXException
- {
- super (next);
- setContentHandler (this);
- // DTDHandler callbacks pass straight through
- setProperty (DECL_HANDLER, this);
- setProperty (LEXICAL_HANDLER, this);
- }
-
- private void fatal (SAXParseException e) throws SAXException
- {
- ErrorHandler eh;
-
- eh = getErrorHandler ();
- if (eh != null)
- eh.fatalError (e);
- throw e;
- }
-
- /**
- * Passes "this" down the filter chain as a proxy locator.
- */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- super.setDocumentLocator (this);
- }
-
- /** Used for proxy locator; do not call directly. */
- public String getSystemId ()
- { return (locator == null) ? null : locator.getSystemId (); }
- /** Used for proxy locator; do not call directly. */
- public String getPublicId ()
- { return (locator == null) ? null : locator.getPublicId (); }
- /** Used for proxy locator; do not call directly. */
- public int getLineNumber ()
- { return (locator == null) ? -1 : locator.getLineNumber (); }
- /** Used for proxy locator; do not call directly. */
- public int getColumnNumber ()
- { return (locator == null) ? -1 : locator.getColumnNumber (); }
-
- /**
- * Assigns the flag controlling the setting of the SAX2
- * namespace-prefixes flag.
- */
- public void setSavingPrefixes (boolean flag)
- { savingPrefixes = flag; }
-
- /**
- * Returns the flag controlling the setting of the SAX2
- * namespace-prefixes flag when parsing included documents.
- * The default value is the SAX2 default (false), which discards
- * information that can be useful.
- */
- public boolean isSavingPrefixes ()
- { return savingPrefixes; }
-
- //
- // Two mechanisms are interacting here.
- //
- // - XML Base implies a stack of base URIs, updated both by
- // "real entity" boundaries and element boundaries.
- //
- // - Active "Real Entities" (for document and general entities,
- // and by xincluded files) are tracked to prevent circular
- // inclusions.
- //
- private String addMarker (String uri)
- throws SAXException
- {
- if (locator != null && locator.getSystemId () != null)
- uri = locator.getSystemId ();
-
- // guard against InputSource objects without system IDs
- if (uri == null)
- fatal (new SAXParseException ("Entity URI is unknown", locator));
-
- try {
- URL url = new URL (uri);
-
- uri = url.toString ();
- if (inclusions.contains (uri))
- fatal (new SAXParseException (
- "XInclude, circular inclusion", locator));
- inclusions.addElement (uri);
- uris.push (url);
- } catch (IOException e) {
- // guard against illegal relative URIs (Xerces)
- fatal (new SAXParseException ("parser bug: relative URI",
- locator, e));
- }
- return uri;
- }
-
- private void pop (String uri)
- {
- inclusions.removeElement (uri);
- uris.pop ();
- }
-
- //
- // Document entity boundaries get both treatments.
- //
- public void startDocument () throws SAXException
- {
- ignoreCount = 0;
- addMarker (null);
- super.startDocument ();
- }
-
- public void endDocument () throws SAXException
- {
- inclusions.setSize (0);
- extEntities.clear ();
- uris.setSize (0);
- super.endDocument ();
- }
-
- //
- // External general entity boundaries get both treatments.
- //
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (name.charAt (0) == '%')
- return;
- try {
- URL url = new URL (locator.getSystemId ());
- systemId = new URL (url, systemId).toString ();
- } catch (IOException e) {
- // what could we do?
- }
- extEntities.put (name, systemId);
- }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (ignoreCount != 0) {
- ignoreCount++;
- return;
- }
-
- String uri = (String) extEntities.get (name);
- if (uri != null)
- addMarker (uri);
- super.startEntity (name);
- }
-
- public void endEntity (String name)
- throws SAXException
- {
- if (ignoreCount != 0) {
- if (--ignoreCount != 0)
- return;
- }
-
- String uri = (String) extEntities.get (name);
-
- if (uri != null)
- pop (uri);
- super.endEntity (name);
- }
-
- //
- // element boundaries only affect the base URI stack,
- // unless they're XInclude elements.
- //
- public void
- startElement (String uri, String localName, String qName, Attributes atts)
- throws SAXException
- {
- if (ignoreCount != 0) {
- ignoreCount++;
- return;
- }
-
- URL baseURI = (URL) uris.peek ();
- String base;
-
- base = atts.getValue ("http://www.w3.org/XML/1998/namespace", "base");
- if (base == null)
- uris.push (baseURI);
- else {
- URL url;
-
- if (base.indexOf ('#') != -1)
- fatal (new SAXParseException (
- "xml:base with fragment: " + base,
- locator));
-
- try {
- baseURI = new URL (baseURI, base);
- uris.push (baseURI);
- } catch (Exception e) {
- fatal (new SAXParseException (
- "xml:base with illegal uri: " + base,
- locator, e));
- }
- }
-
- if (!"http://www.w3.org/2001/XInclude".equals (uri)) {
- super.startElement (uri, localName, qName, atts);
- return;
- }
-
- if ("include".equals (localName)) {
- String href = atts.getValue ("href");
- String parse = atts.getValue ("parse");
- String encoding = atts.getValue ("encoding");
- URL url = (URL) uris.peek ();
- SAXParseException x = null;
-
- if (href == null)
- fatal (new SAXParseException (
- "XInclude missing href",
- locator));
- if (href.indexOf ('#') != -1)
- fatal (new SAXParseException (
- "XInclude with fragment: " + href,
- locator));
-
- if (parse == null || "xml".equals (parse))
- x = xinclude (url, href);
- else if ("text".equals (parse))
- x = readText (url, href, encoding);
- else
- fatal (new SAXParseException (
- "unknown XInclude parsing mode: " + parse,
- locator));
- if (x == null) {
- // strip out all child content
- ignoreCount++;
- return;
- }
-
- // FIXME the 17-Sept-2002 CR of XInclude says we "must"
- // use xi:fallback elements to handle resource errors,
- // if they exist.
- fatal (x);
-
- } else if ("fallback".equals (localName)) {
- fatal (new SAXParseException (
- "illegal top level XInclude 'fallback' element",
- locator));
- } else {
- ErrorHandler eh = getErrorHandler ();
-
- // CR doesn't say this is an error
- if (eh != null)
- eh.warning (new SAXParseException (
- "unrecognized toplevel XInclude element: " + localName,
- locator));
- super.startElement (uri, localName, qName, atts);
- }
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (ignoreCount != 0) {
- if (--ignoreCount != 0)
- return;
- }
-
- uris.pop ();
- if (!("http://www.w3.org/2001/XInclude".equals (uri)
- && "include".equals (localName)))
- super.endElement (uri, localName, qName);
- }
-
- //
- // ignore all content within non-empty xi:include elements
- //
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.characters (ch, start, length);
- }
-
- public void processingInstruction (String target, String value)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.processingInstruction (target, value);
- }
-
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.ignorableWhitespace (ch, start, length);
- }
-
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.comment (ch, start, length);
- }
-
- public void startCDATA () throws SAXException
- {
- if (ignoreCount == 0)
- super.startCDATA ();
- }
-
- public void endCDATA () throws SAXException
- {
- if (ignoreCount == 0)
- super.endCDATA ();
- }
-
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.startPrefixMapping (prefix, uri);
- }
-
- public void endPrefixMapping (String prefix) throws SAXException
- {
- if (ignoreCount == 0)
- super.endPrefixMapping (prefix);
- }
-
- public void skippedEntity (String name) throws SAXException
- {
- if (ignoreCount == 0)
- super.skippedEntity (name);
- }
-
- // JDK 1.1 seems to need it to be done this way, sigh
- void setLocator (Locator l) { locator = l; }
- Locator getLocator () { return locator; }
-
-
- //
- // for XIncluded entities, manage the current locator and
- // filter out events that would be incorrect to report
- //
- private class Scrubber extends EventFilter
- {
- Scrubber (EventFilter f)
- throws SAXException
- {
- // delegation passes to next in chain
- super (f);
-
- // process all content events
- super.setContentHandler (this);
- super.setProperty (LEXICAL_HANDLER, this);
-
- // drop all DTD events
- super.setDTDHandler (null);
- super.setProperty (DECL_HANDLER, null);
- }
-
- // maintain proxy locator
- // only one startDocument()/endDocument() pair per event stream
- public void setDocumentLocator (Locator l)
- { setLocator (l); }
- public void startDocument ()
- { }
- public void endDocument ()
- { }
-
- private void reject (String message) throws SAXException
- { fatal (new SAXParseException (message, getLocator ())); }
-
- // only the DTD from the "base document" gets reported
- public void startDTD (String root, String publicId, String systemId)
- throws SAXException
- { reject ("XIncluded DTD: " + systemId); }
- public void endDTD ()
- throws SAXException
- { reject ("XIncluded DTD"); }
- // ... so this should never happen
- public void skippedEntity (String name) throws SAXException
- { reject ("XInclude skipped entity: " + name); }
-
- // since we rejected DTDs, only builtin entities can be reported
- }
-
- // The SAX2 XMLReaderFactory should return a SAX2 XML parser which
- * supports both of the standardized extension handlers (for declaration
- * and lexical events). That parser will be used to produce events.
- *
- * The first parameter to the command gives the name of the document that
- * will be given to that processor. If it is a file name, it is converted
- * to a URL first.
- *
- * The second parameter describes a simple processing pipeline, and will
- * be used as input to {@link gnu.xml.pipeline.PipelineFactory}
- * methods which identify the processing to be done. Examples of such a
- * pipeline include Relatively complex pipelines can be described on the command line, but
- * not all interesting ones will require as little configuration as can be done
- * in that way. Put filters like "nsfix", perhaps followed by "validate",
- * at the front of the pipeline so they can be optimized out if a parser
- * supports those modes natively.
- *
- * If the parsing is aborted for any reason, the JVM will exit with a
- * failure code. If a validating parse was done then both validation and
- * well formedness errors will cause a failure. A non-validating parse
- * will report failure on well formedness errors.
- *
- * @see gnu.xml.pipeline.PipelineFactory
- *
- * @author David Brownell
- */
-final public class DoParse
-{
- private DoParse () { /* no instances allowed */ }
-
- // first reported nonrecoverable error
- private static SAXParseException fatal;
-
- // error categories
- private static int errorCount;
- private static int fatalCount;
-
- /**
- * Command line invoker for this class; pass a filename or URL
- * as the first argument, and a pipeline description as the second.
- * Make sure to use filters to condition the input to stages that
- * require it; an nsfix filter will be a common requirement,
- * to restore syntax that SAX2 parsers delete by default. Some
- * conditioning filters may be eliminated by setting parser options.
- * (For example, "nsfix" can set the "namespace-prefixes" feature to
- * a non-default value of "true". In the same way, "validate" can set
- * the "validation" feature to "true".)
- */
- public static void main (String argv [])
- throws IOException
- {
- int exitStatus = 1;
-
- if (argv.length != 2) {
- System.err.println ("Usage: DoParse [filename|URL] pipeline-spec");
- System.err.println ("Example pipeline specs:");
- System.err.println (" 'nsfix | validate'");
- System.err.println (
- " ... restore namespace syntax, validate");
- System.err.println (" 'nsfix | write ( stdout )'");
- System.err.println (
- " ... restore namespace syntax, write to stdout as XML"
- );
- System.exit (1);
- }
-
- try {
- //
- // Get input source for specified document (or try ;-)
- //
- argv [0] = Resolver.getURL (argv [0]);
- InputSource input = new InputSource (argv [0]);
-
- //
- // Get the producer, using the system default parser (which
- // can be overridden for this particular invocation).
- //
- // And the pipeline, using commandline options.
- //
- XMLReader producer;
- EventConsumer consumer;
-
- producer = XMLReaderFactory.createXMLReader ();
-
- //
- // XXX pipeline factory now has a pre-tokenized input
- // method, use it ... that way at least some params
- // can be written using quotes (have spaces, ...)
- //
- consumer = PipelineFactory.createPipeline (argv [1]);
-
- //
- // XXX want commandline option for tweaking error handler.
- // Want to be able to present warnings.
- //
- producer.setErrorHandler (new MyErrorHandler ());
-
- // XXX need facility enabling resolving to local DTDs
-
- //
- // Parse. The pipeline may get optimized a bit, so we
- // can't always fail cleanly for validation without taking
- // a look at the filter stages.
- //
- EventFilter.bind (producer, consumer);
- producer.parse (input);
-
- try {
- if (producer.getFeature (
- "http://org.xml/sax/features/validation"))
- exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
- else if (fatalCount == 0)
- exitStatus = 0;
- } catch (SAXException e) {
- if (hasValidator (consumer))
- exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
- else if (fatalCount == 0)
- exitStatus = 0;
- }
-
- } catch (java.net.MalformedURLException e) {
- System.err.println ("** Malformed URL: " + e.getMessage ());
- System.err.println ("Is '" + argv [0] + "' a non-existent file?");
- e.printStackTrace ();
- // e.g. FNF
-
- } catch (SAXParseException e) {
- if (e != fatal) {
- System.err.print (printParseException ("Parsing Aborted", e));
- e.printStackTrace ();
- if (e.getException () != null) {
- System.err.println ("++ Wrapped exception:");
- e.getException ().printStackTrace ();
- }
- }
-
- } catch (SAXException e) {
- Exception x = e;
- if (e.getException () != null)
- x = e.getException ();
- x.printStackTrace ();
-
- } catch (Throwable t) {
- t.printStackTrace ();
- }
-
- System.exit (exitStatus);
- }
-
- // returns true if saw a validator (before end or unrecognized node)
- // false otherwise
- private static boolean hasValidator (EventConsumer e)
- {
- if (e == null)
- return false;
- if (e instanceof ValidationConsumer)
- return true;
- if (e instanceof TeeConsumer) {
- TeeConsumer t = (TeeConsumer) e;
- return hasValidator (t.getFirst ())
- || hasValidator (t.getRest ());
- }
- if (e instanceof WellFormednessFilter
- || e instanceof NSFilter
- )
- return hasValidator (((EventFilter)e).getNext ());
-
- // else ... gee, we can't know. Assume not.
-
- return false;
- }
-
- static class MyErrorHandler implements ErrorHandler
- {
- // dump validation errors, but continue
- public void error (SAXParseException e)
- throws SAXParseException
- {
- errorCount++;
- System.err.print (printParseException ("Error", e));
- }
-
- public void warning (SAXParseException e)
- throws SAXParseException
- {
- // System.err.print (printParseException ("Warning", e));
- }
-
- // try to continue fatal errors, in case a parser reports more
- public void fatalError (SAXParseException e)
- throws SAXParseException
- {
- fatalCount++;
- if (fatal == null)
- fatal = e;
- System.err.print (printParseException ("Nonrecoverable Error", e));
- }
- }
-
- static private String printParseException (
- String label,
- SAXParseException e
- ) {
- StringBuffer buf = new StringBuffer ();
- int temp;
-
- buf.append ("** ");
- buf.append (label);
- buf.append (": ");
- buf.append (e.getMessage ());
- buf.append ('\n');
- if (e.getSystemId () != null) {
- buf.append (" URI: ");
- buf.append (e.getSystemId ());
- buf.append ('\n');
- }
- if ((temp = e.getLineNumber ()) != -1) {
- buf.append (" line: ");
- buf.append (temp);
- buf.append ('\n');
- }
- if ((temp = e.getColumnNumber ()) != -1) {
- buf.append (" char: ");
- buf.append (temp);
- buf.append ('\n');
- }
-
- return buf.toString ();
- }
-}
diff --git a/libjava/gnu/xml/util/DomParser.java b/libjava/gnu/xml/util/DomParser.java
deleted file mode 100644
index b28b6103b70..00000000000
--- a/libjava/gnu/xml/util/DomParser.java
+++ /dev/null
@@ -1,804 +0,0 @@
-/* DomParser.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.util;
-
-import java.util.Enumeration;
-import java.util.Locale;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.NamespaceSupport;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.DefaultHandler2;
-import org.xml.sax.ext.LexicalHandler;
-
-import org.w3c.dom.*;
-
-
-/**
- * This parser emits SAX2 parsing events as it traverses a DOM tree, using
- * any conformant implementation of DOM. It exposes all SAX1 features,
- * and the following SAX2 features and properties (as
- * identified by standard URIs which are not fully provided here). Note
- * that if a Level 1 DOM implementation is given, then this behaves as if
- * namespaces were disabled, and namespace prefixes were enabled. The consequences of modifying a DOM document tree as it is being walked
- * by this "parser" are unspecified; don't do it! This implementation is preliminary.
- *
- * @see gnu.xml.pipeline.XsltFilter
- *
- * @author David Brownell
- */
-public class SAXNullTransformerFactory extends SAXTransformerFactory
-{
-
- private ErrorListener errListener;
- private URIResolver uriResolver;
-
- /** Default constructor */
- public SAXNullTransformerFactory () { }
-
- //
- // only has stuff that makes sense with null transforms
- //
-
- /**
- * Returns true if the requested feature is supported.
- * All three kinds of input and output are accepted:
- * XML text, SAX events, and DOM nodes.
- */
- public boolean getFeature (String feature)
- {
- return SAXTransformerFactory.FEATURE.equals (feature)
- || SAXResult.FEATURE.equals (feature)
- || SAXSource.FEATURE.equals (feature)
- || DOMResult.FEATURE.equals (feature)
- || DOMSource.FEATURE.equals (feature)
- || StreamResult.FEATURE.equals (feature)
- || StreamSource.FEATURE.equals (feature)
- ;
- }
-
- public void setFeature(String name, boolean value)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException(name);
- }
-
-
- /** Throws an exception (no implementation attributes are supported) */
- public void setAttribute (String key, Object value)
- {
- throw new IllegalArgumentException ();
- }
-
- /** Throws an exception (no implementation attributes are supported) */
- public Object getAttribute (String key)
- {
- throw new IllegalArgumentException ();
- }
-
- /** (not yet implemented) */
- public Source getAssociatedStylesheet (Source source,
- String media,
- String title,
- String charset)
- throws TransformerConfigurationException
- {
- // parse, and find the appropriate xsl-stylesheet PI contents
- throw new IllegalArgumentException ();
- }
-
- public Transformer newTransformer ()
- throws TransformerConfigurationException
- {
- return new NullTransformer ();
- }
-
- /**
- * Returns a TransformerHandler that knows how to generate output
- * in all three standard formats. Output text is generated using
- * {@link XMLWriter}, and the GNU implementation of
- * {@link DomDocument DOM} is used.
- *
- * @see SAXResult
- * @see StreamResult
- * @see DOMResult
- */
- public TransformerHandler newTransformerHandler ()
- throws TransformerConfigurationException
- {
- NullTransformer transformer = new NullTransformer ();
- return transformer.handler;
- }
-
- //
- // Stuff that depends on XSLT support, which we don't provide
- //
- private static final String noXSLT = "No XSLT support";
-
- /** Throws an exception (XSLT is not supported). */
- public Transformer newTransformer (Source stylesheet)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException (noXSLT);
- }
-
- /** Throws an exception (XSLT is not supported). */
- public Templates newTemplates (Source stylesheet)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException (noXSLT);
- }
-
- /** Throws an exception (XSLT is not supported). */
- public TemplatesHandler newTemplatesHandler ()
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException (noXSLT);
- }
-
- /** Throws an exception (XSLT is not supported). */
- public TransformerHandler newTransformerHandler (Source stylesheet)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException (noXSLT);
- }
-
- /** Throws an exception (XSLT is not supported). */
- public TransformerHandler newTransformerHandler (Templates stylesheet)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException (noXSLT);
- }
-
- /** Throws an exception (XSLT is not supported). */
- public XMLFilter newXMLFilter (Source stylesheet)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException (noXSLT);
- }
-
- /** Throws an exception (XSLT is not supported). */
- public XMLFilter newXMLFilter (Templates stylesheet)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException (noXSLT);
- }
-
- /** Returns the value assigned by {@link #setErrorListener}. */
- public ErrorListener getErrorListener ()
- {
- return errListener;
- }
-
- /** Assigns a value that would be used when parsing stylesheets */
- public void setErrorListener (ErrorListener e)
- {
- errListener = e;
- }
-
- /** Returns the value assigned by {@link #setURIResolver}. */
- public URIResolver getURIResolver ()
- {
- return uriResolver;
- }
-
- /** Assigns a value that would be used when parsing stylesheets */
- public void setURIResolver (URIResolver u)
- {
- uriResolver = u;
- }
-
-
- //
- // Helper classes. These might in theory be subclassed
- // by an XSLT implementation, if they were exported.
- //
-
- static class DomTerminus
- extends DomConsumer
- {
-
- DomTerminus (DOMResult result)
- throws SAXException
- {
- // won't really throw SAXException
- super (DomDocument.class);
- setHandler (new DomHandler (this, result));
- }
-
- }
-
- static class DomHandler
- extends Consumer.Backdoor
- {
-
- private DOMResult result;
-
- DomHandler (DomConsumer c, DOMResult r)
- throws SAXException
- {
- // won't really throw SAXException
- super (c);
- result = r;
- }
-
- public void endDocument ()
- throws SAXException
- {
- super.endDocument ();
- result.setNode (getDocument ());
- }
-
- }
-
- private static OutputStream getOutputStream (String uri)
- throws IOException
- {
- // JDK stupidity: file "protocol does not support output" ...
- if (uri.startsWith ("file:"))
- return new FileOutputStream (uri.substring (5));
-
- // Otherwise ...
- URL url = new URL (uri);
- URLConnection conn = url.openConnection ();
-
- conn.setDoOutput (true);
- return conn.getOutputStream ();
- }
-
-
- static class NullHandler
- extends EventFilter
- implements TransformerHandler
- {
-
- private String systemId;
- private Transformer transformer;
-
- NullHandler (Transformer t)
- {
- transformer = t;
- }
-
- public Transformer getTransformer ()
- {
- return transformer;
- }
-
- public String getSystemId ()
- {
- return systemId;
- }
-
- public void setSystemId (String id)
- {
- systemId = id;
- }
-
- public void setResult (Result result)
- {
- if (result.getSystemId () != null)
- systemId = result.getSystemId ();
-
- try
- {
-
- // output to partial SAX event stream?
- if (result instanceof SAXResult)
- {
- SAXResult r = (SAXResult) result;
-
- setContentHandler (r.getHandler ());
- setProperty (LEXICAL_HANDLER, r.getLexicalHandler ());
- // DTD info is filtered out by javax.transform
-
- // output to DOM tree?
- }
- else if (result instanceof DOMResult)
- {
- DomTerminus out = new DomTerminus ((DOMResult) result);
-
- setContentHandler (out.getContentHandler ());
- setProperty (LEXICAL_HANDLER,
- out.getProperty (LEXICAL_HANDLER));
- // save DTD-derived info, if any.
- setDTDHandler (out.getDTDHandler ());
- setProperty (DECL_HANDLER,
- out.getProperty (DECL_HANDLER));
-
- // node is saved into result on endDocument()
-
- // output to (XML) text?
- }
- else if (result instanceof StreamResult)
- {
- StreamResult r = (StreamResult) result;
- XMLWriter out;
-
- // FIXME: when do output properties take effect?
- // encoding, standalone decl, xml/xhtml/... ...
-
- // FIXME: maybe put nsfix filter up front
-
- try
- {
- if (r.getWriter () != null)
- out = new XMLWriter (r.getWriter ());
- else if (r.getOutputStream () != null)
- out = new XMLWriter (r.getOutputStream ());
- else if (r.getSystemId () != null)
- out = new XMLWriter (
- getOutputStream (r.getSystemId ()));
- else
- throw new IllegalArgumentException (
- "bad StreamResult");
- }
- catch (IOException e)
- {
- e.printStackTrace ();
- // on jdk 1.4, pass the root cause ...
- throw new IllegalArgumentException (e.getMessage ());
- }
-
- // out.setExpandingEntities (true);
- // out.setPrettyPrinting (true);
- // out.setXhtml (true);
-
- setContentHandler (out);
- setProperty (LEXICAL_HANDLER, out);
- // save DTD info, if any; why not?
- setDTDHandler (out);
- setProperty (DECL_HANDLER, out);
- }
-
- }
- catch (SAXException e)
- {
- // SAXNotSupportedException or SAXNotRecognizedException:
- // "can't happen" ... but SAXException for DOM build probs
- // could happen, so ...
- // on jdk 1.4, pass the root cause ...
- throw new IllegalArgumentException (e.getMessage ());
- }
- }
- }
-
- // an interface that adds no value
- static class LocatorAdapter
- extends LocatorImpl
- implements SourceLocator
- {
-
- LocatorAdapter (SAXParseException e)
- {
- setSystemId (e.getSystemId ());
- setPublicId (e.getPublicId ());
- setLineNumber (e.getLineNumber ());
- setColumnNumber (e.getColumnNumber ());
- }
-
- }
-
- // another interface that adds no value
- static class ListenerAdapter
- implements ErrorHandler
- {
-
- NullTransformer transformer;
-
- ListenerAdapter (NullTransformer t)
- {
- transformer = t;
- }
-
- private TransformerException map (SAXParseException e)
- {
- return new TransformerException (
- e.getMessage (),
- new LocatorAdapter (e),
- e);
- }
-
- public void error (SAXParseException e)
- throws SAXParseException
- {
- try
- {
- if (transformer.errListener != null)
- transformer.errListener.error (map (e));
- }
- catch (TransformerException ex)
- {
- transformer.ex = ex;
- throw e;
- }
- }
-
- public void fatalError (SAXParseException e)
- throws SAXParseException
- {
- try
- {
- if (transformer.errListener != null)
- transformer.errListener.fatalError (map (e));
- else
- throw map (e);
- } catch (TransformerException ex) {
- transformer.ex = ex;
- throw e;
- }
- }
-
- public void warning (SAXParseException e)
- throws SAXParseException
- {
- try
- {
- if (transformer.errListener != null)
- transformer.errListener.warning (map (e));
- }
- catch (TransformerException ex)
- {
- transformer.ex = ex;
- throw e;
- }
- }
- }
-
- static class NullTransformer
- extends Transformer
- {
-
- private URIResolver uriResolver;
- private Properties props = new Properties ();
- private Hashtable params = new Hashtable (7);
-
- ErrorListener errListener = null;
- TransformerException ex = null;
- NullHandler handler;
-
- NullTransformer ()
- {
- super ();
- handler = new NullHandler (this);
- }
-
- public ErrorListener getErrorListener ()
- {
- return errListener;
- }
-
- public void setErrorListener (ErrorListener e)
- {
- errListener = e;
- }
-
- public URIResolver getURIResolver ()
- {
- return uriResolver;
- }
-
- public void setURIResolver (URIResolver u)
- {
- uriResolver = u;
- }
-
- public void setOutputProperties (Properties p)
- {
- props = (Properties) p.clone ();
- }
-
- public Properties getOutputProperties ()
- {
- return (Properties) props.clone ();
- }
-
- public void setOutputProperty (String name, String value)
- {
- props.setProperty (name, value);
- }
-
- public String getOutputProperty (String name)
- {
- return props.getProperty (name);
- }
-
- public void clearParameters ()
- {
- params.clear ();
- }
-
- public void setParameter (String name, Object value)
- {
- props.put (name, value);
- }
-
- public Object getParameter (String name)
- {
- return props.get (name);
- }
-
- public void transform (Source in, Result out)
- throws TransformerException
- {
- try
- {
- XMLReader producer;
- InputSource input;
-
- // Input from DOM?
- if (in instanceof DOMSource)
- {
- DOMSource source = (DOMSource) in;
-
- if (source.getNode () == null)
- throw new IllegalArgumentException ("no DOM node");
- producer = new DomParser (source.getNode ());
- input = null;
-
- // Input from SAX?
- }
- else if (in instanceof SAXSource)
- {
- SAXSource source = (SAXSource) in;
-
- producer = source.getXMLReader ();
- if (producer == null)
- producer = XMLReaderFactory.createXMLReader ();
-
- input = source.getInputSource ();
- if (input == null)
- {
- if (source.getSystemId () != null)
- input = new InputSource (source.getSystemId ());
- else
- throw new IllegalArgumentException (
- "missing SAX input");
- }
-
- // Input from a stream or something?
- }
- else
- {
- producer = XMLReaderFactory.createXMLReader ();
- input = SAXSource.sourceToInputSource (in);
- if (input == null)
- throw new IllegalArgumentException ("missing input");
- }
-
- // preserve original namespace prefixes
- try
- {
- producer.setFeature(EventFilter.FEATURE_URI +
- "namespace-prefixes",
- true);
- }
- catch (Exception e)
- {
- /* ignore */
- // FIXME if we couldn't, "NsFix" stage before the output ..
- }
-
- // arrange the output
- handler.setResult (out);
- EventFilter.bind (producer, handler);
-
- // then parse ... single element pipeline
- producer.parse (input);
-
- }
- catch (IOException e)
- {
- throw new TransformerException ("transform failed", e);
-
- }
- catch (SAXException e)
- {
- if (ex == null && ex.getCause () == e)
- throw ex;
- else
- throw new TransformerException ("transform failed", e);
-
- }
- finally
- {
- ex = null;
- }
- }
- }
-
-}
diff --git a/libjava/gnu/xml/util/XCat.java b/libjava/gnu/xml/util/XCat.java
deleted file mode 100644
index 0f163387081..00000000000
--- a/libjava/gnu/xml/util/XCat.java
+++ /dev/null
@@ -1,1609 +0,0 @@
-/* XCat.java --
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.xml.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Stack;
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-
-import org.xml.sax.ext.DefaultHandler2;
-import org.xml.sax.ext.EntityResolver2;
-
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Packages OASIS XML Catalogs,
- * primarily for entity resolution by parsers.
- * That specification defines an XML syntax for mappings between
- * identifiers declared in DTDs (particularly PUBLIC identifiers) and
- * locations. SAX has always supported such mappings, but conventions for
- * an XML file syntax to maintain them have previously been lacking.
- *
- * This has three main operational modes. The primary intended mode is
- * to create a resolver, then preloading it with one or more site-standard
- * catalogs before using it with one or more SAX parsers: A second mode is to arrange that your application uses instances of
- * this class as its entity resolver, and automatically loads catalogs
- * referenced by <?oasis-xml-catalog...?> processing
- * instructions found before the DTD in documents it parses.
- * It would then discard the resolver after each parse.
- *
- * A third mode applies catalogs in contexts other than entity
- * resolution for parsers.
- * The {@link #resolveURI resolveURI()} method supports resolving URIs
- * stored in XML application data, rather than inside DTDs.
- * Catalogs would be loaded as shown above, and the catalog could
- * be used concurrently for parser entity resolution and for
- * application URI resolution.
- * Errors in catalogs implicitly loaded (during resolution) are ignored
- * beyond being reported through any ErrorHandler assigned using
- * {@link #setErrorHandler setErrorHandler()}. SAX exceptions
- * thrown from such a handler won't abort resolution, although throwing a
- * RuntimeException or Error will normally abort both
- * resolution and parsing. Useful diagnostic information is available to
- * any ErrorHandler used to report problems, or from any exception
- * thrown from an explicit {@link #loadCatalog loadCatalog()} invocation.
- * Applications can use that information as troubleshooting aids.
- *
- * While this class requires SAX2 Extensions 1.1 classes in
- * its class path, basic functionality does not require using a SAX2
- * parser that supports the extended entity resolution functionality.
- * See the original SAX1
- * {@link #resolveEntity(java.lang.String,java.lang.String) resolveEntity()}
- * method for a list of restrictions which apply when it is used with
- * older SAX parsers.
- *
- * @see EntityResolver2
- *
- * @author David Brownell
- */
-public class XCat implements EntityResolver2
-{
- private Catalog catalogs [];
- private boolean usingPublic = true;
- private boolean loadingPermitted = true;
- private boolean unified = true;
- private String parserClass;
- private ErrorHandler errorHandler;
-
- // private EntityResolver next; // chain to next if we fail...
-
- //
- // NOTE: This is a straightforward implementation, and if
- // there are lots of "nextCatalog" or "delegate*" entries
- // in use, two tweaks would be worth considering:
- //
- // - Centralize some sort of cache (key by URI) for individual
- // resolvers. That'd avoid multiple copies of a given catalog.
- //
- // - Have resolution track what catalogs (+modes) have been
- // searched. This would support loop detection.
- //
-
-
- /**
- * Initializes without preloading a catalog.
- * This API is convenient when you may want to arrange that catalogs
- * are automatically loaded when explicitly referenced in documents,
- * using the oasis-xml-catalog processing instruction.
- * In such cases you won't usually be able to preload catalogs.
- */
- public XCat () { }
-
- /**
- * Initializes, and preloads a catalog using the default SAX parser.
- * This API is convenient when you operate with one or more standard
- * catalogs.
- *
- * This just delegates to {@link #loadCatalog loadCatalog()};
- * see it for exception information.
- *
- * @param uri absolute URI for the catalog file.
- */
- public XCat (String uri)
- throws SAXException, IOException
- { loadCatalog (uri); }
-
-
- /**
- * Loads an OASIS XML Catalog.
- * It is appended to the list of currently active catalogs, or
- * reloaded if a catalog with the same URI was already loaded.
- * Callers have control over what parser is used, how catalog parsing
- * errors are reported, and whether URIs will be resolved consistently.
- *
- * The OASIS specification says that errors detected when loading
- * catalogs "must recover by ignoring the catalog entry file that
- * failed, and proceeding." In this API, that action can be the
- * responsibility of applications, when they explicitly load any
- * catalog using this method.
- *
- * Note that catalogs referenced by this one will not be loaded
- * at this time. Catalogs referenced through nextCatalog
- * or delegate* elements are normally loaded only if needed.
- *
- * @see #setErrorHandler
- * @see #setParserClass
- * @see #setUnified
- *
- * @param uri absolute URI for the catalog file.
- *
- * @exception IOException As thrown by the parser, typically to
- * indicate problems reading data from that URI.
- * @exception SAXException As thrown by the parser, typically to
- * indicate problems parsing data from that URI. It may also
- * be thrown if the parser doesn't support necessary handlers.
- * @exception IllegalStateException When attempting to load a
- * catalog after loading has been {@link #disableLoading disabled},
- * such as after any entity or URI lookup has been performed.
- */
- public synchronized void loadCatalog (String uri)
- throws SAXException, IOException
- {
- Catalog catalog;
- int index = -1;
-
- if (!loadingPermitted)
- throw new IllegalStateException ();
-
- uri = normalizeURI (uri);
- if (catalogs != null) {
- // maybe just reload
- for (index = 0; index < catalogs.length; index++)
- if (uri.equals (catalogs [index].catalogURI))
- break;
- }
- catalog = loadCatalog (parserClass, errorHandler, uri, unified);
-
- // add to list of catalogs
- if (catalogs == null) {
- index = 0;
- catalogs = new Catalog [1];
- } else if (index == catalogs.length) {
- Catalog tmp [];
-
- tmp = new Catalog [index + 1];
- System.arraycopy (catalogs, 0, tmp, 0, index);
- catalogs = tmp;
- }
- catalogs [index] = catalog;
- }
-
-
- /**
- * "New Style" external entity resolution for parsers.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * This supports the full core catalog functionality for locating
- * (and relocating) parsed entities that have been declared in a
- * document's DTD.
- *
- * @param name Entity name, such as "dudley", "%nell", or "[dtd]".
- * @param publicId Either a normalized public ID, or null.
- * @param baseURI Absolute base URI associated with systemId.
- * @param systemId URI found in entity declaration (may be
- * relative to baseURI).
- *
- * @return Input source for accessing the external entity, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- *
- * @see #getExternalSubset
- */
- public InputSource resolveEntity (
- String name, // UNUSED ... systemId is always non-null
- String publicId,
- String baseURI, // UNUSED ... it just lets sysId be relative
- String systemId
- ) throws SAXException, IOException
- {
- if (loadingPermitted)
- disableLoading ();
-
- try {
- // steps as found in OASIS XML catalog spec 7.1.2
- // steps 1, 8 involve looping over the list of catalogs
- for (int i = 0; i < catalogs.length; i++) {
- InputSource retval;
- retval = catalogs [i].resolve (usingPublic, publicId, systemId);
- if (retval != null)
- return retval;;
- }
- } catch (DoneDelegation x) {
- // done!
- }
- // step 9 involves returning "no match"
- return null;
- }
-
-
- /**
- * "New Style" parser callback to add an external subset.
- * For documents that don't include an external subset, this may
- * return one according to doctype catalog entries.
- * (This functionality is not a core part of the OASIS XML Catalog
- * specification, though it's presented in an appendix.)
- * If no such entry is defined, this returns null to indicate that
- * this document will not be modified to include such a subset.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * Warning: That catalog functionality can be dangerous.
- * It can provide definitions of general entities, and thereby mask
- * certain well formedess errors.
- *
- * @param name Name of the document element, either as declared in
- * a DOCTYPE declaration or as observed in the text.
- * @param baseURI Document's base URI (absolute).
- *
- * @return Input source for accessing the external subset, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- */
- public InputSource getExternalSubset (String name, String baseURI)
- throws SAXException, IOException
- {
- if (loadingPermitted)
- disableLoading ();
- try {
- for (int i = 0; i < catalogs.length; i++) {
- InputSource retval = catalogs [i].getExternalSubset (name);
- if (retval != null)
- return retval;
- }
- } catch (DoneDelegation x) {
- // done!
- }
- return null;
- }
-
-
- /**
- * "Old Style" external entity resolution for parsers.
- * This API provides only core functionality.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * The functional limitations of this interface include: Applications can tell whether this limited functionality will be
- * used: if the feature flag associated with the {@link EntityResolver2}
- * interface is not true, the limitations apply. Applications
- * can't usually know whether a given document and catalog will trigger
- * those limitations. The issue can only be bypassed by operational
- * procedures such as not using catalogs or documents which involve
- * those features.
- *
- * @param publicId Either a normalized public ID, or null
- * @param systemId Always an absolute URI.
- *
- * @return Input source for accessing the external entity, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- */
- final public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException, IOException
- {
- return resolveEntity (null, publicId, null, systemId);
- }
-
-
- /**
- * Resolves a URI reference that's not defined to the DTD.
- * This is intended for use with URIs found in document text, such as
- * xml-stylesheet processing instructions and in attribute
- * values, where they are not recognized as URIs by XML parsers.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * This functionality is supported by the OASIS XML Catalog
- * specification, but will never be invoked by an XML parser.
- * It corresponds closely to functionality for mapping system
- * identifiers for entities declared in DTDs; closely enough that
- * this implementation's default behavior is that they be
- * identical, to minimize potential confusion.
- *
- * This method could be useful when implementing the
- * {@link javax.xml.transform.URIResolver} interface, wrapping the
- * input source in a {@link javax.xml.transform.sax.SAXSource}.
- *
- * @see #isUnified
- * @see #setUnified
- *
- * @param baseURI The relevant base URI as specified by the XML Base
- * specification. This recognizes xml:base attributes
- * as overriding the actual (physical) base URI.
- * @param uri Either an absolute URI, or one relative to baseURI
- *
- * @return Input source for accessing the mapped URI, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- */
- public InputSource resolveURI (String baseURI, String uri)
- throws SAXException, IOException
- {
- if (loadingPermitted)
- disableLoading ();
-
- // NOTE: baseURI isn't used here, but caller MUST have it,
- // and heuristics _might_ use it in the future ... plus,
- // it's symmetric with resolveEntity ().
-
- // steps 1, 6 involve looping
- try {
- for (int i = 0; i < catalogs.length; i++) {
- InputSource tmp = catalogs [i].resolveURI (uri);
- if (tmp != null)
- return tmp;
- }
- } catch (DoneDelegation x) {
- // done
- }
- // step 7 reports no match
- return null;
- }
-
-
- /**
- * Records that catalog loading is no longer permitted.
- * Loading is automatically disabled when lookups are performed,
- * and should be manually disabled when startDTD() (or
- * any other DTD declaration callback) is invoked, or at the latest
- * when the document root element is seen.
- */
- public synchronized void disableLoading ()
- {
- // NOTE: this method and loadCatalog() are synchronized
- // so that it's impossible to load (top level) catalogs
- // after lookups start. Likewise, deferred loading is also
- // synchronized (for "next" and delegated catalogs) to
- // ensure that parsers can share resolvers.
- loadingPermitted = false;
- }
-
-
- /**
- * Returns the error handler used to report catalog errors.
- * Null is returned if the parser's default error handling
- * will be used.
- *
- * @see #setErrorHandler
- */
- public ErrorHandler getErrorHandler ()
- { return errorHandler; }
-
- /**
- * Assigns the error handler used to report catalog errors.
- * These errors may come either from the SAX2 parser or
- * from the catalog parsing code driven by the parser.
- *
- * If you're sharing the resolver between parsers, don't
- * change this once lookups have begun.
- *
- * @see #getErrorHandler
- *
- * @param parser The error handler, or null saying to use the default
- * (no diagnostics, and only fatal errors terminate loading).
- */
- public void setErrorHandler (ErrorHandler handler)
- { errorHandler = handler; }
-
-
- /**
- * Returns the name of the SAX2 parser class used to parse catalogs.
- * Null is returned if the system default is used.
- * @see #setParserClass
- */
- public String getParserClass ()
- { return parserClass; }
-
- /**
- * Names the SAX2 parser class used to parse catalogs.
- *
- * If you're sharing the resolver between parsers, don't change
- * this once lookups have begun.
- *
- * Note that in order to properly support the xml:base
- * attribute and relative URI resolution, the SAX parser used to parse
- * the catalog must provide a {@link Locator} and support the optional
- * declaration and lexical handlers.
- *
- * @see #getParserClass
- *
- * @param parser The parser class name, or null saying to use the
- * system default SAX2 parser.
- */
- public void setParserClass (String parser)
- { parserClass = parser; }
-
-
- /**
- * Returns true (the default) if all methods resolve
- * a given URI in the same way.
- * Returns false if calls resolving URIs as entities (such as
- * {@link #resolveEntity resolveEntity()}) use different catalog entries
- * than those resolving them as URIs ({@link #resolveURI resolveURI()}),
- * which will generally produce different results.
- *
- * The OASIS XML Catalog specification defines two related schemes
- * to map URIs "as URIs" or "as system IDs".
- * URIs use uri, rewriteURI, and delegateURI
- * elements. System IDs do the same things with systemId,
- * rewriteSystemId, and delegateSystemId.
- * It's confusing and error prone to maintain two parallel copies of
- * such data. Accordingly, this class makes that behavior optional.
- * The unified interpretation of URI mappings is preferred,
- * since it prevents surprises where one URI gets mapped to different
- * contents depending on whether the reference happens to have come
- * from a DTD (or not).
- *
- * @see #setUnified
- */
- public boolean isUnified ()
- { return unified; }
-
- /**
- * Assigns the value of the flag returned by {@link #isUnified}.
- * Set it to false to be strictly conformant with the OASIS XML Catalog
- * specification. Set it to true to make all mappings for a given URI
- * give the same result, regardless of the reason for the mapping.
- *
- * Don't change this once you've loaded the first catalog.
- *
- * @param value new flag setting
- */
- public void setUnified (boolean value)
- { unified = value; }
-
-
- /**
- * Returns true (the default) if a catalog's public identifier
- * mappings will be used.
- * When false is returned, such mappings are ignored except when
- * system IDs are discarded, such as for
- * entities using the urn:publicid: URI scheme in their
- * system identifiers. (See RFC 3151 for information about that
- * URI scheme. Using it in system identifiers may not work well
- * with many SAX parsers unless the resolve-dtd-uris
- * feature flag is set to false.)
- * @see #setUsingPublic
- */
- public boolean isUsingPublic ()
- { return usingPublic; }
-
- /**
- * Specifies which catalog search mode is used.
- * By default, public identifier mappings are able to override system
- * identifiers when both are available.
- * Applications may choose to ignore public
- * identifier mappings in such cases, so that system identifiers
- * declared in DTDs will only be overridden by an explicit catalog
- * match for that system ID.
- *
- * If you're sharing the resolver between parsers, don't
- * change this once lookups have begun.
- * @see #isUsingPublic
- *
- * @param value true to always use public identifier mappings,
- * false to only use them for system ids using the urn:publicid:
- * URI scheme.
- */
- public void setUsingPublic (boolean value)
- { usingPublic = value; }
-
-
-
- // hmm, what's this do? :)
- private static Catalog loadCatalog (
- String parserClass,
- ErrorHandler eh,
- String uri,
- boolean unified
- ) throws SAXException, IOException
- {
- XMLReader parser;
- Loader loader;
- boolean doesIntern = false;
-
- if (parserClass == null)
- parser = XMLReaderFactory.createXMLReader ();
- else
- parser = XMLReaderFactory.createXMLReader (parserClass);
- if (eh != null)
- parser.setErrorHandler (eh);
- // resolve-dtd-entities is at default value (unrecognized == true)
-
- try {
- doesIntern = parser.getFeature (
- "http://xml.org/sax/features/string-interning");
- } catch (SAXNotRecognizedException e) { }
-
- loader = new Loader (doesIntern, eh, unified);
- loader.cat.parserClass = parserClass;
- loader.cat.catalogURI = uri;
-
- parser.setContentHandler (loader);
- parser.setProperty (
- "http://xml.org/sax/properties/declaration-handler",
- loader);
- parser.setProperty (
- "http://xml.org/sax/properties/lexical-handler",
- loader);
- parser.parse (uri);
-
- return loader.cat;
- }
-
- // perform one or both the normalizations for public ids
- private static String normalizePublicId (boolean full, String publicId)
- {
- if (publicId.startsWith ("urn:publicid:")) {
- StringBuffer buf = new StringBuffer ();
- char chars [] = publicId.toCharArray ();
-boolean hasbug = false;
-
- for (int i = 13; i < chars.length; i++) {
- switch (chars [i]) {
- case '+': buf.append (' '); continue;
- case ':': buf.append ("//"); continue;
- case ';': buf.append ("::"); continue;
- case '%':
-// FIXME unhex that char! meanwhile, warn and fallthrough ...
- hasbug = true;
- default: buf.append (chars [i]); continue;
- }
- }
- publicId = buf.toString ();
-if (hasbug)
-System.err.println ("nyet unhexing public id: " + publicId);
- full = true;
- }
-
- // SAX parsers do everything except that URN mapping, but
- // we can't trust other sources to normalize correctly
- if (full) {
- StringTokenizer tokens;
- String token;
-
- tokens = new StringTokenizer (publicId, " \r\n");
- publicId = null;
- while (tokens.hasMoreTokens ()) {
- if (publicId == null)
- publicId = tokens.nextToken ();
- else
- publicId += " " + tokens.nextToken ();
- }
- }
- return publicId;
- }
-
- private static boolean isUriExcluded (int c)
- { return c <= 0x20 || c >= 0x7f || "\"<>^`{|}".indexOf (c) != -1; }
-
- private static int hexNibble (int c)
- {
- if (c < 10)
- return c + '0';
- return ('a' - 10) + c;
- }
-
- // handles URIs with "excluded" characters
- private static String normalizeURI (String systemId)
- {
- int length = systemId.length ();
-
- for (int i = 0; i < length; i++) {
- char c = systemId.charAt (i);
-
- // escape non-ASCII plus "excluded" characters
- if (isUriExcluded (c)) {
- byte buf [];
- ByteArrayOutputStream out;
- int b;
-
- // a JVM that doesn't know UTF8 and 8859_1 is unusable!
- try {
- buf = systemId.getBytes ("UTF8");
- out = new ByteArrayOutputStream (buf.length + 10);
-
- for (i = 0; i < buf.length; i++) {
- b = buf [i] & 0x0ff;
- if (isUriExcluded (b)) {
- out.write ((int) '%');
- out.write (hexNibble (b >> 4));
- out.write (hexNibble (b & 0x0f));
- } else
- out.write (b);
- }
- return out.toString ("8859_1");
- } catch (IOException e) {
- throw new RuntimeException (
- "can't normalize URI: " + e.getMessage ());
- }
- }
- }
- return systemId;
- }
-
- // thrown to mark authoritative end of a search
- private static class DoneDelegation extends SAXException
- {
- DoneDelegation () { }
- }
-
-
- /**
- * Represents a OASIS XML Catalog, and encapsulates much of
- * the catalog functionality.
- */
- private static class Catalog
- {
- // loading infrastructure
- String catalogURI;
- ErrorHandler eh;
- boolean unified;
- String parserClass;
-
- // catalog data
- boolean hasPreference;
- boolean usingPublic;
-
- Hashtable publicIds;
- Hashtable publicDelegations;
-
- Hashtable systemIds;
- Hashtable systemRewrites;
- Hashtable systemDelegations;
-
- Hashtable uris;
- Hashtable uriRewrites;
- Hashtable uriDelegations;
-
- Hashtable doctypes;
-
- Vector next;
-
- // nonpublic!
- Catalog () { }
-
-
- // steps as found in OASIS XML catalog spec 7.1.2
- private InputSource locatePublicId (String publicId)
- throws SAXException, IOException
- {
- // 5. return (first) 'public' entry
- if (publicIds != null) {
- String retval = (String) publicIds.get (publicId);
- if (retval != null) {
- // IF the URI is accessible ...
- return new InputSource (retval);
- }
- }
-
- // 6. return delegatePublic catalog match [complex]
- if (publicDelegations != null)
- return checkDelegations (publicDelegations, publicId,
- publicId, null);
-
- return null;
- }
-
- // steps as found in OASIS XML catalog spec 7.1.2 or 7.2.2
- private InputSource mapURI (
- String uri,
- Hashtable ids,
- Hashtable rewrites,
- Hashtable delegations
- ) throws SAXException, IOException
- {
- // 7.1.2: 2. return (first) 'system' entry
- // 7.2.2: 2. return (first) 'uri' entry
- if (ids != null) {
- String retval = (String) ids.get (uri);
- if (retval != null) {
- // IF the URI is accessible ...
- return new InputSource (retval);
- }
- }
-
- // 7.1.2: 3. return 'rewriteSystem' entries
- // 7.2.2: 3. return 'rewriteURI' entries
- if (rewrites != null) {
- String prefix = null;
- String replace = null;
- int prefixLen = -1;
-
- for (Enumeration e = rewrites.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String temp = (String) e.nextElement ();
- int len = -1;
-
- if (!uri.startsWith (temp))
- continue;
- if (prefix != null
- && (len = temp.length ()) < prefixLen)
- continue;
- prefix = temp;
- prefixLen = len;
- replace = (String) rewrites.get (temp);
- }
- if (prefix != null) {
- StringBuffer buf = new StringBuffer (replace);
- buf.append (uri.substring (prefixLen));
- // IF the URI is accessible ...
- return new InputSource (buf.toString ());
- }
- }
-
- // 7.1.2: 4. return 'delegateSystem' catalog match [complex]
- // 7.2.2: 4. return 'delegateURI' catalog match [complex]
- if (delegations != null)
- return checkDelegations (delegations, uri, null, uri);
-
- return null;
- }
-
-
- /**
- * Returns a URI for an external entity.
- */
- public InputSource resolve (
- boolean usingPublic,
- String publicId,
- String systemId
- ) throws SAXException, IOException
- {
- boolean preferSystem;
- InputSource retval;
-
- if (hasPreference)
- preferSystem = !this.usingPublic;
- else
- preferSystem = !usingPublic;
-
- if (publicId != null)
- publicId = normalizePublicId (false, publicId);
-
- // behavior here matches section 7.1.1 of the oasis spec
- if (systemId != null) {
- if (systemId.startsWith ("urn:publicid:")) {
- String temp = normalizePublicId (true, systemId);
- if (publicId == null) {
- publicId = temp;
- systemId = null;
- } else if (!publicId.equals (temp)) {
- // error; ok to recover by:
- systemId = null;
- }
- } else
- systemId = normalizeURI (systemId);
- }
-
- if (systemId == null && publicId == null)
- return null;
-
- if (systemId != null) {
- retval = mapURI (systemId, systemIds, systemRewrites,
- systemDelegations);
- if (retval != null) {
- retval.setPublicId (publicId);
- return retval;
- }
- }
-
- if (publicId != null
- && !(systemId != null && preferSystem)) {
- retval = locatePublicId (publicId);
- if (retval != null) {
- retval.setPublicId (publicId);
- return retval;
- }
- }
-
- // 7. apply nextCatalog entries
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- retval = n.resolve (usingPublic, publicId, systemId);
- if (retval != null)
- return retval;
- }
- }
-
- return null;
- }
-
- /**
- * Maps one URI into another, for resources that are not defined
- * using XML external entity or notation syntax.
- */
- public InputSource resolveURI (String uri)
- throws SAXException, IOException
- {
- if (uri.startsWith ("urn:publicid:"))
- return resolve (true, normalizePublicId (true, uri), null);
-
- InputSource retval;
-
- uri = normalizeURI (uri);
-
- // 7.2.2 steps 2-4
- retval = mapURI (uri, uris, uriRewrites, uriDelegations);
- if (retval != null)
- return retval;
-
- // 7.2.2 step 5. apply nextCatalog entries
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- retval = n.resolveURI (uri);
- if (retval != null)
- return retval;
- }
- }
-
- return null;
- }
-
-
- /**
- * Finds the external subset associated with a given root element.
- */
- public InputSource getExternalSubset (String name)
- throws SAXException, IOException
- {
- if (doctypes != null) {
- String value = (String) doctypes.get (name);
- if (value != null) {
- // IF the URI is accessible ...
- return new InputSource (value);
- }
- }
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- if (n == null)
- continue;
- InputSource retval = n.getExternalSubset (name);
- if (retval != null)
- return retval;
- }
- }
- return null;
- }
-
- private synchronized Catalog getNext (int i)
- throws SAXException, IOException
- {
- Object obj;
-
- if (next == null || i < 0 || i >= next.size ())
- return null;
- obj = next.elementAt (i);
- if (obj instanceof Catalog)
- return (Catalog) obj;
-
- // ok, we deferred reading that catalog till now.
- // load and cache it.
- Catalog cat = null;
-
- try {
- cat = loadCatalog (parserClass, eh, (String) obj, unified);
- next.setElementAt (cat, i);
- } catch (SAXException e) {
- // must fail quietly, says the OASIS spec
- } catch (IOException e) {
- // same applies here
- }
- return cat;
- }
-
- private InputSource checkDelegations (
- Hashtable delegations,
- String id,
- String publicId, // only one of public/system
- String systemId // will be non-null...
- ) throws SAXException, IOException
- {
- Vector matches = null;
- int length = 0;
-
- // first, see if any prefixes match.
- for (Enumeration e = delegations.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
-
- if (!id.startsWith (prefix))
- continue;
- if (matches == null)
- matches = new Vector ();
-
- // maintain in longer->shorter sorted order
- // NOTE: assumes not many matches will fire!
- int index;
-
- for (index = 0; index < length; index++) {
- String temp = (String) matches.elementAt (index);
- if (prefix.length () > temp.length ()) {
- matches.insertElementAt (prefix, index);
- break;
- }
- }
- if (index == length)
- matches.addElement (prefix);
- length++;
- }
- if (matches == null)
- return null;
-
- // now we know the list of catalogs to replace our "top level"
- // list ... we use it here, rather than somehow going back and
- // restarting, since this helps avoid reading most catalogs.
- // this assumes stackspace won't be a problem.
- for (int i = 0; i < length; i++) {
- Catalog catalog = null;
- InputSource result;
-
- // get this catalog. we may not have read it yet.
- synchronized (delegations) {
- Object prefix = matches.elementAt (i);
- Object cat = delegations.get (prefix);
-
- if (cat instanceof Catalog)
- catalog = (Catalog) cat;
- else {
- try {
- // load and cache that catalog
- catalog = loadCatalog (parserClass, eh,
- (String) cat, unified);
- delegations.put (prefix, catalog);
- } catch (SAXException e) {
- // must ignore, says the OASIS spec
- } catch (IOException e) {
- // same applies here
- }
- }
- }
-
- // ignore failed loads, and proceed
- if (catalog == null)
- continue;
-
- // we have a catalog ... resolve!
- // usingPublic value can't matter, there's no choice
- result = catalog.resolve (true, publicId, systemId);
- if (result != null)
- return result;
- }
-
- // if there were no successes, the entire
- // lookup failed (all the way to top level)
- throw new DoneDelegation ();
- }
- }
-
-
- /** This is the namespace URI used for OASIS XML Catalogs. */
- private static final String catalogNamespace =
- "urn:oasis:names:tc:entity:xmlns:xml:catalog";
-
-
- /**
- * Loads/unmarshals one catalog.
- */
- private static class Loader extends DefaultHandler2
- {
- private boolean preInterned;
- private ErrorHandler handler;
- private boolean unified;
- private int ignoreDepth;
- private Locator locator;
- private boolean started;
- private Hashtable externals;
- private Stack bases;
-
- Catalog cat = new Catalog ();
-
-
- /**
- * Constructor.
- * @param flag true iff the parser already interns strings.
- * @param eh Errors and warnings are delegated to this.
- * @param unified true keeps one table for URI mappings;
- * false matches OASIS spec, storing mappings
- * for URIs and SYSTEM ids in parallel tables.
- */
- Loader (boolean flag, ErrorHandler eh, boolean unified)
- {
- preInterned = flag;
- handler = eh;
- this.unified = unified;
- cat.unified = unified;
- cat.eh = eh;
- }
-
-
- // strips out fragments
- private String nofrag (String uri)
- throws SAXException
- {
- if (uri.indexOf ('#') != -1) {
- warn ("URI with fragment: " + uri);
- uri = uri.substring (0, uri.indexOf ('#'));
- }
- return uri;
- }
-
- // absolutizes relative URIs
- private String absolutize (String uri)
- throws SAXException
- {
- // avoid creating URLs if they're already absolutized,
- // or if the URI is already using a known scheme
- if (uri.startsWith ("file:/")
- || uri.startsWith ("http:/")
- || uri.startsWith ("https:/")
- || uri.startsWith ("ftp:/")
- || uri.startsWith ("urn:")
- )
- return uri;
-
- // otherwise, let's hope the JDK handles this URI scheme.
- try {
- URL base = (URL) bases.peek ();
- return new URL (base, uri).toString ();
- } catch (Exception e) {
- fatal ("can't absolutize URI: " + uri);
- return null;
- }
- }
-
- // recoverable error
- private void error (String message)
- throws SAXException
- {
- if (handler == null)
- return;
- handler.error (new SAXParseException (message, locator));
- }
-
- // nonrecoverable error
- private void fatal (String message)
- throws SAXException
- {
- SAXParseException spe;
-
- spe = new SAXParseException (message, locator);
- if (handler != null)
- handler.fatalError (spe);
- throw spe;
- }
-
- // low severity problem
- private void warn (String message)
- throws SAXException
- {
- if (handler == null)
- return;
- handler.warning (new SAXParseException (message, locator));
- }
-
- // callbacks:
-
- public void setDocumentLocator (Locator l)
- { locator = l; }
-
- public void startDocument ()
- throws SAXException
- {
- if (locator == null)
- error ("no locator!");
- bases = new Stack ();
- String uri = locator.getSystemId ();
- try {
- bases.push (new URL (uri));
- } catch (IOException e) {
- fatal ("bad document base URI: " + uri);
- }
- }
-
- public void endDocument ()
- throws SAXException
- {
- try {
- if (!started)
- error ("not a catalog!");
- } finally {
- locator = null;
- handler = null;
- externals = null;
- bases = null;
- }
- }
-
- // XML Base support for external entities.
-
- // NOTE: expects parser is in default "resolve-dtd-uris" mode.
- public void externalEntityDecl (String name, String pub, String sys)
- throws SAXException
- {
- if (externals == null)
- externals = new Hashtable ();
- if (externals.get (name) == null)
- externals.put (name, pub);
- }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (externals == null)
- return;
- String uri = (String) externals.get (name);
-
- // NOTE: breaks if an EntityResolver substitutes these URIs.
- // If toplevel loader supports one, must intercept calls...
- if (uri != null) {
- try {
- bases.push (new URL (uri));
- } catch (IOException e) {
- fatal ("entity '" + name + "', bad URI: " + uri);
- }
- }
- }
-
- public void endEntity (String name)
- {
- if (externals == null)
- return;
- String value = (String) externals.get (name);
-
- if (value != null)
- bases.pop ();
- }
-
- /**
- * Processes catalog elements, saving their data.
- */
- public void startElement (String namespace, String local,
- String qName, Attributes atts)
- throws SAXException
- {
- // must ignore non-catalog elements, and their contents
- if (ignoreDepth != 0 || !catalogNamespace.equals (namespace)) {
- ignoreDepth++;
- return;
- }
-
- // basic sanity checks
- if (!preInterned)
- local = local.intern ();
- if (!started) {
- started = true;
- if ("catalog" != local)
- fatal ("root element not 'catalog': " + local);
- }
-
- // Handle any xml:base attribute
- String xmlbase = atts.getValue ("xml:base");
-
- if (xmlbase != null) {
- URL base = (URL) bases.peek ();
- try {
- base = new URL (base, xmlbase);
- } catch (IOException e) {
- fatal ("can't resolve xml:base attribute: " + xmlbase);
- }
- bases.push (base);
- } else
- bases.push (bases.peek ());
-
- // fetch multi-element attributes, apply standard tweaks
- // values (uri, catalog, rewritePrefix) get normalized too,
- // as a precaution and since we may compare the values
- String catalog = atts.getValue ("catalog");
- if (catalog != null)
- catalog = normalizeURI (absolutize (catalog));
-
- String rewritePrefix = atts.getValue ("rewritePrefix");
- if (rewritePrefix != null)
- rewritePrefix = normalizeURI (absolutize (rewritePrefix));
-
- String systemIdStartString;
- systemIdStartString = atts.getValue ("systemIdStartString");
- if (systemIdStartString != null) {
- systemIdStartString = normalizeURI (systemIdStartString);
- // unmatchable By default, text is generated "as-is", but some optional modes
- * are supported. Pretty-printing is supported, to make life easier
- * for people reading the output. XHTML (1.0) output has can be made
- * particularly pretty; all the built-in character entities are known.
- * Canonical XML can also be generated, assuming the input is properly
- * formed.
- *
- * Some of the methods on this class are intended for applications to
- * use directly, rather than as pure SAX2 event callbacks. Some of those
- * methods access the JavaBeans properties (used to tweak output formats,
- * for example canonicalization and pretty printing). Subclasses
- * are expected to add new behaviors, not to modify current behavior, so
- * many such methods are final. The write*() methods may be slightly simpler for some
- * applications to use than direct callbacks. For example, they support
- * a simple policy for encoding data items as the content of a single element.
- *
- * To reuse an XMLWriter you must provide it with a new Writer, since
- * this handler closes the writer it was given as part of its endDocument()
- * handling. (XML documents have an end of input, and the way to encode
- * that on a stream is to close it.) Note that any relative URIs in the source document, as found in
- * entity and notation declarations, ought to have been fully resolved by
- * the parser providing events to this handler. This means that the
- * output text should only have fully resolved URIs, which may not be
- * the desired behavior in cases where later binding is desired. Note that due to SAX2 defaults, you may need to manually
- * ensure that the input events are XML-conformant with respect to namespace
- * prefixes and declarations. {@link gnu.xml.pipeline.NSFilter} is
- * one solution to this problem, in the context of processing pipelines.
- * Something as simple as connecting this handler to a parser might not
- * generate the correct output. Another workaround is to ensure that the
- * namespace-prefixes feature is always set to true, if you're
- * hooking this directly up to some XMLReader implementation.
- *
- * @see gnu.xml.pipeline.TextConsumer
- *
- * @author David Brownell
- */
-public class XMLWriter
- implements ContentHandler, LexicalHandler, DTDHandler, DeclHandler
-{
- // text prints/escapes differently depending on context
- // CTX_ENTITY ... entity literal value
- // CTX_ATTRIBUTE ... attribute literal value
- // CTX_CONTENT ... content of an element
- // CTX_UNPARSED ... CDATA, comment, PI, names, etc
- // CTX_NAME ... name or nmtoken, no escapes possible
- private static final int CTX_ENTITY = 1;
- private static final int CTX_ATTRIBUTE = 2;
- private static final int CTX_CONTENT = 3;
- private static final int CTX_UNPARSED = 4;
- private static final int CTX_NAME = 5;
-
-// FIXME: names (element, attribute, PI, notation, etc) are not
-// currently written out with range checks (escapeChars).
-// In non-XHTML, some names can't be directly written; panic!
-
- private static String sysEOL;
-
- static {
- try {
- sysEOL = System.getProperty ("line.separator", "\n");
-
- // don't use the system's EOL if it's illegal XML.
- if (!isLineEnd (sysEOL))
- sysEOL = "\n";
-
- } catch (SecurityException e) {
- sysEOL = "\n";
- }
- }
-
- private static boolean isLineEnd (String eol)
- {
- return "\n".equals (eol)
- || "\r".equals (eol)
- || "\r\n".equals (eol);
- }
-
- private Writer out;
- private boolean inCDATA;
- private int elementNestLevel;
- private String eol = sysEOL;
-
- private short dangerMask;
- private StringBuffer stringBuf;
- private Locator locator;
- private ErrorHandler errHandler;
-
- private boolean expandingEntities = false;
- private int entityNestLevel;
- private boolean xhtml;
- private boolean startedDoctype;
- private String encoding;
-
- private boolean canonical;
- private boolean inDoctype;
- private boolean inEpilogue;
-
- // pretty printing controls
- private boolean prettyPrinting;
- private int column;
- private boolean noWrap;
- private Stack space = new Stack ();
-
- // this is not a hard'n'fast rule -- longer lines are OK,
- // but are to be avoided. Here, prettyprinting is more to
- // show structure "cleanly" than to be precise about it.
- // better to have ragged layout than one line 24Kb long.
- private static final int lineLength = 75;
-
-
- /**
- * Constructs this handler with System.out used to write SAX events
- * using the UTF-8 encoding. Avoid using this except when you know
- * it's safe to close System.out at the end of the document.
- */
- public XMLWriter () throws IOException
- { this (System.out); }
-
- /**
- * Constructs a handler which writes all input to the output stream
- * in the UTF-8 encoding, and closes it when endDocument is called.
- * (Yes it's annoying that this throws an exception -- but there's
- * really no way around it, since it's barely possible a JDK may
- * exist somewhere that doesn't know how to emit UTF-8.)
- */
- public XMLWriter (OutputStream out) throws IOException
- {
- this (new OutputStreamWriter (out, "UTF8"));
- }
-
- /**
- * Constructs a handler which writes all input to the writer, and then
- * closes the writer when the document ends. If an XML declaration is
- * written onto the output, and this class can determine the name of
- * the character encoding for this writer, that encoding name will be
- * included in the XML declaration.
- *
- * See the description of the constructor which takes an encoding
- * name for imporant information about selection of encodings.
- *
- * @param writer XML text is written to this writer.
- */
- public XMLWriter (Writer writer)
- {
- this (writer, null);
- }
-
- /**
- * Constructs a handler which writes all input to the writer, and then
- * closes the writer when the document ends. If an XML declaration is
- * written onto the output, this class will use the specified encoding
- * name in that declaration. If no encoding name is specified, no
- * encoding name will be declared unless this class can otherwise
- * determine the name of the character encoding for this writer.
- *
- * At this time, only the UTF-8 ("UTF8") and UTF-16 ("Unicode")
- * output encodings are fully lossless with respect to XML data. If you
- * use any other encoding you risk having your data be silently mangled
- * on output, as the standard Java character encoding subsystem silently
- * maps non-encodable characters to a question mark ("?") and will not
- * report such errors to applications.
- *
- * For a few other encodings the risk can be reduced. If the writer is
- * a java.io.OutputStreamWriter, and uses either the ISO-8859-1 ("8859_1",
- * "ISO8859_1", etc) or US-ASCII ("ASCII") encodings, content which
- * can't be encoded in those encodings will be written safely. Where
- * relevant, the XHTML entity names will be used; otherwise, numeric
- * character references will be emitted.
- *
- * However, there remain a number of cases where substituting such
- * entity or character references is not an option. Such references are
- * not usable within a DTD, comment, PI, or CDATA section. Neither may
- * they be used when element, attribute, entity, or notation names have
- * the problematic characters.
- *
- * @param writer XML text is written to this writer.
- * @param encoding if non-null, and an XML declaration is written,
- * this is the name that will be used for the character encoding.
- */
- public XMLWriter (Writer writer, String encoding)
- {
- setWriter (writer, encoding);
- }
-
- private void setEncoding (String encoding)
- {
- if (encoding == null && out instanceof OutputStreamWriter)
- encoding = ((OutputStreamWriter)out).getEncoding ();
-
- if (encoding != null) {
- encoding = encoding.toUpperCase ();
-
- // Use official encoding names where we know them,
- // avoiding the Java-only names. When using common
- // encodings where we can easily tell if characters
- // are out of range, we'll escape out-of-range
- // characters using character refs for safety.
-
- // I _think_ these are all the main synonyms for these!
- if ("UTF8".equals (encoding)) {
- encoding = "UTF-8";
- } else if ("US-ASCII".equals (encoding)
- || "ASCII".equals (encoding)) {
- dangerMask = (short) 0xff80;
- encoding = "US-ASCII";
- } else if ("ISO-8859-1".equals (encoding)
- || "8859_1".equals (encoding)
- || "ISO8859_1".equals (encoding)) {
- dangerMask = (short) 0xff00;
- encoding = "ISO-8859-1";
- } else if ("UNICODE".equals (encoding)
- || "UNICODE-BIG".equals (encoding)
- || "UNICODE-LITTLE".equals (encoding)) {
- encoding = "UTF-16";
-
- // TODO: UTF-16BE, UTF-16LE ... no BOM; what
- // release of JDK supports those Unicode names?
- }
-
- if (dangerMask != 0)
- stringBuf = new StringBuffer ();
- }
-
- this.encoding = encoding;
- }
-
-
- /**
- * Resets the handler to write a new text document.
- *
- * @param writer XML text is written to this writer.
- * @param encoding if non-null, and an XML declaration is written,
- * this is the name that will be used for the character encoding.
- *
- * @exception IllegalStateException if the current
- * document hasn't yet ended (with {@link #endDocument})
- */
- final public void setWriter (Writer writer, String encoding)
- {
- if (out != null)
- throw new IllegalStateException (
- "can't change stream in mid course");
- out = writer;
- if (out != null)
- setEncoding (encoding);
- if (!(out instanceof BufferedWriter))
- out = new BufferedWriter (out);
- space.push ("default");
- }
-
- /**
- * Assigns the line ending style to be used on output.
- * @param eolString null to use the system default; else
- * "\n", "\r", or "\r\n".
- */
- final public void setEOL (String eolString)
- {
- if (eolString == null)
- eol = sysEOL;
- else if (!isLineEnd (eolString))
- eol = eolString;
- else
- throw new IllegalArgumentException (eolString);
- }
-
- /**
- * Assigns the error handler to be used to present most fatal
- * errors.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- errHandler = handler;
- }
-
- /**
- * Used internally and by subclasses, this encapsulates the logic
- * involved in reporting fatal errors. It uses locator information
- * for good diagnostics, if available, and gives the application's
- * ErrorHandler the opportunity to handle the error before throwing
- * an exception.
- */
- protected void fatal (String message, Exception e)
- throws SAXException
- {
- SAXParseException x;
-
- if (locator == null)
- x = new SAXParseException (message, null, null, -1, -1, e);
- else
- x = new SAXParseException (message, locator, e);
- if (errHandler != null)
- errHandler.fatalError (x);
- throw x;
- }
-
-
- // JavaBeans properties
-
- /**
- * Controls whether the output should attempt to follow the "transitional"
- * XHTML rules so that it meets the "HTML Compatibility Guidelines"
- * appendix in the XHTML specification. A "transitional" Document Type
- * Declaration (DTD) is placed near the beginning of the output document,
- * instead of whatever DTD would otherwise have been placed there, and
- * XHTML empty elements are printed specially. When writing text in
- * US-ASCII or ISO-8859-1 encodings, the predefined XHTML internal
- * entity names are used (in preference to character references) when
- * writing content characters which can't be expressed in those encodings.
- *
- * When this option is enabled, it is the caller's responsibility
- * to ensure that the input is otherwise valid as XHTML. Things to
- * be careful of in all cases, as described in the appendix referenced
- * above, include: Additionally, some of the oldest browsers have additional
- * quirks, to address with guidelines such as: Also, some characteristics of the resulting output may be
- * a function of whether the document is later given a MIME
- * content type of text/html rather than one indicating
- * XML (application/xml or text/xml). Worse,
- * some browsers ignore MIME content types and prefer to rely URI
- * name suffixes -- so an "index.xml" could always be XML, never
- * XHTML, no matter its MIME type.
- */
- final public void setXhtml (boolean value)
- {
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- xhtml = value;
- if (xhtml)
- canonical = false;
- }
-
- /**
- * Returns true if the output attempts to echo the input following
- * "transitional" XHTML rules and matching the "HTML Compatibility
- * Guidelines" so that an HTML version 3 browser can read the output
- * as HTML; returns false (the default) othewise.
- */
- final public boolean isXhtml ()
- {
- return xhtml;
- }
-
- /**
- * Controls whether the output text contains references to
- * entities (the default), or instead contains the expanded
- * values of those entities.
- */
- final public void setExpandingEntities (boolean value)
- {
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- expandingEntities = value;
- if (!expandingEntities)
- canonical = false;
- }
-
- /**
- * Returns true if the output will have no entity references;
- * returns false (the default) otherwise.
- */
- final public boolean isExpandingEntities ()
- {
- return expandingEntities;
- }
-
- /**
- * Controls pretty-printing, which by default is not enabled
- * (and currently is most useful for XHTML output).
- * Pretty printing enables structural indentation, sorting of attributes
- * by name, line wrapping, and potentially other mechanisms for making
- * output more or less readable.
- *
- * At this writing, structural indentation and line wrapping are
- * enabled when pretty printing is enabled and the xml:space
- * attribute has the value default (its other legal value is
- * preserve, as defined in the XML specification). The three
- * XHTML element types which use another value are recognized by their
- * names (namespaces are ignored).
- *
- * Also, for the record, the "pretty" aspect of printing here
- * is more to provide basic structure on outputs that would otherwise
- * risk being a single long line of text. For now, expect the
- * structure to be ragged ... unless you'd like to submit a patch
- * to make this be more strictly formatted!
- *
- * @exception IllegalStateException thrown if this method is invoked
- * after output has begun.
- */
- final public void setPrettyPrinting (boolean value)
- {
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- prettyPrinting = value;
- if (prettyPrinting)
- canonical = false;
- }
-
- /**
- * Returns value of flag controlling pretty printing.
- */
- final public boolean isPrettyPrinting ()
- {
- return prettyPrinting;
- }
-
-
- /**
- * Sets the output style to be canonicalized. Input events must
- * meet requirements that are slightly more stringent than the
- * basic well-formedness ones, and include: Note that fragments of XML documents, as specified by an XPath
- * node set, may be canonicalized. In such cases, elements may need
- * some fixup (for xml:* attributes and application-specific
- * context).
- *
- * @exception IllegalArgumentException if the output encoding
- * is anything other than UTF-8.
- */
- final public void setCanonical (boolean value)
- {
- if (value && !"UTF-8".equals (encoding))
- throw new IllegalArgumentException ("encoding != UTF-8");
- canonical = value;
- if (canonical) {
- prettyPrinting = xhtml = false;
- expandingEntities = true;
- eol = "\n";
- }
- }
-
-
- /**
- * Returns value of flag controlling canonical output.
- */
- final public boolean isCanonical ()
- {
- return canonical;
- }
-
-
- /**
- * Flushes the output stream. When this handler is used in long lived
- * pipelines, it can be important to flush buffered state, for example
- * so that it can reach the disk as part of a state checkpoint.
- */
- final public void flush ()
- throws IOException
- {
- if (out != null)
- out.flush ();
- }
-
-
- // convenience routines
-
-// FIXME: probably want a subclass that holds a lot of these...
-// and maybe more!
-
- /**
- * Writes the string as if characters() had been called on the contents
- * of the string. This is particularly useful when applications act as
- * producers and write data directly to event consumers.
- */
- final public void write (String data)
- throws SAXException
- {
- char buf [] = data.toCharArray ();
- characters (buf, 0, buf.length);
- }
-
-
- /**
- * Writes an element that has content consisting of a single string.
- * @see #writeEmptyElement
- * @see #startElement
- */
- public void writeElement (
- String uri,
- String localName,
- String qName,
- Attributes atts,
- String content
- ) throws SAXException
- {
- if (content == null || content.length () == 0) {
- writeEmptyElement (uri, localName, qName, atts);
- return;
- }
- startElement (uri, localName, qName, atts);
- char chars [] = content.toCharArray ();
- characters (chars, 0, chars.length);
- endElement (uri, localName, qName);
- }
-
-
- /**
- * Writes an element that has content consisting of a single integer,
- * encoded as a decimal string.
- * @see #writeEmptyElement
- * @see #startElement
- */
- public void writeElement (
- String uri,
- String localName,
- String qName,
- Attributes atts,
- int content
- ) throws SAXException
- {
- writeElement (uri, localName, qName, atts, Integer.toString (content));
- }
-
-
- // SAX1 ContentHandler
- /** SAX1: provides parser status information */
- final public void setDocumentLocator (Locator l)
- {
- locator = l;
- }
-
-
- // URL for dtd that validates against all normal HTML constructs
- private static final String xhtmlFullDTD =
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
-
-
- /**
- * SAX1: indicates the beginning of a document parse.
- * If you're writing (well formed) fragments of XML, neither
- * this nor endDocument should be called.
- */
- // NOT final
- public void startDocument ()
- throws SAXException
- {
- try {
- if (out == null)
- throw new IllegalStateException (
- "null Writer given to XMLWriter");
-
- // Not all parsers provide the locator we want; this also
- // flags whether events are being sent to this object yet.
- // We could only have this one call if we only printed whole
- // documents ... but we also print fragments, so most of the
- // callbacks here replicate this test.
-
- if (locator == null)
- locator = new LocatorImpl ();
-
- // Unless the data is in US-ASCII or we're canonicalizing, write
- // the XML declaration if we know the encoding. US-ASCII won't
- // normally get mangled by web server confusion about the
- // character encodings used. Plus, it's an easy way to
- // ensure we can write ASCII that's unlikely to confuse
- // elderly HTML parsers.
-
- if (!canonical
- && dangerMask != (short) 0xff80
- && encoding != null) {
- rawWrite ("");
- newline ();
- }
-
- if (xhtml) {
-
- rawWrite ("");
- newline ();
- newline ();
-
- // fake the rest of the handler into ignoring
- // everything until the root element, so any
- // XHTML DTD comments, PIs, etc are ignored
- startedDoctype = true;
- }
-
- entityNestLevel = 0;
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * SAX1: indicates the completion of a parse.
- * Note that all complete SAX event streams make this call, even
- * if an error is reported during a parse.
- */
- // NOT final
- public void endDocument ()
- throws SAXException
- {
- try {
- if (!canonical) {
- newline ();
- newline ();
- }
- out.close ();
- out = null;
- locator = null;
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // XHTML elements declared as EMPTY print differently
- final private static boolean isEmptyElementTag (String tag)
- {
- switch (tag.charAt (0)) {
- case 'a': return "area".equals (tag);
- case 'b': return "base".equals (tag)
- || "basefont".equals (tag)
- || "br".equals (tag);
- case 'c': return "col".equals (tag);
- case 'f': return "frame".equals (tag);
- case 'h': return "hr".equals (tag);
- case 'i': return "img".equals (tag)
- || "input".equals (tag)
- || "isindex".equals (tag);
- case 'l': return "link".equals (tag);
- case 'm': return "meta".equals (tag);
- case 'p': return "param".equals (tag);
- }
- return false;
- }
-
- private static boolean indentBefore (String tag)
- {
- // basically indent before block content
- // and within structure like tables, lists
- switch (tag.charAt (0)) {
- case 'a': return "applet".equals (tag);
- case 'b': return "body".equals (tag)
- || "blockquote".equals (tag);
- case 'c': return "center".equals (tag);
- case 'f': return "frame".equals (tag)
- || "frameset".equals (tag);
- case 'h': return "head".equals (tag);
- case 'm': return "meta".equals (tag);
- case 'o': return "object".equals (tag);
- case 'p': return "param".equals (tag)
- || "pre".equals (tag);
- case 's': return "style".equals (tag);
- case 't': return "title".equals (tag)
- || "td".equals (tag)
- || "th".equals (tag);
- }
- // ... but not inline elements like "em", "b", "font"
- return false;
- }
-
- private static boolean spaceBefore (String tag)
- {
- // blank line AND INDENT before certain structural content
- switch (tag.charAt (0)) {
- case 'h': return "h1".equals (tag)
- || "h2".equals (tag)
- || "h3".equals (tag)
- || "h4".equals (tag)
- || "h5".equals (tag)
- || "h6".equals (tag)
- || "hr".equals (tag);
- case 'l': return "li".equals (tag);
- case 'o': return "ol".equals (tag);
- case 'p': return "p".equals (tag);
- case 't': return "table".equals (tag)
- || "tr".equals (tag);
- case 'u': return "ul".equals (tag);
- }
- return false;
- }
-
- // XHTML DTDs say these three have xml:space="preserve"
- private static boolean spacePreserve (String tag)
- {
- return "pre".equals (tag)
- || "style".equals (tag)
- || "script".equals (tag);
- }
-
- /**
- * SAX2: ignored.
- */
- final public void startPrefixMapping (String prefix, String uri)
- {}
-
- /**
- * SAX2: ignored.
- */
- final public void endPrefixMapping (String prefix)
- {}
-
- private void writeStartTag (
- String name,
- Attributes atts,
- boolean isEmpty
- ) throws SAXException, IOException
- {
- rawWrite ('<');
- rawWrite (name);
-
- // write out attributes ... sorting is particularly useful
- // with output that's been heavily defaulted.
- if (atts != null && atts.getLength () != 0) {
-
- // Set up to write, with optional sorting
- int indices [] = new int [atts.getLength ()];
-
- for (int i= 0; i < indices.length; i++)
- indices [i] = i;
-
- // optionally sort
-
-// FIXME: canon xml demands xmlns nodes go first,
-// and sorting by URI first (empty first) then localname
-// it should maybe use a different sort
-
- if (canonical || prettyPrinting) {
-
- // insertion sort by attribute name
- for (int i = 1; i < indices.length; i++) {
- int n = indices [i], j;
- String s = atts.getQName (n);
-
- for (j = i - 1; j >= 0; j--) {
- if (s.compareTo (atts.getQName (indices [j]))
- >= 0)
- break;
- indices [j + 1] = indices [j];
- }
- indices [j + 1] = n;
- }
- }
-
- // write, sorted or no
- for (int i= 0; i < indices.length; i++) {
- String s = atts.getQName (indices [i]);
-
- if (s == null || "".equals (s))
- throw new IllegalArgumentException ("no XML name");
- rawWrite (" ");
- rawWrite (s);
- rawWrite ("=");
- writeQuotedValue (atts.getValue (indices [i]),
- CTX_ATTRIBUTE);
- }
- }
- if (isEmpty)
- rawWrite (" /");
- rawWrite ('>');
- }
-
- /**
- * SAX2: indicates the start of an element.
- * When XHTML is in use, avoid attribute values with
- * line breaks or multiple whitespace characters, since
- * not all user agents handle them correctly.
- */
- final public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- startedDoctype = false;
-
- if (locator == null)
- locator = new LocatorImpl ();
-
- if (qName == null || "".equals (qName))
- throw new IllegalArgumentException ("no XML name");
-
- try {
- if (entityNestLevel != 0)
- return;
- if (prettyPrinting) {
- String whitespace = null;
-
- if (xhtml && spacePreserve (qName))
- whitespace = "preserve";
- else if (atts != null)
- whitespace = atts.getValue ("xml:space");
- if (whitespace == null)
- whitespace = (String) space.peek ();
- space.push (whitespace);
-
- if ("default".equals (whitespace)) {
- if (xhtml) {
- if (spaceBefore (qName)) {
- newline ();
- doIndent ();
- } else if (indentBefore (qName))
- doIndent ();
- // else it's inlined, modulo line length
- // FIXME: incrementing element nest level
- // for inlined elements causes ugliness
- } else
- doIndent ();
- }
- }
- elementNestLevel++;
- writeStartTag (qName, atts, xhtml && isEmptyElementTag (qName));
-
- if (xhtml) {
-// FIXME: if this is an XHTML "pre" element, turn
-// off automatic wrapping.
- }
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * Writes an empty element.
- * @see #startElement
- */
- public void writeEmptyElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- if (canonical) {
- startElement (uri, localName, qName, atts);
- endElement (uri, localName, qName);
- } else {
- try {
- writeStartTag (qName, atts, true);
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
- }
-
-
- /** SAX2: indicates the end of an element */
- final public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (qName == null || "".equals (qName))
- throw new IllegalArgumentException ("no XML name");
-
- try {
- elementNestLevel--;
- if (entityNestLevel != 0)
- return;
- if (xhtml && isEmptyElementTag (qName))
- return;
- rawWrite ("");
- rawWrite (qName);
- rawWrite ('>');
-
- if (prettyPrinting) {
- if (!space.empty ())
- space.pop ();
- else
- fatal ("stack discipline", null);
- }
- if (elementNestLevel == 0)
- inEpilogue = true;
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** SAX1: reports content characters */
- final public void characters (char ch [], int start, int length)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- try {
- if (entityNestLevel != 0)
- return;
- if (inCDATA) {
- escapeChars (ch, start, length, CTX_UNPARSED);
- } else {
- escapeChars (ch, start, length, CTX_CONTENT);
- }
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** SAX1: reports ignorable whitespace */
- final public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- try {
- if (entityNestLevel != 0)
- return;
- // don't forget to map NL to CRLF, CR, etc
- escapeChars (ch, start, length, CTX_CONTENT);
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * SAX1: reports a PI.
- * This doesn't check for illegal target names, such as "xml" or "XML",
- * or namespace-incompatible ones like "big:dog"; the caller is
- * responsible for ensuring those names are legal.
- */
- final public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- // don't print internal subset for XHTML
- if (xhtml && startedDoctype)
- return;
-
- // ancient HTML browsers might render these ... their loss.
- // to prevent: "if (xhtml) return;".
-
- try {
- if (entityNestLevel != 0)
- return;
- if (canonical && inEpilogue)
- newline ();
- rawWrite ("");
- rawWrite (target);
- rawWrite (' ');
- escapeChars (data.toCharArray (), -1, -1, CTX_UNPARSED);
- rawWrite ("?>");
- if (elementNestLevel == 0 && !(canonical && inEpilogue))
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** SAX1: indicates a non-expanded entity reference */
- public void skippedEntity (String name)
- throws SAXException
- {
- try {
- rawWrite ("&");
- rawWrite (name);
- rawWrite (";");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // SAX2 LexicalHandler
-
- /** SAX2: called before parsing CDATA characters */
- final public void startCDATA ()
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- if (canonical)
- return;
-
- try {
- inCDATA = true;
- if (entityNestLevel == 0)
- rawWrite ("SAX2: called after parsing CDATA characters */
- final public void endCDATA ()
- throws SAXException
- {
- if (canonical)
- return;
-
- try {
- inCDATA = false;
- if (entityNestLevel == 0)
- rawWrite ("]]>");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * SAX2: called when the doctype is partially parsed
- * Note that this, like other doctype related calls, is ignored
- * when XHTML is in use.
- */
- final public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
- if (xhtml)
- return;
- try {
- inDoctype = startedDoctype = true;
- if (canonical)
- return;
- rawWrite ("SAX2: called after the doctype is parsed */
- final public void endDTD ()
- throws SAXException
- {
- inDoctype = false;
- if (canonical || xhtml)
- return;
- try {
- rawWrite ("]>");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * SAX2: called before parsing a general entity in content
- */
- final public void startEntity (String name)
- throws SAXException
- {
- try {
- boolean writeEOL = true;
-
- // Predefined XHTML entities (for characters) will get
- // mapped back later.
- if (xhtml || expandingEntities)
- return;
-
- entityNestLevel++;
- if (name.equals ("[dtd]"))
- return;
- if (entityNestLevel != 1)
- return;
- if (!name.startsWith ("%")) {
- writeEOL = false;
- rawWrite ('&');
- }
- rawWrite (name);
- rawWrite (';');
- if (writeEOL)
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * SAX2: called after parsing a general entity in content
- */
- final public void endEntity (String name)
- throws SAXException
- {
- if (xhtml || expandingEntities)
- return;
- entityNestLevel--;
- }
-
- /**
- * SAX2: called when comments are parsed.
- * When XHTML is used, the old HTML tradition of using comments
- * to for inline CSS, or for JavaScript code is discouraged.
- * This is because XML processors are encouraged to discard, on
- * the grounds that comments are for users (and perhaps text
- * editors) not programs. Instead, use external scripts
- */
- final public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- // don't print internal subset for XHTML
- if (xhtml && startedDoctype)
- return;
- // don't print comment in doctype for canon xml
- if (canonical && inDoctype)
- return;
-
- try {
- boolean indent;
-
- if (prettyPrinting && space.empty ())
- fatal ("stack discipline", null);
- indent = prettyPrinting && "default".equals (space.peek ());
- if (entityNestLevel != 0)
- return;
- if (indent)
- doIndent ();
- if (canonical && inEpilogue)
- newline ();
- rawWrite ("");
- if (indent)
- doIndent ();
- if (elementNestLevel == 0 && !(canonical && inEpilogue))
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // SAX1 DTDHandler
-
- /** SAX1: called on notation declarations */
- final public void notationDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
-
- if (entityNestLevel != 0)
- return;
- rawWrite ("");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** SAX1: called on unparsed entity declarations */
- final public void unparsedEntityDecl (String name,
- String publicId, String systemId,
- String notationName)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype) {
- // FIXME: write to temporary buffer, and make the start
- // of the root element write these declarations.
- return;
- }
-
- if (entityNestLevel != 0)
- return;
- rawWrite ("");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // SAX2 DeclHandler
-
- /** SAX2: called on attribute declarations */
- final public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** SAX2: called on element declarations */
- final public void elementDecl (String name, String model)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** SAX2: called on external entity declarations */
- final public void externalEntityDecl (
- String name,
- String publicId,
- String systemId)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** SAX2: called on internal entity declarations */
- final public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- private void writeQuotedValue (String value, int code)
- throws SAXException, IOException
- {
- char buf [] = value.toCharArray ();
- int off = 0, len = buf.length;
-
- // we can't add line breaks to attribute/entity/... values
- noWrap = true;
- rawWrite ('"');
- escapeChars (buf, off, len, code);
- rawWrite ('"');
- noWrap = false;
- }
-
- // From "HTMLlat1x.ent" ... names of entities for ISO-8859-1
- // (Latin/1) characters, all codes: 160-255 (0xA0-0xFF).
- // Codes 128-159 have no assigned values.
- private static final String HTMLlat1x [] = {
- // 160
- "nbsp", "iexcl", "cent", "pound", "curren",
- "yen", "brvbar", "sect", "uml", "copy",
-
- // 170
- "ordf", "laquo", "not", "shy", "reg",
- "macr", "deg", "plusmn", "sup2", "sup3",
-
- // 180
- "acute", "micro", "para", "middot", "cedil",
- "sup1", "ordm", "raquo", "frac14", "frac12",
-
- // 190
- "frac34", "iquest", "Agrave", "Aacute", "Acirc",
- "Atilde", "Auml", "Aring", "AElig", "Ccedil",
-
- // 200
- "Egrave", "Eacute", "Ecirc", "Euml", "Igrave",
- "Iacute", "Icirc", "Iuml", "ETH", "Ntilde",
-
- // 210
- "Ograve", "Oacute", "Ocirc", "Otilde", "Ouml",
- "times", "Oslash", "Ugrave", "Uacute", "Ucirc",
-
- // 220
- "Uuml", "Yacute", "THORN", "szlig", "agrave",
- "aacute", "acirc", "atilde", "auml", "aring",
-
- // 230
- "aelig", "ccedil", "egrave", "eacute", "ecirc",
- "euml", "igrave", "iacute", "icirc", "iuml",
-
- // 240
- "eth", "ntilde", "ograve", "oacute", "ocirc",
- "otilde", "ouml", "divide", "oslash", "ugrave",
-
- // 250
- "uacute", "ucirc", "uuml", "yacute", "thorn",
- "yuml"
- };
-
- // From "HTMLsymbolx.ent" ... some of the symbols that
- // we can conveniently handle. Entities for the Greek.
- // alphabet (upper and lower cases) are compact.
- private static final String HTMLsymbolx_GR [] = {
- // 913
- "Alpha", "Beta", "Gamma", "Delta", "Epsilon",
- "Zeta", "Eta", "Theta", "Iota", "Kappa",
-
- // 923
- "Lambda", "Mu", "Nu", "Xi", "Omicron",
- "Pi", "Rho", null, "Sigma", "Tau",
-
- // 933
- "Upsilon", "Phi", "Chi", "Psi", "Omega"
- };
-
- private static final String HTMLsymbolx_gr [] = {
- // 945
- "alpha", "beta", "gamma", "delta", "epsilon",
- "zeta", "eta", "theta", "iota", "kappa",
-
- // 955
- "lambda", "mu", "nu", "xi", "omicron",
- "pi", "rho", "sigmaf", "sigma", "tau",
-
- // 965
- "upsilon", "phi", "chi", "psi", "omega"
- };
-
-
- // General routine to write text and substitute predefined
- // entities (XML, and a special case for XHTML) as needed.
- private void escapeChars (char buf [], int off, int len, int code)
- throws SAXException, IOException
- {
- int first = 0;
-
- if (off < 0) {
- off = 0;
- len = buf.length;
- }
- for (int i = 0; i < len; i++) {
- String esc;
- char c = buf [off + i];
-
- switch (c) {
- // Note that CTX_ATTRIBUTE isn't explicitly tested here;
- // all syntax delimiters are escaped in CTX_ATTRIBUTE,
- // otherwise it's similar to CTX_CONTENT
-
- // ampersand flags entity references; entity replacement
- // text has unexpanded references, other text doesn't.
- case '&':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "amp";
- break;
-
- // attributes and text may NOT have literal '<', but
- // entities may have markup constructs
- case '<':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "lt";
- break;
-
- // as above re markup constructs; but otherwise
- // except when canonicalizing, this is for consistency
- case '>':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "gt";
- break;
- case '\'':
- if (code == CTX_CONTENT || code == CTX_UNPARSED)
- continue;
- if (canonical)
- continue;
- esc = "apos";
- break;
-
- // needed when printing quoted attribute/entity values
- case '"':
- if (code == CTX_CONTENT || code == CTX_UNPARSED)
- continue;
- esc = "quot";
- break;
-
- // make line ends work per host OS convention
- case '\n':
- esc = eol;
- break;
-
- //
- // No other characters NEED special treatment ... except
- // for encoding-specific issues, like whether the character
- // can really be represented in that encoding.
- //
- default:
- //
- // There are characters we can never write safely; getting
- // them is an error.
- //
- // (a) They're never legal in XML ... detected by range
- // checks, and (eventually) by remerging surrogate
- // pairs on output. (Easy error for apps to prevent.)
- //
- // (b) This encoding can't represent them, and we
- // can't make reference substitution (e.g. inside
- // CDATA sections, names, PI data, etc). (Hard for
- // apps to prevent, except by using UTF-8 or UTF-16
- // as their output encoding.)
- //
- // We know a very little bit about what characters
- // the US-ASCII and ISO-8859-1 encodings support. For
- // other encodings we can't detect the second type of
- // error at all. (Never an issue for UTF-8 or UTF-16.)
- //
-
-// FIXME: CR in CDATA is an error; in text, turn to a char ref
-
-// FIXME: CR/LF/TAB in attributes should become char refs
-
- if ((c > 0xfffd)
- || ((c < 0x0020) && !((c == 0x0009)
- || (c == 0x000A) || (c == 0x000D)))
- || (((c & dangerMask) != 0)
- && (code == CTX_UNPARSED))) {
-
- // if case (b) in CDATA, we might end the section,
- // write a reference, then restart ... possible
- // in one DOM L3 draft.
-
- throw new CharConversionException (
- "Illegal or non-writable character: U+"
- + Integer.toHexString (c));
- }
-
- //
- // If the output encoding represents the character
- // directly, let it do so! Else we'll escape it.
- //
- if ((c & dangerMask) == 0)
- continue;
- esc = null;
-
- // Avoid numeric refs where symbolic ones exist, as
- // symbolic ones make more sense to humans reading!
- if (xhtml) {
- // all the HTMLlat1x.ent entities
- // (all the "ISO-8859-1" characters)
- if (c >= 160 && c <= 255)
- esc = HTMLlat1x [c - 160];
-
- // not quite half the HTMLsymbolx.ent entities
- else if (c >= 913 && c <= 937)
- esc = HTMLsymbolx_GR [c - 913];
- else if (c >= 945 && c <= 969)
- esc = HTMLsymbolx_gr [c - 945];
-
- else switch (c) {
- // all of the HTMLspecialx.ent entities
- case 338: esc = "OElig"; break;
- case 339: esc = "oelig"; break;
- case 352: esc = "Scaron"; break;
- case 353: esc = "scaron"; break;
- case 376: esc = "Yuml"; break;
- case 710: esc = "circ"; break;
- case 732: esc = "tilde"; break;
- case 8194: esc = "ensp"; break;
- case 8195: esc = "emsp"; break;
- case 8201: esc = "thinsp"; break;
- case 8204: esc = "zwnj"; break;
- case 8205: esc = "zwj"; break;
- case 8206: esc = "lrm"; break;
- case 8207: esc = "rlm"; break;
- case 8211: esc = "ndash"; break;
- case 8212: esc = "mdash"; break;
- case 8216: esc = "lsquo"; break;
- case 8217: esc = "rsquo"; break;
- case 8218: esc = "sbquo"; break;
- case 8220: esc = "ldquo"; break;
- case 8221: esc = "rdquo"; break;
- case 8222: esc = "bdquo"; break;
- case 8224: esc = "dagger"; break;
- case 8225: esc = "Dagger"; break;
- case 8240: esc = "permil"; break;
- case 8249: esc = "lsaquo"; break;
- case 8250: esc = "rsaquo"; break;
- case 8364: esc = "euro"; break;
-
- // the other HTMLsymbox.ent entities
- case 402: esc = "fnof"; break;
- case 977: esc = "thetasym"; break;
- case 978: esc = "upsih"; break;
- case 982: esc = "piv"; break;
- case 8226: esc = "bull"; break;
- case 8230: esc = "hellip"; break;
- case 8242: esc = "prime"; break;
- case 8243: esc = "Prime"; break;
- case 8254: esc = "oline"; break;
- case 8260: esc = "frasl"; break;
- case 8472: esc = "weierp"; break;
- case 8465: esc = "image"; break;
- case 8476: esc = "real"; break;
- case 8482: esc = "trade"; break;
- case 8501: esc = "alefsym"; break;
- case 8592: esc = "larr"; break;
- case 8593: esc = "uarr"; break;
- case 8594: esc = "rarr"; break;
- case 8595: esc = "darr"; break;
- case 8596: esc = "harr"; break;
- case 8629: esc = "crarr"; break;
- case 8656: esc = "lArr"; break;
- case 8657: esc = "uArr"; break;
- case 8658: esc = "rArr"; break;
- case 8659: esc = "dArr"; break;
- case 8660: esc = "hArr"; break;
- case 8704: esc = "forall"; break;
- case 8706: esc = "part"; break;
- case 8707: esc = "exist"; break;
- case 8709: esc = "empty"; break;
- case 8711: esc = "nabla"; break;
- case 8712: esc = "isin"; break;
- case 8713: esc = "notin"; break;
- case 8715: esc = "ni"; break;
- case 8719: esc = "prod"; break;
- case 8721: esc = "sum"; break;
- case 8722: esc = "minus"; break;
- case 8727: esc = "lowast"; break;
- case 8730: esc = "radic"; break;
- case 8733: esc = "prop"; break;
- case 8734: esc = "infin"; break;
- case 8736: esc = "ang"; break;
- case 8743: esc = "and"; break;
- case 8744: esc = "or"; break;
- case 8745: esc = "cap"; break;
- case 8746: esc = "cup"; break;
- case 8747: esc = "int"; break;
- case 8756: esc = "there4"; break;
- case 8764: esc = "sim"; break;
- case 8773: esc = "cong"; break;
- case 8776: esc = "asymp"; break;
- case 8800: esc = "ne"; break;
- case 8801: esc = "equiv"; break;
- case 8804: esc = "le"; break;
- case 8805: esc = "ge"; break;
- case 8834: esc = "sub"; break;
- case 8835: esc = "sup"; break;
- case 8836: esc = "nsub"; break;
- case 8838: esc = "sube"; break;
- case 8839: esc = "supe"; break;
- case 8853: esc = "oplus"; break;
- case 8855: esc = "otimes"; break;
- case 8869: esc = "perp"; break;
- case 8901: esc = "sdot"; break;
- case 8968: esc = "lceil"; break;
- case 8969: esc = "rceil"; break;
- case 8970: esc = "lfloor"; break;
- case 8971: esc = "rfloor"; break;
- case 9001: esc = "lang"; break;
- case 9002: esc = "rang"; break;
- case 9674: esc = "loz"; break;
- case 9824: esc = "spades"; break;
- case 9827: esc = "clubs"; break;
- case 9829: esc = "hearts"; break;
- case 9830: esc = "diams"; break;
- }
- }
-
- // else escape with numeric char refs
- if (esc == null) {
- stringBuf.setLength (0);
- stringBuf.append ("#x");
- stringBuf.append (Integer.toHexString (c).toUpperCase ());
- esc = stringBuf.toString ();
-
- // FIXME: We don't write surrogate pairs correctly.
- // They should work as one ref per character, since
- // each pair is one character. For reading back into
- // Unicode, it matters beginning in Unicode 3.1 ...
- }
- break;
- }
- if (i != first)
- rawWrite (buf, off + first, i - first);
- first = i + 1;
- if (esc == eol)
- newline ();
- else {
- rawWrite ('&');
- rawWrite (esc);
- rawWrite (';');
- }
- }
- if (first < len)
- rawWrite (buf, off + first, len - first);
- }
-
-
-
- private void newline ()
- throws SAXException, IOException
- {
- out.write (eol);
- column = 0;
- }
-
- private void doIndent ()
- throws SAXException, IOException
- {
- int space = elementNestLevel * 2;
-
- newline ();
- column = space;
- // track tabs only at line starts
- while (space > 8) {
- out.write ("\t");
- space -= 8;
- }
- while (space > 0) {
- out.write (" ");
- space -= 2;
- }
- }
-
- private void rawWrite (char c)
- throws IOException
- {
- out.write (c);
- column++;
- }
-
- private void rawWrite (String s)
- throws SAXException, IOException
- {
- if (prettyPrinting && "default".equals (space.peek ())) {
- char data [] = s.toCharArray ();
- rawWrite (data, 0, data.length);
- } else {
- out.write (s);
- column += s.length ();
- }
- }
-
- // NOTE: if xhtml, the REC gives some rules about whitespace
- // which we could follow ... notably, many places where conformant
- // agents "must" consolidate/normalize whitespace. Line ends can
- // be removed there, etc. This may not be the right place to do
- // such mappings though.
-
- // Line buffering may help clarify algorithms and improve results.
-
- // It's likely xml:space needs more attention.
-
- private void rawWrite (char buf [], int offset, int length)
- throws SAXException, IOException
- {
- boolean wrap;
-
- if (prettyPrinting && space.empty ())
- fatal ("stack discipline", null);
-
- wrap = prettyPrinting && "default".equals (space.peek ());
- if (!wrap) {
- out.write (buf, offset, length);
- column += length;
- return;
- }
-
- // we're pretty printing and want to fill lines out only
- // to the desired line length.
- while (length > 0) {
- int target = lineLength - column;
- boolean wrote = false;
-
- // Do we even have a problem?
- if (target > length || noWrap) {
- out.write (buf, offset, length);
- column += length;
- return;
- }
-
- // break the line at a space character, trying to fill
- // as much of the line as possible.
- char c;
-
- for (int i = target - 1; i >= 0; i--) {
- if ((c = buf [offset + i]) == ' ' || c == '\t') {
- i++;
- out.write (buf, offset, i);
- doIndent ();
- offset += i;
- length -= i;
- wrote = true;
- break;
- }
- }
- if (wrote)
- continue;
-
- // no space character permitting break before target
- // line length is filled. So, take the next one.
- if (target < 0)
- target = 0;
- for (int i = target; i < length; i++)
- if ((c = buf [offset + i]) == ' ' || c == '\t') {
- i++;
- out.write (buf, offset, i);
- doIndent ();
- offset += i;
- length -= i;
- wrote = true;
- break;
- }
- if (wrote)
- continue;
-
- // no such luck.
- out.write (buf, offset, length);
- column += length;
- break;
- }
- }
-}
diff --git a/libjava/gnu/xml/xpath/AndExpr.java b/libjava/gnu/xml/xpath/AndExpr.java
deleted file mode 100644
index 680e84792fb..00000000000
--- a/libjava/gnu/xml/xpath/AndExpr.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* AndExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Logical and.
- *
- * @author Chris Burdess
- */
-public final class AndExpr
- extends Expr
-{
-
- final Expr lhs;
- final Expr rhs;
-
- public AndExpr(Expr lhs, Expr rhs)
- {
- this.lhs = lhs;
- this.rhs = rhs;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object left = lhs.evaluate(context, pos, len);
- if (!_boolean(context, left))
- {
- return Boolean.FALSE;
- }
- Object right = rhs.evaluate(context, pos, len);
- return _boolean(context, right) ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- return new AndExpr(lhs.clone(context), rhs.clone(context));
- }
-
- public String toString()
- {
- return lhs + " and " + rhs;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/ArithmeticExpr.java b/libjava/gnu/xml/xpath/ArithmeticExpr.java
deleted file mode 100644
index f972d7d4afd..00000000000
--- a/libjava/gnu/xml/xpath/ArithmeticExpr.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/* ArithmeticExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Binary arithmetic expression.
- *
- * @author Chris Burdess
- */
-final class ArithmeticExpr
- extends Expr
-{
-
- static final int ADD = 0;
- static final int SUBTRACT = 1;
- static final int MULTIPLY = 2;
- static final int DIVIDE = 3;
- static final int MODULO = 4;
-
- final Expr lhs;
- final Expr rhs;
- final int op;
-
- ArithmeticExpr(Expr lhs, Expr rhs, int op)
- {
- this.lhs = lhs;
- this.rhs = rhs;
- switch (op)
- {
- case ADD:
- case SUBTRACT:
- case MULTIPLY:
- case DIVIDE:
- case MODULO:
- this.op = op;
- break;
- default:
- throw new IllegalArgumentException();
- }
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object left = lhs.evaluate(context, pos, len);
- Object right = rhs.evaluate(context, pos, len);
-
- double ln = _number(context, left);
- double rn = _number(context, right);
- switch (op)
- {
- case ADD:
- return new Double(ln + rn);
- case SUBTRACT:
- return new Double(ln - rn);
- case MULTIPLY:
- return new Double(ln * rn);
- case DIVIDE:
- if (rn == 0.0d || rn == -0.0d)
- {
- return new Double(ln < 0.0d ?
- Double.NEGATIVE_INFINITY :
- Double.POSITIVE_INFINITY);
- }
- return new Double(ln / rn);
- case MODULO:
- if (rn == 0.0d || rn == -0.0d)
- {
- return new Double(ln < 0.0d ?
- Double.NEGATIVE_INFINITY :
- Double.POSITIVE_INFINITY);
- }
- return new Double(ln % rn);
- default:
- throw new IllegalStateException();
- }
- }
-
- public Expr clone(Object context)
- {
- return new ArithmeticExpr(lhs.clone(context), rhs.clone(context), op);
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- buf.append(lhs);
- buf.append(' ');
- switch (op)
- {
- case ADD:
- buf.append('+');
- break;
- case SUBTRACT:
- buf.append('-');
- break;
- case MULTIPLY:
- buf.append('*');
- break;
- case DIVIDE:
- buf.append("div");
- break;
- case MODULO:
- buf.append("mod");
- break;
- }
- buf.append(' ');
- buf.append(rhs);
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/BooleanFunction.java b/libjava/gnu/xml/xpath/BooleanFunction.java
deleted file mode 100644
index 018348ff2e7..00000000000
--- a/libjava/gnu/xml/xpath/BooleanFunction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* BooleanFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The To be useful, a subclass should override at least start(). Also useful
- * are init, stop, and destroy for control purposes, and getAppletInfo and
- * getParameterInfo for descriptive purposes.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public class Applet extends Panel
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -5836846270535785031L;
-
- /** The applet stub for this applet. */
- private transient AppletStub stub;
-
- /** Some applets call setSize in their constructors. In that case,
- these fields are used to store width and height values until a
- stub is set. */
- private transient int width;
- private transient int height;
-
- /**
- * The accessibility context for this applet.
- *
- * @serial the accessibleContext for this
- * @since 1.2
- */
- private AccessibleContext accessibleContext;
-
- /**
- * Default constructor for subclasses.
- *
- * @throws HeadlessException if in a headless environment
- */
- public Applet()
- {
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException();
- }
-
- /**
- * The browser calls this method to set the applet's stub, which is the
- * low level interface to the browser. Manually setting this to null is
- * asking for problems down the road.
- *
- * @param stub the applet stub for this applet
- */
- public final void setStub(AppletStub stub)
- {
- this.stub = stub;
-
- if (width != 0 && height != 0)
- stub.appletResize (width, height);
- }
-
- /**
- * Tests whether or not this applet is currently active. An applet is active
- * just before the browser invokes start(), and becomes inactive just
- * before the browser invokes stop().
- *
- * @return Event masks defined here are used by components in
- * When it come time to process an event, simply call The first time For backwards compatibility with Swing, this supports a way to build
- * instances of a subclass, using reflection, provided the subclass has a
- * no-arg constructor (of any accessibility).
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see #getAWTKeyStroke(char)
- * @since 1.4
- * @status updated to 1.4
- */
-public class AWTKeyStroke implements Serializable
-{
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = -6430539691155161871L;
-
- /** The mask for modifiers. */
- private static final int MODIFIERS_MASK = 0x3fef;
-
- /**
- * The cache of recently created keystrokes. This maps KeyStrokes to
- * KeyStrokes in a cache which removes the least recently accessed entry,
- * under the assumption that garbage collection of a new keystroke is
- * easy when we find the old one that it matches in the cache.
- */
- private static final LinkedHashMap cache = new LinkedHashMap(11, 0.75f, true)
- {
- /** The largest the keystroke cache can grow. */
- private static final int MAX_CACHE_SIZE = 2048;
-
- /** Prune stale entries. */
- protected boolean removeEldestEntry(Map.Entry eldest)
- { // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
- return size() > MAX_CACHE_SIZE;
- }
- };
-
- /** The most recently generated keystroke, or null. */
- private static AWTKeyStroke recent;
-
- /**
- * The no-arg constructor of a subclass, or null to use AWTKeyStroke. Note
- * that this will be left accessible, to get around private access; but
- * it should not be a security risk as it is highly unlikely that creating
- * protected instances of the subclass via reflection will do much damage.
- */
- private static Constructor ctor;
-
- /**
- * A table of keyCode names to values. This is package-private to
- * avoid an accessor method.
- *
- * @see #getAWTKeyStroke(String)
- */
- static final HashMap vktable = new HashMap();
- static
- {
- // Using reflection saves the hassle of keeping this in sync with KeyEvent,
- // at the price of an expensive initialization.
- AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
- {
- Field[] fields = KeyEvent.class.getFields();
- int i = fields.length;
- try
- {
- while (--i >= 0)
- {
- Field f = fields[i];
- String name = f.getName();
- if (name.startsWith("VK_"))
- vktable.put(name.substring(3), f.get(null));
- }
- }
- catch (Exception e)
- {
- throw (Error) new InternalError().initCause(e);
- }
- return null;
- }
- });
- }
-
- /**
- * The typed character, or CHAR_UNDEFINED for key presses and releases.
- *
- * @serial the keyChar
- */
- private char keyChar;
-
- /**
- * The virtual key code, or VK_UNDEFINED for key typed. Package visible for
- * use by Component.
- *
- * @serial the keyCode
- */
- int keyCode;
-
- /**
- * The modifiers in effect. To match Sun, this stores the old style masks
- * for shift, control, alt, meta, and alt-graph (but not button1); as well
- * as the new style of extended modifiers for all modifiers.
- *
- * @serial bitwise or of the *_DOWN_MASK modifiers
- */
- private int modifiers;
-
- /**
- * True if this is a key release; should only be true if keyChar is
- * CHAR_UNDEFINED.
- *
- * @serial true to distinguish key pressed from key released
- */
- private boolean onKeyRelease;
-
- /**
- * Construct a keystroke with default values: it will be interpreted as a
- * key typed event with an invalid character and no modifiers. Client code
- * should use the factory methods instead.
- *
- * @see #getAWTKeyStroke(char)
- * @see #getAWTKeyStroke(Character, int)
- * @see #getAWTKeyStroke(int, int, boolean)
- * @see #getAWTKeyStroke(int, int)
- * @see #getAWTKeyStrokeForEvent(KeyEvent)
- * @see #getAWTKeyStroke(String)
- */
- protected AWTKeyStroke()
- {
- keyChar = KeyEvent.CHAR_UNDEFINED;
- }
-
- /**
- * Construct a keystroke with the given values. Client code should use the
- * factory methods instead.
- *
- * @param keyChar the character entered, if this is a key typed
- * @param keyCode the key pressed or released, or VK_UNDEFINED for key typed
- * @param modifiers the modifier keys for the keystroke, in old or new style
- * @param onKeyRelease true if this is a key release instead of a press
- * @see #getAWTKeyStroke(char)
- * @see #getAWTKeyStroke(Character, int)
- * @see #getAWTKeyStroke(int, int, boolean)
- * @see #getAWTKeyStroke(int, int)
- * @see #getAWTKeyStrokeForEvent(KeyEvent)
- * @see #getAWTKeyStroke(String)
- */
- protected AWTKeyStroke(char keyChar, int keyCode, int modifiers,
- boolean onKeyRelease)
- {
- this.keyChar = keyChar;
- this.keyCode = keyCode;
- // No need to call extend(), as only trusted code calls this constructor.
- this.modifiers = modifiers;
- this.onKeyRelease = onKeyRelease;
- }
-
- /**
- * Registers a new subclass as being the type of keystrokes to generate in
- * the factory methods. This operation flushes the cache of stored keystrokes
- * if the class differs from the current one. The new class must be
- * AWTKeyStroke or a subclass, and must have a no-arg constructor (which may
- * be private).
- *
- * @param subclass the new runtime type of generated keystrokes
- * @throws IllegalArgumentException subclass doesn't have no-arg constructor
- * @throws ClassCastException subclass doesn't extend AWTKeyStroke
- */
- protected static void registerSubclass(final Class subclass)
- {
- if (subclass == null)
- throw new IllegalArgumentException();
- if (subclass.equals(ctor == null ? AWTKeyStroke.class
- : ctor.getDeclaringClass()))
- return;
- if (subclass.equals(AWTKeyStroke.class))
- {
- cache.clear();
- recent = null;
- ctor = null;
- return;
- }
- try
- {
- ctor = (Constructor) AccessController.doPrivileged
- (new PrivilegedExceptionAction()
- {
- public Object run()
- throws NoSuchMethodException, InstantiationException,
- IllegalAccessException, InvocationTargetException
- {
- Constructor c = subclass.getDeclaredConstructor(null);
- c.setAccessible(true);
- // Create a new instance, to make sure that we can, and
- // to cause any ClassCastException.
- AWTKeyStroke dummy = (AWTKeyStroke) c.newInstance(null);
- return c;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- // e.getCause() will not ever be ClassCastException; that should
- // escape on its own.
- throw (RuntimeException)
- new IllegalArgumentException().initCause(e.getCause());
- }
- cache.clear();
- recent = null;
- }
-
- /**
- * Returns a keystroke representing a typed character.
- *
- * @param keyChar the typed character
- * @return the specified keystroke
- */
- public static AWTKeyStroke getAWTKeyStroke(char keyChar)
- {
- return getAWTKeyStroke(keyChar, KeyEvent.VK_UNDEFINED, 0, false);
- }
-
- /**
- * Returns a keystroke representing a typed character with the given
- * modifiers. Note that keyChar is a Note that the grammar is rather weak, and not all valid keystrokes
- * can be generated in this manner (for example, a typed space, or anything
- * with the alt-graph modifier!). The output of AWTKeyStroke.toString()
- * will not meet the grammar. If pressed or released is not specified,
- * pressed is assumed. Examples: The following table provides a list of all the possible AWTPermission
- * permission names with a description of what that permission allows. This constant is an older name for {@link #PAGE_START} which
- * has exactly the same value.
- *
- * @since 1.2
- */
- public static final String BEFORE_FIRST_LINE = "First";
-
-
- /**
- * The constant indicating the position after the last line of the
- * layout. The exact position depends on the writing system: For a
- * top-to-bottom orientation, it is the same as {@link #SOUTH}, for
- * a bottom-to-top orientation, it is the same as {@link #NORTH}.
- *
- * This constant is an older name for {@link #PAGE_END} which
- * has exactly the same value.
- *
- * @since 1.2
- */
- public static final String AFTER_LAST_LINE = "Last";
-
-
- /**
- * The constant indicating the position before the first item of the
- * layout. The exact position depends on the writing system: For a
- * left-to-right orientation, it is the same as {@link #WEST}, for
- * a right-to-left orientation, it is the same as {@link #EAST}.
- *
- * This constant is an older name for {@link #LINE_START} which
- * has exactly the same value.
- *
- * @since 1.2
- */
- public static final String BEFORE_LINE_BEGINS = "Before";
-
-
- /**
- * The constant indicating the position after the last item of the
- * layout. The exact position depends on the writing system: For a
- * left-to-right orientation, it is the same as {@link #EAST}, for
- * a right-to-left orientation, it is the same as {@link #WEST}.
- *
- * This constant is an older name for {@link #LINE_END} which
- * has exactly the same value.
- *
- * @since 1.2
- */
- public static final String AFTER_LINE_ENDS = "After";
-
-
- /**
- * The constant indicating the position before the first line of the
- * layout. The exact position depends on the writing system: For a
- * top-to-bottom orientation, it is the same as {@link #NORTH}, for
- * a bottom-to-top orientation, it is the same as {@link #SOUTH}.
- *
- * @since 1.4
- */
- public static final String PAGE_START = BEFORE_FIRST_LINE;
-
-
- /**
- * The constant indicating the position after the last line of the
- * layout. The exact position depends on the writing system: For a
- * top-to-bottom orientation, it is the same as {@link #SOUTH}, for
- * a bottom-to-top orientation, it is the same as {@link #NORTH}.
- *
- * @since 1.4
- */
- public static final String PAGE_END = AFTER_LAST_LINE;
-
-
- /**
- * The constant indicating the position before the first item of the
- * layout. The exact position depends on the writing system: For a
- * left-to-right orientation, it is the same as {@link #WEST}, for
- * a right-to-left orientation, it is the same as {@link #EAST}.
- *
- * @since 1.4
- */
- public static final String LINE_START = BEFORE_LINE_BEGINS;
-
-
- /**
- * The constant indicating the position after the last item of the
- * layout. The exact position depends on the writing system: For a
- * left-to-right orientation, it is the same as {@link #EAST}, for
- * a right-to-left orientation, it is the same as {@link #WEST}.
- *
- * @since 1.4
- */
- public static final String LINE_END = AFTER_LINE_ENDS;
-
-
-
-// Serialization constant
-private static final long serialVersionUID = -8658291919501921765L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial
- */
-private Component north;
-
-/**
- * @serial
- */
-private Component south;
-
-/**
- * @serial
- */
-private Component east;
-
-/**
- * @serial
- */
-private Component west;
-
-/**
- * @serial
- */
-private Component center;
-
-/**
- * @serial
- */
-private Component firstLine;
-
-/**
- * @serial
- */
-private Component lastLine;
-
-/**
- * @serial
- */
-private Component firstItem;
-
-/**
- * @serial
- */
-private Component lastItem;
-
-/**
- * @serial The horizontal gap between components
- */
-private int hgap;
-
-/**
- * @serial The vertical gap between components
- */
-private int vgap;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of This class is Serializable, which has some big implications. A user can
- * save the state of all graphical components in one VM, and reload them in
- * another. Note that this class will only save Serializable listeners, and
- * ignore the rest, without causing any serialization exceptions. However, by
- * making a listener serializable, and adding it to another element, you link
- * in that entire element to the state of this component. To get around this,
- * use the idiom shown in the example below - make listeners non-serializable
- * in inner classes, rather than using this object itself as the listener, if
- * external objects do not need to save the state of this object.
- *
- * Status: Incomplete. The event dispatch mechanism is implemented. All
- * other methods defined in the J2SE 1.3 API javadoc exist, but are mostly
- * incomplete or only stubs; except for methods relating to the Drag and
- * Drop, Input Method, and Accessibility frameworks: These methods are
- * present but commented out.
- *
- * @author original author unknown
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status still missing 1.4 support
- */
-public abstract class Component
- implements ImageObserver, MenuContainer, Serializable
-{
- // Word to the wise - this file is huge. Search for '\f' (^L) for logical
- // sectioning by fields, public API, private API, and nested classes.
-
-
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -7644114512714619750L;
-
- /**
- * Constant returned by the The coordinate system used depends on the particular flags.
- *
- * @param img the image that has been updated
- * @param flags tlags as specified in Events are enabled by default when a listener is attached to the
- * component for that event type. This method can be used by subclasses
- * to ensure the delivery of a specified event regardless of whether
- * or not a listener is attached.
- *
- * @param eventsToEnable the desired events to enable
- * @see #processEvent(AWTEvent)
- * @see #disableEvents(long)
- * @see AWTEvent
- * @since 1.1
- */
- protected final void enableEvents(long eventsToEnable)
- {
- eventMask |= eventsToEnable;
- // TODO: Unlike Sun's implementation, I think we should try and
- // enable/disable events at the peer (gtk/X) level. This will avoid
- // clogging the event pipeline with useless mousemove events that
- // we arn't interested in, etc. This will involve extending the peer
- // interface, but thats okay because the peer interfaces have been
- // deprecated for a long time, and no longer feature in the
- // API specification at all.
- if (isLightweight() && parent != null)
- parent.enableEvents(eventsToEnable);
- else if (peer != null)
- peer.setEventMask(eventMask);
- }
-
- /**
- * Disables the specified events. The events to disable are specified
- * by OR-ing together the desired masks from The defaults are:
- * This is a pretty poor excuse for a type-safe enum, since it is not
- * guaranteed that orientation objects are unique (thanks to serialization),
- * yet there is no equals() method. You would be wise to compare the output
- * of isHorizontal() and isLeftToRight() rather than comparing objects with
- * ==, especially since more constants may be added in the future.
- *
- * @author Bryce McKinlay (bryce@albatross.co.nz)
- * @since 1.0
- * @status updated to 1.4
- */
-public final class ComponentOrientation implements Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -4113291392143563828L;
-
- /** Constant for unknown orientation. */
- private static final int UNKNOWN_ID = 1;
-
- /** Constant for horizontal line orientation. */
- private static final int HORIZONTAL_ID = 2;
-
- /** Constant for left-to-right orientation. */
- private static final int LEFT_TO_RIGHT_ID = 4;
-
- /**
- * Items run left to right, and lines flow top to bottom. Examples: English,
- * French.
- */
- public static final ComponentOrientation LEFT_TO_RIGHT
- = new ComponentOrientation(HORIZONTAL_ID | LEFT_TO_RIGHT_ID);
-
- /**
- * Items run right to left, and lines flow top to bottom. Examples: Arabic,
- * Hebrew.
- */
- public static final ComponentOrientation RIGHT_TO_LEFT
- = new ComponentOrientation(HORIZONTAL_ID);
-
- /**
- * The orientation is unknown for the locale. For backwards compatibility,
- * this behaves like LEFT_TO_RIGHT in the instance methods.
- */
- public static final ComponentOrientation UNKNOWN
- = new ComponentOrientation(UNKNOWN_ID | HORIZONTAL_ID | LEFT_TO_RIGHT_ID);
-
- /**
- * The orientation of this object; bitwise-or of unknown (1), horizontal (2),
- * and left-to-right (4).
- *
- * @serial the orientation
- */
- private final int orientation;
-
- /**
- * Construct a given orientation.
- *
- * @param orientation the orientation
- */
- private ComponentOrientation(int orientation)
- {
- this.orientation = orientation;
- }
-
- /**
- * Returns true if the lines are horizontal, in which case lines flow
- * top-to-bottom. For example, English, Hebrew. Counterexamples: Japanese,
- * Chinese, Korean, Mongolian.
- *
- * @return true if this orientation has horizontal lines
- */
- public boolean isHorizontal()
- {
- return (orientation & HORIZONTAL_ID) != 0;
- }
-
- /**
- * If isHorizontal() returns true, then this determines whether items in
- * the line flow left-to-right. If isHorizontal() returns false, items in
- * a line flow top-to-bottom, and this determines if lines flow
- * left-to-right.
- *
- * @return true if this orientation flows left-to-right
- */
- public boolean isLeftToRight()
- {
- return (orientation & LEFT_TO_RIGHT_ID) != 0;
- }
-
- /**
- * Gets an orientation appropriate for the locale.
- *
- * @param locale the locale
- * @return the orientation for that locale
- * @throws NullPointerException if locale is null
- */
- public static ComponentOrientation getOrientation(Locale locale)
- {
- // Based on iterating over all languages defined in JDK 1.4, this behavior
- // matches Sun's. However, it makes me wonder if any non-horizontal
- // orientations even exist, as it sure contradicts their documentation.
- String language = locale.getLanguage();
- if ("ar".equals(language) || "fa".equals(language) || "iw".equals(language)
- || "ur".equals(language))
- return RIGHT_TO_LEFT;
- return LEFT_TO_RIGHT;
- }
-
- /**
- * Gets an orientation from a resource bundle. This tries the following:
- *
- * Since this can expose pixels to untrusted code, there is a security
- * check on custom objects, It is valid for a dimension to have negative width or height; but it
- * is considered to have no area. Therefore, the behavior in various methods
- * is undefined in such a case.
- *
- * There are some public fields; if you mess with them in an inconsistent
- * manner, it is your own fault when you get invalid results. Also, this
- * class is not threadsafe.
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Component
- * @see LayoutManager
- * @since 1.0
- * @status updated to 1.14
- */
-public class Dimension extends Dimension2D implements Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 4723952579491349524L;
-
- /**
- * The width of this object.
- *
- * @see #getSize()
- * @see #setSize(double, double)
- * @serial the width
- */
- public int width;
-
- /**
- * The height of this object.
- *
- * @see #getSize()
- * @see #setSize(double, double)
- * @serial the height
- */
- public int height;
-
- /**
- * Create a new Dimension with a width and height of zero.
- */
- public Dimension()
- {
- }
-
- /**
- * Create a new Dimension with width and height identical to that of the
- * specified dimension.
- *
- * @param d the Dimension to copy
- * @throws NullPointerException if d is null
- */
- public Dimension(Dimension d)
- {
- width = d.width;
- height = d.height;
- }
-
- /**
- * Create a new Dimension with the specified width and height.
- *
- * @param w the width of this object
- * @param h the height of this object
- */
- public Dimension(int w, int h)
- {
- width = w;
- height = h;
- }
-
- /**
- * Gets the width of this dimension.
- *
- * @return the width, as a double
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Gets the height of this dimension.
- *
- * @return the height, as a double
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Sets the size of this dimension. The values are rounded to int.
- *
- * @param w the new width
- * @param h the new height
- * @since 1.2
- */
- public void setSize(double w, double h)
- {
- width = (int) w;
- height = (int) h;
- }
-
- /**
- * Returns the size of this dimension. A pretty useless method, as this is
- * already a dimension.
- *
- * @return a copy of this dimension
- * @see #setSize(Dimension)
- * @since 1.1
- */
- public Dimension getSize()
- {
- return new Dimension(width, height);
- }
-
- /**
- * Sets the width and height of this object to match that of the
- * specified object.
- *
- * @param d the Dimension to get the new width and height from
- * @throws NullPointerException if d is null
- * @see #getSize()
- * @since 1.1
- */
- public void setSize(Dimension d)
- {
- width = d.width;
- height = d.height;
- }
-
- /**
- * Sets the width and height of this object to the specified values.
- *
- * @param w the new width value
- * @param h the new height value
- */
- public void setSize(int w, int h)
- {
- width = w;
- height = h;
- }
-
- /**
- * Tests this object for equality against the specified object. This will
- * be true if and only if the specified object is an instance of
- * Dimension2D, and has the same width and height.
- *
- * @param obj the object to test against
- * @return true if the object is equal to this
- */
- public boolean equals(Object obj)
- {
- if (! (obj instanceof Dimension))
- return false;
- Dimension dim = (Dimension) obj;
- return height == dim.height && width == dim.width;
- }
-
- /**
- * Return the hashcode for this object. It is not documented, but appears
- * to be Specification Note: The Sun JavaDoc for J2SE 1.4 does
- * not indicate whether this value also subsumes OpenType. OpenType
- * is essentially the same format as TrueType, but allows to define
- * glyph shapes in the same way as PostScript, using cubic bezier
- * curves.
- *
- * @since 1.3
- */
- public static final int TRUETYPE_FONT = 0;
-
-
- /**
- * A flag for
- *
- * The style should be one of BOLD, ITALIC, or BOLDITALIC. The default
- * style if none is specified is PLAIN. The default size if none
- * is specified is 12.
- *
- * @param fontspec a string specifying the required font (
- * Virtual devices are supported (for example, in a multiple screen
- * environment, a virtual device covers all screens simultaneously); the
- * configuration will have a non-zero relative coordinate system in such
- * a case.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Window
- * @see Frame
- * @see GraphicsEnvironment
- * @see GraphicsDevice
- * @since 1.0
- * @status updated to 1.4
- */
-public abstract class GraphicsConfiguration
-{
- /**
- * The default constructor.
- *
- * @see GraphicsDevice#getConfigurations()
- * @see GraphicsDevice#getDefaultConfiguration()
- * @see GraphicsDevice#getBestConfiguration(GraphicsConfigTemplate)
- * @see Graphics2D#getDeviceConfiguration()
- */
- protected GraphicsConfiguration ()
- {
- }
-
- /**
- * Gets the associated device that this configuration describes.
- *
- * @return the device
- */
- public abstract GraphicsDevice getDevice();
-
- /**
- * Returns a buffered image optimized to this device, so that blitting can
- * be supported in the buffered image.
- *
- * @param w the width of the buffer
- * @param h the height of the buffer
- * @return the buffered image, or null if none is supported
- */
- public abstract BufferedImage createCompatibleImage(int w, int h);
-
- /**
- * Returns a buffered volatile image optimized to this device, so that
- * blitting can be supported in the buffered image. Because the buffer is
- * volatile, it can be optimized by native graphics accelerators.
- *
- * @param w the width of the buffer
- * @param h the height of the buffer
- * @return the buffered image, or null if none is supported
- * @see Component#createVolatileImage(int, int)
- * @since 1.4
- */
- public abstract VolatileImage createCompatibleVolatileImage(int w, int h);
-
- /**
- * Returns a buffered volatile image optimized to this device, and with the
- * given capabilities, so that blitting can be supported in the buffered
- * image. Because the buffer is volatile, it can be optimized by native
- * graphics accelerators.
- *
- * @param w the width of the buffer
- * @param h the height of the buffer
- * @param caps the desired capabilities of the image buffer
- * @return the buffered image, or null if none is supported
- * @throws AWTException if the capabilities cannot be met
- * @since 1.4
- */
- public VolatileImage createCompatibleVolatileImage(int w, int h,
- ImageCapabilities caps)
- throws AWTException
- {
- throw new AWTException("not implemented");
- }
-
- /**
- * Returns a buffered image optimized to this device, and with the specified
- * transparency, so that blitting can be supported in the buffered image.
- *
- * @param w the width of the buffer
- * @param h the height of the buffer
- * @param transparency the transparency of the buffer
- * @return the buffered image, or null if none is supported
- * @see Transparency#OPAQUE
- * @see Transparency#BITMASK
- * @see Transparency#TRANSLUCENT
- */
- public abstract BufferedImage createCompatibleImage(int w, int h,
- int transparency);
-
- /**
- * Gets the color model of the corresponding device.
- *
- * @return the color model
- */
- public abstract ColorModel getColorModel();
-
- /**
- * Gets a color model for the corresponding device which supports the desired
- * transparency level.
- *
- * @param transparency the transparency of the model
- * @return the color model, with transparency
- * @see Transparency#OPAQUE
- * @see Transparency#BITMASK
- * @see Transparency#TRANSLUCENT
- */
- public abstract ColorModel getColorModel(int transparency);
-
- /**
- * Returns a transform that maps user coordinates to device coordinates. The
- * preferred mapping is about 72 user units to 1 inch (2.54 cm) of physical
- * space. This is often the identity transform. The device coordinates have
- * the origin at the upper left, with increasing x to the right, and
- * increasing y to the bottom.
- *
- * @return the transformation from user space to device space
- * @see #getNormalizingTransform()
- */
- public abstract AffineTransform getDefaultTransform();
-
- /**
- * Returns a transform that maps user coordinates to device coordinates. The
- * exact mapping is 72 user units to 1 inch (2.54 cm) of physical space.
- * This is often the identity transform. The device coordinates have the
- * origin at the upper left, with increasing x to the right, and increasing
- * y to the bottom. Note that this is more accurate (and thus, sometimes more
- * costly) than the default transform.
- *
- * @return the normalized transformation from user space to device space
- * @see #getDefaultTransform()
- */
- public abstract AffineTransform getNormalizingTransform();
-
- /**
- * Returns the bounds of the configuration, in device coordinates. If this
- * is a virtual device (for example, encompassing several screens), the
- * bounds may have a non-zero origin.
- *
- * @return the device bounds
- * @since 1.3
- */
- public abstract Rectangle getBounds();
-
- /**
- * Returns the buffering capabilities of this configuration.
- *
- * @return the buffer capabilities
- * @since 1.4
- */
- public BufferCapabilities getBufferCapabilities()
- {
- throw new Error("not implemented");
- }
-
- /**
- * Returns the imaging capabilities of this configuration.
- *
- * @return the image capabilities
- * @since 1.4
- */
- public ImageCapabilities getImageCapabilities()
- {
- throw new Error("not implemented");
- }
-} // class GraphicsConfiguration
diff --git a/libjava/java/awt/GraphicsDevice.java b/libjava/java/awt/GraphicsDevice.java
deleted file mode 100644
index 581d02f0d41..00000000000
--- a/libjava/java/awt/GraphicsDevice.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/* GraphicsDevice.java -- information about a graphics device
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This describes a graphics device available to the given environment. This
- * includes screen and printer devices, and the different configurations for
- * each device. Also, this allows you to create virtual devices which operate
- * over a multi-screen environment.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see GraphicsEnvironment
- * @see GraphicsConfiguration
- * @since 1.3
- * @status updated to 1.4
- */
-public abstract class GraphicsDevice
-{
- /** Device is a raster screen. */
- public static final int TYPE_RASTER_SCREEN = 0;
-
- /** Device is a printer. */
- public static final int TYPE_PRINTER = 1;
-
- /** Device is an image buffer not visible to the user. */
- public static final int TYPE_IMAGE_BUFFER = 2;
-
- /** The current full-screen window, or null if there is none. */
- private Window full_screen;
-
- /**
- * The bounds of the fullscreen window before it has been switched to full
- * screen.
- */
- private Rectangle fullScreenOldBounds;
-
- /** The current display mode, or null if unknown. */
- private DisplayMode mode;
-
- /**
- * The default constructor.
- *
- * @see GraphicsEnvironment#getScreenDevices()
- * @see GraphicsEnvironment#getDefaultScreenDevice()
- * @see GraphicsConfiguration#getDevice()
- */
- protected GraphicsDevice()
- {
- }
-
- /**
- * Returns the type of the device.
- *
- * @return the device type
- * @see #TYPE_RASTER_SCREEN
- * @see #TYPE_PRINTER
- * @see #TYPE_IMAGE_BUFFER
- */
- public abstract int getType();
-
- /**
- * Returns an identification string for the device. This can be
- * vendor-specific, and may be useful for debugging.
- *
- * @return the identification
- */
- public abstract String getIDstring();
-
- /**
- * Return all configurations valid for this device.
- *
- * @return an array of configurations
- */
- public abstract GraphicsConfiguration[] getConfigurations();
-
- /**
- * Return the default configuration for this device.
- *
- * @return the default configuration
- */
- public abstract GraphicsConfiguration getDefaultConfiguration();
-
- /**
- * Return the best configuration, according to the criteria in the given
- * template.
- *
- * @param template the template to adjust by
- * @return the best configuration
- * @throws NullPointerException if template is null
- */
- public GraphicsConfiguration getBestConfiguration
- (GraphicsConfigTemplate template)
- {
- return template.getBestConfiguration(getConfigurations());
- }
-
- /**
- * Returns true if the device supports full-screen exclusive mode. The
- * default implementation returns true; subclass it if this is not the case.
- *
- * @return true if full screen support is available
- * @since 1.4
- */
- public boolean isFullScreenSupported()
- {
- return true;
- }
-
- /**
- * Toggle the given window between full screen and normal mode. The previous
- * full-screen window, if different, is restored; if the given window is
- * null, no window will be full screen. If
- * By default, the KeyboardFocusManager is the sink for all key events not
- * dispatched by other dispatchers. Therefore, it is unnecessary for the user
- * to register the focus manager as a dispatcher.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)
- * @see KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)
- * @since 1.4
- * @status updated to 1.4
- */
-public interface KeyEventDispatcher
-{
- /**
- * Called by the KeyboardFocusManager to request that a key event be
- * dispatched. The dispatcher is free to retarget the event, consume it,
- * dispatch it, or make other changes. This is usually done to allow
- * delivery of key events to objects other than the window in focus, such
- * as for navigating non-focusable components. If this dispatcher chooses
- * to dispatch the event itself, it should call If the return value is false, the KeyEvent is passed to the next
- * dispatcher in the chain, ending with the KeyboardFocusManager. If the
- * return value is true, the event has been consumed (although it might
- * have been ignored), and no further action will be taken on the event. Be
- * sure to check whether the event was consumed before dispatching it
- * further.
- *
- * @param e the key event
- * @return true if the event has been consumed
- * @see KeyboardFocusManager#redispatchEvent(Component, AWTEvent)
- */
- boolean dispatchKeyEvent(KeyEvent e);
-} // interface KeyEventDispatcher
diff --git a/libjava/java/awt/KeyEventPostProcessor.java b/libjava/java/awt/KeyEventPostProcessor.java
deleted file mode 100644
index 0b39dc25075..00000000000
--- a/libjava/java/awt/KeyEventPostProcessor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* KeyEventPostProcessor.java -- performs actions after a key event dispatch
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.KeyEvent;
-
-/**
- * An instance of this interface coordinates with a KeyboardFocusManager to
- * target and dispatch all key events that are otherwise unconsumed. This
- * allows events which take place when nothing has focus to still operate,
- * such as menu keyboard shortcuts.
- *
- * By default, the KeyboardFocusManager is the sink for all key events not
- * post-processed elsewhere. Therefore, it is unnecessary for the user
- * to register the focus manager as a dispatcher.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)
- * @see KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)
- * @since 1.4
- * @status updated to 1.4
- */
-public interface KeyEventPostProcessor
-{
- /**
- * Called by the KeyboardFocusManager to request that a key event be
- * post-processed. Typically, the event has already been dispatched and
- * handled, unless no object has focus. Thus, this allows global event
- * handling for things like menu shortcuts. If this post-processor chooses
- * to dispatch the event, it should call If the return value is false, the KeyEvent is passed to the next
- * dispatcher in the chain, ending with the KeyboardFocusManager. If the
- * return value is true, the event has been consumed (although it might
- * have been ignored), and no further action will be taken on the event. Be
- * sure to check whether the event was consumed before dispatching it
- * further.
- *
- * @param e the key event
- * @return true if the event has been consumed
- * @see KeyboardFocusManager#redispatchEvent(Component, AWTEvent)
- */
- boolean postProcessKeyEvent(KeyEvent e);
-} // interface KeyEventPostProcessor
diff --git a/libjava/java/awt/KeyboardFocusManager.java b/libjava/java/awt/KeyboardFocusManager.java
deleted file mode 100644
index ab355456646..00000000000
--- a/libjava/java/awt/KeyboardFocusManager.java
+++ /dev/null
@@ -1,1436 +0,0 @@
-/* KeyboardFocusManager.java -- manage component focusing via the keyboard
- Copyright (C) 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.FocusEvent;
-import java.awt.event.KeyEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.beans.PropertyVetoException;
-import java.beans.VetoableChangeListener;
-import java.beans.VetoableChangeSupport;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * The There are some public fields; if you mess with them in an inconsistent
- * manner, it is your own fault when you get invalid results. Also, this
- * class is not threadsafe.
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public class Point extends Point2D implements Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -5276940640259749850L;
-
- /**
- * The x coordinate.
- *
- * @see #getLocation()
- * @see #move(int, int)
- * @serial the X coordinate of the point
- */
- public int x;
-
- /**
- * The y coordinate.
- *
- * @see #getLocation()
- * @see #move(int, int)
- * @serial The Y coordinate of the point
- */
- public int y;
-
- /**
- * Initializes a new instance of There are some public fields; if you mess with them in an inconsistent
- * manner, it is your own fault when you get NullPointerException,
- * ArrayIndexOutOfBoundsException, or invalid results. Also, this class is
- * not threadsafe.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public class Polygon implements Shape, Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -6460061437900069969L;
-
- /**
- * This total number of endpoints.
- *
- * @serial the number of endpoints, possibly less than the array sizes
- */
- public int npoints;
-
- /**
- * The array of X coordinates of endpoints. This should not be null.
- *
- * @see #addPoint(int, int)
- * @serial the x coordinates
- */
- public int[] xpoints;
-
- /**
- * The array of Y coordinates of endpoints. This should not be null.
- *
- * @see #addPoint(int, int)
- * @serial the y coordinates
- */
- public int[] ypoints;
-
- /**
- * The bounding box of this polygon. This is lazily created and cached, so
- * it must be invalidated after changing points.
- *
- * @see #getBounds()
- * @serial the bounding box, or null
- */
- protected Rectangle bounds;
-
- /** A big number, but not so big it can't survive a few float operations */
- private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
-
- /**
- * Initializes an empty polygon.
- */
- public Polygon()
- {
- // Leave room for growth.
- xpoints = new int[4];
- ypoints = new int[4];
- }
-
- /**
- * Create a new polygon with the specified endpoints. The arrays are copied,
- * so that future modifications to the parameters do not affect the polygon.
- *
- * @param xpoints the array of X coordinates for this polygon
- * @param ypoints the array of Y coordinates for this polygon
- * @param npoints the total number of endpoints in this polygon
- * @throws NegativeArraySizeException if npoints is negative
- * @throws IndexOutOfBoundsException if npoints exceeds either array
- * @throws NullPointerException if xpoints or ypoints is null
- */
- public Polygon(int[] xpoints, int[] ypoints, int npoints)
- {
- this.xpoints = new int[npoints];
- this.ypoints = new int[npoints];
- System.arraycopy(xpoints, 0, this.xpoints, 0, npoints);
- System.arraycopy(ypoints, 0, this.ypoints, 0, npoints);
- this.npoints = npoints;
- }
-
- /**
- * Reset the polygon to be empty. The arrays are left alone, to avoid object
- * allocation, but the number of points is set to 0, and all cached data
- * is discarded. If you are discarding a huge number of points, it may be
- * more efficient to just create a new Polygon.
- *
- * @see #invalidate()
- * @since 1.4
- */
- public void reset()
- {
- npoints = 0;
- invalidate();
- }
-
- /**
- * Invalidate or flush all cached data. After direct manipulation of the
- * public member fields, this is necessary to avoid inconsistent results
- * in methods like It is valid for a rectangle to have negative width or height; but it
- * is considered to have no area or internal points. Therefore, the behavior
- * in methods like There are some public fields; if you mess with them in an inconsistent
- * manner, it is your own fault when you get NullPointerException,
- * ArrayIndexOutOfBoundsException, or invalid results. Also, this class is
- * not threadsafe.
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public class Rectangle extends Rectangle2D implements Shape, Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -4345857070255674764L;
-
- /**
- * The X coordinate of the top-left corner of the rectangle.
- *
- * @see #setLocation(int, int)
- * @see #getLocation()
- * @serial the x coordinate
- */
- public int x;
-
- /**
- * The Y coordinate of the top-left corner of the rectangle.
- *
- * @see #setLocation(int, int)
- * @see #getLocation()
- * @serial the y coordinate
- */
- public int y;
-
- /**
- * The width of the rectangle.
- *
- * @see #setSize(int, int)
- * @see #getSize()
- * @serial
- */
- public int width;
-
- /**
- * The height of the rectangle.
- *
- * @see #setSize(int, int)
- * @see #getSize()
- * @serial
- */
- public int height;
-
- /**
- * Initializes a new instance of
- *
- *
- *
- *
- *
- *
- *
- *
- * A point is inside if it is completely inside, or on the boundary and
- * adjacent points in the increasing x or y direction are completely inside.
- * Unclosed shapes are considered as implicitly closed when performing
- * If the optional transform is provided, the iterator is transformed
- * accordingly. Each call returns a new object, independent from others in
- * use. It is recommended, but not required, that the Shape isolate
- * iterations from future changes to the boundary, and document this fact.
- *
- * @param transform an optional transform to apply to the iterator
- * @param flatness the maximum distance for deviation from the real boundary
- * @return a new iterator over the boundary
- * @since 1.2
- */
- PathIterator getPathIterator(AffineTransform transform, double flatness);
-} // interface Shape
diff --git a/libjava/java/awt/Stroke.java b/libjava/java/awt/Stroke.java
deleted file mode 100644
index 1a4c61cfb1f..00000000000
--- a/libjava/java/awt/Stroke.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Stroke.java -- a stroked outline of a shape
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This interface allows a Graphics2D to grab the outline of a shape, as if
- * stroked by a marking pen of appropriate size and shape. The area inked
- * by the pen is the area of this stroke. Anything in the graphic which
- * traces an outline will use this stroke, such as Despite the word “System” in the name of this
- * method, a toolkit may provide different event queues for each
- * applet. There is no guarantee that the same queue is shared
- * system-wide.
- *
- * The implementation first checks whether a
- * SecurityManager has been installed. If so, its {@link
- * java.lang.SecurityManager#checkAwtEventQueueAccess()} method gets
- * called. The security manager will throw a SecurityException if it
- * does not grant the permission to access the event queue.
- *
- * Next, the call is delegated to {@link
- * #getSystemEventQueueImpl()}.
- *
- * @return The event queue for this applet (or application).
- *
- * @throws SecurityException if a security manager has been
- * installed, and it does not grant the permission to access the
- * event queue.
- */
- public final EventQueue getSystemEventQueue()
- {
- SecurityManager sm;
-
- sm = System.getSecurityManager();
- if (sm != null)
- sm.checkAwtEventQueueAccess();
-
- return getSystemEventQueueImpl();
- }
-
-
- /**
- * Returns the event queue that is suitable for the calling context.
- *
- * Despite the word “System” in the name of this
- * method, a toolkit may provide different event queues for each
- * applet. There is no guarantee that the same queue is shared
- * system-wide.
- *
- * No security checks are performed, which is why this method
- * may only be called by Toolkits.
- *
- * @see #getSystemEventQueue()
- */
- protected abstract EventQueue getSystemEventQueueImpl();
-
-
- /**
- * @since 1.3
- */
- public abstract DragSourceContextPeer
- createDragSourceContextPeer(DragGestureEvent e);
-
- /**
- * @since 1.3
- */
- public DragGestureRecognizer
- createDragGestureRecognizer(Class recognizer, DragSource ds,
- Component comp, int actions,
- DragGestureListener l)
- {
- return null;
- }
-
- public final Object getDesktopProperty(String propertyName)
- {
- return desktopProperties.get(propertyName);
- }
-
- protected final void setDesktopProperty(String name, Object newValue)
- {
- Object oldValue = getDesktopProperty(name);
- desktopProperties.put(name, newValue);
- desktopPropsSupport.firePropertyChange(name, oldValue, newValue);
- }
-
- protected Object lazilyLoadDesktopProperty(String name)
- {
- // FIXME - what is this??
- return null;
- }
-
- protected void initializeDesktopProperties()
- {
- // Overridden by toolkit implementation?
- }
-
- public void addPropertyChangeListener(String name,
- PropertyChangeListener pcl)
- {
- desktopPropsSupport.addPropertyChangeListener(name, pcl);
- }
-
- public void removePropertyChangeListener(String name,
- PropertyChangeListener pcl)
- {
- desktopPropsSupport.removePropertyChangeListener(name, pcl);
- }
-
- /**
- * @since 1.4
- */
- public PropertyChangeListener[] getPropertyChangeListeners()
- {
- return desktopPropsSupport.getPropertyChangeListeners();
- }
-
- /**
- * @since 1.4
- */
- public PropertyChangeListener[] getPropertyChangeListeners(String name)
- {
- return desktopPropsSupport.getPropertyChangeListeners(name);
- }
-
- public void addAWTEventListener(AWTEventListener listener, long eventMask)
- {
- // SecurityManager s = System.getSecurityManager();
- // if (s != null)
- // s.checkPermission(AWTPermission("listenToAllAWTEvents"));
- // FIXME
- }
-
- public void removeAWTEventListener(AWTEventListener listener)
- {
- // FIXME
- }
-
- /**
- * @since 1.4
- */
- public AWTEventListener[] getAWTEventListeners()
- {
- return null;
- }
-
- /**
- * @since 1.4
- */
- public AWTEventListener[] getAWTEventListeners(long mask)
- {
- return null;
- }
-
- /**
- * @since 1.3
- */
- public abstract Map mapInputMethodHighlight(InputMethodHighlight highlight);
-} // class Toolkit
diff --git a/libjava/java/awt/Transparency.java b/libjava/java/awt/Transparency.java
deleted file mode 100644
index 88858717693..00000000000
--- a/libjava/java/awt/Transparency.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Transparency.java -- common transparency modes in graphics
- Copyright (C) 2000, 2002, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt;
-
-/**
- * A common transparency mode for layering graphics.
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public interface Transparency
-{
- /** Image data which is completely opaque, for an alpha value of 1.0. */
- int OPAQUE = 1;
-
- /**
- * Image data which is either completely opaque or transparent, for an
- * exact integer alpha value.
- */
- int BITMASK = 2;
-
- /** Image data which is translucent, for a non-integer alpha value. */
- int TRANSLUCENT = 3;
-
- /**
- * Return the transparency type.
- *
- * @return One of {@link #OPAQUE}, {@link #BITMASK}, or {@link #TRANSLUCENT}.
- */
- int getTransparency();
-} // interface Transparency
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
deleted file mode 100644
index 87b6c5767c5..00000000000
--- a/libjava/java/awt/Window.java
+++ /dev/null
@@ -1,1132 +0,0 @@
-/* Window.java --
- Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowFocusListener;
-import java.awt.event.WindowListener;
-import java.awt.event.WindowStateListener;
-import java.awt.image.BufferStrategy;
-import java.awt.peer.WindowPeer;
-import java.lang.ref.Reference;
-import java.lang.ref.WeakReference;
-import java.util.EventListener;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-
-/**
- * This class represents a top-level window with no decorations.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class Window extends Container implements Accessible
-{
- private static final long serialVersionUID = 4497834738069338734L;
-
- // Serialized fields, from Sun's serialization spec.
- private String warningString = null;
- private int windowSerializedDataVersion = 0; // FIXME
- /** @since 1.2 */
- // private FocusManager focusMgr; // FIXME: what is this?
- /** @since 1.2 */
- private int state = 0;
- /** @since 1.4 */
- private boolean focusableWindowState = true;
-
- // A list of other top-level windows owned by this window.
- private transient Vector ownedWindows = new Vector();
-
- private transient WindowListener windowListener;
- private transient WindowFocusListener windowFocusListener;
- private transient WindowStateListener windowStateListener;
- private transient GraphicsConfiguration graphicsConfiguration;
-
- private transient boolean shown;
-
- // This is package-private to avoid an accessor method.
- transient Component windowFocusOwner;
-
- /*
- * The number used to generate the name returned by getName.
- */
- private static transient long next_window_number;
-
- protected class AccessibleAWTWindow extends AccessibleAWTContainer
- {
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.WINDOW;
- }
-
- public AccessibleStateSet getAccessibleStateSet()
- {
- AccessibleStateSet states = super.getAccessibleStateSet();
- if (isActive())
- states.add(AccessibleState.ACTIVE);
- return states;
- }
- }
-
- /**
- * This (package access) constructor is used by subclasses that want
- * to build windows that do not have parents. Eg. toplevel
- * application frames. Subclasses cannot call super(null), since
- * null is an illegal argument.
- */
- Window()
- {
- visible = false;
- // Windows are the only Containers that default to being focus
- // cycle roots.
- focusCycleRoot = true;
- setLayout(new BorderLayout());
-
- addWindowFocusListener (new WindowAdapter ()
- {
- public void windowGainedFocus (WindowEvent event)
- {
- if (windowFocusOwner != null)
- {
- // FIXME: move this section and the other similar
- // sections in Component into a separate method.
- 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));
- }
- }
- }
- });
- }
-
- Window(GraphicsConfiguration gc)
- {
- this();
- graphicsConfiguration = gc;
- }
-
- /**
- * Initializes a new instance of
- * There are two types of hierarchy events. The first type is handled by
- * HierarchyListener, and includes addition or removal of an ancestor, or
- * an ancestor changing its on-screen status (visible and/or displayble). The
- * second type is handled by HierarchyBoundsListener, and includes resizing
- * or moving of an ancestor.
- *
- * @author Bryce McKinlay
- * @see HierarchyListener
- * @see HierarchyBoundsAdapter
- * @see HierarchyBoundsListener
- * @since 1.3
- * @status updated to 1.4
- */
-public class HierarchyEvent extends AWTEvent
-{
- /**
- * Compatible with JDK 1.3+.
- */
- private static final long serialVersionUID = -5337576970038043990L;
-
- /** This is the first id in the range of ids used by this class. */
- public static final int HIERARCHY_FIRST = 1400;
-
- /** This id indicates that the hierarchy tree changed. */
- public static final int HIERARCHY_CHANGED = 1400;
-
- /** This id indicates that an ancestor was moved. */
- public static final int ANCESTOR_MOVED = 1401;
-
- /** This id indicates that an ancestor was resized. */
- public static final int ANCESTOR_RESIZED = 1402;
-
- /** This is the last id in the range of ids used by this class. */
- public static final int HIERARCHY_LAST = 1402;
-
- /** This indicates that the HIERARCHY_CHANGED is a changed parent. */
- public static final int PARENT_CHANGED = 1;
-
- /**
- * This indicates that the HIERARCHY_CHANGED is caused by a change in
- * displayability.
- *
- * @see Component#isDisplayable()
- * @see Component#addNotify()
- * @see Component#removeNotify()
- */
- public static final int DISPLAYABILITY_CHANGED = 2;
-
- /**
- * This indicates that the HIERARCHY_CHANGED is a changed visibility.
- *
- * @see Component#isShowing()
- * @see Component#addNotify()
- * @see Component#removeNotify()
- * @see Component#show()
- * @see Component#hide()
- */
- public static final int SHOWING_CHANGED = 4;
-
- /**
- * The component at the top of the changed hierarchy.
- *
- * @serial the top component changed
- */
- private final Component changed;
-
- /**
- * The parent of this component, either before or after the change depending
- * on the type of change.
- *
- * @serial the parent component changed
- */
- private final Container changedParent;
-
- /**
- * The bitmask of HIERARCHY_CHANGED event types.
- *
- * @serial the change flags
- */
- private final long changeFlags;
-
- /**
- * Initializes a new instance of For an example of checking multiple modifiers, this code will return
- * true only if SHIFT and BUTTON1 were pressed and CTRL was not:
- * "Key typed" events are higher-level, and have already
- * compensated for modifiers and keyboard layout to generate a single Unicode
- * character. It may take several key press events to generate one key typed.
- * The "Key pressed" and "key released" events are lower-level, and
- * are platform and keyboard dependent. They correspond to the actaul motion
- * on a keyboard, and return a virtual key code which labels the key that was
- * pressed. The Some keys do not generate key typed events, such as the F1 or HELP keys.
- * Not all keyboards can generate all virtual keys, and no attempt is made to
- * simulate the ones that can't be typed. Virtual keys correspond to the
- * keyboard layout, so for example, VK_Q in English is VK_A in French. Also,
- * there are some additional virtual keys to ease handling of actions, such
- * as VK_ALL_CANDIDATES in place of ALT+VK_CONVERT. Do not rely on the value
- * of the VK_* constants, except for VK_ENTER, VK_BACK_SPACE, and VK_TAB.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see KeyAdapter
- * @see KeyListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class KeyEvent extends InputEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -2352130953028126954L;
-
- /** This is the first id in the range of event ids used by this class. */
- public static final int KEY_FIRST = 400;
-
- /** This is the last id in the range of event ids used by this class. */
- public static final int KEY_LAST = 402;
-
- /**
- * This event id indicates a key was typed, which is a key press followed
- * by a key release to generate an actual Unicode character. It may take
- * several key presses to generate one key typed event, and some action
- * keys have no corresponding key typed.
- */
- public static final int KEY_TYPED = 400;
-
- /** This event id indicates a key was pressed. */
- public static final int KEY_PRESSED = 401;
-
- /** This event it indicates a key was released. */
- public static final int KEY_RELEASED = 402;
-
- /** The virtual key Enter, which will always map to '\n'. */
- public static final int VK_ENTER = '\n';
-
- /** The virtual key Backspace, which will always map to '\b'. */
- public static final int VK_BACK_SPACE = '\b';
-
- /** The virtual key Tab, which will always map to '\t'. */
- public static final int VK_TAB = '\t';
-
- /** The virtual key Cancel. */
- public static final int VK_CANCEL = 3;
-
- /** The virtual key VK_CLEAR. */
- public static final int VK_CLEAR = 12;
-
- /** The virtual key VK_SHIFT. */
- public static final int VK_SHIFT = 16;
-
- /** The virtual key VK_CONTROL. */
- public static final int VK_CONTROL = 17;
-
- /** The virtual key VK_ALT. */
- public static final int VK_ALT = 18;
-
- /** The virtual key VK_PAUSE. */
- public static final int VK_PAUSE = 19;
-
- /** The virtual key VK_CAPS_LOCK. */
- public static final int VK_CAPS_LOCK = 20;
-
- /** The virtual key VK_ESCAPE. */
- public static final int VK_ESCAPE = 27;
-
- /** The virtual key VK_SPACE. */
- public static final int VK_SPACE = ' ';
-
- /** The virtual key VK_PAGE_UP. */
- public static final int VK_PAGE_UP = 33;
-
- /** The virtual key VK_PAGE_DOWN. */
- public static final int VK_PAGE_DOWN = 34;
-
- /** The virtual key VK_END. */
- public static final int VK_END = 35;
-
- /** The virtual key VK_HOME. */
- public static final int VK_HOME = 36;
-
- /**
- * The virtual key for the non-numpad VK_LEFT.
- *
- * @see #VK_KP_LEFT
- */
- public static final int VK_LEFT = 37;
-
- /**
- * The virtual key for the non-numpad VK_UP.
- *
- * @see #VK_KP_UP
- */
- public static final int VK_UP = 38;
-
- /**
- * The virtual key for the non-numpad VK_RIGHT.
- *
- * @see #VK_KP_RIGHT
- */
- public static final int VK_RIGHT = 39;
-
- /**
- * The virtual key for the non-numpad VK_DOWN.
- *
- * @see #VK_KP_DOWN
- */
- public static final int VK_DOWN = 40;
-
- /** The virtual key VK_COMMA. */
- public static final int VK_COMMA = ',';
-
- /**
- * The virtual key VK_MINUS.
- *
- * @since 1.2
- */
- public static final int VK_MINUS = '-';
-
- /** The virtual key VK_PERIOD. */
- public static final int VK_PERIOD = '.';
-
- /** The virtual key VK_SLASH. */
- public static final int VK_SLASH = '/';
-
- /** The virtual key VK_0. */
- public static final int VK_0 = '0';
-
- /** The virtual key VK_1. */
- public static final int VK_1 = '1';
-
- /** The virtual key VK_2. */
- public static final int VK_2 = '2';
-
- /** The virtual key VK_3. */
- public static final int VK_3 = '3';
-
- /** The virtual key VK_4. */
- public static final int VK_4 = '4';
-
- /** The virtual key VK_5. */
- public static final int VK_5 = '5';
-
- /** The virtual key VK_6. */
- public static final int VK_6 = '6';
-
- /** The virtual key VK_7. */
- public static final int VK_7 = '7';
-
- /** The virtual key VK_8. */
- public static final int VK_8 = '8';
-
- /** The virtual key VK_9. */
- public static final int VK_9 = '9';
-
- /** The virtual key VK_SEMICOLON. */
- public static final int VK_SEMICOLON = ';';
-
- /** The virtual key VK_EQUALS. */
- public static final int VK_EQUALS = '=';
-
- /** The virtual key VK_A. */
- public static final int VK_A = 'A';
-
- /** The virtual key VK_B. */
- public static final int VK_B = 'B';
-
- /** The virtual key VK_C. */
- public static final int VK_C = 'C';
-
- /** The virtual key VK_D. */
- public static final int VK_D = 'D';
-
- /** The virtual key VK_E. */
- public static final int VK_E = 'E';
-
- /** The virtual key VK_F. */
- public static final int VK_F = 'F';
-
- /** The virtual key VK_G. */
- public static final int VK_G = 'G';
-
- /** The virtual key VK_H. */
- public static final int VK_H = 'H';
-
- /** The virtual key VK_I. */
- public static final int VK_I = 'I';
-
- /** The virtual key VK_J. */
- public static final int VK_J = 'J';
-
- /** The virtual key VK_K. */
- public static final int VK_K = 'K';
-
- /** The virtual key VK_L. */
- public static final int VK_L = 'L';
-
- /** The virtual key VK_M. */
- public static final int VK_M = 'M';
-
- /** The virtual key VK_N. */
- public static final int VK_N = 'N';
-
- /** The virtual key VK_O. */
- public static final int VK_O = 'O';
-
- /** The virtual key VK_P. */
- public static final int VK_P = 'P';
-
- /** The virtual key VK_Q. */
- public static final int VK_Q = 'Q';
-
- /** The virtual key VK_R. */
- public static final int VK_R = 'R';
-
- /** The virtual key VK_S. */
- public static final int VK_S = 'S';
-
- /** The virtual key VK_T. */
- public static final int VK_T = 'T';
-
- /** The virtual key VK_U. */
- public static final int VK_U = 'U';
-
- /** The virtual key VK_V. */
- public static final int VK_V = 'V';
-
- /** The virtual key VK_W. */
- public static final int VK_W = 'W';
-
- /** The virtual key VK_X. */
- public static final int VK_X = 'X';
-
- /** The virtual key VK_Y. */
- public static final int VK_Y = 'Y';
-
- /** The virtual key VK_Z. */
- public static final int VK_Z = 'Z';
-
- /** The virtual key VK_OPEN_BRACKET. */
- public static final int VK_OPEN_BRACKET = '[';
-
- /** The virtual key VK_BACK_SLASH. */
- public static final int VK_BACK_SLASH = '\\';
-
- /** The virtual key VK_CLOSE_BRACKET. */
- public static final int VK_CLOSE_BRACKET = ']';
-
- /** The virtual key VK_NUMPAD0. */
- public static final int VK_NUMPAD0 = 96;
-
- /** The virtual key VK_NUMPAD1. */
- public static final int VK_NUMPAD1 = 97;
-
- /** The virtual key VK_NUMPAD2. */
- public static final int VK_NUMPAD2 = 98;
-
- /** The virtual key VK_NUMPAD3. */
- public static final int VK_NUMPAD3 = 99;
-
- /** The virtual key VK_NUMPAD4. */
- public static final int VK_NUMPAD4 = 100;
-
- /** The virtual key VK_NUMPAD5. */
- public static final int VK_NUMPAD5 = 101;
-
- /** The virtual key VK_NUMPAD6. */
- public static final int VK_NUMPAD6 = 102;
-
- /** The virtual key VK_NUMPAD7. */
- public static final int VK_NUMPAD7 = 103;
-
- /** The virtual key VK_NUMPAD8. */
- public static final int VK_NUMPAD8 = 104;
-
- /** The virtual key VK_NUMPAD9. */
- public static final int VK_NUMPAD9 = 105;
-
- /** The virtual key VK_MULTIPLY. */
- public static final int VK_MULTIPLY = 106;
-
- /** The virtual key VK_ADD. */
- public static final int VK_ADD = 107;
-
- /**
- * The virtual key VK_SEPARATOR, handily mispelled for those who can't
- * figure it out.
- *
- * @deprecated use {@link #VK_SEPARATOR}
- */
- public static final int VK_SEPARATER = 108;
-
- /**
- * The virtual key VK_SEPARATOR.
- *
- * @since 1.4
- */
- public static final int VK_SEPARATOR = 108;
-
- /** The virtual key VK_SUBTRACT. */
- public static final int VK_SUBTRACT = 109;
-
- /** The virtual key VK_DECIMAL. */
- public static final int VK_DECIMAL = 110;
-
- /** The virtual key VK_DIVIDE. */
- public static final int VK_DIVIDE = 111;
-
- /** The virtual key VK_DELETE. */
- public static final int VK_DELETE = 127;
-
- /** The virtual key VK_NUM_LOCK. */
- public static final int VK_NUM_LOCK = 144;
-
- /** The virtual key VK_SCROLL_LOCK. */
- public static final int VK_SCROLL_LOCK = 145;
-
- /** The virtual key VK_F1. */
- public static final int VK_F1 = 112;
-
- /** The virtual key VK_F2. */
- public static final int VK_F2 = 113;
-
- /** The virtual key VK_F3. */
- public static final int VK_F3 = 114;
-
- /** The virtual key VK_F4. */
- public static final int VK_F4 = 115;
-
- /** The virtual key VK_F5. */
- public static final int VK_F5 = 116;
-
- /** The virtual key VK_F6. */
- public static final int VK_F6 = 117;
-
- /** The virtual key VK_F7. */
- public static final int VK_F7 = 118;
-
- /** The virtual key VK_F8. */
- public static final int VK_F8 = 119;
-
- /** The virtual key VK_F9. */
- public static final int VK_F9 = 120;
-
- /** The virtual key VK_F10. */
- public static final int VK_F10 = 121;
-
- /** The virtual key VK_F11. */
- public static final int VK_F11 = 122;
-
- /** The virtual key VK_F12. */
- public static final int VK_F12 = 123;
-
- /**
- * The virtual key VK_F13.
- *
- * @since 1.2
- */
- public static final int VK_F13 = 61440;
-
- /**
- * The virtual key VK_F14.
- *
- * @since 1.2
- */
- public static final int VK_F14 = 61441;
-
- /**
- * The virtual key VK_F15.
- *
- * @since 1.2
- */
- public static final int VK_F15 = 61442;
-
- /**
- * The virtual key VK_F16.
- *
- * @since 1.2
- */
- public static final int VK_F16 = 61443;
-
- /**
- * The virtual key VK_F17.
- *
- * @since 1.2
- */
- public static final int VK_F17 = 61444;
-
- /**
- * The virtual key VK_F18.
- *
- * @since 1.2
- */
- public static final int VK_F18 = 61445;
-
- /**
- * The virtual key VK_F19.
- *
- * @since 1.2
- */
- public static final int VK_F19 = 61446;
-
- /**
- * The virtual key VK_F20.
- *
- * @since 1.2
- */
- public static final int VK_F20 = 61447;
-
- /**
- * The virtual key VK_F21.
- *
- * @since 1.2
- */
- public static final int VK_F21 = 61448;
-
- /**
- * The virtual key VK_F22.
- *
- * @since 1.2
- */
- public static final int VK_F22 = 61449;
-
- /**
- * The virtual key VK_F23.
- *
- * @since 1.2
- */
- public static final int VK_F23 = 61450;
-
- /**
- * The virtual key VK_F24.
- *
- * @since 1.2
- */
- public static final int VK_F24 = 61451;
-
- /** The virtual key VK_PRINTSCREEN. */
- public static final int VK_PRINTSCREEN = 154;
-
- /** The virtual key VK_INSERT. */
- public static final int VK_INSERT = 155;
-
- /** The virtual key VK_HELP. */
- public static final int VK_HELP = 156;
-
- /** The virtual key VK_META. */
- public static final int VK_META = 157;
-
- /** The virtual key VK_BACK_QUOTE. */
- public static final int VK_BACK_QUOTE = 192;
-
- /** The virtual key VK_QUOTE. */
- public static final int VK_QUOTE = 222;
-
- /**
- * The virtual key for the numpad VK_KP_UP.
- *
- * @see #VK_UP
- * @since 1.2
- */
- public static final int VK_KP_UP = 224;
-
- /**
- * The virtual key for the numpad VK_KP_DOWN.
- *
- * @see #VK_DOWN
- * @since 1.2
- */
- public static final int VK_KP_DOWN = 225;
-
- /**
- * The virtual key for the numpad VK_KP_LEFT.
- *
- * @see #VK_LEFT
- * @since 1.2
- */
- public static final int VK_KP_LEFT = 226;
-
- /**
- * The virtual key for the numpad VK_KP_RIGHT.
- *
- * @see #VK_RIGHT
- * @since 1.2
- */
- public static final int VK_KP_RIGHT = 227;
-
- /**
- * The virtual key VK_DEAD_GRAVE.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_GRAVE = 128;
-
- /**
- * The virtual key VK_DEAD_ACUTE.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_ACUTE = 129;
-
- /**
- * The virtual key VK_DEAD_CIRCUMFLEX.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_CIRCUMFLEX = 130;
-
- /**
- * The virtual key VK_DEAD_TILDE.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_TILDE = 131;
-
- /**
- * The virtual key VK_DEAD_MACRON.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_MACRON = 132;
-
- /**
- * The virtual key VK_DEAD_BREVE.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_BREVE = 133;
-
- /**
- * The virtual key VK_DEAD_ABOVEDOT.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_ABOVEDOT = 134;
-
- /**
- * The virtual key VK_DEAD_DIAERESIS.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_DIAERESIS = 135;
-
- /**
- * The virtual key VK_DEAD_ABOVERING.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_ABOVERING = 136;
-
- /**
- * The virtual key VK_DEAD_DOUBLEACUTE.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_DOUBLEACUTE = 137;
-
- /**
- * The virtual key VK_DEAD_CARON.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_CARON = 138;
-
- /**
- * The virtual key VK_DEAD_CEDILLA.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_CEDILLA = 139;
-
- /**
- * The virtual key VK_DEAD_OGONEK.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_OGONEK = 140;
-
- /**
- * The virtual key VK_DEAD_IOTA.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_IOTA = 141;
-
- /**
- * The virtual key VK_DEAD_VOICED_SOUND.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_VOICED_SOUND = 142;
-
- /**
- * The virtual key VK_DEAD_SEMIVOICED_SOUND.
- *
- * @since 1.2
- */
- public static final int VK_DEAD_SEMIVOICED_SOUND = 143;
-
- /**
- * The virtual key VK_AMPERSAND.
- *
- * @since 1.2
- */
- public static final int VK_AMPERSAND = 150;
-
- /**
- * The virtual key VK_ASTERISK.
- *
- * @since 1.2
- */
- public static final int VK_ASTERISK = 151;
-
- /**
- * The virtual key VK_QUOTEDBL.
- *
- * @since 1.2
- */
- public static final int VK_QUOTEDBL = 152;
-
- /**
- * The virtual key VK_LESS.
- *
- * @since 1.2
- */
- public static final int VK_LESS = 153;
-
- /**
- * The virtual key VK_GREATER.
- *
- * @since 1.2
- */
- public static final int VK_GREATER = 160;
-
- /**
- * The virtual key VK_BRACELEFT.
- *
- * @since 1.2
- */
- public static final int VK_BRACELEFT = 161;
-
- /**
- * The virtual key VK_BRACERIGHT.
- *
- * @since 1.2
- */
- public static final int VK_BRACERIGHT = 162;
-
- /**
- * The virtual key VK_AT.
- *
- * @since 1.2
- */
- public static final int VK_AT = 512;
-
- /**
- * The virtual key VK_COLON.
- *
- * @since 1.2
- */
- public static final int VK_COLON = 513;
-
- /**
- * The virtual key VK_CIRCUMFLEX.
- *
- * @since 1.2
- */
- public static final int VK_CIRCUMFLEX = 514;
-
- /**
- * The virtual key VK_DOLLAR.
- *
- * @since 1.2
- */
- public static final int VK_DOLLAR = 515;
-
- /**
- * The virtual key VK_EURO_SIGN.
- *
- * @since 1.2
- */
- public static final int VK_EURO_SIGN = 516;
-
- /**
- * The virtual key VK_EXCLAMATION_MARK.
- *
- * @since 1.2
- */
- public static final int VK_EXCLAMATION_MARK = 517;
-
- /**
- * The virtual key VK_INVERTED_EXCLAMATION_MARK.
- *
- * @since 1.2
- */
- public static final int VK_INVERTED_EXCLAMATION_MARK = 518;
-
- /**
- * The virtual key VK_LEFT_PARENTHESIS.
- *
- * @since 1.2
- */
- public static final int VK_LEFT_PARENTHESIS = 519;
-
- /**
- * The virtual key VK_NUMBER_SIGN.
- *
- * @since 1.2
- */
- public static final int VK_NUMBER_SIGN = 520;
-
- /**
- * The virtual key VK_PLUS.
- *
- * @since 1.2
- */
- public static final int VK_PLUS = 521;
-
- /**
- * The virtual key VK_RIGHT_PARENTHESIS.
- *
- * @since 1.2
- */
- public static final int VK_RIGHT_PARENTHESIS = 522;
-
- /**
- * The virtual key VK_UNDERSCORE.
- *
- * @since 1.2
- */
- public static final int VK_UNDERSCORE = 523;
-
- /** The virtual key VK_FINAL. */
- public static final int VK_FINAL = 24;
-
- /** The virtual key VK_CONVERT. */
- public static final int VK_CONVERT = 28;
-
- /** The virtual key VK_NONCONVERT. */
- public static final int VK_NONCONVERT = 29;
-
- /** The virtual key VK_ACCEPT. */
- public static final int VK_ACCEPT = 30;
-
- /** The virtual key VK_MODECHANGE. */
- public static final int VK_MODECHANGE = 31;
-
- /** The virtual key VK_KANA. */
- public static final int VK_KANA = 21;
-
- /** The virtual key VK_KANJI. */
- public static final int VK_KANJI = 25;
-
- /**
- * The virtual key VK_ALPHANUMERIC.
- *
- * @since 1.2
- */
- public static final int VK_ALPHANUMERIC = 240;
-
- /**
- * The virtual key VK_KATAKANA.
- *
- * @since 1.2
- */
- public static final int VK_KATAKANA = 241;
-
- /**
- * The virtual key VK_HIRAGANA.
- *
- * @since 1.2
- */
- public static final int VK_HIRAGANA = 242;
-
- /**
- * The virtual key VK_FULL_WIDTH.
- *
- * @since 1.2
- */
- public static final int VK_FULL_WIDTH = 243;
-
- /**
- * The virtual key VK_HALF_WIDTH.
- *
- * @since 1.2
- */
- public static final int VK_HALF_WIDTH = 244;
-
- /**
- * The virtual key VK_ROMAN_CHARACTERS.
- *
- * @since 1.2
- */
- public static final int VK_ROMAN_CHARACTERS = 245;
-
- /**
- * The virtual key VK_ALL_CANDIDATES.
- *
- * @since 1.2
- */
- public static final int VK_ALL_CANDIDATES = 256;
-
- /**
- * The virtual key VK_PREVIOUS_CANDIDATE.
- *
- * @since 1.2
- */
- public static final int VK_PREVIOUS_CANDIDATE = 257;
-
- /**
- * The virtual key VK_CODE_INPUT.
- *
- * @since 1.2
- */
- public static final int VK_CODE_INPUT = 258;
-
- /**
- * The virtual key VK_JAPANESE_KATAKANA.
- *
- * @since 1.2
- */
- public static final int VK_JAPANESE_KATAKANA = 259;
-
- /**
- * The virtual key VK_JAPANESE_HIRAGANA.
- *
- * @since 1.2
- */
- public static final int VK_JAPANESE_HIRAGANA = 260;
-
- /**
- * The virtual key VK_JAPANESE_ROMAN.
- *
- * @since 1.2
- */
- public static final int VK_JAPANESE_ROMAN = 261;
-
- /**
- * The virtual key VK_KANA_LOCK.
- *
- * @since 1.3
- */
- public static final int VK_KANA_LOCK = 262;
-
- /**
- * The virtual key VK_INPUT_METHOD_ON_OFF.
- *
- * @since 1.3
- */
- public static final int VK_INPUT_METHOD_ON_OFF = 263;
-
- /**
- * The virtual key VK_CUT.
- *
- * @since 1.2
- */
- public static final int VK_CUT = 65489;
-
- /**
- * The virtual key VK_COPY.
- *
- * @since 1.2
- */
- public static final int VK_COPY = 65485;
-
- /**
- * The virtual key VK_PASTE.
- *
- * @since 1.2
- */
- public static final int VK_PASTE = 65487;
-
- /**
- * The virtual key VK_UNDO.
- *
- * @since 1.2
- */
- public static final int VK_UNDO = 65483;
-
- /**
- * The virtual key VK_AGAIN.
- *
- * @since 1.2
- */
- public static final int VK_AGAIN = 65481;
-
- /**
- * The virtual key VK_FIND.
- *
- * @since 1.2
- */
- public static final int VK_FIND = 65488;
-
- /**
- * The virtual key VK_PROPS.
- *
- * @since 1.2
- */
- public static final int VK_PROPS = 65482;
-
- /**
- * The virtual key VK_STOP.
- *
- * @since 1.2
- */
- public static final int VK_STOP = 65480;
-
- /**
- * The virtual key VK_COMPOSE.
- *
- * @since 1.2
- */
- public static final int VK_COMPOSE = 65312;
-
- /**
- * The virtual key VK_ALT_GRAPH.
- *
- * @since 1.2
- */
- public static final int VK_ALT_GRAPH = 65406;
-
- /**
- * The virtual key VK_UNDEFINED. This is used for key typed events, which
- * do not have a virtual key.
- */
- public static final int VK_UNDEFINED = 0;
-
- /**
- * The only char with no valid Unicode interpretation. This is used for
- * key pressed and key released events which do not have a valid keyChar.
- */
- public static final char CHAR_UNDEFINED = '\uffff';
-
- /**
- * Indicates unknown or irrelavent key location. This is also used for
- * key typed events, which do not need a location.
- *
- * @since 1.4
- */
- public static final int KEY_LOCATION_UNKNOWN = 0;
-
- /**
- * Indicates a standard key location, with no left/right variants and not
- * on the numeric pad.
- *
- * @since 1.4
- */
- public static final int KEY_LOCATION_STANDARD = 1;
-
- /**
- * Indicates the key is on the left side of the keyboard, such as the left
- * shift.
- *
- * @since 1.4
- */
- public static final int KEY_LOCATION_LEFT = 2;
-
- /**
- * Indicates the key is on the right side of the keyboard, such as the right
- * shift.
- *
- * @since 1.4
- */
- public static final int KEY_LOCATION_RIGHT = 3;
-
- /**
- * Indicates the key is on the numeric pad, such as the numpad 0.
- *
- * @since 1.4
- */
- public static final int KEY_LOCATION_NUMPAD = 4;
-
- /**
- * The code assigned to the physical keyboard location (as adjusted by the
- * keyboard layout). Use the symbolic VK_* names instead of numbers.
- *
- * @see #getKeyCode()
- * @serial the VK_ code for this key
- */
- private int keyCode;
-
- /**
- * The Unicode character produced by the key type event. This has no meaning
- * for key pressed and key released events.
- *
- * @see #getKeyChar()
- * @serial the Unicode value for this key
- */
- private char keyChar;
-
- /**
- * The keyboard location of the key. One of {@link #KEY_LOCATION_UNKNOWN},
- * {@link #KEY_LOCATION_STANDARD}, {@link #KEY_LOCATION_LEFT},
- * {@link #KEY_LOCATION_RIGHT}, or {@link #KEY_LOCATION_NUMPAD}.
- *
- * @see #getKeyLocation()
- * @serial the key location
- * @since 1.4
- */
- private final int keyLocation;
-
- /**
- * Stores the state of the native event dispatching system, to correctly
- * dispatch in Component#dispatchEventImpl when a proxy is active.
- *
- * XXX Does this matter in Classpath?
- *
- * @serial whether the proxy is active
- */
- private boolean isProxyActive;
-
-
- /**
- * Initializes a new instance of A mouse event is tied to the unobstructed visible component that the
- * mouse cursor was over at the time of the action. The button that was
- * most recently pressed is the only one that shows up in
- * Drag events may be cut short if native drag-and-drop operations steal
- * the event. Likewise, if a mouse drag exceeds the bounds of a window or
- * virtual device, some platforms may clip the path to fit in the bounds of
- * the component.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see MouseAdapter
- * @see MouseListener
- * @see MouseMotionAdapter
- * @see MouseMotionListener
- * @see MouseWheelListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class MouseEvent extends InputEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -991214153494842848L;
-
- /** This is the first id in the range of event ids used by this class. */
- public static final int MOUSE_FIRST = 500;
-
- /** This is the last id in the range of event ids used by this class. */
- public static final int MOUSE_LAST = 507;
-
- /** This event id indicates that the mouse was clicked. */
- public static final int MOUSE_CLICKED = 500;
-
- /** This event id indicates that the mouse was pressed. */
- public static final int MOUSE_PRESSED = 501;
-
- /** This event id indicates that the mouse was released. */
- public static final int MOUSE_RELEASED = 502;
-
- /** This event id indicates that the mouse was moved. */
- public static final int MOUSE_MOVED = 503;
-
- /** This event id indicates that the mouse entered a component. */
- public static final int MOUSE_ENTERED = 504;
-
- /** This event id indicates that the mouse exited a component. */
- public static final int MOUSE_EXITED = 505;
-
- /**
- * This indicates that no button changed state.
- *
- * @see #getButton()
- * @since 1.4
- */
- public static final int NOBUTTON = 0;
-
- /**
- * This indicates that button 1 changed state.
- *
- * @see #getButton()
- * @since 1.4
- */
- public static final int BUTTON1 = 1;
-
- /**
- * This indicates that button 2 changed state.
- *
- * @see #getButton()
- * @since 1.4
- */
- public static final int BUTTON2 = 2;
-
- /**
- * This indicates that button 3 changed state.
- *
- * @see #getButton()
- * @since 1.4
- */
- public static final int BUTTON3 = 3;
-
- /** This event id indicates that the mouse was dragged over a component. */
- public static final int MOUSE_DRAGGED = 506;
-
- /**
- * This event id indicates that the mouse wheel was rotated.
- *
- * @since 1.4
- */
- public static final int MOUSE_WHEEL = 507;
-
- /**
- * The X coordinate of the mouse cursor at the time of the event.
- *
- * @see #getX()
- * @serial the x coordinate
- */
- private int x;
-
- /**
- * The Y coordinate of the mouse cursor at the time of the event.
- *
- * @see #getY()
- * @serial the y coordinate
- */
- private int y;
-
- /**
- * The number of clicks that took place. For MOUSE_CLICKED, MOUSE_PRESSED,
- * and MOUSE_RELEASED, this will be at least 1; otherwise it is 0.
- *
- * see #getClickCount()
- * @serial the number of clicks
- */
- private final int clickCount;
-
- /**
- * Indicates which mouse button changed state. Can only be one of
- * {@link #NOBUTTON}, {@link #BUTTON1}, {@link #BUTTON2}, or
- * {@link #BUTTON3}.
- *
- * @see #getButton()
- * @since 1.4
- */
- private int button;
-
- /**
- * Whether or not this event should trigger a popup menu.
- *
- * @see PopupMenu
- * @see #isPopupTrigger()
- * @serial true if this is a popup trigger
- */
- private final boolean popupTrigger;
-
- /**
- * Initializes a new instance of Because of the special use for scrolling components, MouseWheelEvents
- * often affect a different component than the one located at the point of
- * the event. If the component under the mouse cursor does not accept wheel
- * events, the event is passed to the first ancestor container which does. This
- * is often a ScrollPane, which knows how to scroll. If an AWT component is
- * built from a native widget that knows how to use mouse wheel events, that
- * component will consume the event.
- *
- * The two most common scroll types are "units" (lines at a time) or
- * "blocks" (pages at a time). The initial setting is taken from the platform,
- * although the user can adjust the setting at any time.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see MouseWheelListener
- * @see ScrollPane
- * @see ScrollPane#setWheelScrollingEnabled(boolean)
- * @see JScrollPane
- * @see JScrollPane#setWheelScrollingEnabled(boolean)
- * @since 1.4
- * @status updated to 1.4
- */
-public class MouseWheelEvent extends MouseEvent
-{
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = 6459879390515399677L;
-
- /**
- * Indicates scrolling by units (lines).
- *
- * @see #getScrollType()
- */
- public static final int WHEEL_UNIT_SCROLL = 0;
-
- /**
- * Indicates scrolling by blocks (pages).
- *
- * @see #getScrollType()
- */
- public static final int WHEEL_BLOCK_SCROLL = 1;
-
- /**
- * Indicates what scroll type should take place. This should be limited
- * to {@link #WHEEL_UNIT_SCROLL} and {@link #WHEEL_BLOCK_SCROLL}.
- *
- * @serial the scroll type
- */
- private final int scrollType;
-
- /**
- * Indicates the scroll amount. This is only meaningful if scrollType is
- * WHEEL_UNIT_SCROLL.
- *
- * @serial the number of lines to scroll
- */
- private final int scrollAmount;
-
- /**
- * Indicates how far the mouse wheel was rotated.
- *
- * @serial the rotation amount
- */
- private final int wheelRotation;
-
- /**
- * Initializes a new instance of This accounts for direction of scroll and amount of wheel movement, as
- * interpreted by the platform settings.
- *
- * @return the number of units to scroll
- * @see #getScrollType()
- * @see #getScrollAmount()
- * @see MouseWheelListener
- * @see Adjustable
- * @see Adjustable#getUnitIncrement()
- * @see Scrollable
- * @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
- * @see ScrollPane
- * @see ScrollPane#setWheelScrollingEnabled(boolean)
- * @see JScrollPane
- * @see JScrollPane#setWheelScrollingEnabled(boolean)
- */
- public int getUnitsToScroll()
- {
- return wheelRotation * scrollAmount;
- }
-
- /**
- * Returns a string identifying this event. For mouse wheel events, this
- * is The transformation can be represented using matrix math on a 3x3 array.
- * Given (x,y), the transformation (x',y') can be found by:
- * The resulting matrix is:
- * If this is a uniform scale transformation, the determinant also
- * represents the squared value of the scale. Otherwise, it carries little
- * additional meaning. The determinant is calculated as:
- * The resulting matrix is:
- *
- *
- * The contains and intersects() methods are also more accurate than the
- * specification of #Shape requires.
- *
- * Please note that constructing an Area can be slow
- * (Self-intersection resolving is proportional to the square of
- * the number of segments).
- * @see #add(Area)
- * @see #subtract(Area)
- * @see #intersect(Area)
- * @see #exclusiveOr(Area)
- *
- * @author Sven de Marothy (sven@physto.se)
- *
- * @since 1.2
- * @status Works, but could be faster and more reliable.
- */
-public class Area implements Shape, Cloneable
-{
- /**
- * General numerical precision
- */
- private static final double EPSILON = 1E-11;
-
- /**
- * recursive subdivision epsilon - (see getRecursionDepth)
- */
- private static final double RS_EPSILON = 1E-13;
-
- /**
- * Snap distance - points within this distance are considered equal
- */
- private static final double PE_EPSILON = 1E-11;
-
- /**
- * Segment vectors containing solid areas and holes
- * This is package-private to avoid an accessor method.
- */
- Vector solids;
-
- /**
- * Segment vectors containing solid areas and holes
- * This is package-private to avoid an accessor method.
- */
- Vector holes;
-
- /**
- * Vector (temporary) storing curve-curve intersections
- */
- private Vector cc_intersections;
-
- /**
- * Winding rule WIND_NON_ZERO used, after construction,
- * this is irrelevant.
- */
- private int windingRule;
-
- /**
- * Constructs an empty Area
- */
- public Area()
- {
- solids = new Vector();
- holes = new Vector();
- }
-
- /**
- * Constructs an Area from any given Shape.
- *
- * If the Shape is self-intersecting, the created Area will consist
- * of non-self-intersecting subpaths, and any inner paths which
- * are found redundant in accordance with the Shape's winding rule
- * will not be included.
- *
- * @param s the shape (
- *
- * This is strictly qualified. An area is considered rectangular if:
- * @return true if the above criteria are met, false otherwise
- */
- public boolean isRectangular()
- {
- if (isEmpty())
- return true;
-
- if (holes.size() != 0 || solids.size() != 1)
- return false;
-
- Segment path = (Segment) solids.elementAt(0);
- if (! path.isPolygonal())
- return false;
-
- int nCorners = 0;
- Segment s = path;
- do
- {
- Segment s2 = s.next;
- double d1 = (s.P2.getX() - s.P1.getX())*(s2.P2.getX() - s2.P1.getX())/
- ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
- double d2 = (s.P2.getY() - s.P1.getY())*(s2.P2.getY() - s2.P1.getY())/
- ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
- double dotproduct = d1 + d2;
-
- // For some reason, only rectangles on the XY axis count.
- if (d1 != 0 && d2 != 0)
- return false;
-
- if (Math.abs(dotproduct) == 0) // 90 degree angle
- nCorners++;
- else if ((Math.abs(1.0 - dotproduct) > 0)) // 0 degree angle?
- return false; // if not, return false
-
- s = s.next;
- }
- while (s != path);
-
- return nCorners == 4;
- }
-
- /**
- * Returns whether the Area consists of more than one simple
- * (non self-intersecting) subpath.
- *
- * @return true if the Area consists of none or one simple subpath,
- * false otherwise.
- */
- public boolean isSingular()
- {
- return (holes.size() == 0 && solids.size() <= 1);
- }
-
- /**
- * Returns the bounding box of the Area. Unlike the CubicCurve2D and
- * QuadraticCurve2D classes, this method will return the tightest possible
- * bounding box, evaluating the extreme points of each curved segment.
- * @return the bounding box
- */
- public Rectangle2D getBounds2D()
- {
- if (solids.size() == 0)
- return new Rectangle2D.Double(0.0, 0.0, 0.0, 0.0);
-
- double xmin;
- double xmax;
- double ymin;
- double ymax;
- xmin = xmax = ((Segment) solids.elementAt(0)).P1.getX();
- ymin = ymax = ((Segment) solids.elementAt(0)).P1.getY();
-
- for (int path = 0; path < solids.size(); path++)
- {
- Rectangle2D r = ((Segment) solids.elementAt(path)).getPathBounds();
- xmin = Math.min(r.getMinX(), xmin);
- ymin = Math.min(r.getMinY(), ymin);
- xmax = Math.max(r.getMaxX(), xmax);
- ymax = Math.max(r.getMaxY(), ymax);
- }
-
- return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
- }
-
- /**
- * Returns the bounds of this object in Rectangle format.
- * Please note that this may lead to loss of precision.
- *
- * @return The bounds.
- * @see #getBounds2D()
- */
- public Rectangle getBounds()
- {
- return getBounds2D().getBounds();
- }
-
- /**
- * Create a new area of the same run-time type with the same contents as
- * this one.
- *
- * @return the clone
- */
- public Object clone()
- {
- try
- {
- Area clone = new Area();
- for (int i = 0; i < solids.size(); i++)
- clone.solids.add(((Segment) solids.elementAt(i)).cloneSegmentList());
- for (int i = 0; i < holes.size(); i++)
- clone.holes.add(((Segment) holes.elementAt(i)).cloneSegmentList());
- return clone;
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * Compares two Areas.
- *
- * @param area the area to compare against this area (
- *
- * This method should always produce the correct results, unlike for other
- * classes in geom.
- *
- * @param x the x-coordinate of the rectangle.
- * @param y the y-coordinate of the rectangle.
- * @param w the width of the the rectangle.
- * @param h the height of the rectangle.
- * @return
- *
- * This method should always produce the correct results, unlike for other
- * classes in geom.
- *
- * @param r the rectangle.
- * @return The curve does not keep any reference to the passed point
- * objects. Therefore, a later change to The curve does not keep references to the passed point
- * objects. Therefore, a later change to the In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. In comparison to C1,
- * control point C2 is father away from the gray line. Therefore,
- * the result will be the square of the distance between C2 and the
- * gray line, i.e. the squared length of the red line.
- *
- * @param x1 the x coordinate of the start point P1.
- * @param y1 the y coordinate of the start point P1.
- * @param cx1 the x coordinate of the first control point C1.
- * @param cy1 the y coordinate of the first control point C1.
- * @param cx2 the x coordinate of the second control point C2.
- * @param cy2 the y coordinate of the second control point C2.
- * @param x2 the x coordinate of the end point P2.
- * @param y2 the y coordinate of the end point P2.
- */
- public static double getFlatnessSq(double x1, double y1, double cx1,
- double cy1, double cx2, double cy2,
- double x2, double y2)
- {
- return Math.max(Line2D.ptSegDistSq(x1, y1, x2, y2, cx1, cy1),
- Line2D.ptSegDistSq(x1, y1, x2, y2, cx2, cy2));
- }
-
- /**
- * Calculates the flatness of a cubic curve, directly specifying
- * each coordinate value. The flatness is the maximal distance of a
- * control point to the line between start and end point.
- *
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. In comparison to C1,
- * control point C2 is father away from the gray line. Therefore,
- * the result will be the distance between C2 and the gray line,
- * i.e. the length of the red line.
- *
- * @param x1 the x coordinate of the start point P1.
- * @param y1 the y coordinate of the start point P1.
- * @param cx1 the x coordinate of the first control point C1.
- * @param cy1 the y coordinate of the first control point C1.
- * @param cx2 the x coordinate of the second control point C2.
- * @param cy2 the y coordinate of the second control point C2.
- * @param x2 the x coordinate of the end point P2.
- * @param y2 the y coordinate of the end point P2.
- */
- public static double getFlatness(double x1, double y1, double cx1,
- double cy1, double cx2, double cy2,
- double x2, double y2)
- {
- return Math.sqrt(getFlatnessSq(x1, y1, cx1, cy1, cx2, cy2, x2, y2));
- }
-
- /**
- * Calculates the squared flatness of a cubic curve, specifying the
- * coordinate values in an array. The flatness is the maximal
- * distance of a control point to the line between start and end
- * point.
- *
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. In comparison to C1,
- * control point C2 is father away from the gray line. Therefore,
- * the result will be the square of the distance between C2 and the
- * gray line, i.e. the squared length of the red line.
- *
- * @param coords an array containing the coordinate values. The
- * x coordinate of the start point P1 is located at
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. In comparison to C1,
- * control point C2 is father away from the gray line. Therefore,
- * the result will be the distance between C2 and the gray line,
- * i.e. the length of the red line.
- *
- * @param coords an array containing the coordinate values. The
- * x coordinate of the start point P1 is located at
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. In comparison to C1,
- * control point C2 is father away from the gray line. Therefore,
- * the result will be the square of the distance between C2 and the
- * gray line, i.e. the squared length of the red line.
- */
- public double getFlatnessSq()
- {
- return getFlatnessSq(getX1(), getY1(), getCtrlX1(), getCtrlY1(),
- getCtrlX2(), getCtrlY2(), getX2(), getY2());
- }
-
- /**
- * Calculates the flatness of this curve. The flatness is the
- * maximal distance of a control point to the line between start and
- * end point.
- *
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. In comparison to C1,
- * control point C2 is father away from the gray line. Therefore,
- * the result will be the distance between C2 and the gray line,
- * i.e. the length of the red line.
- */
- public double getFlatness()
- {
- return Math.sqrt(getFlatnessSq(getX1(), getY1(), getCtrlX1(), getCtrlY1(),
- getCtrlX2(), getCtrlY2(), getX2(), getY2()));
- }
-
- /**
- * Subdivides this curve into two halves.
- *
- * The left end point and the right start point will always be
- * identical. Memory-concious programmers thus may want to pass the
- * same array for both For some background about solving cubic equations, see the
- * article “Cubic Formula” in PlanetMath. For an extensive
- * library of numerical algorithms written in the C programming
- * language, see the GNU
- * Scientific Library, from which this implementation was
- * adapted.
- *
- * @param eqn an array with the coefficients of the equation. When
- * this procedure has returned, For some background about solving cubic equations, see the
- * article “Cubic Formula” in PlanetMath. For an extensive
- * library of numerical algorithms written in the C programming
- * language, see the GNU
- * Scientific Library, from which this implementation was
- * adapted.
- *
- * @see QuadCurve2D#solveQuadratic(double[],double[])
- *
- * @param eqn an array with the coefficients of the equation.
- *
- * @param res an array into which the non-complex roots will be
- * stored. The results may be in an arbitrary order. It is safe to
- * pass the same array object reference for both The above drawing illustrates in which area points are
- * considered “inside” a CubicCurve2D.
- */
- public boolean contains(double x, double y)
- {
- if (! getBounds2D().contains(x, y))
- return false;
-
- return ((getAxisIntersections(x, y, true, BIG_VALUE) & 1) != 0);
- }
-
- /**
- * Determines whether a point lies inside the area bounded
- * by the curve and the straight line connecting its end points.
- *
- * The above drawing illustrates in which area points are
- * considered “inside” a CubicCurve2D.
- */
- public boolean contains(Point2D p)
- {
- return contains(p.getX(), p.getY());
- }
-
- /**
- * Determines whether any part of a rectangle is inside the area bounded
- * by the curve and the straight line connecting its end points.
- *
- * The above drawing illustrates in which area points are
- * considered “inside” in a CubicCurve2D.
- * @see #contains(double, double)
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- if (! getBounds2D().contains(x, y, w, h))
- return false;
-
- /* Does any edge intersect? */
- if (getAxisIntersections(x, y, true, w) != 0 /* top */
- || getAxisIntersections(x, y + h, true, w) != 0 /* bottom */
- || getAxisIntersections(x + w, y, false, h) != 0 /* right */
- || getAxisIntersections(x, y, false, h) != 0) /* left */
- return true;
-
- /* No intersections, is any point inside? */
- if ((getAxisIntersections(x, y, true, BIG_VALUE) & 1) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Determines whether any part of a Rectangle2D is inside the area bounded
- * by the curve and the straight line connecting its end points.
- * @see #intersects(double, double, double, double)
- */
- public boolean intersects(Rectangle2D r)
- {
- return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Determine whether a rectangle is entirely inside the area that is bounded
- * by the curve and the straight line connecting its end points.
- *
- * The above drawing illustrates in which area points are
- * considered “inside” a CubicCurve2D.
- * @see #contains(double, double)
- */
- public boolean contains(double x, double y, double w, double h)
- {
- if (! getBounds2D().intersects(x, y, w, h))
- return false;
-
- /* Does any edge intersect? */
- if (getAxisIntersections(x, y, true, w) != 0 /* top */
- || getAxisIntersections(x, y + h, true, w) != 0 /* bottom */
- || getAxisIntersections(x + w, y, false, h) != 0 /* right */
- || getAxisIntersections(x, y, false, h) != 0) /* left */
- return false;
-
- /* No intersections, is any point inside? */
- if ((getAxisIntersections(x, y, true, BIG_VALUE) & 1) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Determine whether a Rectangle2D is entirely inside the area that is
- * bounded by the curve and the straight line connecting its end points.
- *
- * The above drawing illustrates in which area points are
- * considered “inside” a CubicCurve2D.
- * @see #contains(double, double)
- */
- public boolean contains(Rectangle2D r)
- {
- return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Determines the smallest rectangle that encloses the
- * curve’s start, end and control points.
- */
- public Rectangle getBounds()
- {
- return getBounds2D().getBounds();
- }
-
- public PathIterator getPathIterator(final AffineTransform at)
- {
- return new PathIterator()
- {
- /** Current coordinate. */
- private int current = 0;
-
- public int getWindingRule()
- {
- return WIND_NON_ZERO;
- }
-
- public boolean isDone()
- {
- return current >= 2;
- }
-
- public void next()
- {
- current++;
- }
-
- public int currentSegment(float[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = (float) getX1();
- coords[1] = (float) getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = (float) getCtrlX1();
- coords[1] = (float) getCtrlY1();
- coords[2] = (float) getCtrlX2();
- coords[3] = (float) getCtrlY2();
- coords[4] = (float) getX2();
- coords[5] = (float) getY2();
- result = SEG_CUBICTO;
- break;
- default:
- throw new NoSuchElementException("cubic iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 3);
- return result;
- }
-
- public int currentSegment(double[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = getX1();
- coords[1] = getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = getCtrlX1();
- coords[1] = getCtrlY1();
- coords[2] = getCtrlX2();
- coords[3] = getCtrlY2();
- coords[4] = getX2();
- coords[5] = getY2();
- result = SEG_CUBICTO;
- break;
- default:
- throw new NoSuchElementException("cubic iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 3);
- return result;
- }
- };
- }
-
- public PathIterator getPathIterator(AffineTransform at, double flatness)
- {
- return new FlatteningPathIterator(getPathIterator(at), flatness);
- }
-
- /**
- * Create a new curve with the same contents as this one.
- *
- * @return the clone.
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * Helper method used by contains() and intersects() methods, that
- * returns the number of curve/line intersections on a given axis
- * extending from a certain point.
- *
- * @param x x coordinate of the origin point
- * @param y y coordinate of the origin point
- * @param useYaxis axis used, if true the positive Y axis is used,
- * false uses the positive X axis.
- *
- * This is an implementation of the line-crossings algorithm,
- * Detailed in an article on Eric Haines' page:
- * http://www.acm.org/tog/editors/erich/ptinpoly/
- *
- * A special-case not adressed in this code is self-intersections
- * of the curve, e.g. if the axis intersects the self-itersection,
- * the degenerate roots of the polynomial will erroneously count as
- * a single intersection of the curve, and not two.
- */
- private int getAxisIntersections(double x, double y, boolean useYaxis,
- double distance)
- {
- int nCrossings = 0;
- double a0;
- double a1;
- double a2;
- double a3;
- double b0;
- double b1;
- double b2;
- double b3;
- double[] r = new double[4];
- int nRoots;
-
- a0 = a3 = 0.0;
-
- if (useYaxis)
- {
- a0 = getY1() - y;
- a1 = getCtrlY1() - y;
- a2 = getCtrlY2() - y;
- a3 = getY2() - y;
- b0 = getX1() - x;
- b1 = getCtrlX1() - x;
- b2 = getCtrlX2() - x;
- b3 = getX2() - x;
- }
- else
- {
- a0 = getX1() - x;
- a1 = getCtrlX1() - x;
- a2 = getCtrlX2() - x;
- a3 = getX2() - x;
- b0 = getY1() - y;
- b1 = getCtrlY1() - y;
- b2 = getCtrlY2() - y;
- b3 = getY2() - y;
- }
-
- /* If the axis intersects a start/endpoint, shift it up by some small
- amount to guarantee the line is 'inside'
- If this is not done, bad behaviour may result for points on that axis.*/
- if (a0 == 0.0 || a3 == 0.0)
- {
- double small = getFlatness() * EPSILON;
- if (a0 == 0.0)
- a0 -= small;
- if (a3 == 0.0)
- a3 -= small;
- }
-
- if (useYaxis)
- {
- if (Line2D.linesIntersect(b0, a0, b3, a3, EPSILON, 0.0, distance, 0.0))
- nCrossings++;
- }
- else
- {
- if (Line2D.linesIntersect(a0, b0, a3, b3, 0.0, EPSILON, 0.0, distance))
- nCrossings++;
- }
-
- r[0] = a0;
- r[1] = 3 * (a1 - a0);
- r[2] = 3 * (a2 + a0 - 2 * a1);
- r[3] = a3 - 3 * a2 + 3 * a1 - a0;
-
- if ((nRoots = solveCubic(r)) != 0)
- for (int i = 0; i < nRoots; i++)
- {
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- double crossing = -(t * t * t) * (b0 - 3 * b1 + 3 * b2 - b3)
- + 3 * t * t * (b0 - 2 * b1 + b2)
- + 3 * t * (b1 - b0) + b0;
- if (crossing > 0.0 && crossing <= distance)
- nCrossings++;
- }
- }
-
- return (nCrossings);
- }
-
- /**
- * A two-dimensional curve that is parameterized with a cubic
- * function and stores coordinate values in double-precision
- * floating-point format.
- *
- * @see CubicCurve2D.Float
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
- public static class Double extends CubicCurve2D
- {
- /**
- * The x coordinate of the curve’s start point.
- */
- public double x1;
-
- /**
- * The y coordinate of the curve’s start point.
- */
- public double y1;
-
- /**
- * The x coordinate of the curve’s first control point.
- */
- public double ctrlx1;
-
- /**
- * The y coordinate of the curve’s first control point.
- */
- public double ctrly1;
-
- /**
- * The x coordinate of the curve’s second control point.
- */
- public double ctrlx2;
-
- /**
- * The y coordinate of the curve’s second control point.
- */
- public double ctrly2;
-
- /**
- * The x coordinate of the curve’s end point.
- */
- public double x2;
-
- /**
- * The y coordinate of the curve’s end point.
- */
- public double y2;
-
- /**
- * Constructs a new CubicCurve2D that stores its coordinate values
- * in double-precision floating-point format. All points are
- * initially at position (0, 0).
- */
- public Double()
- {
- }
-
- /**
- * Constructs a new CubicCurve2D that stores its coordinate values
- * in double-precision floating-point format, specifying the
- * initial position of each point.
- *
- *
- * @param x - x coordinate of the point.
- * @param y - y coordinate of the point.
- * @return true if the point is within the ellipse, false otherwise.
- */
- public boolean contains(double x, double y)
- {
- double rx = getWidth() / 2;
- double ry = getHeight() / 2;
- double tx = (x - (getX() + rx)) / rx;
- double ty = (y - (getY() + ry)) / ry;
- return tx * tx + ty * ty < 1.0;
- }
-
- /**
- * Determines if a rectangle is completely contained within the
- * ellipse.
- * @param x - x coordinate of the upper-left corner of the rectangle
- * @param y - y coordinate of the upper-left corner of the rectangle
- * @param w - width of the rectangle
- * @param h - height of the rectangle
- * @return true if the rectangle is completely contained, false otherwise.
- */
- public boolean contains(double x, double y, double w, double h)
- {
- double x2 = x + w;
- double y2 = y + h;
- return (contains(x, y) && contains(x, y2) && contains(x2, y)
- && contains(x2, y2));
- }
-
- /**
- * Returns a PathIterator object corresponding to the ellipse.
- *
- * Note: An ellipse cannot be represented exactly in PathIterator
- * segments, the outline is thefore approximated with cubic
- * Bezier segments.
- *
- * @param at an optional transform.
- * @return A path iterator.
- */
- public PathIterator getPathIterator(AffineTransform at)
- {
- // An ellipse is just a complete arc.
- return new Arc2D.ArcIterator(this, at);
- }
-
- /**
- * Determines if a rectangle intersects any part of the ellipse.
- * @param x - x coordinate of the upper-left corner of the rectangle
- * @param y - y coordinate of the upper-left corner of the rectangle
- * @param w - width of the rectangle
- * @param h - height of the rectangle
- * @return true if the rectangle intersects the ellipse, false otherwise.
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- Rectangle2D r = new Rectangle2D.Double(x, y, w, h);
- if (! r.intersects(getX(), getY(), getWidth(), getHeight()))
- return false;
-
- if (contains(x, y) || contains(x, y + h) || contains(x + w, y)
- || contains(x + w, y + h))
- return true;
-
- Line2D l1 = new Line2D.Double(getX(), getY() + (getHeight() / 2),
- getX() + getWidth(),
- getY() + (getHeight() / 2));
- Line2D l2 = new Line2D.Double(getX() + (getWidth() / 2), getY(),
- getX() + (getWidth() / 2),
- getY() + getHeight());
-
- if (l1.intersects(r) || l2.intersects(r))
- return true;
-
- return false;
- }
-
- /**
- * An {@link Ellipse2D} that stores its coordinates using
- * @param x - x coordinate of the upper-left of the bounding rectangle
- * @param y - y coordinate of the upper-left of the bounding rectangle
- * @param w - width of the ellipse
- * @param h - height of the ellipse
- */
- public Double(double x, double y, double w, double h)
- {
- this.x = x;
- this.y = y;
- height = h;
- width = w;
- }
-
- /**
- * Returns the bounding-box of the ellipse.
- * @return The bounding box.
- */
- public Rectangle2D getBounds2D()
- {
- return new Rectangle2D.Double(x, y, width, height);
- }
-
- /**
- * Returns the height of the ellipse.
- * @return The height of the ellipse.
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Returns the width of the ellipse.
- * @return The width of the ellipse.
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Returns x coordinate of the upper-left corner of
- * the ellipse's bounding-box.
- * @return The x coordinate.
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Returns y coordinate of the upper-left corner of
- * the ellipse's bounding-box.
- * @return The y coordinate.
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Returns
- *
- * @param x - x coordinate of the upper-left of the bounding rectangle
- * @param y - y coordinate of the upper-left of the bounding rectangle
- * @param w - width of the ellipse
- * @param h - height of the ellipse
- */
- public void setFrame(double x, double y, double w, double h)
- {
- this.x = x;
- this.y = y;
- height = h;
- width = w;
- }
- } // class Double
-
- /**
- * An {@link Ellipse2D} that stores its coordinates using
- * @param x - x coordinate of the upper-left of the bounding rectangle
- * @param y - y coordinate of the upper-left of the bounding rectangle
- * @param w - width of the ellipse
- * @param h - height of the ellipse
- *
- */
- public Float(float x, float y, float w, float h)
- {
- this.x = x;
- this.y = y;
- this.height = h;
- this.width = w;
- }
-
- /**
- * Returns the bounding-box of the ellipse.
- * @return The bounding box.
- */
- public Rectangle2D getBounds2D()
- {
- return new Rectangle2D.Float(x, y, width, height);
- }
-
- /**
- * Returns the height of the ellipse.
- * @return The height of the ellipse.
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Returns the width of the ellipse.
- * @return The width of the ellipse.
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Returns x coordinate of the upper-left corner of
- * the ellipse's bounding-box.
- * @return The x coordinate.
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Returns y coordinate of the upper-left corner of
- * the ellipse's bounding-box.
- * @return The y coordinate.
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Returns
- *
- * @param x - x coordinate of the upper-left of the bounding rectangle
- * @param y - y coordinate of the upper-left of the bounding rectangle
- * @param w - width of the ellipse
- * @param h - height of the ellipse
- */
- public void setFrame(float x, float y, float w, float h)
- {
- this.x = x;
- this.y = y;
- height = h;
- width = w;
- }
-
- /**
- * Sets the geometry of the ellipse's bounding box.
- *
- * Note: This leads to a loss of precision.
- *
- * @param x - x coordinate of the upper-left of the bounding rectangle
- * @param y - y coordinate of the upper-left of the bounding rectangle
- * @param w - width of the ellipse
- * @param h - height of the ellipse
- */
- public void setFrame(double x, double y, double w, double h)
- {
- this.x = (float) x;
- this.y = (float) y;
- height = (float) h;
- width = (float) w;
- }
- } // class Float
-} // class Ellipse2D
diff --git a/libjava/java/awt/geom/FlatteningPathIterator.java b/libjava/java/awt/geom/FlatteningPathIterator.java
deleted file mode 100644
index b06e6cc47b8..00000000000
--- a/libjava/java/awt/geom/FlatteningPathIterator.java
+++ /dev/null
@@ -1,579 +0,0 @@
-/* FlatteningPathIterator.java -- Approximates curves by straight lines
- Copyright (C) 2003 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.geom;
-
-import java.util.NoSuchElementException;
-
-
-/**
- * A PathIterator for approximating curved path segments by sequences
- * of straight lines. Instances of this class will only return
- * segments of type {@link PathIterator#SEG_MOVETO}, {@link
- * PathIterator#SEG_LINETO}, and {@link PathIterator#SEG_CLOSE}.
- *
- * The accuracy of the approximation is determined by two
- * parameters:
- *
- * Memory Efficiency: The memory consumption grows linearly
- * with the recursion limit. Neither the flatness parameter nor
- * the number of segments in the flattened path will affect the memory
- * consumption.
- *
- * Thread Safety: Multiple threads can safely work on
- * separate instances of this class. However, multiple threads should
- * not concurrently access the same instance, as no synchronization is
- * performed.
- *
- * @see Implementation Note
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- *
- * @since 1.2
- */
-public class FlatteningPathIterator
- implements PathIterator
-{
- /**
- * The PathIterator whose curved segments are being approximated.
- */
- private final PathIterator srcIter;
-
-
- /**
- * The square of the flatness threshold value, which determines when
- * a curve segment is considered flat enough that no further
- * subdivision is needed.
- *
- * Calculating flatness actually produces the squared flatness
- * value. To avoid the relatively expensive calculation of a square
- * root for each curve segment, we perform all flatness comparisons
- * on squared values.
- *
- * @see QuadCurve2D#getFlatnessSq()
- * @see CubicCurve2D#getFlatnessSq()
- */
- private final double flatnessSq;
-
-
- /**
- * The maximal number of subdivions that are performed to
- * approximate a quadratic or cubic curve segment.
- */
- private final int recursionLimit;
-
-
- /**
- * A stack for holding the coordinates of subdivided segments.
- *
- * @see Implementation Note
- */
- private double[] stack;
-
-
- /**
- * The current stack size.
- *
- * @see Implementation Note
- */
- private int stackSize;
-
-
- /**
- * The number of recursions that were performed to arrive at
- * a segment on the stack.
- *
- * @see Implementation Note
- */
- private int[] recLevel;
-
-
-
- private final double[] scratch = new double[6];
-
-
- /**
- * The segment type of the last segment that was returned by
- * the source iterator.
- */
- private int srcSegType;
-
-
- /**
- * The current x position of the source iterator.
- */
- private double srcPosX;
-
-
- /**
- * The current y position of the source iterator.
- */
- private double srcPosY;
-
-
- /**
- * A flag that indicates when this path iterator has finished its
- * iteration over path segments.
- */
- private boolean done;
-
-
- /**
- * Constructs a new PathIterator for approximating an input
- * PathIterator with straight lines. The approximation works by
- * recursive subdivisons, until the specified flatness threshold is
- * not exceeded.
- *
- * There will not be more than 10 nested recursion steps, which
- * means that a single The inside of the curve is defined for drawing purposes by a winding
- * rule. Either the WIND_EVEN_ODD or WIND_NON_ZERO winding rule can be chosen.
- *
- * The EVEN_ODD winding rule defines a point as inside a path if:
- * A ray from the point towards infinity in an arbitrary direction
- * intersects the path an odd number of times. Points A and
- * C in the image are considered to be outside the path.
- * (both intersect twice)
- * Point B intersects once, and is inside.
- *
- * The NON_ZERO winding rule defines a point as inside a path if:
- * The path intersects the ray in an equal number of opposite directions.
- * Point A in the image is outside (one intersection in the
- * ’up’
- * direction, one in the ’down’ direction) Point B in
- * the image is inside (one intersection ’down’)
- * Point C in the image is outside (two intersections
- * ’down’)
- *
- * @see Line2D
- * @see CubicCurve2D
- * @see QuadCurve2D
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- * @author Sven de Marothy (sven@physto.se)
- *
- * @since 1.2
- */
-public final class GeneralPath implements Shape, Cloneable
-{
- public static final int WIND_EVEN_ODD = PathIterator.WIND_EVEN_ODD;
- public static final int WIND_NON_ZERO = PathIterator.WIND_NON_ZERO;
-
- /** Initial size if not specified. */
- private static final int INIT_SIZE = 10;
-
- /** A big number, but not so big it can't survive a few float operations */
- private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
-
- /** The winding rule.
- * This is package-private to avoid an accessor method.
- */
- int rule;
-
- /**
- * The path type in points. Note that xpoints[index] and ypoints[index] maps
- * to types[index]; the control points of quad and cubic paths map as
- * well but are ignored.
- * This is package-private to avoid an accessor method.
- */
- byte[] types;
-
- /**
- * The list of all points seen. Since you can only append floats, it makes
- * sense for these to be float[]. I have no idea why Sun didn't choose to
- * allow a general path of double precision points.
- * Note: Storing x and y coords seperately makes for a slower transforms,
- * But it speeds up and simplifies box-intersection checking a lot.
- * These are package-private to avoid accessor methods.
- */
- float[] xpoints;
- float[] ypoints;
-
- /** The index of the most recent moveto point, or null. */
- private int subpath = -1;
-
- /** The next available index into points.
- * This is package-private to avoid an accessor method.
- */
- int index;
-
- /**
- * Constructs a GeneralPath with the default (NON_ZERO)
- * winding rule and initial capacity (20).
- */
- public GeneralPath()
- {
- this(WIND_NON_ZERO, INIT_SIZE);
- }
-
- /**
- * Constructs a GeneralPath with a specific winding rule
- * and the default initial capacity (20).
- * @param rule the winding rule (WIND_NON_ZERO or WIND_EVEN_ODD)
- */
- public GeneralPath(int rule)
- {
- this(rule, INIT_SIZE);
- }
-
- /**
- * Constructs a GeneralPath with a specific winding rule
- * and the initial capacity. The initial capacity should be
- * the approximate number of path segments to be used.
- * @param rule the winding rule (WIND_NON_ZERO or WIND_EVEN_ODD)
- * @param capacity the inital capacity, in path segments
- */
- public GeneralPath(int rule, int capacity)
- {
- if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO)
- throw new IllegalArgumentException();
- this.rule = rule;
- if (capacity < INIT_SIZE)
- capacity = INIT_SIZE;
- types = new byte[capacity];
- xpoints = new float[capacity];
- ypoints = new float[capacity];
- }
-
- /**
- * Constructs a GeneralPath from an arbitrary shape object.
- * The Shapes PathIterator path and winding rule will be used.
- * @param s the shape
- */
- public GeneralPath(Shape s)
- {
- types = new byte[INIT_SIZE];
- xpoints = new float[INIT_SIZE];
- ypoints = new float[INIT_SIZE];
- PathIterator pi = s.getPathIterator(null);
- setWindingRule(pi.getWindingRule());
- append(pi, false);
- }
-
- /**
- * Adds a new point to a path.
- */
- public void moveTo(float x, float y)
- {
- subpath = index;
- ensureSize(index + 1);
- types[index] = PathIterator.SEG_MOVETO;
- xpoints[index] = x;
- ypoints[index++] = y;
- }
-
- /**
- * Appends a straight line to the current path.
- * @param x x coordinate of the line endpoint.
- * @param y y coordinate of the line endpoint.
- */
- public void lineTo(float x, float y)
- {
- ensureSize(index + 1);
- types[index] = PathIterator.SEG_LINETO;
- xpoints[index] = x;
- ypoints[index++] = y;
- }
-
- /**
- * Appends a quadratic Bezier curve to the current path.
- * @param x1 x coordinate of the control point
- * @param y1 y coordinate of the control point
- * @param x2 x coordinate of the curve endpoint.
- * @param y2 y coordinate of the curve endpoint.
- */
- public void quadTo(float x1, float y1, float x2, float y2)
- {
- ensureSize(index + 2);
- types[index] = PathIterator.SEG_QUADTO;
- xpoints[index] = x1;
- ypoints[index++] = y1;
- xpoints[index] = x2;
- ypoints[index++] = y2;
- }
-
- /**
- * Appends a cubic Bezier curve to the current path.
- * @param x1 x coordinate of the first control point
- * @param y1 y coordinate of the first control point
- * @param x2 x coordinate of the second control point
- * @param y2 y coordinate of the second control point
- * @param x3 x coordinate of the curve endpoint.
- * @param y3 y coordinate of the curve endpoint.
- */
- public void curveTo(float x1, float y1, float x2, float y2, float x3,
- float y3)
- {
- ensureSize(index + 3);
- types[index] = PathIterator.SEG_CUBICTO;
- xpoints[index] = x1;
- ypoints[index++] = y1;
- xpoints[index] = x2;
- ypoints[index++] = y2;
- xpoints[index] = x3;
- ypoints[index++] = y3;
- }
-
- /**
- * Closes the current subpath by drawing a line
- * back to the point of the last moveTo.
- */
- public void closePath()
- {
- ensureSize(index + 1);
- types[index] = PathIterator.SEG_CLOSE;
- xpoints[index] = xpoints[subpath];
- ypoints[index++] = ypoints[subpath];
- }
-
- /**
- * Appends the segments of a Shape to the path. If The curve does not keep any reference to the passed point
- * objects. Therefore, a later change to The curve does not keep references to the passed point
- * objects. Therefore, a later change to the In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. The result will be the
- * the square of the distance between C and the gray line, i.e.
- * the squared length of the red line.
- *
- * @param x1 the x coordinate of the start point P1.
- * @param y1 the y coordinate of the start point P1.
- * @param cx the x coordinate of the control point C.
- * @param cy the y coordinate of the control point C.
- * @param x2 the x coordinate of the end point P2.
- * @param y2 the y coordinate of the end point P2.
- */
- public static double getFlatnessSq(double x1, double y1, double cx,
- double cy, double x2, double y2)
- {
- return Line2D.ptSegDistSq(x1, y1, x2, y2, cx, cy);
- }
-
- /**
- * Calculates the flatness of a quadratic curve, directly specifying
- * each coordinate value. The flatness is the distance of the
- * control point to the line between start and end point.
- *
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. The result will be the
- * the distance between C and the gray line, i.e. the length of
- * the red line.
- *
- * @param x1 the x coordinate of the start point P1.
- * @param y1 the y coordinate of the start point P1.
- * @param cx the x coordinate of the control point C.
- * @param cy the y coordinate of the control point C.
- * @param x2 the x coordinate of the end point P2.
- * @param y2 the y coordinate of the end point P2.
- */
- public static double getFlatness(double x1, double y1, double cx, double cy,
- double x2, double y2)
- {
- return Line2D.ptSegDist(x1, y1, x2, y2, cx, cy);
- }
-
- /**
- * Calculates the squared flatness of a quadratic curve, specifying
- * the coordinate values in an array. The flatness is the distance
- * of the control point to the line between start and end point.
- *
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. The result will be the
- * the square of the distance between C and the gray line, i.e.
- * the squared length of the red line.
- *
- * @param coords an array containing the coordinate values. The
- * x coordinate of the start point P1 is located at
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. The result will be the
- * the the distance between C and the gray line, i.e. the length of
- * the red line.
- *
- * @param coords an array containing the coordinate values. The
- * x coordinate of the start point P1 is located at
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. The result will be the
- * the square of the distance between C and the gray line, i.e. the
- * squared length of the red line.
- */
- public double getFlatnessSq()
- {
- return Line2D.ptSegDistSq(getX1(), getY1(), getX2(), getY2(), getCtrlX(),
- getCtrlY());
- }
-
- /**
- * Calculates the flatness of this curve. The flatness is the
- * distance of the control point to the line between start and end
- * point.
- *
- * In the above drawing, the straight line connecting start point
- * P1 and end point P2 is depicted in gray. The result will be the
- * the distance between C and the gray line, i.e. the length of the
- * red line.
- */
- public double getFlatness()
- {
- return Line2D.ptSegDist(getX1(), getY1(), getX2(), getY2(), getCtrlX(),
- getCtrlY());
- }
-
- /**
- * Subdivides this curve into two halves.
- *
- * The left end point and the right start point will always be
- * identical. Memory-concious programmers thus may want to pass the
- * same array for both For some background about solving quadratic equations, see the
- * article “Quadratic Formula” in PlanetMath. For an extensive library
- * of numerical algorithms written in the C programming language,
- * see the GNU Scientific
- * Library.
- *
- * @see #solveQuadratic(double[], double[])
- * @see CubicCurve2D#solveCubic(double[], double[])
- *
- * @param eqn an array with the coefficients of the equation. When
- * this procedure has returned, For some background about solving quadratic equations, see the
- * article “Quadratic Formula” in PlanetMath. For an extensive library
- * of numerical algorithms written in the C programming language,
- * see the GNU Scientific
- * Library.
- *
- * @see CubicCurve2D#solveCubic(double[],double[])
- *
- * @param eqn an array with the coefficients of the equation.
- *
- * @param res an array into which the non-complex roots will be
- * stored. The results may be in an arbitrary order. It is safe to
- * pass the same array object reference for both The above drawing illustrates in which area points are
- * considered “inside” a QuadCurve2D.
- */
- public boolean contains(double x, double y)
- {
- if (! getBounds2D().contains(x, y))
- return false;
-
- return ((getAxisIntersections(x, y, true, BIG_VALUE) & 1) != 0);
- }
-
- /**
- * Determines whether a point is inside the area bounded
- * by the curve and the straight line connecting its end points.
- *
- * The above drawing illustrates in which area points are
- * considered “inside” a QuadCurve2D.
- */
- public boolean contains(Point2D p)
- {
- return contains(p.getX(), p.getY());
- }
-
- /**
- * Determines whether any part of a rectangle is inside the area bounded
- * by the curve and the straight line connecting its end points.
- *
- * The above drawing illustrates in which area points are
- * considered “inside” in a CubicCurve2D.
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- if (! getBounds2D().contains(x, y, w, h))
- return false;
-
- /* Does any edge intersect? */
- if (getAxisIntersections(x, y, true, w) != 0 /* top */
- || getAxisIntersections(x, y + h, true, w) != 0 /* bottom */
- || getAxisIntersections(x + w, y, false, h) != 0 /* right */
- || getAxisIntersections(x, y, false, h) != 0) /* left */
- return true;
-
- /* No intersections, is any point inside? */
- if ((getAxisIntersections(x, y, true, BIG_VALUE) & 1) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Determines whether any part of a Rectangle2D is inside the area bounded
- * by the curve and the straight line connecting its end points.
- * @see #intersects(double, double, double, double)
- */
- public boolean intersects(Rectangle2D r)
- {
- return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Determines whether a rectangle is entirely inside the area bounded
- * by the curve and the straight line connecting its end points.
- *
- * The above drawing illustrates in which area points are
- * considered “inside” a QuadCurve2D.
- * @see #contains(double, double)
- */
- public boolean contains(double x, double y, double w, double h)
- {
- if (! getBounds2D().intersects(x, y, w, h))
- return false;
-
- /* Does any edge intersect? */
- if (getAxisIntersections(x, y, true, w) != 0 /* top */
- || getAxisIntersections(x, y + h, true, w) != 0 /* bottom */
- || getAxisIntersections(x + w, y, false, h) != 0 /* right */
- || getAxisIntersections(x, y, false, h) != 0) /* left */
- return false;
-
- /* No intersections, is any point inside? */
- if ((getAxisIntersections(x, y, true, BIG_VALUE) & 1) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Determines whether a Rectangle2D is entirely inside the area that is
- * bounded by the curve and the straight line connecting its end points.
- * @see #contains(double, double, double, double)
- */
- public boolean contains(Rectangle2D r)
- {
- return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Determines the smallest rectangle that encloses the
- * curve’s start, end and control point. As the illustration
- * below shows, the invisible control point may cause the bounds to
- * be much larger than the area that is actually covered by the
- * curve.
- *
- * It is valid for a rectangle to have negative width or height; but it
- * is considered to have no area or internal points. Therefore, the behavior
- * in methods like By using the interfaces of {@link java.awt.im.spi}, you can install
- * extensions which allow additional input methods. Some of these may use
- * platform native input methods, or keyboard layouts provided by the platform.
- * Input methods are unavailable if none have been installed and the platform
- * has no underlying native input methods. Extensions are installed as jar
- * files, usually accessed in the default extension location or specified by
- * the -extdir VM flag. The jar must contain a file named
- * "META_INF/services/java.awt.im.spi.InputMethodDescriptor" which lists,
- * one entry per line in UTF-8 encoding, each class in the jar that implements
- * java.awt.im.spi.InputMethodDescriptor.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Component#getInputContext()
- * @see Component#enableInputMethods(boolean)
- * @since 1.2
- * @status updated to 1.4, but unverified
- */
-public class InputContext
-{
- /**
- * The list of installed input method descriptors.
- */
- private static final ArrayList descriptors = new ArrayList();
- static
- {
- Enumeration e;
- try
- {
- e = ClassLoader.getSystemResources
- ("META_INF/services/java.awt.im.spi.InputMethodDescriptor");
- }
- catch (IOException ex)
- {
- // XXX Should we do something else?
- e = EmptyEnumeration.getInstance();
- }
- while (e.hasMoreElements())
- {
- URL url = (URL) e.nextElement();
- BufferedReader in;
- String line;
- try
- {
- in = new BufferedReader
- (new InputStreamReader(url.openConnection().getInputStream(),
- "UTF-8"));
- line = in.readLine().trim();
- }
- catch (IOException ignored)
- {
- continue;
- }
- outer:
- while (line != null)
- {
- try
- {
- if (line.charAt(0) != '#')
- {
- Class c = Class.forName(line);
- descriptors.add((InputMethodDescriptor) c.newInstance());
- }
- line = in.readLine().trim();
- }
- catch (IOException ex)
- {
- continue outer;
- }
- catch (Exception ignored)
- {
- }
- }
- }
- }
-
- /** The current input method; null if no input methods are installed. */
- private InputMethod im;
-
- /** Map of locales to the most recently selected input method. */
- private final HashMap recent = new HashMap();
-
- /** The list of acceptable character subsets. */
- private Character.Subset[] subsets;
-
- /**
- * Construct an InputContext. This is protected, so clients must use
- * {@link #getInstance()} instead.
- */
- protected InputContext()
- {
- }
-
- /**
- * Returns a new InputContext.
- *
- * @return a new instance, initialized to the default locale if available
- */
- public static InputContext getInstance()
- {
- InputContext ic = new InputContext();
- ic.selectInputMethod(Locale.getDefault());
- return ic;
- }
-
- /**
- * Attempts to select an input method or keyboard layout which supports the
- * given locale. This returns true if a locale is available and was selected.
- * The following steps are taken in choosing an input method: Before switching away from an input method, any currently uncommitted
- * text is committed. Not all host operating systems provide API to
- * determine the locale of the currently selected native input method or
- * keyboard layout, and to select a native input method or keyboard layout
- * by locale. For host operating systems that don't provide such API,
- * selectInputMethod assumes that native input methods or keyboard layouts
- * provided by the host operating system support only the system's default
- * locale.
- *
- * An example of where this may be called is in a multi-language document,
- * when moving the insertion point between sections of different locale, so
- * that the user may use the input method appropriate to that section of the
- * document.
- *
- * @param locale the desired new locale
- * @return true if the new locale is active
- * @throws NullPointerException if locale is null
- */
- public boolean selectInputMethod(Locale locale)
- {
- if (im != null && im.setLocale(locale))
- {
- recent.put(locale, im);
- return true;
- }
- InputMethod next = (InputMethod) recent.get(locale);
- outer:
- if (next != null)
- for (int i = 0, limit = descriptors.size(); i < limit; i++)
- {
- InputMethodDescriptor d = (InputMethodDescriptor) descriptors.get(i);
- Locale[] list;
- try
- {
- list = d.getAvailableLocales();
- }
- catch (AWTException ignored)
- {
- continue;
- }
- for (int j = list.length; --j >= 0; )
- if (locale.equals(list[j]))
- {
- try
- {
- next = d.createInputMethod();
- recent.put(locale, next);
- }
- catch (Exception ignored)
- {
- continue;
- }
- }
- }
- if (next == null)
- return false;
- // XXX I'm not sure if this does all the necessary steps in the switch.
- if (im != null)
- {
- try
- {
- next.setCompositionEnabled(im.isCompositionEnabled());
- }
- catch (UnsupportedOperationException ignored)
- {
- }
- im.endComposition();
- im.deactivate(false);
- im.hideWindows();
- }
- im = next;
- im.setLocale(locale);
- im.setCharacterSubsets(subsets);
- return true;
- }
-
- /**
- * Returns the current locale of the current input method or keyboard
- * layout. Returns null if the input context does not have a current input
- * method or keyboard layout or if the current input method's
- * {@link InputMethod#getLocale()} method returns null. Not all host
- * operating systems provide API to determine the locale of the currently
- * selected native input method or keyboard layout. For host operating
- * systems that don't provide such API, getLocale assumes that the current
- * locale of all native input methods or keyboard layouts provided by the
- * host operating system is the system's default locale.
- *
- * @return the locale of the current input method, or null
- * @since 1.3
- */
- public Locale getLocale()
- {
- return im == null ? null : im.getLocale();
- }
-
- /**
- * Sets the subsets of Unicode characters allowed to be input by the current
- * input method, as well as subsequent input methods. The value of null
- * implies all characters are legal. Applications should not rely on this
- * behavior, since native host input methods may not allow restrictions.
- * If no current input method is available, this has no immediate effect.
- *
- * @param subsets the set of Unicode subsets to accept, or null
- */
- public void setCharacterSubsets(Character.Subset[] subsets)
- {
- this.subsets = subsets;
- if (im != null)
- im.setCharacterSubsets(subsets);
- }
-
- /**
- * Changes the enabled status of the current input method. An input method
- * that is enabled for composition interprets incoming events for both
- * composition and control purposes, while a disabled input method only
- * interprets control commands (including commands to enable itself).
- *
- * @param enable whether to enable the input method
- * @throws UnsupportedOperationException if there is no current input method,
- * or the input method does not support enabling
- * @see #isCompositionEnabled()
- * @since 1.3
- */
- public void setCompositionEnabled(boolean enable)
- {
- if (im == null)
- throw new UnsupportedOperationException();
- im.setCompositionEnabled(enable);
- }
-
- /**
- * Find out if the current input method is enabled.
- *
- * @return true if the current input method is enabled
- * @throws UnsupportedOperationException if there is no current input method,
- * or the input method does not support enabling
- * @see #setCompositionEnabled(boolean)
- * @since 1.3
- */
- public boolean isCompositionEnabled()
- {
- if (im == null)
- throw new UnsupportedOperationException();
- return im.isCompositionEnabled();
- }
-
- /**
- * Starts a reconversion operation in the current input method. The input
- * method gets theh text to reconvert from the client component, using
- * {@link InputMethodRequests#getSelectedText(Attribute[])}. Then the
- * composed and committed text produced by the operation is sent back to
- * the client using a sequence of InputMethodRequests.
- *
- * @throws UnsupportedOperationException if there is no current input method,
- * or the input method does not support reconversion
- * @since 1.3
- */
- public void reconvert()
- {
- if (im == null)
- throw new UnsupportedOperationException();
- im.reconvert();
- }
-
- /**
- * Dispatches an event to the current input method. This is called
- * automatically by AWT. If no input method is available, then the event
- * will never be consumed.
- *
- * @param event the event to dispatch
- * @throws NullPointerException if event is null
- */
- public void dispatchEvent(AWTEvent event)
- {
- if (im != null)
- im.dispatchEvent(event);
- }
-
- /**
- * Notifies the input context that a client component has been removed from
- * its containment hierarchy, or that input method support has been disabled
- * for the component. This method is usually called from the client
- * component's {@link Component#removeNotify()} method. Potentially pending
- * input from input methods for this component is discarded. If no input
- * methods are available, then this method has no effect.
- *
- * @param client the client component
- * @throws NullPointerException if client is null
- */
- public void removeNotify(Component client)
- {
- // XXX What to do with client information?
- if (im != null)
- {
- im.deactivate(false);
- im.removeNotify();
- }
- }
-
- /**
- * Ends any input composition that may currently be going on in this
- * context. Depending on the platform and possibly user preferences, this
- * may commit or delete uncommitted text. Any changes to the text are
- * communicated to the active component using an input method event. If no
- * input methods are available, then this method has no effect. This may
- * be called for a variety of reasons, such as when the user moves the
- * insertion point in the client text outside the range of the composed text,
- * or when text is saved to file.
- */
- public void endComposition()
- {
- if (im != null)
- im.endComposition();
- }
-
- /**
- * Disposes of the input context and release the resources used by it.
- * Called automatically by AWT for the default input context of each
- * Window. If no input methods are available, then this method has no
- * effect.
- */
- public void dispose()
- {
- if (im != null)
- {
- im.deactivate(false);
- im.dispose();
- }
- }
-
- /**
- * Returns a control object from the current input method, or null. A
- * control object provides implementation-dependent methods that control
- * the behavior of the input method or obtain information from the input
- * method. Clients have to compare the result against known input method
- * control object types. If no input methods are available or the current
- * input method does not provide an input method control object, then null
- * is returned.
- *
- * @return the control object, or null
- */
- public Object getInputMethodControlObject()
- {
- return im == null ? null : im.getControlObject();
- }
-} // class InputContext
diff --git a/libjava/java/awt/im/InputMethodHighlight.java b/libjava/java/awt/im/InputMethodHighlight.java
deleted file mode 100644
index 0d664b19366..00000000000
--- a/libjava/java/awt/im/InputMethodHighlight.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/* InputMethodHighlight.java -- highlights the current text selection
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.im;
-
-import java.util.Map;
-
-/**
- * This describes the highlight attributes of text composed in an input method.
- * The description includes an abstract level (whether text has been converted
- * yet, and whether it is selected), and a concrete level (which style
- * attributes are used in rendering). If no concrete level is defined, the
- * renderer should use
- * {@link Toolkit#mapInputMethodHighlight(InputMethodHighlight)}. An example
- * of conversion state is kana -> kanji.
- *
- * Instances of this class are typically used in
- * AttributedCharacterIterators, and may be wrapped in Annotations to separate
- * text segments.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see AttributedCharacterIterators
- * @see Annotation
- * @since 1.2
- * @status updated to 1.4
- */
-public class InputMethodHighlight
-{
- /** Raw text state (before conversion). */
- public static final int RAW_TEXT = 0;
-
- /** Converted text state (after conversion). */
- public static final int CONVERTED_TEXT = 1;
-
- /** Default do-nothing highlighting for unselected raw text. */
- public static final InputMethodHighlight UNSELECTED_RAW_TEXT_HIGHLIGHT
- = new InputMethodHighlight(false, RAW_TEXT);
-
- /** Default do-nothing highlighting for selected raw text. */
- public static final InputMethodHighlight SELECTED_RAW_TEXT_HIGHLIGHT
- = new InputMethodHighlight(true, RAW_TEXT);
-
- /** Default do-nothing highlighting for unselected converted text. */
- public static final InputMethodHighlight UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
- = new InputMethodHighlight(false, CONVERTED_TEXT);
-
- /** Default do-nothing highlighting for selected converted text. */
- public static final InputMethodHighlight SELECTED_CONVERTED_TEXT_HIGHLIGHT
- = new InputMethodHighlight(true, CONVERTED_TEXT);
-
- /** Whether the highlighting applies to selected text. */
- private final boolean selected;
-
- /** The state of highlighted text. */
- private final int state;
-
- /** Any variation on the highlighting style. */
- private final int variation;
-
- /** The unmodifiable map of rendering styles. */
- private final Map style;
-
- /**
- * Create an input method highlight style, with variation 0 and null style
- * mapping.
- *
- * @param selected whether the text range is selected
- * @param state either {@link #RAW_TEXT} or {@link #CONVERTED_TEXT}
- * @throws IllegalArgumentException if state is invalid
- */
- public InputMethodHighlight(boolean selected, int state)
- {
- this(selected, state, 0, null);
- }
-
- /**
- * Create an input method highlight style, with null style mapping.
- *
- * @param selected whether the text range is selected
- * @param state either {@link #RAW_TEXT} or {@link #CONVERTED_TEXT}
- * @param variation the style variation
- * @throws IllegalArgumentException if state is invalid
- */
- public InputMethodHighlight(boolean selected, int state, int variation)
- {
- this(selected, state, variation, null);
- }
-
- /**
- * Create an input method highlight style.
- *
- * @param selected whether the text range is selected
- * @param state either {@link #RAW_TEXT} or {@link #CONVERTED_TEXT}
- * @param variation the style variation
- * @param style an unmodifiable map of rendering styles, or null
- * @throws IllegalArgumentException if state is invalid
- * @since 1.3
- */
- public InputMethodHighlight(boolean selected, int state, int variation,
- Map style)
- {
- if (state != RAW_TEXT && state != CONVERTED_TEXT)
- throw new IllegalArgumentException();
- this.selected = selected;
- this.state = state;
- this.variation = variation;
- this.style = style;
- }
-
- /**
- * Return whether the highlighting applies to selected text.
- *
- * @return the selection status
- */
- public boolean isSelected()
- {
- return selected;
- }
-
- /**
- * Return the conversion state of the highlighted text.
- *
- * @return one of {@link #RAW_TEXT} or {@link #CONVERTED_TEXT}
- */
- public int getState()
- {
- return state;
- }
-
- /**
- * Return the highlighting style variation.
- *
- * @return the variation
- */
- public int getVariation()
- {
- return variation;
- }
-
- /**
- * Return the rendering style attributes map, or null if it should be the
- * default mapping.
- *
- * @return the style map
- * @since 1.3
- */
- public Map getStyle()
- {
- return style;
- }
-} // class InputMethodHighlight
diff --git a/libjava/java/awt/im/InputMethodRequests.java b/libjava/java/awt/im/InputMethodRequests.java
deleted file mode 100644
index d50ec33c5c8..00000000000
--- a/libjava/java/awt/im/InputMethodRequests.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/* InputMethodRequests.java -- handles text insertion via input methods
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.im;
-
-import java.awt.Rectangle;
-import java.awt.font.TextHitInfo;
-import java.text.AttributedCharacterIterator;
-import java.text.AttributedCharacterIterator.Attribute;
-
-/**
- * This interface handles requests made by input methods on text editing
- * components. A component must specify a handler for input methods that
- * implements this interface, and which supports one of two user interfaces:
- * If the component has composed text (from the most recent
- * InputMethodEvent), then offset 0 indicates the location of the first
- * character of this composed text. Otherwise, the offset is ignored, and
- * the location should be the beginning of the final line of selected
- * text (in horizontal left-to-right text, like English, this would be the
- * lower left corner of the selction; in vertical top-to-bottom text, like
- * Chinese, this would be the top right corner of the selection).
- *
- * The location returned is a 0-thickness caret (either horizontal or
- * vertical, depending on text flow), mapped to absolute screen coordinates.
- *
- * @param offset offset within composed text, or null
- * @return the screen location of the caret at the offset
- */
- Rectangle getTextLocation(TextHitInfo offset);
-
- /**
- * Get the text offset for the given screen coordinate. The offset is
- * relative to the composed text, and the return is null if it is outside
- * the range of composed text. For example, this can be used to find
- * where a mouse click should pop up a text composition window.
- *
- * @param x the x screen coordinate
- * @param y the y screen coordinate
- * @return a text hit info describing the composed text offset
- */
- TextHitInfo getLocationOffset(int x, int y);
-
- /**
- * Gets the offset where the committed text exists in the text editing
- * component. This can be used to examine the text surrounding the insert
- * position.
- *
- * @return the offset of the insert position
- */
- int getInsertPositionOffset();
-
- /**
- * Gets an interator which provides access to the text and its attributes,
- * except for the uncommitted text. The input method may provide a list of
- * attributes it is interested in; and the iterator need not provide
- * information on the remaining attributes. If the attribute list is null,
- * the iterator must list all attributes.
- *
- * @param beginIndex the index of the first character in the iteration
- * @param endIndex the index of the last character in the iteration
- * @param attributes a list of attributes interested in, or null
- * @return an iterator over the region of text with its attributes
- */
- AttributedCharacterIterator getCommittedText(int beginIndex, int endIndex,
- Attribute[] attributes);
-
- /**
- * Gets the length of committed text.
- *
- * @return the number of committed characters
- */
- int getCommittedTextLength();
-
- /**
- * Gets the latest committed text, and removes it from the component's text
- * body. This allows an input method to provide an "Undo" command. In
- * general, this should only be supported immediately after a commit, and
- * not when other actions intervene; if not supported, simply return null.
- * The input method may provide a list of attributes it is interested in;
- * and the iterator need not provide information on the remaining attributes.
- * If the attribute list is null, the iterator must list all attributes.
- *
- * @param attributes a list of attributes interested in, or null
- * @return the latest committed text, or null
- */
- AttributedCharacterIterator cancelLatestCommittedText
- (Attribute[] attributes);
-
- /**
- * Gets the currently selected text. One use of this is to implement a
- * "Reconvert" feature in an input method, which modifies the selection
- * based on the text in the composition window. The input method may
- * provide a list of attributes it is interested in; and the iterator need
- * not provide information on the remaining attributes. If the attribute
- * list is null, the iterator must list all attributes.
- *
- * @param attributes a list of attributes interested in, or null
- * @return the current selection
- */
- AttributedCharacterIterator getSelectedText(Attribute[] attributes);
-} // interface InputMethodRequests
diff --git a/libjava/java/awt/im/InputSubset.java b/libjava/java/awt/im/InputSubset.java
deleted file mode 100644
index 5e7d58e7f42..00000000000
--- a/libjava/java/awt/im/InputSubset.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/* InputSubset.java -- subsets of Unicode important in text input
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.im;
-
-/**
- * Defines additional Unicode character blocks for use by input methods.
- * These constants encompass several Unicode blocks, or portions thereof, for
- * simplification over {@link Character.UnicodeBlock}.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public final class InputSubset extends Character.Subset
-{
- /**
- * Constant for all Latin characters, including the characters in the
- * BASIC_LATIN, LATIN_1_SUPPLEMENT, LATIN_EXTENDED_A, LATIN_EXTENDED_B
- * Unicode character blocks.
- */
- public static final InputSubset LATIN = new InputSubset("LATIN");
-
- /**
- * Constant for the digits included in the BASIC_LATIN Unicode character
- * block.
- */
- public static final InputSubset LATIN_DIGITS
- = new InputSubset("LATIN_DIGITS");
-
- /**
- * Constant for all Han characters used in writing Traditional Chinese,
- * including a subset of the CJK unified ideographs as well as Traditional
- * Chinese Han characters that may be defined as surrogate characters.
- */
- public static final InputSubset TRADITIONAL_HANZI
- = new InputSubset("TRADITIONAL_HANZI");
-
- /**
- * Constant for all Han characters used in writing Simplified Chinese,
- * including a subset of the CJK unified ideographs as well as Simplified
- * Chinese Han characters that may be defined as surrogate characters.
- */
- public static final InputSubset SIMPLIFIED_HANZI
- = new InputSubset("SIMPLIFIED_HANZI");
-
- /**
- * Constant for all Han characters used in writing Japanese, including a
- * subset of the CJK unified ideographs as well as Japanese Han characters
- * that may be defined as surrogate characters.
- */
- public static final InputSubset KANJI = new InputSubset("KANJI");
-
- /**
- * Constant for all Han characters used in writing Korean, including a
- * subset of the CJK unified ideographs as well as Korean Han characters
- * that may be defined as surrogate characters.
- */
- public static final InputSubset HANJA = new InputSubset("HANJA");
-
- /**
- * Constant for the halfwidth katakana subset of the Unicode halfwidth and
- * fullwidth forms character block.
- */
- public static final InputSubset HALFWIDTH_KATAKANA
- = new InputSubset("HALFWIDTH_KATAKANA");
-
- /**
- * Constant for the fullwidth ASCII variants subset of the Unicode
- * halfwidth and fullwidth forms character block.
- *
- * @since 1.3
- */
- public static final InputSubset FULLWIDTH_LATIN
- = new InputSubset("FULLWIDTH_LATIN");
-
- /**
- * Constant for the fullwidth digits included in the Unicode halfwidth and
- * fullwidth forms character block.
- *
- * @since 1.3
- */
- public static final InputSubset FULLWIDTH_DIGITS
- = new InputSubset("FULLWIDTH_DIGITS");
-
- /**
- * Construct a subset.
- *
- * @param name the subset name
- */
- private InputSubset(String name)
- {
- super(name);
- }
-} // class InputSubset
diff --git a/libjava/java/awt/im/spi/InputMethod.java b/libjava/java/awt/im/spi/InputMethod.java
deleted file mode 100644
index 840d193a8d8..00000000000
--- a/libjava/java/awt/im/spi/InputMethod.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/* InputMethod.java -- defines an interface for complex text input
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.im.spi;
-
-import java.awt.AWTEvent;
-import java.awt.Rectangle;
-import java.util.Locale;
-
-/**
- * This interface supports complex text input, often for situations where
- * the text is more complex than a keyboard will accomodate. For example,
- * this can be used for Chinese, Japanese, and Korean, where multiple
- * keystrokes are necessary to compose text. This could also support things
- * like phonetic English, or reordering Thai.
- *
- * These contexts can be loaded by the input method framework, using
- * {@link InputContext#selectInputMethod(Locale)}.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4
- */
-public interface InputMethod
-{
- /**
- * Set the input method context, which ties the input method to a client
- * component. This is called once automatically when creating the input
- * method.
- *
- * @param context the context for this input method
- * @throws NullPointerException if context is null
- */
- void setInputMethodContext(InputMethodContext context);
-
- /**
- * Sets the input locale. If the input method supports that locale, it
- * changes its behavior to be consistent with the locale and returns true.
- * Otherwise, it returns false. This is called by
- * {@link InputContext#selectInputMethod(Locale)} when the user specifies
- * a locale, or when the previously selected input method had a locale.
- *
- * @param locale the locale to use for input
- * @return true if the change is successful
- * @throws NullPointerException if locale is null
- */
- boolean setLocale(Locale locale);
-
- /**
- * Returns the current input locale, or null if none is defined. This is
- * called by {@link InputContext#getLocale()}, or before switching input
- * methods.
- *
- * @return the current input locale, or null
- */
- Locale getLocale();
-
- /**
- * Sets the allowed Unicode subsets that this input method can use. Null
- * indicates that all characters are allowed. This is called after creation,
- * or when switching to this input method, by
- * {@link InputContext#setCharacterSubsets(Character.Subset[])}.
- *
- * @param subsets the accepted subsets for this input method, or null for all
- */
- void setCharacterSubsets(Character.Subset[] subsets);
-
- /**
- * Changes the enabled status of this input method. An enabled input method
- * accepts incoming events for composition and control purposes, while a
- * disabled input method ignores events (except for control purposes). This
- * is called by {@link InputContext#setCompositionEnabled(boolean)} or when
- * switching from an input method if the previous input method returned
- * without exception on {@link #isCompositionEnabled()}.
- *
- * @param enable whether to enable this input method
- * @throws UnsupportedOperationException if enabling/disabling is unsupported
- * @see #isCompositionEnabled()
- */
- void setCompositionEnabled(boolean enable);
-
- /**
- * Find out if this input method is enabled. This is called by
- * {@link InputContext#isCompositionEnabled()}, or when switching input
- * methods via {@link InputContext#selectInputMethod(Locale)}.
- *
- * @return true if this input method is enabled
- * @throws UnsupportedOperationException if enabling/disabling is unsupported
- * @see #setCompositionEnabled(boolean)
- */
- boolean isCompositionEnabled();
-
- /**
- * Starts a reconversion operation. The input method gets its text from the
- * client, using {@link InputMethodRequests#getSelectedText(Attribute[])}.
- * Then the composed and committed text produced by the operation is sent
- * back to the client using a sequence of InputMethodEvents. This is called
- * by {@link InputContext#reconvert()}.
- *
- * @throws UnsupportedOperationException if reconversion is unsupported
- */
- void reconvert();
-
- /**
- * Dispatch an event to the input method. If input method support is enabled,
- * certain events are dispatched to the input method before the client
- * component or event listeners. The input method must either consume the
- * event or pass it on to the component. Instances of InputEvent, including
- * KeyEvent and MouseEvent, are given to this input method. This method is
- * called by {@link InputContext#dispatchEvent(AWTEvent)}.
- *
- * @param event the event to dispatch
- * @throws NullPointerException if event is null
- */
- void dispatchEvent(AWTEvent event);
-
- /**
- * Notify this input method of changes in the client window. This is called
- * when notifications are enabled (see {@link
- * InputMethodContext#enableClientWindowNotification(InputMethod, boolean)},
- * if {@link #removeNotify(Component)} has not been called. The following
- * situations trigger a notification: If attachToInputContext is true, the new window will share the input
- * context of the input method, so that events in the new window are
- * dispatched to the input method. Also, this supresses deactivate and
- * activate calls to the input method caused by setVisible.
- *
- * @param title the window title, if one is displayed; null becomes ""
- * @param attachToInputContext true for the window to share context with
- * the input method
- * @return the new window for use by the input method
- * @throws HeadlessException if GraphicsEnvironment.isHeadless is true
- */
- Window createInputMethodWindow(String title, boolean attachToInputContext);
-
- /**
- * Creates a top-level Swing JFrame for use by the input method. This frame
- * should float above all document windows and dialogs, not receive focus,
- * and have lightweight decorations (such as no title, reduced drag
- * regions). But this behavior may be modified to meet the platform style.
- * The title may or may not be displayed, depending on the platform.
- *
- * If attachToInputContext is true, the new window will share the input
- * context of the input method, so that events in the new window are
- * dispatched to the input method. Also, this supresses deactivate and
- * activate calls to the input method caused by setVisible.
- *
- * @param title the window title, if one is displayed; null becomes ""
- * @param attachToInputContext true for the window to share context with
- * the input method
- * @return the new window for use by the input method
- * @throws HeadlessException if GraphicsEnvironment.isHeadless is true
- * @since 1.4
- */
- JFrame createInputMethodJFrame(String title, boolean attachToInputContext);
-
- /**
- * Sets whether notification of the client window's location and state should
- * be enabled for the input method. When enabled, the input method's
- * {@link #notifyClientWindowChange(Rectangle)} method is called.
- * Notification is automatically disabled when the input method is disposed.
- *
- * @param inputMethod the method to change status of
- * @param enable true to enable notification
- */
- void enableClientWindowNotification(InputMethod inputMethod, boolean enable);
-} // interface InputMethodContext
diff --git a/libjava/java/awt/im/spi/InputMethodDescriptor.java b/libjava/java/awt/im/spi/InputMethodDescriptor.java
deleted file mode 100644
index 093d7319217..00000000000
--- a/libjava/java/awt/im/spi/InputMethodDescriptor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* InputMethodDescriptor.java -- enables loading and use of an input method
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.im.spi;
-
-import java.awt.AWTException;
-import java.awt.Image;
-import java.util.Locale;
-
-/**
- * This interface provides information about an InputMethod before it is
- * loaded.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4
- */
-public interface InputMethodDescriptor
-{
- /**
- * Returns the locales supported by the input method this describes. This
- * allows the selection of input methods by locale (by language only, or
- * also by country and variant), via
- * {@link InputContext#selectInputMethod(Locale)}. The returned list should
- * ignore pass-through locales, so it is usually a subset of locales for
- * which {@link InputMethod#setContext(Locale)} returns true. If
- * {@link #hasDynamicLocaleList()} returns true, this is called each time
- * information is needed, allowing dynamic addition or removal of supported
- * locales.
- *
- * @return the list of supported locales
- * @throws AWTException if the input method is not available
- */
- Locale[] getAvailableLocales() throws AWTException;
-
- /**
- * Test whether the input method this describes has a static or dynamic
- * locale list. For example, this would return true if the list of supported
- * locales depends on adapters currently loaded over a network.
- *
- * @return true if the locale list is dynamic
- */
- boolean hasDynamicLocaleList();
-
- /**
- * Returns a user visible name of the input locale, displayed in the
- * specified locale. The inputLocale parameter must be one obtained from
- * the list in {@link #getAvailableLocales()}, or null for a
- * locale-independent description of the input method. If a translation to
- * the desired display language is not available, another language may be
- * used.
- *
- * @param inputLocale the locale of the input method, or null
- * @param displayLanguage the language of the result
- * @return the name of the input method when using the given inputLocale
- */
- String getInputMethodDisplayName(Locale inputLocale,
- Locale displayLanguage);
-
- /**
- * Returns a 16x16 icon for the input locale. The inputLocale parameter
- * must be one obtained from the list in {@link #getAvailableLocales()}, or
- * null for a locale-independent icon for the input method.
- *
- * @param inputLocale the locale of the input method, or null
- * @return a 16x16 icon for the input method when using the given inputLocale
- */
- Image getInputMethodIcon(Locale inputLocale);
-
- /**
- * Creates a new instance of the input method.
- *
- * @return the newly created input method
- * @throws Exception if anything goes wrong
- */
- InputMethod createInputMethod() throws Exception;
-
-} // interface InputMethodDescriptor
-
diff --git a/libjava/java/awt/image/AffineTransformOp.java b/libjava/java/awt/image/AffineTransformOp.java
deleted file mode 100644
index f11066e4e3d..00000000000
--- a/libjava/java/awt/image/AffineTransformOp.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/* AffineTransformOp.java -- This class performs affine
- transformation between two images or rasters in 2 dimensions.
- Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.NoninvertibleTransformException;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.util.Arrays;
-
-/**
- * This class performs affine transformation between two images or
- * rasters in 2 dimensions.
- *
- * @author Olga Rodimina (rodimina@redhat.com)
- */
-public class AffineTransformOp implements BufferedImageOp, RasterOp
-{
- public static final int TYPE_NEAREST_NEIGHBOR = 1;
-
- public static final int TYPE_BILINEAR = 2;
-
- /**
- * @since 1.5.0
- */
- public static final int TYPE_BICUBIC = 3;
-
- private AffineTransform transform;
- private RenderingHints hints;
-
- /**
- * Construct AffineTransformOp with the given xform and interpolationType.
- * Interpolation type can be TYPE_BILINEAR, TYPE_BICUBIC or
- * TYPE_NEAREST_NEIGHBOR.
- *
- * @param xform AffineTransform that will applied to the source image
- * @param interpolationType type of interpolation used
- */
- public AffineTransformOp (AffineTransform xform, int interpolationType)
- {
- this.transform = xform;
- if (xform.getDeterminant() == 0)
- throw new ImagingOpException(null);
-
- switch (interpolationType)
- {
- case TYPE_BILINEAR:
- hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BILINEAR);
- break;
- case TYPE_BICUBIC:
- hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- break;
- default:
- hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
- }
- }
-
- /**
- * Construct AffineTransformOp with the given xform and rendering hints.
- *
- * @param xform AffineTransform that will applied to the source image
- * @param hints rendering hints that will be used during transformation
- */
- public AffineTransformOp (AffineTransform xform, RenderingHints hints)
- {
- this.transform = xform;
- this.hints = hints;
- if (xform.getDeterminant() == 0)
- throw new ImagingOpException(null);
- }
-
- /**
- * Creates empty BufferedImage with the size equal to that of the
- * transformed image and correct number of bands. The newly created
- * image is created with the specified ColorModel.
- * If the ColorModel is equal to null, then image is created
- * with the ColorModel of the source image.
- *
- * @param src source image
- * @param destCM color model for the destination image
- * @return new compatible destination image
- */
- public BufferedImage createCompatibleDestImage (BufferedImage src,
- ColorModel destCM)
- {
-
- // if destCm is not specified, use color model of the source image
-
- if (destCM == null)
- destCM = src.getColorModel ();
-
- return new BufferedImage (destCM,
- createCompatibleDestRaster (src.getRaster ()),
- src.isAlphaPremultiplied (),
- null);
-
- }
-
- /**
- * Creates empty WritableRaster with the size equal to the transformed
- * source raster and correct number of bands
- *
- * @param src source raster
- * @throws RasterFormatException if resulting width or height of raster is 0
- * @return new compatible raster
- */
- public WritableRaster createCompatibleDestRaster (Raster src)
- {
- Rectangle rect = (Rectangle) getBounds2D (src);
-
- // throw RasterFormatException if resulting width or height of the
- // transformed raster is 0
-
- if (rect.getWidth () == 0 || rect.getHeight () == 0)
- throw new RasterFormatException("width or height is 0");
-
- return src.createCompatibleWritableRaster ((int) rect.getWidth (),
- (int) rect.getHeight ());
- }
-
- /**
- * Transforms source image using transform specified at the constructor.
- * The resulting transformed image is stored in the destination image.
- *
- * @param src source image
- * @param dst destination image
- * @return transformed source image
- */
- public final BufferedImage filter (BufferedImage src, BufferedImage dst)
- {
-
- if (dst == src)
- throw new IllegalArgumentException ("src image cannot be the same as the dst image");
-
- // If the destination image is null, then BufferedImage is
- // created with ColorModel of the source image
-
- if (dst == null)
- dst = createCompatibleDestImage(src, src.getColorModel ());
-
- // FIXME: Must check if color models of src and dst images are the same.
- // If it is not, then source image should be converted to color model
- // of the destination image
-
- Graphics2D gr = (Graphics2D) dst.createGraphics ();
- gr.setRenderingHints (hints);
- gr.drawImage (src, transform, null);
- return dst;
-
- }
-
- /**
- * Transforms source raster using transform specified at the constructor.
- * The resulting raster is stored in the destination raster.
- *
- * @param src source raster
- * @param dst destination raster
- * @return transformed raster
- */
- public final WritableRaster filter (Raster src, WritableRaster dst)
- {
- if (dst == src)
- throw new IllegalArgumentException("src image cannot be the same as"
- + " the dst image");
-
- if (dst == null)
- dst = createCompatibleDestRaster(src);
-
- if (src.getNumBands() != dst.getNumBands())
- throw new IllegalArgumentException("src and dst must have same number"
- + " of bands");
-
- double[] dpts = new double[dst.getWidth() * 2];
- double[] pts = new double[dst.getWidth() * 2];
- for (int x = 0; x < dst.getWidth(); x++)
- {
- dpts[2 * x] = x + dst.getMinX();
- dpts[2 * x + 1] = x;
- }
- Rectangle srcbounds = src.getBounds();
- if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
- {
- for (int y = dst.getMinY(); y < dst.getMinY() + dst.getHeight(); y++)
- {
- try {
- transform.inverseTransform(dpts, 0, pts, 0, dst.getWidth() * 2);
- } catch (NoninvertibleTransformException e) {
- // Can't happen since the constructor traps this
- e.printStackTrace();
- }
-
- for (int x = 0; x < dst.getWidth(); x++)
- {
- if (!srcbounds.contains(pts[2 * x], pts[2 * x + 1]))
- continue;
- dst.setDataElements(x + dst.getMinX(), y,
- src.getDataElements((int)pts[2 * x],
- (int)pts[2 * x + 1],
- null));
- }
- }
- }
- else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
- {
- double[] tmp = new double[4 * src.getNumBands()];
- for (int y = dst.getMinY(); y < dst.getMinY() + dst.getHeight(); y++)
- {
- try {
- transform.inverseTransform(dpts, 0, pts, 0, dst.getWidth() * 2);
- } catch (NoninvertibleTransformException e) {
- // Can't happen since the constructor traps this
- e.printStackTrace();
- }
-
- for (int x = 0; x < dst.getWidth(); x++)
- {
- if (!srcbounds.contains(pts[2 * x], pts[2 * x + 1]))
- continue;
- int xx = (int)pts[2 * x];
- int yy = (int)pts[2 * x + 1];
- double dx = (pts[2 * x] - xx);
- double dy = (pts[2 * x + 1] - yy);
-
- // TODO write this more intelligently
- if (xx == src.getMinX() + src.getWidth() - 1 ||
- yy == src.getMinY() + src.getHeight() - 1)
- {
- // bottom or right edge
- Arrays.fill(tmp, 0);
- src.getPixel(xx, yy, tmp);
- }
- else
- {
- // Normal case
- src.getPixels(xx, yy, 2, 2, tmp);
- for (int b = 0; b < src.getNumBands(); b++)
- tmp[b] = dx * dy * tmp[b]
- + (1 - dx) * dy * tmp[b + src.getNumBands()]
- + dx * (1 - dy) * tmp[b + 2 * src.getNumBands()]
- + (1 - dx) * (1 - dy) * tmp[b + 3 * src.getNumBands()];
- }
- dst.setPixel(x, y, tmp);
- }
- }
- }
- else
- {
- // Bicubic
- throw new UnsupportedOperationException("not implemented yet");
- }
-
- return dst;
- }
-
- /**
- * Transforms source image using transform specified at the constructor and
- * returns bounds of the transformed image.
- *
- * @param src image to be transformed
- * @return bounds of the transformed image.
- */
- public final Rectangle2D getBounds2D (BufferedImage src)
- {
- return getBounds2D (src.getRaster());
- }
-
- /**
- * Returns bounds of the transformed raster.
- *
- * @param src raster to be transformed
- * @return bounds of the transformed raster.
- */
- public final Rectangle2D getBounds2D (Raster src)
- {
- // determine new size for the transformed raster.
- // Need to calculate transformed coordinates of the lower right
- // corner of the raster. The upper left corner is always (0,0)
-
- double x2 = (double) src.getWidth () + src.getMinX ();
- double y2 = (double) src.getHeight () + src.getMinY ();
- Point2D p2 = getPoint2D (new Point2D.Double (x2,y2), null);
-
- Rectangle2D rect = new Rectangle (0, 0, (int) p2.getX (), (int) p2.getY ());
- return rect.getBounds ();
- }
-
- /**
- * Returns interpolation type used during transformations
- *
- * @return interpolation type
- */
- public final int getInterpolationType ()
- {
- if(hints.containsValue (RenderingHints.VALUE_INTERPOLATION_BILINEAR))
- return TYPE_BILINEAR;
- else
- return TYPE_NEAREST_NEIGHBOR;
- }
-
- /**
- * Returns location of the transformed source point. The resulting point
- * is stored in the dstPt if one is specified.
- *
- * @param srcPt point to be transformed
- * @param dstPt destination point
- * @return the location of the transformed source point.
- */
- public Point2D getPoint2D (Point2D srcPt, Point2D dstPt)
- {
- return transform.transform (srcPt, dstPt);
- }
-
- /**
- * Returns rendering hints that are used during transformation.
- *
- * @return rendering hints
- */
- public final RenderingHints getRenderingHints ()
- {
- return hints;
- }
-
- /**
- * Returns transform used in transformation between source and destination
- * image.
- *
- * @return transform
- */
- public final AffineTransform getTransform ()
- {
- return transform;
- }
-}
diff --git a/libjava/java/awt/image/AreaAveragingScaleFilter.java b/libjava/java/awt/image/AreaAveragingScaleFilter.java
deleted file mode 100644
index b9ca1b70758..00000000000
--- a/libjava/java/awt/image/AreaAveragingScaleFilter.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/* AreaAveragingScaleFilter.java -- Java class for filtering images
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-/**
- * This filter should produce images which do not have image artifacts
- * like broken lines which were originally unbroken. The cost is of
- * course speed. Using bi-linear interpolation here against 4 pixel
- * points should give the desired results although Sun does not
- * specify what the exact algorithm should be.
- * This method performs the inverse function of
- * This method performs the inverse function of
- *
- * The physical (array-based) storage is allocated by a subclass.
- *
- * @param dataType the data type.
- * @param size the number of elements in the buffer.
- */
- protected DataBuffer(int dataType, int size)
- {
- this.dataType = dataType;
- this.size = size;
- }
-
- /**
- * Creates a new
- * The physical (array-based) storage is allocated by a subclass.
- *
- * @param dataType the data type.
- * @param size the number of elements in the buffer.
- * @param numBanks the number of data banks.
- */
- protected DataBuffer(int dataType, int size, int numBanks) {
- this(dataType, size);
- banks = numBanks;
- offsets = new int[numBanks];
- }
-
- /**
- * Creates a new
- * The physical (array-based) storage is allocated by a subclass.
- *
- * @param dataType the data type.
- * @param size the number of elements in the buffer.
- * @param numBanks the number of data banks.
- * @param offset the offset to the first element for all banks.
- */
- protected DataBuffer(int dataType, int size, int numBanks, int offset) {
- this(dataType, size, numBanks);
-
- java.util.Arrays.fill(offsets, offset);
-
- this.offset = offset;
- }
-
- /**
- * Creates a new
- * The physical (array-based) storage is allocated by a subclass.
- *
- * @param dataType the data type.
- * @param size the number of elements in the buffer.
- * @param numBanks the number of data banks.
- * @param offsets the offsets to the first element for all banks.
- *
- * @throws ArrayIndexOutOfBoundsException if
- *
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when
- * Note: there is no exception when This method performs the inverse function of
- *
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 31 May 1998
- **/
-
-public class BeanDescriptor extends FeatureDescriptor {
- Class beanClass;
- Class customizerClass;
-
- /** Create a new BeanDescriptor with the given beanClass and
- ** no customizer class.
- ** @param beanClass the class of the Bean.
- **/
- public BeanDescriptor(Class beanClass) {
- this(beanClass,null);
- }
-
- /** Create a new BeanDescriptor with the given bean class and
- ** customizer class.
- ** @param beanClass the class of the Bean.
- ** @param customizerClass the class of the Bean's Customizer.
- **/
- public BeanDescriptor(Class beanClass, Class customizerClass) {
- this.beanClass = beanClass;
- this.customizerClass = customizerClass;
-
- // Set the FeatureDescriptor programmatic name.
- String name = beanClass.getName();
- int lastInd = name.lastIndexOf('.');
- if (lastInd != -1)
- name = name.substring(lastInd + 1);
-
- setName(name);
- }
-
- /** Get the Bean's class. **/
- public Class getBeanClass() {
- return beanClass;
- }
-
- /** Get the Bean's customizer's class. **/
- public Class getCustomizerClass() {
- return customizerClass;
- }
-}
diff --git a/libjava/java/beans/BeanInfo.java b/libjava/java/beans/BeanInfo.java
deleted file mode 100644
index 525500a389c..00000000000
--- a/libjava/java/beans/BeanInfo.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/* java.beans.BeanInfo
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-/**
- ** BeanInfo can be implemented in order to provide explicit information to the Introspector.
- **
- ** When you write a BeanInfo class, you implement this interface
- ** and provide explicit information by returning a non-null
- ** value from the appropriate method. If you wish the
- ** Introspector to determine certain information in the normal
- ** way, just return null (or in the case of int methods, return
- ** -1). There is a class called SimpleBeanInfo which returns
- ** null from all methods, which you may extend and only
- ** override the methods you wish to override.
- **
- ** When you have written the class, give it the name
- **
- **
- ** A simple note about the way the Introspector interacts with
- ** BeanInfo. Introspectors look at a Bean class and determine
- ** if there is a BeanInfo class with it. If there is not a
- ** BeanInfo class, it will behave as if the BeanInfo class
- ** provided was a SimpleBeanInfo class (i.e. it will determine
- ** all information automatically). If there is a BeanInfo
- ** class, then any methods that do *not* return null are
- ** regarded as providing definitive information about the class
- ** and all of its superclasses for those information types.
- ** Even if a parent BeanInfo class explicitly returns that
- ** information, it will not be used.
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 28 Jul 1998
- **/
-
-public interface BeanInfo {
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_COLOR_16x16 = 1;
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_COLOR_32x32 = 2;
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_MONO_16x16 = 3;
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_MONO_32x32 = 4;
-
- /** Get the general description of this Bean type.
- ** @return the BeanDescriptor for the Bean, or null if
- ** the BeanDescriptor should be obtained by
- ** Introspection.
- **/
- BeanDescriptor getBeanDescriptor();
-
- /** Get the events this Bean type fires.
- ** @return the EventDescriptors representing events this
- ** Bean fires. Returns
- **
- ** The order of precedence when two pieces of BeanInfo
- ** conflict (such as two PropertyDescriptors that have
- ** the same name), in order from highest precedence to
- ** lowest, is:
- **
- **
- ** Spec Note: It is possible that
- ** returning
- **
- ** Spec Note: If you do not support the
- ** type of icon that is being asked for, but you do
- ** support another type, it is unclear whether you should
- ** return the other type or not. I would presume not.
- **
- ** @param iconType the type of icon to get (see the
- ** ICON_* constants in this class).
- ** @return the icon, or null if that type of icon is
- ** unsupported by this Bean.
- **/
- java.awt.Image getIcon(int iconType);
-}
diff --git a/libjava/java/beans/Beans.java b/libjava/java/beans/Beans.java
deleted file mode 100644
index ffcb83fc1f3..00000000000
--- a/libjava/java/beans/Beans.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/* java.beans.Beans
- Copyright (C) 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.beans;
-
-import gnu.java.beans.DummyAppletStub;
-import gnu.java.io.ClassLoaderObjectInputStream;
-
-import java.applet.Applet;
-import java.beans.beancontext.BeanContext;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.net.URL;
-
-/**
- * This is a convenience method that calls This is a convenience method that calls In Beans 1.0 the instantiation scheme is as follows: The name should be dot-separated (e.g "place.for.beans.myBean") and indicate either a
- * serialized object or a class name. In the first case all dots in the name are replaced with
- * slashes ('/') and ".ser" is appended ("place.for.beans.myBean" becomes "place/for/beans/myBean.ser").
- * The bean is then loaded as an application or system resource depending on whether a
- * If no such resource exists or if it contains no bean the name is interpreted as a class name of
- * which an instance is then created. If a If the created Bean is an A Defaults to true. Defaults to false.
- **
- ** A Customizer is meant to be embedded in an RAD tool,
- ** and thus must be a descendant of
- **
- ** It must also have a constructor with no arguments. This
- ** is the constructor that will be called by the RAD tool to
- ** instantiate the Customizer.
- **
- ** Over its lifetime, an instance of a Customizer will only
- ** customize one single Bean. A new instance of the
- ** Customizer will be instantiated to edit any other Beans.
- **
- ** The Customizer is responsible for notifying its
- ** PropertyChangeListeners of any changes that are made,
- ** according to the rules of PropertyChangeListeners (i.e.
- ** notify the clients after the property has
- ** changed).
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 29 Jul 1998
- ** @see java.beans.BeanDescriptor.getCustomizerClass()
- **/
-
-public interface Customizer {
- /** Set the object to Customize. This will always be a
- ** Bean that had a BeanDescriptor indicating this
- ** Customizer.
- ** @param bean the Bean to customize.
- **/
- void setObject(Object bean);
-
- /** Add a PropertyChangeListener.
- ** @param l the PropertyChangeListener to add.
- **/
- void addPropertyChangeListener(PropertyChangeListener l);
-
- /** Remove a PropertyChangeListener.
- ** @param l the PropertyChangeListener to remove.
- **/
- void removePropertyChangeListener(PropertyChangeListener l);
-}
diff --git a/libjava/java/beans/DesignMode.java b/libjava/java/beans/DesignMode.java
deleted file mode 100644
index 39805d50c18..00000000000
--- a/libjava/java/beans/DesignMode.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* java.beans.DesignMode
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-/**
- *
- *
- * EventHandler forms a bridge between dynamically created listeners and
- * arbitrary properties and methods. You can use this class to easily create listener implementations for
- * some basic interactions between an event source and its target. Using
- * the three static methods named See the documentation of each method for usage examples. Typical creation is done with the create method, not by knewing an
- * EventHandler. This constructs an EventHandler that will connect the method
- * listenerMethodName to target.action, extracting eventPropertyName from
- * the first argument of listenerMethodName. and sending it to action. Throws a This method is normally called by the listener's proxy implementation. Returns the primitive type for every wrapper class or the
- * class itself if it is no wrapper class. This is needed because to be able to find both kinds of methods:
- * One that takes a wrapper class as the first argument and one that
- * accepts a primitive instead. Constructs an implementation of You can use such an implementation to simply call a public
- * no-argument method of an arbitrary target object or to forward
- * the first argument of the listener method to the target method. Call this method like: to achieve the following behavior: That means if you need a listener implementation that simply calls a
- * a no-argument method on a given instance for each
- * method of the listener interface. Note: The The In case that the method of the target object throws an exception
- * it will be wrapped in a In case that the method of the target object cannot be found an
- * A call to this method is equivalent to:
- * Constructs an implementation of Use this method if you want to create an implementation that retrieves
- * a property value from the first argument of the listener method
- * and applies it to the target's property or method. This first argument
- * of the listener is usually an event object but any other object is
- * valid, too. You can set the value of If you set An exception thrown in any of these methods will provoke a
- * If you set Any object retrieved from the event object and applied to the
- * target will converted from primitives to their wrapper class or
- * vice versa or applied to a method that accepts a superclass
- * of the object. Examples: The following code: Can be expressed using the
- * As said above you can specify the target as a method, too:
- * Furthermore you can use method names in the property:
- * Finally you can mix names:
- * A call to this method is equivalent to:
- * Constructs an implementation of Besides the functionality described for {@link create(Class, Object, String)}
- * and {@link create(Class, Object, String, String)} this method allows you
- * to filter the listener method that should have an effect. Look at these
- * method's documentation for more information about the If you want to call
- * A
- **
- ** The methods have these constraints on them:
- **
- **
- ** There are also various design patterns associated with some of the methods
- ** of construction. Those are explained in more detail in the appropriate
- ** constructors.
- **
- ** Documentation Convention: for proper
- ** Internalization of Beans inside an RAD tool, sometimes there
- ** are two names for a property or method: a programmatic, or
- ** locale-independent name, which can be used anywhere, and a
- ** localized, display name, for ease of use. In the
- ** documentation I will specify different String values as
- ** either programmatic or localized to
- ** make this distinction clear.
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 31 May 1998
- **/
-
-public class EventSetDescriptor extends FeatureDescriptor {
- private Method addListenerMethod;
- private Method removeListenerMethod;
- private Class listenerType;
- private MethodDescriptor[] listenerMethodDescriptors;
- private Method[] listenerMethods;
-
- private boolean unicast;
- private boolean inDefaultEventSet = true;
-
- /** Create a new EventSetDescriptor.
- ** This version of the constructor enforces the rules imposed on the methods
- ** described at the top of this class, as well as searching for:
- **
- **
- ** @param eventSourceClass the class containing the add and remove listener methods.
- ** @param eventSetName the programmatic name of the event set, generally starting
- ** with a lowercase letter (i.e. fooManChu instead of FooManChu).
- ** @param listenerType the class containing the event firing methods.
- ** @param listenerMethodNames the names of the even firing methods.
- ** @param addListenerMethodName the name of the add listener method.
- ** @param removeListenerMethodName the name of the remove listener method.
- ** @exception IntrospectionException if listenerType is not an EventListener
- ** or if methods are not found or are invalid.
- **/
- public EventSetDescriptor(Class eventSourceClass,
- String eventSetName,
- Class listenerType,
- String[] listenerMethodNames,
- String addListenerMethodName,
- String removeListenerMethodName) throws IntrospectionException {
- setName(eventSetName);
- if(!java.util.EventListener.class.isAssignableFrom(listenerType)) {
- throw new IntrospectionException("Listener type is not an EventListener.");
- }
-
- findMethods(eventSourceClass,listenerType,listenerMethodNames,addListenerMethodName,removeListenerMethodName,null);
- this.listenerType = listenerType;
- checkAddListenerUnicast();
- if(this.removeListenerMethod.getExceptionTypes().length > 0) {
- throw new IntrospectionException("Listener remove method throws exceptions.");
- }
- }
-
- /** Create a new EventSetDescriptor.
- ** This form of constructor allows you to explicitly say which methods do what, and
- ** no reflection is done by the EventSetDescriptor. The methods are, however,
- ** checked to ensure that they follow the rules set forth at the top of the class.
- ** @param eventSetName the programmatic name of the event set, generally starting
- ** with a lowercase letter (i.e. fooManChu instead of FooManChu).
- ** @param listenerType the class containing the listenerMethods.
- ** @param listenerMethods the event firing methods.
- ** @param addListenerMethod the add listener method.
- ** @param removeListenerMethod the remove listener method.
- ** @exception IntrospectionException if the listenerType is not an EventListener,
- ** or any of the methods are invalid.
- **/
- public EventSetDescriptor(String eventSetName,
- Class listenerType,
- Method[] listenerMethods,
- Method addListenerMethod,
- Method removeListenerMethod) throws IntrospectionException {
- setName(eventSetName);
- if(!java.util.EventListener.class.isAssignableFrom(listenerType)) {
- throw new IntrospectionException("Listener type is not an EventListener.");
- }
-
- this.listenerMethods = listenerMethods;
- this.addListenerMethod = addListenerMethod;
- this.removeListenerMethod = removeListenerMethod;
- this.listenerType = listenerType;
- checkMethods();
- checkAddListenerUnicast();
- if(this.removeListenerMethod.getExceptionTypes().length > 0) {
- throw new IntrospectionException("Listener remove method throws exceptions.");
- }
- }
-
- /** Create a new EventSetDescriptor.
- ** This form of constructor allows you to explicitly say which methods do what, and
- ** no reflection is done by the EventSetDescriptor. The methods are, however,
- ** checked to ensure that they follow the rules set forth at the top of the class.
- ** @param eventSetName the programmatic name of the event set, generally starting
- ** with a lowercase letter (i.e. fooManChu instead of FooManChu).
- ** @param listenerType the class containing the listenerMethods.
- ** @param listenerMethodDescriptors the event firing methods.
- ** @param addListenerMethod the add listener method.
- ** @param removeListenerMethod the remove listener method.
- ** @exception IntrospectionException if the listenerType is not an EventListener,
- ** or any of the methods are invalid.
- **/
- public EventSetDescriptor(String eventSetName,
- Class listenerType,
- MethodDescriptor[] listenerMethodDescriptors,
- Method addListenerMethod,
- Method removeListenerMethod) throws IntrospectionException {
- setName(eventSetName);
- if(!java.util.EventListener.class.isAssignableFrom(listenerType)) {
- throw new IntrospectionException("Listener type is not an EventListener.");
- }
-
- this.listenerMethodDescriptors = listenerMethodDescriptors;
- this.listenerMethods = new Method[listenerMethodDescriptors.length];
- for(int i=0;i
- **
- ** An example property would have four methods like this:
- **
- **
- ** The constraints put on get and set methods are:
- **
- **
- ** Implementation note: If there is a get(int) method,
- ** then the return type of that method is used to find the
- ** remaining methods. If there is no get method, then the
- ** set(int) method is searched for exhaustively and that type
- ** is used to find the others.
- **
- ** Spec note:
- ** If there is no get(int) method and multiple set(int) methods with
- ** the same name and the correct parameters (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Class beanClass) throws IntrospectionException {
- super(name);
- String capitalized;
- try {
- capitalized = Character.toUpperCase(name.charAt(0)) + name.substring(1);
- } catch(StringIndexOutOfBoundsException e) {
- capitalized = "";
- }
- findMethods(beanClass, "get" + capitalized, "set" + capitalized, "get" + capitalized, "set" + capitalized);
- }
-
- /** Create a new IndexedPropertyDescriptor by introspection.
- ** This form of constructor allows you to specify the
- ** names of the get and set methods to search for.
- **
- ** Implementation note: If there is a get(int) method,
- ** then the return type of that method is used to find the
- ** remaining methods. If there is no get method, then the
- ** set(int) method is searched for exhaustively and that type
- ** is used to find the others.
- **
- ** Spec note:
- ** If there is no get(int) method and multiple set(int) methods with
- ** the same name and the correct parameters (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @param getMethodName the name of the get array method.
- ** @param setMethodName the name of the set array method.
- ** @param getIndexName the name of the get index method.
- ** @param setIndexName the name of the set index method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Class beanClass, String getMethodName, String setMethodName, String getIndexName, String setIndexName) throws IntrospectionException {
- super(name);
- findMethods(beanClass, getMethodName, setMethodName, getIndexName, setIndexName);
- }
-
- /** Create a new PropertyDescriptor using explicit Methods.
- ** Note that the methods will be checked for conformance to standard
- ** Property method rules, as described above at the top of this class.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param getMethod the get array method.
- ** @param setMethod the set array method.
- ** @param getIndex the get index method.
- ** @param setIndex the set index method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- 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 Class getIndexedPropertyType() {
- return indexedPropertyType;
- }
-
- public Method getIndexedReadMethod() {
- return getIndex;
- }
-
- public Method getIndexedWriteMethod() {
- return setIndex;
- }
-
- private void findMethods(Class beanClass, String getMethodName, String setMethodName, String getIndexName, String setIndexName) throws IntrospectionException {
- try {
- if(getIndexName != null) {
- try {
- Class[] getArgs = new Class[1];
- getArgs[0] = java.lang.Integer.TYPE;
- getIndex = beanClass.getMethod(getIndexName,getArgs);
- indexedPropertyType = getIndex.getReturnType();
- } catch(NoSuchMethodException E) {
- }
- }
- if(getIndex != null) {
- if(setIndexName != null) {
- try {
- Class[] setArgs = new Class[2];
- setArgs[0] = java.lang.Integer.TYPE;
- setArgs[1] = indexedPropertyType;
- setIndex = beanClass.getMethod(setIndexName,setArgs);
- if(!setIndex.getReturnType().equals(java.lang.Void.TYPE)) {
- throw new IntrospectionException(setIndexName + " has non-void return type");
- }
- } catch(NoSuchMethodException E) {
- }
- }
- } else if(setIndexName != null) {
- Method[] m = beanClass.getMethods();
- for(int i=0;i
- *
- * Order of Operations
- *
- * When you call getBeanInfo(class c), the Introspector
- * first searches for BeanInfo class to see if you
- * provided any explicit information. It searches for a
- * class named <bean class name>BeanInfo in different
- * packages, first searching the bean class's package
- * and then moving on to search the beanInfoSearchPath.
- *
- * If it does not find a BeanInfo class, it acts as though
- * it had found a BeanInfo class returning null from all
- * methods (meaning it should discover everything through
- * Introspection). If it does, then it takes the
- * information it finds in the BeanInfo class to be
- * canonical (that is, the information speaks for its
- * class as well as all superclasses).
- *
- * When it has introspected the class, calls
- * getBeanInfo(c.getSuperclass) and adds that information
- * to the information it has, not adding to any information
- * it already has that is canonical.
- *
- * Introspection Design Patterns
- *
- * When the Introspector goes in to read the class, it
- * follows a well-defined order in order to not leave any
- * methods unaccounted for. Its job is to step over all
- * of the public methods in a class and determine whether
- * they are part of a property, an event, or a method (in
- * that order).
- *
- *
- * Properties:
- *
- *
- *
- * If there is a pair of methods,
- *
- *
- * If the addXXX() method throws
- *
- *
- * Spec Note: the spec seems to say that
- * the listener type's classname must be equal to the XXX
- * part of addXXX() and removeXXX(), but that is not the
- * case in Sun's implementation, so I am assuming it is
- * not the case in general.
- *
- * Methods:
- *
- * Any public methods (including those which were used
- * for Properties or Events) are used as Methods.
- *
- * @author John Keiser
- * @since JDK1.1
- * @see java.beans.BeanInfo
- */
-public class Introspector {
-
- public static final int USE_ALL_BEANINFO = 1;
- public static final int IGNORE_IMMEDIATE_BEANINFO = 2;
- public static final int IGNORE_ALL_BEANINFO = 3;
-
- static String[] beanInfoSearchPath = {"gnu.java.beans.info"};
- static Hashtable beanInfoCache = new Hashtable();
-
- private Introspector() {}
-
- /**
- * Get the BeanInfo for class
- **
- ** The constraints put on get and set methods are:
- **
- **
- ** Note that using this constructor the given property must be read- and
- ** writeable. If the implementation does not both, a read and a write method, an
- **
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @exception IntrospectionException if the methods are not found
- ** or invalid.
- **/
- public PropertyDescriptor(String name, Class beanClass)
- throws IntrospectionException
- {
- setName(name);
- if (name.length() == 0)
- {
- throw new IntrospectionException("empty property name");
- }
- String caps = Character.toUpperCase(name.charAt(0)) + name.substring(1);
- findMethods(beanClass, "is" + caps, "get" + caps, "set" + caps);
-
- if (getMethod == null)
- {
- throw new IntrospectionException(
- "Cannot find a is" + caps + " or get" + caps + " method");
- }
-
- if (setMethod == null)
- {
- throw new IntrospectionException(
- "Cannot find a " + caps + " method");
- }
-
- // finally check the methods compatibility
- propertyType = checkMethods(getMethod, setMethod);
- }
-
- /** Create a new PropertyDescriptor by introspection.
- ** This form of constructor allows you to specify the
- ** names of the get and set methods to search for.
- **
- ** Implementation note: If there is a get method (or
- ** boolean isXXX() method), then the return type of that method
- ** is used to find the set method. If there is no get method,
- ** then the set method is searched for exhaustively.
- **
- ** Spec note:
- ** If there is no get method and multiple set methods with
- ** the same name and a single parameter (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @param getMethodName the name of the get method or
- ** If these things are not true, then the behavior of the system
- ** will be undefined.
- **
- ** When a property is bound, its set method is required to fire the
- **
- ** When a property is constrained, its set method is required to:
- **
- **
- ** A PropertyEditor must be able to display its contents when asked to and
- ** be able to allow the user to change its underlying field value. However, it
- ** is not the PropertyEditor's responsibility to make the change to the
- ** underlying Object; in fact, the PropertyEditor does not even know about the
- ** Object it is actually editing--only about the property it is currently
- ** editing. When a change is made to the property, the PropertyEditor must
- ** simply fire a PropertyChangeEvent and allow the RAD tool to actually set
- ** the property in the underlying Bean.
- **
- ** PropertyEditors should not change the Objects they are given by setValue().
- ** These Objects may or may not be the actual Objects which are properties of
- ** the Bean being edited. Instead, PropertyEditors should create a new Object
- ** and fire a PropertyChangeEvent with the old and new values.
- **
- ** PropertyEditors also must support the ability to return a Java
- ** initialization string. See the getJavaInitializationString() method for
- ** details.
- **
- ** There are several different ways a PropertyEditor may display and control
- ** editing of its value. When multiple types of input and display are
- ** given by a single PropertyEditor, the RAD tool may decide which of the call
- ** to support. Some RAD tools may even be text-only, so even if you support
- ** a graphical set and get, it may choose the text set and get whenever it can.
- **
- **
- ** A PropertyChangeEvent should be thrown from the PropertyEditor whenever a
- ** bound property (a property PropertyDescriptor.isBound() set to true)
- ** changes. When this happens, the editor itself should *not* change the value
- ** itself, but rather allow the RAD tool to call setValue() or setAsText().
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 30 June 1998
- ** @see java.beans.PropertyEditorManager
- ** @see java.beans.PropertyEditorSupport
- **/
-
-public interface PropertyEditor {
- /** Called by the RAD tool to set the value of this property for the PropertyEditor.
- ** If the property type is native, it should be wrapped in the appropriate
- ** wrapper type.
- ** @param value the value to set this property to.
- **/
- void setValue(Object value);
-
- /** Accessor method to get the current value the PropertyEditor is working with.
- ** If the property type is native, it will be wrapped in the appropriate
- ** wrapper type.
- ** @return the current value of the PropertyEditor.
- **/
- Object getValue();
-
-
- /** Set the value of this property using a String.
- ** Whether or not this PropertyEditor is editing a String type, this converts
- ** the String into the type of the PropertyEditor.
- ** @param text the text to set it to.
- ** @exception IllegalArgumentException if the String is in the wrong format or setAsText() is not supported.
- **/
- void setAsText(String text) throws IllegalArgumentException;
-
- /** Get the value of this property in String format.
- ** Many times this can simply use Object.toString().
- ** Return null if you do not support getAsText()/setAsText().
- **
- ** This method should do a silent no-op if isPaintable() is false.
- ** @param g the Graphics context to paint on
- ** @param bounds the rectangle you have reserved to work in
- **/
- void paintValue(java.awt.Graphics g, java.awt.Rectangle bounds);
-
-
- /** The RAD tool calls this to find out whether the PropertyEditor supports a custom component to edit and display itself.
- ** @return true if getCustomEditor() will return a component, false if not.
- **/
- boolean supportsCustomEditor();
-
- /** The RAD tool calls this to grab the component that can edit this type.
- ** The component may be painted anywhere the RAD tool wants to paint it--
- ** even in its own window.
- ** The component must hook up with the PropertyEditor and, whenever a
- ** change to the value is made, fire a PropertyChangeEvent to the source.
- ** @return the custom editor for this property type.
- **/
- java.awt.Component getCustomEditor();
-
-
- /** Adds a property change listener to this PropertyEditor.
- ** @param listener the listener to add
- **/
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- /** Removes a property change listener from this PropertyEditor.
- ** @param listener the listener to remove
- **/
- void removePropertyChangeListener(PropertyChangeListener listener);
-
- /** Get a Java language-specific String which could be used to create an Object
- ** of the specified type. Every PropertyEditor must support this.
- ** The reason for this is that while most RAD tools will serialize the Beans
- ** and deserialize them at runtime, some RAD tools will generate code that
- ** creates the Beans. Examples of Java initialization strings would be:
- **
- *
- * It first checks to see if the property editor is
- * already registered; if it is, that property editor is
- * used. Next it takes the type's classname and appends
- * "Editor" to it, and searches first in the class's
- * package and then in the property editor search path.
- *
- * Default property editors are provided for: Spec Suggestion: Perhaps an editor for
- * Filename or something like it should be provided. As well
- * as char.
- * Implementation Note: This class
- * returns the string "@$#^" to make sure the code will
- * be broken, so that you will know to override it when
- * you create your own property editor.
- *
- * @return the Java initialization string.
- */
- public String getJavaInitializationString()
- {
- return "@$#^";
- }
-
- /** Gets the value as text.
- * In this class, you cannot count on getAsText() doing
- * anything useful, although in this implementation I
- * do toString().
- *
- * @return the value as text.
- */
- public String getAsText()
- {
- return value != null ? value.toString() : "null";
- }
-
- /** Sets the value as text.
- * In this class, you cannot count on setAsText() doing
- * anything useful across implementations.
- * Implementation Note: In this
- * implementation it checks if the String is "null", and
- * if it is, sets the value to null, otherwise it throws
- * an IllegalArgumentException.
- *
- * @param s the text to convert to a new value.
- * @exception IllegalArgumentException if the text is
- * malformed.
- */
- public void setAsText(String s) throws IllegalArgumentException
- {
- if (s.equals("null"))
- setValue(null);
- else
- throw new IllegalArgumentException();
- }
-
- /** Returns a list of possible choices for the value.
- *
- * @return
- **
- ** Overriding one or two of these functions
- ** to give explicit information on only those things you
- ** wish to give explicit information is perfectly safe,
- ** and even desirable.
- **
- ** See the BeanInfo class for information on what the
- ** various methods actually do.
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 29 Jul 1998
- ** @see java.beans.BeanInfo
- **/
-
-public class SimpleBeanInfo implements BeanInfo {
- /** Force Introspection of the general bean info.
- ** @return Note: This class may not be reliably used to determine
- * whether a property has actually changed. Use the PropertyChangeListener
- * interface for that instead.
- *
- * @author John Keiser
- * @see java.beans.PropertyChangeListener
- * @see java.beans.VetoableChangeSupport
- * @since 1.1
- * @status updated to 1.4
- */
-public interface VetoableChangeListener extends EventListener
-{
- /**
- * Fired before a Bean's property changes.
- *
- * @param e the change (containing the old and new values)
- * @throws PropertyVetoException if the change is vetoed by the listener
- */
- void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException;
-} // interface VetoableChangeListener
diff --git a/libjava/java/beans/VetoableChangeListenerProxy.java b/libjava/java/beans/VetoableChangeListenerProxy.java
deleted file mode 100644
index 56ca5a38c7f..00000000000
--- a/libjava/java/beans/VetoableChangeListenerProxy.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* VetoableChangeListenerProxy.java -- adds a name to a vetoable listener
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.util.EventListenerProxy;
-
-/**
- * This class provides an extension to
- *
- * Sun decided not to use standard Introspection patterns so that these
- * methods did not get included when the Introspector made its sweep on
- * the class.
- *
- * @author John Keiser
- * @since JDK1.1
- * @version 1.1.0, 29 Jul 1998
- */
-
-public interface Visibility {
- /**
- * Tells whether the Bean can run without a GUI or not.
- * @return false if Bean can run without a GUI, else true.
- */
- boolean needsGui();
-
- /**
- * Tells whether Bean is trying not to use the GUI.
- * If needsGui() is true, this method should always return false.
- * @return true if definitely not using GUI, otherwise false.
- */
- boolean avoidingGui();
-
- /**
- * Tells the Bean not to use GUI methods.
- * If needsGUI() is false, then after this method is called,
- * avoidingGui() should return true.
- */
- void dontUseGui();
-
- /**
- * Tells the Bean it may use the GUI.
- * The Bean is not required to use the GUI in this case, it is
- * merely being permitted to use it. If needsGui() is
- * false, avoidingGui() may return true or false after this method
- * is called.
- */
- void okToUseGui();
-}
diff --git a/libjava/java/beans/XMLDecoder.java b/libjava/java/beans/XMLDecoder.java
deleted file mode 100644
index 238fd6bed91..00000000000
--- a/libjava/java/beans/XMLDecoder.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/* java.beans.XMLDecoder --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import gnu.java.beans.decoder.DefaultExceptionListener;
-import gnu.java.beans.decoder.PersistenceParser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * The XMLDecoder reads XML data that is structured according to
- * this DTD
- * and creates objects according to the content. Usually such data is generated using the
- * {@link XMLEncoder} class.
- *
- * An example XML document might look like this:
- * To read the Besides this basic functionality the An owner object can be set using the Please note that changing the owner after the having read the first object has no effect,
- * because all object have been decoded then. If the Note that changing the ExceptionListener instance after At last one can provide a specific Note: If the See the description of the {@link #readObject()} for the effect caused by See the description of {@link XMLDecoder} class for more information on the ExceptionListener. See the description of {@link XMLDecoder} class for more information on the owner object. Note that the actual decoding takes place when the method is called for the first time. If the If the InputStream instance used in the constructors was See the description of {@link XMLDecoder} class for more information on the ExceptionListener. See the description of {@link XMLDecoder} class for more information on the owner object.
- *
- * Since I can't sprinkle the
- *
- *
- *
- *
- *
- *
- *
- * Similarly,
- *
- * A hierarchy of beans is mainly useful so that different sets of beans
- * can be established, each with their own set of resources.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContext
- extends Collection, BeanContextChild, Visibility, DesignMode {
-
- /**
- * The global lock on changing any BeanContext hierarchy.
- * It kinda sucks that there is only one lock, since there can be
- * multiple hierarchies. Oh well, I didn't design, I just code.
- *
- *
- * Methods that must (or do) synchronize on the global lock:
- *
- *
- * This method exists mainly so that
- *
- * Beans should call this method on their parent rather than the
- * associated
- *
- * I am assuming, but am not entirely sure, that if a
- *
- *
- * Beans should call this method on their parent rather than the
- * associated
- *
- * I am assuming, but am not entirely sure, that if a
- *
- *
- * The difference between a
- *
- *
- *
- * If you do not do this, when the
- *
- * Before dying, a
- *
- * This method is called from
- *
- * When this Object is being added to a new BeanContext or moved
- * from an old one, a non-null value will be passed in.
- *
- *
- * When this Object is being removed from the current
- *
- *
- * When being removed from the current
- *
- * This change should generate
- *
- * If the Bean does not wish to change the parent or be removed
- * from one, it may throw the
- *
- * If you do veto the change, you must first back out any changes
- * you made prior to the veto. Best not to make any such changes
- * prior to the veto in the first place.
- *
- *
- * This method is called from
- *
- * When extending this class, this variable will be set to
- *
- *
- * When this Object is being added to a new BeanContext or moved
- * from an old one, a non-null value will be passed in.
- *
- *
- * When this Object is being removed from the current
- *
- *
- * Order of events:
- *
- *
- * @param newBeanContext the new parent for the
- *
- *
- * This method is meant to be overriden.
- *
- *
- * This method is meant to be overriden.
- *
- *
- * This method is meant to be overriden.
- *
- *
- * This method is meant to be overriden.
- *
- *
- * This method is meant to be overriden.
- *
- *
- * Don't shoot yourself in the foot: if you already implement
- *
- *
- * It is the
- *
- * If for some reason it can no longer provide services for a particular
- * class, this class must invoke
- * If the requested service class is not available, or if this
- *
- *
- * Called by
- *
- * Most
- *
- * If the specified service class does not have a finite number of
- * valid service selectors, it should return
- *
- * If it has no valid service selectors, it should still return an empty
- *
- *
- * This is apparently so that you can import a bunch of services into a
- * RAD tool and it will know about all of them and export them to the
- * user in a readable manner.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-public interface BeanContextServiceProviderBeanInfo extends BeanInfo {
- /**
- * Get
- *
- * If
- *
- * If it is
- *
- * If all copies of the service's class have been relinquished by
- * the requestor, the
- *
- * The specified listener will be registered to receive a
- * revocation notice for the specified serviceClass. One
- * notification per service class per requestor object will be
- * sent.
- *
- *
- * The listener will be unregistered when all services that were
- * obtained by that requestor for that service class are released.
- *
- *
- * If the requested service class is not available, or if this
- *
- *
- * This method may throw unchecked exceptions, so watch out.
- *
- * @specnote it is not specified what happens when two subsequent
- * calls are made to
- *
- * This method must synchronize on
- *
- *
- * If the specified service class does not have a finite number of
- * valid service selectors, it should return
- *
- * If it has no valid service selectors, it should still return an empty
- *
- * This class also implements mark/reset functionality. It is capable
- * of remembering any number of input chars, to the limits of
- * system memory or the size of
- * Note that the number of chars that can be remembered by this method
- * can be greater than the size of the internal read buffer. It is also
- * not dependent on the subordinate stream supporting mark/reset
- * functionality.
- *
- * @param readLimit The number of chars that can be read before the mark
- * becomes invalid
- *
- * @exception IOException If an error occurs
- * @exception IllegalArgumentException if readLimit is negative.
- */
- public void mark(int readLimit) throws IOException
- {
- if (readLimit < 0)
- throw new IllegalArgumentException("Read-ahead limit is negative");
-
- synchronized (lock)
- {
- checkStatus();
- // In this method we need to be aware of the special case where
- // pos + 1 == limit. This indicates that a '\r' was the last char
- // in the buffer during a readLine. We'll want to maintain that
- // condition after we shift things around and if a larger buffer is
- // needed to track readLimit, we'll have to make it one element
- // larger to ensure we don't invalidate the mark too early, if the
- // char following the '\r' is NOT a '\n'. This is ok because, per
- // the spec, we are not required to invalidate when passing readLimit.
- //
- // Note that if 'pos > limit', then doing 'limit -= pos' will cause
- // limit to be negative. This is the only way limit will be < 0.
-
- if (pos + readLimit > limit)
- {
- char[] old_buffer = buffer;
- int extraBuffSpace = 0;
- if (pos > limit)
- extraBuffSpace = 1;
- if (readLimit + extraBuffSpace > limit)
- buffer = new char[readLimit + extraBuffSpace];
- limit -= pos;
- if (limit >= 0)
- {
- System.arraycopy(old_buffer, pos, buffer, 0, limit);
- pos = 0;
- }
- }
-
- if (limit < 0)
- {
- // Maintain the relationship of 'pos > limit'.
- pos = 1;
- limit = markPos = 0;
- }
- else
- markPos = pos;
- // Now pos + readLimit <= buffer.length. thus if we need to read
- // beyond buffer.length, then we are allowed to invalidate markPos.
- }
- }
-
- /**
- * Reset the stream to the point where the
- * This method will throw an IOException if the number of chars read from
- * the stream since the call to
- * This method will block until some data can be read.
- *
- * @param buf The array into which the chars read should be stored
- * @param offset The offset into the array to start storing chars
- * @param count The requested number of chars to read
- *
- * @return The actual number of chars read, or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- * @exception IndexOutOfBoundsException If offset and count are not
- * valid regarding buf.
- */
- public int read(char[] buf, int offset, int count) throws IOException
- {
- if (offset < 0 || offset + count > buf.length || count < 0)
- throw new IndexOutOfBoundsException();
-
- synchronized (lock)
- {
- checkStatus();
- // Once again, we need to handle the special case of a readLine
- // that has a '\r' at the end of the buffer. In this case, we'll
- // need to skip a '\n' if it is the next char to be read.
- // This special case is indicated by 'pos > limit'.
- boolean retAtEndOfBuffer = false;
-
- int avail = limit - pos;
- if (count > avail)
- {
- if (avail > 0)
- count = avail;
- else // pos >= limit
- {
- if (limit == buffer.length)
- markPos = -1; // read too far - invalidate the mark.
- if (pos > limit)
- {
- // Set a boolean and make pos == limit to simplify things.
- retAtEndOfBuffer = true;
- --pos;
- }
- if (markPos < 0)
- {
- // Optimization: can read directly into buf.
- if (count >= buffer.length && !retAtEndOfBuffer)
- return in.read(buf, offset, count);
- pos = limit = 0;
- }
- avail = in.read(buffer, limit, buffer.length - limit);
- if (retAtEndOfBuffer && avail > 0 && buffer[limit] == '\n')
- {
- --avail;
- limit++;
- }
- if (avail < count)
- {
- if (avail <= 0)
- return avail;
- count = avail;
- }
- limit += avail;
- }
- }
- System.arraycopy(buffer, pos, buf, offset, count);
- pos += count;
- return count;
- }
- }
-
- /* Read more data into the buffer. Update pos and limit appropriately.
- Assumes pos==limit initially. May invalidate the mark if read too much.
- Return number of chars read (never 0), or -1 on eof. */
- private int fill() throws IOException
- {
- checkStatus();
- // Handle the special case of a readLine that has a '\r' at the end of
- // the buffer. In this case, we'll need to skip a '\n' if it is the
- // next char to be read. This special case is indicated by 'pos > limit'.
- boolean retAtEndOfBuffer = false;
- if (pos > limit)
- {
- retAtEndOfBuffer = true;
- --pos;
- }
-
- if (markPos >= 0 && limit == buffer.length)
- markPos = -1;
- if (markPos < 0)
- pos = limit = 0;
- int count = in.read(buffer, limit, buffer.length - limit);
- if (count > 0)
- limit += count;
-
- if (retAtEndOfBuffer && buffer[pos] == '\n')
- {
- --count;
- // If the mark was set to the location of the \n, then we
- // must change it to fully pretend that the \n does not
- // exist.
- if (markPos == pos)
- ++markPos;
- ++pos;
- }
-
- return count;
- }
-
- public int read() throws IOException
- {
- synchronized (lock)
- {
- checkStatus();
- if (pos >= limit && fill () <= 0)
- return -1;
- return buffer[pos++];
- }
- }
-
- /* Return the end of the line starting at this.pos and ending at limit.
- * The index returns is *before* any line terminators, or limit
- * if no line terminators were found.
- */
- private int lineEnd(int limit)
- {
- int i = pos;
- for (; i < limit; i++)
- {
- char ch = buffer[i];
- if (ch == '\n' || ch == '\r')
- break;
- }
- return i;
- }
-
- /**
- * This method reads a single line of text from the input stream, returning
- * it as a
- * This method first discards chars in the buffer, then calls the
- *
- * Note that this array is not copied. If its contents are changed
- * while this stream is being read, those changes will be reflected in the
- * bytes supplied to the reader. Please use caution in changing the
- * contents of the buffer while this stream is open.
- *
- * @param buffer The byte array buffer this stream will read from.
- */
- public ByteArrayInputStream(byte[] buffer)
- {
- this(buffer, 0, buffer.length);
- }
-
- /**
- * Create a new ByteArrayInputStream that will read bytes from the
- * passed in byte array. This stream will read from position
- *
- * Note that this array is not copied. If its contents are changed
- * while this stream is being read, those changes will be reflected in the
- * bytes supplied to the reader. Please use caution in changing the
- * contents of the buffer while this stream is open.
- *
- * @param buffer The byte array buffer this stream will read from.
- * @param offset The index into the buffer to start reading bytes from
- * @param length The number of bytes to read from the buffer
- */
- public ByteArrayInputStream(byte[] buffer, int offset, int length)
- {
- if (offset < 0 || length < 0 || offset > buffer.length)
- throw new IllegalArgumentException();
-
- buf = buffer;
-
- count = offset + length;
- if (count > buf.length)
- count = buf.length;
-
- pos = offset;
- mark = pos;
- }
-
- /**
- * This method returns the number of bytes available to be read from this
- * stream. The value returned will be equal to
- * Note that in this class the mark position is set by default to
- * position 0 in the stream. This is in constrast to some other
- * stream types where there is no default mark position.
- *
- * @param readLimit The number of bytes this stream must remember.
- * This parameter is ignored.
- */
- public synchronized void mark(int readLimit)
- {
- // readLimit is ignored per Java Class Lib. book, p.220.
- mark = pos;
- }
-
- /**
- * This method overrides the
- * This method does not block.
- *
- * @param buffer The array into which the bytes read should be stored.
- * @param offset The offset into the array to start storing bytes
- * @param length The requested number of bytes to read
- *
- * @return The actual number of bytes read, or -1 if end of stream.
- */
- public synchronized int read(byte[] buffer, int offset, int length)
- {
- if (pos >= count)
- return -1;
-
- int numBytes = Math.min(count - pos, length);
- System.arraycopy(buf, pos, buffer, offset, numBytes);
- pos += numBytes;
- return numBytes;
- }
-
- /**
- * This method sets the read position in the stream to the mark
- * point by setting the
- * The size of the internal buffer defaults to 32 and it is resized
- * by doubling the size of the buffer. This default size can be
- * overridden by using the
- *
- * There is a constructor that specified the initial buffer size and
- * that is the preferred way to set that value because it it portable
- * across all Java class library implementations.
- *
- * Note that this class also has methods that convert the byte array
- * buffer to a
- * This method does not convert bytes to characters in the proper way and
- * so is deprecated in favor of the other overloaded
- * Note that this array is not copied. If its contents are changed
- * while this stream is being read, those changes will be reflected in the
- * chars supplied to the reader. Please use caution in changing the
- * contents of the buffer while this stream is open.
- *
- * @param buffer The char array buffer this stream will read from.
- */
- public CharArrayReader(char[] buffer)
- {
- this(buffer, 0, buffer.length);
- }
-
- /**
- * Create a new CharArrayReader that will read chars from the passed
- * in char array. This stream will read from position
- *
- * Note that this array is not copied. If its contents are changed
- * while this stream is being read, those changes will be reflected in the
- * chars supplied to the reader. Please use caution in changing the
- * contents of the buffer while this stream is open.
- *
- * @param buffer The char array buffer this stream will read from.
- * @param offset The index into the buffer to start reading chars from
- * @param length The number of chars to read from the buffer
- */
- public CharArrayReader(char[] buffer, int offset, int length)
- {
- super();
- if (offset < 0 || length < 0 || offset > buffer.length)
- throw new IllegalArgumentException();
-
- buf = buffer;
-
- count = offset + length;
- if (count > buf.length)
- count = buf.length;
-
- pos = offset;
- markedPos = pos;
- }
-
- /**
- * This method closes the stream.
- */
- public void close()
- {
- synchronized (lock)
- {
- buf = null;
- }
- }
-
- /**
- * This method sets the mark position in this stream to the current
- * position. Note that the
- * Note that in this class the mark position is set by default to
- * position 0 in the stream. This is in constrast to some other
- * stream types where there is no default mark position.
- *
- * @param readAheadLimit The number of chars this stream must
- * remember. This parameter is ignored.
- *
- * @exception IOException If an error occurs
- */
- public void mark(int readAheadLimit) throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
- // readAheadLimit is ignored per Java Class Lib. book, p. 318.
- markedPos = pos;
- }
- }
-
- /**
- * This method overrides the
- * This method does not block.
- *
- * @param b The array into which the chars read should be stored.
- * @param off The offset into the array to start storing chars
- * @param len The requested number of chars to read
- *
- * @return The actual number of chars read, or -1 if end of stream.
- */
- public int read(char[] b, int off, int len) throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- /* Don't need to check pos value, arraycopy will check it. */
- if (off < 0 || len < 0 || off + len > b.length)
- throw new IndexOutOfBoundsException();
-
- if (pos >= count)
- return -1;
-
- int numChars = Math.min(count - pos, len);
- System.arraycopy(buf, pos, b, off, numChars);
- pos += numChars;
- return numChars;
- }
- }
-
- /**
- * Return true if more characters are available to be read.
- *
- * @return
- * The size of the internal buffer defaults to 32 and it is resized
- * in increments of 1024 chars. This behavior can be over-ridden by using the
- * following two properties:
- *
- *
- * There is a constructor that specified the initial buffer size and
- * that is the preferred way to set that value because it it portable
- * across all Java class library implementations.
- *
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class CharArrayWriter extends Writer
-{
- /**
- * The default initial buffer size
- */
- private static final int DEFAULT_INITIAL_BUFFER_SIZE = 32;
-
- /**
- * This method initializes a new
- * This method can read a
- * This method can read a
- * @return The
- * This method can read an unsigned byte written by an object
- * implementing the
- *
- * As an example, if
- *
- * This method can read a
- * As an example, if
- *
- * The value returned is in the range of -32768 to 32767.
- *
- * This method can read a
- * As an example, if
- *
- * The value returned is in the range of 0 to 65535.
- *
- * This method can read an unsigned short written by an object implementing
- * the
- * As an example, if
- *
- * The value returned is in the range of -2147483648 to 2147483647.
- *
- * This method can read an
- * As an example, if
- *
- * The value returned is in the range of -9223372036854775808 to
- * 9223372036854775807.
- *
- * This method can read an
- * This method can read a
- * This method can read a
- * The reading of bytes ends when either the end of file or a line terminator
- * is encountered. The bytes read are then returned as a
- *
- *
- * @return The line read as a
- * If the first byte has a high order bit of 0, then
- * that character consists on only one byte. This character value consists
- * of seven bits that are at positions 0 through 6 of the byte. As an
- * example, if
- *
- * If the first byte has 110 as its high order bits, then the
- * character consists of two bytes. The bits that make up the character
- * value are in positions 0 through 4 of the first byte and bit positions
- * 0 through 5 of the second byte. (The second byte should have
- * 10 as its high order bits). These values are in most significant
- * byte first (i.e., "big endian") order.
- *
- * As an example, if
- *
- * If the first byte has a 1110 as its high order bits, then the
- * character consists of three bytes. The bits that make up the character
- * value are in positions 0 through 3 of the first byte and bit positions
- * 0 through 5 of the other two bytes. (The second and third bytes should
- * have 10 as their high order bits). These values are in most
- * significant byte first (i.e., "big endian") order.
- *
- * As an example, if
- * This method can read data that was written by an object implementing the
- *
- * This method can read a
- * This method can read a
- * As an example, if
- *
- * This method can read a
- * This method can read a
- * This method can read a
- * As an example, if
- *
- * The value returned is in the range of -2147483648 to 2147483647.
- *
- * This method can read an
- * The reading of bytes ends when either the end of file or a line
- * terminator is encountered. The bytes read are then returned as a
- *
- * This method can read data that was written by an object implementing the
- *
- * As an example, if
- *
- * The value returned is in the range of -9223372036854775808 to
- * 9223372036854775807.
- *
- * This method can read an
- * As an example, if
- *
- * The value returned is in the range of -32768 to 32767.
- *
- * This method can read a
- * This method can read an unsigned byte written by an object
- * implementing the
- * As an example, if
- *
- * The value returned is in the range of 0 to 65535.
- *
- * This method can read an unsigned short written by an object
- * implementing the
- * After the number of remaining bytes have been determined, these
- * bytes are read an transformed into
- * If the first byte has a high order bit of 0, then that character
- * consists on only one byte. This character value consists of
- * seven bits that are at positions 0 through 6 of the byte. As an
- * example, if
- *
- * If the first byte has 110 as its high order bits, then the
- * character consists of two bytes. The bits that make up the character
- * value are in positions 0 through 4 of the first byte and bit positions
- * 0 through 5 of the second byte. (The second byte should have
- * 10 as its high order bits). These values are in most significant
- * byte first (i.e., "big endian") order.
- *
- * As an example, if
- *
- * If the first byte has a 1110 as its high order bits, then the
- * character consists of three bytes. The bits that make up the character
- * value are in positions 0 through 3 of the first byte and bit positions
- * 0 through 5 of the other two bytes. (The second and third bytes should
- * have 10 as their high order bits). These values are in most
- * significant byte first (i.e., "big endian") order.
- *
- * As an example, if
- *
- * Note that all characters are encoded in the method that requires
- * the fewest number of bytes with the exception of the character
- * with the value of
- * This method can read data that was written by an object implementing the
- *
- *
- *
- * The value written can be read using the
- *
- *
- * The value written can be read using the
- *
- *
- * The value written can be read using the
- *
- *
- * The value written can be read using the
- *
- *
- * The value written can be read using the
- *
- *
- * The value written can be read using the
- *
- *
- * The value written can be read using the
- *
- *
- * The value written can be read using the
- * Note that classes which implement this interface must take into account
- * that all superclass data must also be written to the stream as well.
- * The class implementing this interface must figure out how to make that
- * happen.
- *
- * This interface can be used to provide object persistence. When an
- * object is to be stored externally, the
- * Note that this method must be compatible with
- * If this method needs to read back an object instance, then the class
- * for that object must be found and loaded. If that operation fails,
- * then this method throws a
- * Not that the implementation of this method must be coordinated with
- * the implementation of
- * The method in this interface determines if a particular pathname should
- * or should not be included in the pathname listing.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- *
- * @see File#listFiles(java.io.FileFilter)
- */
-public interface FileFilter
-{
- /**
- * This method determines whether or not a given pathname should be included
- * in a pathname listing.
- *
- * @param pathname The pathname to test
- *
- * @return
- * FilePermission's hash code is calculated as the exclusive or of the
- * target
- * String's hash code and the action String's hash code.
- * @specnote Sun did not specify how to calculate the hash code;
- * I made this up.
- * @return the hash code for this Object.
- */
- public int hashCode()
- {
- return getName().hashCode() ^ actionsString.hashCode();
- }
-
- /**
- * Check two FilePermissions for semantic equality.
- * Two FilePermissions are exactly equivalent if they have identical path
- * expressions and have exactly the same access permissions.
- * @param o the Object to compare to.
- * @return whether the Objects are semantically equivalent.
- */
- public boolean equals(Object o)
- {
- if (! (o instanceof FilePermission))
- return false;
- FilePermission p = (FilePermission) o;
-
- String f1 = getName();
- String f2 = p.getName();
-
- // Compare names, taking into account if they refer to a directory
- // and one has a separator and the other does not.
- if (f1.length() > 0 && f1.charAt(f1.length() - 1) == File.separatorChar)
- {
- if (f2.length() > 0
- && f2.charAt(f2.length() - 1) == File.separatorChar)
- {
- if (! f2.equals(f1))
- return false;
- }
- else
- {
- if (! f2.equals(f1.substring(0, f1.length() - 1)))
- return false;
- }
- }
- else
- {
- if (f2.length() > 0
- && f2.charAt(f2.length() - 1) == File.separatorChar)
- {
- if (! f1.equals(f2.substring(0, f2.length() - 1)))
- return false;
- }
- else
- {
- if (! f1.equals(f2))
- return false;
- }
- }
- return (readPerm == p.readPerm
- && writePerm == p.writePerm
- && executePerm == p.executePerm
- && deletePerm == p.deletePerm);
- }
-
- /**
- * Check to see if this permission implies another.
- * Permission A implies permission B if these things are all true:
- *
- * The method in this interface determines if a particular file should
- * or should not be included in the file listing.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- *
- * @see File#listFiles(java.io.FilenameFilter)
- * @see java.awt.FileDialog#setFilenameFilter(java.io.FilenameFilter)
- */
-public interface FilenameFilter
-{
- /**
- * This method determines whether or not a given file should be included
- * in a directory listing.
- *
- * @param dir The
- * This class is not abstract. However, since it only redirects calls
- * to a subordinate
- * When creating a subclass of
- * When creating a subclass of
- * This method always returns 0 in this class
- *
- * @return The number of bytes that can be read before blocking could occur
- *
- * @exception IOException If an error occurs
- */
- public int available() throws IOException
- {
- return 0;
- }
-
- /**
- * This method closes the stream. Any futher attempts to read from the
- * stream may generate an
- * This method does nothing in this class, but subclasses may override
- * this method in order to provide additional functionality.
- *
- * @exception IOException If an error occurs, which can only happen
- * in a subclass
- */
- public void close() throws IOException
- {
- // Do nothing
- }
-
- /**
- * This method marks a position in the input to which the stream can
- * be "reset" by calling the
- * This method does nothing in this class, but subclasses may override it
- * to provide mark/reset functionality.
- *
- * @param readLimit The number of bytes that can be read before the
- * mark becomes invalid
- */
- public void mark(int readLimit)
- {
- // Do nothing
- }
-
- /**
- * This method returns a boolean that indicates whether the mark/reset
- * methods are supported in this class. Those methods can be used to
- * remember a specific point in the stream and reset the stream to that
- * point.
- *
- * This method always returns
- * This method will block until the byte can be read.
- *
- * @return The byte read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public abstract int read() throws IOException;
-
- /**
- * This method reads bytes from a stream and stores them into a caller
- * supplied buffer. This method attempts to completely fill the buffer,
- * but can return before doing so. The actual number of bytes read is
- * returned as an int. A -1 is returned to indicate the end of the stream.
- *
- * This method will block until some data can be read.
- *
- * This method operates by calling an overloaded read method like so:
- *
- * This method will block until some data can be read.
- *
- * This method operates by calling the single byte
- * This method always throws an IOException in this class, but subclasses
- * can override this method if they provide mark/reset functionality.
- *
- * @exception IOException Always thrown for this class
- */
- public void reset() throws IOException
- {
- throw new IOException("mark/reset not supported");
- }
-
- /**
- * This method skips the specified number of bytes in the stream. It
- * returns the actual number of bytes skipped, which may be less than the
- * requested amount.
- *
- * This method reads and discards bytes into a byte array until the
- * specified number of bytes were skipped or until either the end of stream
- * is reached or a read attempt returns a short count. Subclasses can
- * override this metho to provide a more efficient implementation where
- * one exists.
- *
- * @param n The requested number of bytes to skip
- *
- * @return The actual number of bytes skipped.
- *
- * @exception IOException If an error occurs
- */
- public long skip(long n) throws IOException
- {
- // Throw away n bytes by reading them into a temp byte[].
- // Limit the temp array to 2Kb so we don't grab too much memory.
- final int buflen = n > 2048 ? 2048 : (int) n;
- byte[] tmpbuf = new byte[buflen];
- final long origN = n;
-
- while (n > 0L)
- {
- int numread = read(tmpbuf, 0, n > buflen ? buflen : (int) n);
- if (numread <= 0)
- break;
- n -= numread;
- }
-
- return origN - n;
- }
-}
diff --git a/libjava/java/io/InterruptedIOException.java b/libjava/java/io/InterruptedIOException.java
deleted file mode 100644
index 96ec83649f8..00000000000
--- a/libjava/java/io/InterruptedIOException.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* InterruptedIOException.java -- an I/O operation was interrupted
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when a in process I/O operation is interrupted
- * for some reason. The field bytesTransferred will contain the number of
- * bytes that were read/written prior to the interruption.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @see Thread#interrupt()
- * @status updated to 1.4
- */
-public class InterruptedIOException extends IOException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 4020568460727500567L;
-
- /**
- * The number of bytes read/written prior to the interruption.
- *
- * @serial count of bytes successfully transferred
- */
- public int bytesTransferred;
-
- /**
- * Create an extends without a descriptive error message.
- */
- public InterruptedIOException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public InterruptedIOException(String message)
- {
- super(message);
- }
-
- /**
- * Create an exception with a descriptive error message and count of
- * bytes transferred.
- *
- * @param message the descriptive error message
- * @param bytesTransferred number of bytes tranferred before interruption
- */
- InterruptedIOException(String message, int bytesTransferred)
- {
- super(message);
- this.bytesTransferred = bytesTransferred;
- }
-} // class InterruptedIOException
diff --git a/libjava/java/io/InvalidClassException.java b/libjava/java/io/InvalidClassException.java
deleted file mode 100644
index c71b0c67fc7..00000000000
--- a/libjava/java/io/InvalidClassException.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/* InvalidClassException.java -- deserializing a class failed
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when there is some sort of problem with a
- * class during a serialization operation. This could be: The field
- * This class counts only line termination characters. If the last line
- * read from the stream does not end in a line termination sequence, it
- * will not be counted as a line.
- *
- * Note that since this class operates as a filter on an underlying
- * stream, it has the same mark/reset functionality as the underlying
- * stream. The
- * @deprecated This class is deprecated in favor if
- *
- * Note that the stream may not block if additional bytes beyond the count
- * returned by this method are read.
- *
- * @return The number of bytes that can be read before blocking could occur
- *
- * @exception IOException If an error occurs
- */
- public int available() throws IOException
- {
- // We can only guarantee half the characters that might be available
- // without blocking because "\r\n" is treated as a single character.
- return in.available() / 2;
- }
-
- /**
- * This method returns the current line number
- *
- * @return The current line number
- */
- public int getLineNumber()
- {
- return lineNumber;
- }
-
- /**
- * This method marks a position in the input to which the stream can
- * be "reset" byte calling the
- * In this class, this method will remember the current line number
- * as well as the current position in the stream. When the
- *
- * This method only works if the subordinate stream supports mark/reset
- * functionality.
- *
- * @param readlimit The number of bytes that can be read before the
- * mark becomes invalid
- */
- public void mark(int readlimit)
- {
- in.mark(readlimit);
- markLineNumber = lineNumber;
- }
-
- /**
- * This method reads an unsigned byte from the input stream and returns it
- * as an int in the range of 0-255. This method will return -1 if the
- * end of the stream has been reached.
- *
- * Note that if a line termination sequence is encountered (ie, "\r",
- * "\n", or "\r\n") then that line termination sequence is converted to
- * a single "\n" value which is returned from this method. This means
- * that it is possible this method reads two bytes from the subordinate
- * stream instead of just one.
- *
- * Note that this method will block until a byte of data is available
- * to be read.
- *
- * @return The byte read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public int read() throws IOException
- {
- // Treat "\r\n" as a single character. A '\r' may have been read by
- // a previous call to read so we keep an internal flag to avoid having
- // to read ahead.
-
- int ch = in.read();
-
- if (ch == '\n')
- if (justReadReturnChar)
- {
- ch = in.read();
- justReadReturnChar = false;
- }
- else
- lineNumber++;
- else if (ch == '\r')
- {
- ch = '\n';
- justReadReturnChar = true;
- lineNumber++;
- }
- else
- justReadReturnChar = false;
-
- return ch;
- }
-
- /**
- * This method reads bytes from a stream and stores them into a caller
- * supplied buffer. It starts storing data at index
- * This method will block until some data can be read.
- *
- * Note that if a line termination sequence is encountered (ie, "\r",
- * "\n", or "\r\n") then that line termination sequence is converted to
- * a single "\n" value which is stored in the buffer. Only a single
- * byte is counted towards the number of bytes read in this case.
- *
- * @param buf The array into which the bytes read should be stored
- * @param offset The offset into the array to start storing bytes
- * @param len The requested number of bytes to read
- *
- * @return The actual number of bytes read, or -1 if end of stream
- *
- * @exception IOException If an error occurs.
- */
- public int read(byte[] b, int off, int len) throws IOException
- {
- if (off < 0 || len < 0 || off + len > b.length)
- throw new ArrayIndexOutOfBoundsException();
-
- // This case always succeeds.
- if (len == 0)
- return 0;
-
- // The simplest, though not necessarily the most time efficient thing
- // to do is simply call read(void) len times. Since this is a deprecated
- // class, that should be ok.
- final int origOff = off;
- while (len-- > 0)
- {
- int ch = read();
- if (ch < 0)
- break;
-
- b[off++] = (byte) ch;
- }
-
- // This is safe since we already know that some bytes were
- // actually requested.
- return off == origOff ? -1 : off - origOff;
- }
-
- /**
- * This method resets a stream to the point where the
- *
- * In this class, this method will also restore the line number that was
- * current when the
- * This method only works if the subordinate stream supports mark/reset
- * functionality.
- *
- * @exception IOException If an error occurs
- */
- public void reset() throws IOException
- {
- in.reset();
- lineNumber = markLineNumber;
- justReadReturnChar = false;
- }
-
- /**
- * This method sets the current line number to the specified value.
- *
- * @param lineNumber The new line number
- */
- public void setLineNumber(int lineNumber)
- {
- this.lineNumber = lineNumber;
- }
-
- /**
- * This method skips up to the requested number of bytes in the
- * input stream. The actual number of bytes skipped is returned. If the
- * desired number of bytes to skip is negative, no bytes are skipped.
- *
- * @param n requested number of bytes to skip.
- *
- * @return The actual number of bytes skipped.
- *
- * @exception IOException If an error occurs.
- */
- public long skip(long n) throws IOException
- {
- if (n <= 0)
- return 0L;
-
- final long origN = n;
-
- do
- {
- int ch = read();
- if (ch < 0)
- break;
- if (ch == '\n' || ch == '\r')
- lineNumber++;
- }
- while (--n > 0);
-
- return origN - n;
- }
-}
diff --git a/libjava/java/io/LineNumberReader.java b/libjava/java/io/LineNumberReader.java
deleted file mode 100644
index ea418a5e4d6..00000000000
--- a/libjava/java/io/LineNumberReader.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/* LineNumberReader.java -- A character input stream which counts line numbers
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/**
- * This class functions like a standard
- * This class counts only line termination characters. If the last line
- * read from the stream does not end in a line termination sequence, it
- * will not be counted as a line.
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Guilhem Lavaux (guilhem@kaffe.org)
- * @date December 28, 2003.
- */
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- *
- * This implementation has the feature that if '\r' is read, it
- * does not look for a '\n', but immediately returns '\n'.
- * On the next read(), if a '\n' is read, it is skipped.
- * This has the advantage that we do not read (and hang) unnecessarily.
- *
- * This implementation is also minimal in the number of fields it uses.
- */
-public class LineNumberReader extends BufferedReader
-{
- /** The current line number. */
- private int lineNumber;
- /** Whether we already found a new line in the former call. */
- private boolean matchedNewLine;
- /** The saved line number when calling mark() */
- private int savedLineNumber;
-
- /**
- * Create a new
- * In this class, this method will remember the current line number as well
- * as the current position in the stream. When the
- * In this class, this method will also restore the line number that was
- * current when the
- * Note that if a line termination sequence is encountered (ie, "\r",
- * "\n", or "\r\n") then that line termination sequence is converted to
- * a single "\n" value which is returned from this method. This means
- * that it is possible this method reads two chars from the subordinate
- * stream instead of just one.
- *
- * Note that this method will block until a char of data is available
- * to be read.
- *
- * @return The char read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public int read() throws IOException
- {
- synchronized (lock)
- {
- skipRedundantLF();
- if (pos >= limit && fill() < 0)
- return -1;
- char ch = buffer[pos++];
-
- if ((matchedNewLine = (ch == '\r')) || ch == '\n')
- {
- lineNumber++;
- return '\n';
- }
- matchedNewLine = false;
- return (int) ch;
- }
- }
-
- /**
- * This method reads chars from a stream and stores them into a caller
- * supplied buffer. It starts storing data at index
- * This method will block until some data can be read.
- *
- * Note that if a line termination sequence is encountered (ie, "\r",
- * "\n", or "\r\n") then that line termination sequence is converted to
- * a single "\n" value which is stored in the buffer. Only a single
- * char is counted towards the number of chars read in this case.
- *
- * @param buf The array into which the chars read should be stored
- * @param offset The offset into the array to start storing chars
- * @param len The requested number of chars to read
- *
- * @return The actual number of chars read, or -1 if end of stream
- *
- * @exception IOException If an error occurs.
- * @exception NullPointerException If buf is null (in any case).
- * @exception IndexOutOfBoundsException If buffer parameters (offset and
- * count) lies outside of the buffer capacity.
- */
- public int read(char[] buf, int offset, int count) throws IOException
- {
- if (buf == null)
- throw new NullPointerException();
-
- if (offset + count > buf.length || offset < 0)
- throw new IndexOutOfBoundsException();
-
- if (count <= 0)
- {
- if (count < 0)
- throw new IndexOutOfBoundsException();
- return 0;
- }
-
- synchronized (lock)
- {
- if (pos >= limit && fill() < 0)
- return -1;
-
- int start_offset = offset;
- boolean matched = matchedNewLine;
-
- while (count-- > 0 && pos < limit)
- {
- char ch = buffer[pos++];
- if (ch == '\r')
- {
- lineNumber++;
- matched = true;
- }
- else if (ch == '\n' && !matched)
- lineNumber++;
- else
- matched = false;
-
- buf[offset++] = ch;
- }
-
- matchedNewLine = matched;
- return offset - start_offset;
- }
- }
-
- private void skipRedundantLF() throws IOException
- {
- if (pos > 0 && matchedNewLine)
- {
- if (pos < limit)
- { // fast case
- if (buffer[pos] == '\n')
- pos++;
- }
- else
- { // check whether the next buffer begins with '\n'.
- // in that case kill the '\n'.
- if (fill() <= 0)
- return;
- if (buffer[pos] == '\n')
- pos++;
- }
- matchedNewLine = true;
- }
- }
-
- /**
- * This method reads a line of text from the input stream and returns
- * it as a
- * Subclasses must provide an implementation of this abstract method
- *
- * @param b The byte to be written to the output stream, passed as
- * the low eight bits of an
- * This method in this class calls the single byte
- * This method in this class does nothing.
- *
- * @exception IOException If an error occurs
- */
- public void flush () throws IOException
- {
- }
-
- /**
- * This method closes the stream. Any internal or native resources
- * associated with this stream are freed. Any subsequent attempt to
- * access the stream might throw an exception.
- *
- * This method in this class does nothing.
- *
- * @exception IOException If an error occurs
- */
- public void close () throws IOException
- {
- }
-}
diff --git a/libjava/java/io/PipedInputStream.java b/libjava/java/io/PipedInputStream.java
deleted file mode 100644
index beb310b4f0c..00000000000
--- a/libjava/java/io/PipedInputStream.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/* PipedInputStream.java -- Read portion of piped streams.
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-// NOTE: This implementation is very similar to that of PipedReader. If you
-// fix a bug in here, chances are you should make a similar change to the
-// PipedReader code.
-
-/**
- * An input stream that reads its bytes from an output stream
- * to which it is connected.
- *
- * Data is read and written to an internal buffer. It is highly recommended
- * that the This method will block if no byte is available to be read.
- * This method will block if no bytes are available to be read.
- *
- * @param buf The buffer into which bytes will be stored
- * @param offset The index into the buffer at which to start writing.
- * @param len The maximum number of bytes to read.
- *
- * @exception IOException If
- * It is highly recommended that a
- * Data is read and written to an internal buffer. It is highly recommended
- * that the
- * This method will block if no char is available to be read.
- */
- public int read() throws IOException
- {
- // Method operates by calling the multichar overloaded read method
- // Note that read_buf is an internal instance variable. I allocate it
- // there to avoid constant reallocation overhead for applications that
- // call this method in a loop at the cost of some unneeded overhead
- // if this method is never called.
-
- int r = read(read_buf, 0, 1);
- return r != -1 ? read_buf[0] : -1;
- }
-
- /**
- * This method reads characters from the stream into a caller supplied
- * buffer. It starts storing chars at position
- * This method will block if no chars are available to be read.
- *
- * @param buf The buffer into which chars will be stored
- * @param offset The index into the buffer at which to start writing.
- * @param len The maximum number of chars to read.
- *
- * @exception IOException If
- * It is highly recommended that a
- * The default pushback buffer size one byte, but this can be overridden
- * by the creator of the stream.
- *
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class PushbackInputStream extends FilterInputStream
-{
- /**
- * This is the default buffer size
- */
- private static final int DEFAULT_BUFFER_SIZE = 1;
-
- /**
- * This is the buffer that is used to store the pushed back data
- */
- protected byte[] buf;
-
- /**
- * This is the position in the buffer from which the next byte will be
- * read. Bytes are stored in reverse order in the buffer, starting from
- *
- * This method will return the number of bytes available from the
- * pushback buffer plus the number of bytes available from the
- * underlying stream.
- *
- * @return The number of bytes that can be read before blocking could occur
- *
- * @exception IOException If an error occurs
- */
- public int available() throws IOException
- {
- return (buf.length - pos) + super.available();
- }
-
- /**
- * This method closes the stream and releases any associated resources.
- *
- * @exception IOException If an error occurs.
- */
- public synchronized void close() throws IOException
- {
- buf = null;
- super.close();
- }
-
- /**
- * This method returns
- * This method will block until the byte can be read.
- *
- * @return The byte read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public synchronized int read() throws IOException
- {
- if (pos < buf.length)
- return ((int) buf[pos++]) & 0xFF;
-
- return super.read();
- }
-
- /**
- * This method read bytes from a stream and stores them into a
- * caller supplied buffer. It starts storing the data at index
- *
- * This method will block until some data can be read.
- *
- * This method first reads bytes from the pushback buffer in order to
- * satisfy the read request. If the pushback buffer cannot provide all
- * of the bytes requested, the remaining bytes are read from the
- * underlying stream.
- *
- * @param b The array into which the bytes read should be stored
- * @param off The offset into the array to start storing bytes
- * @param len The requested number of bytes to read
- *
- * @return The actual number of bytes read, or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- */
- public synchronized int read(byte[] b, int off, int len) throws IOException
- {
- int numBytes = Math.min(buf.length - pos, len);
-
- if (numBytes > 0)
- {
- System.arraycopy (buf, pos, b, off, numBytes);
- pos += numBytes;
- len -= numBytes;
- off += numBytes;
- }
-
- if (len > 0)
- {
- len = super.read(b, off, len);
- if (len == -1) //EOF
- return numBytes > 0 ? numBytes : -1;
- numBytes += len;
- }
- return numBytes;
- }
-
- /**
- * This method pushes a single byte of data into the pushback buffer.
- * The byte pushed back is the one that will be returned as the first byte
- * of the next read.
- *
- * If the pushback buffer is full, this method throws an exception.
- *
- * The argument to this method is an
- * If the pushback buffer cannot hold all of the requested bytes, an
- * exception is thrown.
- *
- * @param b The byte array to be pushed back
- *
- * @exception IOException If the pushback buffer is full
- */
- public synchronized void unread(byte[] b) throws IOException
- {
- unread(b, 0, b.length);
- }
-
- /**
- * This method pushed back bytes from the passed in array into the
- * pushback buffer. The bytes from
- * If the pushback buffer cannot hold all of the requested bytes, an
- * exception is thrown.
- *
- * @param b The byte array to be pushed back
- * @param off The index into the array where the bytes to be push start
- * @param len The number of bytes to be pushed.
- *
- * @exception IOException If the pushback buffer is full
- */
- public synchronized void unread(byte[] b, int off, int len)
- throws IOException
- {
- if (pos < len)
- throw new IOException("Insufficient space in pushback buffer");
-
- // Note the order that these bytes are being added is the opposite
- // of what would be done if they were added to the buffer one at a time.
- // See the Java Class Libraries book p. 1390.
- System.arraycopy(b, off, buf, pos - len, len);
-
- // Don't put this into the arraycopy above, an exception might be thrown
- // and in that case we don't want to modify pos.
- pos -= len;
- }
-
- /**
- * This method skips the specified number of bytes in the stream. It
- * returns the actual number of bytes skipped, which may be less than the
- * requested amount.
- *
- * This method first discards bytes from the buffer, then calls the
- *
- * The default pushback buffer size one char, but this can be overridden
- * by the creator of the stream.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class PushbackReader extends FilterReader
-{
- /**
- * This is the default buffer size
- */
- private static final int DEFAULT_BUFFER_SIZE = 1;
-
- /**
- * This is the buffer that is used to store the pushed back data
- */
- private char[] buf;
-
- /**
- * This is the position in the buffer from which the next char will be
- * read. Bytes are stored in reverse order in the buffer, starting from
- *
- * This stream is ready to read if there are either chars waiting to be
- * read in the pushback buffer or if the underlying stream is ready to
- * be read.
- *
- * @return
- * This method first discards chars from the buffer, then calls the
- *
- * This method will block until the char can be read.
- *
- * @return The char read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public int read() throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("stream closed");
-
- if (pos == buf.length)
- return(super.read());
-
- ++pos;
- return((buf[pos - 1] & 0xFFFF));
- }
- }
-
- /**
- * This method read chars from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index
- * This method will block until some data can be read.
- *
- * This method first reads chars from the pushback buffer in order to
- * satisfy the read request. If the pushback buffer cannot provide all
- * of the chars requested, the remaining chars are read from the
- * underlying stream.
- *
- * @param buffer The array into which the chars read should be stored
- * @param offset The offset into the array to start storing chars
- * @param length The requested number of chars to read
- *
- * @return The actual number of chars read, or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- */
- public synchronized int read(char[] buffer, int offset, int length)
- throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("stream closed");
-
- if (offset < 0 || length < 0 || offset + length > buffer.length)
- throw new ArrayIndexOutOfBoundsException();
-
- int numBytes = Math.min(buf.length - pos, length);
- if (numBytes > 0)
- {
- System.arraycopy (buf, pos, buffer, offset, numBytes);
- pos += numBytes;
- return numBytes;
- }
-
- return super.read(buffer, offset, length);
- }
- }
-
- /**
- * This method pushes a single char of data into the pushback buffer.
- * The char pushed back is the one that will be returned as the first char
- * of the next read.
- *
- * If the pushback buffer is full, this method throws an exception.
- *
- * The argument to this method is an
- * If the pushback buffer cannot hold all of the requested chars, an
- * exception is thrown.
- *
- * @param buf The char array to be pushed back
- *
- * @exception IOException If the pushback buffer is full
- */
- public synchronized void unread(char[] buf) throws IOException
- {
- unread(buf, 0, buf.length);
- }
-
- /**
- * This method pushed back chars from the passed in array into the pushback
- * buffer. The chars from
- * If the pushback buffer cannot hold all of the requested chars, an
- * exception is thrown.
- *
- * @param buffer The char array to be pushed back
- * @param offset The index into the array where the chars to be push start
- * @param length The number of chars to be pushed.
- *
- * @exception IOException If the pushback buffer is full
- */
- public synchronized void unread(char[] buffer, int offset, int length)
- throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("stream closed");
- if (pos < length)
- throw new IOException("Pushback buffer is full");
-
- // Note the order that these chars are being added is the opposite
- // of what would be done if they were added to the buffer one at a time.
- // See the Java Class Libraries book p. 1397.
- System.arraycopy(buffer, offset, buf, pos - length, length);
-
- // Don't put this into the arraycopy above, an exception might be thrown
- // and in that case we don't want to modify pos.
- pos -= length;
- }
- }
-}
-
diff --git a/libjava/java/io/Reader.java b/libjava/java/io/Reader.java
deleted file mode 100644
index 7970d9a2434..00000000000
--- a/libjava/java/io/Reader.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/* Reader.java -- base class of classes that read input as a stream of chars
- Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This abstract class forms the base of the hierarchy of classes that read
- * input as a stream of characters. It provides a common set of methods for
- * reading characters from streams. Subclasses implement and extend these
- * methods to read characters from a particular input source such as a file
- * or network connection.
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @date April 21, 1998.
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public abstract class Reader
-{
- /**
- * This is the
- * This method will block until some data can be read.
- *
- * This method operates by calling the single char
- * This method will block until some data can be read.
- *
- * This method operates by calling an overloaded read method like so:
- *
- * This method will block until the char can be read.
- *
- * @return The char read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public int read() throws IOException
- {
- char[] buf = new char[1];
- int count = read(buf, 0, 1);
- return count > 0 ? buf[0] : -1;
- }
-
- /**
- * Closes the stream. Any futher attempts to read from the
- * stream may generate an
- * This method always returns
- * This method always throws an IOException in this class, but subclasses
- * can override this method if they provide mark/reset functionality.
- *
- * @exception IOException Always thrown for this class
- */
- public void reset() throws IOException
- {
- throw new IOException("reset not supported");
- }
-
- /**
- * Determines whether or not this stream is ready to be
- * read. If it returns
- * This method always returns
- * This method reads and discards chars into a 256 char array until the
- * specified number of chars were skipped or until either the end of stream
- * is reached or a read attempt returns a short count. Subclasses can
- * override this method to provide a more efficient implementation where
- * one exists.
- *
- * @param count The requested number of chars to skip
- *
- * @return The actual number of chars skipped.
- *
- * @exception IOException If an error occurs
- */
- public long skip(long count) throws IOException
- {
- if (count <= 0)
- return 0;
- int bsize = count > 1024 ? 1024 : (int) count;
- char[] buffer = new char[bsize];
- long todo = count;
- synchronized (lock)
- {
- while (todo > 0)
- {
- int skipped = read(buffer, 0, bsize > todo ? (int) todo : bsize);
- if (skipped <= 0)
- break;
- todo -= skipped;
- }
- }
- return count - todo;
- }
-}
diff --git a/libjava/java/io/SequenceInputStream.java b/libjava/java/io/SequenceInputStream.java
deleted file mode 100644
index 7fefe243263..00000000000
--- a/libjava/java/io/SequenceInputStream.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/* SequenceInputStream.java -- Reads multiple input streams in sequence
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import java.util.Enumeration;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This class merges a sequence of multiple
- * The streams passed to the constructor method are read in order until
- * they return -1 to indicate they are at end of stream. When a stream
- * reports end of stream, it is closed, then the next stream is read.
- * When the last stream is closed, the next attempt to read from this
- * stream will return a -1 to indicate it is at end of stream.
- *
- * If this stream is closed prior to all subordinate streams being read
- * to completion, all subordinate streams are closed.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class SequenceInputStream extends InputStream
-{
- /** The handle for the current input stream. */
- private InputStream in;
-
- /** Secondary input stream; not used if constructed w/ enumeration. */
- private InputStream in2;
-
- /** The enumeration handle; not used if constructed w/ 2 explicit input streams. */
- private Enumeration e;
-
- /**
- * This method creates a new
- * This method will block until the byte can be read.
- *
- * @return The byte read, or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public int read() throws IOException
- {
- int ch = -1;
-
- while (in != null && (ch = in.read()) < 0)
- {
- in.close();
- in = getNextStream();
- }
-
- return ch;
- }
-
- /**
- * This method reads bytes from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index
- * This method will block until at least one byte can be read.
- *
- * @param b The array into which bytes read should be stored
- * @param off The offset into the array to start storing bytes
- * @param len The requested number of bytes to read
- *
- * @return The actual number of bytes read, or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public int read(byte[] b, int off, int len) throws IOException
- {
- int ch = -1;
-
- // The validity of the parameters will be checked by in.read so
- // don't bother doing it here.
- while (in != null && (ch = in.read(b, off, len)) < 0)
- {
- in.close();
- in = getNextStream();
- }
-
- return ch;
- }
-
- /**
- * This private method is used to get the next
- * There are currently two allowable permission names for this class:
- *
- * This constructor sets up the parsing table to parse the stream in the
- * following manner:
- *
- *
- * The mark/reset functionality in this class behaves differently than
- * normal. The
- * Note that this class is deprecated because it does not properly handle
- * 16-bit Java characters. It is provided for backwards compatibility only
- * and should not be used for new development. The
- * This method does not block.
- *
- * @param b The array into which the bytes read should be stored.
- * @param off The offset into the array to start storing bytes
- * @param len The requested number of bytes to read
- *
- * @return The actual number of bytes read, or -1 if end of stream.
- */
- public int read(byte[] b, int off, int len)
- {
- if (off < 0 || len < 0 || off + len > b.length)
- throw new ArrayIndexOutOfBoundsException();
-
- if (pos >= count)
- return -1; // EOF
-
- int numRead = Math.min(len, count - pos);
- if (numRead < 0)
- return 0;
-
- buffer.getBytes(pos, pos + numRead, b, off);
- pos += numRead;
- return numRead;
- }
-
- /**
- * This method sets the read position in the stream to the beginning
- * setting the
- * The mark/reset functionality in this class behaves differently than
- * normal. If no mark has been set, then calling the
- * This method in this class does nothing.
- *
- * @exception IOException If an error occurs
- */
- public abstract void close() throws IOException;
-
- /**
- * This method writes a single char to the output stream.
- *
- * @param b The char to be written to the output stream, passed as an int
- *
- * @exception IOException If an error occurs
- */
- public void write(int b) throws IOException
- {
- char[] buf = new char[1];
-
- buf[0] = (char)b;
- write(buf, 0, buf.length);
- }
-
- /**
- * This method all the writes char from the passed array to the output
- * stream. This method is equivalent to
- *
- * Subclasses must provide an implementation of this abstract method.
- *
- * @param buf The array of char to write from
- * @param offset The index into the array to start writing from
- * @param len The number of char to write
- *
- * @exception IOException If an error occurs
- */
- public abstract void write(char[] buf, int offset, int len)
- throws IOException;
-
- /**
- * This method writes all the characters in a The extended BNF grammar is as follows: Even when classes implement this interface they are not always
- * exchangeble because they might implement their compare, equals or hash
- * function differently. This means that in general one should not use a
- * Notice that calling This interface is simply a tagging interface; it carries no
- * requirements on methods to implement. However, it is typical for
- * a Cloneable class to implement at least If an object that implement Cloneable should not be cloned,
- * simply override the All array types implement Cloneable, and have a public
- * Lists, arrays, and sets of objects that implement this interface can
- * be sorted automatically, without the need for an explicit
- * {@link java.util.Comparator}. Note that You must make sure that the comparison is mutual, ie.
- * You should also ensure transitivity, in two forms:
- * The system property Note that a VM might not have implemented any of this.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @see System#getProperty(String)
- * @see System#getProperty(String, String)
- * @see System#loadLibrary(String)
- * @since JDK 1.0
- * @status updated to 1.4
- */
-public final class Compiler
-{
- /**
- * Don't allow new `Compiler's to be made.
- */
- private Compiler()
- {
- }
-
- /**
- * Compile the class named by A method is not required to declare any subclass of The extended BNF grammar is as follows: The extended BNF grammar is as follows:
- *
- * Note that angles are specified in radians. Conversion functions are
- * provided for your convenience.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- */
-public final class Math
-{
- /**
- * Math is non-instantiable
- */
- private Math()
- {
- }
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("javalang");
- }
- }
-
- /**
- * A random number generator, initialized on first use.
- */
- private static Random rand;
-
- /**
- * The most accurate approximation to the mathematical constant e:
- *
- *
- * Note that the the largest negative value (Integer.MIN_VALUE) cannot
- * be made positive. In this case, because of the rules of negation in
- * a computer, MIN_VALUE is what will be returned.
- * This is a negative value. You have been warned.
- *
- * @param i the number to take the absolute value of
- * @return the absolute value
- * @see Integer#MIN_VALUE
- */
- public static int abs(int i)
- {
- return (i < 0) ? -i : i;
- }
-
- /**
- * Take the absolute value of the argument.
- * (Absolute value means make it positive.)
- *
- *
- * Note that the the largest negative value (Long.MIN_VALUE) cannot
- * be made positive. In this case, because of the rules of negation in
- * a computer, MIN_VALUE is what will be returned.
- * This is a negative value. You have been warned.
- *
- * @param l the number to take the absolute value of
- * @return the absolute value
- * @see Long#MIN_VALUE
- */
- public static long abs(long l)
- {
- return (l < 0) ? -l : l;
- }
-
- /**
- * Take the absolute value of the argument.
- * (Absolute value means make it positive.)
- *
- *
- * This is equivalent, but faster than, calling
- * This is accurate within 2 ulps, and is semi-monotonic. To get r,
- * use sqrt(x*x+y*y).
- *
- * @param y the y position
- * @param x the x position
- * @return theta in the conversion of (x, y) to (r, theta)
- * @see #atan(double)
- */
- public static native double atan2(double y, double x);
-
- /**
- * Take ea. The opposite of Note that the way to get logb(a) is to do this:
- * For other roots, use pow(a, 1 / rootNumber).
- *
- * @param a the numeric argument
- * @return the square root of the argument
- * @see #pow(double, double)
- */
- public static native double sqrt(double a);
-
- /**
- * Raise a number to a power. Special cases: (In the foregoing descriptions, a floating-point value is
- * considered to be an integer if and only if it is a fixed point of the
- * method {@link #ceil(double)} or, equivalently, a fixed point of the
- * method {@link #floor(double)}. A value is a fixed point of a one-argument
- * method if and only if the result of applying the method to the value is
- * equal to the value.) This is accurate within 1 ulp, and is semi-monotonic.
- *
- * @param a the number to raise
- * @param b the power to raise it to
- * @return ab
- */
- public static native double pow(double a, double b);
-
- /**
- * Get the IEEE 754 floating point remainder on two numbers. This is the
- * value of Applications should also throw NullPointerExceptions whenever
- * This is dependent on the platform, and some processes (like native
- * windowing processes, 16-bit processes in Windows, or shell scripts) may
- * be limited in functionality. Because some platforms have limited buffers
- * between processes, you may need to provide input and read output to prevent
- * the process from blocking, or even deadlocking.
- *
- * Even if all references to this object disapper, the process continues
- * to execute to completion. There are no guarantees that the
- * subprocess execute asynchronously or concurrently with the process which
- * owns this object.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @see Runtime#exec(String[], String[], File)
- * @since 1.0
- * @status updated to 1.4
- */
-public abstract class Process
-{
- /**
- * Empty constructor does nothing.
- */
- public Process()
- {
- }
-
- /**
- * Obtain the output stream that sends data to the subprocess. This is
- * the STDIN of the subprocess. When implementing, you should probably
- * use a buffered stream.
- *
- * @return the output stream that pipes to the process input
- */
- public abstract OutputStream getOutputStream();
-
- /**
- * Obtain the input stream that receives data from the subprocess. This is
- * the STDOUT of the subprocess. When implementing, you should probably
- * use a buffered stream.
- *
- * @return the input stream that pipes data from the process output
- */
- public abstract InputStream getInputStream();
-
- /**
- * Obtain the input stream that receives data from the subprocess. This is
- * the STDERR of the subprocess. When implementing, you should probably
- * use a buffered stream.
- *
- * @return the input stream that pipes data from the process error output
- */
- public abstract InputStream getErrorStream();
-
- /**
- * The thread calling The extended BNF grammar is as follows: The source of the various algorithms used is the fdlibm library, at: Note that the the largest negative value (Integer.MIN_VALUE) cannot
- * be made positive. In this case, because of the rules of negation in
- * a computer, MIN_VALUE is what will be returned.
- * This is a negative value. You have been warned.
- *
- * @param i the number to take the absolute value of
- * @return the absolute value
- * @see Integer#MIN_VALUE
- */
- public static int abs(int i)
- {
- return (i < 0) ? -i : i;
- }
-
- /**
- * Take the absolute value of the argument. (Absolute value means make
- * it positive.)
- *
- * Note that the the largest negative value (Long.MIN_VALUE) cannot
- * be made positive. In this case, because of the rules of negation in
- * a computer, MIN_VALUE is what will be returned.
- * This is a negative value. You have been warned.
- *
- * @param l the number to take the absolute value of
- * @return the absolute value
- * @see Long#MIN_VALUE
- */
- public static long abs(long l)
- {
- return (l < 0) ? -l : l;
- }
-
- /**
- * Take the absolute value of the argument. (Absolute value means make
- * it positive.)
- *
- * @param f the number to take the absolute value of
- * @return the absolute value
- */
- public static float abs(float f)
- {
- return (f <= 0) ? 0 - f : f;
- }
-
- /**
- * Take the absolute value of the argument. (Absolute value means make
- * it positive.)
- *
- * @param d the number to take the absolute value of
- * @return the absolute value
- */
- public static double abs(double d)
- {
- return (d <= 0) ? 0 - d : d;
- }
-
- /**
- * Return whichever argument is smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static int min(int a, int b)
- {
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static long min(long a, long b)
- {
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is smaller. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, -0 is always smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static float min(float a, float b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; < will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return -(-a - b);
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is smaller. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, -0 is always smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static double min(double a, double b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; < will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return -(-a - b);
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static int max(int a, int b)
- {
- return (a > b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static long max(long a, long b)
- {
- return (a > b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, 0 is always larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static float max(float a, float b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; > will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return a - -b;
- return (a > b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, 0 is always larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static double max(double a, double b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; > will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return a - -b;
- return (a > b) ? a : b;
- }
-
- /**
- * The trigonometric function sin. The sine of NaN or infinity is
- * NaN, and the sine of 0 retains its sign.
- *
- * @param a the angle (in radians)
- * @return sin(a)
- */
- public static double sin(double a)
- {
- if (a == Double.NEGATIVE_INFINITY || ! (a < Double.POSITIVE_INFINITY))
- return Double.NaN;
-
- if (abs(a) <= PI / 4)
- return sin(a, 0);
-
- // Argument reduction needed.
- double[] y = new double[2];
- int n = remPiOver2(a, y);
- switch (n & 3)
- {
- case 0:
- return sin(y[0], y[1]);
- case 1:
- return cos(y[0], y[1]);
- case 2:
- return -sin(y[0], y[1]);
- default:
- return -cos(y[0], y[1]);
- }
- }
-
- /**
- * The trigonometric function cos. The cosine of NaN or infinity is
- * NaN.
- *
- * @param a the angle (in radians).
- * @return cos(a).
- */
- public static double cos(double a)
- {
- if (a == Double.NEGATIVE_INFINITY || ! (a < Double.POSITIVE_INFINITY))
- return Double.NaN;
-
- if (abs(a) <= PI / 4)
- return cos(a, 0);
-
- // Argument reduction needed.
- double[] y = new double[2];
- int n = remPiOver2(a, y);
- switch (n & 3)
- {
- case 0:
- return cos(y[0], y[1]);
- case 1:
- return -sin(y[0], y[1]);
- case 2:
- return -cos(y[0], y[1]);
- default:
- return sin(y[0], y[1]);
- }
- }
-
- /**
- * The trigonometric function tan. The tangent of NaN or infinity
- * is NaN, and the tangent of 0 retains its sign.
- *
- * @param a the angle (in radians)
- * @return tan(a)
- */
- public static double tan(double a)
- {
- if (a == Double.NEGATIVE_INFINITY || ! (a < Double.POSITIVE_INFINITY))
- return Double.NaN;
-
- if (abs(a) <= PI / 4)
- return tan(a, 0, false);
-
- // Argument reduction needed.
- double[] y = new double[2];
- int n = remPiOver2(a, y);
- return tan(y[0], y[1], (n & 1) == 1);
- }
-
- /**
- * The trigonometric function arcsin. The range of angles returned
- * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN or
- * its absolute value is beyond 1, the result is NaN; and the arcsine of
- * 0 retains its sign.
- *
- * @param x the sin to turn back into an angle
- * @return arcsin(x)
- */
- public static double asin(double x)
- {
- boolean negative = x < 0;
- if (negative)
- x = -x;
- if (! (x <= 1))
- return Double.NaN;
- if (x == 1)
- return negative ? -PI / 2 : PI / 2;
- if (x < 0.5)
- {
- if (x < 1 / TWO_27)
- return negative ? -x : x;
- double t = x * x;
- double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t
- * (PS4 + t * PS5)))));
- double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4)));
- return negative ? -x - x * (p / q) : x + x * (p / q);
- }
- double w = 1 - x; // 1>|x|>=0.5.
- double t = w * 0.5;
- double p = t * (PS0 + t * (PS1 + t * (PS2 + t * (PS3 + t
- * (PS4 + t * PS5)))));
- double q = 1 + t * (QS1 + t * (QS2 + t * (QS3 + t * QS4)));
- double s = sqrt(t);
- if (x >= 0.975)
- {
- w = p / q;
- t = PI / 2 - (2 * (s + s * w) - PI_L / 2);
- }
- else
- {
- w = (float) s;
- double c = (t - w * w) / (s + w);
- p = 2 * s * (p / q) - (PI_L / 2 - 2 * c);
- q = PI / 4 - 2 * w;
- t = PI / 4 - (p - q);
- }
- return negative ? -t : t;
- }
-
- /**
- * The trigonometric function arccos. The range of angles returned
- * is 0 to pi radians (0 to 180 degrees). If the argument is NaN or
- * its absolute value is beyond 1, the result is NaN.
- *
- * @param x the cos to turn back into an angle
- * @return arccos(x)
- */
- public static double acos(double x)
- {
- boolean negative = x < 0;
- if (negative)
- x = -x;
- if (! (x <= 1))
- return Double.NaN;
- if (x == 1)
- return negative ? PI : 0;
- if (x < 0.5)
- {
- if (x < 1 / TWO_57)
- return PI / 2;
- double z = x * x;
- double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z
- * (PS4 + z * PS5)))));
- double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4)));
- double r = x - (PI_L / 2 - x * (p / q));
- return negative ? PI / 2 + r : PI / 2 - r;
- }
- if (negative) // x<=-0.5.
- {
- double z = (1 + x) * 0.5;
- double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z
- * (PS4 + z * PS5)))));
- double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4)));
- double s = sqrt(z);
- double w = p / q * s - PI_L / 2;
- return PI - 2 * (s + w);
- }
- double z = (1 - x) * 0.5; // x>0.5.
- double s = sqrt(z);
- double df = (float) s;
- double c = (z - df * df) / (s + df);
- double p = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z
- * (PS4 + z * PS5)))));
- double q = 1 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4)));
- double w = p / q * s + c;
- return 2 * (df + w);
- }
-
- /**
- * The trigonometric function arcsin. The range of angles returned
- * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN, the
- * result is NaN; and the arctangent of 0 retains its sign.
- *
- * @param x the tan to turn back into an angle
- * @return arcsin(x)
- * @see #atan2(double, double)
- */
- public static double atan(double x)
- {
- double lo;
- double hi;
- boolean negative = x < 0;
- if (negative)
- x = -x;
- if (x >= TWO_66)
- return negative ? -PI / 2 : PI / 2;
- if (! (x >= 0.4375)) // |x|<7/16, or NaN.
- {
- if (! (x >= 1 / TWO_29)) // Small, or NaN.
- return negative ? -x : x;
- lo = hi = 0;
- }
- else if (x < 1.1875)
- {
- if (x < 0.6875) // 7/16<=|x|<11/16.
- {
- x = (2 * x - 1) / (2 + x);
- hi = ATAN_0_5H;
- lo = ATAN_0_5L;
- }
- else // 11/16<=|x|<19/16.
- {
- x = (x - 1) / (x + 1);
- hi = PI / 4;
- lo = PI_L / 4;
- }
- }
- else if (x < 2.4375) // 19/16<=|x|<39/16.
- {
- x = (x - 1.5) / (1 + 1.5 * x);
- hi = ATAN_1_5H;
- lo = ATAN_1_5L;
- }
- else // 39/16<=|x|<2**66.
- {
- x = -1 / x;
- hi = PI / 2;
- lo = PI_L / 2;
- }
-
- // Break sum from i=0 to 10 ATi*z**(i+1) into odd and even poly.
- double z = x * x;
- double w = z * z;
- double s1 = z * (AT0 + w * (AT2 + w * (AT4 + w * (AT6 + w
- * (AT8 + w * AT10)))));
- double s2 = w * (AT1 + w * (AT3 + w * (AT5 + w * (AT7 + w * AT9))));
- if (hi == 0)
- return negative ? x * (s1 + s2) - x : x - x * (s1 + s2);
- z = hi - ((x * (s1 + s2) - lo) - x);
- return negative ? -z : z;
- }
-
- /**
- * A special version of the trigonometric function arctan, for
- * converting rectangular coordinates (x, y) to polar
- * (r, theta). This computes the arctangent of x/y in the range
- * of -pi to pi radians (-180 to 180 degrees). Special cases: This returns theta, the angle of the point. To get r, albeit
- * slightly inaccurately, use sqrt(x*x+y*y).
- *
- * @param y the y position
- * @param x the x position
- * @return theta in the conversion of (x, y) to (r, theta)
- * @see #atan(double)
- */
- public static double atan2(double y, double x)
- {
- if (x != x || y != y)
- return Double.NaN;
- if (x == 1)
- return atan(y);
- if (x == Double.POSITIVE_INFINITY)
- {
- if (y == Double.POSITIVE_INFINITY)
- return PI / 4;
- if (y == Double.NEGATIVE_INFINITY)
- return -PI / 4;
- return 0 * y;
- }
- if (x == Double.NEGATIVE_INFINITY)
- {
- if (y == Double.POSITIVE_INFINITY)
- return 3 * PI / 4;
- if (y == Double.NEGATIVE_INFINITY)
- return -3 * PI / 4;
- return (1 / (0 * y) == Double.POSITIVE_INFINITY) ? PI : -PI;
- }
- if (y == 0)
- {
- if (1 / (0 * x) == Double.POSITIVE_INFINITY)
- return y;
- return (1 / y == Double.POSITIVE_INFINITY) ? PI : -PI;
- }
- if (y == Double.POSITIVE_INFINITY || y == Double.NEGATIVE_INFINITY
- || x == 0)
- return y < 0 ? -PI / 2 : PI / 2;
-
- double z = abs(y / x); // Safe to do y/x.
- if (z > TWO_60)
- z = PI / 2 + 0.5 * PI_L;
- else if (x < 0 && z < 1 / TWO_60)
- z = 0;
- else
- z = atan(z);
- if (x > 0)
- return y > 0 ? z : -z;
- return y > 0 ? PI - (z - PI_L) : z - PI_L - PI;
- }
-
- /**
- * Take ea. The opposite of Note that the way to get logb(a) is to do this:
- * For other roots, use pow(x, 1/rootNumber).
- *
- * @param x the numeric argument
- * @return the square root of the argument
- * @see #pow(double, double)
- */
- public static double sqrt(double x)
- {
- if (x < 0)
- return Double.NaN;
- if (x == 0 || ! (x < Double.POSITIVE_INFINITY))
- return x;
-
- // Normalize x.
- long bits = Double.doubleToLongBits(x);
- int exp = (int) (bits >> 52);
- if (exp == 0) // Subnormal x.
- {
- x *= TWO_54;
- bits = Double.doubleToLongBits(x);
- exp = (int) (bits >> 52) - 54;
- }
- exp -= 1023; // Unbias exponent.
- bits = (bits & 0x000fffffffffffffL) | 0x0010000000000000L;
- if ((exp & 1) == 1) // Odd exp, double x to make it even.
- bits <<= 1;
- exp >>= 1;
-
- // Generate sqrt(x) bit by bit.
- bits <<= 1;
- long q = 0;
- long s = 0;
- long r = 0x0020000000000000L; // Move r right to left.
- while (r != 0)
- {
- long t = s + r;
- if (t <= bits)
- {
- s = t + r;
- bits -= t;
- q += r;
- }
- bits <<= 1;
- r >>= 1;
- }
-
- // Use floating add to round correctly.
- if (bits != 0)
- q += q & 1;
- return Double.longBitsToDouble((q >> 1) + ((exp + 1022L) << 52));
- }
-
- /**
- * Raise a number to a power. Special cases: (In the foregoing descriptions, a floating-point value is
- * considered to be an integer if and only if it is a fixed point of the
- * method {@link #ceil(double)} or, equivalently, a fixed point of the
- * method {@link #floor(double)}. A value is a fixed point of a one-argument
- * method if and only if the result of applying the method to the value is
- * equal to the value.)
- *
- * @param x the number to raise
- * @param y the power to raise it to
- * @return xy
- */
- public static double pow(double x, double y)
- {
- // Special cases first.
- if (y == 0)
- return 1;
- if (y == 1)
- return x;
- if (y == -1)
- return 1 / x;
- if (x != x || y != y)
- return Double.NaN;
-
- // When x < 0, yisint tells if y is not an integer (0), even(1),
- // or odd (2).
- int yisint = 0;
- if (x < 0 && floor(y) == y)
- yisint = (y % 2 == 0) ? 2 : 1;
- double ax = abs(x);
- double ay = abs(y);
-
- // More special cases, of y.
- if (ay == Double.POSITIVE_INFINITY)
- {
- if (ax == 1)
- return Double.NaN;
- if (ax > 1)
- return y > 0 ? y : 0;
- return y < 0 ? -y : 0;
- }
- if (y == 2)
- return x * x;
- if (y == 0.5)
- return sqrt(x);
-
- // More special cases, of x.
- if (x == 0 || ax == Double.POSITIVE_INFINITY || ax == 1)
- {
- if (y < 0)
- ax = 1 / ax;
- if (x < 0)
- {
- if (x == -1 && yisint == 0)
- ax = Double.NaN;
- else if (yisint == 1)
- ax = -ax;
- }
- return ax;
- }
- if (x < 0 && yisint == 0)
- return Double.NaN;
-
- // Now we can start!
- double t;
- double t1;
- double t2;
- double u;
- double v;
- double w;
- if (ay > TWO_31)
- {
- if (ay > TWO_64) // Automatic over/underflow.
- return ((ax < 1) ? y < 0 : y > 0) ? Double.POSITIVE_INFINITY : 0;
- // Over/underflow if x is not close to one.
- if (ax < 0.9999995231628418)
- return y < 0 ? Double.POSITIVE_INFINITY : 0;
- if (ax >= 1.0000009536743164)
- return y > 0 ? Double.POSITIVE_INFINITY : 0;
- // Now |1-x| is <= 2**-20, sufficient to compute
- // log(x) by x-x^2/2+x^3/3-x^4/4.
- t = x - 1;
- w = t * t * (0.5 - t * (1 / 3.0 - t * 0.25));
- u = INV_LN2_H * t;
- v = t * INV_LN2_L - w * INV_LN2;
- t1 = (float) (u + v);
- t2 = v - (t1 - u);
- }
- else
- {
- long bits = Double.doubleToLongBits(ax);
- int exp = (int) (bits >> 52);
- if (exp == 0) // Subnormal x.
- {
- ax *= TWO_54;
- bits = Double.doubleToLongBits(ax);
- exp = (int) (bits >> 52) - 54;
- }
- exp -= 1023; // Unbias exponent.
- ax = Double.longBitsToDouble((bits & 0x000fffffffffffffL)
- | 0x3ff0000000000000L);
- boolean k;
- if (ax < SQRT_1_5) // |x| This is an Error rather than an exception, so that normal code will
- * not catch it. It is intended for asynchronous cleanup when using the
- * deprecated Thread.stop() method.
- *
- * @author John Keiser
- * @author Tom Tromey (tromey@cygnus.com)
- * @see Thread#stop()
- * @status updated to 1.4
- */
-public class ThreadDeath extends Error
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -4417128565033088268L;
-
- /**
- * Create an error without a message.
- */
- public ThreadDeath()
- {
- }
-}
diff --git a/libjava/java/lang/ThreadGroup.java b/libjava/java/lang/ThreadGroup.java
deleted file mode 100644
index 6e4c27a7135..00000000000
--- a/libjava/java/lang/ThreadGroup.java
+++ /dev/null
@@ -1,749 +0,0 @@
-/* ThreadGroup -- a group of Threads
- Copyright (C) 1998, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.lang;
-
-import java.util.Vector;
-
-/**
- * ThreadGroup allows you to group Threads together. There is a hierarchy
- * of ThreadGroups, and only the initial ThreadGroup has no parent. A Thread
- * may access information about its own ThreadGroup, but not its parents or
- * others outside the tree.
- *
- * @author John Keiser
- * @author Tom Tromey
- * @author Bryce McKinlay
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Thread
- * @since 1.0
- * @status updated to 1.4
- */
-public class ThreadGroup
-{
- /** The Initial, top-level ThreadGroup. */
- static ThreadGroup root = new ThreadGroup();
-
- /**
- * This flag is set if an uncaught exception occurs. The runtime should
- * check this and exit with an error status if it is set.
- */
- static boolean had_uncaught_exception;
-
- /** The parent thread group. */
- private final ThreadGroup parent;
-
- /** The group name, non-null. */
- final String name;
-
- /** The threads in the group. */
- private final Vector threads = new Vector();
-
- /** Child thread groups, or null when this group is destroyed. */
- private Vector groups = new Vector();
-
- /** If all threads in the group are daemons. */
- private boolean daemon_flag = false;
-
- /** The maximum group priority. */
- private int maxpri;
-
- /**
- * Hidden constructor to build the root node.
- */
- private ThreadGroup()
- {
- name = "main";
- parent = null;
- maxpri = Thread.MAX_PRIORITY;
- }
-
- /**
- * Create a new ThreadGroup using the given name and the current thread's
- * ThreadGroup as a parent. There may be a security check,
- * This is inherently unsafe, as it can interrupt synchronized blocks and
- * leave data in bad states. Hence, there is a security check:
- * This is inherently unsafe, as suspended threads still hold locks,
- * which can lead to deadlock. Hence, there is a security check:
- * There are two special cases: {@link Error} and {@link RuntimeException}:
- * these two classes (and their subclasses) are considered unchecked
- * exceptions, and are either frequent enough or catastrophic enough that you
- * do not need to declare them in Instances of this class are usually created with knowledge of the
- * execution context, so that you can get a stack trace of the problem spot
- * in the code. Also, since JDK 1.4, Throwables participate in "exception
- * chaining." This means that one exception can be caused by another, and
- * preserve the information of the original.
- *
- * One reason this is useful is to wrap exceptions to conform to an
- * interface. For example, it would be bad design to require all levels
- * of a program interface to be aware of the low-level exceptions thrown
- * at one level of abstraction. Another example is wrapping a checked
- * exception in an unchecked one, to communicate that failure occured
- * while still obeying the method throws clause of a superclass.
- *
- * A cause is assigned in one of two ways; but can only be assigned once
- * in the lifetime of the Throwable. There are new constructors added to
- * several classes in the exception hierarchy that directly initialize the
- * cause, or you can use the By convention, exception classes have two constructors: one with no
- * arguments, and one that takes a String for a detail message. Further,
- * classes which are likely to be used in an exception chain also provide
- * a constructor that takes a Throwable, with or without a detail message
- * string.
- *
- * Another 1.4 feature is the StackTrace, a means of reflection that
- * allows the program to inspect the context of the exception, and which is
- * serialized, so that remote procedure calls can correctly pass exceptions.
- *
- * @author Brian Jones
- * @author John Keiser
- * @author Mark Wielaard
- * @author Tom Tromey
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public class Throwable implements Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -3042686055658047285L;
-
- /**
- * The detail message.
- *
- * @serial specific details about the exception, may be null
- */
- private final String detailMessage;
-
- /**
- * The cause of the throwable, including null for an unknown or non-chained
- * cause. This may only be set once; so the field is set to
- *
- * This implementation first prints a line with the result of this
- * object's
- * The contents of the given stacktrace is copied so changes to the
- * original array do not change the stack trace elements of this
- * throwable.
- *
- * @param stackTrace the new trace to use
- * @throws NullPointerException if stackTrace is null or has null elements
- * @since 1.4
- */
- public void setStackTrace(StackTraceElement[] stackTrace)
- {
- int i = stackTrace.length;
- StackTraceElement[] st = new StackTraceElement[i];
-
- while (--i >= 0)
- {
- st[i] = stackTrace[i];
- if (st[i] == null)
- throw new NullPointerException("Element " + i + " null");
- }
-
- this.stackTrace = st;
- }
-
- /**
- * VM state when fillInStackTrace was called.
- * Used by getStackTrace() to get an array of StackTraceElements.
- * Cleared when no longer needed.
- */
- private transient VMThrowable vmState;
-}
diff --git a/libjava/java/lang/UnknownError.java b/libjava/java/lang/UnknownError.java
deleted file mode 100644
index 7b317bd2aa2..00000000000
--- a/libjava/java/lang/UnknownError.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* UnknownError.java -- thrown when the VM cannot provide more information
- about a catastrophic error
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An This class could be Serializable, but that is up to Sun.
- *
- * It is forbidden to set the accessibility flag to true on any constructor
- * for java.lang.Class. This will result in a SecurityException. If the
- * SecurityException is thrown for any of the passed AccessibleObjects,
- * the accessibility flag will be set on AccessibleObjects in the array prior
- * to the one which resulted in the exception.
- *
- * @param array the array of accessible objects
- * @param flag the desired state of accessibility, true to bypass security
- * @throws NullPointerException if array is null
- * @throws SecurityException if the request is denied
- * @see SecurityManager#checkPermission(java.security.Permission)
- * @see RuntimePermission
- */
- public static void setAccessible(AccessibleObject[] array, boolean flag)
- {
- checkPermission();
- for (int i = 0; i < array.length; i++)
- array[i].secureSetAccessible(flag);
- }
-
- /**
- * Sets the accessibility flag for this reflection object. If a security
- * manager exists, it is checked for
- *
- *
- * It is forbidden to set the accessibility flag to true on any constructor for
- * java.lang.Class. This will result in a SecurityException.
- *
- * @param flag the desired state of accessibility, true to bypass security
- * @throws NullPointerException if array is null
- * @throws SecurityException if the request is denied
- * @see SecurityManager#checkPermission(java.security.Permission)
- * @see RuntimePermission
- */
- public void setAccessible(boolean flag)
- {
- checkPermission();
- secureSetAccessible(flag);
- }
-
- /**
- * Performs the specified security check, for
- * While this interface was designed for use by Proxy, it will also
- * work on any object in general. Hints for implementing this class: For a fun time, create an InvocationHandler that handles the
- * methods of a proxy instance of the InvocationHandler interface!
- *
- * In short, if a method is declared in Object (namely, hashCode,
- * equals, or toString), then Object will be used; otherwise, the
- * leftmost interface that inherits or declares a method will be used,
- * even if it has a more permissive throws clause than what the proxy
- * class is allowed. Thus, in the invocation handler, it is not always
- * safe to assume that every class listed in the throws clause of the
- * passed Method object can safely be thrown; fortunately, the Proxy
- * instance is robust enough to wrap all illegal checked exceptions in
- * {@link UndeclaredThrowableException}.
- *
- * @see InvocationHandler
- * @see UndeclaredThrowableException
- * @see Class
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4, except for the use of ProtectionDomain
- */
-public class Proxy implements Serializable
-{
- /**
- * Compatible with JDK 1.3+.
- */
- private static final long serialVersionUID = -2222568056686623797L;
-
- /**
- * Map of ProxyType to proxy class.
- *
- * @XXX This prevents proxy classes from being garbage collected.
- * java.util.WeakHashSet is not appropriate, because that collects the
- * keys, but we are interested in collecting the elements.
- */
- private static final Map proxyClasses = new HashMap();
-
- /**
- * The invocation handler for this proxy instance. For Proxy, this
- * field is unused, but it appears here in order to be serialized in all
- * proxy classes.
- *
- * NOTE: This implementation is more secure for proxy classes
- * than what Sun specifies. Sun does not require h to be immutable, but
- * this means you could change h after the fact by reflection. However,
- * by making h immutable, we may break non-proxy classes which extend
- * Proxy.
- * @serial invocation handler associated with this proxy instance
- */
- protected InvocationHandler h;
-
- /**
- * Constructs a new Proxy from a subclass (usually a proxy class),
- * with the specified invocation handler.
- *
- * NOTE: This throws a NullPointerException if you attempt
- * to create a proxy instance with a null handler using reflection.
- * This behavior is not yet specified by Sun; see Sun Bug 4487672.
- *
- * @param handler the invocation handler, may be null if the subclass
- * is not a proxy class
- * @throws NullPointerException if handler is null and this is a proxy
- * instance
- */
- protected Proxy(InvocationHandler handler)
- {
- if (handler == null && isProxyClass(getClass()))
- throw new NullPointerException("invalid handler");
- h = handler;
- }
-
- /**
- * Returns the proxy {@link Class} for the given ClassLoader and array
- * of interfaces, dynamically generating it if necessary.
- *
- * There are several restrictions on this method, the violation of
- * which will result in an IllegalArgumentException or
- * NullPointerException: Note that different orders of interfaces produce distinct classes. This check is secure (in other words, it is not simply
- *
- *
- * NOTE: We guarantee a non-null result if successful,
- * but Sun allows the creation of a proxy instance with a null
- * handler. See the comments for {@link #Proxy(InvocationHandler)}.
- *
- * @param proxy the proxy instance, must not be null
- * @return the invocation handler, guaranteed non-null.
- * @throws IllegalArgumentException if
- * When thrown by Proxy, this class will always wrap a checked
- * exception, never {@link Error} or {@link RuntimeException},
- * which are unchecked.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Proxy
- * @see InvocationHandler
- * @since 1.3
- * @status updated to 1.4
- */
-public class UndeclaredThrowableException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.3+.
- */
- private static final long serialVersionUID = 330127114055056639L;
-
- /**
- * The immutable exception that this wraps. This field is redundant
- * with {@link Throwable#cause}, but is necessary for serial compatibility.
- *
- * @serial the chained exception
- */
- private final Throwable undeclaredThrowable;
-
- /**
- * Wraps the given checked exception into a RuntimeException, with no
- * detail message. {@link Throwable#initCause(Throwable)} will fail
- * on this instance.
- *
- * @param cause the undeclared throwable that caused this exception,
- * may be null
- */
- public UndeclaredThrowableException(Throwable cause)
- {
- this(cause, null);
- }
-
- /**
- * Wraps the given checked exception into a RuntimeException, with the
- * specified detail message. {@link Throwable#initCause(Throwable)} will
- * fail on this instance.
- *
- * @param cause the undeclared throwable that caused this exception,
- * may be null
- * @param message the message, may be null
- */
- public UndeclaredThrowableException(Throwable cause, String message)
- {
- super(message, cause);
- undeclaredThrowable = cause;
- }
-
- /**
- * Returns the cause of this exception. If this exception was created
- * by a {@link Proxy} instance, it will be a non-null checked
- * exception. This method pre-dates exception chaining, and is now
- * simply a longer way to call classLoader
is
- * null
. When lookupProviders
is called,
- * the current {@link AccessControlContext} gets recorded. This
- * captured security context will determine the permissions when
- * services get loaded via the next()
method of the
- * returned Iterator
.
- *
- * @param spi the service provider interface which must be
- * implemented by any loaded service providers.
- *
- * @param loader the class loader that will be used to load the
- * service providers, or null
for the system class
- * loader. For using the context class loader, see {@link
- * #lookupProviders(Class)}.
- *
- * @return an iterator over instances of spi
.
- *
- * @throws IllegalArgumentException if spi
is
- * null
.
- */
- public static Iterator lookupProviders(Class spi,
- ClassLoader loader)
- {
- String resourceName;
- Enumeration urls;
-
- if (spi == null)
- throw new IllegalArgumentException();
-
- if (loader == null)
- loader = ClassLoader.getSystemClassLoader();
-
- resourceName = "META-INF/services/" + spi.getName();
- try
- {
- urls = loader.getResources(resourceName);
- }
- catch (IOException ioex)
- {
- /* If an I/O error occurs here, we cannot provide any service
- * providers. In this case, we simply return an iterator that
- * does not return anything (no providers installed).
- */
- log(Level.WARNING, "cannot access {0}", resourceName, ioex);
- return Collections.EMPTY_LIST.iterator();
- }
-
- return new ServiceIterator(spi, urls, loader,
- AccessController.getContext());
- }
-
-
- /**
- * Finds service providers that are implementing the specified
- * Service Provider Interface, using the context class loader
- * for loading providers.
- *
- * @param spi the service provider interface which must be
- * implemented by any loaded service providers.
- *
- * @return an iterator over instances of spi
.
- *
- * @throws IllegalArgumentException if spi
is
- * null
.
- *
- * @see #lookupProviders(Class, ClassLoader)
- */
- public static Iterator lookupProviders(Class spi)
- {
- ClassLoader ctxLoader;
-
- ctxLoader = Thread.currentThread().getContextClassLoader();
- return lookupProviders(spi, ctxLoader);
- }
-
-
- /**
- * An iterator over service providers that are listed in service
- * provider configuration files, which get passed as an Enumeration
- * of URLs. This is a helper class for {@link
- * ServiceFactory#lookupProviders}.
- *
- * @author Sascha Brawer
- */
- private static final class ServiceIterator
- implements Iterator
- {
- /**
- * The service provider interface (usually an interface, sometimes
- * an abstract class) which the services must implement.
- */
- private final Class spi;
-
-
- /**
- * An EnumerationMETA-INF/services/<org.foo.SomeService>
,
- * as returned by {@link ClassLoader#getResources(String)}.
- */
- private final Enumeration urls;
-
-
- /**
- * The class loader used for loading service providers.
- */
- private final ClassLoader loader;
-
-
- /**
- * The security context used when loading and initializing service
- * providers. We want to load and initialize all plug-in service
- * providers under the same security context, namely the one that
- * was active when {@link #lookupProviders} has been called.
- */
- private final AccessControlContext securityContext;
-
-
- /**
- * A reader for the current file listing class names of service
- * implementors, or null
when the last reader has
- * been fetched.
- */
- private BufferedReader reader;
-
-
- /**
- * The URL currently being processed. This is only used for
- * emitting error messages.
- */
- private URL currentURL;
-
-
- /**
- * The service provider that will be returned by the next call to
- * {@link #next()}, or null
if the iterator has
- * already returned all service providers.
- */
- private Object nextProvider;
-
-
- /**
- * Constructs an Iterator that loads and initializes services on
- * demand.
- *
- * @param spi the service provider interface which the services
- * must implement. Usually, this is a Java interface type, but it
- * might also be an abstract class or even a concrete superclass.
- *
- * @param urls an EnumerationMETA-INF/services/<org.foo.SomeService>
, as
- * determined by {@link ClassLoader#getResources(String)}.
- *
- * @param loader the ClassLoader that gets used for loading
- * service providers.
- *
- * @param securityContext the security context to use when loading
- * and initializing service providers.
- */
- ServiceIterator(Class spi, Enumeration urls, ClassLoader loader,
- AccessControlContext securityContext)
- {
- this.spi = spi;
- this.urls = urls;
- this.loader = loader;
- this.securityContext = securityContext;
- this.nextProvider = loadNextServiceProvider();
- }
-
-
- /**
- * @throws NoSuchElementException if {@link #hasNext} returns
- * false
.
- */
- public Object next()
- {
- Object result;
-
- if (!hasNext())
- throw new NoSuchElementException();
-
- result = nextProvider;
- nextProvider = loadNextServiceProvider();
- return result;
- }
-
-
- public boolean hasNext()
- {
- return nextProvider != null;
- }
-
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
-
- private Object loadNextServiceProvider()
- {
- String line;
-
- if (reader == null)
- advanceReader();
-
- for (;;)
- {
- /* If we have reached the last provider list, we cannot
- * retrieve any further lines.
- */
- if (reader == null)
- return null;
-
- try
- {
- line = reader.readLine();
- }
- catch (IOException readProblem)
- {
- log(Level.WARNING, "IOException upon reading {0}", currentURL,
- readProblem);
- line = null;
- }
-
- /* When we are at the end of one list of services,
- * switch over to the next one.
- */
- if (line == null)
- {
- advanceReader();
- continue;
- }
-
-
- // Skip whitespace at the beginning and end of each line.
- line = line.trim();
-
- // Skip empty lines.
- if (line.length() == 0)
- continue;
-
- // Skip comment lines.
- if (line.charAt(0) == '#')
- continue;
-
- try
- {
- log(Level.FINE,
- "Loading service provider \"{0}\", specified"
- + " by \"META-INF/services/{1}\" in {2}.",
- new Object[] { line, spi.getName(), currentURL },
- null);
-
- /* Load the class in the security context that was
- * active when calling lookupProviders.
- */
- return AccessController.doPrivileged(
- new ServiceProviderLoadingAction(spi, line, loader),
- securityContext);
- }
- catch (Exception ex)
- {
- String msg = "Cannot load service provider class \"{0}\","
- + " specified by \"META-INF/services/{1}\" in {2}";
- if (ex instanceof PrivilegedActionException
- && ex.getCause() instanceof ClassCastException)
- msg = "Service provider class \"{0}\" is not an instance"
- + " of \"{1}\". Specified"
- + " by \"META-INF/services/{1}\" in {2}.";
-
- log(Level.WARNING, msg,
- new Object[] { line, spi.getName(), currentURL },
- ex);
- continue;
- }
- }
- }
-
-
- private void advanceReader()
- {
- do
- {
- if (reader != null)
- {
- try
- {
- reader.close();
- log(Level.FINE, "closed {0}", currentURL, null);
- }
- catch (Exception ex)
- {
- log(Level.WARNING, "cannot close {0}", currentURL, ex);
- }
- reader = null;
- currentURL = null;
- }
-
- if (!urls.hasMoreElements())
- return;
-
- currentURL = (URL) urls.nextElement();
- try
- {
- reader = new BufferedReader(new InputStreamReader(
- currentURL.openStream(), "UTF-8"));
- log(Level.FINE, "opened {0}", currentURL, null);
- }
- catch (Exception ex)
- {
- log(Level.WARNING, "cannot open {0}", currentURL, ex);
- }
- }
- while (reader == null);
- }
- }
-
-
- // Package-private to avoid a trampoline.
- /**
- * Passes a log message to the java.util.logging
- * framework. This call returns very quickly if no log message will
- * be produced, so there is not much overhead in the standard case.
- *
- * @param the severity of the message, for instance {@link
- * Level#WARNING}.
- *
- * @param msg the log message, for instance “Could not
- * load {0}.”
- *
- * @param param the parameter(s) for the log message, or
- * null
if msg
does not specify any
- * parameters. If param
is not an array, an array with
- * param
as its single element gets passed to the
- * logging framework.
- *
- * @param t a Throwable that is associated with the log record, or
- * null
if the log message is not associated with a
- * Throwable.
- */
- static void log(Level level, String msg, Object param, Throwable t)
- {
- LogRecord rec;
-
- // Return quickly if no log message will be produced.
- if (!LOGGER.isLoggable(level))
- return;
-
- rec = new LogRecord(level, msg);
- if (param != null && param.getClass().isArray())
- rec.setParameters((Object[]) param);
- else
- rec.setParameters(new Object[] { param });
-
- rec.setThrown(t);
-
- // While java.util.logging can sometimes infer the class and
- // method of the caller, this automatic inference is not reliable
- // on highly optimizing VMs. Also, log messages make more sense to
- // developers when they display a public method in a public class;
- // otherwise, they might feel tempted to figure out the internals
- // of ServiceFactory in order to understand the problem.
- rec.setSourceClassName(ServiceFactory.class.getName());
- rec.setSourceMethodName("lookupProviders");
-
- LOGGER.log(rec);
- }
-}
diff --git a/libjava/gnu/classpath/ServiceProviderLoadingAction.java b/libjava/gnu/classpath/ServiceProviderLoadingAction.java
deleted file mode 100644
index b5e59cb4b6f..00000000000
--- a/libjava/gnu/classpath/ServiceProviderLoadingAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/* ServiceProviderLoadingAction.java -- Action for loading plug-in services.
- Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath;
-
-import java.security.PrivilegedExceptionAction;
-
-/**
- * A privileged action for creating a new instance of a service
- * provider.
- *
- * PriviledgedAction
in order to restrict the loaded
- * service providers to the {@link java.security.AccessControlContext}
- * that was active when {@link
- * gnu.classpath.ServiceFactory#lookupProviders} was called, even
- * though the actual loading is delayed to the time when the provider
- * is actually needed.
- *
- * @author Sascha Brawer
- */
-final class ServiceProviderLoadingAction
- implements PrivilegedExceptionAction
-{
- /**
- * The interface to which the loaded service provider implementation
- * must conform. Usually, this is a Java interface type, but it
- * might also be an abstract class or even a concrete class.
- */
- private final Class spi;
-
-
- /**
- * The fully qualified name of the class that gets loaded when
- * this action is executed.
- */
- private final String providerName;
-
-
- /**
- * The ClassLoader that gets used for loading the service provider
- * class.
- */
- private final ClassLoader loader;
-
-
- /**
- * Constructs a privileged action for loading a service provider.
- *
- * @param spi the interface to which the loaded service provider
- * implementation must conform. Usually, this is a Java interface
- * type, but it might also be an abstract class or even a concrete
- * superclass.
- *
- * @param providerName the fully qualified name of the class that
- * gets loaded when this action is executed.
- *
- * @param loader the ClassLoader that gets used for loading the
- * service provider class.
- *
- * @throws IllegalArgumentException if spi
,
- * providerName
or loader
is
- * null
.
- */
- ServiceProviderLoadingAction(Class spi, String providerName,
- ClassLoader loader)
- {
- if (spi == null || providerName == null || loader == null)
- throw new IllegalArgumentException();
-
- this.spi = spi;
- this.providerName = providerName;
- this.loader = loader;
- }
-
-
- /**
- * Loads an implementation class for a service provider, and creates
- * a new instance of the loaded class by invoking its public
- * no-argument constructor.
- *
- * @return a new instance of the class whose name was passed as
- * providerName
to the constructor.
- *
- * @throws ClassCastException if the service provider does not
- * implement the spi
interface that was passed to the
- * constructor.
- *
- * @throws IllegalAccessException if the service provider class or
- * its no-argument constructor are not public
.
- *
- * @throws InstantiationException if the service provider class is
- * abstract
, an interface, a primitive type, an array
- * class, or void; or if service provider class does not have a
- * no-argument constructor; or if there some other problem with
- * creating a new instance of the service provider.
- */
- public Object run()
- throws Exception
- {
- Class loadedClass;
- Object serviceProvider;
-
- loadedClass = loader.loadClass(providerName);
- serviceProvider = loadedClass.newInstance();
-
- // Ensure that the loaded provider is actually implementing
- // the service provider interface.
- if (!spi.isInstance(serviceProvider))
- throw new ClassCastException(spi.getName());
-
- return serviceProvider;
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/exception/InvalidClassException.java b/libjava/gnu/classpath/jdwp/exception/InvalidClassException.java
deleted file mode 100644
index 2e9b7246818..00000000000
--- a/libjava/gnu/classpath/jdwp/exception/InvalidClassException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* InvalidClassException.java -- invalid/unknown class reference id exception
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.exception;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * An exception thrown by the JDWP back-end when an invalid reference
- * type id is used by the debugger.
- *
- * @author Keith Seitz JdwpException
with the
- * given error code and given cause
- *
- * @param code the JDWP error code
- * @param t the cause of the exception
- */
- public JdwpException (short code, Throwable t)
- {
- super (t);
- _errorCode = code;
- }
-
- /**
- * Constructs a new JdwpException
with the
- * given error code and string error message
- *
- * @param code the JDWP error code
- * @param str an error message
- */
- public JdwpException (short code, String str)
- {
- super (str);
- _errorCode = code;
- }
-
- /**
- * Returns the JDWP error code represented by this exception
- */
- public short getErrorCode ()
- {
- return _errorCode;
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java b/libjava/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java
deleted file mode 100644
index d76ad8ca837..00000000000
--- a/libjava/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* JdwpInternalErrorException.java -- an internal error exception
- features or functions
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.exception;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * An exception thrown by the JDWP back-end when an unusual runtime
- * error occurs internally
- *
- * @author Keith Seitz ArrayId
- */
- public ArrayId ()
- {
- super (JdwpConstants.Tag.ARRAY);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ArrayReferenceTypeId.java b/libjava/gnu/classpath/jdwp/id/ArrayReferenceTypeId.java
deleted file mode 100644
index 14a73dc5b24..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ArrayReferenceTypeId.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ArrayReferenceTypeId.java -- array reference type ids
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * A reference type ID representing java arrays
- *
- * @author Keith Seitz ArrayReferenceTypeId
- */
- public ArrayReferenceTypeId ()
- {
- super (JdwpConstants.TypeTag.ARRAY);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ClassLoaderId.java b/libjava/gnu/classpath/jdwp/id/ClassLoaderId.java
deleted file mode 100644
index 133872566fd..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ClassLoaderId.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ClassLoaderId.java -- class loader IDs
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * A class which represents a JDWP thread id
- *
- * @author Keith Seitz ClassLoaderId
- */
- public ClassLoaderId ()
- {
- super (JdwpConstants.Tag.CLASS_LOADER);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ClassObjectId.java b/libjava/gnu/classpath/jdwp/id/ClassObjectId.java
deleted file mode 100644
index e5559ce10f3..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ClassObjectId.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ClassObjectId.java -- class object IDs
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * A class which represents a JDWP class object id
- *
- * @author Keith Seitz ClassObjectId
- */
- public ClassObjectId ()
- {
- super (JdwpConstants.Tag.CLASS_OBJECT);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ClassReferenceTypeId.java b/libjava/gnu/classpath/jdwp/id/ClassReferenceTypeId.java
deleted file mode 100644
index 6b57673f827..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ClassReferenceTypeId.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ClassReferenceTypeId.java -- class reference type ids
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * A reference type ID representing java classes
- *
- * @author Keith Seitz ClassReferenceTypeId
- */
- public ClassReferenceTypeId ()
- {
- super (JdwpConstants.TypeTag.CLASS);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/InterfaceReferenceTypeId.java b/libjava/gnu/classpath/jdwp/id/InterfaceReferenceTypeId.java
deleted file mode 100644
index bdbd6b6ebff..00000000000
--- a/libjava/gnu/classpath/jdwp/id/InterfaceReferenceTypeId.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* InterfaceReferenceTypeId.java -- interface reference type ids
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * A reference type ID representing java interfaces
- *
- * @author Keith Seitz InterfaceReferenceTypeId
- */
- public InterfaceReferenceTypeId ()
- {
- super (JdwpConstants.TypeTag.INTERFACE);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/JdwpId.java b/libjava/gnu/classpath/jdwp/id/JdwpId.java
deleted file mode 100644
index 37f82e208c5..00000000000
--- a/libjava/gnu/classpath/jdwp/id/JdwpId.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/* JdwpId.java -- base class for all object ID types
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * A baseclass for all object types reported to the debugger
- *
- * @author Keith Seitz JdwpId
- */
- public JdwpId (byte tag)
- {
- _tag = tag;
- }
-
- /**
- * Sets the id for this object reference
- */
- void setId (long id)
- {
- _id = id;
- }
-
- /**
- * Returns the id for this object reference
- */
- public long getId ()
- {
- return _id;
- }
-
- /**
- * Compares two object ids for equality. Two object ids
- * are equal if they point to the same type and contain to
- * the same id number. (NOTE: This is a much stricter check
- * than is necessary: all JdwpId
s have unique
- * ids.)
- */
- public boolean equals (JdwpId id)
- {
- return ((id.getClass () == getClass ()) && (id.getId () == getId ()));
- }
-
- /**
- * Returns size of this type (used by IDSizes)
- */
- public abstract int size ();
-
- /**
- * Writes the contents of this type to the DataOutputStream
- * @param outStream the DataOutputStream
to use
- * @throws IOException when an error occurs on the OutputStream
- */
- public abstract void write (DataOutputStream outStream)
- throws IOException;
-
- /**
- * Writes the contents of this type to the output stream, preceded
- * by a one-byte tag for tagged object IDs or type tag for
- * reference type IDs.
- *
- * @param outStream the DataOutputStream
to use
- * @throws IOException when an error occurs on the OutputStream
- */
- public void writeTagged (DataOutputStream outStream)
- throws IOException
- {
- outStream.writeByte (_tag);
- write (outStream);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/JdwpIdFactory.java b/libjava/gnu/classpath/jdwp/id/JdwpIdFactory.java
deleted file mode 100644
index 06ec3c7681f..00000000000
--- a/libjava/gnu/classpath/jdwp/id/JdwpIdFactory.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/* JdwpIdFactory.java -- factory for generating type and object IDs
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import java.util.HashMap;
-
-/**
- * This factory generates ids for objects and types that may
- * be sent to a debugger.
- *
- * @author Keith Seitz (keiths@redhat.com)
- */
-public class JdwpIdFactory
-{
- // ID of last object / referencetype
- private static Object _idLock = new Object ();
- private static Object _ridLock = new Object ();
- private static long _lastId = 0;
- private static long _lastRid = 0;
-
- // A list of all ID types
- private static HashMap _idList = new HashMap ();
-
- // Initialize the id list with known types
- static
- {
- // ObjectId and ArrayId are special cases. See newId.
- _idList.put (ClassLoaderId.typeClass, ClassLoaderId.class);
- _idList.put (ClassObjectId.typeClass, ClassObjectId.class);
- //_idList.put (FieldId.typeClass, FieldId.class);
- //_idList.put (FrameId.typeClass, FrameId.class);
- //_idList.put (MethodId.typeClass, MethodId.class);
- _idList.put (StringId.typeClass, StringId.class);
- _idList.put (ThreadId.typeClass, ThreadId.class);
- _idList.put (ThreadGroupId.typeClass, ThreadGroupId.class);
- }
-
- /**
- * Returns a new id for the given object
- *
- * @param object the object for which an id is desired
- * @returns a suitable object id
- */
- public static JdwpId newId (Object object)
- {
- JdwpId id = null;
-
- // Special case: arrays
- if (object.getClass ().isArray ())
- id = new ArrayId ();
- else
- {
- // Loop through all classes until we hit baseclass
- Class myClass;
- for (myClass = object.getClass (); myClass != null;
- myClass = myClass.getSuperclass ())
- {
- Class clz = (Class) _idList.get (myClass);
- if (clz != null)
- {
- try
- {
- id = (JdwpId) clz.newInstance ();
- synchronized (_idLock)
- {
- id.setId (++_lastId);
- }
- return id;
- }
- catch (InstantiationException ie)
- {
- // This really should not happen
- throw new RuntimeException ("cannot create new ID", ie);
- }
- catch (IllegalAccessException iae)
- {
- // This really should not happen
- throw new RuntimeException ("illegal access of ID", iae);
- }
- }
- }
-
- /* getSuperclass returned null and no matching ID type found.
- So it must derive from Object. */
- id = new ObjectId ();
- }
-
- synchronized (_idLock)
- {
- id.setId (++_lastId);
- }
-
- return id;
- }
-
- /**
- * Returns a new reference type id for the given class
- *
- * @param clazz the Class
for which an id is desired
- * @returns a suitable reference type id or null
- */
- public static ReferenceTypeId newReferenceTypeId (Class clazz)
- {
- ReferenceTypeId id = null;
- try
- {
- if (clazz.isArray ())
- id = new ArrayReferenceTypeId ();
- else if (clazz.isInterface ())
- id = new InterfaceReferenceTypeId ();
- else
- id = new ClassReferenceTypeId ();
- synchronized (_ridLock)
- {
- id.setId (++_lastRid);
- }
- return id;
- }
- catch (InstantiationException ie)
- {
- return null;
- }
- catch (IllegalAccessException iae)
- {
- return null;
- }
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ObjectId.java b/libjava/gnu/classpath/jdwp/id/ObjectId.java
deleted file mode 100644
index e34a3b59ebf..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ObjectId.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* ObjectId.java -- object IDs
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * A class which represents a JDWP object id for an object
- *
- * @author Keith Seitz ObjectId
- */
- public ObjectId ()
- {
- super (JdwpConstants.Tag.OBJECT);
- }
-
- /**
- * Constructs a new ObjectId
of the
- * given type.
- *
- * @param tag the tag of this type of object ID
- */
- public ObjectId (byte tag)
- {
- super (tag);
- }
-
- /**
- * Returns the size of this id type
- */
- public int size ()
- {
- return 8;
- }
-
- /**
- * Writes the id to the stream
- *
- * @param outStream the stream to which to write
- * @throws IOException when an error occurs on the OutputStream
- */
- public void write (DataOutputStream outStream)
- throws IOException
- {
- // All we need to do is write out our id as an 8-byte integer
- outStream.writeLong (_id);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ReferenceTypeId.java b/libjava/gnu/classpath/jdwp/id/ReferenceTypeId.java
deleted file mode 100644
index cdb78040a41..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ReferenceTypeId.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ReferenceTypeId.java -- a base class for all reference type IDs
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * Base class for reference type IDs. This class usurps
- * JdwpId
's tag member for its own use (type tag).
- *
- * @author Keith Seitz StringId
- */
- public StringId ()
- {
- super (JdwpConstants.Tag.STRING);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ThreadGroupId.java b/libjava/gnu/classpath/jdwp/id/ThreadGroupId.java
deleted file mode 100644
index aef7d5b5421..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ThreadGroupId.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ThreadGroupId.java -- thread group IDs
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * A class which represents a JDWP thread group id
- *
- * @author Keith Seitz ThreadGroupId
- */
- public ThreadGroupId ()
- {
- super (JdwpConstants.Tag.THREAD_GROUP);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/id/ThreadId.java b/libjava/gnu/classpath/jdwp/id/ThreadId.java
deleted file mode 100644
index 733bf55102b..00000000000
--- a/libjava/gnu/classpath/jdwp/id/ThreadId.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ThreadId.java -- thread IDs
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.id;
-
-import gnu.classpath.jdwp.JdwpConstants;
-
-/**
- * A class which represents a JDWP thread id
- *
- * @author Keith Seitz ThreadId
- */
- public ThreadId ()
- {
- super (JdwpConstants.Tag.THREAD);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/processor/CommandSet.java b/libjava/gnu/classpath/jdwp/processor/CommandSet.java
deleted file mode 100644
index 17b956ceadc..00000000000
--- a/libjava/gnu/classpath/jdwp/processor/CommandSet.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* CommandSet.java -- An interface defining JDWP Command Sets
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.processor;
-
-import gnu.classpath.jdwp.exception.JdwpException;
-
-import java.io.DataOutputStream;
-import java.nio.ByteBuffer;
-
-/**
- * A class representing a JDWP Command Set. This class serves as a generic
- * interface for all Command Sets types used by JDWP.
- *
- * @author Aaron Luchko PacketProcessor
object
- * Connection must be validated before getting here!
- *
- * @param con the connection
- */
- public PacketProcessor (JdwpConnection con)
- {
- _connection = con;
- _shutdown = false;
-
- // MAXIMUM is the value of the largest command set we may receive
- _sets = new CommandSet[JdwpConstants.CommandSet.MAXIMUM + 1];
- _outputBytes = new ByteArrayOutputStream();
- _os = new DataOutputStream (_outputBytes);
-
- // Create all the Command Sets and add them to our array
- _sets[JdwpConstants.CommandSet.VirtualMachine.CS_VALUE] =
- new VirtualMachineCommandSet();
- _sets[JdwpConstants.CommandSet.ReferenceType.CS_VALUE] =
- new ReferenceTypeCommandSet();
- _sets[JdwpConstants.CommandSet.ClassType.CS_VALUE] =
- new ClassTypeCommandSet();
- _sets[JdwpConstants.CommandSet.ArrayType.CS_VALUE] =
- new ArrayTypeCommandSet();
- _sets[JdwpConstants.CommandSet.InterfaceType.CS_VALUE] =
- new InterfaceTypeCommandSet();
- _sets[JdwpConstants.CommandSet.Method.CS_VALUE] =
- new MethodCommandSet();
- _sets[JdwpConstants.CommandSet.Field.CS_VALUE] =
- new FieldCommandSet();
- _sets[JdwpConstants.CommandSet.ObjectReference.CS_VALUE] =
- new ObjectReferenceCommandSet();
- _sets[JdwpConstants.CommandSet.StringReference.CS_VALUE] =
- new StringReferenceCommandSet();
- _sets[JdwpConstants.CommandSet.ThreadReference.CS_VALUE] =
- new ThreadReferenceCommandSet();
- _sets[JdwpConstants.CommandSet.ThreadGroupReference.CS_VALUE] =
- new ThreadGroupReferenceCommandSet();
- _sets[JdwpConstants.CommandSet.ArrayReference.CS_VALUE] =
- new ArrayReferenceCommandSet();
- _sets[JdwpConstants.CommandSet.ClassLoaderReference.CS_VALUE] =
- new ClassLoaderReferenceCommandSet();
- _sets[JdwpConstants.CommandSet.EventRequest.CS_VALUE] =
- new EventRequestCommandSet();
- _sets[JdwpConstants.CommandSet.StackFrame.CS_VALUE] =
- new StackFrameCommandSet();
- _sets[JdwpConstants.CommandSet.ClassObjectReference.CS_VALUE] =
- new ClassObjectReferenceCommandSet();
- }
-
- /**
- * Main run routine for this thread. Will loop getting packets
- * from the connection and processing them.
- */
- public void run ()
- {
- try
- {
- while (!_shutdown)
- {
- _processOnePacket ();
- }
- }
- catch (IOException ex)
- {
- ex.printStackTrace();
- }
- // Time to shutdown, tell Jdwp to shutdown
- Jdwp.getDefault().shutdown();
- }
-
- /**
- * Shutdown the packet processor
- */
- public void shutdown ()
- {
- _shutdown = true;
- interrupt ();
- }
-
- // Helper function which actually does all the work of waiting
- // for a packet and getting it processed.
- private void _processOnePacket ()
- throws IOException
- {
- JdwpPacket pkt = _connection.getPacket ();
-
- if (!(pkt instanceof JdwpCommandPacket))
- {
- // We're not supposed to get these from the debugger!
- // Drop it on the floor
- return;
- }
-
- if (pkt != null)
- {
- JdwpCommandPacket commandPkt = (JdwpCommandPacket) pkt;
- JdwpReplyPacket reply = new JdwpReplyPacket(commandPkt);
-
- // Reset our output stream
- _outputBytes.reset();
-
- // Create a ByteBuffer around the command packet
- ByteBuffer bb = ByteBuffer.wrap(commandPkt.getData());
- byte command = commandPkt.getCommand();
- byte commandSet = commandPkt.getCommandSet();
-
- CommandSet set = null;
- try
- {
- // There is no command set with value 0
- if (commandSet > 0 && commandSet < _sets.length)
- {
- set = _sets[commandPkt.getCommandSet()];
- }
- if (set != null)
- {
- _shutdown = set.runCommand(bb, _os, command);
- reply.setData(_outputBytes.toByteArray());
- }
- else
- {
- // This command set wasn't in our tree
- reply.setErrorCode(JdwpConstants.Error.NOT_IMPLEMENTED);
- }
- }
- catch (JdwpException ex)
- {
- reply.setErrorCode(ex.getErrorCode ());
- }
- _connection.sendPacket (reply);
- }
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java b/libjava/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
deleted file mode 100644
index 34def9f2d07..00000000000
--- a/libjava/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/* ReferenceTypeCommandSet.java -- lass to implement the ReferenceType
- Command Set
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.classpath.jdwp.processor;
-
-import gnu.classpath.jdwp.IVirtualMachine;
-import gnu.classpath.jdwp.Jdwp;
-import gnu.classpath.jdwp.JdwpConstants;
-import gnu.classpath.jdwp.exception.InvalidFieldException;
-import gnu.classpath.jdwp.exception.JdwpException;
-import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
-import gnu.classpath.jdwp.exception.NotImplementedException;
-import gnu.classpath.jdwp.id.IdManager;
-import gnu.classpath.jdwp.id.ObjectId;
-import gnu.classpath.jdwp.id.ReferenceTypeId;
-import gnu.classpath.jdwp.util.JdwpString;
-import gnu.classpath.jdwp.util.Signature;
-import gnu.classpath.jdwp.util.Value;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.nio.ByteBuffer;
-
-/**
- * A class representing the ReferenceType Command Set.
- *
- * @author Aaron Luchko JdwpCommandPacket
- */
- public JdwpCommandPacket ()
- {
- // Don't assign an id. This constructor is called by
- // JdwpPacket.fromBytes, and that will assign a packet id.
- }
-
- /**
- * Constructs a new JdwpCommandPacket
- * with the given command set and command
- *
- * @param set the command set
- * @param command the command
- */
- public JdwpCommandPacket (byte set, byte command)
- {
- _id = ++_last_id;
- _commandSet = set;
- _command = command;
- }
-
- /**
- * Retuns the length of this packet
- */
- public int getLength ()
- {
- return MINIMUM_LENGTH + super.getLength ();
- }
-
- /**
- * Returns the command set
- */
- public byte getCommandSet ()
- {
- return _commandSet;
- }
-
- /**
- * Sets the command set
- */
- public void setCommandSet (byte cs)
- {
- _commandSet = cs;
- }
-
- /**
- * Returns the command
- */
- public byte getCommand ()
- {
- return _command;
- }
-
- /**
- * Sets the command
- */
- public void setCommand (byte cmd)
- {
- _command = cmd;
- }
-
- // Reads command packet data from the given buffer, starting
- // at the given offset
- protected int myFromBytes (byte[] bytes, int index)
- {
- int i = 0;
- setCommandSet (bytes[index + i++]);
- setCommand (bytes[index + i++]);
- return i;
- }
-
- // Writes the command packet data into the given buffer
- protected void myWrite (DataOutputStream dos)
- throws IOException
- {
- dos.writeByte (getCommandSet ());
- dos.writeByte (getCommand ());
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/transport/JdwpConnection.java b/libjava/gnu/classpath/jdwp/transport/JdwpConnection.java
deleted file mode 100644
index 18250d3209b..00000000000
--- a/libjava/gnu/classpath/jdwp/transport/JdwpConnection.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/* JdwpConnection.java -- A JDWP-speaking connection
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.transport;
-
-import gnu.classpath.jdwp.Jdwp;
-import gnu.classpath.jdwp.event.Event;
-import gnu.classpath.jdwp.event.EventRequest;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * A connection via some transport to some JDWP-speaking entity.
- * This is also a thread which handles all communications to/from
- * the debugger. While access to the transport layer may be accessed by
- * several threads, start-up and initialization should not be allowed
- * to occur more than once.
- *
- * JdwpConnection
instance
- *
- * @param transport the transport to use for communications
- */
- public JdwpConnection (ITransport transport)
- {
- _transport = transport;
- _commandQueue = new ArrayList ();
- _shutdown = false;
- _bytes = new ByteArrayOutputStream ();
- _doStream = new DataOutputStream (_bytes);
- }
-
- /**
- * Initializes the connection, including connecting
- * to socket or shared memory endpoint
- *
- * @throws TransportException if initialization fails
- */
- public void initialize ()
- throws TransportException
- {
- // Initialize transport (connect socket, e.g.)
- _transport.initialize ();
-
- // Do handshake
- try
- {
- _inStream = new DataInputStream (_transport.getInputStream ());
- _outStream = new DataOutputStream (_transport.getOutputStream ());
- _doHandshake ();
- }
- catch (IOException ioe)
- {
- throw new TransportException (ioe);
- }
- }
-
- /* Does the JDWP handshake -- this should not need synchronization
- because this is called by VM startup code, i.e., no packet
- processing threads have started yet. */
- private void _doHandshake ()
- throws IOException
- {
- // According to the spec, the handshake is always initiated by
- // the debugger, regardless of whether the JVM is in client mode or
- // server mode.
-
- // Wait for handshake from debugger
- byte[] hshake = new byte[_HANDSHAKE.length];
- _inStream.readFully (hshake, 0, _HANDSHAKE.length);
-
- if (Arrays.equals (hshake, _HANDSHAKE))
- {
- // Send reply handshake
- _outStream.write (_HANDSHAKE, 0, _HANDSHAKE.length);
- return;
- }
- else
- {
- throw new IOException ("invalid JDWP handshake (\"" + hshake + "\")");
- }
- }
-
- /**
- * Main run method for the thread. This thread loops waiting for
- * packets to be read via the connection. When a packet is complete
- * and ready for processing, it places the packet in a queue that can
- * be accessed via getPacket
- */
- public void run ()
- {
- while (!_shutdown)
- {
- try
- {
- _readOnePacket ();
- }
- catch (IOException ioe)
- {
- /* IOException can occur for two reasons:
- 1. Lost connection with the other side
- 2. Transport was shutdown
- In either case, we make sure that all of the
- back-end gets shutdown. */
- Jdwp.getInstance().shutdown ();
- }
- catch (Throwable t)
- {
- System.out.println ("JdwpConnection.run: caught an exception: "
- + t);
- // Just keep going
- }
- }
- }
-
- // Reads a single packet from the connection, adding it to the packet
- // queue when a complete packet is ready.
- private void _readOnePacket ()
- throws IOException
- {
- byte[] data = null;
-
- // Read in the packet
- int length = _inStream.readInt ();
- if (length < 11)
- {
- throw new IOException ("JDWP packet length < 11 ("
- + length + ")");
- }
-
- data = new byte[length];
- data[0] = (byte) (length >>> 24);
- data[1] = (byte) (length >>> 16);
- data[2] = (byte) (length >>> 8);
- data[3] = (byte) length;
- _inStream.readFully (data, 4, length - 4);
-
- JdwpPacket packet = JdwpPacket.fromBytes (data);
- if (packet != null)
- {
- synchronized (_commandQueue)
- {
- _commandQueue.add (packet);
- _commandQueue.notifyAll ();
- }
- }
- }
-
- /**
- * Returns a packet from the queue of ready packets
- *
- * @returns a JdwpPacket
ready for processing
- * null
when shutting down
- */
- public JdwpPacket getPacket ()
- {
- synchronized (_commandQueue)
- {
- while (_commandQueue.isEmpty ())
- {
- try
- {
- _commandQueue.wait ();
- }
- catch (InterruptedException ie)
- {
- /* PacketProcessor is interrupted
- when shutting down */
- return null;
- }
- }
-
- return (JdwpPacket) _commandQueue.remove (0);
- }
- }
-
- /**
- * Send a packet to the debugger
- *
- * @param pkt a JdwpPacket
to send
- * @throws IOException
- */
- public void sendPacket (JdwpPacket pkt)
- throws IOException
- {
- pkt.write (_outStream);
- }
-
- /**
- * Send an event notification to the debugger
- *
- * @param request the debugger request that wanted this event
- * @param event the event
- * @throws IOException
- */
- public void sendEvent (EventRequest request, Event event)
- throws IOException
- {
- JdwpPacket pkt;
-
- synchronized (_bytes)
- {
- _bytes.reset ();
- pkt = event.toPacket (_doStream, request);
- pkt.setData (_bytes.toByteArray ());
- }
-
- sendPacket (pkt);
- }
-
- /**
- * Shutdown the connection
- */
- public void shutdown ()
- {
- if (!_shutdown)
- {
- _transport.shutdown ();
- _shutdown = true;
- interrupt ();
- }
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/transport/JdwpPacket.java b/libjava/gnu/classpath/jdwp/transport/JdwpPacket.java
deleted file mode 100644
index 7fa93e2de1b..00000000000
--- a/libjava/gnu/classpath/jdwp/transport/JdwpPacket.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/* JdwpPacket.java -- Base class for JDWP command and reply packets
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.transport;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * All command and reply packets in JDWP share
- * common header type information:
- *
- * length (4 bytes) : size of entire packet, including length
- * id (4 bytes) : unique packet id
- * flags (1 byte) : flag byte
- * [command packet stuff | reply packet stuff]
- * data (variable) : unique command-/reply-specific data
- *
- * This class deal with everything except the command- and reply-specific
- * data, which get handled in {@link
- * gnu.classpath.jdwp.transport.JdwpCommandPacket} and {@link
- * gnu.classpath.jdwp.transprot.JdwpReplyPacket}.
- *
- * @author Keith Seitz JdwpPacket
with the id
- * from the given packet.
- *
- * @param pkt a packet whose id will be used in this new packet
- */
- public JdwpPacket (JdwpPacket pkt)
- {
- _id = pkt.getId ();
- }
-
- /**
- * Returns the packet id
- */
- public int getId ()
- {
- return _id;
- }
-
- /**
- * Sets the packet id
- */
- public void setId (int id)
- {
- _id = id;
- }
-
- /**
- * Returns the packet flags
- */
- public byte getFlags ()
- {
- return _flags;
- }
-
- /**
- * Sets the packet flags
- */
- public void setFlags (byte flags)
- {
- _flags = flags;
- }
-
- /**
- * Gets the command/reply-specific data in this packet
- */
- public byte[] getData ()
- {
- return _data;
- }
-
- /**
- * Sets the command/reply-specific data in this packet
- */
- public void setData (byte[] data)
- {
- _data = data;
- }
-
- /**
- * Returns the length of this entire packet
- */
- public int getLength ()
- {
- return MINIMUM_SIZE + (_data == null ? 0 : _data.length);
- }
-
- /**
- * Allow subclasses to initialize from data
- *
- * @param bytes packet data from the wire
- * @param index index into bytes
to start processing
- * @return number of bytes in bytes
processed
- */
- protected abstract int myFromBytes (byte[] bytes, int index);
-
- /**
- * Convert the given bytes into a JdwpPacket
. Uses the
- * abstract method myFromBytes
to allow subclasses to
- * process data.
- *
- * If the given data does not represent a valid JDWP packet, it returns
- * null
.
- *
- * @param bytes packet data from the wire
- * @param index index into bytes
to start processing
- * @return number of bytes in bytes
processed
- */
- public static JdwpPacket fromBytes (byte[] bytes)
- {
- int i = 0;
- int length = ((bytes[i++] & 0xff) << 24 | (bytes[i++] & 0xff) << 16
- | (bytes[i++] & 0xff) << 8 | (bytes[i++] & 0xff));
- int id = 0;
- byte flags = 0;
-
- if (bytes.length == length)
- {
- id = ((bytes[i++] & 0xff) << 24 | (bytes[i++] & 0xff) << 16
- | (bytes[i++] & 0xff) << 8 | (bytes[i++] & 0xff));
- flags = bytes[i++];
-
- Class clazz = null;
- if (flags == 0)
- clazz = JdwpCommandPacket.class;
- else if ((flags & JDWP_FLAG_REPLY) != 0)
- clazz = JdwpReplyPacket.class;
- else
- {
- // Malformed packet. Discard it.
- return null;
- }
-
- JdwpPacket pkt = null;
- try
- {
- pkt = (JdwpPacket) clazz.newInstance ();
- }
- catch (InstantiationException ie)
- {
- // Discard packet
- return null;
- }
- catch (IllegalAccessException iae)
- {
- // Discard packet
- return null;
- }
-
- pkt.setId (id);
- pkt.setFlags (flags);
-
- i += pkt.myFromBytes (bytes, i);
- byte[] data = new byte[length - i];
- System.arraycopy (bytes, i, data, 0, data.length);
- pkt.setData (data);
-
- return pkt;
- }
-
- return null;
- }
-
- /**
- * Put subclass information onto the stream
- *
- * @param dos the output stream to which to write
- */
- protected abstract void myWrite (DataOutputStream dos)
- throws IOException;
-
- /**
- * Writes the packet to the output stream
- *
- * @param dos the output stream to which to write the packet
- */
- public void write (DataOutputStream dos)
- throws IOException
- {
- // length
- int length = getLength ();
- dos.writeInt (length);
-
- // ID
- dos.writeInt (getId ());
-
- // flag
- dos.writeByte (getFlags ());
-
- // packet-specific stuff
- myWrite (dos);
-
- // data (if any)
- byte[] data = getData ();
- if (data != null && data.length > 0)
- dos.write (data, 0, data.length);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/transport/JdwpReplyPacket.java b/libjava/gnu/classpath/jdwp/transport/JdwpReplyPacket.java
deleted file mode 100644
index de32ecf995b..00000000000
--- a/libjava/gnu/classpath/jdwp/transport/JdwpReplyPacket.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/* JdwpReplyPacket.java -- JDWP reply packet
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.transport;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * A class represents a JDWP reply packet.
- * This class adds an error code to the packet header information
- * in {@link gnu.classpath.transport.JdwpPacket} and adds additional
- * reply packet-specific processing.
- *
- * @author Keith Seitz JdwpReplyPacket
.
- */
- public JdwpReplyPacket ()
- {
- // Don't assign a packet id. This is called by JdwpPacket.fromBytes
- // which assigns a packet id. (Not that a VM would do that...)
- }
-
- /**
- * Constructs a JdwpReplyPacket
with the
- * id from the given packet and error code
- *
- * @param pkt the packet whose id this packet will use
- * @param errorCode the error code
- */
- public JdwpReplyPacket (JdwpPacket pkt, short errorCode)
- {
- this(pkt);
- _errorCode = errorCode;
- }
-
- /**
- * Constructs a JdwpReplyPacket
with the
- * id from the given packet and an empty error code
- *
- * @param pkt the packet whose id this packet will use
- */
- public JdwpReplyPacket (JdwpPacket pkt)
- {
- super (pkt);
- _flags = (byte) JDWP_FLAG_REPLY;
- }
-
- /**
- * Returns the length of this packet
- */
- public int getLength ()
- {
- return MINIMUM_LENGTH + super.getLength ();
- }
-
- /**
- * Returns the error code
- */
- public short getErrorCode ()
- {
- return _errorCode;
- }
-
- /**
- * Sets the error code
- */
- public void setErrorCode (short ec)
- {
- _errorCode = ec;
- }
-
- // Reads command packet data from the given buffer, starting
- // at the given offset
- protected int myFromBytes (byte[] bytes, int index)
- {
- int i = 0;
- setErrorCode ((short) ((bytes[index + i++] & 0xff) << 8
- | (bytes[index + i++] & 0xff)));
- return i;
- }
-
- // Writes the command packet data into the given buffer
- protected void myWrite (DataOutputStream dos)
- throws IOException
- {
- dos.writeShort (getErrorCode ());
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/transport/SocketTransport.java b/libjava/gnu/classpath/jdwp/transport/SocketTransport.java
deleted file mode 100644
index 0ad7357e183..00000000000
--- a/libjava/gnu/classpath/jdwp/transport/SocketTransport.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/* SocketTransport.java -- a socket transport
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.transport;
-
-import gnu.classpath.jdwp.transport.ITransport;
-import gnu.classpath.jdwp.transport.TransportException;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.HashMap;
-
-import javax.net.ServerSocketFactory;
-import javax.net.SocketFactory;
-
-/**
- * A socket-based transport. This transport uses
- * configury string that looks like "name=dt_socket,
- * address=localhost:1234,server=y".
- *
- * @author Keith Seitz InputStream
for the transport
- *
- * @throws IOException if an I/O error occurs creating the stream
- * or the socket is not connected
- */
- public InputStream getInputStream ()
- throws IOException
- {
- return _socket.getInputStream ();
- }
-
- /**
- * Returns an OutputStream
for the transport
- *
- * @throws IOException if an I/O error occurs creating the stream
- * or the socket is not connected
- */
- public OutputStream getOutputStream ()
- throws IOException
- {
- return _socket.getOutputStream ();
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/transport/TransportException.java b/libjava/gnu/classpath/jdwp/transport/TransportException.java
deleted file mode 100644
index 057422a879e..00000000000
--- a/libjava/gnu/classpath/jdwp/transport/TransportException.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* TransportException.java -- Exception for transport configury errors
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.transport;
-
-/**
- * A transport configury or initialization exception thrown by
- * JDWP transports. This class is a generic exception class
- * that the different transport layers use to report transport-specific
- * exceptions that may occur (which could be very different from
- * one transport to the next.).
- *
- * @author Keith Seitz TransportException
with the
- * given message
- *
- * @param message a message describing the exception
- */
- public TransportException (String message)
- {
- super (message);
- }
-
- /**
- * Constructs a TransportException
with the
- * given Throwable
root cause
- *
- * @param t the cause of the exception
- */
- public TransportException (Throwable t)
- {
- super (t);
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/transport/TransportFactory.java b/libjava/gnu/classpath/jdwp/transport/TransportFactory.java
deleted file mode 100644
index 480fb362939..00000000000
--- a/libjava/gnu/classpath/jdwp/transport/TransportFactory.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/* TransportFactory.java -- Factory for transports
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.classpath.jdwp.transport;
-
-import java.util.HashMap;
-
-/**
- * A factory class that constructs transports for use by
- * the JDWP back-end.
- *
- * @author Keith Seitz HashMap
specifying the JDWP
- * configuration properties
- * @returns the created and configured transport
- * @throws TransportException for invalid configurations
- */
- public static ITransport newInstance (HashMap properties)
- throws TransportException
- {
- String name = null;
- if (properties != null)
- name = (String) properties.get (_TRANSPORT_PROPERTY);
- if (name == null)
- throw new TransportException ("no transport specified");
-
- for (int i = 0; i < _transportMethods.length; ++i)
- {
- if (_transportMethods[i].name.equals (name))
- {
- try
- {
- ITransport t;
- t = (ITransport) _transportMethods[i].clazz.newInstance ();
- t.configure (properties);
- return t;
- }
- catch (TransportException te)
- {
- throw te;
- }
- catch (Exception e)
- {
- throw new TransportException (e);
- }
- }
- }
-
- throw new TransportException ("transport \"" + name + "\" not found");
- }
-}
diff --git a/libjava/gnu/classpath/jdwp/util/JdwpString.java b/libjava/gnu/classpath/jdwp/util/JdwpString.java
deleted file mode 100644
index 592249fccb2..00000000000
--- a/libjava/gnu/classpath/jdwp/util/JdwpString.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* JdwpString.java -- utility class to read and write jdwp strings
- Copyright (C) 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.classpath.jdwp.util;
-
-import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-
-/**
- * A class to compute the JDWP representation of Strings.
- *
- * @author Aaron Luchko
- *
- *
setXORMode
for drawing “highlights” such
- * as text selections or cursors by inverting colors temporarily and
- * then inverting them back.
- *
- * Graphics
implementation may contain
- * the following code:
- *
- * public void setXORMode(Color xorColor)
- * {
- * setComposite(new gnu.java.awt.BitwiseXORComposite(xorColor));
- * }
- *
- * public void setPaintMode()
- * {
- * setComposite(java.awt.AlphaComposite.SrcOver);
- * }
- *
- * @author Graydon Hoare (graydon@redhat.com)
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
-public class BitwiseXORComposite
- implements Composite
-{
- /**
- * The color whose RGB value is xor-ed with the values of each
- * pixel.
- */
- protected Color xorColor;
-
-
- /**
- * Constructs a new composite for xor-ing the pixel value.
- *
- * @param xorColor the color whose pixel value will be bitwise
- * xor-ed with the source and destination pixels.
- */
- public BitwiseXORComposite(Color xorColor)
- {
- this.xorColor = xorColor;
- }
-
-
- /**
- * Creates a context object for performing the compositing
- * operation. Several contexts may co-exist for one composite; each
- * context may simultaneously be called from concurrent threads.
- *
- * @param srcColorModel the color model of the source.
- * @param dstColorModel the color model of the destination.
- * @param hints hints for choosing between rendering alternatives.
- */
- public CompositeContext createContext(ColorModel srcColorModel,
- ColorModel dstColorModel,
- RenderingHints hints)
- {
- if (IntContext.isSupported(srcColorModel, dstColorModel, hints))
- return new IntContext(srcColorModel, xorColor);
-
- return new GeneralContext(srcColorModel, dstColorModel, xorColor);
- }
-
-
- /**
- * A fallback CompositeContext that performs bitwise XOR of pixel
- * values with the pixel value of the specified xorColor
.
- *
- * TYPE_INT_RGB
took 611 ms on a lightly loaded 2.4 GHz
- * Intel Pentium 4 CPU running Sun J2SE 1.4.1_01 on GNU/Linux
- * 2.4.20. The timing is the average of ten runs on the same
- * BufferedImage. Since the measurements were taken with {@link
- * System#currentTimeMillis()}, they are rather inaccurate.
- *
- * @author Graydon Hoare (graydon@redhat.com)
- */
- private static class GeneralContext
- implements CompositeContext
- {
- ColorModel srcColorModel;
- ColorModel dstColorModel;
- Color xorColor;
-
- public GeneralContext(ColorModel srcColorModel,
- ColorModel dstColorModel,
- Color xorColor)
- {
- this.srcColorModel = srcColorModel;
- this.dstColorModel = dstColorModel;
- this.xorColor = xorColor;
- }
-
-
- public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
- {
- Rectangle srcRect = src.getBounds();
- Rectangle dstInRect = dstIn.getBounds();
- Rectangle dstOutRect = dstOut.getBounds();
-
- int xp = xorColor.getRGB();
- int w = Math.min(Math.min(srcRect.width, dstOutRect.width),
- dstInRect.width);
- int h = Math.min(Math.min(srcRect.height, dstOutRect.height),
- dstInRect.height);
-
- Object srcPix = null, dstPix = null, rpPix = null;
-
- // Re-using the rpPix object saved 1-2% of execution time in
- // the 1024x1024 pixel benchmark.
-
- for (int y = 0; y < h; y++)
- {
- for (int x = 0; x < w; x++)
- {
- srcPix = src.getDataElements(x + srcRect.x, y + srcRect.y, srcPix);
- dstPix = dstIn.getDataElements(x + dstInRect.x, y + dstInRect.y,
- dstPix);
- int sp = srcColorModel.getRGB(srcPix);
- int dp = dstColorModel.getRGB(dstPix);
- int rp = sp ^ xp ^ dp;
- dstOut.setDataElements(x + dstOutRect.x, y + dstOutRect.y,
- dstColorModel.getDataElements(rp, rpPix));
- }
- }
- }
-
-
- /**
- * Disposes any cached resources. The default implementation does
- * nothing because no resources are cached.
- */
- public void dispose()
- {
- }
- }
-
-
- /**
- * An optimized CompositeContext that performs bitwise XOR of
- * int
pixel values with the pixel value of a specified
- * xorColor
. This CompositeContext working only for
- * rasters whose transfer format is {@link DataBuffer#TYPE_INT}.
- *
- * TYPE_INT_RGB
took 69 ms on a lightly loaded 2.4 GHz
- * Intel Pentium 4 CPU running Sun J2SE 1.4.1_01 on GNU/Linux
- * 2.4.20. The timing is the average of ten runs on the same
- * BufferedImage. Since the measurements were taken with {@link
- * System#currentTimeMillis()}, they are rather inaccurate.
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
- private static class IntContext
- extends GeneralContext
- {
- public IntContext(ColorModel colorModel, Color xorColor)
- {
- super(colorModel, colorModel, xorColor);
- }
-
-
- public void compose(Raster src, Raster dstIn,
- WritableRaster dstOut)
- {
- int aX, bX, dstX, aY, bY, dstY, width, height;
- int xorPixel;
- int[] srcLine, dstLine;
-
- aX = src.getMinX();
- aY = src.getMinY();
- bX = dstIn.getMinX();
- bY = dstIn.getMinY();
- dstX = dstOut.getMinX();
- dstY = dstOut.getMinY();
- width = Math.min(Math.min(src.getWidth(), dstIn.getWidth()),
- dstOut.getWidth());
- height = Math.min(Math.min(src.getHeight(), dstIn.getHeight()),
- dstOut.getHeight());
- if ((width < 1) || (height < 1))
- return;
-
- srcLine = new int[width];
- dstLine = new int[width];
-
- /* We need an int[] array with at least one element here;
- * srcLine is as good as any other.
- */
- srcColorModel.getDataElements(this.xorColor.getRGB(), srcLine);
- xorPixel = srcLine[0];
-
- for (int y = 0; y < height; y++)
- {
- src.getDataElements(aX, y + aY, width, 1, srcLine);
- dstIn.getDataElements(bX, y + bY, width, 1, dstLine);
-
- for (int x = 0; x < width; x++)
- dstLine[x] ^= srcLine[x] ^ xorPixel;
-
- dstOut.setDataElements(dstX, y + dstY, width, 1, dstLine);
- }
- }
-
-
- /**
- * Determines whether an instance of this CompositeContext would
- * be able to process the specified color models.
- */
- public static boolean isSupported(ColorModel srcColorModel,
- ColorModel dstColorModel,
- RenderingHints hints)
- {
- // FIXME: It would be good if someone could review these checks.
- // They probably need to be more restrictive.
-
- int transferType;
-
- transferType = srcColorModel.getTransferType();
- if (transferType != dstColorModel.getTransferType())
- return false;
-
- if (transferType != DataBuffer.TYPE_INT)
- return false;
-
- return true;
- }
- }
-}
diff --git a/libjava/gnu/java/awt/Buffers.java b/libjava/gnu/java/awt/Buffers.java
deleted file mode 100644
index c6ccf919145..00000000000
--- a/libjava/gnu/java/awt/Buffers.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Buffers.java --
- Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt;
-
-import java.awt.image.DataBuffer;
-import java.awt.image.DataBufferByte;
-import java.awt.image.DataBufferDouble;
-import java.awt.image.DataBufferFloat;
-import java.awt.image.DataBufferInt;
-import java.awt.image.DataBufferShort;
-import java.awt.image.DataBufferUShort;
-
-/**
- * Utility class for creating and accessing data buffers of arbitrary
- * data types.
- */
-public final class Buffers
-{
- /**
- * Create a data buffer of a particular type.
- *
- * @param dataType the desired data type of the buffer.
- * @param data an array containing data, or null
- * @param size the size of the data buffer bank
- */
- public static DataBuffer createBuffer(int dataType, Object data,
- int size)
- {
- if (data == null) return createBuffer(dataType, size, 1);
-
- return createBufferFromData(dataType, data, size);
- }
-
-
- /**
- * Create a data buffer of a particular type.
- *
- * @param dataType the desired data type of the buffer.
- * @param size the size of the data buffer bank
- */
- public static DataBuffer createBuffer(int dataType, int size) {
- return createBuffer(dataType, size, 1);
- }
-
- /**
- * Create a data buffer of a particular type.
- *
- * @param dataType the desired data type of the buffer.
- * @param size the size of the data buffer bank
- * @param numBanks the number of banks the buffer should have
- */
- public static DataBuffer createBuffer(int dataType, int size, int numBanks)
- {
- switch (dataType)
- {
- case DataBuffer.TYPE_BYTE:
- return new DataBufferByte(size, numBanks);
- case DataBuffer.TYPE_SHORT:
- return new DataBufferShort(size, numBanks);
- case DataBuffer.TYPE_USHORT:
- return new DataBufferUShort(size, numBanks);
- case DataBuffer.TYPE_INT:
- return new DataBufferInt(size, numBanks);
- case DataBuffer.TYPE_FLOAT:
- return new DataBufferFloat(size, numBanks);
- case DataBuffer.TYPE_DOUBLE:
- return new DataBufferDouble(size, numBanks);
- default:
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * Create a data buffer of a particular type.
- *
- * @param dataType the desired data type of the buffer
- * @param data an array containing the data
- * @param size the size of the data buffer bank
- */
- public static DataBuffer createBufferFromData(int dataType, Object data,
- int size)
- {
- switch (dataType)
- {
- case DataBuffer.TYPE_BYTE:
- return new DataBufferByte((byte[]) data, size);
- case DataBuffer.TYPE_SHORT:
- return new DataBufferShort((short[]) data, size);
- case DataBuffer.TYPE_USHORT:
- return new DataBufferUShort((short[]) data, size);
- case DataBuffer.TYPE_INT:
- return new DataBufferInt((int[]) data, size);
- case DataBuffer.TYPE_FLOAT:
- return new DataBufferFloat((float[]) data, size);
- case DataBuffer.TYPE_DOUBLE:
- return new DataBufferDouble((double[]) data, size);
- default:
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * Return the data array of a data buffer, regardless of the data
- * type.
- *
- * @return an array of primitive values. The actual array type
- * depends on the data type of the buffer.
- */
- public static Object getData(DataBuffer buffer)
- {
- if (buffer instanceof DataBufferByte)
- return ((DataBufferByte) buffer).getData();
-
- if (buffer instanceof DataBufferShort)
- return ((DataBufferShort) buffer).getData();
-
- if (buffer instanceof DataBufferUShort)
- return ((DataBufferUShort) buffer).getData();
-
- if (buffer instanceof DataBufferInt)
- return ((DataBufferInt) buffer).getData();
-
- if (buffer instanceof DataBufferFloat)
- return ((DataBufferFloat) buffer).getData();
-
- if (buffer instanceof DataBufferDouble)
- return ((DataBufferDouble) buffer).getData();
-
- throw new ClassCastException("Unknown data buffer type");
- }
-
-
- /**
- * Copy data from array contained in data buffer, much like
- * System.arraycopy. Create a suitable destination array if the
- * given destination array is null.
- */
- public static Object getData(DataBuffer src, int srcOffset,
- Object dest, int destOffset,
- int length)
- {
- Object from;
- if (src instanceof DataBufferByte)
- {
- from = ((DataBufferByte) src).getData();
- if (dest == null) dest = new byte[length+destOffset];
- }
- else if (src instanceof DataBufferShort)
- {
- from = ((DataBufferShort) src).getData();
- if (dest == null) dest = new short[length+destOffset];
- }
- else if (src instanceof DataBufferUShort)
- {
- from = ((DataBufferUShort) src).getData();
- if (dest == null) dest = new short[length+destOffset];
- }
- else if (src instanceof DataBufferInt)
- {
- from = ((DataBufferInt) src).getData();
- if (dest == null) dest = new int[length+destOffset];
- }
- else if (src instanceof DataBufferFloat)
- {
- from = ((DataBufferFloat) src).getData();
- if (dest == null) dest = new float[length+destOffset];
- }
- else if (src instanceof DataBufferDouble)
- {
- from = ((DataBufferDouble) src).getData();
- if (dest == null) dest = new double[length+destOffset];
- }
- else
- {
- throw new ClassCastException("Unknown data buffer type");
- }
-
- System.arraycopy(from, srcOffset, dest, destOffset, length);
- return dest;
- }
-
- /**
- * @param bits the width of a data element measured in bits
- *
- * @return the smallest data type that can store data elements of
- * the given number of bits, without any truncation.
- */
- public static int smallestAppropriateTransferType(int bits)
- {
- if (bits <= 8)
- {
- return DataBuffer.TYPE_BYTE;
- }
- else if (bits <= 16)
- {
- return DataBuffer.TYPE_USHORT;
- }
- else if (bits <= 32)
- {
- return DataBuffer.TYPE_INT;
- }
- else
- {
- return DataBuffer.TYPE_UNDEFINED;
- }
- }
-}
diff --git a/libjava/gnu/java/awt/ClasspathToolkit.java b/libjava/gnu/java/awt/ClasspathToolkit.java
deleted file mode 100644
index d42bfc08221..00000000000
--- a/libjava/gnu/java/awt/ClasspathToolkit.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/* ClasspathToolkit.java -- Abstract superclass for Classpath toolkits.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt;
-
-import gnu.java.awt.peer.ClasspathFontPeer;
-import gnu.java.awt.peer.ClasspathTextLayoutPeer;
-
-import java.awt.AWTException;
-import java.awt.Dimension;
-import java.awt.DisplayMode;
-import java.awt.EventQueue;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Image;
-import java.awt.Toolkit;
-import java.awt.font.FontRenderContext;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageProducer;
-import java.awt.peer.RobotPeer;
-import java.io.File;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.AttributedString;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.imageio.spi.IIORegistry;
-
-/**
- * An abstract superclass for Classpath toolkits.
- *
- * format
is
- * not supported.
- *
- * @throws FontFormatException if stream
does not
- * contain data in the expected format, or if required tables are
- * missing from a font.
- *
- * @throws IOException if a problem occurs while reading in the
- * contents of stream
.
- */
- public abstract Font createFont(int format, InputStream stream);
-
-
- /**
- * Returns an image from the specified file, which must be in a
- * recognized format. The set of recognized image formats may vary
- * from toolkit to toolkit.
- *
- * path
does not
- * designate a valid path.
- */
- public Image getImage(String path)
- {
- try
- {
- return getImage(new File(path).toURL());
- }
- catch (MalformedURLException muex)
- {
- throw (IllegalArgumentException) new IllegalArgumentException(path)
- .initCause(muex);
- }
- }
-
-
- /**
- * Loads an image from the specified URL. The image data must be in
- * a recognized format. The set of recognized image formats may vary
- * from toolkit to toolkit.
- *
- * Bkrxb)ioj%1>rMyNYzgO#s0l#hKA}#L{VRZU
zzGq;tQ>>eYd>v;64%3
}yx=Y)|
z>TXB5f1e278pz4UN`{Zix@lo}uSZR(Xlb8!=PiChu~^_nP*nx;F3~tw*I|MtAJ)AM
z-&eUKEb?MyhEMUz&O3ar3GgUCW0x}Yco{jLLTou`>VC{k5e94685)GX`TNVOMR%zT
zJ^&m%S!$Xr2%}mvlQ{1fX)sv&2E6jOGVX`f$2)@C(^FZPcmZR%DIZ2Wf7gC($Id9!#{pPw3--mJ494pUO;
zg~LRGXbh@1`>`*Y6C8ZgoF$6IA0G{y6FP|G+b+mx^ETnIu(4)0w8|oMgFG?P;Z*EE
zJZPb>doT;VW5qVY$!X;?wOBK#f5uEkN@^sxaxqtC#1FTS+h(&+h-`fjFQ{PE<(1nc
zH3$@W3iFjcf5TY`Gc-Y--Y@BFj@Jp}r8yonhL5Pms7FPL7-w5#EYw${Io^^Y4}>_q
z>pjFc%r+9ma0u@6z8g;0_R8JwF3lI|gy|T;)=s}eYmGCUbW;R_UJvN;TvSpY9v+{`
z!s1-LBRT@2!pNMQbmIXLZAe
ClasspathFontPeer
interface are required to perform
- * the necessary synchronization.locale
is null
, the returned name is
- * localized to the user’s default locale.
- *
- * @return the name of the face inside its family, or
- * null
if the font does not provide a sub-family name.
- */
-
- public abstract String getSubFamilyName (Font font, Locale locale);
-
-
- /**
- * Implementation of {@link Font#getPSName()}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract String getPostScriptName (Font font);
-
-
- /**
- * Implementation of {@link Font#getNumGlyphs()}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract int getNumGlyphs (Font font);
-
-
- /**
- * Implementation of {@link Font#getMissingGlyphCode()}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract int getMissingGlyphCode (Font font);
-
-
- /**
- * Implementation of {@link Font#getBaselineFor(char)}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract byte getBaselineFor (Font font, char c);
-
-
- /**
- * Returns a name for the specified glyph. This is useful for
- * generating PostScript or PDF files that embed some glyphs of a
- * font. If the implementation follows glyph naming conventions
- * specified by Adobe, search engines can extract the original text
- * from the generated PostScript and PDF files.
- *
- * javax.print
package.
- *
- * post
table of format 3 and provides a
- * mapping from glyph IDs to Unicode sequences through a
- * Zapf
table. If the same sequence of Unicode
- * codepoints leads to different glyphs (depending on contextual
- * position, for example, or on typographic sophistication level),
- * the same name would get synthesized for those glyphs. To avoid
- * this, the font peer would have to go through the names of all
- * glyphs, which would make this operation very inefficient with
- * large fonts.
- *
- * @param font the font containing the glyph whose name is
- * requested.
- *
- * @param glyphIndex the glyph whose name the caller wants to
- * retrieve.
- *
- * @return the glyph name, or null
if a font does not
- * provide glyph names.
- */
-
- public abstract String getGlyphName (Font font, int glyphIndex);
-
-
- /**
- * Implementation of {@link
- * Font#createGlyphVector(FontRenderContext, String)}, {@link
- * Font#createGlyphVector(FontRenderContext, char[])}, and {@link
- * Font#createGlyphVector(FontRenderContext, CharacterIterator)}.
- *
- * @param font the font object that the created GlyphVector will return
- * when it gets asked for its font. This argument is needed because the
- * public API of {@link GlyphVector} works with {@link java.awt.Font},
- * not with font peers.
- */
-
- public abstract GlyphVector createGlyphVector (Font font,
- FontRenderContext frc,
- CharacterIterator ci);
-
-
- /**
- * Implementation of {@link Font#createGlyphVector(FontRenderContext,
- * int[])}.
- *
- * @param font the font object that the created GlyphVector will return
- * when it gets asked for its font. This argument is needed because the
- * public API of {@link GlyphVector} works with {@link java.awt.Font},
- * not with font peers.
- */
-
- public abstract GlyphVector createGlyphVector (Font font,
- FontRenderContext ctx,
- int[] glyphCodes);
-
-
- /**
- * Implementation of {@link Font#layoutGlyphVector(FontRenderContext,
- * char[], int, int, int)}.
- *
- * @param font the font object that the created GlyphVector will return
- * when it gets asked for its font. This argument is needed because the
- * public API of {@link GlyphVector} works with {@link java.awt.Font},
- * not with font peers.
- */
-
- public abstract GlyphVector layoutGlyphVector (Font font,
- FontRenderContext frc,
- char[] chars, int start,
- int limit, int flags);
-
-
- /**
- * Implementation of {@link Font#getFontMetrics()}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract FontMetrics getFontMetrics (Font font);
-
-
- /**
- * Implementation of {@link Font#hasUniformLineMetrics()}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract boolean hasUniformLineMetrics (Font font);
-
-
- /**
- * Implementation of {@link Font#getLineMetrics(CharacterIterator, int,
- * int, FontRenderContext)}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract LineMetrics getLineMetrics (Font font,
- CharacterIterator ci,
- int begin, int limit,
- FontRenderContext rc);
-
- /**
- * Implementation of {@link Font#getMaxCharBounds(FontRenderContext)}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract Rectangle2D getMaxCharBounds (Font font,
- FontRenderContext rc);
-
- /**
- * Implementation of {@link Font#getStringBounds(CharacterIterator, int,
- * int, FontRenderContext)}
- *
- * @param font the font this peer is being called from. This may be
- * useful if you are sharing peers between Font objects. Otherwise it may
- * be ignored.
- */
-
- public abstract Rectangle2D getStringBounds (Font font,
- CharacterIterator ci,
- int begin, int limit,
- FontRenderContext frc);
-
-}
diff --git a/libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java b/libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java
deleted file mode 100644
index 70df2ef74ef..00000000000
--- a/libjava/gnu/java/awt/peer/ClasspathTextLayoutPeer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/* ClasspathTextLayoutPeer.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer;
-
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.font.TextHitInfo;
-import java.awt.font.TextLayout;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-
-/**
- * @author Graydon Hoare
- */
-
-public interface ClasspathTextLayoutPeer
-{
- TextHitInfo getStrongCaret (TextHitInfo hit1,
- TextHitInfo hit2);
-
- void draw (Graphics2D g2, float x, float y);
-
- byte getBaseline ();
-
- boolean isLeftToRight ();
- boolean isVertical ();
-
- float getAdvance ();
- float getAscent ();
- float getDescent ();
- float getLeading ();
-
- int getCharacterCount ();
- byte getCharacterLevel (int index);
-
- float[] getBaselineOffsets ();
- Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint);
- Rectangle2D getBounds ();
-
- float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds);
- Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds);
- Shape[] getCaretShapes (int offset, Rectangle2D bounds,
- TextLayout.CaretPolicy policy);
-
- Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
- Rectangle2D bounds);
- int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
- TextHitInfo secondEndpoint);
-
- TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy);
- TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy);
- TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds);
- TextHitInfo getVisualOtherHit (TextHitInfo hit);
-
- float getVisibleAdvance ();
- Shape getOutline (AffineTransform tx);
- Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
- TextHitInfo secondEndpoint,
- Rectangle2D bounds);
-
- TextLayout getJustifiedLayout (float justificationWidth);
- void handleJustify (float justificationWidth);
-
- Object clone ();
- int hashCode ();
- boolean equals (ClasspathTextLayoutPeer tl);
- String toString ();
-}
diff --git a/libjava/gnu/java/awt/peer/EmbeddedWindowPeer.java b/libjava/gnu/java/awt/peer/EmbeddedWindowPeer.java
deleted file mode 100644
index 4c64a1d2d18..00000000000
--- a/libjava/gnu/java/awt/peer/EmbeddedWindowPeer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* EmbeddedWindowPeer.java -- Interface for window peers that may be
- embedded into other applications
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer;
-
-import java.awt.peer.FramePeer;
-
-public interface EmbeddedWindowPeer extends FramePeer
-{
- void embed (long handle);
-}
diff --git a/libjava/gnu/java/awt/peer/GLightweightPeer.java b/libjava/gnu/java/awt/peer/GLightweightPeer.java
deleted file mode 100644
index 3bcaebcea62..00000000000
--- a/libjava/gnu/java/awt/peer/GLightweightPeer.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/* GLightweightPeer.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer;
-
-import java.awt.AWTEvent;
-import java.awt.AWTException;
-import java.awt.BufferCapabilities;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.GraphicsConfiguration;
-import java.awt.Image;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Toolkit;
-import java.awt.event.PaintEvent;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.image.VolatileImage;
-import java.awt.peer.ContainerPeer;
-import java.awt.peer.LightweightPeer;
-
-/*
- * Another possible implementation strategy for lightweight peers is
- * to make GLightweightPeer a placeholder class that implements
- * LightweightPeer. Then the Component and Container classes could
- * identify a peer as lightweight and handle it specially. The
- * current approach is probably more clear but less efficient.
- */
-
-/**
- * A stub class that implements the ComponentPeer and ContainerPeer
- * interfaces using callbacks into the Component and Container
- * classes. GLightweightPeer allows the Component and Container
- * classes to treat lightweight and heavyweight peers in the same way.
- *
- * Lightweight components are painted directly onto their parent
- * containers through an Image object provided by the toolkit.
- */
-public class GLightweightPeer
- implements LightweightPeer, ContainerPeer
-{
- private Component comp;
-
- private Insets containerInsets;
-
- public GLightweightPeer(Component comp)
- {
- this.comp = comp;
- }
-
- // -------- java.awt.peer.ContainerPeer implementation:
-
- public Insets insets()
- {
- return getInsets ();
- }
-
- public Insets getInsets()
- {
- if (containerInsets == null)
- containerInsets = new Insets (0,0,0,0);
- return containerInsets;
- }
-
- public void beginValidate()
- {
- }
-
- public void endValidate()
- {
- }
-
- public void beginLayout()
- {
- }
-
- public void endLayout()
- {
- }
-
- public boolean isPaintPending()
- {
- return false;
- }
-
- // -------- java.awt.peer.ComponentPeer implementation:
-
- public int checkImage(Image img, int width, int height, ImageObserver o)
- {
- return comp.getToolkit().checkImage(img, width, height, o);
- }
-
- public Image createImage(ImageProducer prod)
- {
- return comp.getToolkit().createImage(prod);
- }
-
- /* This method is not called. */
- public Image createImage(int width, int height)
- {
- return null;
- }
-
- public void disable() {}
-
- public void dispose() {}
-
- public void enable() {}
-
- public GraphicsConfiguration getGraphicsConfiguration()
- {
- return null;
- }
-
- public FontMetrics getFontMetrics(Font f)
- {
- return comp.getToolkit().getFontMetrics(f);
- }
-
- /* Returning null here tells the Component object that called us to
- * use its parent's Graphics. */
- public Graphics getGraphics()
- {
- return null;
- }
-
- public Point getLocationOnScreen()
- {
- Point parentLocation = comp.getParent().getLocationOnScreen();
- return new Point (parentLocation.x + comp.getX(),
- parentLocation.y + comp.getY());
- }
-
- public Dimension getMinimumSize()
- {
- return new Dimension(comp.getWidth(), comp.getHeight());
- }
-
- /* A lightweight component's preferred size is equivalent to its
- * Component width and height values. */
- public Dimension getPreferredSize()
- {
- return new Dimension(comp.getWidth(), comp.getHeight());
- }
-
- /* Returning null here tells the Component object that called us to
- * use its parent's Toolkit. */
- public Toolkit getToolkit()
- {
- return null;
- }
-
- public void handleEvent(AWTEvent e) {}
-
- public void hide() {}
-
- public boolean isFocusable()
- {
- return false;
- }
-
- public boolean isFocusTraversable()
- {
- return false;
- }
-
- public Dimension minimumSize()
- {
- return getMinimumSize();
- }
-
- public Dimension preferredSize()
- {
- return getPreferredSize();
- }
-
- public void paint(Graphics graphics) {}
-
- public boolean prepareImage(Image img, int width, int height,
- ImageObserver o)
- {
- return comp.getToolkit().prepareImage(img, width, height, o);
- }
-
- public void print(Graphics graphics) {}
-
- public void repaint(long tm, int x, int y, int width, int height) {}
-
- public void requestFocus() {}
-
- public boolean requestFocus(Component source, boolean bool1, boolean bool2, long x)
- {
- return false;
- }
-
- public void reshape(int x, int y, int width, int height) {}
-
- public void setBackground(Color color) {}
-
- public void setBounds(int x, int y, int width, int height) {}
-
- public void setCursor(Cursor cursor) {}
-
- public void setEnabled(boolean enabled) {}
-
- public void setEventMask(long eventMask) {}
-
- public void setFont(Font font) {}
-
- public void setForeground(Color color) {}
-
- public void setVisible(boolean visible) {}
-
- public void show() {}
-
- public ColorModel getColorModel ()
- {
- return comp.getColorModel ();
- }
-
- public boolean isObscured()
- {
- return false;
- }
-
- public boolean canDetermineObscurity()
- {
- return false;
- }
-
- public void coalescePaintEvent(PaintEvent e) { }
-
- public void updateCursorImmediately() { }
-
- public VolatileImage createVolatileImage(int width, int height)
- {
- return null;
- }
-
- public boolean handlesWheelScrolling()
- {
- return false;
- }
-
- public void createBuffers(int x, BufferCapabilities capabilities)
- throws AWTException { }
-
- public Image getBackBuffer()
- {
- return null;
- }
-
- public void flip(BufferCapabilities.FlipContents contents) { }
-
- public void destroyBuffers() { }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GThreadMutex.java b/libjava/gnu/java/awt/peer/gtk/GThreadMutex.java
deleted file mode 100644
index e73df9e5509..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GThreadMutex.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* GThreadMutex.java -- Implements a mutex object for glib's gthread
- abstraction, for use with GNU Classpath's --portable-native-sync option.
- This is used in gthread-jni.c
-
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.awt.peer.gtk;
-
-/** Implements a mutex object for glib's gthread
- abstraction, for use with GNU Classpath's --portable-native-sync option.
- This is used in gthread-jni.c.
-
- We use this object to implement the POSIX semantics for Mutexes. They are
- needed are needed for the function vector that is passed to glib's
- g_thread subpackage's initialization function.
-
- The GThreadMutex object itself serves as the Real Lock; if code has
- entered the monitor for this GThreadMutex object (in Java language, if
- it's synchronized on this object) then it holds the lock that this object
- represents.
-
- @author Steven Augart
- May, 2004
-
-
-*/
-
-class GThreadMutex
-{
- /** Might "lock" be locked? Is anyone waiting
- to get that lock? How long is the queue?
-
- If zero, nobody holds a lock on this GThreadMutex object, and nobody is
- trying to get one. Before someone attempts to acquire a lock on this
- object, they must increment potentialLockers. After they release their
- lock on this object, they must decrement potentialLockers.
-
- Access to this field is guarded by synchronizing on the object
- lockForPotentialLockers
.
-
- After construction, we only access this field via JNI.
- */
- volatile int potentialLockers;
-
- /** An object to synchronize to if you want to examine or modify the
- potentialLockers
field. Only hold this lock for brief
- moments, just long enough to check or set the value of
- lockForPotentialLockers
.
-
- We use this representation so that g_thread_mutex_trylock() will work
- with the POSIX semantics. This is the only case in which you ever hold a
- lock on lockForPotentialLockers
while trying to get another
- lock -- if you are the mutex_trylock() implementation, and you have just
- checked that potentialLockers
has the value zero. In that
- case, mutex_trylock() holds the lock on lockForPotentialLockers so that
- another thread calling mutex_trylock() or mutex_lock() won't increment
- potentialLockers after we've checked it and before we've gained the lock
- on the POSIX mutex. Of course, in that case the operation of gaining
- the POSIX lock itself will succeed immediately, and once it has
- succeeded, trylock releases lockForPotentialLockers right away,
- incremented to 1 (one).
-
- After construction, we only access this field via JNI.
- */
- Object lockForPotentialLockers;
-
- GThreadMutex()
- {
- potentialLockers = 0;
- lockForPotentialLockers = new Object();
- }
-}
-// Local Variables:
-// c-file-style: "gnu"
-// End:
diff --git a/libjava/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java b/libjava/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java
deleted file mode 100644
index 9a1b8e3a30a..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/* GThreadNativeMethodRunner.java -- Implements pthread_create(), under
- glib's gthread abstraction, for use with GNU Classpath's
- --portable-native-sync option.
- This is used by gthread-jni.c
-
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.awt.peer.gtk;
-
-import java.lang.ref.WeakReference;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/** Implements pthread_create(), under glib's gthread abstraction, for use
- with GNU Classpath's --portable-native-sync option. This is used in
- gthread-jni.c
-
- Also implements a registry for threads, mapping Thread objects to small
- integers. The registry uses weak references for threads that aren't
- joinable, so that they will be garbage collected.
-
- There are a number of possible alternative implementations.
-
-
- The rest of this comment consists of an answer to a question that was
- raised on the commit-classpath mailing list:
-
- Mark Wielaard wrote:
-
- > Can't we assume that jobject and gpointer are both (void *) so we don't
- > need the int <-> Thread (global jobject ref) mapping?
- > Maybe there are platforms where jobject and gpointer aren't the same,
- > but I guess that is pretty unlikely.
-
-
- I agree with you on the pointer size issues. A gpointer is a void *, so
- it's certainly guaranteed to be at least as large as any other
- pointer. And a jobject is implicitly an opaque pointer (in Jikes RVM, we
- use small integers, but we coerce them into the representation of a
- pointer).
-
- The int <==> Thread mapping addresses a different issue. I realize that I
- did not document this properly (two and a half lines in thread_create),
- and the point is subtle (at least to me; took me a while to figure out).
-
- The int => Thread mapping always returns jobjects that are local
- references, not global ones. This is because Thread objects need to be
- able to go away and be garbage collected after the thread they refer to
- has died.
-
- If we keep a global object reference to a thread, then when do we delete
- that global object reference? We have an answer in the case of GThread
- objects that were explicitly created with the joinable attribute. It is
- safe for us to maintain a global reference to any joinable thread, since
- the joinable thread must linger (even if only in a zombie state)
- until it's explicitly joined via a g_thread_join() call. The global ref
- could be cleaned up at that point too.
-
- However, in the case of GThreads that were created non-joinable by
- g_thread_create(), and in the case of Java threads that were created
- within pure Java code (not via g_thread_create()), we don't want them to
- linger forever, and there is no way to tell when the last reference
- to such threads needs to expire. In the case of this application -- AWT
- with GTK peers -- it would probably be safe anyway, since there are not
- very many threads we create, but I was going for correctness even in the
- case of long-running programs that might set up and tear down AWT
- interfaces many times.
-
- So, I duplicated the POSIX thread-ID semantics. The thread ID of a
- non-joinable thread remains valid as long as that thread is still alive.
- Once that thread dies, the old thread ID may be reused at any moment. And
- that's why the array indexed by thread ID numbers is an array of weak
- references.
-
- That's also why the int => Thread jobject mapping function always returns
- local references, since global references would lock the Thread in memory
- forever.
-
- I would dearly love there to be a cleaner solution. I dislike the
- repeated dips from C code into Java that are necessary to look up thread
- ID numbers. If anyone can think of one, I'm all ears.
-*/
-
-class GThreadNativeMethodRunner
- extends Thread
-{
- /** The C function pointer that was passed to g_thread_create().
- Specifically, this the numeric address of an object of
- C type "void *(*funcPtr)(void *funcArg)".
- */
- private final long funcPtr;
-
- /** The argument for the function "funcPtr(funcArg)". */
- private final long funcArg;
-
- GThreadNativeMethodRunner(long funcPtr, long funcArg, boolean joinable)
- {
- this.funcPtr = funcPtr;
- this.funcArg = funcArg;
-
- if (joinable)
- registerSelfJoinable();
- }
-
- public void run()
- {
- nativeRun(funcPtr, funcArg);
- }
-
- private native void nativeRun(long funcPtr, long funcArg);
-
- /** THREADS is an array of threads, indexed by thread ID codes. Not sure
- whether this is the "best" approach but it does make it O(1) to look up a
- thread by its ID.
-
- Zero is a valid thread ID code. Any negative number is invalid.
-
- Possible future fixes (TODO?)
-
- - The THREADS array will only grow. probably not a problem.
- But we could keep count when nulling entries and shrink when we have
- lots of nulls at the end. Probably not worth it. --mjw
-
- - Could make this a set of Object; see the comment on "joinable" below.
-
- The initial size of 17 is just a starting point. Any number will do,
- including zero.
- */
- private static WeakReference[] threads = new WeakReference[17];
-
- /** Used by threadToThreadID, below. Returns the registration number of
- the newly-registered thread.
- */
- private static synchronized int registerThread(Thread t)
- {
- int i;
-
- for (i = 0; i < threads.length; ++i)
- {
- WeakReference ref = threads[i];
- if (ref == null)
- break; // found an empty spot.
- }
-
- if (i == threads.length)
- {
- /* expand the array */
- WeakReference[] bigger = new WeakReference[threads.length * 2];
- System.arraycopy(threads, 0, bigger, 0, threads.length);
- threads = bigger;
- }
-
- threads[i] = new WeakReference(t);
-
- return i;
- }
-
- /** Look up the Thread ID # for a Thread. Assign a Thread ID # if none
- exists. This is a general routine for handling all threads, including
- the VM's main thread, if appropriate.
-
-
- Runs in O(n/2) time.
-
- We can't just issue a threadID upon thread creation. If we were to do
- that, not all threads would have a threadID, because not all threads
- are launched by GThreadNativeMethodRunner.
- */
- static synchronized int threadToThreadID(Thread t)
- {
- for (int i = 0; i < threads.length; ++i )
- {
- if (threads[i] == null)
- continue;
- Thread referent = (Thread) threads[i].get();
- if (referent == null)
- {
- threads[i] = null; // Purge the dead WeakReference.
- continue;
- }
- if (referent.equals(t))
- return i;
- } // for()
-
- /* No match found. */
- return registerThread(t);
- }
-
- /** @param threadID Must be a non-negative integer.
-
- Used to return null if the thread number was out of range or if
- the thread was unregistered. Now we throw an exception.
-
- Possible Alternative Interface: We could go back to returning null in
- some sort of check-free mode, so code that calls this function must
- be prepared to get null.
- */
- static Thread threadIDToThread(int threadID)
- throws IllegalArgumentException
- {
- if (threadID < 0)
- throw new IllegalArgumentException("Received a negative threadID, "
- + threadID);
- if (threadID >= threads.length)
- throw new IllegalArgumentException("Received a threadID (" + threadID
- + ") higher than was"
- + " ever issued");
-
- /* Note: if the user is using a stale reference, things will just
- break. We might end up getting a different thread than the one
- expected.
-
- TODO: Add an error-checking mode where the user's problems with threads
- are announced. For instance, if the user asks for the thread
- associated with a threadID that was never issued, we could print a
- warning or even abort.
-
- TODO: Consider optionally disabling all of the error-checking we
- already have; it probably slows down the implementation. We could
- just return NULL. This is just the reverse of the above TODO item.
- */
-
- WeakReference threadRef = threads[threadID];
-
- if (threadRef == null)
- throw new IllegalArgumentException("Asked to look up a stale or unissued"
- + "threadID (" + threadID + ")" );
-
-
- Thread referent = (Thread) threadRef.get();
- if (referent == null)
- throw new IllegalArgumentException ("Asked to look up a stale threadID ("
- + threadID + ")");
- return referent;
- }
-
- /** Joinable threads need a hard reference, so that they won't go away when
- they die. That is because their thread IDs need to stay valid until the
- thread is joined via thread_join(threadID). Joinable threads have to be
- explicitly joined before they are allowed to go away completely.
-
- Possible Alternative Implementation: Eliminate the Joinable set. When
- calling getThreadIDFromThread() you know whether or not the thread
- is joinable. So just store the Thread itself in the threads array?
- Make that array an Object array and check with instanceof. This
- looks cleaner and more robust to me and it saves a native -> Java
- call. But instanceof might be expensive. --mjw
- */
- private static final Set joinable =
- Collections.synchronizedSet(new HashSet());
-
- /** Only called from the constructor. */
- private void registerSelfJoinable()
- {
- joinable.add(this);
- }
-
- /** This method is only called from JNI, and only after we have succeeded in
- a thread_join() operation. */
- static void deRegisterJoinable(Thread thread)
- {
- joinable.remove(thread);
- }
-}
-
-// Local Variables:
-// c-file-style: "gnu"
-// End:
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java b/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
deleted file mode 100644
index 7a439e83a9d..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* GdkFontMetrics.java
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.java.awt.ClasspathToolkit;
-
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Toolkit;
-
-public class GdkFontMetrics extends FontMetrics
-{
-
- private int[] font_metrics;
- GdkFontPeer peer;
-
- static final int FONT_METRICS_ASCENT = 0;
- static final int FONT_METRICS_MAX_ASCENT = 1;
- static final int FONT_METRICS_DESCENT = 2;
- static final int FONT_METRICS_MAX_DESCENT = 3;
- static final int FONT_METRICS_MAX_ADVANCE = 4;
-
- static final int TEXT_METRICS_X_BEARING = 0;
- static final int TEXT_METRICS_Y_BEARING = 1;
- static final int TEXT_METRICS_WIDTH = 2;
- static final int TEXT_METRICS_HEIGHT = 3;
- static final int TEXT_METRICS_X_ADVANCE = 4;
- static final int TEXT_METRICS_Y_ADVANCE = 5;
-
-
- public GdkFontMetrics (Font font)
- {
- super (font.getPeer() instanceof GdkFontPeer
- ? font
- : ((ClasspathToolkit)(Toolkit.getDefaultToolkit ()))
- .getFont (font.getName(), font.getAttributes ()));
-
- peer = (GdkFontPeer) this.font.getPeer();
-
- font_metrics = new int[5];
- double [] hires = new double[5];
- peer.getFontMetrics (hires);
- for (int i = 0; i < 5; ++i)
- font_metrics[i] = (int) hires[i];
- }
-
- public int stringWidth (String str)
- {
- double [] hires = new double[6];
- peer.getTextMetrics(str, hires);
- return (int) hires [TEXT_METRICS_WIDTH];
- }
-
- public int charWidth (char ch)
- {
- return stringWidth (new String (new char[] { ch }));
- }
-
- public int charsWidth (char data[], int off, int len)
- {
- return stringWidth (new String (data, off, len));
- }
-
- /*
- Sun's Motif implementation always returns 0 or 1 here (???), but
- going by the X11 man pages, it seems as though we should return
- font.ascent + font.descent.
- */
- public int getLeading ()
- {
- return 1;
- }
-
- public int getAscent ()
- {
- return font_metrics[FONT_METRICS_ASCENT];
- }
-
- public int getMaxAscent ()
- {
- return font_metrics[FONT_METRICS_MAX_ASCENT];
- }
-
- public int getDescent ()
- {
- return font_metrics[FONT_METRICS_DESCENT];
- }
-
- public int getMaxDescent ()
- {
- return font_metrics[FONT_METRICS_MAX_DESCENT];
- }
-
- public int getMaxAdvance ()
- {
- return font_metrics[FONT_METRICS_MAX_ADVANCE];
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GdkFontPeer.java
deleted file mode 100644
index c6d42b37276..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkFontPeer.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/* GdkFontPeer.java -- Implements FontPeer with GTK+
- Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.classpath.Configuration;
-import gnu.java.awt.peer.ClasspathFontPeer;
-
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphVector;
-import java.awt.font.LineMetrics;
-import java.awt.geom.Rectangle2D;
-import java.text.CharacterIterator;
-import java.text.StringCharacterIterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-public class GdkFontPeer extends ClasspathFontPeer
-{
- static native void initStaticState();
- private final int native_state = GtkGenericPeer.getUniqueInteger ();
- private static ResourceBundle bundle;
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
-
- initStaticState ();
-
- try
- {
- bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font");
- }
- catch (Throwable ignored)
- {
- bundle = null;
- }
- }
-
- private native void initState ();
- private native void dispose ();
- private native void setFont (String family, int style, int size, boolean useGraphics2D);
-
- native void getFontMetrics(double [] metrics);
- native void getTextMetrics(String str, double [] metrics);
-
- protected void finalize ()
- {
- if (GtkToolkit.useGraphics2D ())
- GdkGraphics2D.releasePeerGraphicsResource(this);
- dispose ();
- }
-
- /*
- * Helpers for the 3-way overloading that this class seems to suffer
- * from. Remove them if you feel like they're a performance bottleneck,
- * for the time being I prefer my code not be written and debugged in
- * triplicate.
- */
-
- private String buildString(CharacterIterator iter)
- {
- StringBuffer sb = new StringBuffer();
- for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next())
- sb.append(c);
- return sb.toString();
- }
-
- private String buildString(CharacterIterator iter, int begin, int limit)
- {
- StringBuffer sb = new StringBuffer();
- int i = 0;
- for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next(), i++)
- {
- if (begin <= i)
- sb.append(c);
- if (limit <= i)
- break;
- }
- return sb.toString();
- }
-
- private String buildString(char[] chars, int begin, int limit)
- {
- return new String(chars, begin, limit - begin);
- }
-
- /* Public API */
-
- public GdkFontPeer (String name, int style)
- {
- // All fonts get a default size of 12 if size is not specified.
- this(name, style, 12);
- }
-
- public GdkFontPeer (String name, int style, int size)
- {
- super(name, style, size);
- initState ();
- setFont (this.familyName, this.style, (int)this.size,
- GtkToolkit.useGraphics2D());
- }
-
- public GdkFontPeer (String name, Map attributes)
- {
- super(name, attributes);
- initState ();
- setFont (this.familyName, this.style, (int)this.size,
- GtkToolkit.useGraphics2D());
- }
-
- public String getSubFamilyName(Font font, Locale locale)
- {
- return null;
- }
-
- public String getPostScriptName(Font font)
- {
- return null;
- }
-
- public boolean canDisplay (Font font, char c)
- {
- // FIXME: inquire with pango
- return true;
- }
-
- public int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit)
- {
- // FIXME: inquire with pango
- return -1;
- }
-
- private native GdkGlyphVector getGlyphVector(String txt,
- Font f,
- FontRenderContext ctx);
-
- public GlyphVector createGlyphVector (Font font,
- FontRenderContext ctx,
- CharacterIterator i)
- {
- return getGlyphVector(buildString (i), font, ctx);
- }
-
- public GlyphVector createGlyphVector (Font font,
- FontRenderContext ctx,
- int[] glyphCodes)
- {
- return null;
- // return new GdkGlyphVector (font, this, ctx, glyphCodes);
- }
-
- public byte getBaselineFor (Font font, char c)
- {
- throw new UnsupportedOperationException ();
- }
-
- protected class GdkFontLineMetrics extends LineMetrics
- {
- FontMetrics fm;
- int nchars;
-
- public GdkFontLineMetrics (FontMetrics m, int n)
- {
- fm = m;
- nchars = n;
- }
-
- public float getAscent()
- {
- return (float) fm.getAscent ();
- }
-
- public int getBaselineIndex()
- {
- return Font.ROMAN_BASELINE;
- }
-
- public float[] getBaselineOffsets()
- {
- return new float[3];
- }
-
- public float getDescent()
- {
- return (float) fm.getDescent ();
- }
-
- public float getHeight()
- {
- return (float) fm.getHeight ();
- }
-
- public float getLeading() { return 0.f; }
- public int getNumChars() { return nchars; }
- public float getStrikethroughOffset() { return 0.f; }
- public float getStrikethroughThickness() { return 0.f; }
- public float getUnderlineOffset() { return 0.f; }
- public float getUnderlineThickness() { return 0.f; }
-
- }
-
- public LineMetrics getLineMetrics (Font font, CharacterIterator ci,
- int begin, int limit, FontRenderContext rc)
- {
- return new GdkFontLineMetrics (getFontMetrics (font), limit - begin);
- }
-
- public Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc)
- {
- throw new UnsupportedOperationException ();
- }
-
- public int getMissingGlyphCode (Font font)
- {
- throw new UnsupportedOperationException ();
- }
-
- public String getGlyphName (Font font, int glyphIndex)
- {
- throw new UnsupportedOperationException ();
- }
-
- public int getNumGlyphs (Font font)
- {
- throw new UnsupportedOperationException ();
- }
-
- public Rectangle2D getStringBounds (Font font, CharacterIterator ci,
- int begin, int limit, FontRenderContext frc)
- {
- GdkGlyphVector gv = getGlyphVector(buildString (ci, begin, limit), font, frc);
- return gv.getVisualBounds();
- }
-
- public boolean hasUniformLineMetrics (Font font)
- {
- return true;
- }
-
- public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc,
- char[] chars, int start, int limit,
- int flags)
- {
- int nchars = (limit - start) + 1;
- char[] nc = new char[nchars];
-
- for (int i = 0; i < nchars; ++i)
- nc[i] = chars[start + i];
-
- return createGlyphVector (font, frc,
- new StringCharacterIterator (new String (nc)));
- }
-
- public LineMetrics getLineMetrics (Font font, String str,
- FontRenderContext frc)
- {
- return new GdkFontLineMetrics (getFontMetrics (font), str.length ());
- }
-
- public FontMetrics getFontMetrics (Font font)
- {
- return new GdkFontMetrics (font);
- }
-
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java b/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
deleted file mode 100644
index f0ddea43a12..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/* GdkGlyphVector.java -- Glyph vector object
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Font;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphJustificationInfo;
-import java.awt.font.GlyphMetrics;
-import java.awt.font.GlyphVector;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-public class GdkGlyphVector extends GlyphVector
-{
-
- /* We use a simple representation for glyph vectors here. Glyph i
- * consumes 8 doubles:
- *
- * logical x: extents[ 10*i ]
- * logical y: extents[ 10*i + 1 ]
- * logical width: extents[ 10*i + 2 ]
- * logical height: extents[ 10*i + 3 ]
- *
- * visual x: extents[ 10*i + 4 ]
- * visual y: extents[ 10*i + 5 ]
- * visual width: extents[ 10*i + 6 ]
- * visual height: extents[ 10*i + 7 ]
- *
- * origin pos x: extents[ 10*i + 8 ]
- * origin pos y: extents[ 10*i + 9 ]
- *
- * as well as one int, code[i], representing the glyph code in the font.
- */
-
- double [] extents;
- int [] codes;
-
- Font font;
- FontRenderContext fontRenderContext;
-
- Rectangle2D allLogical;
- Rectangle2D allVisual;
-
- public GdkGlyphVector(double[] extents, int[] codes, Font font, FontRenderContext frc)
- {
- this.extents = extents;
- this.codes = codes;
- this.font = font;
- this.fontRenderContext = frc;
-
- allLogical = new Rectangle2D.Double();
- allVisual = new Rectangle2D.Double();
-
- for (int i = 0; i < codes.length; ++i)
- {
- allLogical.add (new Rectangle2D.Double(extents[10*i ] + extents[10*i + 8],
- extents[10*i + 1] + extents[10*i + 9],
- extents[10*i + 2],
- extents[10*i + 3]));
-
- allVisual.add (new Rectangle2D.Double(extents[10*i + 4] + extents[10*i + 8],
- extents[10*i + 5] + extents[10*i + 9],
- extents[10*i + 6],
- extents[10*i + 7]));
- }
- }
-
- /*
- geometric notes:
-
- the FRC contains a mapping from points -> pixels.
-
- typographics points are typically 1/72 of an inch.
-
- pixel displays are often around 72 dpi.
-
- so the FRC can get away with using an identity transform on a screen,
- often. behavior is documented by sun to fall back to an identity
- transform if the internal transformation is null.
-
- coordinates coming up from pango are expressed as floats -- in device
- space, so basically pixels-with-fractional-bits -- derived from their
- storage format in pango (1024ths of pixels).
-
- it is not clear from the javadocs whether the results of methods like
- getGlyphPositions ought to return coordinates in device space, or
- "point" space, or what. for now I'm returning them in device space.
-
- */
-
- public double[] getExtents()
- {
- return extents;
- }
-
- public int[] getCodes()
- {
- return codes;
- }
-
- public Font getFont ()
- {
- return font;
- }
-
- public FontRenderContext getFontRenderContext ()
- {
- return fontRenderContext;
- }
-
- public int getGlyphCharIndex (int glyphIndex)
- {
- // FIXME: currently pango does not provide glyph-by-glyph
- // reverse mapping information, so we assume a broken 1:1
- // glyph model here. This is plainly wrong.
- return glyphIndex;
- }
-
- public int[] getGlyphCharIndices (int beginGlyphIndex,
- int numEntries,
- int[] codeReturn)
- {
- int ix[] = codeReturn;
- if (ix == null)
- ix = new int[numEntries];
-
- for (int i = 0; i < numEntries; i++)
- ix[i] = getGlyphCharIndex (beginGlyphIndex + i);
- return ix;
- }
-
- public int getGlyphCode (int glyphIndex)
- {
- return codes[glyphIndex];
- }
-
- public int[] getGlyphCodes (int beginGlyphIndex, int numEntries,
- int[] codeReturn)
- {
- if (codeReturn == null)
- codeReturn = new int[numEntries];
-
- System.arraycopy(codes, beginGlyphIndex, codeReturn, 0, numEntries);
- return codeReturn;
- }
-
- public Shape getGlyphLogicalBounds (int i)
- {
- return new Rectangle2D.Double (extents[8*i], extents[8*i + 1],
- extents[8*i + 2], extents[8*i + 3]);
- }
-
- public GlyphMetrics getGlyphMetrics (int i)
- {
- // FIXME: pango does not yield vertical layout information at the
- // moment.
-
- boolean is_horizontal = true;
- double advanceX = extents[8*i + 2]; // "logical width" == advanceX
- double advanceY = 0;
-
- return new GlyphMetrics (is_horizontal,
- (float) advanceX, (float) advanceY,
- (Rectangle2D) getGlyphVisualBounds(i),
- GlyphMetrics.STANDARD);
- }
-
- public Shape getGlyphOutline (int glyphIndex)
- {
- throw new UnsupportedOperationException ();
- }
-
- public Shape getGlyphOutline (int glyphIndex, float x, float y)
- {
- throw new UnsupportedOperationException ();
- }
-
- public Rectangle getGlyphPixelBounds (int i,
- FontRenderContext renderFRC,
- float x, float y)
- {
- return new Rectangle((int) x, (int) y,
- (int) extents[8*i + 6], (int) extents[8*i + 7]);
- }
-
- public Point2D getGlyphPosition (int i)
- {
- return new Point2D.Double (extents[10*i + 8],
- extents[10*i + 9]);
- }
-
- public float[] getGlyphPositions (int beginGlyphIndex,
- int numEntries,
- float[] positionReturn)
- {
- float fx[] = positionReturn;
- if (fx == null)
- fx = new float[numEntries * 2];
-
- for (int i = 0; i < numEntries; ++i)
- {
- fx[2*i ] = (float) extents[10*i + 8];
- fx[2*i + 1] = (float) extents[10*i + 9];
- }
- return fx;
- }
-
- public AffineTransform getGlyphTransform (int glyphIndex)
- {
- // Glyphs don't have independent transforms in these simple glyph
- // vectors; docs specify null is an ok return here.
- return null;
- }
-
- public Shape getGlyphVisualBounds (int i)
- {
- return new Rectangle2D.Double(extents[8*i + 4], extents[8*i + 5],
- extents[8*i + 6], extents[8*i + 7]);
- }
-
- public int getLayoutFlags ()
- {
- return 0;
- }
-
- public Rectangle2D getLogicalBounds ()
- {
- return allLogical;
- }
-
- public int getNumGlyphs ()
- {
- return codes.length;
- }
-
- public Shape getOutline ()
- {
- throw new UnsupportedOperationException ();
- }
-
- public Rectangle getPixelBounds (FontRenderContext renderFRC,
- float x, float y)
- {
- return new Rectangle((int)x,
- (int)y,
- (int) allVisual.getWidth(),
- (int) allVisual.getHeight());
- }
-
- public Rectangle2D getVisualBounds ()
- {
- return allVisual;
- }
-
- public void performDefaultLayout ()
- {
- }
-
- public void setGlyphPosition (int i, Point2D newPos)
- {
- extents[8*i ] = newPos.getX();
- extents[8*i + 1] = newPos.getY();
-
- extents[8*i + 4] = newPos.getX();
- extents[8*i + 5] = newPos.getY();
- }
-
- public void setGlyphTransform (int glyphIndex,
- AffineTransform newTX)
- {
- // not yet.. maybe not ever?
- throw new UnsupportedOperationException ();
- }
-
- public boolean equals(GlyphVector gv)
- {
- if (gv == null)
- return false;
-
- if (! (gv instanceof GdkGlyphVector))
- return false;
-
- GdkGlyphVector ggv = (GdkGlyphVector) gv;
-
- if ((ggv.codes.length != this.codes.length)
- || (ggv.extents.length != this.extents.length))
- return false;
-
- if ((ggv.font == null && this.font != null)
- || (ggv.font != null && this.font == null)
- || (!ggv.font.equals(this.font)))
- return false;
-
- if ((ggv.fontRenderContext == null && this.fontRenderContext != null)
- || (ggv.fontRenderContext != null && this.fontRenderContext == null)
- || (!ggv.fontRenderContext.equals(this.fontRenderContext)))
- return false;
-
- for (int i = 0; i < ggv.codes.length; ++i)
- if (ggv.codes[i] != this.codes[i])
- return false;
-
- for (int i = 0; i < ggv.extents.length; ++i)
- if (ggv.extents[i] != this.extents[i])
- return false;
-
- return true;
- }
-
- public GlyphJustificationInfo getGlyphJustificationInfo(int idx)
- {
- throw new UnsupportedOperationException ();
- }
-
- public Shape getOutline(float x, float y)
- {
- throw new UnsupportedOperationException ();
- }
-
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
deleted file mode 100644
index cc3a1009d86..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
+++ /dev/null
@@ -1,487 +0,0 @@
-/* GdkGraphics.java
- Copyright (C) 1998, 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.awt.SystemColor;
-import java.awt.image.ImageObserver;
-import java.text.AttributedCharacterIterator;
-
-public class GdkGraphics extends Graphics
-{
- private final int native_state = GtkGenericPeer.getUniqueInteger();
-
- Color color, xorColor;
- GtkComponentPeer component;
- Font font;
- Rectangle clip;
-
- int xOffset = 0;
- int yOffset = 0;
-
- static final int GDK_COPY = 0, GDK_XOR = 2;
-
- native void initState (GtkComponentPeer component);
- native void initState (int width, int height);
- native void copyState (GdkGraphics g);
-
- GdkGraphics (GdkGraphics g)
- {
- color = g.color;
- xorColor = g.xorColor;
- font = g.font;
- clip = new Rectangle (g.clip);
- component = g.component;
-
- copyState (g);
- }
-
- GdkGraphics (int width, int height)
- {
- initState (width, height);
- color = Color.black;
- clip = new Rectangle (0, 0, width, height);
- font = new Font ("Dialog", Font.PLAIN, 12);
- }
-
- GdkGraphics (GtkComponentPeer component)
- {
- this.component = component;
- font = component.awtComponent.getFont ();
-
- if (component.isRealized ())
- initComponentGraphics ();
- else
- connectSignals (component);
- }
-
- void initComponentGraphics ()
- {
- initState (component);
- color = component.awtComponent.getForeground ();
- Dimension d = component.awtComponent.getSize ();
- clip = new Rectangle (0, 0, d.width, d.height);
- }
-
- native void connectSignals (GtkComponentPeer component);
-
- public native void clearRect(int x, int y, int width, int height);
-
- public void clipRect (int x, int y, int width, int height)
- {
- if (component != null && ! component.isRealized ())
- return;
-
- clip = clip.intersection (new Rectangle (x, y, width, height));
- setClipRectangle (clip.x, clip.y, clip.width, clip.height);
- }
-
- public native void copyArea(int x, int y, int width, int height,
- int dx, int dy);
-
- public Graphics create ()
- {
- return new GdkGraphics (this);
- }
-
- public native void dispose();
-
- native void copyPixmap (Graphics g, int x, int y, int width, int height);
- native void copyAndScalePixmap (Graphics g, boolean flip_x, boolean flip_y,
- int src_x, int src_y,
- int src_width, int src_height,
- int dest_x, int dest_y,
- int dest_width, int dest_height);
- public boolean drawImage (Image img, int x, int y,
- Color bgcolor, ImageObserver observer)
- {
- if (component != null && ! component.isRealized ())
- return false;
-
- if (img instanceof GtkOffScreenImage)
- {
- int width = img.getWidth (null);
- int height = img.getHeight (null);
- copyPixmap (img.getGraphics (),
- x, y, width, height);
- return true;
- }
-
- GtkImage image = (GtkImage) img;
- new GtkImagePainter (image, this, x, y, -1, -1, bgcolor, observer);
- return image.isLoaded ();
- }
-
- public boolean drawImage (Image img, int x, int y, ImageObserver observer)
- {
- if (component != null && ! component.isRealized ())
- return false;
-
- if (img instanceof GtkOffScreenImage)
- {
- int width = img.getWidth (null);
- int height = img.getHeight (null);
- copyPixmap (img.getGraphics (),
- x, y, width, height);
- return true;
- }
-
- if (component != null)
- return drawImage (img, x, y, component.getBackground (), observer);
- else
- return drawImage (img, x, y, SystemColor.window, observer);
- }
-
- public boolean drawImage (Image img, int x, int y, int width, int height,
- Color bgcolor, ImageObserver observer)
- {
- if (component != null && ! component.isRealized ())
- return false;
-
- if (img instanceof GtkOffScreenImage)
- {
- copyAndScalePixmap (img.getGraphics (), false, false,
- 0, 0, img.getWidth (null), img.getHeight (null),
- x, y, width, height);
- return true;
- }
-
- GtkImage image = (GtkImage) img;
- new GtkImagePainter (image, this, x, y, width, height, bgcolor, observer);
- return image.isLoaded ();
- }
-
- public boolean drawImage (Image img, int x, int y, int width, int height,
- ImageObserver observer)
- {
- if (component != null && ! component.isRealized ())
- return false;
-
- if (component != null)
- return drawImage (img, x, y, width, height, component.getBackground (),
- observer);
- else
- return drawImage (img, x, y, width, height, SystemColor.window,
- observer);
- }
-
- public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
- int sx1, int sy1, int sx2, int sy2,
- Color bgcolor, ImageObserver observer)
- {
- if (component != null && ! component.isRealized ())
- return false;
-
- if (img instanceof GtkOffScreenImage)
- {
- int dx_start, dy_start, d_width, d_height;
- int sx_start, sy_start, s_width, s_height;
- boolean x_flip = false;
- boolean y_flip = false;
-
- if (dx1 < dx2)
- {
- dx_start = dx1;
- d_width = dx2 - dx1;
- }
- else
- {
- dx_start = dx2;
- d_width = dx1 - dx2;
- x_flip ^= true;
- }
- if (dy1 < dy2)
- {
- dy_start = dy1;
- d_height = dy2 - dy1;
- }
- else
- {
- dy_start = dy2;
- d_height = dy1 - dy2;
- y_flip ^= true;
- }
- if (sx1 < sx2)
- {
- sx_start = sx1;
- s_width = sx2 - sx1;
- }
- else
- {
- sx_start = sx2;
- s_width = sx1 - sx2;
- x_flip ^= true;
- }
- if (sy1 < sy2)
- {
- sy_start = sy1;
- s_height = sy2 - sy1;
- }
- else
- {
- sy_start = sy2;
- s_height = sy1 - sy2;
- y_flip ^= true;
- }
-
- copyAndScalePixmap (img.getGraphics (), x_flip, y_flip,
- sx_start, sy_start, s_width, s_height,
- dx_start, dy_start, d_width, d_height);
- return true;
- }
-
- GtkImage image = (GtkImage) img;
- new GtkImagePainter (image, this, dx1, dy1, dx2, dy2,
- sx1, sy1, sx2, sy2, bgcolor, observer);
- return image.isLoaded ();
- }
-
- public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
- int sx1, int sy1, int sx2, int sy2,
- ImageObserver observer)
- {
- if (component != null && ! component.isRealized ())
- return false;
-
- if (component != null)
- return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
- component.getBackground (), observer);
- else
- return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
- SystemColor.window, observer);
- }
-
- public native void drawLine(int x1, int y1, int x2, int y2);
-
- public native void drawArc(int x, int y, int width, int height,
- int startAngle, int arcAngle);
- public native void fillArc(int x, int y, int width, int height,
- int startAngle, int arcAngle);
- public native void drawOval(int x, int y, int width, int height);
- public native void fillOval(int x, int y, int width, int height);
-
- public native void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
- public native void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
-
- public native void drawPolyline(int[] xPoints, int[] yPoints, int nPoints);
-
- public native void drawRect(int x, int y, int width, int height);
- public native void fillRect(int x, int y, int width, int height);
-
- GdkFontPeer getFontPeer()
- {
- return (GdkFontPeer) getFont().getPeer();
- }
-
- native void drawString (GdkFontPeer f, String str, int x, int y);
- public void drawString (String str, int x, int y)
- {
- drawString(getFontPeer(), str, x, y);
- }
-
-
- public void drawString (AttributedCharacterIterator ci, int x, int y)
- {
- throw new Error ("not implemented");
- }
-
- public void drawRoundRect(int x, int y, int width, int height,
- int arcWidth, int arcHeight)
- {
- if (arcWidth > width)
- arcWidth = width;
- if (arcHeight > height)
- arcHeight = height;
-
- int xx = x + width - arcWidth;
- int yy = y + height - arcHeight;
-
- drawArc (x, y, arcWidth, arcHeight, 90, 90);
- drawArc (xx, y, arcWidth, arcHeight, 0, 90);
- drawArc (xx, yy, arcWidth, arcHeight, 270, 90);
- drawArc (x, yy, arcWidth, arcHeight, 180, 90);
-
- int y1 = y + arcHeight / 2;
- int y2 = y + height - arcHeight / 2;
- drawLine (x, y1, x, y2);
- drawLine (x + width, y1, x + width, y2);
-
- int x1 = x + arcWidth / 2;
- int x2 = x + width - arcWidth / 2;
- drawLine (x1, y, x2, y);
- drawLine (x1, y + height, x2, y + height);
- }
-
- public void fillRoundRect (int x, int y, int width, int height,
- int arcWidth, int arcHeight)
- {
- if (arcWidth > width)
- arcWidth = width;
- if (arcHeight > height)
- arcHeight = height;
-
- int xx = x + width - arcWidth;
- int yy = y + height - arcHeight;
-
- fillArc (x, y, arcWidth, arcHeight, 90, 90);
- fillArc (xx, y, arcWidth, arcHeight, 0, 90);
- fillArc (xx, yy, arcWidth, arcHeight, 270, 90);
- fillArc (x, yy, arcWidth, arcHeight, 180, 90);
-
- fillRect (x, y + arcHeight / 2, width, height - arcHeight + 1);
- fillRect (x + arcWidth / 2, y, width - arcWidth + 1, height);
- }
-
- public Shape getClip ()
- {
- return getClipBounds ();
- }
-
- public Rectangle getClipBounds ()
- {
- if (clip == null)
- return null;
- else
- return clip.getBounds();
- }
-
- public Color getColor ()
- {
- return color;
- }
-
- public Font getFont ()
- {
- return font;
- }
-
- public FontMetrics getFontMetrics (Font font)
- {
- return new GdkFontMetrics (font);
- }
-
- native void setClipRectangle (int x, int y, int width, int height);
-
- public void setClip (int x, int y, int width, int height)
- {
- if ((component != null && ! component.isRealized ())
- || clip == null)
- return;
-
- clip.x = x;
- clip.y = y;
- clip.width = width;
- clip.height = height;
-
- setClipRectangle (x, y, width, height);
- }
-
- public void setClip (Rectangle clip)
- {
- setClip (clip.x, clip.y, clip.width, clip.height);
- }
-
- public void setClip (Shape clip)
- {
- if (clip != null)
- setClip(clip.getBounds());
- }
-
- private native void setFGColor(int red, int green, int blue);
-
- public void setColor (Color c)
- {
- if (c == null)
- color = Color.BLACK;
- else
- color = c;
-
- if (xorColor == null) /* paint mode */
- setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
- else /* xor mode */
- setFGColor (color.getRed () ^ xorColor.getRed (),
- color.getGreen () ^ xorColor.getGreen (),
- color.getBlue () ^ xorColor.getBlue ());
- }
-
- public void setFont (Font font)
- {
- this.font = font;
- }
-
- native void setFunction (int gdk_func);
-
- public void setPaintMode ()
- {
- xorColor = null;
-
- setFunction (GDK_COPY);
- setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
- }
-
- public void setXORMode (Color c)
- {
- xorColor = c;
-
- setFunction (GDK_XOR);
- setFGColor (color.getRed () ^ xorColor.getRed (),
- color.getGreen () ^ xorColor.getGreen (),
- color.getBlue () ^ xorColor.getBlue ());
- }
-
- public native void translateNative(int x, int y);
-
- public void translate (int x, int y)
- {
- if (component != null && ! component.isRealized ())
- return;
-
- clip.x -= x;
- clip.y -= y;
-
- translateNative (x, y);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java
deleted file mode 100644
index 65c4ca2a224..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java
+++ /dev/null
@@ -1,1449 +0,0 @@
-/* GdkGraphics2D.java --
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.classpath.Configuration;
-import gnu.java.awt.ClasspathToolkit;
-
-import java.awt.AlphaComposite;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Composite;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.GradientPaint;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.Image;
-import java.awt.Paint;
-import java.awt.Rectangle;
-import java.awt.RenderingHints;
-import java.awt.Shape;
-import java.awt.Stroke;
-import java.awt.TexturePaint;
-import java.awt.Toolkit;
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphVector;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Arc2D;
-import java.awt.geom.GeneralPath;
-import java.awt.geom.NoninvertibleTransformException;
-import java.awt.geom.PathIterator;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.AffineTransformOp;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-import java.awt.image.ColorModel;
-import java.awt.image.CropImageFilter;
-import java.awt.image.DataBuffer;
-import java.awt.image.DataBufferInt;
-import java.awt.image.DirectColorModel;
-import java.awt.image.FilteredImageSource;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImagingOpException;
-import java.awt.image.MultiPixelPackedSampleModel;
-import java.awt.image.Raster;
-import java.awt.image.RenderedImage;
-import java.awt.image.SampleModel;
-import java.awt.image.WritableRaster;
-import java.awt.image.renderable.RenderContext;
-import java.awt.image.renderable.RenderableImage;
-import java.text.AttributedCharacterIterator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Stack;
-
-public class GdkGraphics2D extends Graphics2D
-{
- //////////////////////////////////////
- ////// State Management Methods //////
- //////////////////////////////////////
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- System.loadLibrary("gtkpeer");
-
- if (GtkToolkit.useGraphics2D())
- initStaticState();
- }
-
- static native void initStaticState();
-
- private final int native_state = GtkGenericPeer.getUniqueInteger();
-
- // These are package-private to avoid accessor methods.
- Paint paint;
- Stroke stroke;
- Color fg;
- Color bg;
- Shape clip;
- AffineTransform transform;
- private GtkComponentPeer component;
- // This is package-private to avoid an accessor method.
- Font font;
- private RenderingHints hints;
- private BufferedImage bimage;
- private boolean pixelConversionRequired;
- private int[] pixelBuffer;
- // This is package-private to avoid an accessor method.
- Composite comp;
- private Stack stateStack;
-
- private native void initState(GtkComponentPeer component);
- private native void initState(int width, int height);
- private native void initState(int[] pixes, int width, int height);
- private native void copyState(GdkGraphics2D g);
- public native void dispose();
- private native void cairoSurfaceSetFilter(int filter);
- native void connectSignals(GtkComponentPeer component);
-
- public void finalize()
- {
- dispose();
- }
-
- public Graphics create()
- {
- return new GdkGraphics2D(this);
- }
-
- public Graphics create(int x, int y, int width, int height)
- {
- return new GdkGraphics2D(width, height);
- }
-
- GdkGraphics2D(GdkGraphics2D g)
- {
- paint = g.paint;
- stroke = g.stroke;
- setRenderingHints(g.hints);
-
- if (g.fg.getAlpha() != -1)
- fg = new Color(g.fg.getRed(), g.fg.getGreen(), g.fg.getBlue(),
- g.fg.getAlpha());
- else
- fg = new Color(g.fg.getRGB());
-
- if (g.bg.getAlpha() != -1)
- bg = new Color(g.bg.getRed(), g.bg.getGreen(), g.bg.getBlue(),
- g.bg.getAlpha());
- else
- bg = new Color(g.bg.getRGB());
-
- if (g.clip == null)
- clip = null;
- else
- clip = new Rectangle(g.getClipBounds());
-
- if (g.transform == null)
- transform = new AffineTransform();
- else
- transform = new AffineTransform(g.transform);
-
- font = g.font;
- component = g.component;
- copyState(g);
-
- setColor(fg);
- setBackground(bg);
- setPaint(paint);
- setStroke(stroke);
- setTransform(transform);
- setClip(clip);
- stateStack = new Stack();
- }
-
- GdkGraphics2D(int width, int height)
- {
- initState(width, height);
-
- setColor(Color.black);
- setBackground(Color.black);
- setPaint(getColor());
- setFont(new Font("SansSerif", Font.PLAIN, 12));
- setTransform(new AffineTransform());
- setStroke(new BasicStroke());
- setRenderingHints(getDefaultHints());
-
- stateStack = new Stack();
- }
-
- GdkGraphics2D(GtkComponentPeer component)
- {
- this.component = component;
-
- if (component.isRealized())
- initComponentGraphics2D();
- else
- connectSignals(component);
- }
-
- void initComponentGraphics2D()
- {
- initState(component);
-
- setColor(component.awtComponent.getForeground());
- setBackground(component.awtComponent.getBackground());
- setPaint(getColor());
- setTransform(new AffineTransform());
- setStroke(new BasicStroke());
- setRenderingHints(getDefaultHints());
- setFont(new Font("SansSerif", Font.PLAIN, 12));
-
- stateStack = new Stack();
- }
-
- GdkGraphics2D(BufferedImage bimage)
- {
- this.bimage = bimage;
- this.pixelBuffer = findSimpleIntegerArray(bimage.getColorModel(),
- bimage.getRaster());
- if (this.pixelBuffer == null)
- {
- this.pixelBuffer = new int[bimage.getRaster().getWidth() * bimage.getRaster()
- .getHeight()];
- this.pixelConversionRequired = true;
- }
- else
- {
- this.pixelConversionRequired = false;
- }
-
- initState(this.pixelBuffer, bimage.getWidth(), bimage.getHeight());
-
- setColor(Color.black);
- setBackground(Color.black);
- setPaint(getColor());
- setFont(new Font("SansSerif", Font.PLAIN, 12));
- setTransform(new AffineTransform());
- setStroke(new BasicStroke());
- setRenderingHints(getDefaultHints());
-
- stateStack = new Stack();
-
- // draw current buffered image to the pixmap associated
- // with it, if the image is not equal to our paint buffer.
- if (pixelConversionRequired)
- drawImage(bimage, new AffineTransform(1, 0, 0, 1, 0, 0), bg, null);
- }
-
- ////////////////////////////////////
- ////// Native Drawing Methods //////
- ////////////////////////////////////
-
- // GDK drawing methods
- private native void gdkDrawDrawable(GdkGraphics2D other, int x, int y);
-
- // drawing utility methods
- private native void drawPixels(int[] pixels, int w, int h, int stride,
- double[] i2u);
- private native void setTexturePixels(int[] pixels, int w, int h, int stride);
- private native void setGradient(double x1, double y1, double x2, double y2,
- int r1, int g1, int b1, int a1, int r2,
- int g2, int b2, int a2, boolean cyclic);
-
- // simple passthroughs to cairo
- private native void cairoSave();
- private native void cairoRestore();
- private native void cairoSetMatrix(double[] m);
- private native void cairoSetOperator(int cairoOperator);
- private native void cairoSetRGBColor(double red, double green, double blue);
- private native void cairoSetAlpha(double alpha);
- private native void cairoSetFillRule(int cairoFillRule);
- private native void cairoSetLineWidth(double width);
- private native void cairoSetLineCap(int cairoLineCap);
- private native void cairoSetLineJoin(int cairoLineJoin);
- private native void cairoSetDash(double[] dashes, int ndash, double offset);
-
- private native void cairoSetMiterLimit(double limit);
- private native void cairoNewPath();
- private native void cairoMoveTo(double x, double y);
- private native void cairoLineTo(double x, double y);
- private native void cairoCurveTo(double x1, double y1, double x2, double y2,
- double x3, double y3);
- private native void cairoRelMoveTo(double dx, double dy);
- private native void cairoRelLineTo(double dx, double dy);
- private native void cairoRelCurveTo(double dx1, double dy1, double dx2,
- double dy2, double dx3, double dy3);
- private native void cairoRectangle(double x, double y, double width,
- double height);
- private native void cairoClosePath();
- private native void cairoStroke();
- private native void cairoFill();
- private native void cairoClip();
-
- /////////////////////////////////////////////
- ////// General Drawing Support Methods //////
- /////////////////////////////////////////////
-
- private class DrawState
- {
- private Paint paint;
- private Stroke stroke;
- private Color fg;
- private Color bg;
- private Shape clip;
- private AffineTransform transform;
- private Font font;
- private Composite comp;
-
- DrawState(GdkGraphics2D g)
- {
- this.paint = g.paint;
- this.stroke = g.stroke;
- this.fg = g.fg;
- this.bg = g.bg;
- this.clip = g.clip;
- if (g.transform != null)
- this.transform = (AffineTransform) g.transform.clone();
- this.font = g.font;
- this.comp = g.comp;
- }
-
- public void restore(GdkGraphics2D g)
- {
- g.paint = this.paint;
- g.stroke = this.stroke;
- g.fg = this.fg;
- g.bg = this.bg;
- g.clip = this.clip;
- g.transform = this.transform;
- g.font = this.font;
- g.comp = this.comp;
- }
- }
-
- private void stateSave()
- {
- stateStack.push(new DrawState(this));
- cairoSave();
- }
-
- private void stateRestore()
- {
- ((DrawState) (stateStack.pop())).restore(this);
- cairoRestore();
- }
-
- // Some operations (drawing rather than filling) require that their
- // coords be shifted to land on 0.5-pixel boundaries, in order to land on
- // "middle of pixel" coordinates and light up complete pixels.
- private boolean shiftDrawCalls = false;
-
- private double shifted(double coord, boolean doShift)
- {
- if (doShift)
- return Math.floor(coord) + 0.5;
- else
- return coord;
- }
-
- private void walkPath(PathIterator p, boolean doShift)
- {
- double x = 0;
- double y = 0;
- double[] coords = new double[6];
-
- cairoSetFillRule(p.getWindingRule());
- for (; ! p.isDone(); p.next())
- {
- int seg = p.currentSegment(coords);
- switch (seg)
- {
- case PathIterator.SEG_MOVETO:
- x = shifted(coords[0], doShift);
- y = shifted(coords[1], doShift);
- cairoMoveTo(x, y);
- break;
- case PathIterator.SEG_LINETO:
- x = shifted(coords[0], doShift);
- y = shifted(coords[1], doShift);
- cairoLineTo(x, y);
- break;
- case PathIterator.SEG_QUADTO:
- // splitting a quadratic bezier into a cubic:
- // see: http://pfaedit.sourceforge.net/bezier.html
- double x1 = x + (2.0 / 3.0) * (shifted(coords[0], doShift) - x);
- double y1 = y + (2.0 / 3.0) * (shifted(coords[1], doShift) - y);
-
- double x2 = x1 + (1.0 / 3.0) * (shifted(coords[2], doShift) - x);
- double y2 = y1 + (1.0 / 3.0) * (shifted(coords[3], doShift) - y);
-
- x = shifted(coords[2], doShift);
- y = shifted(coords[3], doShift);
- cairoCurveTo(x1, y1, x2, y2, x, y);
- break;
- case PathIterator.SEG_CUBICTO:
- x = shifted(coords[4], doShift);
- y = shifted(coords[5], doShift);
- cairoCurveTo(shifted(coords[0], doShift),
- shifted(coords[1], doShift),
- shifted(coords[2], doShift),
- shifted(coords[3], doShift), x, y);
- break;
- case PathIterator.SEG_CLOSE:
- cairoClosePath();
- break;
- }
- }
- }
-
- private Map getDefaultHints()
- {
- HashMap defaultHints = new HashMap();
-
- defaultHints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
- RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
-
- defaultHints.put(RenderingHints.KEY_STROKE_CONTROL,
- RenderingHints.VALUE_STROKE_DEFAULT);
-
- defaultHints.put(RenderingHints.KEY_FRACTIONALMETRICS,
- RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
-
- defaultHints.put(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_OFF);
-
- defaultHints.put(RenderingHints.KEY_RENDERING,
- RenderingHints.VALUE_RENDER_DEFAULT);
-
- return defaultHints;
- }
-
- public static int[] findSimpleIntegerArray (ColorModel cm, Raster raster)
- {
- if (cm == null || raster == null)
- return null;
-
- if (! cm.getColorSpace().isCS_sRGB())
- return null;
-
- if (! (cm instanceof DirectColorModel))
- return null;
-
- DirectColorModel dcm = (DirectColorModel) cm;
-
- if (dcm.getRedMask() != 0x00FF0000 || dcm.getGreenMask() != 0x0000FF00
- || dcm.getBlueMask() != 0x000000FF)
- return null;
-
- if (! (raster instanceof WritableRaster))
- return null;
-
- if (raster.getSampleModel().getDataType() != DataBuffer.TYPE_INT)
- return null;
-
- if (! (raster.getDataBuffer() instanceof DataBufferInt))
- return null;
-
- DataBufferInt db = (DataBufferInt) raster.getDataBuffer();
-
- if (db.getNumBanks() != 1)
- return null;
-
- // Finally, we have determined that this is a single bank, [A]RGB-int
- // buffer in sRGB space. It's worth checking all this, because it means
- // that cairo can paint directly into the data buffer, which is very
- // fast compared to all the normal copying and converting.
-
- return db.getData();
- }
-
- private void updateBufferedImage()
- {
- if (bimage != null && pixelConversionRequired)
- {
- int height = bimage.getHeight();
- int width = bimage.getWidth();
- for (int y = 0; y < height; ++y)
- for (int x = 0; x < width; ++x)
- bimage.setRGB(x, y, pixelBuffer[y*width+height]);
- }
- }
-
- private boolean drawImage(Image img, AffineTransform xform,
- Color bgcolor, ImageObserver obs)
- {
- if (img == null)
- return false;
-
- if (img instanceof GtkOffScreenImage
- && img.getGraphics() instanceof GdkGraphics2D
- && (xform == null || xform.getType() == AffineTransform.TYPE_IDENTITY
- || xform.getType() == AffineTransform.TYPE_TRANSLATION))
- {
- // we are being asked to flush a double buffer from Gdk
- GdkGraphics2D g2 = (GdkGraphics2D) img.getGraphics();
- gdkDrawDrawable(g2, (int) xform.getTranslateX(),
- (int) xform.getTranslateY());
-
- updateBufferedImage();
-
- return true;
- }
- else
- {
- // In this case, xform is an AffineTransform that transforms bounding
- // box of the specified image from image space to user space. However
- // when we pass this transform to cairo, cairo will use this transform
- // to map "user coordinates" to "pixel" coordinates, which is the
- // other way around. Therefore to get the "user -> pixel" transform
- // that cairo wants from "image -> user" transform that we currently
- // have, we will need to invert the transformation matrix.
- AffineTransform invertedXform = new AffineTransform();
-
- try
- {
- invertedXform = xform.createInverse();
- if (img instanceof BufferedImage)
- {
- // draw an image which has actually been loaded
- // into memory fully
- BufferedImage b = (BufferedImage) img;
- return drawRaster(b.getColorModel(), b.getData(),
- invertedXform, bgcolor);
- }
- else
- return this.drawImage(GdkPixbufDecoder.createBufferedImage(img
- .getSource()),
- xform, bgcolor, obs);
- }
- catch (NoninvertibleTransformException e)
- {
- throw new ImagingOpException("Unable to invert transform "
- + xform.toString());
- }
- }
- }
-
- //////////////////////////////////////////////////
- ////// Implementation of Graphics2D Methods //////
- //////////////////////////////////////////////////
-
- public void draw(Shape s)
- {
- if (stroke != null && ! (stroke instanceof BasicStroke))
- {
- fill(stroke.createStrokedShape(s));
- return;
- }
-
- cairoNewPath();
-
- if (s instanceof Rectangle2D)
- {
- Rectangle2D r = (Rectangle2D) s;
- cairoRectangle(shifted(r.getX(), shiftDrawCalls),
- shifted(r.getY(), shiftDrawCalls), r.getWidth(),
- r.getHeight());
- }
- else
- walkPath(s.getPathIterator(null), shiftDrawCalls);
- cairoStroke();
-
- updateBufferedImage();
- }
-
- public void fill(Shape s)
- {
- cairoNewPath();
- if (s instanceof Rectangle2D)
- {
- Rectangle2D r = (Rectangle2D) s;
- cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
- else
- walkPath(s.getPathIterator(null), false);
-
- cairoFill();
-
- updateBufferedImage();
- }
-
- public void clip(Shape s)
- {
- // update it
- if (clip == null || s == null)
- clip = s;
- else if (s instanceof Rectangle2D && clip instanceof Rectangle2D)
- {
- Rectangle2D r = (Rectangle2D) s;
- Rectangle2D curr = (Rectangle2D) clip;
- clip = curr.createIntersection(r);
- }
- else
- throw new UnsupportedOperationException();
-
- // draw it
- if (clip != null)
- {
- cairoNewPath();
- if (clip instanceof Rectangle2D)
- {
- Rectangle2D r = (Rectangle2D) clip;
- cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
- else
- walkPath(clip.getPathIterator(null), false);
-
- // cairoClosePath ();
- cairoClip();
- }
- }
-
- public Paint getPaint()
- {
- return paint;
- }
-
- public AffineTransform getTransform()
- {
- return (AffineTransform) transform.clone();
- }
-
- public void setPaint(Paint p)
- {
- if (paint == null)
- return;
-
- paint = p;
- if (paint instanceof Color)
- {
- setColor((Color) paint);
- }
- else if (paint instanceof TexturePaint)
- {
- TexturePaint tp = (TexturePaint) paint;
- BufferedImage img = tp.getImage();
-
- // map the image to the anchor rectangle
- int width = (int) tp.getAnchorRect().getWidth();
- int height = (int) tp.getAnchorRect().getHeight();
-
- double scaleX = width / (double) img.getWidth();
- double scaleY = width / (double) img.getHeight();
-
- AffineTransform at = new AffineTransform(scaleX, 0, 0, scaleY, 0, 0);
- AffineTransformOp op = new AffineTransformOp(at, getRenderingHints());
- BufferedImage texture = op.filter(img, null);
- int[] pixels = texture.getRGB(0, 0, width, height, null, 0, width);
- setTexturePixels(pixels, width, height, width);
- }
- else if (paint instanceof GradientPaint)
- {
- GradientPaint gp = (GradientPaint) paint;
- Point2D p1 = gp.getPoint1();
- Point2D p2 = gp.getPoint2();
- Color c1 = gp.getColor1();
- Color c2 = gp.getColor2();
- setGradient(p1.getX(), p1.getY(), p2.getX(), p2.getY(), c1.getRed(),
- c1.getGreen(), c1.getBlue(), c1.getAlpha(), c2.getRed(),
- c2.getGreen(), c2.getBlue(), c2.getAlpha(), gp.isCyclic());
- }
- else
- throw new java.lang.UnsupportedOperationException();
- }
-
- public void setTransform(AffineTransform tx)
- {
- transform = tx;
- if (transform != null)
- {
- double[] m = new double[6];
- transform.getMatrix(m);
- cairoSetMatrix(m);
- }
- }
-
- public void transform(AffineTransform tx)
- {
- if (transform == null)
- transform = new AffineTransform(tx);
- else
- transform.concatenate(tx);
- setTransform(transform);
- if (clip != null)
- {
- // FIXME: this should actuall try to transform the shape
- // rather than degrade to bounds.
- Rectangle2D r = clip.getBounds2D();
- double[] coords = new double[]
- {
- r.getX(), r.getY(), r.getX() + r.getWidth(),
- r.getY() + r.getHeight()
- };
- try
- {
- tx.createInverse().transform(coords, 0, coords, 0, 2);
- r.setRect(coords[0], coords[1], coords[2] - coords[0],
- coords[3] - coords[1]);
- clip = r;
- }
- catch (java.awt.geom.NoninvertibleTransformException e)
- {
- }
- }
- }
-
- public void rotate(double theta)
- {
- transform(AffineTransform.getRotateInstance(theta));
- }
-
- public void rotate(double theta, double x, double y)
- {
- transform(AffineTransform.getRotateInstance(theta, x, y));
- }
-
- public void scale(double sx, double sy)
- {
- transform(AffineTransform.getScaleInstance(sx, sy));
- }
-
- public void translate(double tx, double ty)
- {
- transform(AffineTransform.getTranslateInstance(tx, ty));
- }
-
- public void translate(int x, int y)
- {
- translate((double) x, (double) y);
- }
-
- public void shear(double shearX, double shearY)
- {
- transform(AffineTransform.getShearInstance(shearX, shearY));
- }
-
- public Stroke getStroke()
- {
- return stroke;
- }
-
- public void setStroke(Stroke st)
- {
- stroke = st;
- if (stroke instanceof BasicStroke)
- {
- BasicStroke bs = (BasicStroke) stroke;
- cairoSetLineCap(bs.getEndCap());
- cairoSetLineWidth(bs.getLineWidth());
- cairoSetLineJoin(bs.getLineJoin());
- cairoSetMiterLimit(bs.getMiterLimit());
- float[] dashes = bs.getDashArray();
- if (dashes != null)
- {
- double[] double_dashes = new double[dashes.length];
- for (int i = 0; i < dashes.length; i++)
- double_dashes[i] = dashes[i];
- cairoSetDash(double_dashes, double_dashes.length,
- (double) bs.getDashPhase());
- }
- }
- }
-
- ////////////////////////////////////////////////
- ////// Implementation of Graphics Methods //////
- ////////////////////////////////////////////////
-
- public void setPaintMode()
- {
- setComposite(java.awt.AlphaComposite.SrcOver);
- }
-
- public void setXORMode(Color c)
- {
- setComposite(new gnu.java.awt.BitwiseXORComposite(c));
- }
-
- public void setColor(Color c)
- {
- if (c == null)
- c = Color.BLACK;
-
- fg = c;
- paint = c;
- cairoSetRGBColor(fg.getRed() / 255.0, fg.getGreen() / 255.0,
- fg.getBlue() / 255.0);
- cairoSetAlpha((fg.getAlpha() & 255) / 255.0);
- }
-
- public Color getColor()
- {
- return fg;
- }
-
- public void clipRect(int x, int y, int width, int height)
- {
- clip(new Rectangle(x, y, width, height));
- }
-
- public Shape getClip()
- {
- return clip.getBounds2D(); //getClipInDevSpace();
- }
-
- public Rectangle getClipBounds()
- {
- if (clip == null)
- return null;
- else
- return clip.getBounds();
- }
-
- protected Rectangle2D getClipInDevSpace()
- {
- Rectangle2D uclip = clip.getBounds2D();
- if (transform == null)
- return uclip;
- else
- {
- Point2D pos = transform.transform(new Point2D.Double(uclip.getX(),
- uclip.getY()),
- (Point2D) null);
- Point2D extent = transform.deltaTransform(new Point2D.Double(uclip
- .getWidth(),
- uclip
- .getHeight()),
- (Point2D) null);
- return new Rectangle2D.Double(pos.getX(), pos.getY(), extent.getX(),
- extent.getY());
- }
- }
-
- public void setClip(int x, int y, int width, int height)
- {
- setClip(new Rectangle2D.Double((double) x, (double) y, (double) width,
- (double) height));
- }
-
- public void setClip(Shape s)
- {
- clip = s;
- if (s != null)
- {
- cairoNewPath();
- if (s instanceof Rectangle2D)
- {
- Rectangle2D r = (Rectangle2D) s;
- cairoRectangle(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
- else
- walkPath(s.getPathIterator(null), false);
-
- // cairoClosePath ();
- cairoClip();
- }
- }
-
- private static BasicStroke draw3DRectStroke = new BasicStroke();
-
- public void draw3DRect(int x, int y, int width, int height, boolean raised)
- {
- Stroke tmp = stroke;
- setStroke(draw3DRectStroke);
- super.draw3DRect(x, y, width, height, raised);
- setStroke(tmp);
- updateBufferedImage();
- }
-
- public void fill3DRect(int x, int y, int width, int height, boolean raised)
- {
- Stroke tmp = stroke;
- setStroke(draw3DRectStroke);
- super.fill3DRect(x, y, width, height, raised);
- setStroke(tmp);
- updateBufferedImage();
- }
-
- public void drawRect(int x, int y, int width, int height)
- {
- draw(new Rectangle(x, y, width, height));
- }
-
- public void fillRect(int x, int y, int width, int height)
- {
- cairoNewPath();
- cairoRectangle(x, y, width, height);
- cairoFill();
- }
-
- public void clearRect(int x, int y, int width, int height)
- {
- cairoSetRGBColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
- bg.getBlue() / 255.0);
- cairoSetAlpha(1.0);
- cairoNewPath();
- cairoRectangle(x, y, width, height);
- cairoFill();
- setColor(fg);
-
- updateBufferedImage();
- }
-
- public void setBackground(Color c)
- {
- bg = c;
- }
-
- public Color getBackground()
- {
- return bg;
- }
-
- private void doPolygon(int[] xPoints, int[] yPoints, int nPoints,
- boolean close, boolean fill)
- {
- if (nPoints < 1)
- return;
- GeneralPath gp = new GeneralPath(PathIterator.WIND_EVEN_ODD);
- gp.moveTo((float) xPoints[0], (float) yPoints[0]);
- for (int i = 1; i < nPoints; i++)
- gp.lineTo((float) xPoints[i], (float) yPoints[i]);
-
- if (close)
- gp.closePath();
-
- Shape sh = gp;
- if (fill == false && stroke != null && ! (stroke instanceof BasicStroke))
- {
- sh = stroke.createStrokedShape(gp);
- fill = true;
- }
-
- if (fill)
- fill(sh);
- else
- draw(sh);
- }
-
- public void drawLine(int x1, int y1, int x2, int y2)
- {
- int[] xp = new int[2];
- int[] yp = new int[2];
-
- xp[0] = x1;
- xp[1] = x2;
- yp[0] = y1;
- yp[1] = y2;
-
- doPolygon(xp, yp, 2, false, false);
- }
-
- public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
- {
- doPolygon(xPoints, yPoints, nPoints, true, true);
- }
-
- public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
- {
- doPolygon(xPoints, yPoints, nPoints, true, false);
- }
-
- public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
- {
- doPolygon(xPoints, yPoints, nPoints, false, false);
- }
-
- private boolean drawRaster(ColorModel cm, Raster r,
- AffineTransform imageToUser, Color bgcolor)
- {
- if (r == null)
- return false;
-
- SampleModel sm = r.getSampleModel();
- DataBuffer db = r.getDataBuffer();
-
- if (db == null || sm == null)
- return false;
-
- if (cm == null)
- cm = ColorModel.getRGBdefault();
-
- double[] i2u = new double[6];
- if (imageToUser != null)
- imageToUser.getMatrix(i2u);
- else
- {
- i2u[0] = 1;
- i2u[1] = 0;
- i2u[2] = 0;
- i2u[3] = 1;
- i2u[4] = 0;
- i2u[5] = 0;
- }
-
- int[] pixels = findSimpleIntegerArray(cm, r);
-
- if (pixels == null)
- {
- // FIXME: I don't think this code will work correctly with a non-RGB
- // MultiPixelPackedSampleModel. Although this entire method should
- // probably be rewritten to better utilize Cairo's different supported
- // data formats.
- if (sm instanceof MultiPixelPackedSampleModel)
- {
- pixels = r.getPixels(0, 0, r.getWidth(), r.getHeight(), pixels);
- for (int i = 0; i < pixels.length; i++)
- pixels[i] = cm.getRGB(pixels[i]);
- }
- else
- {
- pixels = new int[r.getWidth() * r.getHeight()];
- for (int i = 0; i < pixels.length; i++)
- pixels[i] = cm.getRGB(db.getElem(i));
- }
- }
-
- // Change all transparent pixels in the image to the specified bgcolor,
- // or (if there's no alpha) fill in an alpha channel so that it paints
- // correctly.
- if (cm.hasAlpha())
- {
- if (bgcolor != null && cm.hasAlpha())
- for (int i = 0; i < pixels.length; i++)
- {
- if (cm.getAlpha(pixels[i]) == 0)
- pixels[i] = bgcolor.getRGB();
- }
- }
- else
- for (int i = 0; i < pixels.length; i++)
- pixels[i] |= 0xFF000000;
-
- drawPixels(pixels, r.getWidth(), r.getHeight(), r.getWidth(), i2u);
-
- updateBufferedImage();
-
- return true;
- }
-
- public void drawRenderedImage(RenderedImage image, AffineTransform xform)
- {
- drawRaster(image.getColorModel(), image.getData(), xform, bg);
- }
-
- public void drawRenderableImage(RenderableImage image, AffineTransform xform)
- {
- drawRenderedImage(image.createRendering(new RenderContext(xform)), xform);
- }
-
- public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
- {
- return drawImage(img, xform, bg, obs);
- }
-
- public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y)
- {
- Image filtered = op.filter(image, null);
- drawImage(filtered, new AffineTransform(1f, 0f, 0f, 1f, x, y), bg, null);
- }
-
- public boolean drawImage(Image img, int x, int y, ImageObserver observer)
- {
- return drawImage(img, new AffineTransform(1f, 0f, 0f, 1f, x, y), bg,
- observer);
- }
-
- ///////////////////////////////////////////////
- ////// Unimplemented Stubs and Overloads //////
- ///////////////////////////////////////////////
-
- public boolean hit(Rectangle rect, Shape text, boolean onStroke)
- {
- throw new java.lang.UnsupportedOperationException();
- }
-
- public GraphicsConfiguration getDeviceConfiguration()
- {
- throw new java.lang.UnsupportedOperationException();
- }
-
- public void setComposite(Composite comp)
- {
- this.comp = comp;
-
- if (comp instanceof AlphaComposite)
- {
- AlphaComposite a = (AlphaComposite) comp;
- cairoSetOperator(a.getRule());
- Color c = getColor();
- setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(),
- (int) (a.getAlpha() * ((float) c.getAlpha()))));
- }
- else
- throw new java.lang.UnsupportedOperationException();
- }
-
- public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
- {
- hints.put(hintKey, hintValue);
-
- if (hintKey.equals(RenderingHints.KEY_INTERPOLATION)
- || hintKey.equals(RenderingHints.KEY_ALPHA_INTERPOLATION))
- {
- if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
- cairoSurfaceSetFilter(0);
-
- else if (hintValue.equals(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
- cairoSurfaceSetFilter(1);
-
- else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
- cairoSurfaceSetFilter(2);
-
- else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
- cairoSurfaceSetFilter(3);
-
- else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
- cairoSurfaceSetFilter(4);
- }
-
- shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
- || hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
- }
-
- public Object getRenderingHint(RenderingHints.Key hintKey)
- {
- return hints.get(hintKey);
- }
-
- public void setRenderingHints(Map hints)
- {
- this.hints = new RenderingHints(getDefaultHints());
- this.hints.add(new RenderingHints(hints));
-
- if (hints.containsKey(RenderingHints.KEY_INTERPOLATION))
- {
- if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
- cairoSurfaceSetFilter(0);
-
- else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
- cairoSurfaceSetFilter(1);
- }
-
- if (hints.containsKey(RenderingHints.KEY_ALPHA_INTERPOLATION))
- {
- if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED))
- cairoSurfaceSetFilter(2);
-
- else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY))
- cairoSurfaceSetFilter(3);
-
- else if (hints.containsValue(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT))
- cairoSurfaceSetFilter(4);
- }
-
- shiftDrawCalls = hints.containsValue(RenderingHints.VALUE_STROKE_NORMALIZE)
- || hints.containsValue(RenderingHints.VALUE_STROKE_DEFAULT);
- }
-
- public void addRenderingHints(Map hints)
- {
- this.hints.add(new RenderingHints(hints));
- }
-
- public RenderingHints getRenderingHints()
- {
- return hints;
- }
-
- public Composite getComposite()
- {
- if (comp == null)
- return AlphaComposite.SrcOver;
- else
- return comp;
- }
-
- public FontRenderContext getFontRenderContext()
- {
- return new FontRenderContext(transform, true, true);
- }
-
- public void copyArea(int x, int y, int width, int height, int dx, int dy)
- {
- throw new java.lang.UnsupportedOperationException();
- }
-
- public void drawArc(int x, int y, int width, int height, int startAngle,
- int arcAngle)
- {
- draw(new Arc2D.Double((double) x, (double) y, (double) width,
- (double) height, (double) startAngle,
- (double) arcAngle, Arc2D.OPEN));
- }
-
- public boolean drawImage(Image img, int x, int y, Color bgcolor,
- ImageObserver observer)
- {
- return drawImage(img, x, y, img.getWidth(observer),
- img.getHeight(observer), bgcolor, observer);
- }
-
- public boolean drawImage(Image img, int x, int y, int width, int height,
- Color bgcolor, ImageObserver observer)
- {
- double scaleX = width / (double) img.getWidth(observer);
- double scaleY = height / (double) img.getHeight(observer);
-
- return drawImage(img, new AffineTransform(scaleX, 0f, 0f, scaleY, x, y),
- bgcolor, observer);
- }
-
- public boolean drawImage(Image img, int x, int y, int width, int height,
- ImageObserver observer)
- {
- return drawImage(img, x, y, width, height, bg, observer);
- }
-
- public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
- int sx1, int sy1, int sx2, int sy2, Color bgcolor,
- ImageObserver observer)
- {
- if (img == null)
- return false;
-
- Image subImage;
-
- int sourceWidth = sx2 - sx1;
- int sourceHeight = sy2 - sy1;
-
- int destWidth = dx2 - dx1;
- int destHeight = dy2 - dy1;
-
- double scaleX = destWidth / (double) sourceWidth;
- double scaleY = destHeight / (double) sourceHeight;
-
- // Get the subimage of the source enclosed in the
- // rectangle specified by sx1, sy1, sx2, sy2
-
- if (img instanceof BufferedImage)
- {
- BufferedImage b = (BufferedImage) img;
- subImage = b.getSubimage(sx1, sy1, sx2, sy2);
- }
- else
- {
- // FIXME: This code currently doesn't work. Null Pointer
- // exception is thrown in this case. This happens
- // because img.getSource() always returns null, since source gets
- // never initialized when it is created with the help of
- // createImage(int width, int height).
- CropImageFilter filter = new CropImageFilter(sx1, sx2, sx2, sy2);
- FilteredImageSource src = new FilteredImageSource(img.getSource(),
- filter);
-
- subImage = Toolkit.getDefaultToolkit().createImage(src);
- }
-
- return drawImage(subImage,
- new AffineTransform(scaleX, 0, 0, scaleY, dx1, dy1),
- bgcolor, observer);
- }
-
- public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
- int sx1, int sy1, int sx2, int sy2,
- ImageObserver observer)
- {
- return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bg, observer);
- }
-
- public void drawOval(int x, int y, int width, int height)
- {
- drawArc(x, y, width, height, 0, 360);
- }
-
- public void drawRoundRect(int x, int y, int width, int height, int arcWidth,
- int arcHeight)
- {
- if (arcWidth > width)
- arcWidth = width;
- if (arcHeight > height)
- arcHeight = height;
-
- int xx = x + width - arcWidth;
- int yy = y + height - arcHeight;
-
- drawArc(x, y, arcWidth, arcHeight, 90, 90);
- drawArc(xx, y, arcWidth, arcHeight, 0, 90);
- drawArc(xx, yy, arcWidth, arcHeight, 270, 90);
- drawArc(x, yy, arcWidth, arcHeight, 180, 90);
-
- int y1 = y + arcHeight / 2;
- int y2 = y + height - arcHeight / 2;
- drawLine(x, y1, x, y2);
- drawLine(x + width, y1, x + width, y2);
-
- int x1 = x + arcWidth / 2;
- int x2 = x + width - arcWidth / 2;
- drawLine(x1, y, x2, y);
- drawLine(x1, y + height, x2, y + height);
- }
-
- // these are the most accelerated painting paths
- native void cairoDrawGlyphVector(GdkFontPeer font,
- float x, float y, int n,
- int[] codes, float[] positions);
-
- native void cairoDrawGdkTextLayout(GdkTextLayout gl,
- float x, float y);
-
- GdkFontPeer getFontPeer()
- {
- return (GdkFontPeer) getFont().getPeer();
- }
-
- public void drawGdkTextLayout(GdkTextLayout gl, float x, float y)
- {
- cairoDrawGdkTextLayout (gl, x, y);
- updateBufferedImage ();
- }
-
- public void drawString(String str, float x, float y)
- {
- drawGlyphVector(getFont().createGlyphVector(null, str), x, y);
- updateBufferedImage ();
- }
-
- public void drawString(String str, int x, int y)
- {
- drawString (str, (float) x, (float) y);
- }
-
- public void drawString(AttributedCharacterIterator ci, int x, int y)
- {
- drawString (ci, (float) x, (float) y);
- }
-
- public void drawGlyphVector(GlyphVector gv, float x, float y)
- {
- int n = gv.getNumGlyphs ();
- int[] codes = gv.getGlyphCodes (0, n, null);
- float[] positions = gv.getGlyphPositions (0, n, null);
-
- setFont (gv.getFont ());
- cairoDrawGlyphVector (getFontPeer(), x, y, n, codes, positions);
- updateBufferedImage ();
- }
-
- public void drawString(AttributedCharacterIterator ci, float x, float y)
- {
- GlyphVector gv = getFont().createGlyphVector(getFontRenderContext(), ci);
- drawGlyphVector(gv, x, y);
- }
-
- public void fillArc(int x, int y, int width, int height, int startAngle,
- int arcAngle)
- {
- fill(new Arc2D.Double((double) x, (double) y, (double) width,
- (double) height, (double) startAngle,
- (double) arcAngle, Arc2D.OPEN));
- }
-
- public void fillOval(int x, int y, int width, int height)
- {
- fillArc(x, y, width, height, 0, 360);
- }
-
- public void fillRoundRect(int x, int y, int width, int height, int arcWidth,
- int arcHeight)
- {
- if (arcWidth > width)
- arcWidth = width;
- if (arcHeight > height)
- arcHeight = height;
-
- int xx = x + width - arcWidth;
- int yy = y + height - arcHeight;
-
- fillArc(x, y, arcWidth, arcHeight, 90, 90);
- fillArc(xx, y, arcWidth, arcHeight, 0, 90);
- fillArc(xx, yy, arcWidth, arcHeight, 270, 90);
- fillArc(x, yy, arcWidth, arcHeight, 180, 90);
-
- fillRect(x, y + arcHeight / 2, width, height - arcHeight + 1);
- fillRect(x + arcWidth / 2, y, width - arcWidth + 1, height);
- }
-
- public Font getFont()
- {
- if (font == null)
- return new Font("SansSerif", Font.PLAIN, 12);
- return font;
- }
-
- // Until such time as pango is happy to talk directly to cairo, we
- // actually need to redirect some calls from the GtkFontPeer and
- // GtkFontMetrics into the drawing kit and ask cairo ourselves.
-
- static native void releasePeerGraphicsResource(GdkFontPeer f);
-
- public FontMetrics getFontMetrics()
- {
- return getFontMetrics(getFont());
- }
-
- public FontMetrics getFontMetrics(Font f)
- {
- // the reason we go via the toolkit here is to try to get
- // a cached object. the toolkit keeps such a cache.
- return Toolkit.getDefaultToolkit().getFontMetrics(f);
- }
-
- public void setFont(Font f)
- {
- if (f.getPeer() instanceof GdkFontPeer)
- font = f;
- else
- font =
- ((ClasspathToolkit)(Toolkit.getDefaultToolkit()))
- .getFont(f.getName(), f.getAttributes());
- }
-
- public String toString()
- {
- return (getClass().getName()
- + "[font=" + getFont().toString()
- + ",color=" + fg.toString()
- + "]");
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
deleted file mode 100644
index bfad87acac0..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/* GdkGraphicsConfiguration.java -- describes characteristics of graphics
- Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.BufferCapabilities;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.ImageCapabilities;
-import java.awt.Rectangle;
-
-import java.awt.geom.AffineTransform;
-
-import java.awt.image.BufferedImage;
-import java.awt.image.ColorModel;
-import java.awt.image.VolatileImage;
-
-public class GdkGraphicsConfiguration
- extends GraphicsConfiguration
-{
- GdkScreenGraphicsDevice gdkScreenGraphicsDevice;
- ColorModel cm;
- Rectangle bounds;
-
- public GtkToolkit getToolkit()
- {
- return gdkScreenGraphicsDevice.getToolkit();
- }
-
- public GdkGraphicsConfiguration(GdkScreenGraphicsDevice dev)
- {
- this.gdkScreenGraphicsDevice = dev;
- cm = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).getColorModel();
- bounds = getToolkit().getBounds();
- }
-
- public GraphicsDevice getDevice()
- {
- return gdkScreenGraphicsDevice;
- }
-
- public BufferedImage createCompatibleImage(int w, int h)
- {
- return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
- }
-
- public BufferedImage createCompatibleImage(int w, int h,
- int transparency)
- {
- return createCompatibleImage(w, h);
- }
-
- public VolatileImage createCompatibleVolatileImage(int w, int h)
- {
- return new GtkVolatileImage(w, h);
- }
-
- public VolatileImage createCompatibleVolatileImage(int w, int h,
- ImageCapabilities caps)
- throws java.awt.AWTException
- {
- return new GtkVolatileImage(w, h, caps);
- }
-
- public ColorModel getColorModel()
- {
- return cm;
- }
-
- public ColorModel getColorModel(int transparency)
- {
- return getColorModel();
- }
-
- public AffineTransform getDefaultTransform()
- {
- // FIXME: extract the GDK DPI information here.
- return new AffineTransform();
- }
-
- public AffineTransform getNormalizingTransform()
- {
- // FIXME: extract the GDK DPI information here.
- return new AffineTransform();
- }
-
- public Rectangle getBounds()
- {
- return bounds;
- }
-
- public BufferCapabilities getBufferCapabilities()
- {
- return new BufferCapabilities(getImageCapabilities(),
- getImageCapabilities(),
- BufferCapabilities.FlipContents.UNDEFINED);
- }
-
- public ImageCapabilities getImageCapabilities()
- {
- return new ImageCapabilities(false);
- }
-
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
deleted file mode 100644
index 4f9d1c27af6..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* GdkGraphicsEnvironment.java -- information about the graphics environment
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.HeadlessException;
-import java.awt.image.BufferedImage;
-import java.util.Locale;
-
-public class GdkGraphicsEnvironment extends GraphicsEnvironment
-{
- GtkToolkit gtkToolkit;
-
- public GtkToolkit getToolkit()
- {
- return gtkToolkit;
- }
-
- public GdkGraphicsEnvironment (GtkToolkit tk)
- {
- super();
- gtkToolkit = tk;
- }
-
- public GraphicsDevice[] getScreenDevices ()
- {
- // FIXME: Support multiple screens, since GDK can.
- return new GraphicsDevice[] { new GdkScreenGraphicsDevice (this) };
- }
-
- public GraphicsDevice getDefaultScreenDevice ()
- {
- if (GraphicsEnvironment.isHeadless ())
- throw new HeadlessException ();
-
- return new GdkScreenGraphicsDevice (this);
- }
-
- public Graphics2D createGraphics (BufferedImage image)
- {
- return new GdkGraphics2D (image);
- }
-
- private native int nativeGetNumFontFamilies();
- private native void nativeGetFontFamilies(String[] family_names);
-
- public Font[] getAllFonts ()
- {
- throw new java.lang.UnsupportedOperationException ();
- }
-
- public String[] getAvailableFontFamilyNames ()
- {
- String[] family_names;
- int array_size;
-
- array_size = nativeGetNumFontFamilies();
- family_names = new String[array_size];
-
- nativeGetFontFamilies(family_names);
- return family_names;
- }
-
- public String[] getAvailableFontFamilyNames (Locale l)
- {
- throw new java.lang.UnsupportedOperationException ();
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
deleted file mode 100644
index a3d82f62f87..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+++ /dev/null
@@ -1,675 +0,0 @@
-/* GdkPixbufDecoder.java -- Image data decoding object
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.classpath.Configuration;
-
-import java.awt.image.BufferedImage;
-import java.awt.image.ColorModel;
-import java.awt.image.DirectColorModel;
-import java.awt.image.ImageConsumer;
-import java.awt.image.ImageProducer;
-import java.awt.image.Raster;
-import java.awt.image.RenderedImage;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Vector;
-
-import javax.imageio.IIOImage;
-import javax.imageio.ImageReadParam;
-import javax.imageio.ImageReader;
-import javax.imageio.ImageTypeSpecifier;
-import javax.imageio.ImageWriteParam;
-import javax.imageio.ImageWriter;
-import javax.imageio.metadata.IIOMetadata;
-import javax.imageio.spi.IIORegistry;
-import javax.imageio.spi.ImageReaderSpi;
-import javax.imageio.spi.ImageWriterSpi;
-import javax.imageio.stream.ImageInputStream;
-import javax.imageio.stream.ImageOutputStream;
-
-public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
-{
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
- initStaticState ();
- }
-
- static native void initStaticState();
- private final int native_state = GtkGenericPeer.getUniqueInteger ();
- private boolean initialized = false;
-
- // the current set of ImageConsumers for this decoder
- Vector curr;
-
- // interface to GdkPixbuf
- native void initState ();
- native void pumpBytes (byte[] bytes, int len);
- native void finish ();
- static native void streamImage(int[] bytes, String format, int width, int height, boolean hasAlpha, DataOutput sink);
-
- // gdk-pixbuf provids data in RGBA format
- static final ColorModel cm = new DirectColorModel (32, 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff);
- public GdkPixbufDecoder (InputStream in)
- {
- super (in);
- }
-
- public GdkPixbufDecoder (String filename)
- {
- super (filename);
- }
-
- public GdkPixbufDecoder (URL url)
- {
- super (url);
- }
-
- public GdkPixbufDecoder (byte[] imagedata, int imageoffset, int imagelength)
- {
- super (imagedata, imageoffset, imagelength);
- }
-
- // called back by native side
- void areaPrepared (int width, int height)
- {
-
- if (curr == null)
- return;
-
- for (int i = 0; i < curr.size (); i++)
- {
- ImageConsumer ic = (ImageConsumer) curr.elementAt (i);
- ic.setDimensions (width, height);
- ic.setColorModel (cm);
- ic.setHints (ImageConsumer.RANDOMPIXELORDER);
- }
- }
-
- // called back by native side
- void areaUpdated (int x, int y, int width, int height,
- int pixels[], int scansize)
- {
- if (curr == null)
- return;
-
- for (int i = 0; i < curr.size (); i++)
- {
- ImageConsumer ic = (ImageConsumer) curr.elementAt (i);
- ic.setPixels (x, y, width, height, cm, pixels, 0, scansize);
- }
- }
-
- // called from an async image loader of one sort or another, this method
- // repeatedly reads bytes from the input stream and passes them through a
- // GdkPixbufLoader using the native method pumpBytes. pumpBytes in turn
- // decodes the image data and calls back areaPrepared and areaUpdated on
- // this object, feeding back decoded pixel blocks, which we pass to each
- // of the ImageConsumers in the provided Vector.
-
- public void produce (Vector v, InputStream is) throws IOException
- {
- curr = v;
-
- byte bytes[] = new byte[4096];
- int len = 0;
- initState();
- while ((len = is.read (bytes)) != -1)
- pumpBytes (bytes, len);
-
- for (int i = 0; i < curr.size (); i++)
- {
- ImageConsumer ic = (ImageConsumer) curr.elementAt (i);
- ic.imageComplete (ImageConsumer.STATICIMAGEDONE);
- }
-
- curr = null;
- }
-
- public void finalize()
- {
- finish();
- }
-
-
- public static class ImageFormatSpec
- {
- public String name;
- public boolean writable = false;
- public ArrayList mimeTypes = new ArrayList();
- public ArrayList extensions = new ArrayList();
-
- public ImageFormatSpec(String name, boolean writable)
- {
- this.name = name;
- this.writable = writable;
- }
-
- public synchronized void addMimeType(String m)
- {
- mimeTypes.add(m);
- }
-
- public synchronized void addExtension(String e)
- {
- extensions.add(e);
- }
- }
-
- static ArrayList imageFormatSpecs;
-
- public static ImageFormatSpec registerFormat(String name, boolean writable)
- {
- ImageFormatSpec ifs = new ImageFormatSpec(name, writable);
- synchronized(GdkPixbufDecoder.class)
- {
- if (imageFormatSpecs == null)
- imageFormatSpecs = new ArrayList();
- imageFormatSpecs.add(ifs);
- }
- return ifs;
- }
-
- static String[] getFormatNames(boolean writable)
- {
- ArrayList names = new ArrayList();
- synchronized (imageFormatSpecs)
- {
- Iterator i = imageFormatSpecs.iterator();
- while (i.hasNext())
- {
- ImageFormatSpec ifs = (ImageFormatSpec) i.next();
- if (writable && !ifs.writable)
- continue;
- names.add(ifs.name);
-
- /*
- * In order to make the filtering code work, we need to register
- * this type under every "format name" likely to be used as a synonym.
- * This generally means "all the extensions people might use".
- */
-
- Iterator j = ifs.extensions.iterator();
- while (j.hasNext())
- names.add((String) j.next());
- }
- }
- Object[] objs = names.toArray();
- String[] strings = new String[objs.length];
- for (int i = 0; i < objs.length; ++i)
- strings[i] = (String) objs[i];
- return strings;
- }
-
- static String[] getFormatExtensions(boolean writable)
- {
- ArrayList extensions = new ArrayList();
- synchronized (imageFormatSpecs)
- {
- Iterator i = imageFormatSpecs.iterator();
- while (i.hasNext())
- {
- ImageFormatSpec ifs = (ImageFormatSpec) i.next();
- if (writable && !ifs.writable)
- continue;
- Iterator j = ifs.extensions.iterator();
- while (j.hasNext())
- extensions.add((String) j.next());
- }
- }
- Object[] objs = extensions.toArray();
- String[] strings = new String[objs.length];
- for (int i = 0; i < objs.length; ++i)
- strings[i] = (String) objs[i];
- return strings;
- }
-
- static String[] getFormatMimeTypes(boolean writable)
- {
- ArrayList mimeTypes = new ArrayList();
- synchronized (imageFormatSpecs)
- {
- Iterator i = imageFormatSpecs.iterator();
- while (i.hasNext())
- {
- ImageFormatSpec ifs = (ImageFormatSpec) i.next();
- if (writable && !ifs.writable)
- continue;
- Iterator j = ifs.mimeTypes.iterator();
- while (j.hasNext())
- mimeTypes.add((String) j.next());
- }
- }
- Object[] objs = mimeTypes.toArray();
- String[] strings = new String[objs.length];
- for (int i = 0; i < objs.length; ++i)
- strings[i] = (String) objs[i];
- return strings;
- }
-
-
- static String findFormatName(Object ext, boolean needWritable)
- {
- if (ext == null)
- throw new IllegalArgumentException("extension is null");
-
- if (!(ext instanceof String))
- throw new IllegalArgumentException("extension is not a string");
-
- String str = (String) ext;
-
- Iterator i = imageFormatSpecs.iterator();
- while (i.hasNext())
- {
- ImageFormatSpec ifs = (ImageFormatSpec) i.next();
-
- if (needWritable && !ifs.writable)
- continue;
-
- if (ifs.name.equals(str))
- return str;
-
- Iterator j = ifs.extensions.iterator();
- while (j.hasNext())
- {
- String extension = (String)j.next();
- if (extension.equals(str))
- return ifs.name;
- }
-
- j = ifs.mimeTypes.iterator();
- while (j.hasNext())
- {
- String mimeType = (String)j.next();
- if (mimeType.equals(str))
- return ifs.name;
- }
- }
- throw new IllegalArgumentException("unknown extension '" + str + "'");
- }
-
- private static GdkPixbufReaderSpi readerSpi;
- private static GdkPixbufWriterSpi writerSpi;
-
- public static synchronized GdkPixbufReaderSpi getReaderSpi()
- {
- if (readerSpi == null)
- readerSpi = new GdkPixbufReaderSpi();
- return readerSpi;
- }
-
- public static synchronized GdkPixbufWriterSpi getWriterSpi()
- {
- if (writerSpi == null)
- writerSpi = new GdkPixbufWriterSpi();
- return writerSpi;
- }
-
- public static void registerSpis(IIORegistry reg)
- {
- reg.registerServiceProvider(getReaderSpi(), ImageReaderSpi.class);
- reg.registerServiceProvider(getWriterSpi(), ImageWriterSpi.class);
- }
-
- public static class GdkPixbufWriterSpi extends ImageWriterSpi
- {
- public GdkPixbufWriterSpi()
- {
- super("GdkPixbuf", "2.x",
- GdkPixbufDecoder.getFormatNames(true),
- GdkPixbufDecoder.getFormatExtensions(true),
- GdkPixbufDecoder.getFormatMimeTypes(true),
- "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufWriter",
- new Class[] { ImageOutputStream.class },
- new String[] { "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufReaderSpi" },
- false, null, null, null, null,
- false, null, null, null, null);
- }
-
- public boolean canEncodeImage(ImageTypeSpecifier ts)
- {
- return true;
- }
-
- public ImageWriter createWriterInstance(Object ext)
- {
- return new GdkPixbufWriter(this, ext);
- }
-
- public String getDescription(java.util.Locale loc)
- {
- return "GdkPixbuf Writer SPI";
- }
-
- }
-
- public static class GdkPixbufReaderSpi extends ImageReaderSpi
- {
- public GdkPixbufReaderSpi()
- {
- super("GdkPixbuf", "2.x",
- GdkPixbufDecoder.getFormatNames(false),
- GdkPixbufDecoder.getFormatExtensions(false),
- GdkPixbufDecoder.getFormatMimeTypes(false),
- "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufReader",
- new Class[] { ImageInputStream.class },
- new String[] { "gnu.java.awt.peer.gtk.GdkPixbufDecoder$GdkPixbufWriterSpi" },
- false, null, null, null, null,
- false, null, null, null, null);
- }
-
- public boolean canDecodeInput(Object obj)
- {
- return true;
- }
-
- public ImageReader createReaderInstance(Object ext)
- {
- return new GdkPixbufReader(this, ext);
- }
-
- public String getDescription(Locale loc)
- {
- return "GdkPixbuf Reader SPI";
- }
- }
-
- private static class GdkPixbufWriter
- extends ImageWriter
- {
- String ext;
- public GdkPixbufWriter(GdkPixbufWriterSpi ownerSpi, Object ext)
- {
- super(ownerSpi);
- this.ext = findFormatName(ext, true);
- }
-
- public IIOMetadata convertImageMetadata (IIOMetadata inData,
- ImageTypeSpecifier imageType,
- ImageWriteParam param)
- {
- return null;
- }
-
- public IIOMetadata convertStreamMetadata (IIOMetadata inData,
- ImageWriteParam param)
- {
- return null;
- }
-
- public IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType,
- ImageWriteParam param)
- {
- return null;
- }
-
- public IIOMetadata getDefaultStreamMetadata (ImageWriteParam param)
- {
- return null;
- }
-
- public void write (IIOMetadata streamMetadata, IIOImage i, ImageWriteParam param)
- throws IOException
- {
- RenderedImage image = i.getRenderedImage();
- Raster ras = image.getData();
- int width = ras.getWidth();
- int height = ras.getHeight();
- ColorModel model = image.getColorModel();
- int[] pixels = GdkGraphics2D.findSimpleIntegerArray (image.getColorModel(), ras);
-
- if (pixels == null)
- {
- BufferedImage img = new BufferedImage(width, height,
- (model != null && model.hasAlpha() ?
- BufferedImage.TYPE_INT_ARGB
- : BufferedImage.TYPE_INT_RGB));
- int[] pix = new int[4];
- for (int y = 0; y < height; ++y)
- for (int x = 0; x < width; ++x)
- img.setRGB(x, y, model.getRGB(ras.getPixel(x, y, pix)));
- pixels = GdkGraphics2D.findSimpleIntegerArray (img.getColorModel(),
- img.getRaster());
- model = img.getColorModel();
- }
-
- processImageStarted(1);
- streamImage(pixels, this.ext, width, height, model.hasAlpha(),
- (DataOutput) this.getOutput());
- processImageComplete();
- }
- }
-
- private static class GdkPixbufReader
- extends ImageReader
- implements ImageConsumer
- {
- // ImageConsumer parts
- GdkPixbufDecoder dec;
- BufferedImage bufferedImage;
- ColorModel defaultModel;
- int width;
- int height;
- String ext;
-
- public GdkPixbufReader(GdkPixbufReaderSpi ownerSpi, Object ext)
- {
- super(ownerSpi);
- this.ext = findFormatName(ext, false);
- }
-
- public GdkPixbufReader(GdkPixbufReaderSpi ownerSpi, Object ext, GdkPixbufDecoder d)
- {
- this(ownerSpi, ext);
- dec = d;
- }
-
- public void setDimensions(int w, int h)
- {
- processImageStarted(1);
- width = w;
- height = h;
- }
-
- public void setProperties(Hashtable props) {}
-
- public void setColorModel(ColorModel model)
- {
- defaultModel = model;
- }
-
- public void setHints(int flags) {}
-
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels,
- int offset, int scansize)
- {
- }
-
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels,
- int offset, int scansize)
- {
- if (model == null)
- model = defaultModel;
-
- if (bufferedImage == null)
- {
- bufferedImage = new BufferedImage (width, height, (model != null && model.hasAlpha() ?
- BufferedImage.TYPE_INT_ARGB
- : BufferedImage.TYPE_INT_RGB));
- }
-
- int pixels2[];
- if (model != null)
- {
- pixels2 = new int[pixels.length];
- for (int yy = 0; yy < h; yy++)
- for (int xx = 0; xx < w; xx++)
- {
- int i = yy * scansize + xx;
- pixels2[i] = model.getRGB (pixels[i]);
- }
- }
- else
- pixels2 = pixels;
-
- bufferedImage.setRGB (x, y, w, h, pixels2, offset, scansize);
- processImageProgress(y / (height == 0 ? 1 : height));
- }
-
- public void imageComplete(int status)
- {
- processImageComplete();
- }
-
- public BufferedImage getBufferedImage()
- {
- if (bufferedImage == null && dec != null)
- dec.startProduction (this);
- return bufferedImage;
- }
-
- // ImageReader parts
-
- public int getNumImages(boolean allowSearch)
- throws IOException
- {
- return 1;
- }
-
- public IIOMetadata getImageMetadata(int i)
- {
- return null;
- }
-
- public IIOMetadata getStreamMetadata()
- throws IOException
- {
- return null;
- }
-
- public Iterator getImageTypes(int imageIndex)
- throws IOException
- {
- BufferedImage img = getBufferedImage();
- Vector vec = new Vector();
- vec.add(new ImageTypeSpecifier(img));
- return vec.iterator();
- }
-
- public int getHeight(int imageIndex)
- throws IOException
- {
- return getBufferedImage().getHeight();
- }
-
- public int getWidth(int imageIndex)
- throws IOException
- {
- return getBufferedImage().getWidth();
- }
-
- public void setInput(Object input,
- boolean seekForwardOnly,
- boolean ignoreMetadata)
- {
- super.setInput(input, seekForwardOnly, ignoreMetadata);
- dec = new GdkPixbufDecoder((InputStream) getInput());
- }
-
- public BufferedImage read(int imageIndex, ImageReadParam param)
- throws IOException
- {
- return getBufferedImage ();
- }
- }
-
- // remaining helper class and static method is a convenience for the Gtk
- // peers, for loading a BufferedImage in off a disk file without going
- // through the whole imageio system.
-
- public static BufferedImage createBufferedImage (String filename)
- {
- GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(),
- "png", // reader auto-detects, doesn't matter
- new GdkPixbufDecoder (filename));
- return r.getBufferedImage ();
- }
-
- public static BufferedImage createBufferedImage (URL u)
- {
- GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(),
- "png", // reader auto-detects, doesn't matter
- new GdkPixbufDecoder (u));
- return r.getBufferedImage ();
- }
-
- public static BufferedImage createBufferedImage (byte[] imagedata, int imageoffset,
- int imagelength)
- {
- GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(),
- "png", // reader auto-detects, doesn't matter
- new GdkPixbufDecoder (imagedata,
- imageoffset,
- imagelength));
- return r.getBufferedImage ();
- }
-
- public static BufferedImage createBufferedImage (ImageProducer producer)
- {
- GdkPixbufReader r = new GdkPixbufReader (getReaderSpi(), "png" /* ignored */, null);
- producer.startProduction(r);
- return r.getBufferedImage ();
- }
-
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkRobotPeer.java b/libjava/gnu/java/awt/peer/gtk/GdkRobotPeer.java
deleted file mode 100644
index 6d0218d057a..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkRobotPeer.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* GdkRobot.java -- an XTest implementation of RobotPeer
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.AWTException;
-import java.awt.GraphicsDevice;
-import java.awt.Rectangle;
-import java.awt.image.ColorModel;
-import java.awt.image.DirectColorModel;
-import java.awt.peer.RobotPeer;
-
-/**
- * Implements the RobotPeer interface using the XTest extension.
- *
- * @author Thomas Fitzsimmons
- */
-public class GdkRobotPeer implements RobotPeer
-{
- // gdk-pixbuf provides data in RGBA format
- static final ColorModel cm = new DirectColorModel (32, 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff);
-
- public GdkRobotPeer (GraphicsDevice screen) throws AWTException
- {
- // FIXME: make use of screen parameter when GraphicsDevice is
- // implemented.
- if (!initXTest ())
- throw new AWTException ("XTest extension not supported");
- }
-
- native boolean initXTest ();
-
- // RobotPeer methods
- public native void mouseMove (int x, int y);
- public native void mousePress (int buttons);
- public native void mouseRelease (int buttons);
- public native void mouseWheel (int wheelAmt);
- public native void keyPress (int keycode);
- public native void keyRelease (int keycode);
- native int[] nativeGetRGBPixels (int x, int y, int width, int height);
-
- public int getRGBPixel (int x, int y)
- {
- return cm.getRGB (nativeGetRGBPixels (x, y, 1, 1)[0]);
- }
-
- public int[] getRGBPixels (Rectangle r)
- {
- int[] gdk_pixels = nativeGetRGBPixels (r.x, r.y, r.width, r.height);
- int[] pixels = new int[r.width * r.height];
-
- for (int i = 0; i < r.width * r.height; i++)
- pixels[i] = cm.getRGB (gdk_pixels[i]);
-
- return pixels;
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/libjava/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
deleted file mode 100644
index 2bf9d23db94..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/* GdkScreenGraphicsDevice.java -- information about a screen device
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Dimension;
-import java.awt.DisplayMode;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-
-public class GdkScreenGraphicsDevice extends GraphicsDevice
-{
- GdkGraphicsEnvironment env;
-
- public GtkToolkit getToolkit()
- {
- return env.getToolkit();
- }
-
- public GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
- {
- super ();
- env = e;
- }
-
- public int getType ()
- {
- return GraphicsDevice.TYPE_RASTER_SCREEN;
- }
-
- public String getIDstring ()
- {
- // FIXME: query X for this string
- return "default GDK device ID string";
- }
-
- public GraphicsConfiguration[] getConfigurations ()
- {
- // FIXME: query X for the list of possible configurations
- return new GraphicsConfiguration [] { new GdkGraphicsConfiguration(this) };
- }
-
- public GraphicsConfiguration getDefaultConfiguration ()
- {
-
- // FIXME: query X for default configuration
- return new GdkGraphicsConfiguration(this);
- }
-
-
- /**
- * Returns the current display mode of this device, or null if unknown.
- *
- * @return the current display mode
- * @see #setDisplayMode(DisplayMode)
- * @see #getDisplayModes()
- * @since 1.4
- */
- public DisplayMode getDisplayMode()
- {
- // determine display mode
- Dimension dim = getToolkit().getScreenSize();
- DisplayMode mode = new DisplayMode(dim.width, dim.height, 0,
- DisplayMode.REFRESH_RATE_UNKNOWN);
- return mode;
- }
-
- /**
- * This device does not yet support fullscreen exclusive mode, so this
- * returns false
.
- *
- * @return false
- * @since 1.4
- */
- public boolean isFullScreenSupported()
- {
- return false;
- }
-
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java b/libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java
deleted file mode 100644
index ff51745f26c..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GdkTextLayout.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/* GdkTextLayout.java
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.classpath.Configuration;
-import gnu.java.awt.peer.ClasspathTextLayoutPeer;
-
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphMetrics;
-import java.awt.font.GlyphVector;
-import java.awt.font.TextAttribute;
-import java.awt.font.TextHitInfo;
-import java.awt.font.TextLayout;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-import java.awt.geom.Rectangle2D;
-import java.text.AttributedCharacterIterator;
-import java.text.AttributedString;
-import java.text.CharacterIterator;
-
-/**
- * This is an implementation of the text layout peer interface which
- * delegates all the hard work to pango.
- *
- * @author Graydon Hoare
- */
-
-public class GdkTextLayout
- implements ClasspathTextLayoutPeer
-{
- // native side, plumbing, etc.
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
- initStaticState ();
- }
- private native void setText(String str);
- private native void getExtents(double[] inkExtents,
- double[] logExtents);
- private native void indexToPos(int idx, double[] pos);
- private native void initState ();
- private native void dispose ();
- static native void initStaticState();
- private final int native_state = GtkGenericPeer.getUniqueInteger ();
- protected void finalize ()
- {
- dispose ();
- }
-
- // we hold on to these to make sure we can render when presented
- // with non-GdkGraphics2D paint targets
- private AttributedString attributedString;
- private FontRenderContext fontRenderContext;
-
- public GdkTextLayout(AttributedString str, FontRenderContext frc)
- {
- initState();
- attributedString = str;
- fontRenderContext = frc;
- }
-
- protected class CharacterIteratorProxy
- implements CharacterIterator
- {
- public CharacterIterator target;
- public int begin;
- public int limit;
- public int index;
-
- public CharacterIteratorProxy (CharacterIterator ci)
- {
- target = ci;
- }
-
- public int getBeginIndex ()
- {
- return begin;
- }
-
- public int getEndIndex ()
- {
- return limit;
- }
-
- public int getIndex ()
- {
- return index;
- }
-
- public char setIndex (int idx)
- throws IllegalArgumentException
- {
- if (idx < begin || idx >= limit)
- throw new IllegalArgumentException ();
- char ch = target.setIndex (idx);
- index = idx;
- return ch;
- }
-
- public char first ()
- {
- int save = target.getIndex ();
- char ch = target.setIndex (begin);
- target.setIndex (save);
- return ch;
- }
-
- public char last ()
- {
- if (begin == limit)
- return this.first ();
-
- int save = target.getIndex ();
- char ch = target.setIndex (limit - 1);
- target.setIndex (save);
- return ch;
- }
-
- public char current ()
- {
- return target.current();
- }
-
- public char next ()
- {
- if (index >= limit - 1)
- return CharacterIterator.DONE;
- else
- {
- index++;
- return target.next();
- }
- }
-
- public char previous ()
- {
- if (index <= begin)
- return CharacterIterator.DONE;
- else
- {
- index--;
- return target.previous ();
- }
- }
-
- public Object clone ()
- {
- CharacterIteratorProxy cip = new CharacterIteratorProxy (this.target);
- cip.begin = this.begin;
- cip.limit = this.limit;
- cip.index = this.index;
- return cip;
- }
-
- }
-
-
- // public side
-
- public void draw (Graphics2D g2, float x, float y)
- {
- if (g2 instanceof GdkGraphics2D)
- {
- // we share pango structures directly with GdkGraphics2D
- // when legal
- GdkGraphics2D gg2 = (GdkGraphics2D) g2;
- gg2.drawGdkTextLayout(this, x, y);
- }
- else
- {
- // falling back to a rather tedious layout algorithm when
- // not legal
- AttributedCharacterIterator ci = attributedString.getIterator ();
- CharacterIteratorProxy proxy = new CharacterIteratorProxy (ci);
- Font defFont = g2.getFont ();
-
- /* Note: this implementation currently only interprets FONT text
- * attributes. There is a reasonable argument to be made for some
- * attributes being interpreted out here, where we have control of the
- * Graphics2D and can construct or derive new fonts, and some
- * attributes being interpreted by the GlyphVector itself. So far, for
- * all attributes except FONT we do neither.
- */
-
- for (char c = ci.first ();
- c != CharacterIterator.DONE;
- c = ci.next ())
- {
- proxy.begin = ci.getIndex ();
- proxy.limit = ci.getRunLimit(TextAttribute.FONT);
- if (proxy.limit <= proxy.begin)
- continue;
-
- proxy.index = proxy.begin;
-
- Object fnt = ci.getAttribute(TextAttribute.FONT);
- GlyphVector gv;
- if (fnt instanceof Font)
- gv = ((Font)fnt).createGlyphVector (fontRenderContext, proxy);
- else
- gv = defFont.createGlyphVector (fontRenderContext, proxy);
-
- g2.drawGlyphVector (gv, x, y);
-
- int n = gv.getNumGlyphs ();
- for (int i = 0; i < n; ++i)
- {
- GlyphMetrics gm = gv.getGlyphMetrics (i);
- if (gm.getAdvanceX() == gm.getAdvance ())
- x += gm.getAdvanceX ();
- else
- y += gm.getAdvanceY ();
- }
- }
- }
- }
-
- public TextHitInfo getStrongCaret (TextHitInfo hit1,
- TextHitInfo hit2)
- {
- throw new Error("not implemented");
- }
-
- public byte getBaseline ()
- {
- throw new Error("not implemented");
- }
-
- public boolean isLeftToRight ()
- {
- throw new Error("not implemented");
- }
-
- public boolean isVertical ()
- {
- throw new Error("not implemented");
- }
-
- public float getAdvance ()
- {
- throw new Error("not implemented");
- }
-
- public float getAscent ()
- {
- throw new Error("not implemented");
- }
-
- public float getDescent ()
- {
- throw new Error("not implemented");
- }
-
- public float getLeading ()
- {
- throw new Error("not implemented");
- }
-
- public int getCharacterCount ()
- {
- throw new Error("not implemented");
- }
-
- public byte getCharacterLevel (int index)
- {
- throw new Error("not implemented");
- }
-
- public float[] getBaselineOffsets ()
- {
- throw new Error("not implemented");
- }
-
- public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
- {
- throw new Error("not implemented");
- }
-
- public Rectangle2D getBounds ()
- {
- double[] inkExtents = new double[4];
- double[] logExtents = new double[4];
- getExtents(inkExtents, logExtents);
- return new Rectangle2D.Double(logExtents[0], logExtents[1],
- logExtents[2], logExtents[3]);
- }
-
- public float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds)
- {
- throw new Error("not implemented");
- }
-
- public Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds)
- {
- throw new Error("not implemented");
- }
-
- public Shape[] getCaretShapes (int offset, Rectangle2D bounds,
- TextLayout.CaretPolicy policy)
- {
- throw new Error("not implemented");
- }
-
- public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
- Rectangle2D bounds)
- {
- AffineTransform at = new AffineTransform();
- GeneralPath gp = new GeneralPath();
- double [] rect = new double[4];
- Rectangle2D tmp = new Rectangle2D.Double();
- for (int i = firstEndpoint; i <= secondEndpoint; ++i)
- {
- indexToPos(i, rect);
- tmp.setRect(rect[0], rect[1], rect[2], rect[3]);
- Rectangle2D.intersect(tmp, bounds, tmp);
- gp.append(tmp.getPathIterator(at), false);
- }
- return gp;
- }
-
- public int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
- TextHitInfo secondEndpoint)
- {
- throw new Error("not implemented");
- }
-
- public TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy)
- {
- throw new Error("not implemented");
- }
- public TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy)
- {
- throw new Error("not implemented");
- }
- public TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds)
- {
- throw new Error("not implemented");
- }
- public TextHitInfo getVisualOtherHit (TextHitInfo hit)
- {
- throw new Error("not implemented");
- }
-
- public float getVisibleAdvance ()
- {
- throw new Error("not implemented");
- }
-
- public Shape getOutline (AffineTransform tx)
- {
- throw new Error("not implemented");
- }
-
- public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
- TextHitInfo secondEndpoint,
- Rectangle2D bounds)
- {
- throw new Error("not implemented");
- }
-
-
- public TextLayout getJustifiedLayout (float justificationWidth)
- {
- throw new Error("not implemented");
- }
-
- public void handleJustify (float justificationWidth)
- {
- throw new Error("not implemented");
- }
-
- public Object clone ()
- {
- throw new Error("not implemented");
- }
-
- public int hashCode ()
- {
- throw new Error("not implemented");
- }
-
- public boolean equals (ClasspathTextLayoutPeer tl)
- {
- throw new Error("not implemented");
- }
-
- public String toString ()
- {
- throw new Error("not implemented");
- }
-
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
deleted file mode 100644
index ab5df9f463f..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* GtkButtonPeer.java -- Implements ButtonPeer with GTK
- Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.AWTEvent;
-import java.awt.Button;
-import java.awt.Component;
-import java.awt.Point;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.awt.peer.ButtonPeer;
-
-public class GtkButtonPeer extends GtkComponentPeer
- implements ButtonPeer
-{
- native void create (String label);
-
- public native void connectSignals ();
-
- native void gtkWidgetModifyFont (String name, int style, int size);
- native void gtkSetLabel (String label);
- native void gtkWidgetSetForeground (int red, int green, int blue);
- native void gtkWidgetSetBackground (int red, int green, int blue);
- native void gtkActivate ();
- native void gtkWidgetRequestFocus ();
- native void setNativeBounds (int x, int y, int width, int height);
-
- public GtkButtonPeer (Button b)
- {
- super (b);
- }
-
- void create ()
- {
- create (((Button) awtComponent).getLabel ());
- }
-
- public void setLabel (String label)
- {
- gtkSetLabel(label);
- }
-
- public void handleEvent (AWTEvent e)
- {
- if (e.getID () == MouseEvent.MOUSE_RELEASED && isEnabled ())
- {
- MouseEvent me = (MouseEvent) e;
- Point p = me.getPoint();
- p.translate(((Component) me.getSource()).getX(),
- ((Component) me.getSource()).getY());
- if (!me.isConsumed ()
- && (me.getModifiersEx () & MouseEvent.BUTTON1_DOWN_MASK) != 0
- && awtComponent.getBounds().contains(p))
- postActionEvent (((Button) awtComponent).getActionCommand (),
- me.getModifiersEx ());
- }
-
- if (e.getID () == KeyEvent.KEY_PRESSED)
- {
- KeyEvent ke = (KeyEvent) e;
- if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_SPACE)
- {
- postActionEvent (((Button) awtComponent).getActionCommand (),
- ke.getModifiersEx ());
- gtkActivate ();
- }
- }
-
- super.handleEvent (e);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
deleted file mode 100644
index dc21761209e..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* GtkCanvasPeer.java
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.AWTEvent;
-import java.awt.Canvas;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.event.PaintEvent;
-import java.awt.peer.CanvasPeer;
-
-public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer
-{
- native void create ();
-
- public GtkCanvasPeer (Canvas c)
- {
- super (c);
- }
-
- public Graphics getGraphics ()
- {
- if (GtkToolkit.useGraphics2D ())
- return new GdkGraphics2D (this);
- else
- return new GdkGraphics (this);
- }
-
- public void handleEvent (AWTEvent event)
- {
- int id = event.getID();
-
- switch (id)
- {
- case PaintEvent.PAINT:
- case PaintEvent.UPDATE:
- {
- try
- {
- Graphics g = getGraphics ();
- g.setClip (((PaintEvent)event).getUpdateRect());
-
- if (id == PaintEvent.PAINT)
- awtComponent.paint (g);
- else
- awtComponent.update (g);
-
- g.dispose ();
- }
- catch (InternalError e)
- {
- System.err.println (e);
- }
- }
- break;
- }
- }
-
- /* Preferred size for a drawing widget is always what the user requested */
- public Dimension getPreferredSize ()
- {
- return awtComponent.getSize ();
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java
deleted file mode 100644
index 46b0733d363..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/* GtkCheckboxGroupPeer.java - Wrap a CheckboxGroup
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.CheckboxGroup;
-import java.util.WeakHashMap;
-
-// Note that there is no peer interface for a CheckboxGroup. We
-// introduce our own in order to make it easier to keep a piece of
-// native state for each one.
-public class GtkCheckboxGroupPeer extends GtkGenericPeer
-{
- // This maps from a CheckboxGroup to the native peer.
- private static WeakHashMap map = new WeakHashMap ();
-
- // Find the native peer corresponding to a CheckboxGroup.
- public static synchronized GtkCheckboxGroupPeer
- getCheckboxGroupPeer (CheckboxGroup group)
- {
- if (group == null)
- return null;
- GtkCheckboxGroupPeer nat = (GtkCheckboxGroupPeer) map.get (group);
- if (nat == null)
- {
- nat = new GtkCheckboxGroupPeer ();
- map.put (group, nat);
- }
- return nat;
- }
-
- private GtkCheckboxGroupPeer ()
- {
- // We don't need any special state here. Note that we can't store
- // a reference to the java-side CheckboxGroup. That would mean
- // they could never be collected.
- super (null);
- }
-
- // Dispose of our native resources.
- public native void dispose ();
-
- // Remove a given checkbox from this group.
- public native void remove (GtkCheckboxPeer box);
-
- // When collected, clean up the native state.
- protected void finalize ()
- {
- dispose ();
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
deleted file mode 100644
index 01a6e3102d9..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GtkCheckboxMenuItemPeer.java -- Implements CheckboxMenuItemPeer with GTK+
- Copyright (C) 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.CheckboxMenuItem;
-import java.awt.ItemSelectable;
-import java.awt.event.ItemEvent;
-import java.awt.peer.CheckboxMenuItemPeer;
-
-public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer
- implements CheckboxMenuItemPeer
-{
- native void create (String label);
-
- public GtkCheckboxMenuItemPeer (CheckboxMenuItem menu)
- {
- super (menu);
- setState (menu.getState ());
- }
-
- public native void setState(boolean t);
-
- protected void postMenuActionEvent ()
- {
- CheckboxMenuItem item = (CheckboxMenuItem)awtWidget;
- q().postEvent (new ItemEvent ((ItemSelectable)awtWidget,
- ItemEvent.ITEM_STATE_CHANGED,
- item.getActionCommand(),
- item.getState() ? ItemEvent.DESELECTED : ItemEvent.SELECTED));
-
- super.postMenuActionEvent();
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
deleted file mode 100644
index 851757245aa..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK
- Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Checkbox;
-import java.awt.CheckboxGroup;
-import java.awt.peer.CheckboxPeer;
-
-public class GtkCheckboxPeer extends GtkComponentPeer
- implements CheckboxPeer
-{
- // Group from last time it was set.
- public GtkCheckboxGroupPeer old_group;
- // The current state of the GTK checkbox.
- private boolean currentState;
-
- public native void create (GtkCheckboxGroupPeer group);
- public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
- public native void connectSignals ();
- native void gtkWidgetModifyFont (String name, int style, int size);
- native void gtkButtonSetLabel (String label);
- native void gtkToggleButtonSetActive (boolean is_active);
-
- public GtkCheckboxPeer (Checkbox c)
- {
- super (c);
- }
-
- // FIXME: we must be able to switch between a checkbutton and a
- // radiobutton dynamically.
- public void create ()
- {
- Checkbox checkbox = (Checkbox) awtComponent;
- CheckboxGroup g = checkbox.getCheckboxGroup ();
- old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);
- create (old_group);
- gtkToggleButtonSetActive (checkbox.getState ());
- gtkButtonSetLabel (checkbox.getLabel ());
- }
-
- public void setState (boolean state)
- {
- if (currentState != state)
- gtkToggleButtonSetActive (state);
- }
-
- public void setLabel (String label)
- {
- gtkButtonSetLabel (label);
- }
-
- public void setCheckboxGroup (CheckboxGroup group)
- {
- GtkCheckboxGroupPeer gp
- = GtkCheckboxGroupPeer.getCheckboxGroupPeer (group);
- if (gp != old_group)
- {
- if (old_group != null)
- old_group.remove (this);
- nativeSetCheckboxGroup (gp);
- old_group = gp;
- }
- }
-
- // Override the superclass postItemEvent so that the peer doesn't
- // need information that we have.
- public void postItemEvent (Object item, int stateChange)
- {
- Checkbox currentCheckBox = ((Checkbox)awtComponent);
- // A firing of the event is only desired if the state has changed due to a
- // button press. The currentCheckBox's state must be different from the
- // one that the stateChange is changing to.
- // stateChange = 1 if it goes from false -> true
- // stateChange = 2 if it goes from true -> false
- if (( !currentCheckBox.getState() && stateChange == 1)
- || (currentCheckBox.getState() && stateChange == 2))
- {
- super.postItemEvent (awtComponent, stateChange);
- currentState = !currentCheckBox.getState();
- currentCheckBox.setState(currentState);
- }
- }
-
- public void dispose ()
- {
- // Notify the group so that the native state can be cleaned up
- // appropriately.
- if (old_group != null)
- old_group.remove (this);
- super.dispose ();
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
deleted file mode 100644
index 6260b58e0e6..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/* GtkChoicePeer.java -- Implements ChoicePeer with GTK
- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Choice;
-import java.awt.event.ItemEvent;
-import java.awt.peer.ChoicePeer;
-
-public class GtkChoicePeer extends GtkComponentPeer
- implements ChoicePeer
-{
- public GtkChoicePeer (Choice c)
- {
- super (c);
-
- int count = c.getItemCount ();
- if (count > 0)
- {
- String items[] = new String[count];
- for (int i = 0; i < count; i++)
- items[i] = c.getItem (i);
-
- append (items);
- }
-
- int selected = c.getSelectedIndex();
- if (selected >= 0)
- select(selected);
- }
-
- native void create ();
-
- native void append (String items[]);
- native int nativeGetSelected ();
- native void nativeAdd (String item, int index);
- native void nativeRemove (int index);
- native void nativeRemoveAll ();
-
- public native void select (int position);
-
- public void add (String item, int index)
- {
- int before = nativeGetSelected();
-
- nativeAdd (item, index);
-
- /* Generate an ItemEvent if we added the first one or
- if we inserted at or before the currently selected item. */
- if ((before < 0) || (before >= index))
- {
- // Must set our state before notifying listeners
- ((Choice) awtComponent).select (((Choice) awtComponent).getItem (0));
- postItemEvent (((Choice) awtComponent).getItem (0), ItemEvent.SELECTED);
- }
- }
-
- public void remove (int index)
- {
- int before = nativeGetSelected();
- int after;
-
- nativeRemove (index);
- after = nativeGetSelected();
-
- /* Generate an ItemEvent if we are removing the currently selected item
- and there are at least one item left. */
- if ((before == index) && (after >= 0))
- {
- // Must set our state before notifying listeners
- ((Choice) awtComponent).select (((Choice) awtComponent).getItem (0));
- postItemEvent (((Choice) awtComponent).getItem (0), ItemEvent.SELECTED);
- }
- }
-
- public void removeAll ()
- {
- nativeRemoveAll();
- }
-
- public void addItem (String item, int position)
- {
- add (item, position);
- }
-
- protected void choicePostItemEvent (String label, int stateChange)
- {
- // Must set our state before notifying listeners
- if (stateChange == ItemEvent.SELECTED)
- ((Choice) awtComponent).select (label);
- postItemEvent (label, stateChange);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java b/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
deleted file mode 100644
index c719cddb575..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/* GtkClipboard.java
- Copyright (C) 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.ClipboardOwner;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class GtkClipboard extends Clipboard
-{
- /* the number of milliseconds that we'll wait around for the
- owner of the GDK_SELECTION_PRIMARY selection to convert
- the requested data */
- static final int SELECTION_RECEIVED_TIMEOUT = 5000;
-
- /* We currently only support transferring of text between applications */
- static String selection;
- static Object selectionLock = new Object ();
-
- static boolean hasSelection = false;
-
- protected GtkClipboard()
- {
- super("System Clipboard");
- initNativeState();
- }
-
- public Transferable getContents(Object requestor)
- {
- synchronized (this)
- {
- if (hasSelection)
- return contents;
- }
-
- /* Java doesn't own the selection, so we need to ask X11 */
- // XXX: Does this hold with Swing too ?
- synchronized (selectionLock)
- {
- requestStringConversion();
-
- try
- {
- selectionLock.wait(SELECTION_RECEIVED_TIMEOUT);
- }
- catch (InterruptedException e)
- {
- return null;
- }
-
- return selection == null ? null : new StringSelection(selection);
- }
- }
-
- void stringSelectionReceived(String newSelection)
- {
- synchronized (selectionLock)
- {
- selection = newSelection;
- selectionLock.notify();
- }
- }
-
- /* convert Java clipboard data into a String suitable for sending
- to another application */
- synchronized String stringSelectionHandler() throws IOException
- {
- String selection = null;
-
- try
- {
- if (contents.isDataFlavorSupported(DataFlavor.stringFlavor))
- selection = (String)contents.getTransferData(DataFlavor.stringFlavor);
- else if (contents.isDataFlavorSupported(DataFlavor.plainTextFlavor))
- {
- StringBuffer sbuf = new StringBuffer();
- InputStreamReader reader;
- char readBuf[] = new char[512];
- int numChars;
-
- reader = new InputStreamReader
- ((InputStream)
- contents.getTransferData(DataFlavor.plainTextFlavor), "UNICODE");
-
- while (true)
- {
- numChars = reader.read(readBuf);
- if (numChars == -1)
- break;
- sbuf.append(readBuf, 0, numChars);
- }
-
- selection = new String(sbuf);
- }
- }
- catch (Exception e)
- {
- }
-
- return selection;
- }
-
- public synchronized void setContents(Transferable contents,
- ClipboardOwner owner)
- {
- selectionGet();
-
- this.contents = contents;
- this.owner = owner;
-
- hasSelection = true;
- }
-
- synchronized void selectionClear()
- {
- hasSelection = false;
-
- if (owner != null)
- {
- owner.lostOwnership(this, contents);
- owner = null;
- contents = null;
- }
- }
-
- native void initNativeState();
- static native void requestStringConversion();
- static native void selectionGet();
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
deleted file mode 100644
index 61dbaadf054..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ /dev/null
@@ -1,662 +0,0 @@
-/* GtkComponentPeer.java -- Implements ComponentPeer with GTK
- Copyright (C) 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.AWTEvent;
-import java.awt.AWTException;
-import java.awt.BufferCapabilities;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.Image;
-import java.awt.Insets;
-import java.awt.ItemSelectable;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
-import java.awt.Window;
-import java.awt.event.FocusEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.PaintEvent;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.image.VolatileImage;
-import java.awt.peer.ComponentPeer;
-
-public class GtkComponentPeer extends GtkGenericPeer
- implements ComponentPeer
-{
- VolatileImage backBuffer;
- BufferCapabilities caps;
-
- Component awtComponent;
-
- Insets insets;
-
- boolean isInRepaint;
-
- /* this isEnabled differs from Component.isEnabled, in that it
- knows if a parent is disabled. In that case Component.isEnabled
- may return true, but our isEnabled will always return false */
- native boolean isEnabled ();
- static native boolean modalHasGrab();
-
- native int[] gtkWidgetGetForeground ();
- native int[] gtkWidgetGetBackground ();
- native void gtkWidgetGetDimensions (int[] dim);
- native void gtkWidgetGetPreferredDimensions (int[] dim);
- native void gtkWidgetGetLocationOnScreen (int[] point);
- native void gtkWidgetSetCursor (int type);
- native void gtkWidgetSetBackground (int red, int green, int blue);
- native void gtkWidgetSetForeground (int red, int green, int blue);
- native void gtkWidgetSetSensitive (boolean sensitive);
- native void gtkWidgetSetParent (ComponentPeer parent);
- native void gtkWidgetRequestFocus ();
- native void gtkWidgetDispatchKeyEvent (int id, long when, int mods,
- int keyCode, int keyLocation);
-
- native boolean isRealized ();
-
- void create ()
- {
- throw new RuntimeException ();
- }
-
- native void connectSignals ();
-
- protected GtkComponentPeer (Component awtComponent)
- {
- super (awtComponent);
- this.awtComponent = awtComponent;
- insets = new Insets (0, 0, 0, 0);
-
- create ();
-
- connectSignals ();
-
- if (awtComponent.getForeground () != null)
- setForeground (awtComponent.getForeground ());
- if (awtComponent.getBackground () != null)
- setBackground (awtComponent.getBackground ());
- if (awtComponent.getFont() != null)
- setFont(awtComponent.getFont());
-
- Component parent = awtComponent.getParent ();
-
- // Only set our parent on the GTK side if our parent on the AWT
- // side is not showing. Otherwise the gtk peer will be shown
- // before we've had a chance to position and size it properly.
- if (awtComponent instanceof Window
- || (parent != null && ! parent.isShowing ()))
- setParentAndBounds ();
- }
-
- void setParentAndBounds ()
- {
- setParent ();
-
- setComponentBounds ();
-
- setVisibleAndEnabled ();
- }
-
- void setParent ()
- {
- ComponentPeer p;
- Component component = awtComponent;
- do
- {
- component = component.getParent ();
- p = component.getPeer ();
- }
- while (p instanceof java.awt.peer.LightweightPeer);
-
- if (p != null)
- gtkWidgetSetParent (p);
- }
-
- void beginNativeRepaint ()
- {
- isInRepaint = true;
- }
-
- void endNativeRepaint ()
- {
- isInRepaint = false;
- }
-
- /*
- * Set the bounds of this peer's AWT Component based on dimensions
- * returned by the native windowing system. Most Components impose
- * their dimensions on the peers which is what the default
- * implementation does. However some peers, like GtkFileDialogPeer,
- * need to pass their size back to the AWT Component.
- */
- void setComponentBounds ()
- {
- Rectangle bounds = awtComponent.getBounds ();
-
- if (bounds.x == 0 && bounds.y == 0
- && bounds.width == 0 && bounds.height == 0)
- return;
-
- setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
- }
-
- void setVisibleAndEnabled ()
- {
- setVisible (awtComponent.isVisible ());
- setEnabled (awtComponent.isEnabled ());
- }
-
- public int checkImage (Image image, int width, int height,
- ImageObserver observer)
- {
- GtkImage i = (GtkImage) image;
- return i.checkImage ();
- }
-
- public Image createImage (ImageProducer producer)
- {
- GtkImage image = new GtkImage (producer, null);
- producer.startProduction (image);
- return image;
- }
-
- public Image createImage (int width, int height)
- {
- Graphics g;
- if (GtkToolkit.useGraphics2D ())
- {
- Graphics2D g2 = new GdkGraphics2D (width, height);
- g2.setBackground (getBackground ());
- g = g2;
- }
- else
- g = new GdkGraphics (width, height);
-
- g.setColor(getBackground());
- g.fillRect(0, 0, width, height);
-
- return new GtkOffScreenImage (null, g, width, height);
- }
-
- public void disable ()
- {
- setEnabled (false);
- }
-
- public void enable ()
- {
- setEnabled (true);
- }
-
- public ColorModel getColorModel ()
- {
- return ColorModel.getRGBdefault ();
- }
-
- public FontMetrics getFontMetrics (Font font)
- {
- return getToolkit().getFontMetrics(font);
- }
-
- public Graphics getGraphics ()
- {
- if (GtkToolkit.useGraphics2D ())
- return new GdkGraphics2D (this);
- else
- return new GdkGraphics (this);
- }
-
- public Point getLocationOnScreen ()
- {
- int point[] = new int[2];
- gtkWidgetGetLocationOnScreen (point);
- return new Point (point[0], point[1]);
- }
-
- public Dimension getMinimumSize ()
- {
- return minimumSize ();
- }
-
- public Dimension getPreferredSize ()
- {
- return preferredSize ();
- }
-
- public Toolkit getToolkit ()
- {
- return Toolkit.getDefaultToolkit();
- }
-
- public void handleEvent (AWTEvent event)
- {
- int id = event.getID();
- KeyEvent ke = null;
-
- switch (id)
- {
- case PaintEvent.PAINT:
- case PaintEvent.UPDATE:
- {
- try
- {
- Graphics g = getGraphics ();
-
- // Some peers like GtkFileDialogPeer are repainted by Gtk itself
- if (g == null)
- break;
-
- g.setClip (((PaintEvent) event).getUpdateRect());
-
- if (id == PaintEvent.PAINT)
- awtComponent.paint (g);
- else
- awtComponent.update (g);
-
- g.dispose ();
- }
- catch (InternalError e)
- {
- System.err.println (e);
- }
- }
- break;
- case KeyEvent.KEY_PRESSED:
- ke = (KeyEvent) event;
- gtkWidgetDispatchKeyEvent (ke.getID (), ke.getWhen (), ke.getModifiersEx (),
- ke.getKeyCode (), ke.getKeyLocation ());
- break;
- case KeyEvent.KEY_RELEASED:
- ke = (KeyEvent) event;
- gtkWidgetDispatchKeyEvent (ke.getID (), ke.getWhen (), ke.getModifiersEx (),
- ke.getKeyCode (), ke.getKeyLocation ());
- break;
- }
- }
-
- public boolean isFocusTraversable ()
- {
- return true;
- }
-
- public Dimension minimumSize ()
- {
- int dim[] = new int[2];
-
- gtkWidgetGetPreferredDimensions (dim);
-
- return new Dimension (dim[0], dim[1]);
- }
-
- public void paint (Graphics g)
- {
- }
-
- public Dimension preferredSize ()
- {
- int dim[] = new int[2];
-
- gtkWidgetGetPreferredDimensions (dim);
-
- return new Dimension (dim[0], dim[1]);
- }
-
- public boolean prepareImage (Image image, int width, int height,
- ImageObserver observer)
- {
- GtkImage i = (GtkImage) image;
-
- if (i.isLoaded ()) return true;
-
- class PrepareImage extends Thread
- {
- GtkImage image;
- ImageObserver observer;
-
- PrepareImage (GtkImage image, ImageObserver observer)
- {
- this.image = image;
- image.setObserver (observer);
- }
-
- public void run ()
- {
- image.source.startProduction (image);
- }
- }
-
- new PrepareImage (i, observer).start ();
- return false;
- }
-
- public void print (Graphics g)
- {
- throw new RuntimeException ();
- }
-
- public void repaint (long tm, int x, int y, int width, int height)
- {
- if (x == 0 && y == 0 && width == 0 && height == 0)
- return;
-
- q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
- new Rectangle (x, y, width, height)));
- }
-
- public void requestFocus ()
- {
- gtkWidgetRequestFocus();
- postFocusEvent(FocusEvent.FOCUS_GAINED, false);
- }
-
- public void reshape (int x, int y, int width, int height)
- {
- setBounds (x, y, width, height);
- }
-
- public void setBackground (Color c)
- {
- gtkWidgetSetBackground (c.getRed(), c.getGreen(), c.getBlue());
- }
-
- native void setNativeBounds (int x, int y, int width, int height);
-
- public void setBounds (int x, int y, int width, int height)
- {
- Component parent = awtComponent.getParent ();
-
- // Heavyweight components that are children of one or more
- // lightweight containers have to be handled specially. Because
- // calls to GLightweightPeer.setBounds do nothing, GTK has no
- // knowledge of the lightweight containers' positions. So we have
- // to add the offsets manually when placing a heavyweight
- // component within a lightweight container. The lightweight
- // container may itself be in a lightweight container and so on,
- // so we need to continue adding offsets until we reach a
- // container whose position GTK knows -- that is, the first
- // non-lightweight.
- boolean lightweightChild = false;
- Insets i;
- while (parent.isLightweight ())
- {
- lightweightChild = true;
-
- i = ((Container) parent).getInsets ();
-
- x += parent.getX () + i.left;
- y += parent.getY () + i.top;
-
- parent = parent.getParent ();
- }
-
- // We only need to convert from Java to GTK coordinates if we're
- // placing a heavyweight component in a Window.
- if (parent instanceof Window && !lightweightChild)
- {
- Insets insets = ((Window) parent).getInsets ();
- GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer ();
- int menuBarHeight = 0;
- if (peer instanceof GtkFramePeer)
- menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight ();
-
- // Convert from Java coordinates to GTK coordinates.
- setNativeBounds (x - insets.left, y - insets.top + menuBarHeight,
- width, height);
- }
- else
- setNativeBounds (x, y, width, height);
- }
-
- void setCursor ()
- {
- setCursor (awtComponent.getCursor ());
- }
-
- public void setCursor (Cursor cursor)
- {
- gtkWidgetSetCursor (cursor.getType ());
- }
-
- public void setEnabled (boolean b)
- {
- gtkWidgetSetSensitive (b);
- }
-
- public void setFont (Font f)
- {
- // FIXME: This should really affect the widget tree below me.
- // Currently this is only handled if the call is made directly on
- // a text widget, which implements setFont() itself.
- gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize());
- }
-
- public void setForeground (Color c)
- {
- gtkWidgetSetForeground (c.getRed(), c.getGreen(), c.getBlue());
- }
-
- public Color getForeground ()
- {
- int rgb[] = gtkWidgetGetForeground ();
- return new Color (rgb[0], rgb[1], rgb[2]);
- }
-
- public Color getBackground ()
- {
- int rgb[] = gtkWidgetGetBackground ();
- return new Color (rgb[0], rgb[1], rgb[2]);
- }
-
- public void setVisible (boolean b)
- {
- if (b)
- show ();
- else
- hide ();
- }
-
- public native void hide ();
- public native void show ();
-
- protected void postMouseEvent(int id, long when, int mods, int x, int y,
- int clickCount, boolean popupTrigger)
- {
- q().postEvent(new MouseEvent(awtComponent, id, when, mods, x, y,
- clickCount, popupTrigger));
- }
-
- protected void postExposeEvent (int x, int y, int width, int height)
- {
- if (!isInRepaint)
- q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x, y, width, height)));
- }
-
- protected void postKeyEvent (int id, long when, int mods,
- int keyCode, char keyChar, int keyLocation)
- {
- KeyEvent keyEvent = new KeyEvent (awtComponent, id, when, mods,
- keyCode, keyChar, keyLocation);
-
- // Also post a KEY_TYPED event if keyEvent is a key press that
- // doesn't represent an action or modifier key.
- if (keyEvent.getID () == KeyEvent.KEY_PRESSED
- && (!keyEvent.isActionKey ()
- && keyCode != KeyEvent.VK_SHIFT
- && keyCode != KeyEvent.VK_CONTROL
- && keyCode != KeyEvent.VK_ALT))
- {
- synchronized (q)
- {
- q().postEvent (keyEvent);
- q().postEvent (new KeyEvent (awtComponent, KeyEvent.KEY_TYPED, when, mods,
- KeyEvent.VK_UNDEFINED, keyChar, keyLocation));
- }
- }
- else
- q().postEvent (keyEvent);
- }
-
- protected void postFocusEvent (int id, boolean temporary)
- {
- q().postEvent (new FocusEvent (awtComponent, id, temporary));
- }
-
- protected void postItemEvent (Object item, int stateChange)
- {
- q().postEvent (new ItemEvent ((ItemSelectable)awtComponent,
- ItemEvent.ITEM_STATE_CHANGED,
- item, stateChange));
- }
-
- public GraphicsConfiguration getGraphicsConfiguration ()
- {
- // FIXME: just a stub for now.
- return null;
- }
-
- public void setEventMask (long mask)
- {
- // FIXME: just a stub for now.
- }
-
- public boolean isFocusable ()
- {
- return false;
- }
-
- public boolean requestFocus (Component source, boolean b1,
- boolean b2, long x)
- {
- return false;
- }
-
- public boolean isObscured ()
- {
- return false;
- }
-
- public boolean canDetermineObscurity ()
- {
- return false;
- }
-
- public void coalescePaintEvent (PaintEvent e)
- {
-
- }
-
- public void updateCursorImmediately ()
- {
-
- }
-
- public boolean handlesWheelScrolling ()
- {
- return false;
- }
-
- // Convenience method to create a new volatile image on the screen
- // on which this component is displayed.
- public VolatileImage createVolatileImage (int width, int height)
- {
- return new GtkVolatileImage (width, height);
- }
-
- // Creates buffers used in a buffering strategy.
- public void createBuffers (int numBuffers, BufferCapabilities caps)
- throws AWTException
- {
- // numBuffers == 2 implies double-buffering, meaning one back
- // buffer and one front buffer.
- if (numBuffers == 2)
- backBuffer = new GtkVolatileImage(awtComponent.getWidth(),
- awtComponent.getHeight(),
- caps.getBackBufferCapabilities());
- else
- throw new AWTException("GtkComponentPeer.createBuffers:"
- + " multi-buffering not supported");
- this.caps = caps;
- }
-
- // Return the back buffer.
- public Image getBackBuffer ()
- {
- return backBuffer;
- }
-
- // FIXME: flip should be implemented as a fast native operation
- public void flip (BufferCapabilities.FlipContents contents)
- {
- getGraphics().drawImage(backBuffer,
- awtComponent.getWidth(),
- awtComponent.getHeight(),
- null);
-
- // create new back buffer and clear it to the background color.
- if (contents == BufferCapabilities.FlipContents.BACKGROUND)
- {
- backBuffer = createVolatileImage(awtComponent.getWidth(),
- awtComponent.getHeight());
- backBuffer.getGraphics().clearRect(0, 0,
- awtComponent.getWidth(),
- awtComponent.getHeight());
- }
- // FIXME: support BufferCapabilities.FlipContents.PRIOR
- }
-
- // Release the resources allocated to back buffers.
- public void destroyBuffers ()
- {
- backBuffer.flush();
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
deleted file mode 100644
index e4d033fc2f6..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/* GtkContainerPeer.java -- Implements ContainerPeer with GTK
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Window;
-import java.awt.peer.ComponentPeer;
-import java.awt.peer.ContainerPeer;
-
-public class GtkContainerPeer extends GtkComponentPeer
- implements ContainerPeer
-{
- Container c;
- boolean isValidating;
-
- public GtkContainerPeer(Container c)
- {
- super (c);
- this.c = c;
- }
-
- public void beginValidate ()
- {
- isValidating = true;
- }
-
- public void endValidate ()
- {
- Component parent = awtComponent.getParent ();
-
- // Only set our parent on the GTK side if our parent on the AWT
- // side is not showing. Otherwise the gtk peer will be shown
- // before we've had a chance to position and size it properly.
- if (parent != null && parent.isShowing ())
- {
- Component[] components = ((Container) awtComponent).getComponents ();
- int ncomponents = components.length;
-
- for (int i = 0; i < ncomponents; i++)
- {
- ComponentPeer peer = components[i].getPeer ();
-
- // Skip lightweight peers.
- if (peer instanceof GtkComponentPeer)
- ((GtkComponentPeer) peer).setParentAndBounds ();
- }
-
- // GTK windows don't have parents.
- if (!(awtComponent instanceof Window))
- setParentAndBounds ();
- }
-
- isValidating = false;
- }
-
- public Insets getInsets()
- {
- return insets;
- }
-
- public Insets insets()
- {
- return getInsets ();
- }
-
- public void setBounds (int x, int y, int width, int height)
- {
- super.setBounds (x, y, width, height);
- }
-
- public void setFont(Font f)
- {
- super.setFont(f);
- Component[] components = ((Container) awtComponent).getComponents();
- for (int i = 0; i < components.length; i++)
- {
- GtkComponentPeer peer = (GtkComponentPeer) components[i].getPeer();
- if (peer != null && ! peer.awtComponent.isFontSet())
- peer.setFont(f);
- }
- }
-
- public Graphics getGraphics ()
- {
- return super.getGraphics();
- }
-
- public void beginLayout () { }
- public void endLayout () { }
- public boolean isPaintPending () { return false; }
-
- public void setBackground (Color c)
- {
- super.setBackground(c);
-
- Object components[] = ((Container) awtComponent).getComponents();
- for (int i = 0; i < components.length; i++)
- {
- Component comp = (Component) components[i];
-
- // If the child's background has not been explicitly set yet,
- // it should inherit this container's background. This makes the
- // child component appear as if it has a transparent background.
- // Note that we do not alter the background property of the child,
- // but only repaint the child with the parent's background color.
- if (!comp.isBackgroundSet() && comp.getPeer() != null)
- comp.getPeer().setBackground(c);
- }
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
deleted file mode 100644
index c2cbc37dce9..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* GtkDialogPeer.java -- Implements DialogPeer with GTK
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Dialog;
-import java.awt.Graphics;
-import java.awt.Rectangle;
-import java.awt.event.PaintEvent;
-import java.awt.peer.DialogPeer;
-
-public class GtkDialogPeer extends GtkWindowPeer
- implements DialogPeer
-{
- public GtkDialogPeer (Dialog dialog)
- {
- super (dialog);
- }
-
- public Graphics getGraphics ()
- {
- Graphics g;
- if (GtkToolkit.useGraphics2D ())
- g = new GdkGraphics2D (this);
- else
- g = new GdkGraphics (this);
- g.translate (-insets.left, -insets.top);
- return g;
- }
-
- protected void postMouseEvent(int id, long when, int mods, int x, int y,
- int clickCount, boolean popupTrigger)
- {
- super.postMouseEvent (id, when, mods,
- x + insets.left, y + insets.top,
- clickCount, popupTrigger);
- }
-
- protected void postExposeEvent (int x, int y, int width, int height)
- {
- if (!isInRepaint)
- q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x + insets.left,
- y + insets.top,
- width, height)));
- }
-
- void create ()
- {
- // Create a decorated dialog window.
- create (GDK_WINDOW_TYPE_HINT_DIALOG, true);
-
- Dialog dialog = (Dialog) awtComponent;
-
- gtkWindowSetModal (dialog.isModal ());
- setTitle (dialog.getTitle ());
- setResizable (dialog.isResizable ());
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java
deleted file mode 100644
index 0533d2759c2..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkEmbeddedWindowPeer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* GtkEmbeddedWindowPeer.java -- Implements EmbeddedWindowPeer using a
- GtkPlug
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.java.awt.EmbeddedWindow;
-import gnu.java.awt.peer.EmbeddedWindowPeer;
-
-public class GtkEmbeddedWindowPeer extends GtkFramePeer
- implements EmbeddedWindowPeer
-{
- native void create (long socket_id);
-
- void create ()
- {
- create (((EmbeddedWindow) awtComponent).getHandle ());
- }
-
- native void construct (long socket_id);
-
- // FIXME: embed doesn't work right now, though I believe it should.
- // This means that you can't call setVisible (true) on an
- // EmbeddedWindow before calling setHandle with a valid handle. The
- // problem is that somewhere after the call to
- // GtkEmbeddedWindow.create and before the call to
- // GtkEmbeddedWindow.construct, the GtkPlug peer is being realized.
- // GtkSocket silently fails to embed an already-realized GtkPlug.
- public void embed (long handle)
- {
- construct (handle);
- }
-
- public GtkEmbeddedWindowPeer (EmbeddedWindow w)
- {
- super (w);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
deleted file mode 100644
index bd1f0775a92..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/* GtkFileDialogPeer.java -- Implements FileDialogPeer with GTK
- Copyright (C) 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Dialog;
-import java.awt.FileDialog;
-import java.awt.Graphics;
-import java.awt.Window;
-import java.awt.peer.FileDialogPeer;
-import java.io.File;
-import java.io.FilenameFilter;
-
-public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
-{
- static final String FS = System.getProperty("file.separator");
-
- private String currentFile = null;
- private String currentDirectory = null;
- private FilenameFilter filter;
-
- native void create (GtkContainerPeer parent);
- native void connectSignals ();
- native void nativeSetFile (String file);
- public native String nativeGetDirectory();
- public native void nativeSetDirectory(String directory);
- native void nativeSetFilenameFilter (FilenameFilter filter);
-
- public void create()
- {
- create((GtkContainerPeer) awtComponent.getParent().getPeer());
-
- FileDialog fd = (FileDialog) awtComponent;
-
- setDirectory(fd.getDirectory());
- setFile(fd.getFile());
-
- FilenameFilter filter = fd.getFilenameFilter();
- if (filter != null)
- setFilenameFilter(filter);
- }
-
- public GtkFileDialogPeer (FileDialog fd)
- {
- super (fd);
- }
-
- void setComponentBounds ()
- {
- if (awtComponent.getHeight () == 0
- && awtComponent.getWidth () == 0)
- {
- int[] dims = new int[2];
- gtkWidgetGetPreferredDimensions (dims);
- ((GtkFileDialogPeer) this).setBoundsCallback ((Window) awtComponent,
- awtComponent.getX (),
- awtComponent.getY (),
- dims[0], dims[1]);
- }
- super.setComponentBounds ();
- }
-
- public void setFile (String fileName)
- {
- /* If nothing changed do nothing. This usually happens because
- the only way we have to set the file name in FileDialog is by
- calling its SetFile which will call us back. */
- if ((fileName == null && currentFile == null)
- || (fileName != null && fileName.equals (currentFile)))
- return;
-
- if (fileName == null || fileName.equals (""))
- {
- currentFile = "";
- nativeSetFile ("");
- return;
- }
-
- // GtkFileChooser requires absolute filenames. If the given filename
- // is not absolute, let's construct it based on current directory.
- currentFile = fileName;
- if (fileName.indexOf(FS) == 0)
- {
- nativeSetFile (fileName);
- }
- else
- {
- nativeSetFile (nativeGetDirectory() + FS + fileName);
- }
- }
-
- public void setDirectory (String directory)
- {
- /* If nothing changed so nothing. This usually happens because
- the only way we have to set the directory in FileDialog is by
- calling its setDirectory which will call us back. */
- if ((directory == null && currentDirectory == null)
- || (directory != null && directory.equals (currentDirectory)))
- return;
-
- if (directory == null || directory.equals (""))
- {
- currentDirectory = FS;
- nativeSetFile (FS);
- return;
- }
-
- currentDirectory = directory;
- nativeSetDirectory (directory);
- }
-
- public void setFilenameFilter (FilenameFilter filter)
- {
- this.filter = filter;
- nativeSetFilenameFilter(filter);
- }
-
- /* This method interacts with the native callback function of the
- same name. The native function will extract the filename from the
- GtkFileFilterInfo object and send it to this method, which will
- in turn call the filter's accept() method and give back the return
- value. */
- boolean filenameFilterCallback (String fullname) {
- String filename = fullname.substring(fullname.lastIndexOf(FS) + 1);
- String dirname = fullname.substring(0, fullname.lastIndexOf(FS));
- File dir = new File(dirname);
- return filter.accept(dir, filename);
- }
-
- public Graphics getGraphics ()
- {
- // GtkFileDialog will repaint by itself
- return null;
- }
-
- void gtkHideFileDialog ()
- {
- ((Dialog) awtComponent).hide();
- }
-
- void gtkDisposeFileDialog ()
- {
- ((Dialog) awtComponent).dispose();
- }
-
- /* Callback to set the file and directory values when the user is finished
- * with the dialog.
- */
- void gtkSetFilename (String fileName)
- {
- FileDialog fd = (FileDialog) awtWidget;
- if (fileName == null)
- {
- currentFile = null;
- fd.setFile(null);
- return;
- }
-
- int sepIndex = fileName.lastIndexOf (FS);
- if (sepIndex < 0)
- {
- /* This should never happen on Unix (all paths start with '/') */
- currentFile = fileName;
- }
- else
- {
- if (fileName.length() > (sepIndex + 1))
- {
- String fn = fileName.substring (sepIndex + 1);
- currentFile = fn;
- }
- else
- {
- currentFile = null;
- }
-
- String dn = fileName.substring (0, sepIndex + 1);
- currentDirectory = dn;
- fd.setDirectory(dn);
- }
-
- fd.setFile (currentFile);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
deleted file mode 100644
index 80ad1580362..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/* GtkFontPeer.java -- Implements FontPeer with GTK+
- Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.java.awt.peer.ClasspathFontPeer;
-
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphVector;
-import java.awt.font.LineMetrics;
-import java.awt.geom.Rectangle2D;
-import java.text.CharacterIterator;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class GtkFontPeer extends ClasspathFontPeer
-{
- private static ResourceBundle bundle;
-
- static
- {
- try
- {
- bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font");
- }
- catch (Throwable ignored)
- {
- bundle = null;
- }
- }
-
- private final String Xname;
-
- public GtkFontPeer (String name, int style)
- {
- // All fonts get a default size of 12 if size is not specified.
- this(name, style, 12);
- }
-
- public GtkFontPeer (String name, int style, int size)
- {
- super(name, style, size);
-
- String Xname = null;
- if (bundle != null)
- {
- try
- {
- Xname = bundle.getString (name.toLowerCase () + "." + style);
- }
- catch (MissingResourceException mre)
- {
- // ignored
- }
- }
-
- if (Xname == null)
- {
- String weight;
- String slant;
- String spacing;
-
- if (style == Font.ITALIC || (style == (Font.BOLD+Font.ITALIC)))
- slant = "i";
- else
- slant = "r";
- if (style == Font.BOLD || (style == (Font.BOLD+Font.ITALIC)))
- weight = "bold";
- else
- weight = "medium";
- if (name.equals("Serif") || name.equals("SansSerif")
- || name.equals("Helvetica") || name.equals("Times"))
- spacing = "p";
- else
- spacing = "c";
-
- Xname = "-*-*-" + weight + "-" + slant + "-normal-*-*-" + size + "-*-*-" + spacing + "-*-*-*";
- }
-
- this.Xname = Xname;
- }
-
- public String getXLFD ()
- {
- return Xname;
- }
-
-
- /* remaining methods are for static compatibility with the newer
- ClasspathFontPeer superclass; none of these methods ever existed or
- worked on the older FontPeer interface, but we need to pretend to
- support them anyways. */
-
- public boolean canDisplay (Font font, char c)
- {
- throw new UnsupportedOperationException();
- }
-
- public int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit)
- {
- throw new UnsupportedOperationException();
- }
-
- public String getSubFamilyName (Font font, Locale locale)
- {
- throw new UnsupportedOperationException();
- }
-
- public String getPostScriptName (Font font)
- {
- throw new UnsupportedOperationException();
- }
-
- public int getNumGlyphs (Font font)
- {
- throw new UnsupportedOperationException();
- }
-
- public int getMissingGlyphCode (Font font)
- {
- throw new UnsupportedOperationException();
- }
-
- public byte getBaselineFor (Font font, char c)
- {
- throw new UnsupportedOperationException();
- }
-
- public String getGlyphName (Font font, int glyphIndex)
- {
- throw new UnsupportedOperationException();
- }
-
- public GlyphVector createGlyphVector (Font font,
- FontRenderContext frc,
- CharacterIterator ci)
- {
- throw new UnsupportedOperationException();
- }
-
- public GlyphVector createGlyphVector (Font font,
- FontRenderContext ctx,
- int[] glyphCodes)
- {
- throw new UnsupportedOperationException();
- }
-
- public GlyphVector layoutGlyphVector (Font font,
- FontRenderContext frc,
- char[] chars, int start,
- int limit, int flags)
- {
- throw new UnsupportedOperationException();
- }
-
- public FontMetrics getFontMetrics (Font font)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean hasUniformLineMetrics (Font font)
- {
- throw new UnsupportedOperationException();
- }
-
- public LineMetrics getLineMetrics (Font font,
- CharacterIterator ci,
- int begin, int limit,
- FontRenderContext rc)
- {
- throw new UnsupportedOperationException();
- }
-
- public Rectangle2D getMaxCharBounds (Font font,
- FontRenderContext rc)
- {
- throw new UnsupportedOperationException();
- }
-
- public Rectangle2D getStringBounds (Font font,
- CharacterIterator ci,
- int begin, int limit,
- FontRenderContext frc)
- {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
deleted file mode 100644
index 77b7a81786a..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/* GtkFramePeer.java -- Implements FramePeer with GTK
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.MenuBar;
-import java.awt.Rectangle;
-import java.awt.Window;
-import java.awt.event.PaintEvent;
-import java.awt.image.ColorModel;
-import java.awt.peer.FramePeer;
-import java.awt.peer.MenuBarPeer;
-
-public class GtkFramePeer extends GtkWindowPeer
- implements FramePeer
-{
- private int menuBarHeight;
- private MenuBarPeer menuBar;
- native int getMenuBarHeight (MenuBarPeer bar);
- native void setMenuBarWidth (MenuBarPeer bar, int width);
- native void setMenuBarPeer (MenuBarPeer bar);
- native void removeMenuBarPeer ();
- native void gtkFixedSetVisible (boolean visible);
-
- int getMenuBarHeight ()
- {
- return menuBar == null ? 0 : getMenuBarHeight (menuBar);
- }
-
- public void setMenuBar (MenuBar bar)
- {
- if (bar == null && menuBar != null)
- {
- // We're removing the menubar.
- gtkFixedSetVisible (false);
- menuBar = null;
- removeMenuBarPeer ();
- insets.top -= menuBarHeight;
- menuBarHeight = 0;
- awtComponent.validate ();
- gtkFixedSetVisible (true);
- }
- else if (bar != null && menuBar == null)
- {
- // We're adding a menubar where there was no menubar before.
- gtkFixedSetVisible (false);
- menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
- setMenuBarPeer (menuBar);
- int menuBarWidth =
- awtComponent.getWidth () - insets.left - insets.right;
- if (menuBarWidth > 0)
- setMenuBarWidth (menuBar, menuBarWidth);
- menuBarHeight = getMenuBarHeight ();
- insets.top += menuBarHeight;
- awtComponent.validate ();
- gtkFixedSetVisible (true);
- }
- else if (bar != null && menuBar != null)
- {
- // We're swapping the menubar.
- gtkFixedSetVisible (false);
- removeMenuBarPeer();
- int oldHeight = menuBarHeight;
- int menuBarWidth =
- awtComponent.getWidth () - insets.left - insets.right;
- menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer ();
- setMenuBarPeer (menuBar);
- if (menuBarWidth > 0)
- setMenuBarWidth (menuBar, menuBarWidth);
- menuBarHeight = getMenuBarHeight ();
- if (oldHeight != menuBarHeight)
- {
- insets.top += (menuBarHeight - oldHeight);
- awtComponent.validate ();
- }
- gtkFixedSetVisible (true);
- }
- }
-
- public void setBounds (int x, int y, int width, int height)
- {
- int menuBarWidth = width - insets.left - insets.right;
- if (menuBar != null && menuBarWidth > 0)
- setMenuBarWidth (menuBar, menuBarWidth);
-
- nativeSetBounds (x, y,
- width - insets.left - insets.right,
- height - insets.top - insets.bottom
- + menuBarHeight);
- }
-
- public void setResizable (boolean resizable)
- {
- // Call setSize; otherwise when resizable is changed from true to
- // false the frame will shrink to the dimensions it had before it
- // was resizable.
- setSize (awtComponent.getWidth() - insets.left - insets.right,
- awtComponent.getHeight() - insets.top - insets.bottom
- + menuBarHeight);
- gtkWindowSetResizable (resizable);
- }
-
- protected void postInsetsChangedEvent (int top, int left,
- int bottom, int right)
- {
- insets.top = top + menuBarHeight;
- insets.left = left;
- insets.bottom = bottom;
- insets.right = right;
- }
-
- public GtkFramePeer (Frame frame)
- {
- super (frame);
- }
-
- void create ()
- {
- // Create a normal decorated window.
- create (GDK_WINDOW_TYPE_HINT_NORMAL, true);
-
- Frame frame = (Frame) awtComponent;
-
- setMenuBar (frame.getMenuBar ());
-
- setTitle (frame.getTitle ());
- gtkWindowSetResizable (frame.isResizable ());
- setIconImage(frame.getIconImage());
- }
-
- native void nativeSetIconImageFromDecoder (GdkPixbufDecoder decoder);
- native void nativeSetIconImageFromData (int[] pixels, int width, int height);
- public void setIconImage (Image image)
- {
- if (image != null && image instanceof GtkImage)
- {
- GtkImage img = (GtkImage) image;
- // FIXME: Image should be loaded, but if not, do image loading here.
- if (img.isLoaded())
- {
- if (img.getSource() instanceof GdkPixbufDecoder)
- {
- nativeSetIconImageFromDecoder((GdkPixbufDecoder) img.getSource());
- }
- else
- {
- int[] pixels = img.getPixelCache();
- ColorModel model = img.getColorModel();
- int[] data = new int[pixels.length * 4];
- for (int i = 0; i < pixels.length; i++)
- {
- data[i * 4] = model.getRed(pixels[i]);
- data[i * 4 + 1] = model.getGreen(pixels[i]);
- data[i * 4 + 2] = model.getBlue(pixels[i]);
- data[i * 4 + 3] = model.getAlpha(pixels[i]);
- }
- nativeSetIconImageFromData(data, img.getWidth(null), img.getHeight(null));
- }
- }
- }
- }
-
- public Graphics getGraphics ()
- {
- Graphics g;
- if (GtkToolkit.useGraphics2D ())
- g = new GdkGraphics2D (this);
- else
- g = new GdkGraphics (this);
- g.translate (-insets.left, -insets.top);
- return g;
- }
-
- protected void postConfigureEvent (int x, int y, int width, int height)
- {
- int frame_x = x - insets.left;
- // Since insets.top includes the MenuBar height, we need to add back
- // the MenuBar height to the frame's y position.
- // If no MenuBar exists in this frame, the MenuBar height will be 0.
- int frame_y = y - insets.top + menuBarHeight;
- int frame_width = width + insets.left + insets.right;
- // Ditto as above. Since insets.top already includes the MenuBar's height,
- // we need to subtract the MenuBar's height from the top inset.
- int frame_height = height + insets.top + insets.bottom - menuBarHeight;
- if (frame_x != awtComponent.getX()
- || frame_y != awtComponent.getY()
- || frame_width != awtComponent.getWidth()
- || frame_height != awtComponent.getHeight())
- {
- if (frame_width != awtComponent.getWidth() && menuBar != null
- && width > 0)
- setMenuBarWidth (menuBar, width);
-
- setBoundsCallback ((Window) awtComponent,
- frame_x,
- frame_y,
- frame_width,
- frame_height);
-
- awtComponent.validate();
- }
- }
-
- protected void postMouseEvent(int id, long when, int mods, int x, int y,
- int clickCount, boolean popupTrigger)
- {
- super.postMouseEvent (id, when, mods,
- x + insets.left, y + insets.top,
- clickCount, popupTrigger);
- }
-
- protected void postExposeEvent (int x, int y, int width, int height)
- {
- if (!isInRepaint)
- q().postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x + insets.left,
- y + insets.top,
- width, height)));
- }
-
- public int getState ()
- {
- return 0;
- }
-
- public void setState (int state)
- {
-
- }
-
- public void setMaximizedBounds (Rectangle r)
- {
-
- }
-}
-
-
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
deleted file mode 100644
index 669268e92d8..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* GtkGenericPeer.java - Has a hashcode. Yuck.
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.EventQueue;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-
-public class GtkGenericPeer
-{
- final int native_state = getUniqueInteger ();
-
- // Next native state value we will assign.
- private static int next_native_state = 0;
-
- // The widget or other java-side object we wrap.
- protected Object awtWidget;
-
- // Global event queue.
- protected static EventQueue q = null;
-
- // Dispose of our native state.
- public native void dispose ();
-
- static EventQueue q ()
- {
- return Toolkit.getDefaultToolkit ().getSystemEventQueue ();
- }
-
- protected GtkGenericPeer (Object awtWidget)
- {
- this.awtWidget = awtWidget;
- }
-
- public static void enableQueue (EventQueue sq)
- {
- if (q == null)
- q = sq;
- }
-
- protected void postActionEvent (String command, int mods)
- {
- q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED,
- command, mods));
- }
-
- // Return a unique integer for use in the native state mapping
- // code. We can't use a hash code since that is not guaranteed to
- // be unique.
- static synchronized int getUniqueInteger ()
- {
- // Let's assume this will never wrap.
- return next_native_state++;
- }
-
- native void gtkWidgetModifyFont (String name, int style, int size);
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImage.java b/libjava/gnu/java/awt/peer/gtk/GtkImage.java
deleted file mode 100644
index a9f8e9075b6..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkImage.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/* GtkImage.java
- Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageConsumer;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.util.Hashtable;
-import java.util.Vector;
-
-public class GtkImage extends Image implements ImageConsumer
-{
- int width = -1, height = -1;
- Hashtable props = null;
- boolean isLoaded = false;
- boolean isCacheable = true;
- boolean loading = false;
-
- Vector widthObservers = new Vector ();
- Vector heightObservers = new Vector ();
- Vector propertyObservers = new Vector ();
-
- ImageProducer source;
- ImageObserver observer;
- Graphics g;
-
- /* Variables in which we stored cached data, if possible.
-
- An image is cached if the following properties are true:
- 1. The ColorModel passed into setColorModel is the same ColorModel
- passed to all invocations of setPixels.
- 2. The image contains a single frame.
-
- */
- int[] pixelCache;
- ColorModel model;
-
- public
- GtkImage (ImageProducer producer, Graphics g)
- {
- source = producer;
- this.g = g;
-
- if (source != null)
- source.addConsumer (this);
- }
-
- public void setObserver (ImageObserver observer)
- {
- this.observer = observer;
- }
-
- public synchronized int[]
- getPixelCache ()
- {
- return pixelCache;
- }
-
- public synchronized ColorModel
- getColorModel ()
- {
- return model;
- }
-
- public synchronized int
- getWidth (ImageObserver observer)
- {
- if (width == -1)
- widthObservers.addElement (observer);
-
- return width;
- }
-
- public synchronized int
- getHeight (ImageObserver observer)
- {
- if (height == -1)
- heightObservers.addElement (observer);
-
- return height;
- }
-
- public ImageProducer
- getSource ()
- {
- return source;
- }
-
- public Graphics
- getGraphics ()
- {
- return g;
- }
-
- public synchronized Object
- getProperty (String name, ImageObserver observer)
- {
- if (props == null)
- {
- propertyObservers.addElement (observer);
- return null;
- }
-
- Object value = props.get (name);
- return (value == null) ? UndefinedProperty : value;
- }
-
- public synchronized void
- flush ()
- {
- isLoaded = false;
- isCacheable = true;
- width = height = -1;
- props = null;
- pixelCache = null;
- model = null;
-
- if (source != null)
- {
- source.removeConsumer (this);
- source.addConsumer (this);
- }
- }
-
- public boolean
- isLoaded ()
- {
- return isLoaded;
- }
-
- /* ImageConsumer methods */
-
- public synchronized void
- setDimensions (int width, int height)
- {
- pixelCache = new int[width*height];
-
- this.width = width;
- this.height = height;
-
- for (int i = 0; i < widthObservers.size (); i++)
- {
- ImageObserver io = (ImageObserver) widthObservers.elementAt (i);
- if (io != null)
- io.imageUpdate (this, ImageObserver.WIDTH, -1, -1, width, height);
- }
-
- for (int i = 0; i < heightObservers.size (); i++)
- {
- ImageObserver io = (ImageObserver) heightObservers.elementAt (i);
- if (io != null)
- io.imageUpdate (this, ImageObserver.HEIGHT, -1, -1, width, height);
- }
-
- if (observer != null)
- observer.imageUpdate (this,
- (ImageObserver.WIDTH
- | ImageObserver.HEIGHT),
- -1, -1, width, height);
- }
-
- public synchronized void
- setProperties (Hashtable props)
- {
- this.props = props;
-
- for (int i = 0; i < propertyObservers.size (); i++)
- {
- ImageObserver io = (ImageObserver) propertyObservers.elementAt (i);
- if (io != null)
- io.imageUpdate (this, ImageObserver.PROPERTIES, -1, -1, width, height);
- }
- }
-
- public synchronized void
- setColorModel (ColorModel model)
- {
- if (this.model == null || this.model.equals(model))
- this.model = model;
- else
- isCacheable = false;
- }
-
- public synchronized void
- setHints (int flags)
- {
- }
-
- public synchronized void
- setPixels (int x, int y, int width, int height, ColorModel cm, byte[] pixels,
- int offset, int scansize)
- {
- setPixels (x, y, width, height, cm, convertPixels (pixels), offset,
- scansize);
-
- if (observer != null)
- observer.imageUpdate (this,
- ImageObserver.SOMEBITS,
- x, y, width, height);
- }
-
- public synchronized void
- setPixels (int x, int y, int width, int height, ColorModel cm, int[] pixels,
- int offset, int scansize)
- {
- loading = true;
-
- if (!isCacheable)
- return;
-
- if (!cm.equals(model) || pixelCache == null)
- {
- isCacheable = false;
- return;
- }
-
- if (scansize == width && height == 1)
- {
- // Copy contents of pixels array into pixel cache.
- System.arraycopy (pixels, offset,
- pixelCache, y * this.width + x,
- pixels.length - offset);
- }
- else // skip over scansize-width for each row
- {
- for (int i = 0; i < height; i++)
- System.arraycopy (pixels, offset + (i * scansize),
- pixelCache, (y + i) * this.width + x,
- width);
- }
- }
-
- public synchronized void
- imageComplete (int status)
- {
- if (status == ImageConsumer.STATICIMAGEDONE && isCacheable)
- isLoaded = true;
-
- if (status == ImageConsumer.SINGLEFRAME)
- isCacheable = false;
-
- if (observer != null)
- {
- if (status == ImageConsumer.IMAGEERROR)
- observer.imageUpdate (null,
- ImageObserver.ERROR,
- -1, -1, -1, -1);
- else
- observer.imageUpdate (null,
- ImageObserver.ALLBITS,
- -1, -1, -1, -1);
- }
-
- if (source != null && status != ImageConsumer.SINGLEFRAME)
- source.removeConsumer (this);
- }
-
- public synchronized void
- startProduction (GtkImagePainter painter)
- {
- if (isLoaded)
- {
- painter.setDimensions (width, height);
- painter.setPixels (0, 0, width, height, model, pixelCache, 0, width);
- }
- else
- {
- if (source != null)
- {
- source.startProduction (painter);
- source.removeConsumer (painter);
- }
- }
- }
-
- private int[]
- convertPixels (byte[] pixels)
- {
- int ret[] = new int[pixels.length];
-
- for (int i = 0; i < pixels.length; i++)
- ret[i] = pixels[i];
-
- return ret;
- }
-
- synchronized int
- checkImage ()
- {
- int bits = 0;
-
- if (width != -1)
- bits |= ImageObserver.WIDTH;
- if (height != -1)
- bits |= ImageObserver.HEIGHT;
- if (props != null)
- bits |= ImageObserver.PROPERTIES;
- if (loading)
- bits |= ImageObserver.SOMEBITS;
- if (isLoaded)
- bits |= ImageObserver.ALLBITS;
-
- return bits;
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java b/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
deleted file mode 100644
index 9efa0ae7137..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/* GtkImagePainter.java
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Color;
-import java.awt.Rectangle;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageConsumer;
-import java.awt.image.ImageObserver;
-import java.util.Hashtable;
-
-public class GtkImagePainter implements Runnable, ImageConsumer
-{
- GtkImage image;
- GdkGraphics gc;
- int startX, startY;
- int redBG;
- int greenBG;
- int blueBG;
- double affine[];
- int width, height;
- boolean flipX, flipY;
- Rectangle clip;
- int s_width, s_height;
- ImageObserver observer;
-
- public
- GtkImagePainter (GtkImage image, GdkGraphics gc, int x, int y,
- int width, int height, Color bgcolor, ImageObserver o)
- {
- this.image = image;
- this.gc = (GdkGraphics) gc.create ();
- startX = x;
- startY = y;
- redBG = bgcolor.getRed ();
- greenBG = bgcolor.getGreen ();
- blueBG = bgcolor.getBlue ();
- this.width = width;
- this.height = height;
- flipX = flipY = false;
- s_width = s_height = 0;
- clip = null;
- observer = o;
-
- run ();
- }
-
- public
- GtkImagePainter (GtkImage image, GdkGraphics gc,
- int dx1, int dy1, int dx2, int dy2,
- int sx1, int sy1, int sx2, int sy2,
- Color bgcolor, ImageObserver o)
- {
- this.image = image;
- this.gc = (GdkGraphics) gc.create ();
- startX = (dx1 < dx2) ? dx1 : dx2;
- startY = dy1;
- redBG = bgcolor.getRed ();
- greenBG = bgcolor.getGreen ();
- blueBG = bgcolor.getBlue ();
- observer = o;
-
- this.width = Math.abs (dx2 - dx1);
- this.height = Math.abs (dy2 - dy1);
-
- flipX = ((dx1 > dx2 && sx2 > sx1)
- || (dx1 < dx2 && sx2 < sx1));
-
- flipY = ((dy1 > dy2 && sy2 > sy1)
- || (dy1 < dy2 && sy2 < sy1));
-
- s_width = Math.abs (sx2 - sx1);
- s_height = Math.abs (sy2 - sy1);
- clip = new Rectangle (sx1, sy1, s_width, s_height);
-
- run ();
- }
-
- public void
- run ()
- {
- image.startProduction (this);
- gc.dispose ();
- }
-
- /* Convert pixel data into a format that gdkrgb can understand */
- static int[]
- convertPixels (int[] pixels, ColorModel model)
- {
- if (pixels == null || model == null)
- {
- return null;
- }
-
- if (model.equals (ColorModel.getRGBdefault ()))
- return pixels;
-
- int ret[] = new int[pixels.length];
-
- for (int i = 0; i < pixels.length; i++)
- ret[i] = model.getRGB (pixels[i]);
-
- return ret;
- }
-
- static int[]
- convertPixels (byte[] pixels, ColorModel model)
- {
- if (pixels == null || model == null)
- {
- return null;
- }
-
- int ret[] = new int[pixels.length];
-
- for (int i = 0; i < pixels.length; i++)
- ret[i] = model.getRGB (pixels[i]);
-
- return ret;
- }
-
- native void
- drawPixels (GdkGraphics gc, int bg_red, int bg_green, int bg_blue,
- int x, int y, int width, int height, int[] pixels, int offset,
- int scansize, double affine[]);
-
-
- public void
- setPixels (int x, int y, int width, int height, ColorModel model,
- int[] pixels, int offset, int scansize)
- {
- if (clip != null)
- {
- Rectangle r;
- r = clip.intersection (new Rectangle (x, y, width, height));
- if (r.width == 0 && r.height == 0)
- return;
-
- offset += r.y * scansize + r.x;
-
- width = r.width;
- height = r.height;
- x = r.x;
- y = r.y;
- }
-
- drawPixels (gc, redBG, greenBG, blueBG,
- startX + x, startY + y,
- width, height, convertPixels (pixels, model), offset,
- scansize, affine);
- }
-
- public void
- setPixels (int x, int y, int width, int height, ColorModel model,
- byte[] pixels, int offset, int scansize)
- {
- setPixels (x, y, width, height, ColorModel.getRGBdefault(),
- convertPixels (pixels, model), offset, scansize);
- }
-
- public void
- setDimensions (int width, int height)
- {
- if (!flipX && !flipY &&
- ((this.width == -1 && this.height == -1)
- || (this.width == width && this.height == height)))
- return;
-
- affine = new double[6];
- affine[1] = affine[2] = affine[4] = affine[5] = 0;
-
- if (clip != null)
- {
- affine[0] = this.width / (double) s_width;
- affine[3] = this.height / (double) s_height;
- }
- else
- {
- affine[0] = this.width / (double) width;
- affine[3] = this.height / (double) height;
- }
-
- if (flipX)
- {
- affine[0] = -affine[0];
- affine[4] = this.width;
- }
-
- if (flipY)
- {
- affine[3] = -affine[3];
- affine[5] = this.height;
- }
-
- if (affine[0] == 1 && affine[3] == 1)
- affine = null;
- }
-
- public void
- setProperties (Hashtable props)
- {
- }
-
- public void
- setColorModel (ColorModel model)
- {
- }
-
- public void
- setHints (int flags)
- {
- }
-
- public void
- imageComplete (int status)
- {
- image.imageComplete(status);
-
- if (observer != null)
- {
- if (status == ImageConsumer.IMAGEERROR)
- observer.imageUpdate (null,
- ImageObserver.ERROR,
- -1, -1, -1, -1);
- else
- observer.imageUpdate (null,
- ImageObserver.ALLBITS,
- -1, -1, -1, -1);
- }
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
deleted file mode 100644
index fdd5fd15f63..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GtkLabelPeer.java -- Implements LabelPeer with GTK
- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Label;
-import java.awt.peer.LabelPeer;
-
-public class GtkLabelPeer extends GtkComponentPeer
- implements LabelPeer
-{
- native void create (String text, float alignment);
- native void gtkWidgetModifyFont (String name, int style, int size);
- native void nativeSetAlignment (float alignment);
-
- public native void setText(String text);
- native void setNativeBounds (int x, int y, int width, int height);
-
- void create ()
- {
- Label label = (Label) awtComponent;
- create (label.getText (), getGtkAlignment (label.getAlignment ()));
- }
-
- public GtkLabelPeer (Label l)
- {
- super (l);
- }
-
- public void setAlignment (int alignment)
- {
- nativeSetAlignment (getGtkAlignment (alignment));
- }
-
- float getGtkAlignment (int alignment)
- {
- switch (alignment)
- {
- case Label.LEFT:
- return 0.0f;
- case Label.CENTER:
- return 0.5f;
- case Label.RIGHT:
- return 1.0f;
- }
-
- return 0.0f;
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
deleted file mode 100644
index ff12fe34bba..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/* GtkListPeer.java -- Implements ListPeer with GTK
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.AWTEvent;
-import java.awt.Dimension;
-import java.awt.List;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.awt.peer.ListPeer;
-
-public class GtkListPeer extends GtkComponentPeer
- implements ListPeer
-{
- void create ()
- {
- List list = (List) awtComponent;
-
- create (list.getRows ());
-
- setMultipleMode (list.isMultipleMode ());
- }
-
- native void create (int rows);
- native void connectSignals ();
- native void gtkWidgetModifyFont (String name, int style, int size);
- native void gtkWidgetRequestFocus ();
-
- native void getSize (int rows, int visibleRows, int dims[]);
-
- public GtkListPeer (List list)
- {
- super (list);
-
- setMultipleMode (list.isMultipleMode ());
-
- if (list.getItemCount () > 0)
- append (list.getItems ());
- }
-
- native void append (String items[]);
-
- public native void add (String item, int index);
-
- public void addItem (String item, int index)
- {
- add (item, index);
- }
-
- public void clear ()
- {
- removeAll ();
- }
-
- public native void delItems (int start, int end);
- public native void deselect (int index);
-
- public Dimension getMinimumSize (int rows)
- {
- return minimumSize (rows);
- }
-
- public Dimension getPreferredSize (int rows)
- {
- return preferredSize (rows);
- }
-
- public native int[] getSelectedIndexes ();
- public native void makeVisible (int index);
-
- public Dimension minimumSize (int rows)
- {
- int dims[] = new int[2];
-
- int visibleRows = ((List) awtComponent).getRows();
- getSize (rows, visibleRows, dims);
- return new Dimension (dims[0], dims[1]);
- }
-
- public Dimension preferredSize (int rows)
- {
- int dims[] = new int[2];
-
- int visibleRows = ((List) awtComponent).getRows();
- getSize (rows, visibleRows, dims);
- return new Dimension (dims[0], dims[1]);
- }
-
- public void removeAll ()
- {
- delItems (0, -1);
- }
-
- public native void select (int index);
- public native void setMultipleMode (boolean b);
-
- public void setMultipleSelections (boolean b)
- {
- setMultipleMode (b);
- }
-
- public void handleEvent (AWTEvent e)
- {
- if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled ())
- {
- // Only generate the ActionEvent on the second click of a
- // multiple click.
- MouseEvent me = (MouseEvent) e;
- if (!me.isConsumed ()
- && (me.getModifiersEx () & MouseEvent.BUTTON1_DOWN_MASK) != 0
- && me.getClickCount() == 2)
- {
- String selectedItem = ((List) awtComponent).getSelectedItem ();
-
- // Double-click only generates an Action event if
- // something is selected.
- if (selectedItem != null)
- postActionEvent (((List) awtComponent).getSelectedItem (),
- me.getModifiersEx ());
- }
- }
-
- if (e.getID () == KeyEvent.KEY_PRESSED)
- {
- KeyEvent ke = (KeyEvent) e;
- if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_ENTER)
- {
- String selectedItem = ((List) awtComponent).getSelectedItem ();
-
- // Enter only generates an Action event if something is
- // selected.
- if (selectedItem != null)
- postActionEvent (selectedItem, ke.getModifiersEx ());
- }
- }
-
- super.handleEvent (e);
- }
-
- protected void postItemEvent (int item, int stateChange)
- {
- postItemEvent (new Integer (item), stateChange);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
deleted file mode 100644
index 79eeaf9ba6a..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* GtkMenuBarPeer.java -- Implements MenuBarPeer with GTK+
- Copyright (C) 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Font;
-import java.awt.Menu;
-import java.awt.MenuBar;
-import java.awt.MenuComponent;
-import java.awt.peer.MenuBarPeer;
-import java.awt.peer.MenuPeer;
-
-public class GtkMenuBarPeer extends GtkMenuComponentPeer
- implements MenuBarPeer
-{
-
- native void create ();
- native void addMenu (MenuPeer menu);
-
- public GtkMenuBarPeer (MenuBar target)
- {
- super (target);
- }
-
- void setFont ()
- {
- MenuComponent mc = (MenuComponent) awtWidget;
- Font f = mc.getFont ();
-
- if (f == null)
- mc.setFont (new Font ("Dialog", Font.PLAIN, 12));
- }
-
- // FIXME: remove this method or replace it with one that does
- // something useful.
- /* In Gnome, help menus are no longer right flushed. */
- native void nativeSetHelpMenu(MenuPeer menuPeer);
-
- public void addHelpMenu (Menu menu)
- {
- // nativeSetHelpMenu((MenuPeer) menu.getPeer());
- }
-
- public native void delMenu(int index);
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
deleted file mode 100644
index 8d9d1ca04a0..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* GtkMenuComponentPeer.java -- Implements MenuComponentPeer with GTK+
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.peer.MenuComponentPeer;
-
-public class GtkMenuComponentPeer extends GtkGenericPeer
- implements MenuComponentPeer
-{
- void create ()
- {
- throw new RuntimeException ();
- }
-
- void setFont ()
- {
- }
-
- public GtkMenuComponentPeer (Object awtWidget)
- {
- super (awtWidget);
- create ();
- setFont ();
- }
-
- public native void dispose();
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
deleted file mode 100644
index 5728f262b13..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/* GtkMenuItemPeer.java -- Implements MenuItemPeer with GTK+
- Copyright (C) 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Font;
-import java.awt.Menu;
-import java.awt.MenuBar;
-import java.awt.MenuComponent;
-import java.awt.MenuItem;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuPeer;
-
-public class GtkMenuItemPeer extends GtkMenuComponentPeer
- implements MenuItemPeer
-{
- native void create (String label);
- native void connectSignals ();
- native void gtkWidgetModifyFont (String name, int style, int size);
-
- void create ()
- {
- create (((MenuItem) awtWidget).getLabel());
- }
-
- public GtkMenuItemPeer (MenuItem item)
- {
- super (item);
- setEnabled (item.isEnabled ());
- setParent (item);
-
- if (item.getParent() instanceof Menu && ! (item instanceof Menu))
- connectSignals();
- }
-
- void setFont ()
- {
- MenuComponent mc = ((MenuComponent) awtWidget);
- Font f = mc.getFont ();
-
- if (f == null)
- {
- MenuComponent parent = (MenuComponent) mc.getParent ();
- Font pf = parent.getFont ();
- gtkWidgetModifyFont (pf.getName (), pf.getStyle (), pf.getSize ());
- }
- else
- gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize());
- }
-
- void setParent (MenuItem item)
- {
- // add ourself differently, based on what type of parent we have
- // yes, the typecasting here is nasty.
- Object parent = item.getParent ();
- if (parent instanceof MenuBar)
- {
- ((GtkMenuBarPeer)((MenuBar)parent).getPeer ()).addMenu ((MenuPeer) this);
- }
- else // parent instanceof Menu
- {
- ((GtkMenuPeer)((Menu)parent).getPeer ()).addItem (this,
- item.getShortcut ());
- }
- }
-
- public void disable ()
- {
- setEnabled (false);
- }
-
- public void enable ()
- {
- setEnabled (true);
- }
-
- public native void setEnabled(boolean b);
-
- public native void setLabel(String label);
-
- protected void postMenuActionEvent ()
- {
- postActionEvent (((MenuItem)awtWidget).getActionCommand (), 0);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java
deleted file mode 100644
index 80332dd6a72..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/* GtkMenuPeer.java -- Implements MenuPeer with GTK+
- Copyright (C) 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Component;
-import java.awt.Menu;
-import java.awt.MenuContainer;
-import java.awt.MenuItem;
-import java.awt.MenuShortcut;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuPeer;
-
-public class GtkMenuPeer extends GtkMenuItemPeer
- implements MenuPeer
-{
- native void create (String label);
- native void addItem (MenuItemPeer item, int key, boolean shiftModifier);
- native void setupAccelGroup (GtkGenericPeer container);
- native void addTearOff ();
-
- public GtkMenuPeer (Menu menu)
- {
- super (menu);
-
- if (menu.isTearOff())
- addTearOff();
-
- MenuContainer parent = menu.getParent ();
- if (parent instanceof Menu)
- setupAccelGroup ((GtkGenericPeer)((Menu)parent).getPeer ());
- else if (parent instanceof Component)
- setupAccelGroup ((GtkGenericPeer)((Component)parent).getPeer ());
- else
- setupAccelGroup (null);
- }
-
- public void addItem (MenuItem item)
- {
- int key = 0;
- boolean shiftModifier = false;
-
- MenuShortcut ms = item.getShortcut ();
- if (ms != null)
- {
- key = ms.getKey ();
- shiftModifier = ms.usesShiftModifier ();
- }
-
- addItem ((MenuItemPeer) item.getPeer (), key, shiftModifier);
- }
-
- public void addItem (MenuItemPeer item, MenuShortcut ms)
- {
- int key = 0;
- boolean shiftModifier = false;
-
- if (ms != null)
- {
- key = ms.getKey ();
- shiftModifier = ms.usesShiftModifier ();
- }
-
- addItem (item, key, shiftModifier);
- }
-
- public native void delItem(int index);
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java b/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java
deleted file mode 100644
index 48cea2d7231..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* GtkOffScreenImage.java
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-
-public class GtkOffScreenImage extends Image
-{
- int width, height;
- ImageProducer source;
- Graphics g;
-
- public GtkOffScreenImage (ImageProducer source, Graphics g,
- int width, int height)
- {
- this.width = width;
- this.height = height;
-
- this.source = source;
- this.g = g;
- }
-
- public int getWidth (ImageObserver observer)
- {
- return width;
- }
-
- public int getHeight (ImageObserver observer)
- {
- return height;
- }
-
- public ImageProducer getSource ()
- {
- return source;
- }
-
- public Graphics getGraphics ()
- {
- if (g instanceof GdkGraphics2D)
- return new GdkGraphics2D ((GdkGraphics2D) this.g);
- else
- return new GdkGraphics ((GdkGraphics) this.g);
- }
-
- public Object getProperty (String name, ImageObserver observer)
- {
- return Image.UndefinedProperty;
- }
-
- public void flush ()
- {
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
deleted file mode 100644
index fbddb302a76..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* GtkPanelPeer.java -- Implements PanelPeer with GTK
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.AWTEvent;
-import java.awt.Panel;
-import java.awt.event.MouseEvent;
-import java.awt.peer.PanelPeer;
-
-public class GtkPanelPeer extends GtkContainerPeer
- implements PanelPeer
-{
- native void create ();
-
- public GtkPanelPeer (Panel p)
- {
- super (p);
- }
-
- public void handleEvent (AWTEvent event)
- {
- int id = event.getID();
-
- switch (id)
- {
- case MouseEvent.MOUSE_PRESSED:
- awtComponent.requestFocusInWindow ();
- break;
- }
- super.handleEvent (event);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
deleted file mode 100644
index d14c16dd79d..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GtkPopupMenuPeer.java -- Implements PopupMenuPeer with GTK+
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Component;
-import java.awt.Event;
-import java.awt.MenuItem;
-import java.awt.Point;
-import java.awt.PopupMenu;
-import java.awt.peer.PopupMenuPeer;
-
-public class GtkPopupMenuPeer extends GtkMenuPeer
- implements PopupMenuPeer
-{
- public GtkPopupMenuPeer (PopupMenu menu)
- {
- super (menu);
- }
-
- native void setupAccelGroup (GtkGenericPeer container);
-
- void setParent (MenuItem item)
- {
- // we don't need to "add" ourselves to our parent
- }
-
- native void show (int x, int y, long time);
- public void show (Component origin, int x, int y)
- {
- Point abs = origin.getLocationOnScreen ();
- show (abs.x + x, abs.y + y, 0);
- }
-
- public void show (Event e)
- {
-
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
deleted file mode 100644
index 69f8b494625..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GtkScrollPanePeer.java -- Implements ScrollPanePeer with GTK
- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Adjustable;
-import java.awt.Dimension;
-import java.awt.ScrollPane;
-import java.awt.peer.ScrollPanePeer;
-
-public class GtkScrollPanePeer extends GtkContainerPeer
- implements ScrollPanePeer
-{
- native void create (int width, int height);
-
- void create ()
- {
- create (awtComponent.getWidth (), awtComponent.getHeight ());
- }
-
- // native void gtkScrolledWindowSetScrollPosition(int x, int y);
- native void gtkScrolledWindowSetHScrollIncrement (int u);
- native void gtkScrolledWindowSetVScrollIncrement (int u);
-
- public GtkScrollPanePeer (ScrollPane sp)
- {
- super (sp);
-
- setPolicy (sp.getScrollbarDisplayPolicy ());
- }
-
- native void setPolicy (int policy);
- public void childResized (int width, int height)
- {
- int dim[] = new int[2];
-
- gtkWidgetGetDimensions (dim);
-
- // If the child is in this range, GTK adds both scrollbars, but
- // the AWT doesn't. So set the peer's scroll policy to
- // GTK_POLICY_NEVER.
- if ((width > dim[0] - getVScrollbarWidth ()
- && width <= dim[0])
- && (height > dim[1] - getHScrollbarHeight ()
- && height <= dim[1]))
- setPolicy (ScrollPane.SCROLLBARS_NEVER);
- else
- setPolicy (((ScrollPane) awtComponent).getScrollbarDisplayPolicy ());
- }
-
- public native int getHScrollbarHeight();
- public native int getVScrollbarWidth();
- public native void setScrollPosition(int x, int y);
-
- public Dimension getPreferredSize ()
- {
- return awtComponent.getSize();
- }
-
- public void setUnitIncrement (Adjustable adj, int u)
- {
- if (adj.getOrientation()==Adjustable.HORIZONTAL)
- gtkScrolledWindowSetHScrollIncrement (u);
- else
- gtkScrolledWindowSetVScrollIncrement (u);
- }
-
- public void setValue (Adjustable adj, int v)
- {
-// System.out.println("SPP: setVal: "+adj+":"+v);
-// Point p=myScrollPane.getScrollPosition ();
-// if (adj.getOrientation()==Adjustable.HORIZONTAL)
-// gtkScrolledWindowSetScrollPosition (v,p.y);
-// else
-// gtkScrolledWindowSetScrollPosition (p.x,v);
-// adj.setValue(v);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
deleted file mode 100644
index aa3a26e34ad..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* GtkScrollbarPeer.java -- Implements ScrollbarPeer with GTK+
- Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Adjustable;
-import java.awt.Scrollbar;
-import java.awt.event.AdjustmentEvent;
-import java.awt.peer.ScrollbarPeer;
-
-public class GtkScrollbarPeer extends GtkComponentPeer
- implements ScrollbarPeer
-{
- void create ()
- {
- Scrollbar sb = (Scrollbar) awtComponent;
-
- create (sb.getOrientation (), sb.getValue (),
- sb.getMinimum (), sb.getMaximum (),
- sb.getUnitIncrement (), sb.getBlockIncrement (),
- sb.getVisibleAmount ());
- }
-
- native void create (int orientation, int value,
- int min, int max, int stepIncr, int pageIncr,
- int visibleAmount);
-
- native void connectSignals ();
-
- public GtkScrollbarPeer (Scrollbar s)
- {
- super (s);
- }
-
- public native void setLineIncrement(int amount);
- public native void setPageIncrement(int amount);
- public native void setValues(int value, int visible, int min, int max);
-
- protected void postAdjustmentEvent (int type, int value)
- {
- q().postEvent (new AdjustmentEvent ((Adjustable)awtComponent,
- AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
- type, value));
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
deleted file mode 100644
index fb0e2ced508..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/* GtkTextAreaPeer.java -- Implements TextAreaPeer with GTK
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.TextArea;
-import java.awt.peer.TextAreaPeer;
-
-public class GtkTextAreaPeer extends GtkTextComponentPeer
- implements TextAreaPeer
-{
- private static transient int DEFAULT_ROWS = 10;
- private static transient int DEFAULT_COLS = 80;
-
- native void create (int width, int height, int scrollbarVisibility);
-
- native void gtkWidgetModifyFont (String name, int style, int size);
- native void gtkWidgetRequestFocus ();
-
- void create ()
- {
- Font f = awtComponent.getFont ();
-
- // By default, Sun sets a TextArea's font when its peer is
- // created. If f != null then the peer's font is set by
- // GtkComponent.create.
- if (f == null)
- {
- f = new Font ("Dialog", Font.PLAIN, 12);
- awtComponent.setFont (f);
- }
-
- FontMetrics fm = getFontMetrics (f);
-
- TextArea ta = ((TextArea) awtComponent);
- int sizeRows = ta.getRows ();
- int sizeCols = ta.getColumns ();
-
- sizeRows = sizeRows == 0 ? DEFAULT_ROWS : sizeRows;
- sizeCols = sizeCols == 0 ? DEFAULT_COLS : sizeCols;
-
- int width = sizeCols * fm.getMaxAdvance ();
- int height = sizeRows * (fm.getMaxDescent () + fm.getMaxAscent ());
-
- create (width, height, ta.getScrollbarVisibility ());
- setEditable (ta.isEditable ());
- }
-
- public GtkTextAreaPeer (TextArea ta)
- {
- super (ta);
- }
-
- public native void insert (String str, int pos);
- public native void replaceRange (String str, int start, int end);
-
- public Dimension getMinimumSize (int rows, int cols)
- {
- return minimumSize (rows == 0 ? DEFAULT_ROWS : rows,
- cols == 0 ? DEFAULT_COLS : cols);
- }
-
- public Dimension getPreferredSize (int rows, int cols)
- {
- return preferredSize (rows == 0 ? DEFAULT_ROWS : rows,
- cols == 0 ? DEFAULT_COLS : cols);
- }
-
- native int getHScrollbarHeight ();
- native int getVScrollbarWidth ();
-
- // Deprecated
- public Dimension minimumSize (int rows, int cols)
- {
- TextArea ta = ((TextArea) awtComponent);
- int height = 0;
- int width = 0;
-
- if (ta.getScrollbarVisibility () == TextArea.SCROLLBARS_BOTH
- || ta.getScrollbarVisibility () == TextArea.SCROLLBARS_HORIZONTAL_ONLY)
- height = getHScrollbarHeight ();
-
- if (ta.getScrollbarVisibility () == TextArea.SCROLLBARS_BOTH
- || ta.getScrollbarVisibility () == TextArea.SCROLLBARS_VERTICAL_ONLY)
- width = getVScrollbarWidth ();
-
- Font f = awtComponent.getFont ();
- if (f == null)
- return new Dimension (width, height);
-
- FontMetrics fm = getFontMetrics (f);
-
- int sizeRows = rows == 0 ? DEFAULT_ROWS : rows;
- int sizeCols = cols == 0 ? DEFAULT_COLS : cols;
-
- width += sizeCols * fm.getMaxAdvance ();
- height += sizeRows * (fm.getMaxDescent () + fm.getMaxAscent ());
-
- return new Dimension (width, height);
- }
-
- public Dimension preferredSize (int rows, int cols)
- {
- TextArea ta = ((TextArea) awtComponent);
- int height = 0;
- int width = 0;
-
- if (ta.getScrollbarVisibility () == TextArea.SCROLLBARS_BOTH
- || ta.getScrollbarVisibility () == TextArea.SCROLLBARS_HORIZONTAL_ONLY)
- height = getHScrollbarHeight ();
-
- if (ta.getScrollbarVisibility () == TextArea.SCROLLBARS_BOTH
- || ta.getScrollbarVisibility () == TextArea.SCROLLBARS_VERTICAL_ONLY)
- width = getVScrollbarWidth ();
-
- Font f = awtComponent.getFont ();
- if (f == null)
- return new Dimension (width, height);
-
- FontMetrics fm = getFontMetrics (f);
-
- int sizeRows = rows == 0 ? DEFAULT_ROWS : rows;
- int sizeCols = cols == 0 ? DEFAULT_COLS : cols;
-
- width += sizeCols * fm.getMaxAdvance ();
- height += sizeRows * (fm.getMaxDescent () + fm.getMaxAscent ());
-
- return new Dimension (width, height);
- }
-
- public void replaceText (String str, int start, int end)
- {
- replaceRange (str, start, end);
- }
-
- public void insertText (String str, int pos)
- {
- insert (str, pos);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
deleted file mode 100644
index c1f1cf0e1ae..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* GtkTextComponentPeer.java -- Implements TextComponentPeer with GTK
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Rectangle;
-import java.awt.TextComponent;
-import java.awt.event.TextEvent;
-import java.awt.peer.TextComponentPeer;
-
-public class GtkTextComponentPeer extends GtkComponentPeer
- implements TextComponentPeer
-{
- GtkTextComponentPeer (TextComponent tc)
- {
- super (tc);
-
- setText (tc.getText ());
- setCaretPosition(0);
- }
-
- public native void connectSignals ();
-
- public native int getCaretPosition ();
- public native void setCaretPosition (int pos);
- public native int getSelectionStart ();
- public native int getSelectionEnd ();
- public native String getText ();
- public native void select (int start, int end);
- public native void setEditable (boolean state);
- public native void setText (String text);
-
- public int getIndexAtPoint(int x, int y)
- {
- return 0; // FIXME
- }
-
- public Rectangle getCharacterBounds (int pos)
- {
- return null;
- }
-
- public long filterEvents (long filter)
- {
- return filter; // FIXME
- }
-
- protected void postTextEvent ()
- {
- q().postEvent (new TextEvent (awtComponent, TextEvent.TEXT_VALUE_CHANGED));
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
deleted file mode 100644
index 1031f7cc9e6..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/* GtkTextFieldPeer.java -- Implements TextFieldPeer with GTK
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.AWTEvent;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.TextField;
-import java.awt.event.KeyEvent;
-import java.awt.peer.TextFieldPeer;
-
-public class GtkTextFieldPeer extends GtkTextComponentPeer
- implements TextFieldPeer
-{
- native void create (int width);
- native void gtkWidgetSetBackground (int red, int green, int blue);
- native void gtkWidgetSetForeground (int red, int green, int blue);
-
- void create ()
- {
- Font f = awtComponent.getFont ();
-
- // By default, Sun sets a TextField's font when its peer is
- // created. If f != null then the peer's font is set by
- // GtkComponent.create.
- if (f == null)
- {
- f = new Font ("Dialog", Font.PLAIN, 12);
- awtComponent.setFont (f);
- }
-
- FontMetrics fm = getFontMetrics (f);
-
- TextField tf = ((TextField) awtComponent);
- int cols = tf.getColumns ();
-
- int text_width = cols * fm.getMaxAdvance ();
-
- create (text_width);
-
- setEditable (tf.isEditable ());
- }
-
- native int gtkEntryGetBorderWidth ();
-
- native void gtkWidgetModifyFont (String name, int style, int size);
-
- public GtkTextFieldPeer (TextField tf)
- {
- super (tf);
-
- if (tf.echoCharIsSet ())
- setEchoChar (tf.getEchoChar ());
- }
-
- public Dimension getMinimumSize (int cols)
- {
- return minimumSize (cols);
- }
-
- public Dimension getPreferredSize (int cols)
- {
- return preferredSize (cols);
- }
-
- public native void setEchoChar (char c);
-
- // Deprecated
- public Dimension minimumSize (int cols)
- {
- int dim[] = new int[2];
-
- gtkWidgetGetPreferredDimensions (dim);
-
- Font f = awtComponent.getFont ();
- if (f == null)
- return new Dimension (2 * gtkEntryGetBorderWidth (), dim[1]);
-
- FontMetrics fm = getFontMetrics (f);
-
- int text_width = cols * fm.getMaxAdvance ();
-
- int width = text_width + 2 * gtkEntryGetBorderWidth ();
-
- return new Dimension (width, dim[1]);
- }
-
- public Dimension preferredSize (int cols)
- {
- int dim[] = new int[2];
-
- gtkWidgetGetPreferredDimensions (dim);
-
- Font f = awtComponent.getFont ();
- if (f == null)
- return new Dimension (2 * gtkEntryGetBorderWidth (), dim[1]);
-
- FontMetrics fm = getFontMetrics (f);
-
- int text_width = cols * fm.getMaxAdvance ();
-
- int width = text_width + 2 * gtkEntryGetBorderWidth ();
-
- return new Dimension (width, dim[1]);
- }
-
- public void setEchoCharacter (char c)
- {
- setEchoChar (c);
- }
-
- public void handleEvent (AWTEvent e)
- {
- if (e.getID () == KeyEvent.KEY_PRESSED)
- {
- KeyEvent ke = (KeyEvent) e;
-
- if (!ke.isConsumed ()
- && ke.getKeyCode () == KeyEvent.VK_ENTER)
- postActionEvent (getText (), ke.getModifiersEx ());
- }
-
- super.handleEvent (e);
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
deleted file mode 100644
index 10afde77c74..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
+++ /dev/null
@@ -1,670 +0,0 @@
-/* GtkToolkit.java -- Implements an AWT Toolkit using GTK for peers
- Copyright (C) 1998, 1999, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import gnu.classpath.Configuration;
-import gnu.java.awt.EmbeddedWindow;
-import gnu.java.awt.EmbeddedWindowSupport;
-import gnu.java.awt.peer.ClasspathFontPeer;
-import gnu.java.awt.peer.ClasspathTextLayoutPeer;
-import gnu.java.awt.peer.EmbeddedWindowPeer;
-
-import java.awt.*;
-import java.awt.datatransfer.Clipboard;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.peer.DragSourceContextPeer;
-import java.awt.font.FontRenderContext;
-import java.awt.im.InputMethodHighlight;
-import java.awt.image.BufferedImage;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageConsumer;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.peer.*;
-import java.io.InputStream;
-import java.net.URL;
-import java.text.AttributedString;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.imageio.spi.IIORegistry;
-
-/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
- This merits comment. We are basically calling Sun's bluff on this one.
- We think Sun has deprecated it simply to discourage its use as it is
- bad programming style. However, we need to get at a component's peer in
- this class. If getPeer() ever goes away, we can implement a hash table
- that will keep up with every window's peer, but for now this is faster. */
-
-/**
- * This class accesses a system property called
- * gnu.java.awt.peer.gtk.Graphics. If the property is defined and
- * equal to "Graphics2D", the cairo-based GdkGraphics2D will be used in
- * drawing contexts. Any other value will cause the older GdkGraphics
- * object to be used.
- */
-public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
- implements EmbeddedWindowSupport
-{
- Hashtable containers = new Hashtable();
- static EventQueue q;
- static Clipboard systemClipboard;
- static boolean useGraphics2dSet;
- static boolean useGraphics2d;
-
- public static boolean useGraphics2D()
- {
- if (useGraphics2dSet)
- return useGraphics2d;
- useGraphics2d = System.getProperty("gnu.java.awt.peer.gtk.Graphics",
- "Graphics").equals("Graphics2D");
- useGraphics2dSet = true;
- return useGraphics2d;
- }
-
- static native void gtkInit(int portableNativeSync);
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- System.loadLibrary("gtkpeer");
-
- int portableNativeSync;
- String portNatSyncProp =
- System.getProperty("gnu.classpath.awt.gtk.portable.native.sync");
-
- if (portNatSyncProp == null)
- portableNativeSync = -1; // unset
- else if (Boolean.valueOf(portNatSyncProp).booleanValue())
- portableNativeSync = 1; // true
- else
- portableNativeSync = 0; // false
-
- gtkInit(portableNativeSync);
- }
-
- public GtkToolkit ()
- {
- systemClipboard = new GtkClipboard ();
- }
-
- public native void beep();
- private native void getScreenSizeDimensions(int[] xy);
-
- public int checkImage (Image image, int width, int height,
- ImageObserver observer)
- {
- int status = ImageObserver.ALLBITS
- | ImageObserver.WIDTH
- | ImageObserver.HEIGHT;
-
- if (image instanceof GtkImage)
- {
- status = ((GtkImage) image).checkImage ();
- }
-
- if (observer != null)
- observer.imageUpdate (image, status,
- -1, -1,
- image.getWidth (observer),
- image.getHeight (observer));
-
- return status;
- }
-
- /**
- * A helper class to return to clients in cases where a BufferedImage is
- * desired but its construction fails.
- */
- private class GtkErrorImage extends Image
- {
- public GtkErrorImage()
- {
- }
-
- public int getWidth(ImageObserver observer)
- {
- return -1;
- }
-
- public int getHeight(ImageObserver observer)
- {
- return -1;
- }
-
- public ImageProducer getSource()
- {
-
- return new ImageProducer()
- {
- HashSet consumers = new HashSet();
- public void addConsumer(ImageConsumer ic)
- {
- consumers.add(ic);
- }
-
- public boolean isConsumer(ImageConsumer ic)
- {
- return consumers.contains(ic);
- }
-
- public void removeConsumer(ImageConsumer ic)
- {
- consumers.remove(ic);
- }
-
- public void startProduction(ImageConsumer ic)
- {
- consumers.add(ic);
- Iterator i = consumers.iterator();
- while(i.hasNext())
- {
- ImageConsumer c = (ImageConsumer) i.next();
- c.imageComplete(ImageConsumer.IMAGEERROR);
- }
- }
- public void requestTopDownLeftRightResend(ImageConsumer ic)
- {
- startProduction(ic);
- }
- };
- }
-
- public Graphics getGraphics()
- {
- return null;
- }
-
- public Object getProperty(String name, ImageObserver observer)
- {
- return null;
- }
- public Image getScaledInstance(int width, int height, int flags)
- {
- return new GtkErrorImage();
- }
-
- public void flush()
- {
- }
- }
-
-
- /**
- * Helper to return either a BufferedImage -- the argument -- or a
- * GtkErrorImage if the argument is null.
- */
-
- private Image bufferedImageOrError(BufferedImage b)
- {
- if (b == null)
- return new GtkErrorImage();
- else
- return b;
- }
-
-
- public Image createImage (String filename)
- {
- if (useGraphics2D())
- return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (filename));
- else
- {
- GdkPixbufDecoder d = new GdkPixbufDecoder (filename);
- GtkImage image = new GtkImage (d, null);
- d.startProduction (image);
- return image;
- }
- }
-
- public Image createImage (URL url)
- {
- if (useGraphics2D())
- return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (url));
- else
- {
- GdkPixbufDecoder d = new GdkPixbufDecoder (url);
- GtkImage image = new GtkImage (d, null);
- d.startProduction (image);
- return image;
- }
- }
-
- public Image createImage (ImageProducer producer)
- {
- if (useGraphics2D())
- return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (producer));
- else
- {
- GtkImage image = new GtkImage (producer, null);
- producer.startProduction (image);
- return image;
- }
- }
-
- public Image createImage (byte[] imagedata, int imageoffset,
- int imagelength)
- {
- if (useGraphics2D())
- return bufferedImageOrError(GdkPixbufDecoder.createBufferedImage (imagedata,
- imageoffset,
- imagelength));
- else
- {
- GdkPixbufDecoder d = new GdkPixbufDecoder (imagedata,
- imageoffset,
- imagelength);
- GtkImage image = new GtkImage (d, null);
- d.startProduction (image);
- return image;
- }
- }
-
- /**
- * Creates an ImageProducer from the specified URL. The image is assumed
- * to be in a recognised format.
- *
- * @param url URL to read image data from.
- */
- public ImageProducer createImageProducer(URL url)
- {
- return new GdkPixbufDecoder(url);
- }
-
- public ColorModel getColorModel ()
- {
- return ColorModel.getRGBdefault ();
- }
-
- public String[] getFontList ()
- {
- return (new String[] { "Dialog",
- "DialogInput",
- "Monospaced",
- "Serif",
- "SansSerif" });
- }
-
- private class LRUCache extends LinkedHashMap
- {
- int max_entries;
- public LRUCache(int max)
- {
- super(max, 0.75f, true);
- max_entries = max;
- }
- protected boolean removeEldestEntry(Map.Entry eldest)
- {
- return size() > max_entries;
- }
- }
-
- private LRUCache fontCache = new LRUCache(50);
- private LRUCache metricsCache = new LRUCache(50);
- private LRUCache imageCache = new LRUCache(50);
-
- public FontMetrics getFontMetrics (Font font)
- {
- synchronized (metricsCache)
- {
- if (metricsCache.containsKey(font))
- return (FontMetrics) metricsCache.get(font);
- }
-
- FontMetrics m = new GdkFontMetrics (font);
- synchronized (metricsCache)
- {
- metricsCache.put(font, m);
- }
- return m;
- }
-
- public Image getImage (String filename)
- {
- if (imageCache.containsKey(filename))
- return (Image) imageCache.get(filename);
- else
- {
- Image im = createImage(filename);
- imageCache.put(filename, im);
- return im;
- }
- }
-
- public Image getImage (URL url)
- {
- if (imageCache.containsKey(url))
- return (Image) imageCache.get(url);
- else
- {
- Image im = createImage(url);
- imageCache.put(url, im);
- return im;
- }
- }
-
- public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)
- {
- return null;
- }
-
- public native int getScreenResolution();
-
- public Dimension getScreenSize ()
- {
- int dim[] = new int[2];
- getScreenSizeDimensions(dim);
- return new Dimension(dim[0], dim[1]);
- }
-
- public Clipboard getSystemClipboard()
- {
- return systemClipboard;
- }
-
- public boolean prepareImage (Image image, int width, int height,
- ImageObserver observer)
- {
- GtkImage i = (GtkImage) image;
-
- if (i.isLoaded ()) return true;
-
- class PrepareImage extends Thread
- {
- GtkImage image;
- ImageObserver observer;
-
- PrepareImage (GtkImage image, ImageObserver observer)
- {
- this.image = image;
- image.setObserver (observer);
- }
-
- public void run ()
- {
- image.source.startProduction (image);
- }
- }
-
- new PrepareImage (i, observer).start ();
- return false;
- }
-
- public native void sync();
-
- protected void setComponentState (Component c, GtkComponentPeer cp)
- {
- /* Make the Component reflect Peer defaults */
- if (c.getForeground () == null)
- c.setForeground (cp.getForeground ());
- if (c.getBackground () == null)
- c.setBackground (cp.getBackground ());
- // if (c.getFont () == null)
- // c.setFont (cp.getFont ());
-
- /* Make the Peer reflect the state of the Component */
- if (! (c instanceof Window))
- {
- cp.setCursor (c.getCursor ());
-
- Rectangle bounds = c.getBounds ();
- cp.setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
- cp.setVisible (c.isVisible ());
- }
- }
-
- protected ButtonPeer createButton (Button b)
- {
- return new GtkButtonPeer (b);
- }
-
- protected CanvasPeer createCanvas (Canvas c)
- {
- return new GtkCanvasPeer (c);
- }
-
- protected CheckboxPeer createCheckbox (Checkbox cb)
- {
- return new GtkCheckboxPeer (cb);
- }
-
- protected CheckboxMenuItemPeer createCheckboxMenuItem (CheckboxMenuItem cmi)
- {
- return new GtkCheckboxMenuItemPeer (cmi);
- }
-
- protected ChoicePeer createChoice (Choice c)
- {
- return new GtkChoicePeer (c);
- }
-
- protected DialogPeer createDialog (Dialog d)
- {
- return new GtkDialogPeer (d);
- }
-
- protected FileDialogPeer createFileDialog (FileDialog fd)
- {
- return new GtkFileDialogPeer (fd);
- }
-
- protected FramePeer createFrame (Frame f)
- {
- return new GtkFramePeer (f);
- }
-
- protected LabelPeer createLabel (Label label)
- {
- return new GtkLabelPeer (label);
- }
-
- protected ListPeer createList (List list)
- {
- return new GtkListPeer (list);
- }
-
- protected MenuPeer createMenu (Menu m)
- {
- return new GtkMenuPeer (m);
- }
-
- protected MenuBarPeer createMenuBar (MenuBar mb)
- {
- return new GtkMenuBarPeer (mb);
- }
-
- protected MenuItemPeer createMenuItem (MenuItem mi)
- {
- return new GtkMenuItemPeer (mi);
- }
-
- protected PanelPeer createPanel (Panel p)
- {
- return new GtkPanelPeer (p);
- }
-
- protected PopupMenuPeer createPopupMenu (PopupMenu target)
- {
- return new GtkPopupMenuPeer (target);
- }
-
- protected ScrollPanePeer createScrollPane (ScrollPane sp)
- {
- return new GtkScrollPanePeer (sp);
- }
-
- protected ScrollbarPeer createScrollbar (Scrollbar sb)
- {
- return new GtkScrollbarPeer (sb);
- }
-
- protected TextAreaPeer createTextArea (TextArea ta)
- {
- return new GtkTextAreaPeer (ta);
- }
-
- protected TextFieldPeer createTextField (TextField tf)
- {
- return new GtkTextFieldPeer (tf);
- }
-
- protected WindowPeer createWindow (Window w)
- {
- return new GtkWindowPeer (w);
- }
-
- public EmbeddedWindowPeer createEmbeddedWindow (EmbeddedWindow w)
- {
- return new GtkEmbeddedWindowPeer (w);
- }
-
- /**
- * @deprecated part of the older "logical font" system in earlier AWT
- * implementations. Our newer Font class uses getClasspathFontPeer.
- */
- protected FontPeer getFontPeer (String name, int style) {
- // All fonts get a default size of 12 if size is not specified.
- return getFontPeer(name, style, 12);
- }
-
- /**
- * Private method that allows size to be set at initialization time.
- */
- private FontPeer getFontPeer (String name, int style, int size)
- {
- Map attrs = new HashMap ();
- ClasspathFontPeer.copyStyleToAttrs (style, attrs);
- ClasspathFontPeer.copySizeToAttrs (size, attrs);
- return getClasspathFontPeer (name, attrs);
- }
-
- /**
- * Newer method to produce a peer for a Font object, even though Sun's
- * design claims Font should now be peerless, we do not agree with this
- * model, hence "ClasspathFontPeer".
- */
-
- public ClasspathFontPeer getClasspathFontPeer (String name, Map attrs)
- {
- Map keyMap = new HashMap (attrs);
- // We don't know what kind of "name" the user requested (logical, face,
- // family), and we don't actually *need* to know here. The worst case
- // involves failure to consolidate fonts with the same backend in our
- // cache. This is harmless.
- keyMap.put ("GtkToolkit.RequestedFontName", name);
- if (fontCache.containsKey (keyMap))
- return (ClasspathFontPeer) fontCache.get (keyMap);
- else
- {
- ClasspathFontPeer newPeer = new GdkFontPeer (name, attrs);
- fontCache.put (keyMap, newPeer);
- return newPeer;
- }
- }
-
- public ClasspathTextLayoutPeer getClasspathTextLayoutPeer (AttributedString str,
- FontRenderContext frc)
- {
- return new GdkTextLayout(str, frc);
- }
-
- protected EventQueue getSystemEventQueueImpl()
- {
- synchronized (GtkToolkit.class)
- {
- if (q == null)
- {
- q = new EventQueue();
- GtkGenericPeer.enableQueue (q);
- }
- }
- return q;
- }
-
- protected native void loadSystemColors (int[] systemColors);
-
- public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e)
- {
- throw new Error("not implemented");
- }
-
- public Map mapInputMethodHighlight(InputMethodHighlight highlight)
- {
- throw new Error("not implemented");
- }
-
- public Rectangle getBounds()
- {
- int[] dims = new int[2];
- getScreenSizeDimensions(dims);
- return new Rectangle(0, 0, dims[0], dims[1]);
- }
-
- // ClasspathToolkit methods
-
- public GraphicsEnvironment getLocalGraphicsEnvironment()
- {
- return new GdkGraphicsEnvironment(this);
- }
-
- public Font createFont(int format, InputStream stream)
- {
- throw new UnsupportedOperationException();
- }
-
- public RobotPeer createRobot (GraphicsDevice screen) throws AWTException
- {
- return new GdkRobotPeer (screen);
- }
-
- public void registerImageIOSpis(IIORegistry reg)
- {
- GdkPixbufDecoder.registerSpis(reg);
- }
-
- public native boolean nativeQueueEmpty();
- public native void wakeNativeQueue();
- public native void iterateNativeQueue(EventQueue locked, boolean block);
-
-} // class GtkToolkit
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkVolatileImage.java b/libjava/gnu/java/awt/peer/gtk/GtkVolatileImage.java
deleted file mode 100644
index 496090a0940..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkVolatileImage.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/* GtkVolatileImage.java -- a hardware-accelerated image buffer
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.ImageCapabilities;
-import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.image.BufferedImage;
-import java.awt.image.ImageObserver;
-import java.awt.image.VolatileImage;
-
-public class GtkVolatileImage extends VolatileImage
-{
- private int width;
- private int height;
- private ImageCapabilities caps;
-
- public GtkVolatileImage(int width, int height)
- {
- this(width, height, null);
- }
-
- public GtkVolatileImage(int width, int height, ImageCapabilities caps)
- {
- this.width = width;
- this.height = height;
- this.caps = caps;
- }
-
- // FIXME: should return a buffered image snapshot of the accelerated
- // visual
- public BufferedImage getSnapshot()
- {
- return null;
- }
-
- public int getWidth()
- {
- return width;
- }
-
- public int getHeight()
- {
- return height;
- }
-
- // FIXME: should return a graphics wrapper around this image's
- // visual
- public Graphics2D createGraphics()
- {
- return null;
- }
-
- public int validate(GraphicsConfiguration gc)
- {
- return VolatileImage.IMAGE_OK;
- }
-
- public boolean contentsLost()
- {
- return false;
- }
-
- public ImageCapabilities getCapabilities()
- {
- return caps;
- }
-
- public synchronized Object getProperty (String name, ImageObserver observer)
- {
- return null;
- }
-
- public synchronized int getWidth (ImageObserver observer)
- {
- return width;
- }
-
- public synchronized int getHeight (ImageObserver observer)
- {
- return height;
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
deleted file mode 100644
index bd16f3c7695..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/* GtkWindowPeer.java -- Implements WindowPeer with GTK
- Copyright (C) 1998, 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Component;
-import java.awt.Frame;
-import java.awt.Window;
-import java.awt.event.WindowEvent;
-import java.awt.peer.WindowPeer;
-
-public class GtkWindowPeer extends GtkContainerPeer
- implements WindowPeer
-{
- protected static final int GDK_WINDOW_TYPE_HINT_NORMAL = 0;
- protected static final int GDK_WINDOW_TYPE_HINT_DIALOG = 1;
- protected static final int GDK_WINDOW_TYPE_HINT_MENU = 2;
- protected static final int GDK_WINDOW_TYPE_HINT_TOOLBAR = 3;
- protected static final int GDK_WINDOW_TYPE_HINT_SPLASHSCREEN = 4;
- protected static final int GDK_WINDOW_TYPE_HINT_UTILITY = 5;
- protected static final int GDK_WINDOW_TYPE_HINT_DOCK = 6;
- protected static final int GDK_WINDOW_TYPE_HINT_DESKTOP = 7;
-
- private boolean hasBeenShown = false;
- private int oldState = Frame.NORMAL;
-
- native void gtkWindowSetTitle (String title);
- native void gtkWindowSetResizable (boolean resizable);
- native void gtkWindowSetModal (boolean modal);
-
- int getWidth ()
- {
- return awtComponent.getWidth();
- }
-
- int getHeight ()
- {
- return awtComponent.getHeight();
- }
-
- native void create (int type, boolean decorated, GtkWindowPeer parent);
-
- void create (int type, boolean decorated)
- {
- GtkWindowPeer parent_peer = null;
- Component parent = awtComponent.getParent();
-
- if (parent != null)
- parent_peer = (GtkWindowPeer) awtComponent.getParent().getPeer();
-
- create (type, decorated, parent_peer);
- }
-
- void create ()
- {
- // Create a normal undecorated window.
- create (GDK_WINDOW_TYPE_HINT_NORMAL, false);
- }
-
- void setParent ()
- {
- setVisible (awtComponent.isVisible ());
- setEnabled (awtComponent.isEnabled ());
- }
-
- void setVisibleAndEnabled ()
- {
- }
-
- native void connectSignals ();
-
- public GtkWindowPeer (Window window)
- {
- super (window);
- }
-
- public native void toBack();
- public native void toFront();
-
- native void nativeSetBounds (int x, int y, int width, int height);
-
- public void setBounds (int x, int y, int width, int height)
- {
- nativeSetBounds (x, y,
- width - insets.left - insets.right,
- height - insets.top - insets.bottom);
- }
-
- public void setTitle (String title)
- {
- gtkWindowSetTitle (title);
- }
-
- native void setSize (int width, int height);
-
- public void setResizable (boolean resizable)
- {
- // Call setSize; otherwise when resizable is changed from true to
- // false the window will shrink to the dimensions it had before it
- // was resizable.
- setSize (awtComponent.getWidth() - insets.left - insets.right,
- awtComponent.getHeight() - insets.top - insets.bottom);
- gtkWindowSetResizable (resizable);
- }
-
- native void setBoundsCallback (Window window,
- int x, int y,
- int width, int height);
-
- protected void postInsetsChangedEvent (int top, int left,
- int bottom, int right)
- {
- insets.top = top;
- insets.left = left;
- insets.bottom = bottom;
- insets.right = right;
- }
-
- protected void postConfigureEvent (int x, int y, int width, int height)
- {
- int frame_x = x - insets.left;
- int frame_y = y - insets.top;
- int frame_width = width + insets.left + insets.right;
- int frame_height = height + insets.top + insets.bottom;
-
- if (frame_x != awtComponent.getX()
- || frame_y != awtComponent.getY()
- || frame_width != awtComponent.getWidth()
- || frame_height != awtComponent.getHeight())
- {
- setBoundsCallback ((Window) awtComponent,
- frame_x, frame_y, frame_width, frame_height);
-
- awtComponent.validate();
- }
- }
-
- native void nativeSetVisible (boolean b);
- public void setVisible (boolean b)
- {
- // Prevent the window manager from automatically placing this
- // window when it is shown.
- if (b)
- setBounds (awtComponent.getX(),
- awtComponent.getY(),
- awtComponent.getWidth(),
- awtComponent.getHeight());
- nativeSetVisible (b);
- }
-
- void postWindowEvent (int id, Window opposite, int newState)
- {
- if (id == WindowEvent.WINDOW_OPENED)
- {
- // Post a WINDOW_OPENED event the first time this window is shown.
- if (!hasBeenShown)
- {
- q().postEvent (new WindowEvent ((Window) awtComponent, id,
- opposite));
- hasBeenShown = true;
- }
- }
- else if (id == WindowEvent.WINDOW_STATE_CHANGED)
- {
- if (oldState != newState)
- {
- q().postEvent (new WindowEvent ((Window) awtComponent, id, opposite,
- oldState, newState));
- oldState = newState;
- }
- }
- else
- q().postEvent (new WindowEvent ((Window) awtComponent, id, opposite));
- }
-}
diff --git a/libjava/gnu/java/awt/peer/gtk/Test.java b/libjava/gnu/java/awt/peer/gtk/Test.java
deleted file mode 100644
index 66f37d814bd..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/Test.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/* Test.java -- Tests the GTK Toolkit
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.peer.*;
-import java.awt.datatransfer.*;
-import gnu.java.awt.image.*;
-import java.io.*;
-
-class Test
-{
- static int xs = 5, ys = 5;
-
- public static void main(String args[])
- {
- if (args.length == 0)
- {
- Properties prop=System.getProperties ();
- prop.put ("awt.toolkit","gnu.java.awt.peer.gtk.GtkToolkit");
- }
-
- final Frame f=new Frame();
- f.setTitle ("Red Hat Classpath");
-
-// f.addComponentListener (new ComponentAdapter() {
-// public void componentMoved (ComponentEvent e) {
-// System.out.println("component moved");
-// }
-// public void componentResized (ComponentEvent e) {
-// System.out.println("component resized");
-// }
-// });
- f.setSize(200,200);
-
- Panel pan=new Panel();
-
- final Label l = new Label ("Pithy Message:");
- l.setCursor (Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR));
- pan.add (l);
-
- TextField tf = new TextField("Hello world!");
- pan.add(tf);
-
- final Image img;
- img = Toolkit.getDefaultToolkit ().createImage (new XBMDecoder ("fvwm.xbm"));
-
-
- final Canvas ch = new Canvas () {
-
- public void update (Graphics g)
- {
- System.out.println ("update called");
- super.update (g);
- }
- public void paint (Graphics g) {
- g.drawString("Hello world!", xs+5, ys+10);
- g.setColor (Color.blue);
- g.drawLine (xs,ys,xs+20,ys+20);
-
-// System.out.println (TextArea.SCROLLBARS_BOTH);
-// System.out.println (TextArea.SCROLLBARS_HORIZONTAL_ONLY);
-// System.out.println (TextArea.SCROLLBARS_VERTICAL_ONLY);
-
-// Font f1 = new Font ("TimesRoman", Font.PLAIN, 10);
-// System.out.println (f1.getName ());
-// System.out.println (f1.getFamily ());
-
-// Font font = new Font ("Serif", Font.PLAIN, 18);
-// g.setFont (font);
-// g.setXORMode (Color.red);
-
-
-// System.out.println (g.getFontMetrics (font).stringWidth ("foobar"));
-
-// System.out.println (g.drawImage (img, 0, 0, this));
- }
- };
-
- ch.setSize(60, 60);
-// List ch=new List();
-// ch.add("Ding");
-// ch.add("September");
-// ch.add("Red");
-// ch.add("Quassia");
-// ch.add("Pterodactyl");
-
-// ch.addMouseListener(new MouseAdapter() {
-// public void mousePressed(MouseEvent e) {
-// System.out.println("mouse pressed ch");
-// System.out.println("shift = " + e.isShiftDown());
-// System.out.println("meta = " + e.isMetaDown());
-// System.out.println("alt = " + e.isAltDown());
-// System.out.println("ctrl = " + e.isControlDown());
-// System.out.println("x = " + e.getX());
-// System.out.println("y = " + e.getY());
-// System.out.println("clickcount = " + e.getClickCount());
-// System.out.println("when = " + e.getWhen());
-// System.out.println();
-// }
-// public void mouseReleased(MouseEvent e) {
-// System.out.println("mouse released ch");
-// }
-// public void mouseClicked(MouseEvent e) {
-// System.out.println("mouse clicked ch");
-// }
-// });
-
- pan.add(ch);
- f.add(pan,"North");
-
- final ScrollPane sp=new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
- System.out.println ("ALWAYS HERE: " + ScrollPane.SCROLLBARS_ALWAYS);
- System.out.println ("ALWAYS" + ScrollPane.SCROLLBARS_ALWAYS);
- System.out.println ("NEEDED" + ScrollPane.SCROLLBARS_AS_NEEDED);
- System.out.println ("NEVER " + ScrollPane.SCROLLBARS_NEVER);
-
-
- final Panel p=new Panel();
- System.out.println ("PREFERED: " + p.getPreferredSize ());
- p.add(new Button("Stop"));
- System.out.println ("PREFERED: " + p.getPreferredSize ());
- p.add(new Button("evil"));
- System.out.println ("PREFERED: " + p.getPreferredSize ());
- p.add(new Button("hoarders"));
- p.add(new Button("use"));
- p.add(new Button("GNU"));
- p.add(new Scrollbar(Scrollbar.HORIZONTAL));
- System.out.println ("PREFERED: " + p.getPreferredSize ());
-
- sp.add(p);
- f.add(sp,"South");
-
- Panel east_panel = new Panel();
- east_panel.setLayout(new GridLayout (0,1));
-
-// CheckboxGroup group = new CheckboxGroup();
-
-// Checkbox cb=new Checkbox("one", group, true);
-// east_panel.add(cb);
-// cb=new Checkbox("two", group, false);
-// east_panel.add(cb);
-
-// cb.addMouseListener(new MouseAdapter() {
-// public void mousePressed(MouseEvent e) {
-// System.out.println("mouse pressed cb");
-// System.out.println("shift = " + e.isShiftDown());
-// System.out.println("meta = " + e.isMetaDown());
-// System.out.println("alt = " + e.isAltDown());
-// System.out.println("ctrl = " + e.isControlDown());
-// System.out.println("x = " + e.getX());
-// System.out.println("y = " + e.getY());
-// System.out.println("clickcount = " + e.getClickCount());
-// System.out.println("when = " + e.getWhen());
-// System.out.println();
-// }
-// public void mouseReleased(MouseEvent e) {
-// System.out.println("mouse released cb");
-// }
-// public void mouseClicked(MouseEvent e) {
-// System.out.println("mouse clicked cb");
-// }
-// public void mouseEntered(MouseEvent e) {
-// System.out.println("mouse entered cb");
-// }
-// public void mouseExited(MouseEvent e) {
-// System.out.println("mouse exited cb");
-// }
-// });
-
- f.add(east_panel,"East");
-
- final Button wb=new Button();
- wb.setLabel("Destroy Frame on Click");
- wb.addActionListener (new ActionListener () {
- public void actionPerformed (ActionEvent e) {
- ScrollPanePeer peer = (ScrollPanePeer)sp.getPeer ();
- if (peer != null)
- {
- System.out.println (peer.getHScrollbarHeight ());
- System.out.println (peer.getVScrollbarWidth ());
- }
-
- l.setText ("Hello World!");
- System.out.println ("PREFERED: " + p.getPreferredSize ());
-
- final Dialog d = new Dialog (f);
- d.setModal (true);
- Button b = new Button ("foobar");
- b.addMouseListener (new MouseAdapter () {
- public void mousePressed (MouseEvent me) {
- System.out.println ("I got called");
- d.hide ();
-
-// System.out.println (ScrollPane.SCROLLBARS_ALWAYS);
-// System.out.println (ScrollPane.SCROLLBARS_AS_NEEDED);
-// System.out.println (ScrollPane.SCROLLBARS_NEVER);
- }
- });
- d.add (b);
- d.pack ();
- d.show ();
- System.out.println ("hello world");
-// System.out.println ("action listener on wb called");
-// Clipboard clip = Toolkit.getDefaultToolkit ().getSystemClipboard ();
-// StringSelection ss = new StringSelection("123456789");
-// clip.setContents (ss, ss);
-// Transferable t = clip.getContents (this);
-// try {
-// System.out.println (t.getTransferData (DataFlavor.stringFlavor));
-// } catch (Exception ex) {
-// ex.printStackTrace ();
-// }
-// System.exit (0);
- }
- });
-
- wb.addMouseListener(new MouseAdapter() {
- public void mousePressed(MouseEvent e) {
- System.out.println("mouse pressed wb");
- xs++;
- ys++;
- ch.repaint ();
- }
- public void mouseReleased(MouseEvent e) {
- System.out.println("mouse released wb");
- }
- public void mouseClicked(MouseEvent e) {
- System.out.println("mouse clicked wb");
- }
- public void mouseEntered(MouseEvent e) {
- System.out.println("mouse entered wb");
- }
- public void mouseExited(MouseEvent e) {
- System.out.println("mouse exited wb");
- }
- });
-
- f.add(wb,"West");
-
- f.pack();
- f.show();
-
- sp.setScrollPosition (10,0);
-
- Toolkit t = Toolkit.getDefaultToolkit();
- /* t.beep(); */
- System.out.println("screen size: " + t.getScreenSize());
- System.out.println("resolution : " + t.getScreenResolution());
-// try {
-// Thread.sleep (5000);
-// } catch (InterruptedException e) {}
-// f.setSize(500,500);
-
- System.out.println ("background of canvas: " + ch.getBackground ());
- System.out.println ("foreground of canvas: " + ch.getForeground ());
-
- System.out.println("done");
- }
-}
-
-
-
diff --git a/libjava/gnu/java/awt/peer/gtk/TestAWT.java b/libjava/gnu/java/awt/peer/gtk/TestAWT.java
deleted file mode 100644
index 3fb00a4f2d6..00000000000
--- a/libjava/gnu/java/awt/peer/gtk/TestAWT.java
+++ /dev/null
@@ -1,613 +0,0 @@
-/* TestAWT.java -- Tests the AWT like testgtk
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-import java.awt.List;
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.peer.*;
-
-class TestAWT
-{
- public static void main(String args[])
- {
- if (args.length==0)
- {
- Properties prop = System.getProperties ();
- prop.put ("awt.toolkit", "gnu.java.awt.peer.gtk.GtkToolkit");
- }
- MainWindow f = new MainWindow();
- System.out.println(f.isDisplayable());
- f.show();
- System.out.println(f.isDisplayable());
- }
-}
-
-interface SubWindow
-{
- public void init ();
-}
-
-class PrettyPanel extends Panel
-{
- Insets myInsets;
-
- public PrettyPanel ()
- {
- myInsets = new Insets (10, 10, 10, 10);
- }
- public Insets getInsets ()
- {
- return myInsets;
- }
-}
-
-abstract class PrettyFrame extends Frame
-{
- public PrettyFrame ()
- {
- ((BorderLayout) getLayout ()).setHgap (5);
- ((BorderLayout) getLayout ()).setVgap (5);
- }
-
-// public Insets getInsets()
-// {
-// Insets oldInsets = super.getInsets ();
-// return new Insets (oldInsets.top+10,
-// oldInsets.left+10,
-// oldInsets.bottom+10,
-// oldInsets.right+10);
-// }
-}
-
-abstract class SubFrame extends PrettyFrame implements SubWindow
-{
- boolean initted = false;
-
- public void setVisible (boolean visible)
- {
- if (!initted && visible)
- init();
- super.setVisible (visible);
- }
-}
-
-class MainWindow extends PrettyFrame implements ActionListener
-{
- Button closeButton;
-
- Hashtable windows;
- Vector buttons;
-
- void addSubWindow (String name, SubWindow w)
- {
- Button b = new Button (name);
- b.addActionListener (this);
-
- buttons.addElement (b);
- windows.put (b, w);
- }
-
- MainWindow ()
- {
- MenuBar mb = new MenuBar ();
- Menu menu = new Menu ("File");
- Menu submenu = new Menu ("Testing");
- submenu.add (new CheckboxMenuItem ("Foobar"));
- menu.add (submenu);
- mb.add (menu);
-
- setMenuBar (mb);
-
- add (new Label ("Classpath v0.0.0"), "North");
-
- closeButton = new Button ("Close");
- closeButton.addActionListener (this);
- closeButton.setFont (new Font ("Serif", Font.BOLD | Font.ITALIC, 18));
- add (closeButton, "South");
-
- windows = new Hashtable ();
- buttons = new Vector ();
-
- addSubWindow ("Buttons", new ButtonsWindow ());
- addSubWindow ("Cursors", new CursorsWindow ());
- addSubWindow ("Dialog", new DialogWindow (this));
- addSubWindow ("File", new FileWindow (this));
- addSubWindow ("Labels", new LabelWindow ());
- addSubWindow ("List", new ListWindow ());
- addSubWindow ("Radio Buttons", new RadioWindow ());
- addSubWindow ("TextField", new TextFieldWindow ());
-
- Panel sp = new Panel();
- PrettyPanel p = new PrettyPanel();
- p.setLayout (new GridLayout (windows.size(), 1));
-
- for (Enumeration e = buttons.elements (); e.hasMoreElements (); )
- {
- p.add ((Button) e.nextElement ());
- }
-
- sp.add (p);
- add (sp, "Center");
-
- setSize (200, 86 + (windows.size ()*22));
- setTitle ("TestAWT");
- }
-
- public void actionPerformed (ActionEvent evt)
- {
- Button source = (Button) evt.getSource ();
-
- if (source==closeButton)
- {
- System.getProperties ().list (System.out);
- dispose();
- System.exit (0);
- }
-
- Window w = (Window) windows.get (source);
- if (w.isVisible ())
- w.dispose ();
- else
- {
- if (w instanceof Dialog)
- {
- System.out.println ("Will 'show'");
- w.show();
- System.out.println ("Has shown");
- }
- else
- {
- w.setVisible (true);
- }
- }
- }
-}
-
-class ButtonsWindow extends SubFrame implements ActionListener
-{
- Button b[] = new Button [9];
-
- public void init ()
- {
- initted = true;
- Panel p = new Panel ();
- p.setLayout (new GridLayout (0, 3, 5, 5));
-
- for (int i=0; i<9; i++)
- {
- b[i]=new Button ("button" + (i+1));
- b[i].addActionListener (this);
- }
-
- p.add (b[0]);
- p.add (b[6]);
- p.add (b[4]);
- p.add (b[8]);
- p.add (b[1]);
- p.add (b[7]);
- p.add (b[3]);
- p.add (b[5]);
- p.add (b[2]);
-
- add (p, "North");
-
- Button cb = new Button ("close");
- cb.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e) {
- dispose();
- }
- });
- add (cb, "South");
- setTitle ("Buttons");
- }
-
- public void actionPerformed (ActionEvent evt)
- {
- Button source = (Button) evt.getSource ();
-
- for (int i=0; i<9; i++)
- {
- if (source == b[i])
- {
- int i2=((i+1)==9)?0:(i+1);
- if (b[i2].isVisible())
- b[i2].setVisible(false);
- else
- b[i2].setVisible(true);
- }
- }
- }
-}
-
-
-class DialogWindow extends Dialog implements SubWindow
-{
- Label text;
- Frame parent;
- boolean initted = false;
-
- public DialogWindow (Frame f)
- {
- super (f, true);
-
- this.parent = f;
-
- addWindowListener (new WindowAdapter ()
- {
- public void windowClosing (WindowEvent e)
- {
- System.out.println ("Window Closing");
- text.setVisible (false);
- hide ();
- }
- });
- }
-
- public void setVisible (boolean visible)
- {
- if (!initted && visible)
- init();
- super.setVisible (visible);
- }
-
- public void show ()
- {
- if (!initted)
- init();
- super.show ();
- }
-
- public void init ()
- {
- text = new Label ("Dialog Test");
- text.setAlignment (Label.CENTER);
-
- add (text, "North");
- text.setVisible (false);
-
- Panel p = new PrettyPanel();
-
- Button cb = new Button ("OK");
- cb.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e)
- {
- text.setVisible (false);
- hide();
- }
- });
-
- p.setLayout (new GridLayout (1, 3));
- ((GridLayout) p.getLayout ()).setHgap (5);
- ((GridLayout) p.getLayout ()).setVgap (5);
- p.add (cb);
-
- Button toggle = new Button ("Toggle");
- p.add (toggle);
-
- toggle.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e)
- {
- if (text.isVisible ())
- text.setVisible (false);
- else
- text.setVisible (true);
- doLayout();
- }
- });
-
- Button subdlg = new Button ("SubDialog");
- p.add (subdlg);
-
- subdlg.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e)
- {
- DialogWindow sw = new DialogWindow (parent);
- System.out.println ("Will show modal sub dialog");
- sw.show ();
- System.out.println ("Has shown modal sub dialog");
- }
- });
-
- add (p, "South");
- setTitle ("Dialog");
- setSize (240, 120);
- }
-}
-
-class CursorsWindow extends SubFrame implements ItemListener
-{
- Choice cursorChoice;
- Canvas cursorCanvas;
-
- public void init ()
- {
- cursorChoice = new Choice();
- cursorChoice.add ("Default");
- cursorChoice.add ("Crosshair");
- cursorChoice.add ("Text");
- cursorChoice.add ("Wait");
- cursorChoice.add ("Southwest Resize");
- cursorChoice.add ("Southeast Resize");
- cursorChoice.add ("Northwest Resize");
- cursorChoice.add ("Northeast Resize");
- cursorChoice.add ("North Resize");
- cursorChoice.add ("South Resize");
- cursorChoice.add ("West Resize");
- cursorChoice.add ("East Resize");
- cursorChoice.add ("Hand");
- cursorChoice.add ("Move");
-
- cursorChoice.addItemListener(this);
-
- add (cursorChoice, "North");
-
- cursorCanvas = new Canvas ()
- {
- public void paint (Graphics g)
- {
- Dimension d = this.getSize();
- g.setColor (Color.white);
- g.fillRect (0, 0, d.width, d.height/2);
- g.setColor (Color.black);
- g.fillRect (0, d.height/2, d.width, d.height/2);
- g.setColor (this.getBackground());
- g.fillRect (d.width/3, d.height/3, d.width/3,
- d.height/3);
- }
- };
-
- cursorCanvas.setSize (80,80);
-
- add (cursorCanvas, "Center");
-
- Button cb = new Button ("Close");
- cb.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e) {
- dispose();
- }
- });
-
- add (cb, "South");
- setTitle ("Cursors");
- setSize (160, 180);
- }
-
- public void itemStateChanged (ItemEvent e)
- {
- cursorCanvas.setCursor (Cursor.getPredefinedCursor (cursorChoice.getSelectedIndex()));
- }
-}
-
-class TextFieldWindow extends SubFrame implements ItemListener
-{
- Checkbox editable, visible, sensitive;
- TextField text;
-
- public void init ()
- {
- initted = true;
- text = new TextField ("hello world");
- add (text, "North");
-
- Panel p = new Panel();
- p.setLayout (new GridLayout (3, 1));
- ((GridLayout) p.getLayout ()).setHgap (5);
- ((GridLayout) p.getLayout ()).setVgap (5);
-
- editable = new Checkbox("Editable", true);
- p.add (editable);
- editable.addItemListener (this);
-
- visible = new Checkbox("Visible", true);
- p.add (visible);
- visible.addItemListener (this);
-
- sensitive = new Checkbox("Sensitive", true);
- p.add (sensitive);
- sensitive.addItemListener (this);
-
- add (p, "Center");
-
- Button cb = new Button ("Close");
- cb.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e) {
- dispose();
- }
- });
-
- add (cb, "South");
- setTitle ("TextField");
- setSize (160, 180);
- }
-
- public void itemStateChanged (ItemEvent e)
- {
- boolean on=true;
-
- if (e.getStateChange () == ItemEvent.DESELECTED)
- on=false;
- if (e.getSource() == editable)
- text.setEditable (on);
- if (e.getSource() == visible)
- if (on)
- text.setEchoChar ((char) 0);
- else
- text.setEchoChar ('*');
- if (e.getSource() == sensitive)
- text.setEnabled (on);
-
- }
-}
-
-class FileWindow extends FileDialog implements SubWindow
-{
- boolean initted = false;
-
- public FileWindow (MainWindow mw)
- {
- super (mw);
- }
-
- public void setVisible (boolean visible)
- {
- if (!initted && visible)
- init();
- super.setVisible (visible);
- }
-
- public void init()
- {
- initted = true;
- }
-}
-
-class LabelWindow extends SubFrame
-{
- public void init ()
- {
- initted = true;
-
- Panel p = new Panel();
- p.setLayout (new GridLayout (3, 1));
- ((GridLayout) p.getLayout ()).setHgap (5);
- ((GridLayout) p.getLayout ()).setVgap (5);
-
- p.add (new Label ("left justified label", Label.LEFT));
- p.add (new Label ("center justified label", Label.CENTER));
- p.add (new Label ("right justified label", Label.RIGHT));
-
- add (p, "Center");
-
- Button cb = new Button ("Close");
- cb.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e) {
- dispose();
- }
- });
-
- add (cb, "South");
- setTitle ("Labels");
- setSize (160, 180);
- }
-}
-
-class ListWindow extends SubFrame
-{
- public void init ()
- {
- initted = true;
-
- Panel p = new Panel ();
- p.setLayout (new GridLayout (3, 1));
-
- List l = new List (5, true);
- for (int i = 0; i < 10; i++)
- l.add ("added item " + i);
-
- p.add (l);
-
- add (p, "Center");
-
- Button cb = new Button ("Close");
- cb.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e) {
- dispose();
- }
- });
-
- add (cb, "South");
- setTitle ("List");
- setSize (85, 167);
- }
-}
-
-
-class RadioWindow extends SubFrame
-{
- public void init ()
- {
- initted = true;
-
- Panel p = new Panel();
- p.setLayout (new GridLayout (3, 1));
- ((GridLayout) p.getLayout ()).setHgap (5);
- ((GridLayout) p.getLayout ()).setVgap (5);
-
- final CheckboxGroup cg = new CheckboxGroup();
- final Checkbox[] boxes = new Checkbox[3];
- for (int i = 0; i < 3; ++i)
- {
- boxes[i] = new Checkbox("button" + i, cg, i == 0);
- p.add(boxes[i]);
- }
-
- add (p, "North");
-
- p = new Panel();
- p.setLayout (new GridLayout (1, 3));
- ((GridLayout) p.getLayout ()).setHgap (5);
- ((GridLayout) p.getLayout ()).setVgap (5);
-
- for (int i = 0; i < 3; ++i)
- {
- final int val = i;
- Button tweak = new Button ("Set " + i);
- tweak.addActionListener(new ActionListener ()
- {
- public void actionPerformed (ActionEvent e)
- {
- cg.setSelectedCheckbox(boxes[val]);
- }
- });
- p.add(tweak);
- }
-
- add (p, "Center");
-
- Button cb = new Button ("Close");
- cb.addActionListener(new ActionListener () {
- public void actionPerformed (ActionEvent e) {
- dispose();
- }
- });
-
- add (cb, "South");
- setTitle ("Radio Buttons");
- setSize (85, 167);
- }
-}
diff --git a/libjava/gnu/java/beans/BeanInfoEmbryo.java b/libjava/gnu/java/beans/BeanInfoEmbryo.java
deleted file mode 100644
index 0cf73e5b9ae..00000000000
--- a/libjava/gnu/java/beans/BeanInfoEmbryo.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/* gnu.java.beans.BeanInfoEmbryo
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans;
-
-import java.beans.BeanDescriptor;
-import java.beans.BeanInfo;
-import java.beans.EventSetDescriptor;
-import java.beans.IndexedPropertyDescriptor;
-import java.beans.MethodDescriptor;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.Vector;
-
-/**
- ** A BeanInfoEmbryo accumulates information about a Bean
- ** while it is in the process of being created, and then
- ** when you are done accumulating the information, the
- ** getBeanInfo() method may be called to create a BeanInfo
- ** object based on the information.Applet
- * beans being created with {@link java.beans.Beans.instantiate}.null
object on
- * URL.openConnection()
.
- *
- * @see java.applet.AppletContext#getAudioClip(java.net.URL)
- *
- * FIXME: When Java Sound API (javax.sound) is included in Classpath or URL is able to handle
- * sampled sound this should be adjusted.
- */
- public AudioClip getAudioClip(URL url)
- {
- try
- {
- return (url.openConnection() != null ? DUMMY_CLIP : null);
- }
- catch (IOException ioe)
- {
- return null;
- }
- }
-
- /** Loads the Image
instance by delegating to
- * {@link java.awt.Toolkit.createImage(URL) }.
- *
- * @see java.applet.AppletContext#getImage(java.net.URL)
- * @see java.awt.Toolkit#createImage(java.net.URL)
- */
- public Image getImage(URL url)
- {
- return Toolkit.getDefaultToolkit().createImage(url);
- }
-
- /** Returns null
for every argument.
- *
- * @see java.applet.AppletContext#getApplet(java.lang.String)
- */
- public Applet getApplet(String name)
- {
- return null;
- }
-
- /** Returns always an empty Enumeration
.
- *
- * @see java.applet.AppletContext#getApplets()
- */
- public Enumeration getApplets()
- {
- return EMPTY_ENUMERATION;
- }
-
- /** Does nothing.
- *
- * @see java.applet.AppletContext#showDocument(java.net.URL)
- */
- public void showDocument(URL url)
- {
- }
-
- /** Does nothing.
- *
- * @see java.applet.AppletContext#showDocument(java.net.URL, java.lang.String)
- */
- public void showDocument(URL url, String target)
- {
- }
-
- /** Does nothing.
- *
- * @see java.applet.AppletContext#showStatus(java.lang.String)
- */
- public void showStatus(String message)
- {
- }
-
- /** Does nothing.
- *
- * @see java.applet.AppletContext#setStream(java.lang.String, java.io.InputStream)
- */
- public void setStream(String key, InputStream stream)
- throws IOException
- {
- throw new IOException("Dummy implementation imposes zero InputStream associations.");
- }
-
- /** Returns null
for every argument.
- *
- * @see java.applet.AppletContext#getStream(java.lang.String)
- */
- public InputStream getStream(String key)
- {
- return null;
- }
-
- /** Returns always an empty iterator.
- *
- * @see java.applet.AppletContext#getStreamKeys()
- */
- public Iterator getStreamKeys()
- {
- return Collections.EMPTY_SET.iterator();
- }
-
- /** Dummy AudioClip
implementation that does nothing but
- * preventing NullPointerException
S being thrown in programs
- * that expect a valid AudioClip
instance to be returned by
- * their Applet.
- *
- * @author Robert Schuster
- */
- static class DummyAudioClip implements AudioClip
- {
- public void play()
- {
- }
-
- public void stop()
- {
- }
-
- public void loop()
- {
- }
-
- public String toString()
- {
- return "DummyAudioClip never plays anything - implement javax.sound and make us happy :)";
- }
- }
-}
diff --git a/libjava/gnu/java/beans/DummyAppletStub.java b/libjava/gnu/java/beans/DummyAppletStub.java
deleted file mode 100644
index 3bcb43534cf..00000000000
--- a/libjava/gnu/java/beans/DummyAppletStub.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/* gnu.java.beans.DummyAppletStub
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans;
-
-import java.applet.AppletContext;
-import java.applet.AppletStub;
-import java.net.URL;
-
-/** Placeholder implementation of AppletStub
providing no functionality.
- * Applet
being created with
- * {@link java.beans.Bean.instantiate}.true
.
- *
- * @see java.applet.AppletStub#isActive()
- */
- public boolean isActive()
- {
- return true;
- }
-
- /**
- * @see java.applet.AppletStub#getDocumentBase()
- */
- public URL getDocumentBase()
- {
- return documentBase;
- }
-
- /**
- * @see java.applet.AppletStub#getCodeBase()
- */
- public URL getCodeBase()
- {
- return codeBase;
- }
-
- /** Implementation returns null
for every parameter name.
- *
- * @see java.applet.AppletStub#getParameter(java.lang.String)
- */
- public String getParameter(String name)
- {
- return null;
- }
-
- /** Returns a non-functional context instance.
- *
- * @see java.applet.AppletStub#getAppletContext()
- */
- public AppletContext getAppletContext()
- {
- return context;
- }
-
- /** Does nothing.
- *
- * @see java.applet.AppletStub#appletResize(int, int)
- */
- public void appletResize(int width, int height)
- {
- }
-}
diff --git a/libjava/gnu/java/beans/ExplicitBeanInfo.java b/libjava/gnu/java/beans/ExplicitBeanInfo.java
deleted file mode 100644
index 6da5e869695..00000000000
--- a/libjava/gnu/java/beans/ExplicitBeanInfo.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/* ExplicitBeanInfo.java --
- Copyright (C) 1998, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans;
-
-import java.awt.Image;
-import java.beans.BeanDescriptor;
-import java.beans.BeanInfo;
-import java.beans.EventSetDescriptor;
-import java.beans.MethodDescriptor;
-import java.beans.PropertyDescriptor;
-
-/**
- ** ExplicitBeanInfo lets you specify in the constructor
- ** all the various parts of the BeanInfo.
- **
- ** @author John Keiser
- ** @version 1.1.0, 30 Jul 1998
- ** @see java.beans.BeanInfo
- **/
-
-public class ExplicitBeanInfo implements BeanInfo {
- /** The BeanDescriptor returned by getBeanDescriptor. **/
- protected BeanDescriptor beanDescriptor;
-
- /** The EventSetDescriptor array returned by
- ** getEventSetDescriptors().
- **/
- protected EventSetDescriptor[] eventSetDescriptors = new EventSetDescriptor[0];
-
- /** The PropertyDescriptor array returned by
- ** getPropertyDescriptors().
- **/
- protected PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[0];
-
- /** The MethodDescriptor array returned by
- ** getMethodDescriptors().
- **/
- protected MethodDescriptor[] methodDescriptors;
-
- /** The default property index. **/
- protected int defaultPropertyIndex;
-
- /** The default event index. **/
- protected int defaultEventIndex;
-
- /** The BeanInfo array returned by
- ** getAdditionalBeanInfo().
- **/
- protected BeanInfo[] additionalBeanInfo;
-
- /** The set of icons. **/
- protected Image[] icons;
-
- public ExplicitBeanInfo(BeanDescriptor beanDescriptor,
- BeanInfo[] additionalBeanInfo,
- PropertyDescriptor[] propertyDescriptors,
- int defaultPropertyIndex,
- EventSetDescriptor[] eventSetDescriptors,
- int defaultEventIndex,
- MethodDescriptor[] methodDescriptors,
- Image[] icons) {
- this.beanDescriptor = beanDescriptor;
- this.additionalBeanInfo = additionalBeanInfo;
- this.propertyDescriptors = propertyDescriptors;
- this.defaultPropertyIndex = defaultPropertyIndex;
- this.eventSetDescriptors = eventSetDescriptors;
- this.defaultEventIndex = defaultEventIndex;
- this.methodDescriptors = methodDescriptors;
- this.icons = icons;
- }
-
- /** Get Bean descriptor. **/
- public BeanDescriptor getBeanDescriptor() {
- return beanDescriptor;
- }
-
- /** Get Bean events. **/
- public EventSetDescriptor[] getEventSetDescriptors() {
- return eventSetDescriptors;
- }
-
- /** Get default event set. **/
- public int getDefaultEventIndex() {
- return defaultEventIndex;
- }
-
- /** Get Bean properties. **/
- public PropertyDescriptor[] getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- /** Get "default" property. **/
- public int getDefaultPropertyIndex() {
- return defaultPropertyIndex;
- }
-
- /** Get Bean methods. **/
- public MethodDescriptor[] getMethodDescriptors() {
- return methodDescriptors;
- }
-
- /** Get additional Bean info. **/
- public BeanInfo[] getAdditionalBeanInfo() {
- return additionalBeanInfo;
- }
-
- /** Get Bean icons.
- ** @param iconType the type of icon
- **/
- public Image getIcon(int iconType) {
- return icons != null ? icons[iconType - 1] : null;
- }
-}
diff --git a/libjava/gnu/java/beans/IntrospectionIncubator.java b/libjava/gnu/java/beans/IntrospectionIncubator.java
deleted file mode 100644
index e0d9480e327..00000000000
--- a/libjava/gnu/java/beans/IntrospectionIncubator.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/* gnu.java.beans.IntrospectionIncubator
- Copyright (C) 1998, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.beans;
-
-import gnu.java.lang.ArrayHelper;
-import gnu.java.lang.ClassHelper;
-
-import java.beans.BeanInfo;
-import java.beans.EventSetDescriptor;
-import java.beans.IndexedPropertyDescriptor;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.MethodDescriptor;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- ** IntrospectionIncubator takes in a bunch of Methods, and
- ** Introspects only those Methods you give it.
- **
- ** See {@link addMethod(Method)} for details which rules apply to
- ** the methods.
- **
- ** @author John Keiser
- ** @author Robert Schuster
- ** @see gnu.java.beans.ExplicitBeanInfo
- ** @see java.beans.BeanInfo
- **/
-
-public class IntrospectionIncubator {
- Hashtable propertyMethods = new Hashtable();
- Hashtable listenerMethods = new Hashtable();
- Vector otherMethods = new Vector();
-
- Class propertyStopClass;
- Class eventStopClass;
- Class methodStopClass;
-
- public IntrospectionIncubator() {
- }
-
- /** Examines the given method and files it in a suitable collection.
- * It files the method as a property method if it finds:
- *
- *
- * It files the method as a listener method if all of these rules apply:
- *
- *
- * All public methods are filed as such.
- *
- * @param method The method instance to examine.
- */
- public void addMethod(Method method) {
- if(Modifier.isPublic(method.getModifiers())) {
- String name = ClassHelper.getTruncatedName(method.getName());
- Class retType = method.getReturnType();
- Class[] params = method.getParameterTypes();
- boolean isVoid = retType.equals(java.lang.Void.TYPE);
- Class methodClass = method.getDeclaringClass();
-
- /* Accepts the method for examination if no stop class is given or the method is declared in a subclass of the stop class.
- * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}.
- * This block finds out whether the method is a suitable getter or setter method (or read/write method).
- */
- if(isReachable(propertyStopClass, methodClass)) {
- /* At this point a method may regarded as a property's read or write method if its name
- * starts with "is", "get" or "set". However, if a method is static it cannot be part
- * of a property.
- */
- if(Modifier.isStatic(method.getModifiers())) {
- // files method as other because it is static
- otherMethods.addElement(method);
- } else if(name.startsWith("is")
- && retType.equals(java.lang.Boolean.TYPE)
- && params.length == 0) {
- // files method as boolean "is" style getter
- addToPropertyHash(name,method,IS);
- } else if(name.startsWith("get") && !isVoid) {
- if(params.length == 0) {
- // files as legal non-argument getter
- addToPropertyHash(name,method,GET);
- } else if(params.length == 1 && params[0].equals(java.lang.Integer.TYPE)) {
- // files as legal indiced getter
- addToPropertyHash(name,method,GET_I);
- } else {
- // files as other because the method's signature is not Bean-like
- otherMethods.addElement(method);
- }
- } else if(name.startsWith("set") && isVoid) {
- if(params.length == 1) {
- // files as legal single-argument setter method
- addToPropertyHash(name,method,SET);
- } else if(params.length == 2 && params[0].equals(java.lang.Integer.TYPE)) {
- // files as legal indiced setter method
- addToPropertyHash(name,method,SET_I);
- } else {
- // files as other because the method's signature is not Bean-like
- otherMethods.addElement(method);
- }
- }
- }
-
- if(isReachable(eventStopClass, methodClass)) {
- if(name.startsWith("add")
- && isVoid
- && params.length == 1
- && java.util.EventListener.class.isAssignableFrom(params[0])) {
- addToListenerHash(name,method,ADD);
- } else if(name.startsWith("remove")
- && isVoid
- && params.length == 1
- && java.util.EventListener.class.isAssignableFrom(params[0])) {
- addToListenerHash(name,method,REMOVE);
- }
- }
-
- if(isReachable(methodStopClass, methodClass)) {
- // files as reachable public method
- otherMethods.addElement(method);
- }
-
- }
- }
-
- public void addMethods(Method[] m) {
- for(int i=0;ijava.util.EventListener
null
- * or declaringClass
the string will simply have no
- * attributes.
- */
- public void append (String text, HashMap local_attributes)
- {
- int[] new_ranges = new int[ranges.length+1];
- HashMap[] new_attributes = new HashMap[attributes.length+1];
-
- formattedString += text;
- System.arraycopy (attributes, 0, new_attributes, 0, attributes.length);
- System.arraycopy (ranges, 0, new_ranges, 0, ranges.length);
- new_ranges[ranges.length] = formattedString.length();
- new_attributes[attributes.length] = local_attributes;
-
- ranges = new_ranges;
- attributes = new_attributes;
- }
-
- /**
- * This method appends a string without attributes. It is completely
- * equivalent to call {@link #append(String,HashMap)} with local_attributes
- * equal to is a true subclass of
to determine their titlecase). The listing
- * is a sorted sequence of character pairs; converting the first character
- * of the pair to titlecase produces the second character.
- */
- String TITLE
- = "\u01c4\u01c5\u01c5\u01c5\u01c6\u01c5\u01c7\u01c8\u01c8\u01c8\u01c9"
- + "\u01c8\u01ca\u01cb\u01cb\u01cb\u01cc\u01cb\u01f1\u01f2\u01f2\u01f2"
- + "\u01f3\u01f2";
-
- /**
- * This is a listing of characters with multi-character uppercase sequences.
- * A character appears in this list exactly when it has a non-zero entry
- * in the low-order 2-bit field of DIRECTION. The listing is a sorted
- * sequence of pairs (hence a binary search on the even elements is an
- * efficient way to lookup a character). The first element of a pair is the
- * character with the expansion, and the second is the index into
- * UPPER_EXPAND where the expansion begins. Use the 2-bit field of
- * DIRECTION to determine where the expansion ends.
- */
- String UPPER_SPECIAL
- = "\u00df\000\u0149\002\u01f0\004\u0390\006\u03b0\011"
- + "\u0587\014\u1e96\016\u1e97\020\u1e98\022\u1e99\024"
- + "\u1e9a\026\u1f50\030\u1f52\032\u1f54\035\u1f56 "
- + "\u1f80#\u1f81%\u1f82'\u1f83)\u1f84+"
- + "\u1f85-\u1f86/\u1f871\u1f883\u1f895"
- + "\u1f8a7\u1f8b9\u1f8c;\u1f8d=\u1f8e?"
- + "\u1f8fA\u1f90C\u1f91E\u1f92G\u1f93I"
- + "\u1f94K\u1f95M\u1f96O\u1f97Q\u1f98S"
- + "\u1f99U\u1f9aW\u1f9bY\u1f9c[\u1f9d]"
- + "\u1f9e_\u1f9fa\u1fa0c\u1fa1e\u1fa2g"
- + "\u1fa3i\u1fa4k\u1fa5m\u1fa6o\u1fa7q"
- + "\u1fa8s\u1fa9u\u1faaw\u1faby\u1fac{"
- + "\u1fad}\u1fae\u007f\u1faf\u0081\u1fb2\u0083\u1fb3\u0085"
- + "\u1fb4\u0087\u1fb6\u0089\u1fb7\u008b\u1fbc\u008e\u1fc2\u0090"
- + "\u1fc3\u0092\u1fc4\u0094\u1fc6\u0096\u1fc7\u0098\u1fcc\u009b"
- + "\u1fd2\u009d\u1fd3\u00a0\u1fd6\u00a3\u1fd7\u00a5\u1fe2\u00a8"
- + "\u1fe3\u00ab\u1fe4\u00ae\u1fe6\u00b0\u1fe7\u00b2\u1ff2\u00b5"
- + "\u1ff3\u00b7\u1ff4\u00b9\u1ff6\u00bb\u1ff7\u00bd\u1ffc\u00c0"
- + "\ufb00\u00c2\ufb01\u00c4\ufb02\u00c6\ufb03\u00c8\ufb04\u00cb"
- + "\ufb05\u00ce\ufb06\u00d0\ufb13\u00d2\ufb14\u00d4\ufb15\u00d6"
- + "\ufb16\u00d8\ufb17\u00da";
-
- /**
- * This is the listing of special case multi-character uppercase sequences.
- * Characters listed in UPPER_SPECIAL index into this table to find their
- * uppercase expansion. Remember that you must also perform special-casing
- * on two single-character sequences in the Turkish locale, which are not
- * covered here in CharData.
- */
- String UPPER_EXPAND
- = "SS\u02bcNJ\u030c\u0399\u0308\u0301\u03a5\u0308"
- + "\u0301\u0535\u0552H\u0331T\u0308W\u030aY\u030a"
- + "A\u02be\u03a5\u0313\u03a5\u0313\u0300\u03a5\u0313\u0301\u03a5"
- + "\u0313\u0342\u1f08\u0399\u1f09\u0399\u1f0a\u0399\u1f0b\u0399\u1f0c"
- + "\u0399\u1f0d\u0399\u1f0e\u0399\u1f0f\u0399\u1f08\u0399\u1f09\u0399"
- + "\u1f0a\u0399\u1f0b\u0399\u1f0c\u0399\u1f0d\u0399\u1f0e\u0399\u1f0f"
- + "\u0399\u1f28\u0399\u1f29\u0399\u1f2a\u0399\u1f2b\u0399\u1f2c\u0399"
- + "\u1f2d\u0399\u1f2e\u0399\u1f2f\u0399\u1f28\u0399\u1f29\u0399\u1f2a"
- + "\u0399\u1f2b\u0399\u1f2c\u0399\u1f2d\u0399\u1f2e\u0399\u1f2f\u0399"
- + "\u1f68\u0399\u1f69\u0399\u1f6a\u0399\u1f6b\u0399\u1f6c\u0399\u1f6d"
- + "\u0399\u1f6e\u0399\u1f6f\u0399\u1f68\u0399\u1f69\u0399\u1f6a\u0399"
- + "\u1f6b\u0399\u1f6c\u0399\u1f6d\u0399\u1f6e\u0399\u1f6f\u0399\u1fba"
- + "\u0399\u0391\u0399\u0386\u0399\u0391\u0342\u0391\u0342\u0399\u0391"
- + "\u0399\u1fca\u0399\u0397\u0399\u0389\u0399\u0397\u0342\u0397\u0342"
- + "\u0399\u0397\u0399\u0399\u0308\u0300\u0399\u0308\u0301\u0399\u0342"
- + "\u0399\u0308\u0342\u03a5\u0308\u0300\u03a5\u0308\u0301\u03a1\u0313"
- + "\u03a5\u0342\u03a5\u0308\u0342\u1ffa\u0399\u03a9\u0399\u038f\u0399"
- + "\u03a9\u0342\u03a9\u0342\u0399\u03a9\u0399FFFI"
- + "FLFFIFFLSTS"
- + "T\u0544\u0546\u0544\u0535\u0544\u053b\u054e\u0546\u0544\u053d";
-}
diff --git a/libjava/gnu/java/lang/ClassHelper.java b/libjava/gnu/java/lang/ClassHelper.java
deleted file mode 100644
index 14c8a39c478..00000000000
--- a/libjava/gnu/java/lang/ClassHelper.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/* ClassHelper.java -- Utility methods to augment java.lang.Class
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.lang;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * ClassHelper has various methods that ought to have been in Class.
- *
- * @author John Keiser
- * @author Eric Blake (ebb9@email.byu.edu)
- */
-public class ClassHelper
-{
- /**
- * Strip the package part from the class name.
- *
- * @param clazz the class to get the truncated name from
- * @return the truncated class name
- */
- public static String getTruncatedClassName(Class clazz)
- {
- return getTruncatedName(clazz.getName());
- }
-
- /**
- * Strip the package part from the class name, or the class part from
- * the method or field name.
- *
- * @param name the name to truncate
- * @return the truncated name
- */
- public static String getTruncatedName(String name)
- {
- int lastInd = name.lastIndexOf('.');
- if (lastInd == -1)
- return name;
- return name.substring(lastInd + 1);
- }
-
- /** Cache of methods found in getAllMethods(). */
- private static Map allMethods = new HashMap();
-
- /**
- * Get all the methods, public, private and otherwise, from the class,
- * getting them from the most recent class to find them. This may not
- * be quite the correct approach, as this includes methods that are not
- * inherited or accessible from clazz, so beware.
- *
- * @param clazz the class to start at
- * @return all methods declared or inherited in clazz
- */
- public static Method[] getAllMethods(Class clazz)
- {
- Method[] retval = (Method[]) allMethods.get(clazz);
- if (retval == null)
- {
- Set methods = new HashSet();
- Class c = clazz;
- while (c != null)
- {
- Method[] currentMethods = c.getDeclaredMethods();
- loop:
- for (int i = 0; i < currentMethods.length; i++)
- {
- Method current = currentMethods[i];
- int size = methods.size();
- Iterator iter = methods.iterator();
- while (--size >= 0)
- {
- Method override = (Method) iter.next();
- if (current.getName().equals(override.getName())
- && Arrays.equals(current.getParameterTypes(),
- override.getParameterTypes())
- && current.getReturnType() == override.getReturnType())
- continue loop;
- }
- methods.add(current);
- }
- c = c.getSuperclass();
- }
- retval = new Method[methods.size()];
- methods.toArray(retval);
- allMethods.put(clazz, retval);
- }
- return retval;
- }
-
- /** Cache of fields found in getAllFields(). */
- private static Map allFields = new HashMap();
-
- /**
- * Get all the fields, public, private and otherwise, from the class,
- * getting them from the most recent class to find them. This may not
- * be quite the correct approach, as this includes fields that are not
- * inherited or accessible from clazz, so beware.
- *
- * @param clazz the class to start at
- * @return all fields declared or inherited in clazz
- */
- public static Field[] getAllFields(Class clazz)
- {
- Field[] retval = (Field[]) allFields.get(clazz);
- if (retval == null)
- {
- Set fields = new HashSet();
- Class c = clazz;
- while (c != null)
- {
- Field[] currentFields = c.getDeclaredFields();
- loop:
- for (int i = 0; i < currentFields.length; i++)
- {
- Field current = currentFields[i];
- int size = fields.size();
- Iterator iter = fields.iterator();
- while (--size >= 0)
- {
- Field override = (Field) iter.next();
- if (current.getName().equals(override.getName())
- && current.getType() == override.getType())
- continue loop;
- }
- fields.add(current);
- }
- c = c.getSuperclass();
- }
- retval = new Field[fields.size()];
- fields.toArray(retval);
- allFields.put(clazz, retval);
- }
- return retval;
- }
-}
diff --git a/libjava/gnu/java/lang/reflect/TypeSignature.java b/libjava/gnu/java/lang/reflect/TypeSignature.java
deleted file mode 100644
index 842e5bdf0f0..00000000000
--- a/libjava/gnu/java/lang/reflect/TypeSignature.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/* TypeSignature.java -- Class used to compute type signatures
- Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.lang.reflect;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-
-/**
- * This class provides static methods that can be used to compute
- * type-signatures of stopClass
.
- * This expression is useful to detect whether a method should be introspected or not.
- * The rules for this are described in {@link java.beans.Introspector.getBeanInfo(Class, Class)}.
- */
- static boolean isReachable(Class stopClass, Class declaringClass) {
- return stopClass == null || (stopClass.isAssignableFrom(declaringClass) && !stopClass.equals(declaringClass));
- }
-
- /** Transforms a property name into a part of a method name.
- * E.g. "value" becomes "Value" which can then concatenated with
- * "set", "get" or "is" to form a valid method name.
- *
- * Implementation notes:
- * If "" is the argument, it is returned without changes.
- * If null
is the argument, null
is returned.
- *
- * @param name Name of a property.
- * @return Part of a method name of a property.
- */
- static String capitalize(String name) {
- try {
- if(Character.isUpperCase(name.charAt(0))) {
- return name;
- } else {
- char[] c = name.toCharArray();
- c[0] = Character.toLowerCase(c[0]);
- return new String(c);
- }
- } catch(StringIndexOutOfBoundsException E) {
- return name;
- } catch(NullPointerException E) {
- return null;
- }
- }
-}
-
-/** This class is a hashmap key that consists of a Class
and a
- * String
element.
- *
- * It is used for XXX: find out what this is used for
- *
- * @author John Keiser
- * @author Robert Schuster
- */
-class DoubleKey {
- Class type;
- String name;
-
- DoubleKey(Class type, String name) {
- this.type = type;
- this.name = name;
- }
-
- Class getType() {
- return type;
- }
-
- String getName() {
- return name;
- }
-
- public boolean equals(Object o) {
- if(o instanceof DoubleKey) {
- DoubleKey d = (DoubleKey)o;
- return d.type.equals(type) && d.name.equals(name);
- } else {
- return false;
- }
- }
-
- public int hashCode() {
- return type.hashCode() ^ name.hashCode();
- }
-}
diff --git a/libjava/gnu/java/beans/decoder/AbstractContext.java b/libjava/gnu/java/beans/decoder/AbstractContext.java
deleted file mode 100644
index 0e95d432986..00000000000
--- a/libjava/gnu/java/beans/decoder/AbstractContext.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* gnu.java.beans.decoder.AbstractContext
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.beans.decoder;
-
-
-/** AbstractContext implements some basic functionality of the Context
- * interface and is therefore the base of all Context implementations.
- *
- * @author Robert Schuster
- */
-abstract class AbstractContext implements Context
-{
- private boolean isStatement;
- private String id;
-
- public String getId()
- {
- return id;
- }
-
- public void setId(String newId)
- {
- id = newId;
- }
-
- public boolean isStatement()
- {
- return isStatement;
- }
-
- public void setStatement(boolean b)
- {
- isStatement = b;
- }
-}
diff --git a/libjava/gnu/java/beans/decoder/AbstractCreatableObjectContext.java b/libjava/gnu/java/beans/decoder/AbstractCreatableObjectContext.java
deleted file mode 100644
index 47f04fa1cbe..00000000000
--- a/libjava/gnu/java/beans/decoder/AbstractCreatableObjectContext.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* gnu.java.beans.decoder.AbstractCreatableContext
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-package gnu.java.beans.decoder;
-
-
-/** AbstractCreatableObjectContext is the base class for all Context implementations
- * which create a result object in their lifetime. It provides means for preventing
- * to create the object twice.
- *
- * @author Robert Schuster
- *
- */
-abstract class AbstractCreatableObjectContext extends AbstractObjectContext
-{
- AbstractCreatableObjectContext()
- {
- }
-
- /** Adds a parameter object to this Context if the result object has not been
- * created yet. Otherwise an AssemblyException is thrown that indicates a wrong
- * behavior of the decoder.
- */
- public final void addParameterObject(Object o) throws AssemblyException
- {
- if (object == null)
- addParameterObjectImpl(o);
- else
- throw new AssemblyException(new IllegalStateException("No more parameter objects are allowed when the object as already been created."));
- }
-
- /** Adds a parameter object to this Context. Implement this without caring
- * for illegal states because this has been done already.
- *
- * @param obj The parameter object to be added.
- */
- protected abstract void addParameterObjectImpl(Object obj);
-
- /** Creates the result object if it does not exist already.
- */
- public final void notifyStatement(Context outerContext)
- throws AssemblyException
- {
- if (object != null)
- return;
-
- object = createObject(outerContext);
- }
-
- /** Creates the result object. This method is called only once. Implement this
- * without checking for double invocations as this is already being prevented.
- *
- * @param outerContext The Context that exists around this one.
- * @return The result object.
- * @throws AssemblerException if the object creation fails somehow.
- */
- protected abstract Object createObject(Context outerContext)
- throws AssemblyException;
-
- /* (non-Javadoc)
- * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context)
- */
- public final Object endContext(Context outerContext)
- throws AssemblyException
- {
- notifyStatement(outerContext);
- return object;
- }
-
- /* (non-Javadoc)
- * @see gnu.java.beans.decoder.Context#subContextFailed()
- */
- public boolean subContextFailed()
- {
- /* Returns true when the AbstractCreatableObjectContext has not created the result object yet
- * (A failed subcontext automatically lets this context fail too.)
- */
- return object == null;
- }
-}
diff --git a/libjava/gnu/java/beans/decoder/AbstractElementHandler.java b/libjava/gnu/java/beans/decoder/AbstractElementHandler.java
deleted file mode 100644
index e5578a990bc..00000000000
--- a/libjava/gnu/java/beans/decoder/AbstractElementHandler.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/* gnu.java.beans.decoder.AbstractElementHandler
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.beans.decoder;
-
-import java.beans.ExceptionListener;
-
-import org.xml.sax.Attributes;
-
-/** ElementHandler manages a Context instance and interacts with
- * its parent and child handlers.
- *
- * @author Robert Schuster
- */
-abstract class AbstractElementHandler implements ElementHandler
-{
- /** The Context instance of this handler. The instance is available after the startElement()
- * method was called. Otherwise the handler is marked as failed.
- */
- private Context context;
-
- /** The parent handler. */
- private ElementHandler parent;
-
- /** Stores whether this handler is marked as failed. */
- private boolean hasFailed;
-
- /** Stores the character data which is contained in the body of the XML tag. */
- private StringBuffer buffer = new StringBuffer();
-
- /** Stores whether this ElementHandler can have subelements. The information for this is taken from
- * javabeans.dtd which can be found here:
- * Java Persistence Article
- */
- private boolean allowsSubelements;
-
- /** Creates a new ElementHandler with the given ElementHandler instance
- * as parent.
- *
- * @param parentHandler The parent handler.
- */
- protected AbstractElementHandler(ElementHandler parentHandler,
- boolean allowsSubs)
- {
- parent = parentHandler;
- allowsSubelements = allowsSubs;
- }
-
- /** Evaluates the attributes and creates a Context instance.
- * If the creation of the Context instance fails the ElementHandler
- * is marked as failed which may affect the parent handler other.
- *
- * @param attributes Attributes of the XML tag.
- */
- public final void start(Attributes attributes,
- ExceptionListener exceptionListener)
- {
- try
- {
- // lets the subclass create the appropriate Context instance
- context = startElement(attributes, exceptionListener);
- }
- catch (AssemblyException pe)
- {
- Throwable t = pe.getCause();
-
- if (t instanceof Exception)
- exceptionListener.exceptionThrown((Exception) t);
- else
- throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report.");
-
- notifyContextFailed();
-
- return;
- }
- }
-
- /** Analyses the content of the Attributes instance and creates a Context
- * object accordingly.
- * An AssemblerException is thrown when the Context instance could not
- * be created.
- *
- * @param attributes Attributes of the XML tag.
- * @return A Context instance.
- * @throws AssemblerException when Context instance could not be created.
- */
- protected abstract Context startElement(Attributes attributes, ExceptionListener exceptionListener)
- throws AssemblyException;
-
- /** Post-processes the Context.
- */
- public final void end(ExceptionListener exceptionListener)
- {
- // skips processing if the handler is marked as failed (because the Context
- // is then invalid or may not exist at all)
- if (!hasFailed)
- {
- try
- {
- // note: the order of operations is very important here
- // sends the stored character data to the Context
- endElement(buffer.toString());
-
- // reports to the parent handler if this handler's Context is a
- // statement (returning no value BACK to the parent's Context)
- if (context.isStatement())
- {
- // This may create a valid result in the parent's Context
- // or let it fail
- parent.notifyStatement(exceptionListener);
-
- // skips any further processing if the parent handler is now marked
- // as failed
- if (parent.hasFailed())
- return;
- }
-
- // processes the Context and stores the result
- putObject(context.getId(), context.endContext(parent.getContext()));
-
- // transfers the Context's results to the parent's Context
- // if it is an expression (rather than a statement)
- if (! context.isStatement())
- parent.getContext().addParameterObject(context.getResult());
- }
- catch (AssemblyException pe)
- {
- // notifies that an exception was thrown in this handler's Context
- Throwable t = pe.getCause();
-
- if (t instanceof Exception)
- exceptionListener.exceptionThrown((Exception) t);
- else
- throw (InternalError) new InternalError("Severe problem while decoding XML data.")
- .initCause(t);
-
- // marks the handler as failed
- notifyContextFailed();
- }
- }
- }
-
- /** Notifies the handler's Context that its child Context will not return
- * a value back. Some Context variants need this information to know when
- * a method or a constructor call can be made.
- *
- * This method is called by a child handler.
- */
- public void notifyStatement(ExceptionListener exceptionListener)
- {
- try
- {
-
- // propagates to parent handler first to generate objects
- // needed by this Context instance
- if(context.isStatement())
- {
- parent.notifyStatement(exceptionListener);
- }
-
- // Some Context instances do stuff which can fail now. If that
- // happens this handler is marked as failed.
- context.notifyStatement(parent.getContext());
- }
- catch (AssemblyException ae)
- {
- // notifies that an exception was thrown in this handler's Context
- Throwable t = ae.getCause();
-
- if (t instanceof Exception)
- exceptionListener.exceptionThrown((Exception) t);
- else
- throw (InternalError) new InternalError("Severe problem while decoding XML data.")
- .initCause(t);
-
- // marks the handler as failed
- notifyContextFailed();
- }
- }
-
- /** Marks this and any depending parent handlers as failed. Which means that on their end
- * no result is calculated.
- *
- * When a handler has failed no more handlers are accepted within it.
- */
- public final void notifyContextFailed()
- {
- hasFailed = true;
-
- // marks the parent handler as failed if its Context
- // is affected by the failure of this handler's Context
- if (parent.getContext().subContextFailed())
- parent.notifyContextFailed();
- }
-
- /** Returns whether this handler has failed.
- *
- * This is used to skip child elements.
- *
- * @return Whether this handler has failed.
- */
- public final boolean hasFailed()
- {
- return hasFailed;
- }
-
- /** Processes the character data when the element ends.
- *
- * The default implementation does nothing for convenience.
- *
- * @param characters
- * @throws AssemblerException
- */
- protected void endElement(String characters) throws AssemblyException
- {
- // XXX: throw an exception when unexpected character data is available?
- }
-
- /** Adds characters from the body of the XML tag to the buffer.
- *
- * @param ch
- * @param start
- * @param length
- * @throws SAXException
- */
- public final void characters(char[] ch, int start, int length)
- {
- // simply appends character data
- buffer.append(ch, start, length);
- }
-
- /** Stores an object globally under a unique id. If the id is
- * null the object is not stored.
- *
- * @param objectId
- * @param o
- */
- public void putObject(String objectId, Object o)
- {
- if (objectId != null)
- parent.putObject(objectId, o);
- }
-
- /** Returns a previously stored object. If the id is null the
- * result is null, too.
- *
- * @param objectId
- * @return Returns a previously stored object or null.
- */
- public Object getObject(String objectId) throws AssemblyException
- {
- return objectId == null ? null : parent.getObject(objectId);
- }
-
- /** Returns the Class instance as if called Class.forName() but
- * uses a ClassLoader given by the user.
- *
- * @param className
- * @return
- * @throws ClassNotFoundException
- */
- public Class instantiateClass(String className)
- throws ClassNotFoundException
- {
- return parent.instantiateClass(className);
- }
-
- public final boolean isSubelementAllowed(String subElementName)
- {
- return allowsSubelements && ! subElementName.equals("java");
- }
-
- public final Context getContext()
- {
- return context;
- }
-
- public final ElementHandler getParent()
- {
- return parent;
- }
-}
diff --git a/libjava/gnu/java/beans/decoder/AbstractObjectContext.java b/libjava/gnu/java/beans/decoder/AbstractObjectContext.java
deleted file mode 100644
index 202c33b3413..00000000000
--- a/libjava/gnu/java/beans/decoder/AbstractObjectContext.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/* gnu.java.beans.decoder.AbstractObjectContext
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-package gnu.java.beans.decoder;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/** AbstractObjectContext is the base for all Context implementations which
- * create or provide a result object during their lifetime.
- *
- * System.err
.notifyStatement()
) is called.Object
that makes
- the methods hashCode()
and equals(Object)
- as discriminating as possible.
-*/
-public class ObjectIdentityWrapper
-{
-
- /**
- Constructs a ObjectIdentityWrapper
that is wrapped
- around o.
- */
- public ObjectIdentityWrapper( Object o )
- {
- object = o;
- }
-
- /**
- Uses System.identityHashCode(Object)
to compute a
- hash code for the object wrapped by this
- ObjectIdentityWrapper
.
-
- @see java.lang.System#identityHashCode(java.lang.Object)
- @see java.util.Hashtable
- @see java.lang.Object#hashCode()
- */
- public int hashCode()
- {
- return System.identityHashCode( object );
- }
-
- /**
- Uses the ==
operator to test for equality between
- the object wrapped by this ObjectIdentityWrapper
and
- the object wrapped by the ObjectIdentityWrapper
o.
- Returns false if o is not a ObjectIdentityWrapper
.
-
- @see java.util.Hashtable
- @see java.lang.Object#equals()
- */
- public boolean equals( Object o )
- {
- if( o instanceof ObjectIdentityWrapper )
- return object == ((ObjectIdentityWrapper)o).object;
- else
- return false;
- }
-
- public String toString()
- {
- return "ObjectIdentityWrapper< " + object + ", " + hashCode() + " >";
- }
-
- /**
- The Object
wrapped by this
- ObjectIdentityWrapper
.
- */
- public Object object;
-}
diff --git a/libjava/gnu/java/lang/ArrayHelper.java b/libjava/gnu/java/lang/ArrayHelper.java
deleted file mode 100644
index 5f675831e9f..00000000000
--- a/libjava/gnu/java/lang/ArrayHelper.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ArrayHelper.java -- Helper methods for handling array operations
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.lang;
-
-/**
- * ArrayHelper helps you do things with arrays.
- *
- * @author John Keiser
- */
-public class ArrayHelper
-{
- /**
- * Counterpart to java.util.Collection.contains.
- *
- * @param array the array to search
- * @param searchFor the object to locate
- * @return true if some array element equals(searchFor)
- */
- public static boolean contains(Object[] array, Object searchFor)
- {
- return indexOf(array, searchFor) != -1;
- }
-
- /**
- * Counterpart to java.util.Collection.indexOf.
- *
- * @param array the array to search
- * @param searchFor the object to locate
- * @return the index of the first equal object, or -1
- */
- public static int indexOf(Object[] array, Object searchFor)
- {
- for (int i = 0; i < array.length; i++)
- {
- if(array[i].equals(searchFor))
- {
- return i;
- }
- }
- return -1;
- }
-}
diff --git a/libjava/gnu/java/lang/CharData.java b/libjava/gnu/java/lang/CharData.java
deleted file mode 100644
index 7631522c810..00000000000
--- a/libjava/gnu/java/lang/CharData.java
+++ /dev/null
@@ -1,1001 +0,0 @@
-/* gnu/java/lang/CharData -- Database for java.lang.Character Unicode info
- Copyright (C) 2002 Free Software Foundation, Inc.
- *** This file is generated by scripts/unicode-muncher.pl ***
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.lang;
-
-/**
- * This contains the info about the unicode characters, that
- * java.lang.Character needs. It is generated automatically from
- * gnu/gcj/convert/UnicodeData-3.0.0.txt
and
- * gnu/gcj/convert/SpecialCasing-2.txt
, by some
- * perl scripts. These Unicode definition files can be found on the
- * http://www.unicode.org website.
- * JDK 1.4 uses Unicode version 3.0.0.
- *
- * The data is stored as string constants, but Character will convert these
- * Strings to their respective char[]
components. The field
- * BLOCKS
stores the offset of a block of 2SHIFT
- * characters within DATA
. The DATA field, in turn, stores
- * information about each character in the low order bits, and an offset
- * into the attribute tables UPPER
, LOWER
,
- * NUM_VALUE
, and DIRECTION
. Notice that the
- * attribute tables are much smaller than 0xffff entries; as many characters
- * in Unicode share common attributes. The DIRECTION table also contains
- * a field for detecting characters with multi-character uppercase expansions.
- * Next, there is a listing for TITLE
exceptions (most characters
- * just have the same title case as upper case). Finally, there are two
- * tables for multi-character capitalization, UPPER_SPECIAL
- * which lists the characters which are special cased, and
- * UPPER_EXPAND
, which lists their expansion.
- *
- * @author scripts/unicode-muncher.pl (written by Jochen Hoenicke,
- * Eric Blake)
- * @see Character
- * @see String
- */
-public interface CharData
-{
- /**
- * The Unicode definition file that was parsed to build this database.
- */
- String SOURCE = "gnu/gcj/convert/UnicodeData-3.0.0.txt";
-
- /**
- * The character shift amount to look up the block offset. In other words,
- * (char) (BLOCKS.value[ch >> SHIFT] + ch)
is the index where
- * ch
is described in DATA
.
- */
- int SHIFT = 5;
-
- /**
- * The mapping of character blocks to their location in DATA
.
- * Each entry has been adjusted so that the 16-bit sum with the desired
- * character gives the actual index into DATA
.
- */
- String BLOCKS
- = "\u01c2\u01c2\u01c1\u012c\u012b\u01a0\u01f8\u02dc\u025f\u02ee\u0215"
- + "\u0346\u02dc\u0326\u02bc\u0216\u015f\u02d4\u0376\u0376\u0376\u0369"
- + "\ufe8f\u0344\uff85\uff65\ufdb5\ufda1\033\u02c4\034G\ufea8"
- + "\uff8c\u0235\ufeff\032\ufebf&\ufb20\ufe28\u0113\u0104\ufb61"
- + "\ufb5a\u010b\u0109\u00fe\uff08\u0229\u025e\u01c7\u01fc\u01dc\ufc46"
- + "\u0229\ufe27\ufb55\u0169\ufbc8\u00fc\u0103\ufb68\ufb48\ufb28\ufb08"
- + "\ufae8\ufac8\ufaa8\ufa88\ufa68\ufa48eP\u00ab\u0139\ufe0e"
- + "c\u0155\u01a8\uf669\u0129\u0128\uf91f\ufe56\u0108\u0107\ufac0"
- + "\ufc8e\ufead\u00c6\ufca7\ufb95\uf47d\u009f\ufb17\ufe20\ufd28\ufb2f"
- + ";\uf3b9\ufe57\ufcce\uffbb\uf339\ufa98\uff8b\uff3b\ufa54\uf7e3"
- + "\uff2b\ufad7\ufb69\ufc3a\ufee5\uf4c8\ufcb0\ufa88\ufdbf\uf448\ufe45"
- + "\ufcc7\ufe4f\uf7f1\uf715\uf2e8\ufd9f\uf348\uf96a\ufc02\ufd97\uf2c8"
- + "\uf2a8\uf4b9\uf4b3\uef6b\uf86a\uf84a\ufc58\uf80a\uf7ea\ufc0f\uf7aa"
- + "\uee9c\ufb90\uf74a\uf7fa\uf70a\uf7ca\uf792\uf471\uf4d2\uf732\uf64a"
- + "\uf401\uf64d\uefa8\uf5ca\uf5aa\ueca1\uf569\uf54a\uf52a\uf50a\uf4ea"
- + "\uf4ca\uf4aa\uf48a\uf46a\uf44a\uf42a\uf40a\uf3ea\uf3ca\uf3aa\uf38a"
- + "\uf36a\uf34a\uf32a\uf289\uf777\uf2ca\uf2aa\uf737\uec28\uec08\uebe8"
- + "\uebc8\uf1ea\uf4a2\uf545\uedc6\uf2d7\uf14a\ue8ed\ue81e\uf0ea\uf597"
- + "\uea68\uea48\uea28\uea08\ue9e8\ue9c8\ue9a8\ue988\ue968\ue948\ue928"
- + "\ue908\ue8e8\ue8c8\ue8a8\ue888\ue868\ue848\ue828\ue808\ue7e8\ue7c8"
- + "\ue7a8\ue788\ue768\ue748\ue728\ue708\ue6e8\ue6c8\ue6a8\ue688\ue668"
- + "\ue648\ue628\ue608\ue5e8\ue5c8\ue5a8\ue588\ue568\ue548\ue55f\ue53f"
- + "\ue51f\ue4ff\uefd7\ue4bf\ue49f\ue485\uef87\uef57\uef57\uef57\uef57"
- + "\uef47\ue1ad\uef46\uef46\uef46\ue1e0\ue3dd\uef06\ue9d9\uebeb\ue244"
- + "\ueed4\uef65\ue1f5\uef45\ueee9\uef7c\uee74\uef70\uef7d\uef78\uee91"
- + "\uefd3\uee7d\uee25\uee27\uef65\uefdd\uee96\uefd3\uefe1\uef69\udf88"
- + "\udf68\udf48\ued2b\ued3d\ued19\uef1c\uef08\ued47\ued3d\ued33\uec2b"
- + "\uec0b\uebeb\uebcb\uebce\uea7c\ueb69\ueb6c\ue9b6\ueb0b\ueaeb\ue9e9"
- + "\udca8\udc88\udc68\udc48\ue910\uea23\ueb58\ueb4f\ueb45\ueae5\udb68"
- + "\udb48\ue92b\ue90b\ue8eb\ue8cb\ue8ab\ue88b\ue86b\ue84b\uda28\uda08"
- + "\ud9e8\ud9c8\ud9a8\ud988\ud968\ud948\ud928\ud908\ud8e8\ud8c8\ud8a8"
- + "\ud888\ud868\ud848\ud828\ud808\ud7e8\ud7c8\ud7a8\ud788\ud768\ud748"
- + "\ud728\ud708\ud6e8\ud6c8\ud6a8\ud688\ud668\ud648\ud628\ud608\ud5e8"
- + "\ud5c8\ud5a8\ud588\ud568\ud548\ud528\ud508\ud4e8\ud4c8\ue2b1\ue28b"
- + "\ue26b\ue270\ue22b\ue20b\ue1eb\ue1cb\ue1ab\ue18b\ue18e\udd8f\ue3a8"
- + "\udfd3\ud929\ud90a\ue348\ud8c9\ud8aa\udcd7\udcb2\ud681\ud82a\ud80a"
- + "\ue268\ucede\ud168\ud148\ue116\ue0e9\ue1cb\ue0b7\ue0b7\ue15e\udf17"
- + "\ue034\ue013\udff3\udfd3\ude6c\udf93\udf73\udf55\udf34\ud56a\ud54a"
- + "\ud52a\ud50a\ud4ea\ud4ca\ud4aa\ud48a\ud46a\ud44a\ud42a\ud40a\ud3ea"
- + "\ud3ca\ud3aa\ud38a\ud36a\ud34a\ud32a\ud30a\ud2ea\ud2ca\ud2aa\ud28a"
- + "\ud26a\ud24a\ud22a\ud20a\ud1ea\ud1ca\ud1aa\ud18a\ud16a\ud14a\ud12a"
- + "\ud10a\ud0ea\ud0ca\ud0aa\ud08a\ud06a\ud04a\ud02a\ud00a\ucfea\ucfca"
- + "\ucfaa\ucf8a\ucf6a\ucf4a\ucf2a\ucf0a\uceea\uceca\uceaa\uce8a\uce6a"
- + "\uce4a\uce2a\uce0a\ucdea\ucdca\ucdaa\ucd8a\ucd6a\ucd4a\ucd2a\ucd0a"
- + "\uccea\uccca\uccaa\ucc8a\ucc6a\ucc4a\ucc2a\ucc0a\ucbea\ucbca\ucbaa"
- + "\ucb8a\ucb6a\ucb4a\ucb2a\ucb0a\ucaea\ucaca\ucaaa\uca8a\uca6a\uca4a"
- + "\uca2a\uca0a\uc9ea\uc9ca\uc9aa\uc98a\uc96a\uc94a\uc92a\uc90a\uc8ea"
- + "\uc8ca\uc8aa\uc88a\uc86a\uc84a\uc82a\uc80a\uc7ea\uc7ca\uc7aa\uc78a"
- + "\uc76a\uc74a\uc72a\uc70a\uc6ea\uc6ca\uc6aa\uc68a\uc66a\uc64a\uc62a"
- + "\uc60a\uc5ea\uc5ca\uc5aa\uc58a\uc56a\uc54a\uc52a\uc50a\uc4ea\uc4ca"
- + "\uc4aa\uc48a\uc46a\uc44a\uc42a\uc40a\uc3ea\uc3ca\uc3aa\uc38a\uc36a"
- + "\uc34a\uc32a\uc30a\uc2ea\uc2ca\uc2aa\uc28a\uc26a\uc24a\uc22a\uc20a"
- + "\uc1ea\uc1ca\uc1aa\uc18a\uc16a\uc14a\uc12a\uc10a\uc0ea\uc0ca\uc0aa"
- + "\uc08a\uc06a\uc04a\uc02a\uc00a\ubfea\ubfca\ubfaa\ubf8a\ubf6a\ubf4a"
- + "\ubf2a\ubf0a\ubeea\ubeca\ubeaa\ube8a\ube6a\ube4a\ube2a\ube0a\ubdea"
- + "\ubdca\ubdaa\ubd8a\ubd6a\ubd4a\ubd2a\ubd0a\ubcea\ubcca\ubcaa\ubc8a"
- + "\ubc6a\ubc4a\ubc2a\ubc0a\ubbea\ub2e0\ub568\ub548\ubb6a\ubb4a\ubb2a"
- + "\ubb0a\ubaea\ubaca\ubaaa\uba8a\uba6a\uba4a\uba2a\uba0a\ub9ea\ub9ca"
- + "\ub9aa\ub98a\ub96a\ub94a\ub92a\ub90a\ub8ea\ub8ca\ub8aa\ub88a\ub86a"
- + "\ub84a\ub82a\ub80a\ub7ea\ub7ca\ub7aa\ub78a\ub76a\ub74a\ub72a\ub70a"
- + "\ub6ea\ub6ca\ub6aa\ub68a\ub66a\ub64a\ub62a\ub60a\ub5ea\ub5ca\ub5aa"
- + "\ub58a\ub56a\ub54a\ub52a\ub50a\ub4ea\ub4ca\ub4aa\ub48a\ub46a\ub44a"
- + "\ub42a\ub40a\ub3ea\ub3ca\ub3aa\ub38a\ub36a\ub34a\ub32a\ub30a\ub2ea"
- + "\ub2ca\ub2aa\ub28a\ub26a\ub24a\ub22a\ub20a\ub1ea\ub1ca\ub1aa\ub18a"
- + "\ub16a\ub14a\ub12a\ub10a\ub0ea\ub0ca\ub0aa\ub08a\ub06a\ub04a\ub02a"
- + "\ub00a\uafea\uafca\uafaa\uaf8a\uaf6a\uaf4a\uaf2a\uaf0a\uaeea\uaeca"
- + "\uaeaa\uae8a\uae6a\uae4a\uae2a\uae0a\uadea\uadca\uadaa\uad8a\uad6a"
- + "\uad4a\uad2a\uad0a\uacea\uacca\uacaa\uac8a\uac6a\uac4a\uac2a\uac0a"
- + "\uabea\uabca\uabaa\uab8a\uab6a\uab4a\uab2a\uab0a\uaaea\uaaca\uaaaa"
- + "\uaa8a\uaa6a\uaa4a\uaa2a\uaa0a\ua9ea\ua9ca\ua9aa\ua98a\ua96a\ua94a"
- + "\ua92a\ua90a\ua8ea\ua8ca\ua8aa\ua88a\ua86a\ua84a\ua82a\ua80a\ua7ea"
- + "\ua7ca\ua7aa\ua78a\ua76a\ua74a\ua72a\ua70a\ua6ea\ua6ca\ua6aa\ua68a"
- + "\ua66a\ua64a\ua62a\ua60a\ua5ea\ua5ca\ua5aa\ua58a\ua56a\ua54a\ua52a"
- + "\ua50a\ua4ea\ua4ca\ua4aa\ua48a\ua46a\ua44a\ua42a\ua40a\ua3ea\ua3ca"
- + "\ua3aa\ua38a\ua36a\ua34a\ua32a\ua30a\ua2ea\ua2ca\ua2aa\ua28a\ua26a"
- + "\ua24a\ua22a\ua20a\ua1ea\ua1ca\ua1aa\ua18a\ua16a\ua14a\ua12a\ua10a"
- + "\ua0ea\ua0ca\ua0aa\ua08a\ua06a\ua04a\ua02a\ua00a\u9fea\u9fca\u9faa"
- + "\u9f8a\u9f6a\u9f4a\u9f2a\u9f0a\u9eea\u9eca\u9eaa\u9e8a\u9e6a\u9e4a"
- + "\u9e2a\u9e0a\u9dea\u9dca\u9daa\u9d8a\u9d6a\u9d4a\u9d2a\u9d0a\u9cea"
- + "\u9cca\u9caa\u9c8a\u9c6a\u9c4a\u9c2a\u9c0a\u9bea\u9bca\u9baa\u9b8a"
- + "\u9b6a\u9b4a\u9b2a\u9b0a\u9aea\u9aca\u9aaa\u9a8a\u9a6a\u9a4a\u9a2a"
- + "\u9a0a\u99ea\u99ca\u99aa\u998a\u996a\u994a\u992a\u990a\u98ea\u98ca"
- + "\u98aa\u988a\u986a\u984a\u982a\u980a\u97ea\u97ca\u97aa\u978a\u976a"
- + "\u974a\u972a\u970a\u96ea\u96ca\u96aa\u968a\u966a\u964a\u962a\u960a"
- + "\u95ea\u95ca\u95aa\u958a\u956a\u954a\u952a\u950a\u94ea\u94ca\u94aa"
- + "\u948a\u946a\u944a\u942a\u940a\u93ea\u93ca\u93aa\u938a\u936a\u934a"
- + "\u932a\u930a\u92ea\u92ca\u92aa\u928a\u926a\u924a\u922a\u920a\u91ea"
- + "\u91ca\u91aa\u918a\u916a\u914a\u912a\u910a\u90ea\u90ca\u90aa\u908a"
- + "\u906a\u904a\u902a\u900a\u8fea\u8fca\u8faa\u8f8a\u8f6a\u8f4a\u8f2a"
- + "\u8f0a\u8eea\u8eca\u8eaa\u8e8a\u8e6a\u8e4a\u8e2a\u8e0a\u8dea\u8dca"
- + "\u8daa\u8d8a\u8d6a\u8d4a\u8d2a\u8d0a\u8cea\u8cca\u8caa\u8c8a\u8c6a"
- + "\u8c4a\u8c2a\u8c0a\u8bea\u8bca\u8baa\u8b8a\u8b6a\u8b4a\u8b2a\u8b0a"
- + "\u8aea\u8aca\u8aaa\u8a8a\u8a6a\u8a4a\u8a2a\u8a0a\u89ea\u89ca\u89aa"
- + "\u898a\u896a\u894a\u892a\u890a\u88ea\u88ca\u88aa\u888a\u886a\u884a"
- + "\u882a\u880a\u87ea\u87ca\u87aa\u878a\u876a\u874a\u872a\u870a\u86ea"
- + "\u86ca\u86aa\u868a\u866a\u864a\u862a\u860a\u85ea\u85ca\u85aa\u858a"
- + "\u856a\u854a\u852a\u850a\u84ea\u84ca\u84aa\u848a\u846a\u844a\u842a"
- + "\u840a\u83ea\u83ca\u83aa\u838a\u836a\u834a\u832a\u830a\u82ea\u82ca"
- + "\u82aa\u828a\u826a\u824a\u822a\u820a\u81ea\u81ca\u81aa\u818a\u816a"
- + "\u814a\u812a\u810a\u80ea\u80ca\u80aa\u808a\u806a\u804a\u802a\u800a"
- + "\u7fea\u7fca\u7faa\u7f8a\u7f6a\u7f4a\u7f2a\u7f0a\u7eea\u7eca\u7eaa"
- + "\u7e8a\u7e6a\u7e4a\u7e2a\u7e0a\u7dea\u7dca\u7daa\u7d8a\u7d6a\u7d4a"
- + "\u7d2a\u7d0a\u7cea\u7cca\u7caa\u7c8a\u7c6a\u7c4a\u7c2a\u7c0a\u7bea"
- + "\u7bca\u7baa\u7b8a\u7b6a\u7b4a\u7b2a\u7b0a\u7aea\u7aca\u7aaa\u7a8a"
- + "\u7a6a\u7a4a\u7a2a\u7a0a\u79ea\u79ca\u79aa\u798a\u796a\u794a\u792a"
- + "\u790a\u78ea\u78ca\u78aa\u788a\u786a\u784a\u782a\u780a\u77ea\u77ca"
- + "\u77aa\u778a\u776a\u774a\u772a\u770a\u76ea\u76ca\u76aa\u768a\u766a"
- + "\u764a\u762a\u760a\u75ea\u75ca\u75aa\u758a\u756a\u754a\u752a\u750a"
- + "\u74ea\u74ca\u74aa\u748a\u746a\u744a\u742a\u740a\u73ea\u73ca\u73aa"
- + "\u738a\u736a\u734a\u732a\u730a\u72ea\u72ca\u72aa\u728a\u726a\u724a"
- + "\u722a\u720a\u71ea\u71ca\u71aa\u718a\u716a\u714a\u712a\u710a\u70ea"
- + "\u70ca\u70aa\u708a\u706a\u704a\u702a\u700a\u6fea\u6fca\u6faa\u6f8a"
- + "\u6f6a\u6f4a\u6f2a\u6f0a\u6eea\u6eca\u6eaa\u6e8a\u6e6a\u6e4a\u6e2a"
- + "\u6e0a\u6dea\u6dca\u6daa\u6d8a\u6d6a\u6d4a\u6d2a\u6d0a\u6cea\u6cca"
- + "\u6caa\u6c8a\u6c6a\u6c4a\u6c2a\u6c0a\u6bea\u6bca\u6baa\u6b8a\u6b6a"
- + "\u6b4a\u6b2a\u6b0a\u6aea\u6aca\u6aaa\u6a8a\u6a6a\u6a4a\u6a2a\u6a0a"
- + "\u69ea\u60f0\u6368\u6348\u696a\u694a\u692a\u690a\u68ea\u68ca\u68aa"
- + "\u688a\u686a\u684a\u682a\u680a\u67ea\u67ca\u67aa\u678a\u676a\u674a"
- + "\u672a\u670a\u66ea\u66ca\u66aa\u668a\u666a\u664a\u662a\u660a\u65ea"
- + "\u65ca\u65aa\u658a\u656a\u654a\u652a\u650a\u6b26\u6de1\u6e9c\u5e48"
- + "\u5e28\u5e08\u5de8\u5dc8\u5da8\u5d88\u5d68\u5d48\u5d28\u5d08\u5ce8"
- + "\u5cc8\u5ca8\u5c88\u5c68\u5c48\u5c28\u5c08\u5be8\u5bc8\u5ba8\u5b88"
- + "\u5b68\u5b48\u5b28\u5b08\u5ae8\u5ac8\u5aa8\u5a88\u5a68\u5a48\u5a28"
- + "\u5a08\u59e8\u59c8\u59a8\u5988\u5968\u5948\u5928\u5908\u58e8\u58c8"
- + "\u58a8\u5888\u5868\u5848\u5828\u5808\u57e8\u57c8\u57a8\u5788\u5768"
- + "\u5748\u5d6a\u5d4a\u5d2a\u5d0a\u5cea\u5cca\u5caa\u5c8a\u5c6a\u5c4a"
- + "\u5c2a\u5c0a\u5bea\u5bca\u5baa\u5b8a\u5b6a\u5b4a\u5b2a\u5b0a\u5aea"
- + "\u5aca\u5aaa\u5a8a\u5a6a\u5a4a\u5a2a\u5a0a\u59ea\u59ca\u59aa\u598a"
- + "\u596a\u594a\u592a\u590a\u58ea\u58ca\u58aa\u588a\u586a\u584a\u582a"
- + "\u580a\u57ea\u57ca\u57aa\u578a\u576a\u574a\u572a\u570a\u56ea\u56ca"
- + "\u56aa\u568a\u566a\u564a\u562a\u560a\u55ea\u55ca\u55aa\u558a\u556a"
- + "\u554a\u552a\u550a\u54ea\u54ca\u54aa\u548a\u546a\u544a\u542a\u540a"
- + "\u53ea\u53ca\u53aa\u538a\u536a\u534a\u532a\u530a\u52ea\u52ca\u52aa"
- + "\u528a\u526a\u524a\u522a\u520a\u51ea\u51ca\u51aa\u518a\u516a\u514a"
- + "\u512a\u510a\u50ea\u50ca\u50aa\u508a\u506a\u504a\u502a\u500a\u4fea"
- + "\u4fca\u4faa\u4f8a\u4f6a\u4f4a\u4f2a\u4f0a\u4eea\u4eca\u4eaa\u4e8a"
- + "\u4e6a\u4e4a\u4e2a\u4e0a\u4dea\u4dca\u4daa\u4d8a\u4d6a\u4d4a\u4d2a"
- + "\u4d0a\u4cea\u4cca\u4caa\u4c8a\u4c6a\u4c4a\u4c2a\u4c0a\u4bea\u4bca"
- + "\u4baa\u4b8a\u4b6a\u4b4a\u4b2a\u4b0a\u4aea\u4aca\u4aaa\u4a8a\u4a6a"
- + "\u4a4a\u4a2a\u4a0a\u49ea\u49ca\u49aa\u498a\u496a\u494a\u492a\u490a"
- + "\u48ea\u48ca\u48aa\u488a\u486a\u484a\u482a\u480a\u47ea\u47ca\u47aa"
- + "\u478a\u476a\u474a\u472a\u470a\u46ea\u46ca\u46aa\u468a\u466a\u464a"
- + "\u462a\u460a\u45ea\u45ca\u45aa\u458a\u456a\u454a\u452a\u450a\u44ea"
- + "\u44ca\u44aa\u448a\u446a\u444a\u442a\u440a\u43ea\u43ca\u43aa\u438a"
- + "\u436a\u434a\u432a\u430a\u42ea\u42ca\u42aa\u428a\u426a\u424a\u422a"
- + "\u420a\u41ea\u41ca\u41aa\u418a\u416a\u414a\u412a\u410a\u40ea\u40ca"
- + "\u40aa\u408a\u406a\u404a\u402a\u400a\u3fea\u3fca\u3faa\u3f8a\u3f6a"
- + "\u3f4a\u3f2a\u3f0a\u3eea\u3eca\u3eaa\u3e8a\u3e6a\u3e4a\u3e2a\u3e0a"
- + "\u3dea\u3dca\u3daa\u3d8a\u3d6a\u3d4a\u3d2a\u3d0a\u3cea\u3cca\u3caa"
- + "\u3c8a\u3c6a\u3c4a\u3c2a\u3c0a\u3bea\u3bca\u3baa\u3b8a\u3b6a\u3b4a"
- + "\u3b2a\u3b0a\u3aea\u3aca\u3aaa\u3a8a\u3a6a\u3a4a\u3a2a\u3a0a\u39ea"
- + "\u39ca\u39aa\u398a\u396a\u394a\u392a\u390a\u38ea\u38ca\u38aa\u388a"
- + "\u386a\u384a\u382a\u380a\u37ea\u37ca\u37aa\u378a\u376a\u374a\u372a"
- + "\u370a\u36ea\u36ca\u36aa\u368a\u366a\u364a\u362a\u360a\u35ea\u35ca"
- + "\u35aa\u358a\u356a\u354a\u352a\u350a\u34ea\u34ca\u34aa\u348a\u346a"
- + "\u344a\u342a\u340a\u33ea\u33ca\u33aa\u338a\u336a\u334a\u332a\u330a"
- + "\u32ea\u32ca\u32aa\u328a\u326a\u324a\u322a\u320a\u31ea\u28f2\u2b68"
- + "\u2b48\u3c2b\u3c0b\u3beb\u3bcb\u3bab\u3b8b\u3b6b\u3b4b\u3b2b\u3b0b"
- + "\u3aeb\u3acb\u3aab\u3a8b\u3a6b\u3a4b\u3a2b\u3a0b\u39eb\u39cb\u39ab"
- + "\u398b\u396b\u394b\u392b\u390b\u38eb\u38cb\u38ab\u388b\u386b\u384b"
- + "\u382b\u380b\u37eb\u37cb\u37ab\u378b\u376b\u374b\u372b\u370b\u36eb"
- + "\u36cb\u36ab\u368b\u366b\u364b\u362b\u360b\u35eb\u35cb\u35ab\u358b"
- + "\u356b\u354b\u352b\u350b\u34eb\u34cb\u34ab\u348b\u346b\u344b\u344b"
- + "\u342b\u340b\u33eb\u33cb\u33ab\u338b\u336b\u334b\u332b\u330b\u32eb"
- + "\u32cb\u32ab\u328b\u326b\u324b\u322b\u320b\u31eb\u31cb\u31ab\u318b"
- + "\u316b\u314b\u312b\u310b\u30eb\u30cb\u30ab\u308b\u306b\u304b\u302b"
- + "\u300b\u2feb\u2fcb\u2fab\u2f8b\u2f6b\u2f4b\u2f2b\u2f0b\u2eeb\u2ecb"
- + "\u2eab\u2e8b\u2e6b\u2e4b\u2e2b\u2e0b\u2deb\u2dcb\u2dab\u2d8b\u2d6b"
- + "\u2d4b\u2d2b\u2d0b\u2ceb\u2ccb\u2cab\u2c8b\u2c6b\u2c4b\u2c2b\u2c0b"
- + "\u2beb\u2bcb\u2bab\u2b8b\u2b6b\u2b4b\u2b2b\u2b0b\u2aeb\u2acb\u2aab"
- + "\u2a8b\u2a6b\u2a4b\u2a2b\u2a0b\u29eb\u29cb\u29ab\u298b\u296b\u294b"
- + "\u292b\u290b\u28eb\u28cb\u28ab\u288b\u286b\u284b\u282b\u280b\u27eb"
- + "\u27cb\u27ab\u278b\u276b\u274b\u272b\u270b\u26eb\u26cb\u26ab\u268b"
- + "\u266b\u264b\u262b\u260b\u25eb\u25cb\u25ab\u258b\u256b\u254b\u252b"
- + "\u250b\u24eb\u24cb\u24ab\u248b\u246b\u244b\u242b\u240b\u23eb\u23cb"
- + "\u23ab\u238b\u236b\u234b\u232b\u230b\u22eb\u22cb\u22ab\u228b\u226b"
- + "\u224b\u222b\u220b\u21eb\u21cb\u21ab\u218b\u216b\u214b\u212b\u210b"
- + "\u20eb\u20cb\u20ab\u208b\u206b\u204b\u202b\u200b\u1feb\u1fcb\u1fab"
- + "\u1f8b\u1f6b\u1f4b\u1f2b\u1f0b\u1eeb\u1ecb\u1eab\u1e8b\u1e6b\u1e4b"
- + "\u1e2b\u1e0b\u1deb\u1dcb\u1dab\u1d8b\u1d6b\u1d4b\u1d2b\u1d0b\u1ceb"
- + "\u1ccb\u1cab\u1c8b\u1c6b\u1c4b\u1c2b\u1c0b\u1beb\u1bcb\u1bab\u1b8b"
- + "\u1b6b\u106a\u104a\u102a\u100a\u0fea\u0fca\u0faa\u0f8a\u0f6a\u0668"
- + "\u08e8\u08c8\u08a8\u0888\u0868\u0848\u07d7\u194b\u07b6\u0d1c\u0cfc"
- + "\u0cb2\u0ca9\u0c9c\u0c7c\u0c5c\u0c3c\u0c1c\u0bfc\u0bdc\u0bbc\u0b9c"
- + "\u0b7c\u0b5e\u0b2c\u0b1c\u0ab8\u0adc\u0a9c\u02c2\u0528\u166b\u1667"
- + "\u03ff\u09fc\u09dc\u09bc\u0659\u0bb8\u15a7\u0fc6\u01c0\u01b1\u09cb"
- + "\u082c\u1285";
-
- /**
- * Information about each character. The low order 5 bits form the
- * character type, the next bit is a flag for non-breaking spaces, and the
- * next bit is a flag for mirrored directionality. The high order 9 bits
- * form the offset into the attribute tables. Note that this limits the
- * number of unique character attributes to 512, which is not a problem
- * as of Unicode version 3.2.0, but may soon become one.
- */
- String DATA
- = "\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3e80\u3e80\u3001\u3082\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3a85"
- + "\u3a85\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85"
- + "\u3e80\u3e80\u3e80\u3e80\u5b88\u5b88\u3e80\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80"
- + "\u3e80\u3e80\u3e80\u5198\u3e80\u3e80\u3e80\u3e80\u4606\u3e80\u3e80"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u3a85"
- + "\u3a85\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u3e80\u3e80\u3e80\u3e80\u5202\u5202\u5202\u5202"
- + "\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202"
- + "\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202\u5202"
- + "\u5202\u5202\u5202\u5202\u5202\u2e82\u3e80\u5198\u2a14\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4686\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u1a1b\u1a1b\u3e80\u3e80\u3e80\u3e80\u4584\u3e80\u3e80"
- + "\u3e80\u0298\u3e80\u0298\u6615\u6696\u0298\u1a97\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u4584\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u4584\u4584\u1a1b\u1a1b\u1a1b\u1a1b"
- + "\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u4584"
- + "\u4584\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b"
- + "\u1a1b\u1a1b\u1a1b\u1a1b\u2e82\u7282\u2e82\u3e80\u2e82\u4902\u7481"
- + "\u7481\u7481\u7481\u7383\u1a1b\u1a1b\u1a1b\u6d82\u6d82\u4902\u4902"
- + "\u3e80\u3e80\u2e82\u4902\u6e01\u6e01\u7501\u7501\u3e80\u1a1b\u1a1b"
- + "\u1a1b\u1b02\u1b82\u1c02\u1c82\u1d02\u1d82\u1e02\u1e82\u1f02\u1f82"
- + "\u2002\u2082\u2102\u2182\u2202\u2282\u2302\u2382\u2402\u2482\u2502"
- + "\u2582\u2602\u2682\u2702\u2782\u0455\u0c99\u04d6\u0c99\017\017"
- + "\017\017\017\u010f\017\017\017\017\017\017\017"
- + "\017\017\017\017\017\017\017\017\017\017\017"
- + "\017\017\017\017\017\017\017\017\u008f\u010f\u008f"
- + "\u018f\u010f\017\017\017\017\017\017\017\017\017"
- + "\017\017\017\017\017\u010f\u010f\u010f\u008f\u020c\u0298"
- + "\u0298\u0318\u039a\u0318\u0298\u0298\u0455\u04d6\u0298\u0519\u0598"
- + "\u0614\u0598\u0698\u0709\u0789\u0809\u0889\u0909\u0989\u0a09\u0a89"
- + "\u0b09\u0b89\u0598\u0298\u0c59\u0c99\u0c59\u0298\u0d01\u0d81\u0e01"
- + "\u0e81\u0f01\u0f81\u1001\u1081\u1101\u1181\u1201\u1281\u1301\u1381"
- + "\u1401\u1481\u1501\u1581\u1601\u1681\u1701\u1781\u1801\u1881\u1901"
- + "\u1981\u0455\u0298\u04d6\u1a1b\u1a97\u0298\u0298\u0298\u0c99\u0455"
- + "\u04d6\u3e80\u0298\u0298\u0298\u0298\u0298\u0298\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u282c\u0298\u039a\u039a\u039a\u039a\u289c"
- + "\u289c\u1a1b\u289c\u2902\u29dd\u0c99\u2a14\u289c\u1a1b\u2a9c\u0519"
- + "\u2b0b\u2b8b\u1a1b\u2c02\u289c\u0298\u1a1b\u2c8b\u2902\u2d5e\u2d8b"
- + "\u2d8b\u2d8b\u0298\u0298\u0519\u0614\u0c99\u0c99\u0c99\u3e80\u0298"
- + "\u039a\u0318\u0298\u3e80\u3e80\u3e80\u3e80\u5405\u5405\u5405\u3e80"
- + "\u5405\u3e80\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u3e80\u3e80\u3e80\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u3e80\u501c\u501c\u4f81\u4f81"
- + "\u4f81\u4f81\u4f81\u4f81\u4f81\u4f81\u4f81\u4f81\u4f81\u4f81\u4f81"
- + "\u4f81\u4f81\u4f81\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01"
- + "\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01"
- + "\u2e01\u2e01\u2e01\u2e01\u0c99\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01"
- + "\u2e01\u2e82\u2e82\u2e82\u4902\u4902\u2e82\u2e82\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u2e82\u2e82"
- + "\u2e82\u2e82\u2e82\u3e80\u3e80\u3e80\u3e80\u3e80\u5305\u4606\u5305"
- + "\u5305\u3e80\u5305\u5305\u3e80\u5305\u5305\u5305\u5305\u5305\u5305"
- + "\u5305\u5305\u5305\u5305\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5398\u5405\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u5087\u5087\u4606\u5087\u5087\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b"
- + "\u2d8b\u2d8b\u2d8b\u2d8b\u2d8b\u840b\u3082\u3001\u3082\u3001\u3082"
- + "\u3001\u3082\u3001\u3082\u2e82\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3001\u3082\u3001\u3082\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u5c09"
- + "\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89\u6009\u6089\u4606\u4606"
- + "\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u1a1b\u1a1b\u4701\u0298\u4781\u4781\u4781\u3e80"
- + "\u4801\u3e80\u4881\u4881\u4902\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01"
- + "\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2f02"
- + "\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02"
- + "\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02"
- + "\u0c99\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f82\u2f02\u2f02"
- + "\u4a82\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u4b02"
- + "\u4b82\u4b82\u3e80\u4c02\u4c82\u4d01\u4d01\u4d01\u4d82\u4e02\u2902"
- + "\u3e80\u3e80\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u2e82\u3b81\u3c03\u3c82"
- + "\u3001\u3082\u3d81\u3e01\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3101\u3182"
- + "\u3001\u3082\u3001\u3082\u3001\u3082\u2902\u3001\u3082\u3001\u3082"
- + "\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u4e82\u4f02\u3d02\u2902\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u5b10\u5b10\u5b10\u5b10\u5b10"
- + "\u5b10\u7f0b\u3e80\u3e80\u3e80\u7f8b\u800b\u808b\u810b\u818b\u820b"
- + "\u0519\u0519\u0c99\u0455\u04d6\u2902\u3301\u3001\u3082\u3001\u3082"
- + "\u3381\u3001\u3082\u3401\u3401\u3001\u3082\u2902\u3481\u3501\u3581"
- + "\u3001\u3082\u3401\u3601\u3682\u3701\u3781\u3001\u3082\u2902\u2902"
- + "\u3701\u3801\u2902\u3881\u3a85\u3a85\u3a85\u3a85\u3b81\u3c03\u3c82"
- + "\u3b81\u3c03\u3c82\u3b81\u3c03\u3c82\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3d02\u3001\u3082\u501c\u4606\u4606\u4606\u4606\u3e80\u5087\u5087"
- + "\u3e80\u3e80\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3001\u3082\u3001\u3082\u3201\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3282\u3001\u3082\u3001\u3082\u3001\u3082\u3901\u3001\u3082\u3901"
- + "\u2902\u2902\u3001\u3082\u3901\u3001\u3082\u3981\u3981\u3001\u3082"
- + "\u3001\u3082\u3a01\u3001\u3082\u2902\u3a85\u3001\u3082\u2902\u3b02"
- + "\u4d01\u3001\u3082\u3001\u3082\u3e80\u3e80\u3001\u3082\u3e80\u3e80"
- + "\u3001\u3082\u3e80\u3e80\u3e80\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001"
- + "\u3082\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u0598\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u5398\u3e80\u3e80\u3e80\u5398"
- + "\u5398\u5398\u5398\u5398\u5398\u5398\u5398\u5398\u5398\u5398\u5398"
- + "\u5398\u5398\u3e80\u5b10\u5405\u4606\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u3e80\u3e80\u5b10\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01"
- + "\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01"
- + "\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01\u4d01"
- + "\u4d01\u4d01\u4d01\u4d01\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u5c09\u5c89\u5d09\u5d89\u5e09\u5e89"
- + "\u5f09\u5f89\u6009\u6089\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u2902\u2902\u2902\u3f02\u3f82\u2902\u4002"
- + "\u4002\u2902\u4082\u2902\u4102\u2902\u2902\u2902\u2902\u4002\u2902"
- + "\u2902\u4182\u2902\u2902\u2902\u2902\u4202\u4282\u2902\u2902\u2902"
- + "\u2902\u2902\u4282\u2902\u2902\u4302\u2902\u2902\u4382\u2902\u2902"
- + "\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u4402\u2902\u2902"
- + "\u4402\u2902\u2902\u2902\u2902\u4402\u2902\u4482\u4482\u2902\u2902"
- + "\u2902\u2902\u2902\u2902\u4502\u2902\u2902\u2902\u2902\u2902\u2902"
- + "\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u2902\u3e80\u3e80\u4584"
- + "\u4584\u4584\u4584\u4584\u4584\u4584\u4584\u4584\u1a1b\u1a1b\u4584"
- + "\u4584\u4584\u4584\u4584\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b\u1a1b"
- + "\u1a1b\u1a1b\u4584\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u5101\u5101"
- + "\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u5101"
- + "\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u5101\u3e80"
- + "\u3e80\u4584\u5198\u5198\u5198\u5198\u5198\u5198\u2e01\u2e01\u3e80"
- + "\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u2e01\u4982\u4a02"
- + "\u4a02\u4a02\u4902\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02"
- + "\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u2f02\u4f02\u4f02\u4f02"
- + "\u4f02\u4f02\u4f02\u4f02\u4f02\u4f02\u4f02\u4f02\u4f02\u4f02\u4f02"
- + "\u4f02\u4f02\u4606\u4606\u4606\u4606\u4606\u5198\u4606\u4606\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u3e80\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u3e80\u4606\u4606\u4606\u5298"
- + "\u4606\u4606\u5298\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u5305\u5305\u5305\u5305\u5305\u5305\u5305"
- + "\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u5305\u5305\u5305\u5298\u5298\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u5c89\u5d09\u5d89"
- + "\u5e09\u5e89\u5f09\u5f89\u6009\u6089\u640b\u648b\u650b\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u4606\u5b88\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80"
- + "\u3e80\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80"
- + "\u3e80\u3a85\u3a85\u3e80\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3e80"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u5b88\u5b88\u5b88\u5b88\u3e80\u4606\u4606\u4606\u3e80\u4606"
- + "\u4606\u4606\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u4606"
- + "\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u4606"
- + "\u5b88\u5b88\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3e80\u3e80\u3a85\u3a85\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3e80\u3e80\u3e80\u3e80\u5b88\u5b88\u3e80\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3a85\u3a85\u3a85"
- + "\u3e80\u3e80\u3e80\u3e80\u5c09\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09"
- + "\u5f89\u6009\u6089\u501c\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u5509\u5589\u5609"
- + "\u5689\u5709\u5789\u5809\u5889\u5909\u5989\u0318\u5a18\u5a18\u5398"
- + "\u3e80\u3e80\u4606\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u3e80\u3e80\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u6615\u6696\u5484\u5405\u5405\u5405\u5405"
- + "\u5405\u5405\u5405\u5405\u5405\u5405\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u5b88\u5b88\u5198\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u4606\u4606\u5b88"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3e80"
- + "\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u5198\u5198\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u4606\u4606\u4606\u4606\u4606\u5484\u5484\u4606"
- + "\u4606\u289c\u4606\u4606\u4606\u4606\u3e80\u3e80\u0709\u0789\u0809"
- + "\u0889\u0909\u0989\u0a09\u0a89\u0b09\u0b89\u5405\u5405\u5405\u5a9c"
- + "\u5a9c\u3e80\u3a85\u3a85\u3a85\u3e80\u3a85\u3e80\u3a85\u3e80\u3e80"
- + "\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u4606\u3a85\u3a85\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u3e80\u4606\u4606\u3a85\u3e80\u3e80"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u4606\u4606\u5b88"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3e80\u3e80\u4606\u3a85\u5b88\u5b88\u5b88\u5b88\u5b88\u3e80\u4606"
- + "\u5b88\u5b88\u3e80\u5b88\u5b88\u4606\u4606\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u5b88\u5b88\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3a85\u3e80\u5198\u5198\u5198\u5198\u5198\u5198\u5198\u5198"
- + "\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89\u6009\u6089\u640b\u670b"
- + "\u678b\u680b\u688b\u690b\u698b\u6a0b\u6a8b\u648b\u6b0b\u3e80\u3e80"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3e80"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u4606\u3a85\u5b88\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u5b88\u5b88\u5b88\u5b88"
- + "\u4606\u3e80\u3e80\u3a85\u4606\u4606\u4606\u4606\u3e80\u3e80\u3e80"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3e80\u3e80\u3e80"
- + "\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u4606\u3e80\u5b88\u5b88\u5b88"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85"
- + "\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3e80\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u4606\u3a85\u3a85\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u3e80\u3e80\u3e80\u3e80\u039a\u039a\u039a"
- + "\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a\u039a"
- + "\u039a\u039a\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85\u4606\u4606"
- + "\u5198\u5198\u5c09\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89\u6009"
- + "\u6089\u5198\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u0298\u0298\u0318\u039a\u0318"
- + "\u0298\u0298\u6615\u6696\u0298\u0519\u0598\u0614\u0598\u0698\u0709"
- + "\u0789\u0809\u0889\u0909\u0989\u0a09\u0a89\u0b09\u0b89\u0598\u0298"
- + "\u0c99\u0c99\u0c99\u0298\u0298\u0298\u0298\u0298\u0298\u2a14\u0298"
- + "\u0298\u0298\u0298\u5b10\u5b10\u5b10\u5b10\u3e80\u5c09\u5c89\u5d09"
- + "\u5d89\u5e09\u5e89\u5f09\u5f89\u6009\u6089\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u5b88"
- + "\u4606\u4606\u4606\u4606\u3e80\u3e80\u5b88\u5b88\u3e80\u3e80\u5b88"
- + "\u5b88\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u5b88\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85\u3e80\u3a85\u3e80\u3e80"
- + "\u3a85\u3a85\u3e80\u3a85\u3e80\u3e80\u3a85\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3e80\u3a85\u3a85\u3e80\u3a85\u3a85\u3e80\u3a85\u3a85"
- + "\u3e80\u3e80\u4606\u3e80\u5b88\u5b88\u4606\u4606\u3e80\u3e80\u3e80"
- + "\u3e80\u4606\u4606\u3e80\u3e80\u4606\u4606\u4606\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85"
- + "\u3a85\u3e80\u3a85\u3e80\u3a85\u3a85\u4606\u4606\u3e80\u3e80\u5c09"
- + "\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89\u6009\u6089\u3a85\u3a85"
- + "\u039a\u039a\u610b\u618b\u620b\u628b\u630b\u638b\u501c\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3a85"
- + "\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u4606\u3a85"
- + "\u5b88\u5b88\u4606\u4606\u4606\u4606\u4606\u3e80\u4606\u4606\u5b88"
- + "\u3e80\u5b88\u5b88\u4606\u3e80\u3e80\u3a85\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u5c09\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89\u6009\u6089\u630b"
- + "\u630b\u630b\u630b\u630b\u630b\u630b\u630b\u630b\u630b\u501c\u4606"
- + "\u501c\u4606\u501c\u4606\u6615\u6696\u6615\u6696\u5b88\u5b88\u4606"
- + "\u4606\u4606\u3e80\u3e80\u3e80\u5b88\u5b88\u3e80\u3e80\u5b88\u5b88"
- + "\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u4606\u5b88"
- + "\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3e80\u3a85\u3a85\u3e80\u5b88\u4606\u4606\u4606\u4606\u5b88"
- + "\u4606\u3e80\u3e80\u3e80\u4606\u4606\u5b88\u4606\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u5b88\u5b88\u5b88\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u5b88\u5b88\u3e80\u3e80\u3e80\u5b88\u5b88\u5b88\u3e80\u5b88\u5b88"
- + "\u5b88\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u5b88\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u4584\u3e80\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u3e80\u3e80\u5c09\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89"
- + "\u6009\u6089\u3e80\u3e80\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u5c09"
- + "\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89\u6009\u6089\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u5087\u5087\u5087\u5b88\u4606\u4606"
- + "\u4606\u3e80\u3e80\u5b88\u5b88\u5b88\u3e80\u5b88\u5b88\u5b88\u4606"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u5b88\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u4606\u3e80\u3e80\u3e80\u3e80"
- + "\u5b88\u5b88\u5b88\u4606\u4606\u4606\u3e80\u4606\u3e80\u5b88\u5b88"
- + "\u5b88\u5b88\u5b88\u5b88\u5b88\u5b88\u4606\u5b88\u5b88\u4606\u4606"
- + "\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u4606\u5198\u5198"
- + "\u5198\u5198\u5198\u5198\u5198\u039a\u5198\u3e80\u3e80\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u4584\u4606\u4606\u4606\u4606\u4606"
- + "\u4606\u4606\u4606\u5198\u5c09\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09"
- + "\u5f89\u6009\u6089\u5198\u5198\u3e80\u3e80\u3e80\u3e80\u3a85\u501c"
- + "\u501c\u501c\u5198\u5198\u5198\u5198\u5198\u5198\u5198\u5198\u65b8"
- + "\u5198\u5198\u5198\u5198\u5198\u5198\u501c\u501c\u501c\u501c\u501c"
- + "\u4606\u4606\u501c\u501c\u501c\u501c\u501c\u501c\u4606\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u3e80\u3e80\u501c\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u1a97\u4584\u4584\u4584"
- + "\u3e80\u5c09\u5c89\u5d09\u5d89\u5e09\u5e89\u5f09\u5f89\u6009\u6089"
- + "\u5198\u5198\u5198\u5198\u5198\u5198\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u5b88\u5b88\u4606\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u020c\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u6615\u6696\u3e80\u3e80\u3e80\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u5198"
- + "\u5198\u5198\u6b8b\u6c0b\u6c8b\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u4606\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3001\u3082\u3001"
- + "\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082"
- + "\u3001\u3082\u3001\u3082\u3001\u3082\u3001\u3082\u2e82\u2e82\u2e82"
- + "\u2e82\u2e82\u6d02\u3e80\u3e80\u3e80\u3e80\u6d82\u6d82\u6d82\u6d82"
- + "\u6d82\u6d82\u6d82\u6d82\u6e01\u6e01\u6e01\u6e01\u6e01\u6e01\u6e01"
- + "\u6e01\u6d82\u6d82\u6d82\u6d82\u6d82\u6d82\u6d82\u6d82\u6e01\u6e01"
- + "\u6e01\u6e01\u6e01\u6e01\u6e01\u6e01\u6d82\u6d82\u6d82\u6d82\u6d82"
- + "\u6d82\u3e80\u3e80\u6e01\u6e01\u6e01\u6e01\u6e01\u6e01\u3e80\u3e80"
- + "\u2e82\u6d82\u4902\u6d82\u4902\u6d82\u4902\u6d82\u3e80\u6e01\u3e80"
- + "\u6e01\u3e80\u6e01\u3e80\u6e01\u6d82\u6d82\u6d82\u6d82\u6d82\u6d82"
- + "\u6d82\u6d82\u6e01\u6e01\u6e01\u6e01\u6e01\u6e01\u6e01\u6e01\u6e82"
- + "\u6e82\u6f02\u6f02\u6f02\u6f02\u6f82\u6f82\u7002\u7002\u7082\u7082"
- + "\u7102\u7102\u3e80\u3e80\u7182\u7182\u7182\u7182\u7182\u7182\u7182"
- + "\u7182\u7203\u7203\u7203\u7203\u7203\u7203\u7203\u7203\u7182\u7182"
- + "\u7182\u7182\u7182\u7182\u7182\u7182\u7203\u7203\u7203\u7203\u7203"
- + "\u7203\u7203\u7203\u6d82\u6d82\u2e82\u7282\u2e82\u3e80\u2e82\u4902"
- + "\u6e01\u6e01\u7301\u7301\u7383\u1a1b\u7402\u1a1b\u1b02\u1b82\u1c02"
- + "\u1c82\u1d02\u1d82\u1e02\u1e82\u1f02\u1f82\u2002\u2082\u2102\u2182"
- + "\u2202\u2282\u2302\u2382\u2402\u2482\u2502\u2582\u2602\u2682\u2702"
- + "\u2782\u6615\u0c99\u6696\u0c99\u3e80\u6d82\u6d82\u4902\u4902\u2e82"
- + "\u7582\u2e82\u4902\u6e01\u6e01\u7601\u7601\u7681\u1a1b\u1a1b\u1a1b"
- + "\u3e80\u3e80\u2e82\u7282\u2e82\u3e80\u2e82\u4902\u7701\u7701\u7781"
- + "\u7781\u7383\u1a1b\u1a1b\u3e80\u020c\u020c\u020c\u020c\u020c\u020c"
- + "\u020c\u782c\u020c\u020c\u020c\u788c\u5b10\u5b10\u7910\u7990\u2a14"
- + "\u7a34\u2a14\u2a14\u2a14\u2a14\u0298\u0298\u7a9d\u7b1e\u6615\u7a9d"
- + "\u7a9d\u7b1e\u6615\u7a9d\u0298\u0298\u0298\u0298\u0298\u0298\u0298"
- + "\u0298\u7b8d\u7c0e\u7c90\u7d10\u7d90\u7e10\u7e90\u782c\u0318\u0318"
- + "\u0318\u0318\u0318\u0298\u0298\u0298\u0298\u29dd\u2d5e\u0298\u0298"
- + "\u0298\u0298\u1a97\u7f0b\u2c8b\u2b0b\u2b8b\u7f8b\u800b\u808b\u810b"
- + "\u818b\u820b\u0519\u0519\u0c99\u0455\u04d6\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u3e80\u3e80\u3e80\u3e80\u3e80\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u4d01\u289c\u289c\u289c\u289c"
- + "\u4d01\u289c\u289c\u2902\u4d01\u4d01\u4d01\u2902\u2902\u4d01\u4d01"
- + "\u4d01\u2902\u289c\u4d01\u289c\u289c\u289c\u4d01\u4d01\u4d01\u4d01"
- + "\u4d01\u289c\u289c\ua20a\ua28a\ua30a\ua38a\ua40a\ua48a\ua50a\ua58a"
- + "\ua60a\u4606\u4606\u4606\u4606\u4606\u4606\u2a14\u4584\u4584\u4584"
- + "\u4584\u4584\u289c\u289c\ua68a\ua70a\ua78a\u3e80\u3e80\u3e80\u289c"
- + "\u289c\u289c\u289c\u3e80\u289c\u289c\u289c\u289c\u3e80\u3e80\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u0c99\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u0c99\u0c99\u289c\u289c\u0c99\u289c\u0c99"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u0c99\u289c\u289c\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u948a"
- + "\u950a\u958a\u960a\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u0c99\u0c99\u0c99\u0c99\u0c99\u289c\u289c"
- + "\u289c\u289c\u289c\u0c99\u0c99\u289c\u289c\u289c\u289c\u4d01\u289c"
- + "\u8281\u289c\u4d01\u289c\u8301\u8381\u4d01\u4d01\u2a9c\u2902\u4d01"
- + "\u4d01\u289c\u4d01\u2902\u3a85\u3a85\u3a85\u3a85\u2902\u289c\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u848a\u850a\u858a\u860a\u868a\u870a\u878a"
- + "\u880a\u888a\u890a\u898a\u8a0a\u8a8a\u8b0a\u8b8a\u8c0a\u8c8a\u8d0a"
- + "\u8d8a\u8e0a\u8e8a\u8f0a\u8f8a\u900a\u908a\u910a\u918a\u920a\u928a"
- + "\u930a\u938a\u940a\u0c99\u0c99\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59"
- + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
- + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99"
- + "\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99\u0c99"
- + "\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59"
- + "\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
- + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59\u0c59"
- + "\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c99\u0c99\u0c99\u0c99"
- + "\u0c99\u0c99\u0c99\u289c\u289c\u0c99\u289c\u289c\u0c99\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u0c99\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u3e80\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u0c99\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59"
- + "\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c59\u0519\u0519\u0c99\u0c59"
- + "\u0c59\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c99\u0c59\u0c99"
- + "\u0c59\u0c99\u0c99\u0c99\u0c99\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
- + "\u0c59\u0c59\u0c59\u0c99\u0c99\u0c99\u0c99\u0c99\u0c59\u0c99\u0c59"
- + "\u0c59\u0c59\u0c59\u0c59\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u0455\u04d6\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u3e80\u3e80\u3e80\u3e80\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u9c1c\u9c1c\u9c1c\u9c1c"
- + "\u9c1c\u9c1c\u9c1c\u9c1c\u9c1c\u9c1c\u9c1c\u9c1c\u9c1c\u9c1c\u9c1c"
- + "\u9c1c\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c"
- + "\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c\u9c9c\u7f0b\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u0c59\u0c99\u0c59\u0c99\u0c59"
- + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59"
- + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59\u0c59"
- + "\u0c59\u0c59\u0c59\u0c59\u0c59\u0c99\u0c99\u0c59\u0c59\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u039a\u039a\u0c99\u1a1b\u289c\u039a\u039a\u3e80\u289c\u0c99"
- + "\u0c99\u0c99\u0c99\u289c\u289c\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u5b10\u5b10\u5b10\u289c\u289c\u3e80\u3e80"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u3e80\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u3e80\u289c"
- + "\u3e80\u289c\u289c\u289c\u289c\u3e80\u3e80\u3e80\u289c\u3e80\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u840b\u9d0b"
- + "\u9d8b\u9e0b\u9e8b\u9f0b\u9f8b\ua00b\ua08b\ua10b\u840b\u9d0b\u9d8b"
- + "\u9e0b\u9e8b\u9f0b\u9f8b\ua00b\ua08b\ua10b\u289c\u3e80\u3e80\u3e80"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u0c59\u0c59\u0c59"
- + "\u0c59\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c\u289c"
- + "\u501c\u289c\u289c\u289c\u289c\u289c\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u630b\u630b\u630b\u630b\u630b\u630b\u630b\u630b\u630b\u630b\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u3e80\u3e80"
- + "\u3e80\u501c\u610b\u618b\u620b\u628b\ua80b\ua88b\ua90b\ua98b\uaa0b"
- + "\u640b\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u289c\u3e80\u289c\u289c\u289c"
- + "\u3e80\u289c\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u2c8b\u2b0b\u2b8b\u7f8b\u800b\u808b"
- + "\u810b\u818b\u820b\u968b\u970b\u978b\u980b\u988b\u990b\u998b\u9a0b"
- + "\u9a8b\u9b0b\u9b8b\u2c8b\u2b0b\u2b8b\u7f8b\u800b\u808b\u810b\u818b"
- + "\u820b\u968b\u970b\u978b\u980b\u988b\u990b\u998b\u9a0b\u9a8b\u9b0b"
- + "\u9b8b\u501c\u501c\u501c\u501c\u020c\u0298\u0298\u0298\u289c\u4584"
- + "\u3a85\ua18a\u0455\u04d6\u0455\u04d6\u0455\u04d6\u0455\u04d6\u0455"
- + "\u04d6\u289c\u289c\u0455\u04d6\u0455\u04d6\u0455\u04d6\u0455\u04d6"
- + "\u2a14\u6615\u6696\u6696\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3e80\u3e80\u3e80\u3e80\u4606\u4606\u1a1b\u1a1b"
- + "\u4584\u4584\u3e80\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85"
- + "\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3a85\u3e80\u501c\u501c\u630b"
- + "\u630b\u630b\u630b\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c"
- + "\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u501c\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93"
- + "\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93"
- + "\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93\uaa93"
- + "\uaa93\uaa93\uaa93\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12"
- + "\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12"
- + "\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12\uab12"
- + "\uab12\uab12\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u5305"
- + "\u0519\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u5305\u5305"
- + "\u5305\u5305\u5305\u3e80\u5305\u5305\u5305\u5305\u5305\u3e80\u5305"
- + "\u3e80\u4606\u4606\u4606\u4606\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80"
- + "\u3e80\u3e80\u3e80\u3e80\u3e80\u3e80\u0298\u2a14\u2a14\u1a97\u1a97"
- + "\u6615\u6696\u6615\u6696\u6615\u6696\u6615\u6696\u6615\u6696\u6615"
- + "\u6696\u3e80\u3e80\u3e80\u3e80\u0298\u0298\u0298\u0298\u1a97\u1a97"
- + "\u1a97\u0598\u0298\u0598\u3e80\u0298\u0598\u0298\u0298\u2a14\u6615"
- + "\u6696\u6615\u6696\u6615\u6696\u0318\u0298\u0d01\u0d81\u0e01\u0e81"
- + "\u0f01\u0f81\u1001\u1081\u1101\u1181\u1201\u1281\u1301\u1381\u1401"
- + "\u1481\u1501\u1581\u1601\u1681\u1701\u1781\u1801\u1881\u1901\u1981"
- + "\u6615\u0298\u6696\u1a1b\u1a97";
-
- /**
- * This is the attribute table for computing the numeric value of a
- * character. The value is -1 if Unicode does not define a value, -2
- * if the value is not a positive integer, otherwise it is the value.
- * Note that this is a signed value, but stored as an unsigned char
- * since this is a String literal.
- */
- String NUM_VALUE
- = "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\000\001\002\003\004\005\006\007"
- + "\010\011\uffff\uffff\012\013\014\015\016\017\020"
- + "\021\022\023\024\025\026\027\030\031\032\033"
- + "\034\035\036\037 !\"#\uffff\uffff\012"
- + "\013\014\015\016\017\020\021\022\023\024\025"
- + "\026\027\030\031\032\033\034\035\036\037 "
- + "!\"#\uffff\uffff\uffff\uffff\uffff\uffff\002\003"
- + "\uffff\001\uffff\ufffe\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff\uffff"
- + "\uffff\uffff\uffff\uffff\uffff\000\001\002\003\004\005"
- + "\006\007\010\011\uffff\uffff\uffff\uffff\000\001\002"
- + "\003\004\005\006\007\010\011\001\002\003\004"
- + "\uffff\020\012d\u03e8\uffff\uffff\uffff\024\036("
- + "2Class
s or Member
s.
- * More specific methods are also provided for computing the
- * type-signature of Constructor
s and
- * Method
s. Methods are also provided to go in the
- * reverse direction.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
-public class TypeSignature
-{
- /**
- * Returns a String
representing the type-encoding of a class.
- * The .class file format has different encodings for classes, depending
- * on whether it must be disambiguated from primitive types or not; hence
- * the descriptor parameter to choose between them. If you are planning
- * on decoding primitive types along with classes, then descriptor should
- * be true for correct results. Type-encodings are computed as follows:
- *
- *
- * boolean -> "Z"
- * byte -> "B"
- * char -> "C"
- * double -> "D"
- * float -> "F"
- * int -> "I"
- * long -> "J"
- * short -> "S"
- * void -> "V"
- * arrays -> "[" + descriptor format of component type
- * object -> class format: fully qualified name with '.' replaced by '/'
- * descriptor format: "L" + class format + ";"
- *
- *
- * @param type the class name to encode
- * @param descriptor true to return objects in descriptor format
- * @return the class name, as it appears in bytecode constant pools
- * @see #getClassForEncoding(String)
- */
- public static String getEncodingOfClass(String type, boolean descriptor)
- {
- if (! descriptor || type.charAt(0) == '[')
- return type.replace('.', '/');
- if (type.equals("boolean"))
- return "Z";
- if (type.equals("byte"))
- return "B";
- if (type.equals("short"))
- return "S";
- if (type.equals("char"))
- return "C";
- if (type.equals("int"))
- return "I";
- if (type.equals("long"))
- return "J";
- if (type.equals("float"))
- return "F";
- if (type.equals("double"))
- return "D";
- if (type.equals("void"))
- return "V";
- return 'L' + type.replace('.', '/') + ';';
- }
-
- /**
- * Gets the descriptor encoding for a class.
- *
- * @param clazz the class to encode
- * @param descriptor true to return objects in descriptor format
- * @return the class name, as it appears in bytecode constant pools
- * @see #getEncodingOfClass(String, boolean)
- */
- public static String getEncodingOfClass(Class clazz, boolean descriptor)
- {
- return getEncodingOfClass(clazz.getName(), descriptor);
- }
-
- /**
- * Gets the descriptor encoding for a class.
- *
- * @param clazz the class to encode
- * @return the class name, as it appears in bytecode constant pools
- * @see #getEncodingOfClass(String, boolean)
- */
- public static String getEncodingOfClass(Class clazz)
- {
- return getEncodingOfClass(clazz.getName(), true);
- }
-
-
- /**
- * This function is the inverse of getEncodingOfClass
. This
- * accepts both object and descriptor formats, but must know which style
- * of string is being passed in (usually, descriptor should be true). In
- * descriptor format, "I" is treated as int.class, in object format, it
- * is treated as a class named I in the unnamed package. This method is
- * strictly equivalent to {@link #getClassForEncoding(java.lang.String, boolean, java.lang.ClassLoader)}
- * with a class loader equal to null
. In that case, it
- * uses the default class loader on the calling stack.
- *
- * @param type_code the class name to decode
- * @param descriptor if the string is in descriptor format
- * @return the corresponding Class object
- * @throws ClassNotFoundException if the class cannot be located
- * @see #getEncodingOfClass(Class, boolean)
- */
- public static Class getClassForEncoding(String type_code, boolean descriptor)
- throws ClassNotFoundException
- {
- return getClassForEncoding(type_code, descriptor, null);
- }
-
- /**
- * This function is the inverse of getEncodingOfClass
. This
- * accepts both object and descriptor formats, but must know which style
- * of string is being passed in (usually, descriptor should be true). In
- * descriptor format, "I" is treated as int.class, in object format, it
- * is treated as a class named I in the unnamed package.
- *
- * @param type_code The class name to decode.
- * @param descriptor If the string is in descriptor format.
- * @param loader The class loader when resolving generic object name. If
- * loader
is null then it uses the default class loader on the
- * calling stack.
- * @return the corresponding Class object.
- * @throws ClassNotFoundException if the class cannot be located.
- * @see #getEncodingOfClass(Class, boolean)
- * @see #getClassForEncoding(String, boolean)
- */
- public static Class getClassForEncoding(String type_code, boolean descriptor,
- ClassLoader loader)
- throws ClassNotFoundException
- {
- if (descriptor)
- {
- switch (type_code.charAt(0))
- {
- case 'B':
- return byte.class;
- case 'C':
- return char.class;
- case 'D':
- return double.class;
- case 'F':
- return float.class;
- case 'I':
- return int.class;
- case 'J':
- return long.class;
- case 'S':
- return short.class;
- case 'V':
- return void.class;
- case 'Z':
- return boolean.class;
- default:
- throw new ClassNotFoundException("Invalid class name: "
- + type_code);
- case 'L':
- type_code = type_code.substring(1, type_code.length() - 1);
- // Fallthrough.
- case '[':
- }
- }
- return Class.forName(type_code.replace('/', '.'), true, loader);
- }
-
- /**
- * Gets the Class object for a type name.
- *
- * @param type_code the class name to decode
- * @return the corresponding Class object
- * @throws ClassNotFoundException if the class cannot be located
- * @see #getClassForEncoding(String, boolean)
- */
- public static Class getClassForEncoding(String type_code)
- throws ClassNotFoundException
- {
- return getClassForEncoding(type_code, true);
- }
-
- /**
- * Returns a String
representing the type-encoding of a
- * method. The type-encoding of a method is:
- *
- * "(" + parameter type descriptors + ")" + return type descriptor
- *
- * XXX This could be faster if it were implemented natively.
- *
- * @param m the method to encode
- * @return the encoding
- */
- public static String getEncodingOfMethod(Method m)
- {
- Class[] paramTypes = m.getParameterTypes();
- StringBuffer buf = new StringBuffer().append('(');
- for (int i = 0; i < paramTypes.length; i++)
- buf.append(getEncodingOfClass(paramTypes[i].getName(), true));
- buf.append(')').append(getEncodingOfClass(m.getReturnType().getName(),
- true));
- return buf.toString();
- }
-
- /**
- * Returns a String
representing the type-encoding of a
- * constructor. The type-encoding of a method is:
- *
- * "(" + parameter type descriptors + ")V"
- *
- * XXX This could be faster if it were implemented natively.
- *
- * @param c the constructor to encode
- * @return the encoding
- */
- public static String getEncodingOfConstructor(Constructor c)
- {
- Class[] paramTypes = c.getParameterTypes();
- StringBuffer buf = new StringBuffer().append('(');
- for (int i = 0; i < paramTypes.length; i++)
- buf.append(getEncodingOfClass(paramTypes[i].getName(), true));
- buf.append(")V");
- return buf.toString();
- }
-
- /**
- * Returns a String
representing the type-encoding of a
- * class member. This appropriately handles Constructors, Methods, and
- * Fields.
- *
- * @param mem the member to encode
- * @return the encoding
- */
- public static String getEncodingOfMember(Member mem)
- {
- if (mem instanceof Constructor)
- return getEncodingOfConstructor((Constructor) mem);
- if (mem instanceof Method)
- return getEncodingOfMethod((Method) mem);
- else // Field
- return getEncodingOfClass(((Field) mem).getType().getName(), true);
- }
-} // class TypeSignature
diff --git a/libjava/gnu/java/math/MPN.java b/libjava/gnu/java/math/MPN.java
deleted file mode 100644
index 05491bb7e84..00000000000
--- a/libjava/gnu/java/math/MPN.java
+++ /dev/null
@@ -1,771 +0,0 @@
-/* gnu.java.math.MPN
- Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-// Included from Kawa 1.6.62 with permission of the author,
-// Per Bothner
- *
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class FTPConnection
-{
-
- /**
- * The default FTP transmission control port.
- */
- public static final int FTP_PORT = 21;
-
- /**
- * The FTP data port.
- */
- public static final int FTP_DATA_PORT = 20;
-
- // -- FTP vocabulary --
- protected static final String USER = "USER";
- protected static final String PASS = "PASS";
- protected static final String ACCT = "ACCT";
- protected static final String CWD = "CWD";
- protected static final String CDUP = "CDUP";
- protected static final String SMNT = "SMNT";
- protected static final String REIN = "REIN";
- protected static final String QUIT = "QUIT";
-
- protected static final String PORT = "PORT";
- protected static final String PASV = "PASV";
- protected static final String TYPE = "TYPE";
- protected static final String STRU = "STRU";
- protected static final String MODE = "MODE";
-
- protected static final String RETR = "RETR";
- protected static final String STOR = "STOR";
- protected static final String STOU = "STOU";
- protected static final String APPE = "APPE";
- protected static final String ALLO = "ALLO";
- protected static final String REST = "REST";
- protected static final String RNFR = "RNFR";
- protected static final String RNTO = "RNTO";
- protected static final String ABOR = "ABOR";
- protected static final String DELE = "DELE";
- protected static final String RMD = "RMD";
- protected static final String MKD = "MKD";
- protected static final String PWD = "PWD";
- protected static final String LIST = "LIST";
- protected static final String NLST = "NLST";
- protected static final String SITE = "SITE";
- protected static final String SYST = "SYST";
- protected static final String STAT = "STAT";
- protected static final String HELP = "HELP";
- protected static final String NOOP = "NOOP";
-
- protected static final String AUTH = "AUTH";
- protected static final String PBSZ = "PBSZ";
- protected static final String PROT = "PROT";
- protected static final String CCC = "CCC";
- protected static final String TLS = "TLS";
-
- public static final int TYPE_ASCII = 1;
- public static final int TYPE_EBCDIC = 2;
- public static final int TYPE_BINARY = 3;
-
- public static final int STRUCTURE_FILE = 1;
- public static final int STRUCTURE_RECORD = 2;
- public static final int STRUCTURE_PAGE = 3;
-
- public static final int MODE_STREAM = 1;
- public static final int MODE_BLOCK = 2;
- public static final int MODE_COMPRESSED = 3;
-
- // -- Telnet constants --
- private static final String US_ASCII = "US-ASCII";
-
- /**
- * The socket used to communicate with the server.
- */
- protected Socket socket;
-
- /**
- * The socket input stream.
- */
- protected LineInputStream in;
-
- /**
- * The socket output stream.
- */
- protected CRLFOutputStream out;
-
- /**
- * The timeout when attempting to connect a socket.
- */
- protected int connectionTimeout;
-
- /**
- * The read timeout on sockets.
- */
- protected int timeout;
-
- /**
- * If true, print debugging information.
- */
- protected boolean debug;
-
- /**
- * The current data transfer process in use by this connection.
- */
- protected DTP dtp;
-
- /**
- * The current representation type.
- */
- protected int representationType = TYPE_ASCII;
-
- /**
- * The current file structure type.
- */
- protected int fileStructure = STRUCTURE_FILE;
-
- /**
- * The current transfer mode.
- */
- protected int transferMode = MODE_STREAM;
-
- /**
- * If true, use passive mode.
- */
- protected boolean passive = false;
-
- /**
- * Creates a new connection to the server using the default port.
- * @param hostname the hostname of the server to connect to
- */
- public FTPConnection(String hostname)
- throws UnknownHostException, IOException
- {
- this(hostname, -1, 0, 0, false);
- }
-
- /**
- * Creates a new connection to the server.
- * @param hostname the hostname of the server to connect to
- * @param port the port to connect to(if <=0, use default port)
- */
- public FTPConnection(String hostname, int port)
- throws UnknownHostException, IOException
- {
- this(hostname, port, 0, 0, false);
- }
-
- /**
- * Creates a new connection to the server.
- * @param hostname the hostname of the server to connect to
- * @param port the port to connect to(if <=0, use default port)
- * @param connectionTimeout the connection timeout, in milliseconds
- * @param timeout the I/O timeout, in milliseconds
- * @param debug print debugging information
- */
- public FTPConnection(String hostname, int port,
- int connectionTimeout, int timeout, boolean debug)
- throws UnknownHostException, IOException
- {
- this.connectionTimeout = connectionTimeout;
- this.timeout = timeout;
- this.debug = debug;
- if (port <= 0)
- {
- port = FTP_PORT;
- }
-
- // Set up socket
- socket = new Socket();
- InetSocketAddress address = new InetSocketAddress(hostname, port);
- if (connectionTimeout > 0)
- {
- socket.connect(address, connectionTimeout);
- }
- else
- {
- socket.connect(address);
- }
- if (timeout > 0)
- {
- socket.setSoTimeout(timeout);
- }
-
- InputStream in = socket.getInputStream();
- in = new BufferedInputStream(in);
- in = new CRLFInputStream(in);
- this.in = new LineInputStream(in);
- OutputStream out = socket.getOutputStream();
- out = new BufferedOutputStream(out);
- this.out = new CRLFOutputStream(out);
-
- // Read greeting
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 220: // hello
- break;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Authenticate using the specified username and password.
- * If the username suffices for the server, the password will not be used
- * and may be null.
- * @param username the username
- * @param password the optional password
- * @return true on success, false otherwise
- */
- public boolean authenticate(String username, String password)
- throws IOException
- {
- String cmd = USER + ' ' + username;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 230: // User logged in
- return true;
- case 331: // User name okay, need password
- break;
- case 332: // Need account for login
- case 530: // No such user
- return false;
- default:
- throw new FTPException(response);
- }
- cmd = PASS + ' ' + password;
- send(cmd);
- response = getResponse();
- switch (response.getCode())
- {
- case 230: // User logged in
- case 202: // Superfluous
- return true;
- case 332: // Need account for login
- case 530: // Bad password
- return false;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Negotiates TLS over the current connection.
- * See IETF draft-murray-auth-ftp-ssl-15.txt for details.
- * @param confidential whether to provide confidentiality for the
- * connection
- */
- public boolean starttls(boolean confidential)
- throws IOException
- {
- return starttls(confidential, new EmptyX509TrustManager());
- }
-
- /**
- * Negotiates TLS over the current connection.
- * See IETF draft-murray-auth-ftp-ssl-15.txt for details.
- * @param confidential whether to provide confidentiality for the
- * connection
- * @param tm the trust manager used to validate the server certificate.
- */
- public boolean starttls(boolean confidential, TrustManager tm)
- throws IOException
- {
- try
- {
- // Use SSLSocketFactory to negotiate a TLS session and wrap the
- // current socket.
- SSLContext context = SSLContext.getInstance("TLS");
- // We don't require strong validation of the server certificate
- TrustManager[] trust = new TrustManager[] { tm };
- context.init(null, trust, null);
- SSLSocketFactory factory = context.getSocketFactory();
-
- send(AUTH + ' ' + TLS);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 500:
- case 502:
- case 504:
- case 534:
- case 431:
- return false;
- case 234:
- break;
- default:
- throw new FTPException(response);
- }
-
- String hostname = socket.getInetAddress().getHostName();
- int port = socket.getPort();
- SSLSocket ss =
- (SSLSocket) factory.createSocket(socket, hostname, port, true);
- String[] protocols = { "TLSv1", "SSLv3" };
- ss.setEnabledProtocols(protocols);
- ss.setUseClientMode(true);
- ss.startHandshake();
-
- // PBSZ:PROT sequence
- send(PBSZ + ' ' + Integer.MAX_VALUE);
- response = getResponse();
- switch (response.getCode())
- {
- case 501: // syntax error
- case 503: // not authenticated
- return false;
- case 200:
- break;
- default:
- throw new FTPException(response);
- }
- send(PROT + ' ' +(confidential ? 'P' : 'C'));
- response = getResponse();
- switch (response.getCode())
- {
- case 503: // not authenticated
- case 504: // invalid level
- case 536: // level not supported
- return false;
- case 200:
- break;
- default:
- throw new FTPException(response);
- }
-
- if (confidential)
- {
- // Set up streams
- InputStream in = ss.getInputStream();
- in = new BufferedInputStream(in);
- in = new CRLFInputStream(in);
- this.in = new LineInputStream(in);
- OutputStream out = ss.getOutputStream();
- out = new BufferedOutputStream(out);
- this.out = new CRLFOutputStream(out);
- }
- return true;
- }
- catch (GeneralSecurityException e)
- {
- return false;
- }
- }
-
- /**
- * Changes directory to the specified path.
- * @param path an absolute or relative pathname
- * @return true on success, false if the specified path does not exist
- */
- public boolean changeWorkingDirectory(String path)
- throws IOException
- {
- String cmd = CWD + ' ' + path;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 250:
- return true;
- case 550:
- return false;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Changes directory to the parent of the current working directory.
- * @return true on success, false otherwise
- */
- public boolean changeToParentDirectory()
- throws IOException
- {
- send(CDUP);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 250:
- return true;
- case 550:
- return false;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Terminates an authenticated login.
- * If file transfer is in progress, it remains active for result response
- * only.
- */
- public void reinitialize()
- throws IOException
- {
- send(REIN);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 220:
- if (dtp != null)
- {
- dtp.complete();
- dtp = null;
- }
- break;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Terminates the control connection.
- * The file transfer connection remains open for result response only.
- * This connection is invalid and no further commands may be issued.
- */
- public void logout()
- throws IOException
- {
- send(QUIT);
- try
- {
- getResponse(); // not required
- }
- catch (IOException e)
- {
- }
- if (dtp != null)
- {
- dtp.complete();
- dtp = null;
- }
- try
- {
- socket.close();
- }
- catch (IOException e)
- {
- }
- }
-
- /**
- * Initialise the data transfer process.
- */
- protected void initialiseDTP()
- throws IOException
- {
- if (dtp != null)
- {
- dtp.complete();
- dtp = null;
- }
-
- InetAddress localhost = socket.getLocalAddress();
- if (passive)
- {
- send(PASV);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 227:
- String message = response.getMessage();
- try
- {
- int start = message.indexOf(',');
- char c = message.charAt(start - 1);
- while (c >= 0x30 && c <= 0x39)
- {
- c = message.charAt((--start) - 1);
- }
- int mid1 = start;
- for (int i = 0; i < 4; i++)
- {
- mid1 = message.indexOf(',', mid1 + 1);
- }
- int mid2 = message.indexOf(',', mid1 + 1);
- if (mid1 == -1 || mid2 < mid1)
- {
- throw new ProtocolException("Malformed 227: " +
- message);
- }
- int end = mid2;
- c = message.charAt(end + 1);
- while (c >= 0x30 && c <= 0x39)
- {
- c = message.charAt((++end) + 1);
- }
-
- String address =
- message.substring(start, mid1).replace(',', '.');
- int port_hi =
- Integer.parseInt(message.substring(mid1 + 1, mid2));
- int port_lo =
- Integer.parseInt(message.substring(mid2 + 1, end + 1));
- int port = (port_hi << 8) | port_lo;
-
- /*System.out.println("Entering passive mode: " + address +
- ":" + port);*/
- dtp = new PassiveModeDTP(address, port, localhost,
- connectionTimeout, timeout);
- break;
- }
- catch (ArrayIndexOutOfBoundsException e)
- {
- throw new ProtocolException(e.getMessage() + ": " +
- message);
- }
- catch (NumberFormatException e)
- {
- throw new ProtocolException(e.getMessage() + ": " +
- message);
- }
- default:
- throw new FTPException(response);
- }
- }
- else
- {
- // Get the local port
- int port = socket.getLocalPort() + 1;
- int tries = 0;
- // Bind the active mode DTP
- while (dtp == null)
- {
- try
- {
- dtp = new ActiveModeDTP(localhost, port,
- connectionTimeout, timeout);
- /*System.out.println("Listening on: " + port);*/
- }
- catch (BindException e)
- {
- port++;
- tries++;
- if (tries > 9)
- {
- throw e;
- }
- }
- }
-
- // Send PORT command
- StringBuffer buf = new StringBuffer(PORT);
- buf.append(' ');
- // Construct the address/port string form
- byte[] address = localhost.getAddress();
- for (int i = 0; i < address.length; i++)
- {
- int a =(int) address[i];
- if (a < 0)
- {
- a += 0x100;
- }
- buf.append(a);
- buf.append(',');
- }
- int port_hi =(port & 0xff00) >> 8;
- int port_lo =(port & 0x00ff);
- buf.append(port_hi);
- buf.append(',');
- buf.append(port_lo);
- send(buf.toString());
- // Get response
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 200: // OK
- break;
- default:
- dtp.abort();
- dtp = null;
- throw new FTPException(response);
- }
- }
- dtp.setTransferMode(transferMode);
- }
-
- /**
- * Set passive mode.
- * @param flag true if we should use passive mode, false otherwise
- */
- public void setPassive(boolean flag)
- throws IOException
- {
- if (passive != flag)
- {
- passive = flag;
- initialiseDTP();
- }
- }
-
- /**
- * Returns the current representation type of the transfer data.
- * @return TYPE_ASCII, TYPE_EBCDIC, or TYPE_BINARY
- */
- public int getRepresentationType()
- {
- return representationType;
- }
-
- /**
- * Sets the desired representation type of the transfer data.
- * @param type TYPE_ASCII, TYPE_EBCDIC, or TYPE_BINARY
- */
- public void setRepresentationType(int type)
- throws IOException
- {
- StringBuffer buf = new StringBuffer(TYPE);
- buf.append(' ');
- switch (type)
- {
- case TYPE_ASCII:
- buf.append('A');
- break;
- case TYPE_EBCDIC:
- buf.append('E');
- break;
- case TYPE_BINARY:
- buf.append('I');
- break;
- default:
- throw new IllegalArgumentException(Integer.toString(type));
- }
- //buf.append(' ');
- //buf.append('N');
- send(buf.toString());
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 200:
- representationType = type;
- break;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns the current file structure type.
- * @return STRUCTURE_FILE, STRUCTURE_RECORD, or STRUCTURE_PAGE
- */
- public int getFileStructure()
- {
- return fileStructure;
- }
-
- /**
- * Sets the desired file structure type.
- * @param structure STRUCTURE_FILE, STRUCTURE_RECORD, or STRUCTURE_PAGE
- */
- public void setFileStructure(int structure)
- throws IOException
- {
- StringBuffer buf = new StringBuffer(STRU);
- buf.append(' ');
- switch (structure)
- {
- case STRUCTURE_FILE:
- buf.append('F');
- break;
- case STRUCTURE_RECORD:
- buf.append('R');
- break;
- case STRUCTURE_PAGE:
- buf.append('P');
- break;
- default:
- throw new IllegalArgumentException(Integer.toString(structure));
- }
- send(buf.toString());
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 200:
- fileStructure = structure;
- break;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns the current transfer mode.
- * @return MODE_STREAM, MODE_BLOCK, or MODE_COMPRESSED
- */
- public int getTransferMode()
- {
- return transferMode;
- }
-
- /**
- * Sets the desired transfer mode.
- * @param mode MODE_STREAM, MODE_BLOCK, or MODE_COMPRESSED
- */
- public void setTransferMode(int mode)
- throws IOException
- {
- StringBuffer buf = new StringBuffer(MODE);
- buf.append(' ');
- switch (mode)
- {
- case MODE_STREAM:
- buf.append('S');
- break;
- case MODE_BLOCK:
- buf.append('B');
- break;
- case MODE_COMPRESSED:
- buf.append('C');
- break;
- default:
- throw new IllegalArgumentException(Integer.toString(mode));
- }
- send(buf.toString());
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 200:
- transferMode = mode;
- if (dtp != null)
- {
- dtp.setTransferMode(mode);
- }
- break;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Retrieves the specified file.
- * @param filename the filename of the file to retrieve
- * @return an InputStream containing the file content
- */
- public InputStream retrieve(String filename)
- throws IOException
- {
- if (dtp == null || transferMode == MODE_STREAM)
- {
- initialiseDTP();
- }
- /*
- int size = -1;
- String cmd = SIZE + ' ' + filename;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 213:
- size = Integer.parseInt(response.getMessage());
- break;
- case 550: // File not found
- default:
- throw new FTPException(response);
- }
- */
- String cmd = RETR + ' ' + filename;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 125: // Data connection already open; transfer starting
- case 150: // File status okay; about to open data connection
- return dtp.getInputStream();
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns a stream for uploading a file.
- * If a file with the same filename already exists on the server, it will
- * be overwritten.
- * @param filename the name of the file to save the content as
- * @return an OutputStream to write the file data to
- */
- public OutputStream store(String filename)
- throws IOException
- {
- if (dtp == null || transferMode == MODE_STREAM)
- {
- initialiseDTP();
- }
- String cmd = STOR + ' ' + filename;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 125: // Data connection already open; transfer starting
- case 150: // File status okay; about to open data connection
- return dtp.getOutputStream();
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns a stream for uploading a file.
- * If a file with the same filename already exists on the server, the
- * content specified will be appended to the existing file.
- * @param filename the name of the file to save the content as
- * @return an OutputStream to write the file data to
- */
- public OutputStream append(String filename)
- throws IOException
- {
- if (dtp == null || transferMode == MODE_STREAM)
- {
- initialiseDTP();
- }
- String cmd = APPE + ' ' + filename;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 125: // Data connection already open; transfer starting
- case 150: // File status okay; about to open data connection
- return dtp.getOutputStream();
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * This command may be required by some servers to reserve sufficient
- * storage to accommodate the new file to be transferred.
- * It should be immediately followed by a store
or
- * append
.
- * @param size the number of bytes of storage to allocate
- */
- public void allocate(long size)
- throws IOException
- {
- String cmd = ALLO + ' ' + size;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 200: // OK
- case 202: // Superfluous
- break;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Renames a file.
- * @param oldName the current name of the file
- * @param newName the new name
- * @return true if successful, false otherwise
- */
- public boolean rename(String oldName, String newName)
- throws IOException
- {
- String cmd = RNFR + ' ' + oldName;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 450: // File unavailable
- case 550: // File not found
- return false;
- case 350: // Pending
- break;
- default:
- throw new FTPException(response);
- }
- cmd = RNTO + ' ' + newName;
- send(cmd);
- response = getResponse();
- switch (response.getCode())
- {
- case 250: // OK
- return true;
- case 450:
- case 550:
- return false;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Aborts the transfer in progress.
- * @return true if a transfer was in progress, false otherwise
- */
- public boolean abort()
- throws IOException
- {
- send(ABOR);
- FTPResponse response = getResponse();
- // Abort client DTP
- if (dtp != null)
- {
- dtp.abort();
- }
- switch (response.getCode())
- {
- case 226: // successful abort
- return false;
- case 426: // interrupted
- response = getResponse();
- if (response.getCode() == 226)
- {
- return true;
- }
- // Otherwise fall through to throw exception
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Causes the file specified to be deleted at the server site.
- * @param filename the file to delete
- */
- public boolean delete(String filename)
- throws IOException
- {
- String cmd = DELE + ' ' + filename;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 250: // OK
- return true;
- case 450: // File unavailable
- case 550: // File not found
- return false;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Causes the directory specified to be deleted.
- * This may be an absolute or relative pathname.
- * @param pathname the directory to delete
- */
- public boolean removeDirectory(String pathname)
- throws IOException
- {
- String cmd = RMD + ' ' + pathname;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 250: // OK
- return true;
- case 550: // File not found
- return false;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Causes the directory specified to be created at the server site.
- * This may be an absolute or relative pathname.
- * @param pathname the directory to create
- */
- public boolean makeDirectory(String pathname)
- throws IOException
- {
- String cmd = MKD + ' ' + pathname;
- send(cmd);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 257: // Directory created
- return true;
- case 550: // File not found
- return false;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns the current working directory.
- */
- public String getWorkingDirectory()
- throws IOException
- {
- send(PWD);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 257:
- String message = response.getMessage();
- if (message.charAt(0) == '"')
- {
- int end = message.indexOf('"', 1);
- if (end == -1)
- {
- throw new ProtocolException(message);
- }
- return message.substring(1, end);
- }
- else
- {
- int end = message.indexOf(' ');
- if (end == -1)
- {
- return message;
- }
- else
- {
- return message.substring(0, end);
- }
- }
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns a listing of information about the specified pathname.
- * If the pathname specifies a directory or other group of files, the
- * server should transfer a list of files in the specified directory.
- * If the pathname specifies a file then the server should send current
- * information on the file. A null argument implies the user's
- * current working or default directory.
- * @param pathname the context pathname, or null
- */
- public InputStream list(String pathname)
- throws IOException
- {
- if (dtp == null || transferMode == MODE_STREAM)
- {
- initialiseDTP();
- }
- if (pathname == null)
- {
- send(LIST);
- }
- else
- {
- String cmd = LIST + ' ' + pathname;
- send(cmd);
- }
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 125: // Data connection already open; transfer starting
- case 150: // File status okay; about to open data connection
- return dtp.getInputStream();
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns a directory listing. The pathname should specify a
- * directory or other system-specific file group descriptor; a null
- * argument implies the user's current working or default directory.
- * @param pathname the directory pathname, or null
- * @return a list of filenames(strings)
- */
- public List nameList(String pathname)
- throws IOException
- {
- if (dtp == null || transferMode == MODE_STREAM)
- {
- initialiseDTP();
- }
- if (pathname == null)
- {
- send(NLST);
- }
- else
- {
- String cmd = NLST + ' ' + pathname;
- send(cmd);
- }
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 125: // Data connection already open; transfer starting
- case 150: // File status okay; about to open data connection
- InputStream in = dtp.getInputStream();
- in = new BufferedInputStream(in);
- in = new CRLFInputStream(in); // TODO ensure that TYPE is correct
- LineInputStream li = new LineInputStream(in);
- List ret = new ArrayList();
- for (String line = li.readLine();
- line != null;
- line = li.readLine())
- {
- ret.add(line);
- }
- li.close();
- return ret;
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Returns the type of operating system at the server.
- */
- public String system()
- throws IOException
- {
- send(SYST);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 215:
- String message = response.getMessage();
- int end = message.indexOf(' ');
- if (end == -1)
- {
- return message;
- }
- else
- {
- return message.substring(0, end);
- }
- default:
- throw new FTPException(response);
- }
- }
-
- /**
- * Does nothing.
- * This method can be used to ensure that the connection does not time
- * out.
- */
- public void noop()
- throws IOException
- {
- send(NOOP);
- FTPResponse response = getResponse();
- switch (response.getCode())
- {
- case 200:
- break;
- default:
- throw new FTPException(response);
- }
- }
-
- // -- I/O --
-
- /**
- * Sends the specified command line to the server.
- * The CRLF sequence is automatically appended.
- * @param cmd the command line to send
- */
- protected void send(String cmd)
- throws IOException
- {
- byte[] data = cmd.getBytes(US_ASCII);
- out.write(data);
- out.writeln();
- out.flush();
- }
-
- /**
- * Reads the next response from the server.
- * If the server sends the "transfer complete" code, this is handled here,
- * and the next response is passed to the caller.
- */
- protected FTPResponse getResponse()
- throws IOException
- {
- FTPResponse response = readResponse();
- if (response.getCode() == 226)
- {
- if (dtp != null)
- {
- dtp.transferComplete();
- }
- response = readResponse();
- }
- return response;
- }
-
- /**
- * Reads and parses the next response from the server.
- */
- protected FTPResponse readResponse()
- throws IOException
- {
- String line = in.readLine();
- if (line == null)
- {
- throw new ProtocolException( "EOF");
- }
- if (line.length() < 4)
- {
- throw new ProtocolException(line);
- }
- int code = parseCode(line);
- if (code == -1)
- {
- throw new ProtocolException(line);
- }
- char c = line.charAt(3);
- if (c == ' ')
- {
- return new FTPResponse(code, line.substring(4));
- }
- else if (c == '-')
- {
- StringBuffer buf = new StringBuffer(line.substring(4));
- buf.append('\n');
- while(true)
- {
- line = in.readLine();
- if (line == null)
- {
- throw new ProtocolException("EOF");
- }
- if (line.length() >= 4 &&
- line.charAt(3) == ' ' &&
- parseCode(line) == code)
- {
- return new FTPResponse(code, line.substring(4),
- buf.toString());
- }
- else
- {
- buf.append(line);
- buf.append('\n');
- }
- }
- }
- else
- {
- throw new ProtocolException(line);
- }
- }
-
- /*
- * Parses the 3-digit numeric code at the beginning of the given line.
- * Returns -1 on failure.
- */
- static final int parseCode(String line)
- {
- char[] c = { line.charAt(0), line.charAt(1), line.charAt(2) };
- int ret = 0;
- for (int i = 0; i < 3; i++)
- {
- int digit =((int) c[i]) - 0x30;
- if (digit < 0 || digit > 9)
- {
- return -1;
- }
- // Computing integer powers is way too expensive in Java!
- switch (i)
- {
- case 0:
- ret +=(100 * digit);
- break;
- case 1:
- ret +=(10 * digit);
- break;
- case 2:
- ret += digit;
- break;
- }
- }
- return ret;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/ftp/FTPException.java b/libjava/gnu/java/net/protocol/ftp/FTPException.java
deleted file mode 100644
index 14ad3813f85..00000000000
--- a/libjava/gnu/java/net/protocol/ftp/FTPException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* FTPException.java --
- Copyright (C) 2003. 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.ftp;
-
-import java.io.IOException;
-
-/**
- * An FTP control exception.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class FTPException
- extends IOException
-{
-
- /**
- * The response that provoked this exception.
- */
- protected final FTPResponse response;
-
- /**
- * Constructs a new FTP exception.
- * @param response the response that provoked this exception
- */
- public FTPException(FTPResponse response)
- {
- super(response.getMessage());
- this.response = response;
- }
-
- /**
- * Returns the response that provoked this exception.
- */
- public FTPResponse getResponse()
- {
- return response;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/ftp/FTPResponse.java b/libjava/gnu/java/net/protocol/ftp/FTPResponse.java
deleted file mode 100644
index ec72c732c1c..00000000000
--- a/libjava/gnu/java/net/protocol/ftp/FTPResponse.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/* FTPResponse.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.ftp;
-
-/**
- * An FTP control response.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public final class FTPResponse
-{
-
- /**
- * The 3-digit status code.
- */
- protected final int code;
-
- /**
- * The human-readable message.
- */
- protected final String message;
-
- /**
- * Multiline data, if present.
- */
- protected final String data;
-
- /**
- * Constructs a new FTP response.
- * @param code the status code
- * @param message the message
- */
- public FTPResponse(int code, String message)
- {
- this(code, message, null);
- }
-
- /**
- * Constructs a new multiline FTP response.
- * @param code the status code
- * @param message the message
- * @param data multiline data
- */
- public FTPResponse(int code, String message, String data)
- {
- this.code = code;
- this.message = message;
- this.data = data;
- }
-
- /**
- * Returns the 3-digit status code.
- */
- public int getCode()
- {
- return code;
- }
-
- /**
- * Returns the human-readable message.
- */
- public String getMessage()
- {
- return message;
- }
-
- /**
- * Returns the multiline data, or null if there was no such data.
- */
- public String getData()
- {
- return data;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/ftp/FTPURLConnection.java b/libjava/gnu/java/net/protocol/ftp/FTPURLConnection.java
deleted file mode 100644
index 62c40f19e04..00000000000
--- a/libjava/gnu/java/net/protocol/ftp/FTPURLConnection.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/* FTPURLConnection.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.ftp;
-
-import gnu.java.net.GetLocalHostAction;
-import gnu.java.security.action.GetPropertyAction;
-
-import java.io.FileNotFoundException;
-import java.io.FilterInputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * An FTP URL connection.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class FTPURLConnection
- extends URLConnection
-{
-
- /**
- * The connection managing the protocol exchange.
- */
- protected FTPConnection connection;
-
- protected boolean passive;
- protected int representationType;
- protected int fileStructure;
- protected int transferMode;
-
- /**
- * Constructs an FTP connection to the specified URL.
- * @param url the URL
- */
- public FTPURLConnection(URL url)
- {
- super(url);
- passive = true;
- representationType = FTPConnection.TYPE_BINARY;
- fileStructure = -1;
- transferMode = -1;
- }
-
- /**
- * Establishes the connection.
- */
- public void connect()
- throws IOException
- {
- if (connected)
- {
- return;
- }
- String host = url.getHost();
- int port = url.getPort();
- String username = url.getUserInfo();
- String password = null;
- if (username != null)
- {
- int ci = username.indexOf(':');
- if (ci != -1)
- {
- password = username.substring(ci + 1);
- username = username.substring(0, ci);
- }
- }
- else
- {
- username = "anonymous";
- PrivilegedAction a = new GetPropertyAction("user.name");
- String systemUsername =(String) AccessController.doPrivileged(a);
- a = new GetLocalHostAction();
- InetAddress localhost =(InetAddress) AccessController.doPrivileged(a);
- password = systemUsername + "@" +
- ((localhost == null) ? "localhost" : localhost.getHostName());
- }
- connection = new FTPConnection(host, port);
- if (!connection.authenticate(username, password))
- {
- throw new SecurityException("Authentication failed");
- }
- connection.setPassive(passive);
- if (representationType != -1)
- {
- connection.setRepresentationType(representationType);
- }
- if (fileStructure != -1)
- {
- connection.setFileStructure(fileStructure);
- }
- if (transferMode != -1)
- {
- connection.setTransferMode(transferMode);
- }
- }
-
- /**
- * This connection supports doInput.
- */
- public void setDoInput(boolean doinput)
- {
- doInput = doinput;
- }
-
- /**
- * This connection supports doOutput.
- */
- public void setDoOutput(boolean dooutput)
- {
- doOutput = dooutput;
- }
-
- /**
- * Returns an input stream that reads from this open connection.
- */
- public InputStream getInputStream()
- throws IOException
- {
- if (!connected)
- {
- connect();
- }
- String path = url.getPath();
- String filename = null;
- int lsi = path.lastIndexOf('/');
- if (lsi != -1)
- {
- filename = path.substring(lsi + 1);
- path = path.substring(0, lsi);
- if (!connection.changeWorkingDirectory(path))
- {
- throw new FileNotFoundException(path);
- }
- }
- if (filename != null && filename.length() > 0)
- {
- return this.new ClosingInputStream(connection.retrieve(filename));
- }
- else
- {
- return this.new ClosingInputStream(connection.list(null));
- }
- }
-
- /**
- * Returns an output stream that writes to this connection.
- */
- public OutputStream getOutputStream()
- throws IOException
- {
- if (!connected)
- {
- connect();
- }
- String dir = url.getPath();
- String filename = url.getFile();
- if (!connection.changeWorkingDirectory(dir))
- {
- throw new FileNotFoundException(dir);
- }
- if (filename != null)
- {
- return this.new ClosingOutputStream(connection.store(filename));
- }
- else
- {
- throw new FileNotFoundException(filename);
- }
- }
-
- public String getRequestProperty(String key)
- {
- if ("passive".equals(key))
- {
- return Boolean.toString(passive);
- }
- else if ("representationType".equals(key))
- {
- switch (representationType)
- {
- case FTPConnection.TYPE_ASCII:
- return "ASCII";
- case FTPConnection.TYPE_EBCDIC:
- return "EBCDIC";
- case FTPConnection.TYPE_BINARY:
- return "BINARY";
- }
- }
- else if ("fileStructure".equals(key))
- {
- switch (fileStructure)
- {
- case FTPConnection.STRUCTURE_FILE:
- return "FILE";
- case FTPConnection.STRUCTURE_RECORD:
- return "RECORD";
- case FTPConnection.STRUCTURE_PAGE:
- return "PAGE";
- }
- }
- else if ("transferMode".equals(key))
- {
- switch (transferMode)
- {
- case FTPConnection.MODE_STREAM:
- return "STREAM";
- case FTPConnection.MODE_BLOCK:
- return "BLOCK";
- case FTPConnection.MODE_COMPRESSED:
- return "COMPRESSED";
- }
- }
- return null;
- }
-
- public Map getRequestProperties()
- {
- Map map = new HashMap();
- addRequestPropertyValue(map, "passive");
- addRequestPropertyValue(map, "representationType");
- addRequestPropertyValue(map, "fileStructure");
- addRequestPropertyValue(map, "transferMode");
- return map;
- }
-
- private void addRequestPropertyValue(Map map, String key)
- {
- String value = getRequestProperty(key);
- map.put(key, value);
- }
-
- public void setRequestProperty(String key, String value)
- {
- if (connected)
- {
- throw new IllegalStateException();
- }
- if ("passive".equals(key))
- {
- passive = Boolean.valueOf(value).booleanValue();
- }
- else if ("representationType".equals(key))
- {
- if ("A".equalsIgnoreCase(value) ||
- "ASCII".equalsIgnoreCase(value))
- {
- representationType = FTPConnection.TYPE_ASCII;
- }
- else if ("E".equalsIgnoreCase(value) ||
- "EBCDIC".equalsIgnoreCase(value))
- {
- representationType = FTPConnection.TYPE_EBCDIC;
- }
- else if ("I".equalsIgnoreCase(value) ||
- "BINARY".equalsIgnoreCase(value))
- {
- representationType = FTPConnection.TYPE_BINARY;
- }
- else
- {
- throw new IllegalArgumentException(value);
- }
- }
- else if ("fileStructure".equals(key))
- {
- if ("F".equalsIgnoreCase(value) ||
- "FILE".equalsIgnoreCase(value))
- {
- fileStructure = FTPConnection.STRUCTURE_FILE;
- }
- else if ("R".equalsIgnoreCase(value) ||
- "RECORD".equalsIgnoreCase(value))
- {
- fileStructure = FTPConnection.STRUCTURE_RECORD;
- }
- else if ("P".equalsIgnoreCase(value) ||
- "PAGE".equalsIgnoreCase(value))
- {
- fileStructure = FTPConnection.STRUCTURE_PAGE;
- }
- else
- {
- throw new IllegalArgumentException(value);
- }
- }
- else if ("transferMode".equals(key))
- {
- if ("S".equalsIgnoreCase(value) ||
- "STREAM".equalsIgnoreCase(value))
- {
- transferMode = FTPConnection.MODE_STREAM;
- }
- else if ("B".equalsIgnoreCase(value) ||
- "BLOCK".equalsIgnoreCase(value))
- {
- transferMode = FTPConnection.MODE_BLOCK;
- }
- else if ("C".equalsIgnoreCase(value) ||
- "COMPRESSED".equalsIgnoreCase(value))
- {
- transferMode = FTPConnection.MODE_COMPRESSED;
- }
- else
- {
- throw new IllegalArgumentException(value);
- }
- }
- }
-
- public void addRequestProperty(String key, String value)
- {
- setRequestProperty(key, value);
- }
-
- class ClosingInputStream
- extends FilterInputStream
- {
-
- ClosingInputStream(InputStream in)
- {
- super(in);
- }
-
- public void close()
- throws IOException
- {
- super.close();
- connection.logout();
- }
-
- }
-
- class ClosingOutputStream
- extends FilterOutputStream
- {
-
- ClosingOutputStream(OutputStream out)
- {
- super(out);
- }
-
- public void close()
- throws IOException
- {
- super.close();
- connection.logout();
- }
-
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/ftp/Handler.java b/libjava/gnu/java/net/protocol/ftp/Handler.java
deleted file mode 100644
index 88491b3c15a..00000000000
--- a/libjava/gnu/java/net/protocol/ftp/Handler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Handler.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.ftp;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * An FTP URL stream handler.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Handler
- extends URLStreamHandler
-{
-
- protected int getDefaultPort()
- {
- return FTPConnection.FTP_PORT;
- }
-
- /**
- * Returns an FTPURLConnection for the given URL.
- */
- public URLConnection openConnection(URL url)
- throws IOException
- {
- return new FTPURLConnection(url);
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/ftp/PassiveModeDTP.java b/libjava/gnu/java/net/protocol/ftp/PassiveModeDTP.java
deleted file mode 100644
index 6f4fd634168..00000000000
--- a/libjava/gnu/java/net/protocol/ftp/PassiveModeDTP.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/* PassiveModeDTP.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.ftp;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-
-/**
- * A passive mode FTP data transfer process.
- * This connects to the host specified and proxies the resulting socket's
- * input and output streams.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-final class PassiveModeDTP
- implements DTP
-{
-
- final String address;
- final int port;
- Socket socket;
- DTPInputStream in;
- DTPOutputStream out;
- boolean completed;
- boolean inProgress;
- int transferMode;
-
- PassiveModeDTP(String address, int port, InetAddress localhost,
- int connectionTimeout, int timeout)
- throws IOException
- {
- this.address = address;
- this.port = port;
- completed = false;
- inProgress = false;
- socket = new Socket();
- InetSocketAddress remote = new InetSocketAddress(address, port);
- InetSocketAddress local = new InetSocketAddress(localhost, port + 1);
- socket.bind(local);
- if (connectionTimeout > 0)
- {
- socket.connect(remote, connectionTimeout);
- }
- else
- {
- socket.connect(remote);
- }
- if (timeout > 0)
- {
- socket.setSoTimeout(timeout);
- }
- }
-
- /**
- * Returns an input stream from which a remote file can be read.
- */
- public InputStream getInputStream()
- throws IOException
- {
- if (inProgress)
- {
- throw new IOException("Transfer in progress");
- }
- switch (transferMode)
- {
- case FTPConnection.MODE_STREAM:
- in = new StreamInputStream(this, socket.getInputStream());
- break;
- case FTPConnection.MODE_BLOCK:
- in = new BlockInputStream(this, socket.getInputStream());
- break;
- case FTPConnection.MODE_COMPRESSED:
- in = new CompressedInputStream(this, socket.getInputStream());
- break;
- default:
- throw new IllegalStateException("Invalid transfer mode");
- }
- in.setTransferComplete(false);
- return in;
- }
-
- /**
- * Returns an output stream to which a local file can be written for
- * upload.
- */
- public OutputStream getOutputStream()
- throws IOException
- {
- if (inProgress)
- {
- throw new IOException("Transfer in progress");
- }
- switch (transferMode)
- {
- case FTPConnection.MODE_STREAM:
- out = new StreamOutputStream(this, socket.getOutputStream());
- break;
- case FTPConnection.MODE_BLOCK:
- out = new BlockOutputStream(this, socket.getOutputStream());
- break;
- case FTPConnection.MODE_COMPRESSED:
- out = new CompressedOutputStream(this, socket.getOutputStream());
- break;
- default:
- throw new IllegalStateException("Invalid transfer mode");
- }
- out.setTransferComplete(false);
- return out;
- }
-
- public void setTransferMode(int mode)
- {
- transferMode = mode;
- }
-
- public void complete()
- {
- completed = true;
- if (!inProgress)
- {
- transferComplete();
- }
- }
-
- public boolean abort()
- {
- completed = true;
- transferComplete();
- return inProgress;
- }
-
- /*
- * Called by DTPInputStream or DTPOutputStream when end of
- * stream is reached.
- */
- public void transferComplete()
- {
- if (in != null)
- {
- in.setTransferComplete(true);
- }
- if (out != null)
- {
- out.setTransferComplete(true);
- }
- inProgress = false;
- completed = completed ||(transferMode == FTPConnection.MODE_STREAM);
- if (completed && socket != null)
- {
- try
- {
- socket.close();
- }
- catch (IOException e)
- {
- }
- }
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/ftp/StreamInputStream.java b/libjava/gnu/java/net/protocol/ftp/StreamInputStream.java
deleted file mode 100644
index 93eee4e1924..00000000000
--- a/libjava/gnu/java/net/protocol/ftp/StreamInputStream.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* StreamInputStream.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.ftp;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * A DTP input stream that implements the FTP stream data transfer mode.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-class StreamInputStream
- extends DTPInputStream
-{
-
- StreamInputStream(DTP dtp, InputStream in)
- {
- super(dtp, in);
- }
-
- public int read()
- throws IOException
- {
- if (transferComplete)
- {
- return -1;
- }
- int c = in.read();
- if (c == -1)
- {
- close();
- }
- return c;
- }
-
- public int read(byte[] buf)
- throws IOException
- {
- return read(buf, 0, buf.length);
- }
-
- public int read(byte[] buf, int off, int len)
- throws IOException
- {
- if (transferComplete)
- {
- return -1;
- }
- int l = in.read(buf, off, len);
- if (l == -1)
- {
- close();
- }
- return l;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/ftp/StreamOutputStream.java b/libjava/gnu/java/net/protocol/ftp/StreamOutputStream.java
deleted file mode 100644
index a6e28ece3d4..00000000000
--- a/libjava/gnu/java/net/protocol/ftp/StreamOutputStream.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* StreamOutputStream.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.ftp;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * A DTP output stream that implements the FTP stream transfer mode.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-class StreamOutputStream
- extends DTPOutputStream
-{
-
- StreamOutputStream(DTP dtp, OutputStream out)
- {
- super(dtp, out);
- }
-
- public void write(int c)
- throws IOException
- {
- if (transferComplete)
- {
- return;
- }
- out.write(c);
- }
-
- public void write(byte[] b)
- throws IOException
- {
- write(b, 0, b.length);
- }
-
- public void write(byte[] b, int off, int len)
- throws IOException
- {
- if (transferComplete)
- {
- return;
- }
- out.write(b, off, len);
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/Authenticator.java b/libjava/gnu/java/net/protocol/http/Authenticator.java
deleted file mode 100644
index 0d7c9881956..00000000000
--- a/libjava/gnu/java/net/protocol/http/Authenticator.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Authenticator.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Callback interface for managing authentication.
- * @see Request#setAuthenticator
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface Authenticator
-{
-
- /**
- * Returns the credentials to supply for the given realm.
- * @param realm the authentication realm
- * @param attempt zero on first authentication attempt, increments on each
- * unsuccessful attempt
- */
- Credentials getCredentials(String realm, int attempt);
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java b/libjava/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
deleted file mode 100644
index 35ad2bccf45..00000000000
--- a/libjava/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ByteArrayRequestBodyWriter.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * A simple request body writer using a byte array.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class ByteArrayRequestBodyWriter
- implements RequestBodyWriter
-{
-
- /**
- * The content.
- */
- protected byte[] content;
-
- /**
- * The position within the content at which the next read will occur.
- */
- protected int pos;
-
- /**
- * Constructs a new byte array request body writer with the specified
- * content.
- * @param content the content buffer
- */
- public ByteArrayRequestBodyWriter(byte[] content)
- {
- this.content = content;
- pos = 0;
- }
-
- /**
- * Returns the total number of bytes that will be written in a single pass
- * by this writer.
- */
- public int getContentLength()
- {
- return content.length;
- }
-
- /**
- * Initialises the writer.
- * This will be called before each pass.
- */
- public void reset()
- {
- pos = 0;
- }
-
- /**
- * Writes body content to the supplied buffer.
- * @param buffer the content buffer
- * @return the number of bytes written
- */
- public int write(byte[] buffer)
- {
- int len = content.length - pos;
- len = (buffer.length < len) ? buffer.length : len;
- if (len > -1)
- {
- System.arraycopy(content, pos, buffer, 0, len);
- pos += len;
- }
- return len;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java b/libjava/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java
deleted file mode 100644
index 680e45d3e49..00000000000
--- a/libjava/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Authenticator.java --ByteArrayResponseBodyReader.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Simple response body reader that stores content in a byte array.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class ByteArrayResponseBodyReader
- implements ResponseBodyReader
-{
-
- /**
- * The content.
- */
- protected byte[] content;
-
- /**
- * The position in the content at which the next write will occur.
- */
- protected int pos;
-
- /**
- * The length of the buffer.
- */
- protected int len;
-
- /**
- * Constructs a new byte array response body reader.
- */
- public ByteArrayResponseBodyReader()
- {
- this(4096);
- }
-
- /**
- * Constructs a new byte array response body reader with the specified
- * initial buffer size.
- * @param size the initial buffer size
- */
- public ByteArrayResponseBodyReader(int size)
- {
- content = new byte[size];
- pos = len = 0;
- }
-
- /**
- * This reader accepts all responses.
- */
- public boolean accept(Request request, Response response)
- {
- return true;
- }
-
- public void read(byte[] buffer, int offset, int length)
- {
- int l = length - offset;
- if (pos + l > content.length)
- {
- byte[] tmp = new byte[content.length * 2];
- System.arraycopy(content, 0, tmp, 0, pos);
- content = tmp;
- }
- System.arraycopy(buffer, offset, content, pos, l);
- pos += l;
- len = pos;
- }
-
- public void close()
- {
- pos = 0;
- }
-
- /**
- * Retrieves the content of this reader as a byte array.
- * The size of the returned array is the number of bytes read.
- */
- public byte[] toByteArray()
- {
- byte[] ret = new byte[len];
- System.arraycopy(content, 0, ret, 0, len);
- return ret;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/ChunkedInputStream.java b/libjava/gnu/java/net/protocol/http/ChunkedInputStream.java
deleted file mode 100644
index c0706b70840..00000000000
--- a/libjava/gnu/java/net/protocol/http/ChunkedInputStream.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/* ChunkedInputStream.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.ProtocolException;
-
-/**
- * Input stream wrapper for the "chunked" transfer-coding.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class ChunkedInputStream
- extends FilterInputStream
-{
-
- private static final byte CR = 0x0d;
- private static final byte LF = 0x0a;
-
- int size;
- int count;
- boolean meta;
- boolean eof;
- Headers headers;
-
- /**
- * Constructor.
- * @param in the response socket input stream
- * @param headers the headers to receive additional header lines
- */
- public ChunkedInputStream(InputStream in, Headers headers)
- {
- super(in);
- this.headers = headers;
- size = -1;
- count = 0;
- meta = true;
- }
-
- public int read()
- throws IOException
- {
- byte[] buf = new byte[1];
- int len = read(buf, 0, 1);
- if (len == -1)
- {
- return -1;
- }
- int ret = (int) buf[0];
- if (ret < 0)
- {
- ret += 0x100;
- }
- return ret;
- }
-
- public int read(byte[] buffer)
- throws IOException
- {
- return read(buffer, 0, buffer.length);
- }
-
- public int read(byte[] buffer, int offset, int length)
- throws IOException
- {
- if (eof)
- {
- return -1;
- }
- if (meta)
- {
- // Read chunk header
- int c, last = 0;
- boolean seenSemi = false;
- StringBuffer buf = new StringBuffer();
- do
- {
- c = in.read();
- if (c == 0x3b) // ;
- {
- seenSemi = true;
- }
- else if (c == 0x0a && last == 0x0d) // CRLF
- {
- size = Integer.parseInt(buf.toString(), 16);
- break;
- }
- else if (!seenSemi && c >= 0x30)
- {
- buf.append ((char) c);
- }
- last = c;
- }
- while(c != -1);
- count = 0;
- meta = false;
- }
- if (size == 0)
- {
- // Read trailer
- headers.parse(in);
- eof = true;
- return -1;
- }
- else
- {
- int diff = length - offset;
- int max = size - count;
- max = (diff < max) ? diff : max;
- int len = (max > 0) ? in.read(buffer, offset, max) : 0;
- count += len;
- if (count == size)
- {
- // Read CRLF
- int c1 = in.read();
- int c2 = in.read();
- if (c1 == -1 && c2 == -1)
- {
- // EOF before CRLF: bad, but ignore
- eof = true;
- return -1;
- }
- if (c1 != 0x0d || c2 != 0x0a)
- {
- throw new ProtocolException("expecting CRLF: " + c1 + "," + c2);
- }
- meta = true;
- }
- return len;
- }
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/Cookie.java b/libjava/gnu/java/net/protocol/http/Cookie.java
deleted file mode 100644
index 45e2f733ff3..00000000000
--- a/libjava/gnu/java/net/protocol/http/Cookie.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Cookie.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import java.util.Date;
-
-/**
- * An HTTP cookie, as specified in RFC 2109.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Cookie
-{
-
- /**
- * The name of the cookie.
- */
- protected final String name;
-
- /**
- * The value of the cookie.
- */
- protected final String value;
-
- /**
- * Optional documentation of the intended use of the cookie.
- */
- protected final String comment;
-
- /**
- * The domain for which the cookie is valid.
- */
- protected final String domain;
-
- /**
- * Optional subset of URL paths within the domain for which the cookie is
- * valid.
- */
- protected final String path;
-
- /**
- * Indicates that the user-agent should only use secure means to transmit
- * this cookie to the server.
- */
- protected final boolean secure;
-
- /**
- * The date at which this cookie expires.
- */
- protected final Date expires;
-
- public Cookie(String name, String value, String comment, String domain,
- String path, boolean secure, Date expires)
- {
- this.name = name;
- this.value = value;
- this.comment = comment;
- this.domain = domain;
- this.path = path;
- this.secure = secure;
- this.expires = expires;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public String getComment()
- {
- return comment;
- }
-
- public String getDomain()
- {
- return domain;
- }
-
- public String getPath()
- {
- return path;
- }
-
- public boolean isSecure()
- {
- return secure;
- }
-
- public Date getExpiryDate()
- {
- return expires;
- }
-
- public String toString()
- {
- return toString(true, true);
- }
-
- public String toString(boolean showPath, boolean showDomain)
- {
- StringBuffer buf = new StringBuffer();
- buf.append(name);
- buf.append('=');
- buf.append(value);
- if (showPath)
- {
- buf.append("; $Path=");
- buf.append(path);
- }
- if (showDomain)
- {
- buf.append("; $Domain=");
- buf.append(domain);
- }
- return buf.toString();
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/CookieManager.java b/libjava/gnu/java/net/protocol/http/CookieManager.java
deleted file mode 100644
index cc1225c497d..00000000000
--- a/libjava/gnu/java/net/protocol/http/CookieManager.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* CookieManager.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Cookie manager interface.
- * If an application wants to handle cookies, they should implement this
- * interface and register the instance with each HTTPConnection they use.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface CookieManager
-{
-
- /**
- * Stores a cookie in the cookie manager.
- * @param cookie the cookie to store
- */
- void setCookie(Cookie cookie);
-
- /**
- * Retrieves the cookies matching the specified criteria.
- * @param host the host name
- * @param secure whether the connection is secure
- * @param path the path to access
- */
- Cookie[] getCookies(String host, boolean secure, String path);
-
-}
diff --git a/libjava/gnu/java/net/protocol/http/Credentials.java b/libjava/gnu/java/net/protocol/http/Credentials.java
deleted file mode 100644
index 9e5fcd172f5..00000000000
--- a/libjava/gnu/java/net/protocol/http/Credentials.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Credentials.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Represents a username/password combination that can be used to
- * authenticate to an HTTP server.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Credentials
-{
-
- /**
- * The username.
- */
- private String username;
-
- /**
- * The password.
- */
- private String password;
-
- /**
- * Constructor.
- * @param username the username
- * @param password the password
- */
- public Credentials(String username, String password)
- {
- this.username = username;
- this.password = password;
- }
-
- /**
- * Returns the username.
- */
- public String getUsername()
- {
- return username;
- }
-
- /**
- * Returns the password.
- */
- public String getPassword()
- {
- return password;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/HTTPConnection.java b/libjava/gnu/java/net/protocol/http/HTTPConnection.java
deleted file mode 100644
index 221733dba05..00000000000
--- a/libjava/gnu/java/net/protocol/http/HTTPConnection.java
+++ /dev/null
@@ -1,681 +0,0 @@
-/* HTTPConnection.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import gnu.classpath.Configuration;
-import gnu.classpath.SystemProperties;
-import gnu.java.net.EmptyX509TrustManager;
-import gnu.java.net.protocol.http.event.ConnectionEvent;
-import gnu.java.net.protocol.http.event.ConnectionListener;
-import gnu.java.net.protocol.http.event.RequestEvent;
-import gnu.java.net.protocol.http.event.RequestListener;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.net.ssl.HandshakeCompletedListener;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-
-/**
- * A connection to an HTTP server.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class HTTPConnection
-{
-
- /**
- * The default HTTP port.
- */
- public static final int HTTP_PORT = 80;
-
- /**
- * The default HTTPS port.
- */
- public static final int HTTPS_PORT = 443;
-
- private static final String userAgent = SystemProperties.getProperty("http.agent");
-
- /**
- * The host name of the server to connect to.
- */
- protected final String hostname;
-
- /**
- * The port to connect to.
- */
- protected final int port;
-
- /**
- * Whether the connection should use transport level security (HTTPS).
- */
- protected final boolean secure;
-
- /**
- * The connection timeout for connecting the underlying socket.
- */
- protected final int connectionTimeout;
-
- /**
- * The read timeout for reads on the underlying socket.
- */
- protected final int timeout;
-
- /**
- * The host name of the proxy to connect to.
- */
- protected String proxyHostname;
-
- /**
- * The port on the proxy to connect to.
- */
- protected int proxyPort;
-
- /**
- * The major version of HTTP supported by this client.
- */
- protected int majorVersion;
-
- /**
- * The minor version of HTTP supported by this client.
- */
- protected int minorVersion;
-
- private final List connectionListeners;
- private final List requestListeners;
- private final List handshakeCompletedListeners;
-
- /**
- * The socket this connection communicates on.
- */
- protected Socket socket;
-
- /**
- * The SSL socket factory to use.
- */
- private SSLSocketFactory sslSocketFactory;
-
- /**
- * The socket input stream.
- */
- protected InputStream in;
-
- /**
- * The socket output stream.
- */
- protected OutputStream out;
-
- /**
- * Nonce values seen by this connection.
- */
- private Map nonceCounts;
-
- /**
- * The cookie manager for this connection.
- */
- protected CookieManager cookieManager;
-
- /**
- * Creates a new HTTP connection.
- * @param hostname the name of the host to connect to
- */
- public HTTPConnection(String hostname)
- {
- this(hostname, HTTP_PORT, false, 0, 0);
- }
-
- /**
- * Creates a new HTTP or HTTPS connection.
- * @param hostname the name of the host to connect to
- * @param secure whether to use a secure connection
- */
- public HTTPConnection(String hostname, boolean secure)
- {
- this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure, 0, 0);
- }
-
- /**
- * Creates a new HTTP or HTTPS connection on the specified port.
- * @param hostname the name of the host to connect to
- * @param secure whether to use a secure connection
- * @param connectionTimeout the connection timeout
- * @param timeout the socket read timeout
- */
- public HTTPConnection(String hostname, boolean secure,
- int connectionTimeout, int timeout)
- {
- this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure,
- connectionTimeout, timeout);
- }
-
- /**
- * Creates a new HTTP connection on the specified port.
- * @param hostname the name of the host to connect to
- * @param port the port on the host to connect to
- */
- public HTTPConnection(String hostname, int port)
- {
- this(hostname, port, false, 0, 0);
- }
-
- /**
- * Creates a new HTTP or HTTPS connection on the specified port.
- * @param hostname the name of the host to connect to
- * @param port the port on the host to connect to
- * @param secure whether to use a secure connection
- */
- public HTTPConnection(String hostname, int port, boolean secure)
- {
- this(hostname, port, secure, 0, 0);
- }
-
- /**
- * Creates a new HTTP or HTTPS connection on the specified port.
- * @param hostname the name of the host to connect to
- * @param port the port on the host to connect to
- * @param secure whether to use a secure connection
- * @param connectionTimeout the connection timeout
- * @param timeout the socket read timeout
- */
- public HTTPConnection(String hostname, int port, boolean secure,
- int connectionTimeout, int timeout)
- {
- this.hostname = hostname;
- this.port = port;
- this.secure = secure;
- this.connectionTimeout = connectionTimeout;
- this.timeout = timeout;
- majorVersion = minorVersion = 1;
- connectionListeners = new ArrayList(4);
- requestListeners = new ArrayList(4);
- handshakeCompletedListeners = new ArrayList(2);
- }
-
- /**
- * Returns the name of the host to connect to.
- */
- public String getHostName()
- {
- return hostname;
- }
-
- /**
- * Returns the port on the host to connect to.
- */
- public int getPort()
- {
- return port;
- }
-
- /**
- * Indicates whether to use a secure connection or not.
- */
- public boolean isSecure()
- {
- return secure;
- }
-
- /**
- * Returns the HTTP version string supported by this connection.
- * @see #version
- */
- public String getVersion()
- {
- return "HTTP/" + majorVersion + '.' + minorVersion;
- }
-
- /**
- * Sets the HTTP version supported by this connection.
- * @param majorVersion the major version
- * @param minorVersion the minor version
- */
- public void setVersion(int majorVersion, int minorVersion)
- {
- if (majorVersion != 1)
- {
- throw new IllegalArgumentException("major version not supported: " +
- majorVersion);
- }
- if (minorVersion < 0 || minorVersion > 1)
- {
- throw new IllegalArgumentException("minor version not supported: " +
- minorVersion);
- }
- this.majorVersion = majorVersion;
- this.minorVersion = minorVersion;
- }
-
- /**
- * Directs this connection to use the specified proxy.
- * @param hostname the proxy host name
- * @param port the port on the proxy to connect to
- */
- public void setProxy(String hostname, int port)
- {
- proxyHostname = hostname;
- proxyPort = port;
- }
-
- /**
- * Indicates whether this connection is using an HTTP proxy.
- */
- public boolean isUsingProxy()
- {
- return (proxyHostname != null && proxyPort > 0);
- }
-
- /**
- * Sets the cookie manager to use for this connection.
- * @param cookieManager the cookie manager
- */
- public void setCookieManager(CookieManager cookieManager)
- {
- this.cookieManager = cookieManager;
- }
-
- /**
- * Returns the cookie manager in use for this connection.
- */
- public CookieManager getCookieManager()
- {
- return cookieManager;
- }
-
- /**
- * Creates a new request using this connection.
- * @param method the HTTP method to invoke
- * @param path the URI-escaped RFC2396 abs_path
with
- * optional query part
- */
- public Request newRequest(String method, String path)
- {
- if (method == null || method.length() == 0)
- {
- throw new IllegalArgumentException("method must have non-zero length");
- }
- if (path == null || path.length() == 0)
- {
- path = "/";
- }
- Request ret = new Request(this, method, path);
- if ((secure && port != HTTPS_PORT) ||
- (!secure && port != HTTP_PORT))
- {
- ret.setHeader("Host", hostname + ":" + port);
- }
- else
- {
- ret.setHeader("Host", hostname);
- }
- ret.setHeader("User-Agent", userAgent);
- ret.setHeader("Connection", "keep-alive");
- ret.setHeader("Accept-Encoding",
- "chunked;q=1.0, gzip;q=0.9, deflate;q=0.8, " +
- "identity;q=0.6, *;q=0");
- if (cookieManager != null)
- {
- Cookie[] cookies = cookieManager.getCookies(hostname, secure, path);
- if (cookies != null && cookies.length > 0)
- {
- StringBuffer buf = new StringBuffer();
- buf.append("$Version=1");
- for (int i = 0; i < cookies.length; i++)
- {
- buf.append(',');
- buf.append(' ');
- buf.append(cookies[i].toString());
- }
- ret.setHeader("Cookie", buf.toString());
- }
- }
- fireRequestEvent(RequestEvent.REQUEST_CREATED, ret);
- return ret;
- }
-
- /**
- * Closes this connection.
- */
- public void close()
- throws IOException
- {
- try
- {
- closeConnection();
- }
- finally
- {
- fireConnectionEvent(ConnectionEvent.CONNECTION_CLOSED);
- }
- }
-
- /**
- * Retrieves the socket associated with this connection.
- * This creates the socket if necessary.
- */
- protected Socket getSocket()
- throws IOException
- {
- if (socket == null)
- {
- String connectHostname = hostname;
- int connectPort = port;
- if (isUsingProxy())
- {
- connectHostname = proxyHostname;
- connectPort = proxyPort;
- }
- socket = new Socket();
- InetSocketAddress address =
- new InetSocketAddress(connectHostname, connectPort);
- if (connectionTimeout > 0)
- {
- socket.connect(address, connectionTimeout);
- }
- else
- {
- socket.connect(address);
- }
- if (timeout > 0)
- {
- socket.setSoTimeout(timeout);
- }
- if (secure)
- {
- try
- {
- SSLSocketFactory factory = getSSLSocketFactory();
- SSLSocket ss =
- (SSLSocket) factory.createSocket(socket, connectHostname,
- connectPort, true);
- String[] protocols = { "TLSv1", "SSLv3" };
- ss.setEnabledProtocols(protocols);
- ss.setUseClientMode(true);
- synchronized (handshakeCompletedListeners)
- {
- if (!handshakeCompletedListeners.isEmpty())
- {
- for (Iterator i =
- handshakeCompletedListeners.iterator();
- i.hasNext(); )
- {
- HandshakeCompletedListener l =
- (HandshakeCompletedListener) i.next();
- ss.addHandshakeCompletedListener(l);
- }
- }
- }
- ss.startHandshake();
- socket = ss;
- }
- catch (GeneralSecurityException e)
- {
- throw new IOException(e.getMessage());
- }
- }
- in = socket.getInputStream();
- in = new BufferedInputStream(in);
- out = socket.getOutputStream();
- out = new BufferedOutputStream(out);
- }
- return socket;
- }
-
- SSLSocketFactory getSSLSocketFactory()
- throws GeneralSecurityException
- {
- if (sslSocketFactory == null)
- {
- TrustManager tm = new EmptyX509TrustManager();
- SSLContext context = SSLContext.getInstance("SSL");
- TrustManager[] trust = new TrustManager[] { tm };
- context.init(null, trust, null);
- sslSocketFactory = context.getSocketFactory();
- }
- return sslSocketFactory;
- }
-
- void setSSLSocketFactory(SSLSocketFactory factory)
- {
- sslSocketFactory = factory;
- }
-
- protected InputStream getInputStream()
- throws IOException
- {
- if (socket == null)
- {
- getSocket();
- }
- return in;
- }
-
- protected OutputStream getOutputStream()
- throws IOException
- {
- if (socket == null)
- {
- getSocket();
- }
- return out;
- }
-
- /**
- * Closes the underlying socket, if any.
- */
- protected void closeConnection()
- throws IOException
- {
- if (socket != null)
- {
- try
- {
- socket.close();
- }
- finally
- {
- socket = null;
- }
- }
- }
-
- /**
- * Returns a URI representing the connection.
- * This does not include any request path component.
- */
- protected String getURI()
- {
- StringBuffer buf = new StringBuffer();
- buf.append(secure ? "https://" : "http://");
- buf.append(hostname);
- if (secure)
- {
- if (port != HTTPConnection.HTTPS_PORT)
- {
- buf.append(':');
- buf.append(port);
- }
- }
- else
- {
- if (port != HTTPConnection.HTTP_PORT)
- {
- buf.append(':');
- buf.append(port);
- }
- }
- return buf.toString();
- }
-
- /**
- * Get the number of times the specified nonce has been seen by this
- * connection.
- */
- int getNonceCount(String nonce)
- {
- if (nonceCounts == null)
- {
- return 0;
- }
- return((Integer) nonceCounts.get(nonce)).intValue();
- }
-
- /**
- * Increment the number of times the specified nonce has been seen.
- */
- void incrementNonce(String nonce)
- {
- int current = getNonceCount(nonce);
- if (nonceCounts == null)
- {
- nonceCounts = new HashMap();
- }
- nonceCounts.put(nonce, new Integer(current + 1));
- }
-
- // -- Events --
-
- public void addConnectionListener(ConnectionListener l)
- {
- synchronized (connectionListeners)
- {
- connectionListeners.add(l);
- }
- }
-
- public void removeConnectionListener(ConnectionListener l)
- {
- synchronized (connectionListeners)
- {
- connectionListeners.remove(l);
- }
- }
-
- protected void fireConnectionEvent(int type)
- {
- ConnectionEvent event = new ConnectionEvent(this, type);
- ConnectionListener[] l = null;
- synchronized (connectionListeners)
- {
- l = new ConnectionListener[connectionListeners.size()];
- connectionListeners.toArray(l);
- }
- for (int i = 0; i < l.length; i++)
- {
- switch (type)
- {
- case ConnectionEvent.CONNECTION_CLOSED:
- l[i].connectionClosed(event);
- break;
- }
- }
- }
-
- public void addRequestListener(RequestListener l)
- {
- synchronized (requestListeners)
- {
- requestListeners.add(l);
- }
- }
-
- public void removeRequestListener(RequestListener l)
- {
- synchronized (requestListeners)
- {
- requestListeners.remove(l);
- }
- }
-
- protected void fireRequestEvent(int type, Request request)
- {
- RequestEvent event = new RequestEvent(this, type, request);
- RequestListener[] l = null;
- synchronized (requestListeners)
- {
- l = new RequestListener[requestListeners.size()];
- requestListeners.toArray(l);
- }
- for (int i = 0; i < l.length; i++)
- {
- switch (type)
- {
- case RequestEvent.REQUEST_CREATED:
- l[i].requestCreated(event);
- break;
- case RequestEvent.REQUEST_SENDING:
- l[i].requestSent(event);
- break;
- case RequestEvent.REQUEST_SENT:
- l[i].requestSent(event);
- break;
- }
- }
- }
-
- void addHandshakeCompletedListener(HandshakeCompletedListener l)
- {
- synchronized (handshakeCompletedListeners)
- {
- handshakeCompletedListeners.add(l);
- }
- }
- void removeHandshakeCompletedListener(HandshakeCompletedListener l)
- {
- synchronized (handshakeCompletedListeners)
- {
- handshakeCompletedListeners.remove(l);
- }
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/HTTPDateFormat.java b/libjava/gnu/java/net/protocol/http/HTTPDateFormat.java
deleted file mode 100644
index 2f59e43181c..00000000000
--- a/libjava/gnu/java/net/protocol/http/HTTPDateFormat.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/* HTTPDateFormat.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-/**
- * HTTP date formatter and parser.
- * Formats dates according to RFC 822 (updated by RFC 1123).
- * Parses dates according to the above, or RFC 1036, or the
- * ANSI C asctime()
format.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class HTTPDateFormat
- extends DateFormat
-{
-
- static final String[] DAYS_OF_WEEK = {
- null, "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- };
-
- static final String[] MONTHS = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
-
- public HTTPDateFormat()
- {
- calendar = new GregorianCalendar(TimeZone.getTimeZone ("GMT"));
- numberFormat = new DecimalFormat();
- }
-
- /**
- * Appends the textual value for the specified field to the given string
- * buffer. This method should be avoided, use format(Date)
- * instead.
- * @param date the Date object
- * @param buf the buffer to append to
- * @param field the current field position
- * @return the modified buffer
- */
- public StringBuffer format(Date date, StringBuffer buf,
- FieldPosition field)
- {
- calendar.clear();
- calendar.setTime(date);
- buf.setLength(0);
-
- // Day of week
- buf.append(DAYS_OF_WEEK[calendar.get(Calendar.DAY_OF_WEEK)]);
- buf.append(',');
- buf.append(' ');
-
- // Day of month
- int day = calendar.get(Calendar.DAY_OF_MONTH);
- buf.append(Character.forDigit(day / 10, 10));
- buf.append(Character.forDigit(day % 10, 10));
- buf.append(' ');
-
- // Month
- buf.append(MONTHS[calendar.get(Calendar.MONTH)]);
- buf.append(' ');
-
- // Year
- int year = calendar.get(Calendar.YEAR);
- if (year < 1000)
- {
- buf.append('0');
- if (year < 100)
- {
- buf.append('0');
- if (year < 10)
- {
- buf.append('0');
- }
- }
- }
- buf.append(Integer.toString(year));
- buf.append(' ');
-
- // Hour
- int hour = calendar.get(Calendar.HOUR_OF_DAY);
- buf.append(Character.forDigit(hour / 10, 10));
- buf.append(Character.forDigit(hour % 10, 10));
- buf.append(':');
-
- // Minute
- int minute = calendar.get(Calendar.MINUTE);
- buf.append(Character.forDigit(minute / 10, 10));
- buf.append(Character.forDigit(minute % 10, 10));
- buf.append(':');
-
- // Second
- int second = calendar.get(Calendar.SECOND);
- buf.append(Character.forDigit(second / 10, 10));
- buf.append(Character.forDigit(second % 10, 10));
- buf.append(' ');
-
- // Timezone
- // Get time offset in minutes
- int zoneOffset =(calendar.get(Calendar.ZONE_OFFSET) +
- calendar.get(Calendar.DST_OFFSET)) / 60000;
-
- // Apply + or - appropriately
- if (zoneOffset < 0)
- {
- zoneOffset = -zoneOffset;
- buf.append('-');
- }
- else
- {
- buf.append('+');
- }
-
- // Set the 2 2-char fields as specified above
- int tzhours = zoneOffset / 60;
- buf.append(Character.forDigit(tzhours / 10, 10));
- buf.append(Character.forDigit(tzhours % 10, 10));
- int tzminutes = zoneOffset % 60;
- buf.append(Character.forDigit(tzminutes / 10, 10));
- buf.append(Character.forDigit(tzminutes % 10, 10));
-
- field.setBeginIndex(0);
- field.setEndIndex(buf.length());
- return buf;
- }
-
- /**
- * Parses the given date in the current TimeZone.
- * @param text the formatted date to be parsed
- * @param pos the current parse position
- */
- public Date parse(String text, ParsePosition pos)
- {
- int date, month, year, hour, minute, second;
- String monthText;
- int start = 0, end = -1;
- int len = text.length();
- calendar.clear();
- pos.setIndex(start);
- try
- {
- // Advance to date
- if (Character.isLetter(text.charAt(start)))
- {
- start = skipNonWhitespace(text, start);
- }
- // Determine mode
- switch(start)
- {
- case 3:
- // asctime
- start = skipWhitespace(text, start);
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- monthText = text.substring(start, end);
- month = -1;
- for (int i = 0; i < 12; i++)
- {
- if (MONTHS[i].equals(monthText))
- {
- month = i;
- break;
- }
- }
- if (month == -1)
- {
- pos.setErrorIndex(end);
- return null;
- }
- // Advance to date
- start = skipWhitespace(text, end + 1);
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- date = Integer.parseInt(text.substring(start, end));
- // Advance to hour
- start = skipWhitespace(text, end + 1);
- pos.setIndex(start);
- end = skipTo(text, start + 1, ':');
- hour = Integer.parseInt(text.substring(start, end));
- // Advance to minute
- start = end + 1;
- pos.setIndex(start);
- end = skipTo(text, start + 1, ':');
- minute = Integer.parseInt(text.substring(start, end));
- // Advance to second
- start = end + 1;
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- second = Integer.parseInt(text.substring(start, end));
- // Advance to year
- start = skipWhitespace(text, end + 1);
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- year = Integer.parseInt(text.substring(start, end));
- break;
- case 0:
- case 4:
- // rfc822
- start = skipWhitespace(text, start);
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- date = Integer.parseInt(text.substring(start, end));
- // Advance to month
- start = skipWhitespace(text, end + 1);
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- monthText = text.substring(start, end);
- month = -1;
- for (int i = 0; i < 12; i++)
- {
- if (MONTHS[i].equals(monthText))
- {
- month = i;
- break;
- }
- }
- if (month == -1)
- {
- pos.setErrorIndex(end);
- return null;
- }
- // Advance to year
- start = skipWhitespace(text, end + 1);
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- year = Integer.parseInt(text.substring(start, end));
- // Advance to hour
- start = skipWhitespace(text, end + 1);
- pos.setIndex(start);
- end = skipTo(text, start + 1, ':');
- hour = Integer.parseInt(text.substring(start, end));
- // Advance to minute
- start = end + 1;
- pos.setIndex(start);
- end = skipTo(text, start + 1, ':');
- minute = Integer.parseInt(text.substring(start, end));
- // Advance to second
- start = end + 1;
- pos.setIndex(start);
- end = start + 1;
- while (end < len && !Character.isWhitespace(text.charAt(end)))
- {
- end++;
- }
- second = Integer.parseInt(text.substring(start, end));
- break;
- default:
- // rfc850(obsolete)
- start = skipWhitespace(text, start);
- pos.setIndex(start);
- end = skipTo(text, start + 1, '-');
- date = Integer.parseInt(text.substring(start, end));
- // Advance to month
- start = end + 1;
- pos.setIndex(start);
- end = skipTo(text, start + 1, '-');
- monthText = text.substring(start, end);
- month = -1;
- for (int i = 0; i < 12; i++)
- {
- if (MONTHS[i].equals(monthText))
- {
- month = i;
- break;
- }
- }
- if (month == -1)
- {
- pos.setErrorIndex(end);
- return null;
- }
- // Advance to year
- start = end + 1;
- pos.setIndex(start);
- end = skipNonWhitespace(text, start + 1);
- year = 1900 + Integer.parseInt(text.substring(start, end));
- // Advance to hour
- start = skipWhitespace(text, end + 1);
- pos.setIndex(start);
- end = skipTo(text, start + 1, ':');
- hour = Integer.parseInt(text.substring(start, end));
- // Advance to minute
- start = end + 1;
- pos.setIndex(start);
- end = skipTo(text, start + 1, ':');
- minute = Integer.parseInt(text.substring(start, end));
- // Advance to second
- start = end + 1;
- pos.setIndex(start);
- end = start + 1;
- while (end < len && !Character.isWhitespace(text.charAt(end)))
- {
- end++;
- }
- second = Integer.parseInt(text.substring(start, end));
- }
-
- calendar.set(Calendar.YEAR, year);
- calendar.set(Calendar.MONTH, month);
- calendar.set(Calendar.DAY_OF_MONTH, date);
- calendar.set(Calendar.HOUR, hour);
- calendar.set(Calendar.MINUTE, minute);
- calendar.set(Calendar.SECOND, second);
-
- if (end != len)
- {
- // Timezone
- start = skipWhitespace(text, end + 1);
- end = start + 1;
- while (end < len && !Character.isWhitespace(text.charAt(end)))
- {
- end++;
- }
- char pm = text.charAt(start);
- if (Character.isLetter(pm))
- {
- TimeZone tz =
- TimeZone.getTimeZone(text.substring(start, end));
- calendar.set(Calendar.ZONE_OFFSET, tz.getRawOffset());
- }
- else
- {
- int zoneOffset = 0;
- zoneOffset += 600 * Character.digit(text.charAt(++start), 10);
- zoneOffset += 60 * Character.digit(text.charAt(++start), 10);
- zoneOffset += 10 * Character.digit(text.charAt(++start), 10);
- zoneOffset += Character.digit(text.charAt(++start), 10);
- zoneOffset *= 60000; // minutes -> ms
- if ('-' == pm)
- {
- zoneOffset = -zoneOffset;
- }
- calendar.set(Calendar.ZONE_OFFSET, zoneOffset);
- }
- }
- pos.setIndex(end);
-
- return calendar.getTime();
- }
- catch (NumberFormatException e)
- {
- pos.setErrorIndex(Math.max(start, end));
- }
- catch (StringIndexOutOfBoundsException e)
- {
- pos.setErrorIndex(Math.max(start, end));
- }
- return null;
- }
-
- private int skipWhitespace(String text, int pos)
- {
- while(Character.isWhitespace(text.charAt(pos)))
- {
- pos++;
- }
- return pos;
- }
-
- private int skipNonWhitespace(String text, int pos)
- {
- while(!Character.isWhitespace(text.charAt(pos)))
- {
- pos++;
- }
- return pos;
- }
-
- private int skipTo(String text, int pos, char c)
- {
- while(text.charAt(pos) != c)
- {
- pos++;
- }
- return pos;
- }
-
- /**
- * Don't allow setting the calendar.
- */
- public void setCalendar(Calendar newCalendar)
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Don't allow setting the NumberFormat.
- */
- public void setNumberFormat(NumberFormat newNumberFormat)
- {
- throw new UnsupportedOperationException();
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/HTTPURLConnection.java b/libjava/gnu/java/net/protocol/http/HTTPURLConnection.java
deleted file mode 100644
index 1745a34abff..00000000000
--- a/libjava/gnu/java/net/protocol/http/HTTPURLConnection.java
+++ /dev/null
@@ -1,682 +0,0 @@
-/* HTTPURLConnection.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.cert.Certificate;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.net.ssl.HandshakeCompletedEvent;
-import javax.net.ssl.HandshakeCompletedListener;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLPeerUnverifiedException;
-import javax.net.ssl.SSLSocketFactory;
-
-/**
- * A URLConnection that uses the HTTPConnection class.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class HTTPURLConnection
- extends HttpsURLConnection
- implements HandshakeCompletedListener
-{
-
- /**
- * Pool of reusable connections, used if keepAlive is true.
- */
- private static final Map connectionPool = new LinkedHashMap();
-
- /*
- * The underlying connection.
- */
- private HTTPConnection connection;
-
- private String proxyHostname;
- private int proxyPort;
- private String agent;
- private boolean keepAlive;
- private int maxConnections;
-
- private Request request;
- private Headers requestHeaders;
- private ByteArrayOutputStream requestSink;
- private boolean requestMethodSetExplicitly;
-
- private Response response;
- private ByteArrayInputStream responseSink;
- private ByteArrayInputStream errorSink;
-
- private HandshakeCompletedEvent handshakeEvent;
-
- /**
- * Constructor.
- * @param url the URL
- */
- public HTTPURLConnection(URL url)
- throws IOException
- {
- super(url);
- requestHeaders = new Headers();
- AccessController.doPrivileged(this.new GetHTTPPropertiesAction());
- }
-
- class GetHTTPPropertiesAction
- implements PrivilegedAction
- {
-
- public Object run()
- {
- proxyHostname = System.getProperty("http.proxyHost");
- if (proxyHostname != null && proxyHostname.length() > 0)
- {
- String port = System.getProperty("http.proxyPort");
- if (port != null && port.length() > 0)
- {
- proxyPort = Integer.parseInt(port);
- }
- else
- {
- proxyHostname = null;
- proxyPort = -1;
- }
- }
- agent = System.getProperty("http.agent");
- String ka = System.getProperty("http.keepAlive");
- keepAlive = !(ka != null && "false".equals(ka));
- String mc = System.getProperty("http.maxConnections");
- maxConnections = (mc != null && mc.length() > 0) ?
- Math.max(Integer.parseInt(mc), 1) : 5;
- return null;
- }
-
- }
-
- public void connect()
- throws IOException
- {
- if (connected)
- {
- return;
- }
- String protocol = url.getProtocol();
- boolean secure = "https".equals(protocol);
- String host = url.getHost();
- int port = url.getPort();
- if (port < 0)
- {
- port = secure ? HTTPConnection.HTTPS_PORT :
- HTTPConnection.HTTP_PORT;
- }
- String file = url.getFile();
- String username = url.getUserInfo();
- String password = null;
- if (username != null)
- {
- int ci = username.indexOf(':');
- if (ci != -1)
- {
- password = username.substring(ci + 1);
- username = username.substring(0, ci);
- }
- }
- final Credentials creds = (username == null) ? null :
- new Credentials (username, password);
-
- boolean retry;
- do
- {
- retry = false;
- if (connection == null)
- {
- connection = getConnection(host, port, secure);
- if (secure)
- {
- SSLSocketFactory factory = getSSLSocketFactory();
- HostnameVerifier verifier = getHostnameVerifier();
- if (factory != null)
- {
- connection.setSSLSocketFactory(factory);
- }
- connection.addHandshakeCompletedListener(this);
- // TODO verifier
- }
- }
- if (proxyHostname != null)
- {
- if (proxyPort < 0)
- {
- proxyPort = secure ? HTTPConnection.HTTPS_PORT :
- HTTPConnection.HTTP_PORT;
- }
- connection.setProxy(proxyHostname, proxyPort);
- }
- request = connection.newRequest(method, file);
- if (!keepAlive)
- {
- request.setHeader("Connection", "close");
- }
- if (agent != null)
- {
- request.setHeader("User-Agent", agent);
- }
- request.getHeaders().putAll(requestHeaders);
- if (requestSink != null)
- {
- byte[] content = requestSink.toByteArray();
- RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content);
- request.setRequestBodyWriter(writer);
- }
- ByteArrayResponseBodyReader reader = new ByteArrayResponseBodyReader();
- request.setResponseBodyReader(reader);
- if (creds != null)
- {
- request.setAuthenticator(new Authenticator() {
- public Credentials getCredentials(String realm, int attempts)
- {
- return (attempts < 2) ? creds : null;
- }
- });
- }
- response = request.dispatch();
- if (response.getCodeClass() == 3 && getInstanceFollowRedirects())
- {
- // Follow redirect
- String location = response.getHeader("Location");
- String connectionUri = connection.getURI();
- int start = connectionUri.length();
- if (location.startsWith(connectionUri) &&
- location.charAt(start) == '/')
- {
- file = location.substring(start);
- retry = true;
- }
- else if (location.startsWith("http:"))
- {
- connection.close();
- connection = null;
- secure = false;
- start = 7;
- int end = location.indexOf('/', start);
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTP_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.startsWith("https:"))
- {
- connection.close();
- connection = null;
- secure = true;
- start = 8;
- int end = location.indexOf('/', start);
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTPS_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.length() > 0)
- {
- // Malformed absolute URI, treat as file part of URI
- if (location.charAt(0) == '/')
- {
- // Absolute path
- file = location;
- }
- else
- {
- // Relative path
- int lsi = file.lastIndexOf('/');
- file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
- file += location;
- }
- retry = true;
- }
- }
- else
- {
- responseSink = new ByteArrayInputStream(reader.toByteArray ());
- if (response.getCode() == 404)
- {
- errorSink = responseSink;
- throw new FileNotFoundException(url.toString());
- }
- }
- }
- while (retry);
- connected = true;
- }
-
- /**
- * Returns a connection, from the pool if necessary.
- */
- HTTPConnection getConnection(String host, int port, boolean secure)
- throws IOException
- {
- HTTPConnection connection;
- if (keepAlive)
- {
- StringBuffer buf = new StringBuffer(secure ? "https://" : "http://");
- buf.append(host);
- buf.append(':');
- buf.append(port);
- String key = buf.toString();
- synchronized (connectionPool)
- {
- connection = (HTTPConnection) connectionPool.get(key);
- if (connection == null)
- {
- connection = new HTTPConnection(host, port, secure);
- // Good housekeeping
- if (connectionPool.size() == maxConnections)
- {
- // maxConnections must always be >= 1
- Object lru = connectionPool.keySet().iterator().next();
- connectionPool.remove(lru);
- }
- connectionPool.put(key, connection);
- }
- }
- }
- else
- {
- connection = new HTTPConnection(host, port, secure);
- }
- return connection;
- }
-
- public void disconnect()
- {
- if (connection != null)
- {
- try
- {
- connection.close();
- }
- catch (IOException e)
- {
- }
- }
- }
-
- public boolean usingProxy()
- {
- return (proxyHostname != null);
- }
-
- /**
- * Overrides the corresponding method in HttpURLConnection to permit
- * arbitrary methods, as long as they're valid ASCII alphabetic
- * characters. This is to permit WebDAV and other HTTP extensions to
- * function.
- * @param method the method
- */
- public void setRequestMethod(String method)
- throws ProtocolException
- {
- if (connected)
- {
- throw new ProtocolException("Already connected");
- }
- // Validate
- method = method.toUpperCase();
- int len = method.length();
- if (len == 0)
- {
- throw new ProtocolException("Empty method name");
- }
- for (int i = 0; i < len; i++)
- {
- char c = method.charAt(i);
- if (c < 0x41 || c > 0x5a)
- {
- throw new ProtocolException("Illegal character '" + c +
- "' at index " + i);
- }
- }
- // OK
- this.method = method;
- requestMethodSetExplicitly = true;
- }
-
- public String getRequestProperty(String key)
- {
- return requestHeaders.getValue(key);
- }
-
- public Map getRequestProperties()
- {
- return requestHeaders;
- }
-
- public void setRequestProperty(String key, String value)
- {
- requestHeaders.put(key, value);
- }
-
- public void addRequestProperty(String key, String value)
- {
- String old = requestHeaders.getValue(key);
- if (old == null)
- {
- requestHeaders.put(key, value);
- }
- else
- {
- requestHeaders.put(key, old + "," + value);
- }
- }
-
- public OutputStream getOutputStream()
- throws IOException
- {
- if (connected)
- {
- throw new ProtocolException("Already connected");
- }
- if (!doOutput)
- {
- throw new ProtocolException("doOutput is false");
- }
- else if (!requestMethodSetExplicitly)
- {
- /*
- * Silently change the method to POST if no method was set
- * explicitly. This is due to broken applications depending on this
- * behaviour (Apache XMLRPC for one).
- */
- method = "POST";
- }
- if (requestSink == null)
- {
- requestSink = new ByteArrayOutputStream();
- }
- return requestSink;
- }
-
- // -- Response --
-
- public InputStream getInputStream()
- throws IOException
- {
- if (!connected)
- {
- connect();
- }
- if (!doInput)
- {
- throw new ProtocolException("doInput is false");
- }
- return responseSink;
- }
-
- public InputStream getErrorStream()
- {
- return errorSink;
- }
-
- public Map getHeaderFields()
- {
- if (!connected)
- {
- try
- {
- connect();
- }
- catch (IOException e)
- {
- return null;
- }
- }
- Map headers = response.getHeaders();
- Map ret = new LinkedHashMap();
- ret.put("", Collections.singletonList(getStatusLine(response)));
- for (Iterator i = headers.entrySet().iterator(); i.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) i.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
- ret.put(key, Collections.singletonList(value));
- }
- return ret;
- }
-
- String getStatusLine(Response response)
- {
- return "HTTP/" + response.getMajorVersion() +
- "." + response.getMinorVersion() +
- " " + response.getCode() +
- " " + response.getMessage();
- }
-
- public String getHeaderField(int index)
- {
- if (!connected)
- {
- try
- {
- connect();
- }
- catch (IOException e)
- {
- return null;
- }
- }
- if (index == 0)
- {
- return getStatusLine(response);
- }
- Iterator i = response.getHeaders().entrySet().iterator();
- Map.Entry entry;
- int count = 1;
- do
- {
- if (!i.hasNext())
- {
- return null;
- }
- entry = (Map.Entry) i.next();
- count++;
- }
- while (count <= index);
- return (String) entry.getValue();
- }
-
- public String getHeaderFieldKey(int index)
- {
- if (!connected)
- {
- try
- {
- connect();
- }
- catch (IOException e)
- {
- return null;
- }
- }
- if (index == 0)
- {
- return null;
- }
- Iterator i = response.getHeaders().entrySet().iterator();
- Map.Entry entry;
- int count = 1;
- do
- {
- if (!i.hasNext())
- {
- return null;
- }
- entry = (Map.Entry) i.next();
- count++;
- }
- while (count <= index);
- return (String) entry.getKey();
- }
-
- public String getHeaderField(String name)
- {
- if (!connected)
- {
- try
- {
- connect();
- }
- catch (IOException e)
- {
- return null;
- }
- }
- return (String) response.getHeader(name);
- }
-
- public long getHeaderFieldDate(String name, long def)
- {
- if (!connected)
- {
- try
- {
- connect();
- }
- catch (IOException e)
- {
- return def;
- }
- }
- Date date = response.getDateHeader(name);
- return (date == null) ? def : date.getTime();
- }
-
- public String getContentType()
- {
- return getHeaderField("Content-Type");
- }
-
- public int getResponseCode()
- throws IOException
- {
- if (!connected)
- {
- connect();
- }
- return response.getCode();
- }
-
- public String getResponseMessage()
- throws IOException
- {
- if (!connected)
- {
- connect();
- }
- return response.getMessage();
- }
-
- // -- HTTPS specific --
-
- public String getCipherSuite()
- {
- if (!connected)
- {
- throw new IllegalStateException("not connected");
- }
- return handshakeEvent.getCipherSuite();
- }
-
- public Certificate[] getLocalCertificates()
- {
- if (!connected)
- {
- throw new IllegalStateException("not connected");
- }
- return handshakeEvent.getLocalCertificates();
- }
-
- public Certificate[] getServerCertificates()
- throws SSLPeerUnverifiedException
- {
- if (!connected)
- {
- throw new IllegalStateException("not connected");
- }
- return handshakeEvent.getPeerCertificates();
- }
-
- // HandshakeCompletedListener
-
- public void handshakeCompleted(HandshakeCompletedEvent event)
- {
- handshakeEvent = event;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/Handler.java b/libjava/gnu/java/net/protocol/http/Handler.java
deleted file mode 100644
index 64054251331..00000000000
--- a/libjava/gnu/java/net/protocol/http/Handler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Handler.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * An HTTP URL stream handler.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Handler
- extends URLStreamHandler
-{
-
- /**
- * Returns the default HTTP port (80).
- */
- protected int getDefaultPort()
- {
- return HTTPConnection.HTTP_PORT;
- }
-
- /**
- * Returns an HTTPURLConnection for the given URL.
- */
- public URLConnection openConnection(URL url)
- throws IOException
- {
- return new HTTPURLConnection(url);
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/Headers.java b/libjava/gnu/java/net/protocol/http/Headers.java
deleted file mode 100644
index 847ebefc1f6..00000000000
--- a/libjava/gnu/java/net/protocol/http/Headers.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/* Headers.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import gnu.java.net.LineInputStream;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A collection of HTTP header names and associated values.
- * Retrieval of values is case insensitive. An iteration over the keys
- * returns the header names in the order they were received.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Headers
- implements Map
-{
-
- static final DateFormat dateFormat = new HTTPDateFormat();
-
- static class Header
- {
-
- final String name;
-
- Header(String name)
- {
- if (name == null || name.length() == 0)
- {
- throw new IllegalArgumentException(name);
- }
- this.name = name;
- }
-
- public int hashCode()
- {
- return name.toLowerCase().hashCode();
- }
-
- public boolean equals(Object other)
- {
- if (other instanceof Header)
- {
- return ((Header) other).name.equalsIgnoreCase(name);
- }
- return false;
- }
-
- public String toString()
- {
- return name;
- }
-
- }
-
- static class HeaderEntry
- implements Map.Entry
- {
-
- final Map.Entry entry;
-
- HeaderEntry(Map.Entry entry)
- {
- this.entry = entry;
- }
-
- public Object getKey()
- {
- return ((Header) entry.getKey()).name;
- }
-
- public Object getValue()
- {
- return entry.getValue();
- }
-
- public Object setValue(Object value)
- {
- return entry.setValue(value);
- }
-
- public int hashCode()
- {
- return entry.hashCode();
- }
-
- public boolean equals(Object other)
- {
- return entry.equals(other);
- }
-
- public String toString()
- {
- return getKey().toString() + "=" + getValue();
- }
-
- }
-
- private LinkedHashMap headers;
-
- public Headers()
- {
- headers = new LinkedHashMap();
- }
-
- public int size()
- {
- return headers.size();
- }
-
- public boolean isEmpty()
- {
- return headers.isEmpty();
- }
-
- public boolean containsKey(Object key)
- {
- return headers.containsKey(new Header((String) key));
- }
-
- public boolean containsValue(Object value)
- {
- return headers.containsValue(value);
- }
-
- public Object get(Object key)
- {
- return headers.get(new Header((String) key));
- }
-
- /**
- * Returns the value of the specified header as a string.
- */
- public String getValue(String header)
- {
- return (String) headers.get(new Header(header));
- }
-
- /**
- * Returns the value of the specified header as an integer,
- * or -1 if the header is not present or not an integer.
- */
- public int getIntValue(String header)
- {
- String val = getValue(header);
- if (val == null)
- {
- return -1;
- }
- try
- {
- return Integer.parseInt(val);
- }
- catch (NumberFormatException e)
- {
- }
- return -1;
- }
-
- /**
- * Returns the value of the specified header as a date,
- * or null
if the header is not present or not a date.
- */
- public Date getDateValue(String header)
- {
- String val = getValue(header);
- if (val == null)
- {
- return null;
- }
- try
- {
- return dateFormat.parse(val);
- }
- catch (ParseException e)
- {
- return null;
- }
- }
-
- public Object put(Object key, Object value)
- {
- return headers.put(new Header((String) key), value);
- }
-
- public Object remove(Object key)
- {
- return headers.remove(new Header((String) key));
- }
-
- public void putAll(Map t)
- {
- for (Iterator i = t.keySet().iterator(); i.hasNext(); )
- {
- String key = (String) i.next();
- String value = (String) t.get(key);
- headers.put(new Header(key), value);
- }
- }
-
- public void clear()
- {
- headers.clear();
- }
-
- public Set keySet()
- {
- Set keys = headers.keySet();
- Set ret = new LinkedHashSet();
- for (Iterator i = keys.iterator(); i.hasNext(); )
- {
- ret.add(((Header) i.next()).name);
- }
- return ret;
- }
-
- public Collection values()
- {
- return headers.values();
- }
-
- public Set entrySet()
- {
- Set entries = headers.entrySet();
- Set ret = new LinkedHashSet();
- for (Iterator i = entries.iterator(); i.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) i.next();
- ret.add(new HeaderEntry(entry));
- }
- return ret;
- }
-
- public boolean equals(Object other)
- {
- return headers.equals(other);
- }
-
- public int hashCode()
- {
- return headers.hashCode();
- }
-
- /**
- * Parse the specified input stream, adding headers to this collection.
- */
- public void parse(InputStream in)
- throws IOException
- {
- LineInputStream lin = (in instanceof LineInputStream) ?
- (LineInputStream) in : new LineInputStream(in);
-
- String name = null;
- StringBuffer value = new StringBuffer();
- while (true)
- {
- String line = lin.readLine();
- if (line == null)
- {
- if (name != null)
- {
- addValue(name, value.toString());
- }
- break;
- }
- int len = line.length();
- if (len < 2)
- {
- if (name != null)
- {
- addValue(name, value.toString());
- }
- break;
- }
- char c1 = line.charAt(0);
- if (c1 == ' ' || c1 == '\t')
- {
- // Continuation
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
- value.append(line.substring(0, last));
- }
- else
- {
- if (name != null)
- {
- addValue(name, value.toString());
- }
-
- int di = line.indexOf(':');
- name = line.substring(0, di);
- value.setLength(0);
- do
- {
- di++;
- }
- while (di < len && line.charAt(di) == ' ');
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
- value.append(line.substring(di, last));
- }
- }
- }
-
- private void addValue(String name, String value)
- {
- Header key = new Header(name);
- String old = (String) headers.get(key);
- if (old == null)
- {
- headers.put(key, value);
- }
- else
- {
- headers.put(key, old + ", " + value);
- }
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/Request.java b/libjava/gnu/java/net/protocol/http/Request.java
deleted file mode 100644
index 15a459e3eac..00000000000
--- a/libjava/gnu/java/net/protocol/http/Request.java
+++ /dev/null
@@ -1,914 +0,0 @@
-/* Request.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import gnu.java.net.BASE64;
-import gnu.java.net.LineInputStream;
-import gnu.java.net.protocol.http.event.RequestEvent;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ProtocolException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.InflaterInputStream;
-
-/**
- * A single HTTP request.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Request
-{
-
- /**
- * The connection context in which this request is invoked.
- */
- protected final HTTPConnection connection;
-
- /**
- * The HTTP method to invoke.
- */
- protected final String method;
-
- /**
- * The path identifying the resource.
- * This string must conform to the abs_path definition given in RFC2396,
- * with an optional "?query" part, and must be URI-escaped by the caller.
- */
- protected final String path;
-
- /**
- * The headers in this request.
- */
- protected final Headers requestHeaders;
-
- /**
- * The request body provider.
- */
- protected RequestBodyWriter requestBodyWriter;
-
- /**
- * Request body negotiation threshold for 100-continue expectations.
- */
- protected int requestBodyNegotiationThreshold;
-
- /**
- * The response body reader.
- */
- protected ResponseBodyReader responseBodyReader;
-
- /**
- * Map of response header handlers.
- */
- protected Map responseHeaderHandlers;
-
- /**
- * The authenticator.
- */
- protected Authenticator authenticator;
-
- /**
- * Whether this request has been dispatched yet.
- */
- private boolean dispatched;
-
- /**
- * Constructor for a new request.
- * @param connection the connection context
- * @param method the HTTP method
- * @param path the resource path including query part
- */
- protected Request(HTTPConnection connection, String method,
- String path)
- {
- this.connection = connection;
- this.method = method;
- this.path = path;
- requestHeaders = new Headers();
- responseHeaderHandlers = new HashMap();
- requestBodyNegotiationThreshold = 4096;
- }
-
- /**
- * Returns the connection associated with this request.
- * @see #connection
- */
- public HTTPConnection getConnection()
- {
- return connection;
- }
-
- /**
- * Returns the HTTP method to invoke.
- * @see #method
- */
- public String getMethod()
- {
- return method;
- }
-
- /**
- * Returns the resource path.
- * @see #path
- */
- public String getPath()
- {
- return path;
- }
-
- /**
- * Returns the full request-URI represented by this request, as specified
- * by HTTP/1.1.
- */
- public String getRequestURI()
- {
- return connection.getURI() + path;
- }
-
- /**
- * Returns the headers in this request.
- */
- public Headers getHeaders()
- {
- return requestHeaders;
- }
-
- /**
- * Returns the value of the specified header in this request.
- * @param name the header name
- */
- public String getHeader(String name)
- {
- return requestHeaders.getValue(name);
- }
-
- /**
- * Returns the value of the specified header in this request as an integer.
- * @param name the header name
- */
- public int getIntHeader(String name)
- {
- return requestHeaders.getIntValue(name);
- }
-
- /**
- * Returns the value of the specified header in this request as a date.
- * @param name the header name
- */
- public Date getDateHeader(String name)
- {
- return requestHeaders.getDateValue(name);
- }
-
- /**
- * Sets the specified header in this request.
- * @param name the header name
- * @param value the header value
- */
- public void setHeader(String name, String value)
- {
- requestHeaders.put(name, value);
- }
-
- /**
- * Convenience method to set the entire request body.
- * @param requestBody the request body content
- */
- public void setRequestBody(byte[] requestBody)
- {
- setRequestBodyWriter(new ByteArrayRequestBodyWriter(requestBody));
- }
-
- /**
- * Sets the request body provider.
- * @param requestBodyWriter the handler used to obtain the request body
- */
- public void setRequestBodyWriter(RequestBodyWriter requestBodyWriter)
- {
- this.requestBodyWriter = requestBodyWriter;
- }
-
- /**
- * Sets the response body reader.
- * @param responseBodyReader the handler to receive notifications of
- * response body content
- */
- public void setResponseBodyReader(ResponseBodyReader responseBodyReader)
- {
- this.responseBodyReader = responseBodyReader;
- }
-
- /**
- * Sets a callback handler to be invoked for the specified header name.
- * @param name the header name
- * @param handler the handler to receive the value for the header
- */
- public void setResponseHeaderHandler(String name,
- ResponseHeaderHandler handler)
- {
- responseHeaderHandlers.put(name, handler);
- }
-
- /**
- * Sets an authenticator that can be used to handle authentication
- * automatically.
- * @param authenticator the authenticator
- */
- public void setAuthenticator(Authenticator authenticator)
- {
- this.authenticator = authenticator;
- }
-
- /**
- * Sets the request body negotiation threshold.
- * If this is set, it determines the maximum size that the request body
- * may be before body negotiation occurs(via the
- * 100-continue
expectation). This ensures that a large
- * request body is not sent when the server wouldn't have accepted it
- * anyway.
- * @param threshold the body negotiation threshold, or <=0 to disable
- * request body negotation entirely
- */
- public void setRequestBodyNegotiationThreshold(int threshold)
- {
- requestBodyNegotiationThreshold = threshold;
- }
-
- /**
- * Dispatches this request.
- * A request can only be dispatched once; calling this method a second
- * time results in a protocol exception.
- * @exception IOException if an I/O error occurred
- * @return an HTTP response object representing the result of the operation
- */
- public Response dispatch()
- throws IOException
- {
- if (dispatched)
- {
- throw new ProtocolException("request already dispatched");
- }
- final String CRLF = "\r\n";
- final String HEADER_SEP = ": ";
- final String US_ASCII = "US-ASCII";
- final String version = connection.getVersion();
- Response response;
- int contentLength = -1;
- boolean retry = false;
- int attempts = 0;
- boolean expectingContinue = false;
- if (requestBodyWriter != null)
- {
- contentLength = requestBodyWriter.getContentLength();
- if (contentLength > requestBodyNegotiationThreshold)
- {
- expectingContinue = true;
- setHeader("Expect", "100-continue");
- }
- else
- {
- setHeader("Content-Length", Integer.toString(contentLength));
- }
- }
-
- try
- {
- // Loop while authentication fails or continue
- do
- {
- retry = false;
- // Send request
- connection.fireRequestEvent(RequestEvent.REQUEST_SENDING, this);
-
- // Get socket output and input streams
- OutputStream out = connection.getOutputStream();
- LineInputStream in =
- new LineInputStream(connection.getInputStream());
- // Request line
- String requestUri = path;
- if (connection.isUsingProxy() &&
- !"*".equals(requestUri) &&
- !"CONNECT".equals(method))
- {
- requestUri = getRequestURI();
- }
- String line = method + ' ' + requestUri + ' ' + version + CRLF;
- out.write(line.getBytes(US_ASCII));
- // Request headers
- for (Iterator i = requestHeaders.keySet().iterator();
- i.hasNext(); )
- {
- String name =(String) i.next();
- String value =(String) requestHeaders.get(name);
- line = name + HEADER_SEP + value + CRLF;
- out.write(line.getBytes(US_ASCII));
- }
- out.write(CRLF.getBytes(US_ASCII));
- // Request body
- if (requestBodyWriter != null && !expectingContinue)
- {
- byte[] buffer = new byte[4096];
- int len;
- int count = 0;
-
- requestBodyWriter.reset();
- do
- {
- len = requestBodyWriter.write(buffer);
- if (len > 0)
- {
- out.write(buffer, 0, len);
- }
- count += len;
- }
- while (len > -1 && count < contentLength);
- out.write(CRLF.getBytes(US_ASCII));
- }
- out.flush();
- // Sent event
- connection.fireRequestEvent(RequestEvent.REQUEST_SENT, this);
- // Get response
- response = readResponse(in);
- int sc = response.getCode();
- if (sc == 401 && authenticator != null)
- {
- if (authenticate(response, attempts++))
- {
- retry = true;
- }
- }
- else if (sc == 100 && expectingContinue)
- {
- requestHeaders.remove("Expect");
- setHeader("Content-Length", Integer.toString(contentLength));
- expectingContinue = false;
- retry = true;
- }
- }
- while (retry);
- }
- catch (IOException e)
- {
- connection.close();
- throw e;
- }
- return response;
- }
-
- Response readResponse(LineInputStream in)
- throws IOException
- {
- String line;
- int len;
-
- // Read response status line
- line = in.readLine();
- if (line == null)
- {
- throw new ProtocolException("Peer closed connection");
- }
- if (!line.startsWith("HTTP/"))
- {
- throw new ProtocolException(line);
- }
- len = line.length();
- int start = 5, end = 6;
- while (line.charAt(end) != '.')
- {
- end++;
- }
- int majorVersion = Integer.parseInt(line.substring(start, end));
- start = end + 1;
- end = start + 1;
- while (line.charAt(end) != ' ')
- {
- end++;
- }
- int minorVersion = Integer.parseInt(line.substring(start, end));
- start = end + 1;
- end = start + 3;
- int code = Integer.parseInt(line.substring(start, end));
- String message = line.substring(end + 1, len - 1);
- // Read response headers
- Headers responseHeaders = new Headers();
- responseHeaders.parse(in);
- notifyHeaderHandlers(responseHeaders);
- // Construct response
- int codeClass = code / 100;
- Response ret = new Response(majorVersion, minorVersion, code,
- codeClass, message, responseHeaders);
- switch (code)
- {
- case 204:
- case 205:
- break;
- default:
- // Does response body reader want body?
- boolean notify = (responseBodyReader != null);
- if (notify)
- {
- if (!responseBodyReader.accept(this, ret))
- {
- notify = false;
- }
- }
- readResponseBody(ret, in, notify);
- }
- return ret;
- }
-
- void notifyHeaderHandlers(Headers headers)
- {
- for (Iterator i = headers.entrySet().iterator(); i.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) i.next();
- String name =(String) entry.getKey();
- // Handle Set-Cookie
- if ("Set-Cookie".equalsIgnoreCase(name))
- {
- String value = (String) entry.getValue();
- handleSetCookie(value);
- }
- ResponseHeaderHandler handler =
- (ResponseHeaderHandler) responseHeaderHandlers.get(name);
- if (handler != null)
- {
- String value = (String) entry.getValue();
- handler.setValue(value);
- }
- }
- }
-
- void readResponseBody(Response response, InputStream in,
- boolean notify)
- throws IOException
- {
- byte[] buffer = new byte[4096];
- int contentLength = -1;
- Headers trailer = null;
-
- String transferCoding = response.getHeader("Transfer-Encoding");
- if ("chunked".equalsIgnoreCase(transferCoding))
- {
- trailer = new Headers();
- in = new ChunkedInputStream(in, trailer);
- }
- else
- {
- contentLength = response.getIntHeader("Content-Length");
- }
- String contentCoding = response.getHeader("Content-Encoding");
- if (contentCoding != null && !"identity".equals(contentCoding))
- {
- if ("gzip".equals(contentCoding))
- {
- in = new GZIPInputStream(in);
- }
- else if ("deflate".equals(contentCoding))
- {
- in = new InflaterInputStream(in);
- }
- else
- {
- throw new ProtocolException("Unsupported Content-Encoding: " +
- contentCoding);
- }
- }
-
- // Persistent connections are the default in HTTP/1.1
- boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
- "close".equalsIgnoreCase(response.getHeader("Connection")) ||
- (connection.majorVersion == 1 && connection.minorVersion == 0) ||
- (response.majorVersion == 1 && response.minorVersion == 0);
-
- int count = contentLength;
- int len = (count > -1) ? count : buffer.length;
- len = (len > buffer.length) ? buffer.length : len;
- while (len > -1)
- {
- len = in.read(buffer, 0, len);
- if (len < 0)
- {
- // EOF
- connection.closeConnection();
- break;
- }
- if (notify)
- {
- responseBodyReader.read(buffer, 0, len);
- }
- if (count > -1)
- {
- count -= len;
- if (count < 1)
- {
- if (doClose)
- {
- connection.closeConnection();
- }
- break;
- }
- }
- }
- if (notify)
- {
- responseBodyReader.close();
- }
- if (trailer != null)
- {
- response.getHeaders().putAll(trailer);
- notifyHeaderHandlers(trailer);
- }
- }
-
- boolean authenticate(Response response, int attempts)
- throws IOException
- {
- String challenge = response.getHeader("WWW-Authenticate");
- if (challenge == null)
- {
- challenge = response.getHeader("Proxy-Authenticate");
- }
- int si = challenge.indexOf(' ');
- String scheme = (si == -1) ? challenge : challenge.substring(0, si);
- if ("Basic".equalsIgnoreCase(scheme))
- {
- Properties params = parseAuthParams(challenge.substring(si + 1));
- String realm = params.getProperty("realm");
- Credentials creds = authenticator.getCredentials(realm, attempts);
- String userPass = creds.getUsername() + ':' + creds.getPassword();
- byte[] b_userPass = userPass.getBytes("US-ASCII");
- byte[] b_encoded = BASE64.encode(b_userPass);
- String authorization =
- scheme + " " + new String(b_encoded, "US-ASCII");
- setHeader("Authorization", authorization);
- return true;
- }
- else if ("Digest".equalsIgnoreCase(scheme))
- {
- Properties params = parseAuthParams(challenge.substring(si + 1));
- String realm = params.getProperty("realm");
- String nonce = params.getProperty("nonce");
- String qop = params.getProperty("qop");
- String algorithm = params.getProperty("algorithm");
- String digestUri = getRequestURI();
- Credentials creds = authenticator.getCredentials(realm, attempts);
- String username = creds.getUsername();
- String password = creds.getPassword();
- connection.incrementNonce(nonce);
- try
- {
- MessageDigest md5 = MessageDigest.getInstance("MD5");
- final byte[] COLON = { 0x3a };
-
- // Calculate H(A1)
- md5.reset();
- md5.update(username.getBytes("US-ASCII"));
- md5.update(COLON);
- md5.update(realm.getBytes("US-ASCII"));
- md5.update(COLON);
- md5.update(password.getBytes("US-ASCII"));
- byte[] ha1 = md5.digest();
- if ("md5-sess".equals(algorithm))
- {
- byte[] cnonce = generateNonce();
- md5.reset();
- md5.update(ha1);
- md5.update(COLON);
- md5.update(nonce.getBytes("US-ASCII"));
- md5.update(COLON);
- md5.update(cnonce);
- ha1 = md5.digest();
- }
- String ha1Hex = toHexString(ha1);
-
- // Calculate H(A2)
- md5.reset();
- md5.update(method.getBytes("US-ASCII"));
- md5.update(COLON);
- md5.update(digestUri.getBytes("US-ASCII"));
- if ("auth-int".equals(qop))
- {
- byte[] hEntity = null; // TODO hash of entity body
- md5.update(COLON);
- md5.update(hEntity);
- }
- byte[] ha2 = md5.digest();
- String ha2Hex = toHexString(ha2);
-
- // Calculate response
- md5.reset();
- md5.update(ha1Hex.getBytes("US-ASCII"));
- md5.update(COLON);
- md5.update(nonce.getBytes("US-ASCII"));
- if ("auth".equals(qop) || "auth-int".equals(qop))
- {
- String nc = getNonceCount(nonce);
- byte[] cnonce = generateNonce();
- md5.update(COLON);
- md5.update(nc.getBytes("US-ASCII"));
- md5.update(COLON);
- md5.update(cnonce);
- md5.update(COLON);
- md5.update(qop.getBytes("US-ASCII"));
- }
- md5.update(COLON);
- md5.update(ha2Hex.getBytes("US-ASCII"));
- String digestResponse = toHexString(md5.digest());
-
- String authorization = scheme +
- " username=\"" + username + "\"" +
- " realm=\"" + realm + "\"" +
- " nonce=\"" + nonce + "\"" +
- " uri=\"" + digestUri + "\"" +
- " response=\"" + digestResponse + "\"";
- setHeader("Authorization", authorization);
- return true;
- }
- catch (NoSuchAlgorithmException e)
- {
- return false;
- }
- }
- // Scheme not recognised
- return false;
- }
-
- Properties parseAuthParams(String text)
- {
- int len = text.length();
- String key = null;
- StringBuffer buf = new StringBuffer();
- Properties ret = new Properties();
- boolean inQuote = false;
- for (int i = 0; i < len; i++)
- {
- char c = text.charAt(i);
- if (c == '"')
- {
- inQuote = !inQuote;
- }
- else if (c == '=' && key == null)
- {
- key = buf.toString().trim();
- buf.setLength(0);
- }
- else if (c == ' ' && !inQuote)
- {
- String value = unquote(buf.toString().trim());
- ret.put(key, value);
- key = null;
- buf.setLength(0);
- }
- else if (c != ',' || (i <(len - 1) && text.charAt(i + 1) != ' '))
- {
- buf.append(c);
- }
- }
- if (key != null)
- {
- String value = unquote(buf.toString().trim());
- ret.put(key, value);
- }
- return ret;
- }
-
- String unquote(String text)
- {
- int len = text.length();
- if (len > 0 && text.charAt(0) == '"' && text.charAt(len - 1) == '"')
- {
- return text.substring(1, len - 1);
- }
- return text;
- }
-
- /**
- * Returns the number of times the specified nonce value has been seen.
- * This always returns an 8-byte 0-padded hexadecimal string.
- */
- String getNonceCount(String nonce)
- {
- int nc = connection.getNonceCount(nonce);
- String hex = Integer.toHexString(nc);
- StringBuffer buf = new StringBuffer();
- for (int i = 8 - hex.length(); i > 0; i--)
- {
- buf.append('0');
- }
- buf.append(hex);
- return buf.toString();
- }
-
- /**
- * Client nonce value.
- */
- byte[] nonce;
-
- /**
- * Generates a new client nonce value.
- */
- byte[] generateNonce()
- throws IOException, NoSuchAlgorithmException
- {
- if (nonce == null)
- {
- long time = System.currentTimeMillis();
- MessageDigest md5 = MessageDigest.getInstance("MD5");
- md5.update(Long.toString(time).getBytes("US-ASCII"));
- nonce = md5.digest();
- }
- return nonce;
- }
-
- String toHexString(byte[] bytes)
- {
- char[] ret = new char[bytes.length * 2];
- for (int i = 0, j = 0; i < bytes.length; i++)
- {
- int c =(int) bytes[i];
- if (c < 0)
- {
- c += 0x100;
- }
- ret[j++] = Character.forDigit(c / 0x10, 0x10);
- ret[j++] = Character.forDigit(c % 0x10, 0x10);
- }
- return new String(ret);
- }
-
- /**
- * Parse the specified cookie list and notify the cookie manager.
- */
- void handleSetCookie(String text)
- {
- CookieManager cookieManager = connection.getCookieManager();
- if (cookieManager == null)
- {
- return;
- }
- String name = null;
- String value = null;
- String comment = null;
- String domain = connection.getHostName();
- String path = this.path;
- int lsi = path.lastIndexOf('/');
- if (lsi != -1)
- {
- path = path.substring(0, lsi);
- }
- boolean secure = false;
- Date expires = null;
-
- int len = text.length();
- String attr = null;
- StringBuffer buf = new StringBuffer();
- boolean inQuote = false;
- for (int i = 0; i <= len; i++)
- {
- char c =(i == len) ? '\u0000' : text.charAt(i);
- if (c == '"')
- {
- inQuote = !inQuote;
- }
- else if (!inQuote)
- {
- if (c == '=' && attr == null)
- {
- attr = buf.toString().trim();
- buf.setLength(0);
- }
- else if (c == ';' || i == len || c == ',')
- {
- String val = unquote(buf.toString().trim());
- if (name == null)
- {
- name = attr;
- value = val;
- }
- else if ("Comment".equalsIgnoreCase(attr))
- {
- comment = val;
- }
- else if ("Domain".equalsIgnoreCase(attr))
- {
- domain = val;
- }
- else if ("Path".equalsIgnoreCase(attr))
- {
- path = val;
- }
- else if ("Secure".equalsIgnoreCase(val))
- {
- secure = true;
- }
- else if ("Max-Age".equalsIgnoreCase(attr))
- {
- int delta = Integer.parseInt(val);
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(System.currentTimeMillis());
- cal.add(Calendar.SECOND, delta);
- expires = cal.getTime();
- }
- else if ("Expires".equalsIgnoreCase(attr))
- {
- DateFormat dateFormat = new HTTPDateFormat();
- try
- {
- expires = dateFormat.parse(val);
- }
- catch (ParseException e)
- {
- // if this isn't a valid date, it may be that
- // the value was returned unquoted; in that case, we
- // want to continue buffering the value
- buf.append(c);
- continue;
- }
- }
- attr = null;
- buf.setLength(0);
- // case EOL
- if (i == len || c == ',')
- {
- Cookie cookie = new Cookie(name, value, comment, domain,
- path, secure, expires);
- cookieManager.setCookie(cookie);
- }
- if (c == ',')
- {
- // Reset cookie fields
- name = null;
- value = null;
- comment = null;
- domain = connection.getHostName();
- path = this.path;
- if (lsi != -1)
- {
- path = path.substring(0, lsi);
- }
- secure = false;
- expires = null;
- }
- }
- else
- {
- buf.append(c);
- }
- }
- else
- {
- buf.append(c);
- }
- }
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/RequestBodyWriter.java b/libjava/gnu/java/net/protocol/http/RequestBodyWriter.java
deleted file mode 100644
index 05d98ebb81a..00000000000
--- a/libjava/gnu/java/net/protocol/http/RequestBodyWriter.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* RequestBodyWriter.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Callback interface for writing request body content.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface RequestBodyWriter
-{
-
- /**
- * Returns the total number of bytes that will be written in a single pass
- * by this writer.
- */
- int getContentLength();
-
- /**
- * Initialises the writer.
- * This will be called before each pass.
- */
- void reset();
-
- /**
- * Writes body content to the supplied buffer.
- * @param buffer the content buffer
- * @return the number of bytes written
- */
- int write(byte[] buffer);
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/Response.java b/libjava/gnu/java/net/protocol/http/Response.java
deleted file mode 100644
index 29dc28b17d3..00000000000
--- a/libjava/gnu/java/net/protocol/http/Response.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Response.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import java.util.Date;
-
-/**
- * An HTTP response.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Response
-{
-
- /**
- * The HTTP major version of the server issuing the response.
- */
- protected final int majorVersion;
-
- /**
- * The HTTP minor version of the server issuing the response.
- */
- protected final int minorVersion;
-
- /**
- * The HTTP status code of the response.
- */
- protected final int code;
-
- /**
- * The class of the response. This is the most significant digit of the
- * status code.
- *
- *
- */
- protected final int codeClass;
-
- /**
- * Human-readable text of the response.
- */
- protected final String message;
-
- /**
- * The response headers.
- */
- protected final Headers headers;
-
- /**
- * Constructs a new response with the specified parameters.
- */
- protected Response(int majorVersion, int minorVersion, int code,
- int codeClass, String message,
- Headers headers)
- {
- this.majorVersion = majorVersion;
- this.minorVersion = minorVersion;
- this.code = code;
- this.codeClass = codeClass;
- this.message = message;
- this.headers = headers;
- }
-
- /**
- * Returns the HTTP major version of the server issuing the response.
- * @see #majorVersion
- */
- public int getMajorVersion()
- {
- return majorVersion;
- }
-
- /**
- * Returns the HTTP minor version of the server issuing the response.
- * @see #minorVersion
- */
- public int getMinorVersion()
- {
- return minorVersion;
- }
-
- /**
- * Returns the HTTP status code of the response.
- * @see #code
- */
- public int getCode()
- {
- return code;
- }
-
- /**
- * Returns the class of the response.
- * @see #codeClass
- */
- public int getCodeClass()
- {
- return codeClass;
- }
-
- /**
- * Returns the human-readable text of the response.
- * @see #message
- */
- public String getMessage()
- {
- return message;
- }
-
- /**
- * Returns the headers in the response.
- */
- public Headers getHeaders()
- {
- return headers;
- }
-
- /**
- * Returns the header value for the specified name.
- * @param name the header name
- */
- public String getHeader(String name)
- {
- return headers.getValue(name);
- }
-
- /**
- * Returns the header value for the specified name as an integer.
- * @param name the header name
- */
- public int getIntHeader(String name)
- {
- return headers.getIntValue(name);
- }
-
- /**
- * Returns the header value for the specified name as a date.
- * @param name the header name
- */
- public Date getDateHeader(String name)
- {
- return headers.getDateValue(name);
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/ResponseBodyReader.java b/libjava/gnu/java/net/protocol/http/ResponseBodyReader.java
deleted file mode 100644
index 49e1b376f0f..00000000000
--- a/libjava/gnu/java/net/protocol/http/ResponseBodyReader.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ResponseBodyReader.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Callback interface for receiving notification of response body content.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface ResponseBodyReader
-{
-
- /**
- * Indicate whether this reader is interested in the specified response.
- * If it returns false, it will not receive body content notifications for
- * that response.
- */
- boolean accept(Request request, Response response);
-
- /**
- * Receive notification of body content.
- * @param buffer the content buffer
- * @param offset the offset within the buffer that content starts
- * @param length the length of the content
- */
- void read(byte[] buffer, int offset, int length);
-
- /**
- * Notifies the reader that the end of the content was reached.
- */
- void close();
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/ResponseHeaderHandler.java b/libjava/gnu/java/net/protocol/http/ResponseHeaderHandler.java
deleted file mode 100644
index 8e4e6492acf..00000000000
--- a/libjava/gnu/java/net/protocol/http/ResponseHeaderHandler.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ResponseHeaderHandler.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Callback interface for objects that wish to be notified of response
- * header values.
- * @see Request#setHeaderHandler(String)
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface ResponseHeaderHandler
-{
-
- /**
- * Sets the value for the header associated with this handler.
- */
- void setValue(String value);
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/SimpleCookieManager.java b/libjava/gnu/java/net/protocol/http/SimpleCookieManager.java
deleted file mode 100644
index 8947471885c..00000000000
--- a/libjava/gnu/java/net/protocol/http/SimpleCookieManager.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* CookieManager.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A simple non-persistent cookie manager. This class can be extended to
- * provide cookie persistence.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class SimpleCookieManager
- implements CookieManager
-{
-
- /**
- * The cookie cache.
- * This is a dictionary mapping domains to maps of cookies by name.
- */
- protected Map cookies;
-
- /**
- * Constructor.
- */
- public SimpleCookieManager()
- {
- cookies = new HashMap();
- }
-
- public void setCookie(Cookie cookie)
- {
- String domain = cookie.getDomain();
- Map map =(Map) cookies.get(domain);
- if (map == null)
- {
- map = new HashMap();
- cookies.put(domain, map);
- }
- String name = cookie.getName();
- map.put(name, cookie); // will replace a cookie of the same name
- }
-
- public Cookie[] getCookies(String host, boolean secure, String path)
- {
- List matches = new ArrayList();
- Date now = new Date();
- if (Character.isLetter(host.charAt(0)))
- {
- int di = host.indexOf('.');
- while (di != -1)
- {
- addCookies(matches, host, secure, path, now);
- host = host.substring(di);
- di = host.indexOf('.', 1);
- }
- }
- addCookies(matches, host, secure, path, now);
- Cookie[] ret = new Cookie[matches.size()];
- matches.toArray(ret);
- return ret;
- }
-
- private void addCookies(List matches, String domain, boolean secure,
- String path, Date now)
- {
- Map map = (Map) cookies.get(domain);
- if (map != null)
- {
- List expired = new ArrayList();
- for (Iterator i = map.entrySet().iterator(); i.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) i.next();
- Cookie cookie = (Cookie) entry.getValue();
- Date expires = cookie.getExpiryDate();
- if (expires != null && expires.before(now))
- {
- expired.add(entry.getKey());
- continue;
- }
- if (secure && !cookie.isSecure())
- {
- continue;
- }
- if (path.startsWith(cookie.getPath()))
- {
- matches.add(cookie);
- }
- }
- // Good housekeeping
- for (Iterator i = expired.iterator(); i.hasNext(); )
- {
- map.remove(i.next());
- }
- }
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/event/ConnectionEvent.java b/libjava/gnu/java/net/protocol/http/event/ConnectionEvent.java
deleted file mode 100644
index 3f6f5454e73..00000000000
--- a/libjava/gnu/java/net/protocol/http/event/ConnectionEvent.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ConnectionEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http.event;
-
-import java.util.EventObject;
-
-/**
- * A connection event.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class ConnectionEvent
- extends EventObject
-{
-
- /**
- * The connection closed event type.
- */
- public static final int CONNECTION_CLOSED = 0;
-
- /**
- * The type of this event.
- */
- protected int type;
-
- /**
- * Constructs a connection event with the specified source and type.
- */
- public ConnectionEvent(Object source, int type)
- {
- super(source);
- this.type = type;
- }
-
- /**
- * Returns the type of this event.
- * @see #type
- */
- public int getType()
- {
- return type;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/event/ConnectionListener.java b/libjava/gnu/java/net/protocol/http/event/ConnectionListener.java
deleted file mode 100644
index 073e89d4407..00000000000
--- a/libjava/gnu/java/net/protocol/http/event/ConnectionListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ConnectionListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http.event;
-
-import java.util.EventListener;
-
-/**
- * A connection listener.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface ConnectionListener
- extends EventListener
-{
-
- /**
- * Callback invoked when the associated connection is closed.
- */
- void connectionClosed(ConnectionEvent event);
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/event/RequestEvent.java b/libjava/gnu/java/net/protocol/http/event/RequestEvent.java
deleted file mode 100644
index 281c621f33f..00000000000
--- a/libjava/gnu/java/net/protocol/http/event/RequestEvent.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* RequestEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http.event;
-
-import gnu.java.net.protocol.http.Request;
-
-import java.util.EventObject;
-
-/**
- * A request event.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class RequestEvent
- extends EventObject
-{
-
- /**
- * The request created event type.
- */
- public static final int REQUEST_CREATED = 0;
-
- /**
- * The request sending event type.
- */
- public static final int REQUEST_SENDING = 1;
-
- /**
- * The request sent event type.
- */
- public static final int REQUEST_SENT = 2;
-
- /**
- * The type of this event.
- */
- protected int type;
-
- /**
- * The request associated with this event.
- */
- protected Request request;
-
- /**
- * Constructs a request event with the specified source, type, and request.
- */
- public RequestEvent(Object source, int type, Request request)
- {
- super(source);
- this.type = type;
- this.request = request;
- }
-
- /**
- * Returns the type of this event.
- * @see #type
- */
- public int getType()
- {
- return type;
- }
-
- /**
- * Returns the request associated with this event.
- */
- public Request getRequest()
- {
- return request;
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/http/event/RequestListener.java b/libjava/gnu/java/net/protocol/http/event/RequestListener.java
deleted file mode 100644
index c880fbce6f0..00000000000
--- a/libjava/gnu/java/net/protocol/http/event/RequestListener.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* RequestListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http.event;
-
-import java.util.EventListener;
-
-/**
- * A request listener.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface RequestListener
- extends EventListener
-{
-
- /**
- * Callback invoked when a request is created from the associated
- * connection.
- */
- void requestCreated(RequestEvent event);
-
- /**
- * Callback invoked when the request has been initialised with all data
- * and before sending this data to the server.
- */
- void requestSending(RequestEvent event);
-
- /**
- * Callback invoked after all request data has been sent to the server.
- */
- void requestSent(RequestEvent event);
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/https/Handler.java b/libjava/gnu/java/net/protocol/https/Handler.java
deleted file mode 100644
index 2b137517021..00000000000
--- a/libjava/gnu/java/net/protocol/https/Handler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Handler.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.https;
-
-import gnu.java.net.protocol.http.HTTPConnection;
-import gnu.java.net.protocol.http.HTTPURLConnection;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * An HTTPS URL stream handler.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class Handler
- extends URLStreamHandler
-{
-
- /**
- * Returns the default HTTPS port (443).
- */
- protected int getDefaultPort()
- {
- return HTTPConnection.HTTPS_PORT;
- }
-
- /**
- * Returns an HTTPURLConnection for the given URL.
- */
- public URLConnection openConnection(URL url)
- throws IOException
- {
- return new HTTPURLConnection(url);
- }
-
-}
-
diff --git a/libjava/gnu/java/net/protocol/jar/Handler.java b/libjava/gnu/java/net/protocol/jar/Handler.java
deleted file mode 100644
index d45411c47e5..00000000000
--- a/libjava/gnu/java/net/protocol/jar/Handler.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/* gnu.java.net.protocol.jar.Handler - jar protocol handler for java.net
- Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.jar;
-
-import gnu.java.net.URLParseError;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * @author Kresten Krab Thorup (krab@gnu.org)
- */
-public class Handler extends URLStreamHandler
-{
- /**
- * A do nothing constructor
- */
- public Handler()
- {
- }
-
- /**
- * This method returs a new JarURLConnection for the specified URL
- *
- * @param url The URL to return a connection for
- *
- * @return The URLConnection
- *
- * @exception IOException If an error occurs
- */
- protected URLConnection openConnection(URL url) throws IOException
- {
- return new Connection(url);
- }
-
- /**
- * This method overrides URLStreamHandler's for parsing url of protocol "jar"
- *
- * @param url The URL object in which to store the results
- * @param url_string The String-ized URL to parse
- * @param start The position in the string to start scanning from
- * @param end The position in the string to stop scanning
- */
- protected void parseURL (URL url, String url_string, int start, int end)
- {
- // This method does not throw an exception or return a value. Thus our
- // strategy when we encounter an error in parsing is to return without
- // doing anything.
- String file = url.getFile();
-
- if (!file.equals(""))
- { //has context url
- url_string = url_string.substring (start, end);
- if (url_string.startsWith("/"))
- { //url string is an absolute path
- int idx = file.lastIndexOf ("!/");
-
- if (idx < 0)
- throw new URLParseError("no !/ in spec");
-
- file = file.substring (0, idx + 1) + url_string;
- }
- else
- {
- int idx = file.lastIndexOf ("/");
- if (idx == -1) //context path is weird
- file = "/" + url_string;
- else if (idx == (file.length() - 1))
- //just concatenate two parts
- file = file + url_string;
- else
- // according to Java API Documentation, here is a little different
- // with URLStreamHandler.parseURL
- // but JDK seems doesn't handle it well
- file = file.substring(0, idx + 1) + url_string;
- }
-
- setURL (url, "jar", url.getHost(), url.getPort(), file, null);
- return;
- }
-
- // Bunches of things should be true. Make sure.
- if (end < start)
- return;
- if (end - start < 2)
- return;
- if (start > url_string.length())
- return;
-
- // Skip remains of protocol
- url_string = url_string.substring (start, end);
-
- int jar_stop;
- if ((jar_stop = url_string.indexOf("!/")) < 0)
- throw new URLParseError("no !/ in spec");
-
- try
- {
- new URL(url_string.substring (0, jar_stop));
- }
- catch (MalformedURLException e)
- {
- throw new URLParseError("invalid inner URL: " + e.getMessage());
- }
-
- if (!url.getProtocol().equals ("jar") )
- throw new URLParseError("unexpected protocol " + url.getProtocol());
-
- setURL (url, "jar", url.getHost(), url.getPort(), url_string, null);
- }
-
- /**
- * This method converts a Jar URL object into a String.
- *
- * @param url The URL object to convert
- */
- protected String toExternalForm (URL url)
- {
- String file = url.getFile();
-
- // return "jar:" + file;
- // Performance!!:
- // Do the concatenation manually to avoid resize StringBuffer's
- // internal buffer.
- StringBuffer sb = new StringBuffer (file.length() + 5);
- sb.append ("jar:");
- sb.append (file);
- return sb.toString();
- }
-}
diff --git a/libjava/gnu/java/nio/ChannelInputStream.java b/libjava/gnu/java/nio/ChannelInputStream.java
deleted file mode 100644
index 675a62f3d88..00000000000
--- a/libjava/gnu/java/nio/ChannelInputStream.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ChannelInputStream.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.nio;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.IllegalBlockingModeException;
-import java.nio.channels.ReadableByteChannel;
-import java.nio.channels.SelectableChannel;
-
-/**
- * @author Michael Koch
- */
-public final class ChannelInputStream extends InputStream
-{
- private ReadableByteChannel ch;
-
- public ChannelInputStream (ReadableByteChannel ch)
- {
- super();
-
- this.ch = ch;
- }
-
- public int read() throws IOException
- {
- if (ch instanceof SelectableChannel
- && (! ((SelectableChannel) ch).isBlocking()))
- throw new IllegalBlockingModeException();
-
- ByteBuffer buffer = ByteBuffer.allocate(1);
- int result = ch.read(buffer);
-
- if (result == -1)
- return -1;
-
- if (result == 0)
- throw new IOException("Could not read from channel");
-
- return buffer.get(0);
- }
-}
diff --git a/libjava/gnu/java/nio/ChannelOutputStream.java b/libjava/gnu/java/nio/ChannelOutputStream.java
deleted file mode 100644
index 08323eacec4..00000000000
--- a/libjava/gnu/java/nio/ChannelOutputStream.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ChannelOutputStream.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.nio;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.WritableByteChannel;
-
-/**
- * @author Michael Koch
- */
-public final class ChannelOutputStream extends OutputStream
-{
- private WritableByteChannel ch;
-
- public ChannelOutputStream (WritableByteChannel ch)
- {
- super();
-
- this.ch = ch;
- }
-
- public void write (int value) throws IOException
- {
- ByteBuffer buffer = ByteBuffer.allocate (1);
- buffer.put ((byte) (value & 0xff));
- buffer.flip();
- ch.write (buffer);
- }
-}
diff --git a/libjava/gnu/java/nio/ChannelReader.java b/libjava/gnu/java/nio/ChannelReader.java
deleted file mode 100644
index 44fe6625a3b..00000000000
--- a/libjava/gnu/java/nio/ChannelReader.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/* ChannelReader.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
-
-
-package gnu.java.nio;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.channels.ReadableByteChannel;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
-
-/**
- * A Reader implementation that works using a ReadableByteChannel and a
- * CharsetDecoder.
- *
- * 1xx
2xx
3xx
4xx
5xx
c
to out
in the byte order
- * specified by byteOrder
.
- **/
- private void put (ByteBuffer out, char c)
- {
- if (byteOrder == BIG_ENDIAN)
- {
- out.put ((byte) (c >> 8));
- out.put ((byte) (c & 0xFF));
- }
- else
- {
- out.put ((byte) (c & 0xFF));
- out.put ((byte) (c >> 8));
- }
- }
-
- protected void implReset ()
- {
- needsByteOrderMark = useByteOrderMark;
- }
-
- // TODO: override canEncode(char) and canEncode(CharSequence)
- // for performance
-}
diff --git a/libjava/gnu/java/nio/charset/UTF_16LE.java b/libjava/gnu/java/nio/charset/UTF_16LE.java
deleted file mode 100644
index 952f4aa1700..00000000000
--- a/libjava/gnu/java/nio/charset/UTF_16LE.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* UTF_16LE.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.nio.charset;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-
-/**
- * UTF-16LE charset.
- *
- * @author Jesse Rosenstock
- */
-final class UTF_16LE extends Charset
-{
- UTF_16LE ()
- {
- super ("UTF-16LE", new String[] {
- // witnessed by the internet
- "UTF16LE",
- /* These names are provided by
- * http://oss.software.ibm.com/cgi-bin/icu/convexp?s=ALL
- */
- "x-utf-16le", "ibm-1202", "ibm-13490", "ibm-17586",
- "UTF16_LittleEndian",
- // see http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html
- "UnicodeLittleUnmarked"
- });
- }
-
- public boolean contains (Charset cs)
- {
- return cs instanceof US_ASCII || cs instanceof ISO_8859_1
- || cs instanceof UTF_8 || cs instanceof UTF_16BE
- || cs instanceof UTF_16LE || cs instanceof UTF_16;
- }
-
- public CharsetDecoder newDecoder ()
- {
- return new UTF_16Decoder (this, UTF_16Decoder.LITTLE_ENDIAN);
- }
-
- public CharsetEncoder newEncoder ()
- {
- return new UTF_16Encoder (this, UTF_16Encoder.LITTLE_ENDIAN, true);
- }
-}
diff --git a/libjava/gnu/java/nio/charset/UTF_8.java b/libjava/gnu/java/nio/charset/UTF_8.java
deleted file mode 100644
index 12f15e1b0c2..00000000000
--- a/libjava/gnu/java/nio/charset/UTF_8.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/* UTF_8.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.nio.charset;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-
-/**
- * UTF-8 charset.
- *
- *
- *
- *
- * @author Jesse Rosenstock
- */
-final class UTF_8 extends Charset
-{
- UTF_8 ()
- {
- super ("UTF-8", new String[] {
- /* These names are provided by
- * http://oss.software.ibm.com/cgi-bin/icu/convexp?s=ALL
- */
- "ibm-1208", "ibm-1209", "ibm-5304", "ibm-5305",
- "windows-65001", "cp1208",
- // see http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html
- "UTF8"
- });
- }
-
- public boolean contains (Charset cs)
- {
- return cs instanceof US_ASCII || cs instanceof ISO_8859_1
- || cs instanceof UTF_8 || cs instanceof UTF_16BE
- || cs instanceof UTF_16LE || cs instanceof UTF_16;
- }
-
- public CharsetDecoder newDecoder ()
- {
- return new Decoder (this);
- }
-
- public CharsetEncoder newEncoder ()
- {
- return new Encoder (this);
- }
-
- private static final class Decoder extends CharsetDecoder
- {
- // Package-private to avoid a trampoline constructor.
- Decoder (Charset cs)
- {
- super (cs, 1.0f, 1.0f);
- }
-
- protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
- {
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- int inPos = in.position();
- try
- {
- while (in.hasRemaining ())
- {
- char c;
- byte b1 = in.get ();
- int highNibble = (b1 >> 4) & 0xF;
-
- switch (highNibble)
- {
- case 0: case 1: case 2: case 3:
- case 4: case 5: case 6: case 7:
- if (out.remaining () < 1)
- return CoderResult.OVERFLOW;
- out.put ((char) b1);
- inPos++;
- break;
-
- case 0xC: case 0xD:
- byte b2;
- if (in.remaining () < 1)
- return CoderResult.UNDERFLOW;
- if (out.remaining () < 1)
- return CoderResult.OVERFLOW;
- if (!isContinuation (b2 = in.get ()))
- return CoderResult.malformedForLength (1);
- c = (char) (((b1 & 0x1F) << 6) | (b2 & 0x3F));
- // check that we had the shortest encoding
- if (c <= 0x7F)
- return CoderResult.malformedForLength (2);
- out.put (c);
- inPos += 2;
- break;
-
- case 0xE:
- byte b3;
- if (in.remaining () < 2)
- return CoderResult.UNDERFLOW;
- if (out.remaining () < 1)
- return CoderResult.OVERFLOW;
- if (!isContinuation (b2 = in.get ()))
- return CoderResult.malformedForLength (1);
- if (!isContinuation (b3 = in.get ()))
- return CoderResult.malformedForLength (1);
- c = (char) (((b1 & 0x0F) << 12)
- | ((b2 & 0x3F) << 6)
- | (b3 & 0x3F));
- // check that we had the shortest encoding
- if (c <= 0x7FF)
- return CoderResult.malformedForLength (3);
- out.put (c);
- inPos += 3;
- break;
-
- default:
- return CoderResult.malformedForLength (1);
- }
- }
-
- return CoderResult.UNDERFLOW;
- }
- finally
- {
- // In case we did a get(), then encountered an error, reset the
- // position to before the error. If there was no error, this
- // will benignly reset the position to the value it already has.
- in.position (inPos);
- }
- }
-
- private static boolean isContinuation (byte b)
- {
- return (b & 0xC0) == 0x80;
- }
- }
-
- private static final class Encoder extends CharsetEncoder
- {
- // Package-private to avoid a trampoline constructor.
- Encoder (Charset cs)
- {
- // According to
- // http://www-106.ibm.com/developerworks/unicode/library/utfencodingforms/index.html
- // On average, English takes slightly over one unit per code point.
- // Most Latin-script languages take about 1.1 bytes. Greek, Russian,
- // Arabic and Hebrew take about 1.7 bytes, and most others (including
- // Japanese, Chinese, Korean and Hindi) take about 3 bytes.
- // We assume we will be dealing with latin scripts, and use 1.1
- // for averageBytesPerChar.
- super (cs, 1.1f, 4.0f);
- }
-
- protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
- {
- int inPos = in.position();
- try
- {
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- while (in.hasRemaining ())
- {
- int remaining = out.remaining ();
- char c = in.get ();
-
- // UCS-4 range (hex.) UTF-8 octet sequence (binary)
- // 0000 0000-0000 007F 0xxxxxxx
- // 0000 0080-0000 07FF 110xxxxx 10xxxxxx
- // 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
-
- // Scalar Value UTF-16 byte 1 byte 2 byte 3 byte 4
- // 0000 0000 0xxx xxxx 0000 0000 0xxx xxxx 0xxx xxxx
- // 0000 0yyy yyxx xxxx 0000 0yyy yyxx xxxx 110y yyyy 10xx xxxx
- // zzzz yyyy yyxx xxxx zzzz yyyy yyxx xxxx 1110 zzzz 10yy yyyy 10xx xxxx
- // u uuuu zzzz yyyy yyxx xxxx 1101 10ww wwzz zzyy 1111 0uuu 10uu zzzz 10yy yyyy 10xx xxxx
- // + 1101 11yy yyxx xxxx
- // Note: uuuuu = wwww + 1
-
- if (c <= 0x7F)
- {
- if (remaining < 1)
- return CoderResult.OVERFLOW;
- out.put ((byte) c);
- inPos++;
- }
- else if (c <= 0x7FF)
- {
- if (remaining < 2)
- return CoderResult.OVERFLOW;
- out.put ((byte) (0xC0 | (c >> 6)));
- out.put ((byte) (0x80 | (c & 0x3F)));
- inPos++;
- }
- else if (0xD800 <= c && c <= 0xDFFF)
- {
- if (remaining < 4)
- return CoderResult.OVERFLOW;
-
- // we got a low surrogate without a preciding high one
- if (c > 0xDBFF)
- return CoderResult.malformedForLength (1);
-
- // high surrogates
- if (!in.hasRemaining ())
- return CoderResult.UNDERFLOW;
-
- char d = in.get ();
-
- // make sure d is a low surrogate
- if (d < 0xDC00 || d > 0xDFFF)
- return CoderResult.malformedForLength (1);
-
- // make the 32 bit value
- // int value2 = (c - 0xD800) * 0x400 + (d - 0xDC00) + 0x10000;
- int value = (((c & 0x3FF) << 10) | (d & 0x3FF)) + 0x10000;
- // assert value == value2;
- out.put ((byte) (0xF0 | (value >> 18)));
- out.put ((byte) (0x80 | ((value >> 12) & 0x3F)));
- out.put ((byte) (0x80 | ((value >> 6) & 0x3F)));
- out.put ((byte) (0x80 | ((value ) & 0x3F)));
-
- inPos += 2;
- }
- else
- {
- if (remaining < 3)
- return CoderResult.OVERFLOW;
-
- out.put ((byte) (0xE0 | (c >> 12)));
- out.put ((byte) (0x80 | ((c >> 6) & 0x3F)));
- out.put ((byte) (0x80 | (c & 0x3F)));
- inPos++;
- }
- }
-
- return CoderResult.UNDERFLOW;
- }
- finally
- {
- // In case we did a get(), then encountered an error, reset the
- // position to before the error. If there was no error, this
- // will benignly reset the position to the value it already has.
- in.position (inPos);
- }
- }
- }
-}
diff --git a/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java b/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java
deleted file mode 100644
index 140069379bc..00000000000
--- a/libjava/gnu/java/rmi/RMIMarshalledObjectInputStream.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* gnu.java.rmi.RMIMarshalledObjectInputStream
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi;
-
-import gnu.java.rmi.server.RMIObjectInputStream;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-
-/**
- * This class is only for java.rmi.MarshalledObject to deserialize object from
- * objBytes and locBytes
- */
-
-public class RMIMarshalledObjectInputStream extends RMIObjectInputStream
-{
- private ObjectInputStream locStream;
-
- public RMIMarshalledObjectInputStream(byte[] objBytes, byte[] locBytes) throws IOException
- {
- super(new ByteArrayInputStream(objBytes));
- if(locBytes != null)
- locStream = new ObjectInputStream(new ByteArrayInputStream(locBytes));
- }
-
- //This method overrides RMIObjectInputStream's
- protected Object getAnnotation() throws IOException, ClassNotFoundException
- {
- if(locStream == null)
- return null;
- return locStream.readObject();
- }
-
-} // End of RMIMarshalledObjectInputStream
diff --git a/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java b/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java
deleted file mode 100644
index 2bbbaacb45f..00000000000
--- a/libjava/gnu/java/rmi/RMIMarshalledObjectOutputStream.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* gnu.java.rmi.RMIMarshalledObjectOutputStream
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi;
-
-import gnu.java.rmi.server.RMIObjectOutputStream;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-
-/**
- * This class is only for java.rmi.MarshalledObject to serialize object and
- * got objBytes and locBytes
- */
-public class RMIMarshalledObjectOutputStream extends RMIObjectOutputStream
-{
- private ObjectOutputStream locStream;
- private ByteArrayOutputStream locBytesStream;
-
- public RMIMarshalledObjectOutputStream(OutputStream objStream) throws IOException
- {
- super(objStream);
- locBytesStream = new ByteArrayOutputStream(256);
- locStream = new ObjectOutputStream(locBytesStream);
- }
-
- //This method overrides RMIObjectOutputStream's.
- protected void setAnnotation(String annotation) throws IOException{
- locStream.writeObject(annotation);
- }
-
- public void flush() throws IOException {
- super.flush();
- locStream.flush();
- }
-
- public byte[] getLocBytes(){
- return locBytesStream.toByteArray();
- }
-
-} // End of RMIMarshalledObjectOutputStream
-
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl.java b/libjava/gnu/java/rmi/dgc/DGCImpl.java
deleted file mode 100644
index a32445c343b..00000000000
--- a/libjava/gnu/java/rmi/dgc/DGCImpl.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/* DGCImpl.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.dgc;
-
-import gnu.java.rmi.server.UnicastServerRef;
-
-import java.rmi.RemoteException;
-import java.rmi.dgc.DGC;
-import java.rmi.dgc.Lease;
-import java.rmi.dgc.VMID;
-import java.rmi.server.ObjID;
-import java.rmi.server.RMISocketFactory;
-import java.util.Hashtable;
-
-/**
- * I let DGCImpl to extend UnicastServerRef, but not
- * UnicastRemoteObject, because UnicastRemoteObject must
- * exportObject automatically.
- */
-public class DGCImpl
- extends UnicastServerRef implements DGC {
-
- private static final long LEASE_VALUE = 600000L;
- // leaseCache caches a LeaseRecord associated with a vmid
- private Hashtable leaseCache = new Hashtable();
-
-public DGCImpl() throws RemoteException {
- super(new ObjID(ObjID.DGC_ID), 0, RMISocketFactory.getSocketFactory());
-}
-
-public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException {
- VMID vmid = lease.getVMID();
- if (vmid == null)
- vmid = new VMID();
- long leaseValue = LEASE_VALUE;
- //long leaseValue = lease.getValue();
- lease = new Lease(vmid, leaseValue);
- synchronized(leaseCache){
- LeaseRecord lr = (LeaseRecord)leaseCache.get(vmid);
- if (lr != null)
- lr.reset(leaseValue);
- else{
- lr = new LeaseRecord(vmid, leaseValue);
- leaseCache.put(vmid, lr);
- }
- }
-
- return (lease);
-}
-
-public void clean(ObjID[] ids, long sequenceNum, VMID vmid, boolean strong) throws RemoteException {
- // Not implemented
-}
-
- /**
- * LeaseRecord associates a vmid to expireTime.
- */
- private static class LeaseRecord{
- private VMID vmid;
- private long expireTime;
-
- LeaseRecord(VMID vmid, long leaseValue){
- this.vmid = vmid;
- reset(leaseValue);
- }
-
- // reset expireTime
- void reset(long leaseValue){
- long l = System.currentTimeMillis();
- expireTime = l + leaseValue;
- }
-
- boolean isExpired(){
- long l = System.currentTimeMillis();
- if ( l > expireTime)
- return true;
- return false;
- }
-
- } //End of LeaseRecord
-
-} //End of DGCImpl
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java b/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
deleted file mode 100644
index 5f032e72f8a..00000000000
--- a/libjava/gnu/java/rmi/dgc/DGCImpl_Skel.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/* DGCImpl_Skel.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Skel class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.dgc;
-
-public final class DGCImpl_Skel
- implements java.rmi.server.Skeleton
-{
- private static final long interfaceHash = -669196253586618813L;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean"),
- new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease")
- };
-
- public java.rmi.server.Operation[] getOperations() {
- return ((java.rmi.server.Operation[]) operations.clone());
- }
-
- public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
- if (opnum < 0) {
- if (hash == -5803803475088455571L) {
- opnum = 0;
- }
- else if (hash == -8139341527526761862L) {
- opnum = 1;
- }
- else {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
- }
- else if (hash != interfaceHash) {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
-
- gnu.java.rmi.dgc.DGCImpl server = (gnu.java.rmi.dgc.DGCImpl)obj;
- switch (opnum) {
- case 0:
- {
- java.rmi.server.ObjID[] $param_0;
- long $param_1;
- java.rmi.dgc.VMID $param_2;
- boolean $param_3;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.rmi.server.ObjID[])in.readObject();
- $param_1 = (long)in.readLong();
- $param_2 = (java.rmi.dgc.VMID)in.readObject();
- $param_3 = (boolean)in.readBoolean();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.clean($param_0, $param_1, $param_2, $param_3);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 1:
- {
- java.rmi.server.ObjID[] $param_0;
- long $param_1;
- java.rmi.dgc.Lease $param_2;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.rmi.server.ObjID[])in.readObject();
- $param_1 = (long)in.readLong();
- $param_2 = (java.rmi.dgc.Lease)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- java.rmi.dgc.Lease $result = server.dirty($param_0, $param_1, $param_2);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- out.writeObject($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- default:
- throw new java.rmi.UnmarshalException("invalid method number");
- }
- }
-}
diff --git a/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java b/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
deleted file mode 100644
index b1e086a73b2..00000000000
--- a/libjava/gnu/java/rmi/dgc/DGCImpl_Stub.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/* DGCImpl_Stub.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Stub class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.dgc;
-
-public final class DGCImpl_Stub
- extends java.rmi.server.RemoteStub
- implements java.rmi.dgc.DGC
-{
- private static final long serialVersionUID = 2L;
-
- private static final long interfaceHash = -669196253586618813L;
-
- private static boolean useNewInvoke;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean)"),
- new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)")
- };
-
- private static java.lang.reflect.Method $method_clean_0;
- private static java.lang.reflect.Method $method_dirty_1;
-
- static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });
- useNewInvoke = true;
- $method_clean_0 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("clean", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.VMID.class, boolean.class});
- $method_dirty_1 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("dirty", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.Lease.class});
-
- }
- catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
- }
-
- public DGCImpl_Stub() {
- super();
- }
- public DGCImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
- }
-
- public void clean(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.VMID $param_2, boolean $param_3) throws java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, new java.lang.Boolean($param_3)}, -5803803475088455571L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeLong($param_1);
- out.writeObject($param_2);
- out.writeBoolean($param_3);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.Lease $param_2) throws java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- java.lang.Object $result = ref.invoke(this, $method_dirty_1, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2}, -8139341527526761862L);
- return ((java.rmi.dgc.Lease)$result);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 1, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeLong($param_1);
- out.writeObject($param_2);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.rmi.dgc.Lease $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.dgc.Lease)in.readObject();
- return ($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
-}
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl.java b/libjava/gnu/java/rmi/registry/RegistryImpl.java
deleted file mode 100644
index 0c94434d806..00000000000
--- a/libjava/gnu/java/rmi/registry/RegistryImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/* RegistryImpl.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.registry;
-
-import gnu.java.rmi.server.UnicastServerRef;
-
-import java.rmi.AccessException;
-import java.rmi.AlreadyBoundException;
-import java.rmi.NotBoundException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.rmi.server.ObjID;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RMIServerSocketFactory;
-import java.rmi.server.RMISocketFactory;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-public class RegistryImpl
- extends UnicastRemoteObject implements Registry {
-
-private Hashtable bindings = new Hashtable();
-
-public RegistryImpl(int port) throws RemoteException {
- this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory());
-}
-
-public RegistryImpl(int port, RMIClientSocketFactory cf, RMIServerSocketFactory sf) throws RemoteException {
- super(new UnicastServerRef(new ObjID(ObjID.REGISTRY_ID), port, sf));
- // The following is unnecessary, because UnicastRemoteObject export itself automatically.
- //((UnicastServerRef)getRef()).exportObject(this);
-}
-
-public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException {
- Object obj = bindings.get(name);
- if (obj == null) {
- throw new NotBoundException(name);
- }
- return ((Remote)obj);
-}
-
-public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException {
- if (bindings.containsKey(name)) {
- throw new AlreadyBoundException(name);
- }
- bindings.put(name, obj);
-}
-
-public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
- Object obj = bindings.remove(name);
- if (obj == null) {
- throw new NotBoundException(name);
- }
-}
-
-public void rebind(String name, Remote obj) throws RemoteException, AccessException {
- bindings.put(name, obj);
-}
-
-public String[] list() throws RemoteException, AccessException {
- int size = bindings.size();
- String[] strings = new String[size];
- Enumeration e = bindings.keys();
- for (int i = 0; i < size; i++) {
- strings[i] = (String)e.nextElement();
- }
- return (strings);
-}
-
-public static void version() {
- System.out.println("rmiregistry ("
- + System.getProperty("java.vm.name")
- + ") "
- + System.getProperty("java.vm.version"));
- System.out.println("Copyright 2005 Free Software Foundation, Inc.");
- System.out.println("This is free software; see the source for copying conditions. There is NO");
- System.out.println("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
- System.exit(0);
-}
-
-public static void help() {
- System.out.println(
-"Usage: rmiregistry [OPTION | PORT]\n" +
-"\n" +
-" --help Print this help, then exit\n" +
-" --version Print version number, then exit\n");
- System.exit(0);
-}
-
-public static void main(String[] args) {
- int port = Registry.REGISTRY_PORT;
- if (args.length > 0) {
- if (args[0].equals("--version")) {
- version();
- }
- else if (args[0].equals("--help")) {
- help();
- }
- try {
- port = Integer.parseInt(args[0]);
- }
- catch (NumberFormatException _) {
- System.err.println("Bad port number - using default");
- }
- }
-
- try {
- Registry impl = LocateRegistry.createRegistry(port);
- }
- catch (RemoteException _) {
- System.err.println("Registry failed");
- }
-}
-
-}
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java b/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
deleted file mode 100644
index 8cf14ccc0c4..00000000000
--- a/libjava/gnu/java/rmi/registry/RegistryImpl_Skel.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/* RegistryImpl_Skel.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Skel class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.registry;
-
-public final class RegistryImpl_Skel
- implements java.rmi.server.Skeleton
-{
- private static final long interfaceHash = 4905912898345647071L;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote"),
- new java.rmi.server.Operation("java.lang.String[] list("),
- new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String"),
- new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote"),
- new java.rmi.server.Operation("void unbind(java.lang.String")
- };
-
- public java.rmi.server.Operation[] getOperations() {
- return ((java.rmi.server.Operation[]) operations.clone());
- }
-
- public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
- if (opnum < 0) {
- if (hash == 7583982177005850366L) {
- opnum = 0;
- }
- else if (hash == 2571371476350237748L) {
- opnum = 1;
- }
- else if (hash == -7538657168040752697L) {
- opnum = 2;
- }
- else if (hash == -8381844669958460146L) {
- opnum = 3;
- }
- else if (hash == 7305022919901907578L) {
- opnum = 4;
- }
- else {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
- }
- else if (hash != interfaceHash) {
- throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
- }
-
- gnu.java.rmi.registry.RegistryImpl server = (gnu.java.rmi.registry.RegistryImpl)obj;
- switch (opnum) {
- case 0:
- {
- java.lang.String $param_0;
- java.rmi.Remote $param_1;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
- $param_1 = (java.rmi.Remote)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.bind($param_0, $param_1);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 1:
- {
- try {
- java.io.ObjectInput in = call.getInputStream();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- java.lang.String[] $result = server.list();
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- out.writeObject($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 2:
- {
- java.lang.String $param_0;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- java.rmi.Remote $result = server.lookup($param_0);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- out.writeObject($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 3:
- {
- java.lang.String $param_0;
- java.rmi.Remote $param_1;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
- $param_1 = (java.rmi.Remote)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.rebind($param_0, $param_1);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- case 4:
- {
- java.lang.String $param_0;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $param_0 = (java.lang.String)in.readObject();
-
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- catch (java.lang.ClassCastException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
- }
- finally {
- call.releaseInputStream();
- }
- server.unbind($param_0);
- try {
- java.io.ObjectOutput out = call.getResultStream(true);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling return", e);
- }
- break;
- }
-
- default:
- throw new java.rmi.UnmarshalException("invalid method number");
- }
- }
-}
diff --git a/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java b/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
deleted file mode 100644
index b289426b4fc..00000000000
--- a/libjava/gnu/java/rmi/registry/RegistryImpl_Stub.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/* RegistryImpl_Stub.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-// Stub class generated by rmic - DO NOT EDIT!
-
-package gnu.java.rmi.registry;
-
-public final class RegistryImpl_Stub
- extends java.rmi.server.RemoteStub
- implements java.rmi.registry.Registry
-{
- private static final long serialVersionUID = 2L;
-
- private static final long interfaceHash = 4905912898345647071L;
-
- private static boolean useNewInvoke;
-
- private static final java.rmi.server.Operation[] operations = {
- new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),
- new java.rmi.server.Operation("java.lang.String[] list()"),
- new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),
- new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),
- new java.rmi.server.Operation("void unbind(java.lang.String)")
- };
-
- private static java.lang.reflect.Method $method_bind_0;
- private static java.lang.reflect.Method $method_list_1;
- private static java.lang.reflect.Method $method_lookup_2;
- private static java.lang.reflect.Method $method_rebind_3;
- private static java.lang.reflect.Method $method_unbind_4;
-
- static {
- try {
- java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });
- useNewInvoke = false;
- $method_bind_0 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("bind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class});
- $method_list_1 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("list", new java.lang.Class[] {});
- $method_lookup_2 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("lookup", new java.lang.Class[] {java.lang.String.class});
- $method_rebind_3 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("rebind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class});
- $method_unbind_4 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("unbind", new java.lang.Class[] {java.lang.String.class});
-
- }
- catch (java.lang.NoSuchMethodException e) {
- useNewInvoke = false;
- }
- }
-
- public RegistryImpl_Stub() {
- super();
- }
- public RegistryImpl_Stub(java.rmi.server.RemoteRef ref) {
- super(ref);
- }
-
- public void bind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_bind_0, new java.lang.Object[] {$param_0, $param_1}, 7583982177005850366L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeObject($param_1);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.AlreadyBoundException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public java.lang.String[] list() throws java.rmi.AccessException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- java.lang.Object $result = ref.invoke(this, $method_list_1, null, 2571371476350237748L);
- return ((java.lang.String[])$result);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 1, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.lang.String[] $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.lang.String[])in.readObject();
- return ($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public java.rmi.Remote lookup(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- java.lang.Object $result = ref.invoke(this, $method_lookup_2, new java.lang.Object[] {$param_0}, -7538657168040752697L);
- return ((java.rmi.Remote)$result);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 2, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- java.rmi.Remote $result;
- try {
- java.io.ObjectInput in = call.getInputStream();
- $result = (java.rmi.Remote)in.readObject();
- return ($result);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.NotBoundException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public void rebind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_rebind_3, new java.lang.Object[] {$param_0, $param_1}, -8381844669958460146L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 3, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- out.writeObject($param_1);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
- public void unbind(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException {
- try {
- if (useNewInvoke) {
- ref.invoke(this, $method_unbind_4, new java.lang.Object[] {$param_0}, 7305022919901907578L);
- }
- else {
- java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 4, interfaceHash);
- try {
- java.io.ObjectOutput out = call.getOutputStream();
- out.writeObject($param_0);
- }
- catch (java.io.IOException e) {
- throw new java.rmi.MarshalException("error marshalling arguments", e);
- }
- ref.invoke(call);
- try {
- java.io.ObjectInput in = call.getInputStream();
- }
- catch (java.io.IOException e) {
- throw new java.rmi.UnmarshalException("error unmarshalling return", e);
- }
- finally {
- ref.done(call);
- }
- }
- }
- catch (java.rmi.AccessException e) {
- throw e;
- }
- catch (java.rmi.NotBoundException e) {
- throw e;
- }
- catch (java.rmi.RemoteException e) {
- throw e;
- }
- catch (java.lang.Exception e) {
- throw new java.rmi.UnexpectedException("undeclared checked exception", e);
- }
- }
-
-}
diff --git a/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java b/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java
deleted file mode 100644
index 9cc57b2289f..00000000000
--- a/libjava/gnu/java/rmi/server/ConnectionRunnerPool.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/* gnu.java.rmi.server.ConnectionRunnerPool
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-//Should I generalize this class?
-
-class ConnectionRunnerPool
-{
-
- public static
- class ConnectionRunner extends Thread{
- private UnicastConnection conn;
- private volatile boolean exiting = false;
-
- public ConnectionRunner(ThreadGroup group, String id){
- super(group, id);
- }
-
- public synchronized void run(){
- while(!exiting){
- if(conn == null)
- try{
- wait();
- }catch(InterruptedException e){
- continue;
- }
- else{
- conn.run();
- conn = null;
- synchronized(ConnectionRunnerPool.class){
- freelist.add(this);
- if(freelist.size() == 1)
- ConnectionRunnerPool.class.notifyAll();
- }
- }
- }
- }
-
- public synchronized void dispatch(UnicastConnection conn){
- this.conn = conn;
- notify();
- }
-
- void exit(){
- exiting = true;
- if(conn != null)
- try{
- join(500);
- }catch(InterruptedException e){}
- interrupt();
- }
-
- }
-
- // Should this value equal to number of CPU?
- private static int size = 5;
- private static int max_size = 10;
-
- // Package-private to avoid a trampoline.
- static ArrayList freelist;
-
- private static ThreadGroup group = new ThreadGroup("pool");
-
- static {
- ConnectionRunner[] pools = new ConnectionRunner[size];
- for(int i = 0; i < pools.length; i++){
- pools[i] = new ConnectionRunner(group, new Integer(i).toString());
- pools[i].setContextClassLoader(Thread.currentThread().getContextClassLoader());
- pools[i].start();
- }
- freelist = new ArrayList(Arrays.asList(pools));
- }
-
- public static void setSize(int size_){
- size = size_;
- }
-
- public static void setMaxSize(int size){
- max_size = size;
- }
-
- private static synchronized ConnectionRunner getConnectionRunner()
- {
- if(freelist.size() == 0){
- if(size < max_size){
- ++size;
- ConnectionRunner a = new ConnectionRunner(group, new Integer(size).toString());
- a.start();
- freelist.add(a);
- }else
- while(freelist.size() == 0)
- try{
- ConnectionRunnerPool.class.wait();
- }catch(InterruptedException e){}
- }
-
- // always let the first in pool most busy or other scheduling plan??
- ConnectionRunner a = (ConnectionRunner)freelist.get(0);
- freelist.remove(a);
- return a;
- }
-
- public static void dispatchConnection(UnicastConnection conn)
- {
- ConnectionRunner r = getConnectionRunner();
- r.dispatch(conn);
- }
-
- public static void exit()
- {
- Thread[] list = new Thread[group.activeCount()];
- group.enumerate(list);
- for(int i = 0; i < list.length; i++)
- ((ConnectionRunner)list[i]).exit();
- }
-
-}
diff --git a/libjava/gnu/java/rmi/server/ProtocolConstants.java b/libjava/gnu/java/rmi/server/ProtocolConstants.java
deleted file mode 100644
index 30fb5e89b39..00000000000
--- a/libjava/gnu/java/rmi/server/ProtocolConstants.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ProtocolConstants.java --
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-public interface ProtocolConstants
-{
- int PROTOCOL_HEADER = 0x4a524d49; // JRMI
- int PROTOCOL_VERSION = 2;
-
- int STREAM_PROTOCOL = 0x4b;
- int SINGLE_OP_PROTOCOL = 0x4c;
- int MULTIPLEX_PROTOCOL = 0x4d;
-
- int PROTOCOL_ACK = 0x4e;
- int PROTOCOL_NACK = 0x4f;
-
- int MESSAGE_CALL = 0x50;
- int MESSAGE_CALL_ACK = 0x51;
- int MESSAGE_PING = 0x52;
- int MESSAGE_PING_ACK = 0x53;
- int MESSAGE_DGCACK = 0x54;
-
- int RETURN_ACK = 0x01;
- int RETURN_NACK = 0x02;
-
- int DEFAULT_PROTOCOL = STREAM_PROTOCOL;
-}
diff --git a/libjava/gnu/java/rmi/server/RMIDefaultSocketFactory.java b/libjava/gnu/java/rmi/server/RMIDefaultSocketFactory.java
deleted file mode 100644
index 628e1cc8799..00000000000
--- a/libjava/gnu/java/rmi/server/RMIDefaultSocketFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* RMIDefaultSocketFactory.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.rmi.server.RMISocketFactory;
-
-public class RMIDefaultSocketFactory
- extends RMISocketFactory {
-
-public RMIDefaultSocketFactory() {
-}
-
-public Socket createSocket(String host, int port) throws IOException {
- return (new Socket(host, port));
-}
-
-public ServerSocket createServerSocket(int port) throws IOException {
- return (new ServerSocket(port));
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIHashes.java b/libjava/gnu/java/rmi/server/RMIHashes.java
deleted file mode 100644
index 5a414404d4f..00000000000
--- a/libjava/gnu/java/rmi/server/RMIHashes.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* RMIHashes.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import gnu.java.lang.reflect.TypeSignature;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.lang.reflect.Method;
-import java.security.MessageDigest;
-
-public class RMIHashes
-{
- //There're other places using DigestOutputStream to generate hash in classpath, but I think the way I used
- //here is more efficient, anyway, you can switch to DigestOutputStream by doing like "//or:" comments say.
-
- //or:add this statement: private static final NullOutputStream nullOutputStream = new NullOutputStream ();
- public static long getMethodHash(Method meth)
- {
- //Object Serialization Spec 8.3
- try
- {
- MessageDigest md = MessageDigest.getInstance ("SHA");
- //or:remove this statement: DigestOutputStream digest_out = new DigestOutputStream (nullOutputStream, md);
- ByteArrayOutputStream digest_out = new ByteArrayOutputStream();
- DataOutputStream data_out = new DataOutputStream (digest_out);
-
- StringBuffer sbuf = new StringBuffer();
- sbuf.append(meth.getName());
- sbuf.append('(');
- Class params[] = meth.getParameterTypes();
- for(int i = 0; i < params.length; i++)
- sbuf.append(TypeSignature.getEncodingOfClass(params[i]));
- sbuf.append(')');
- Class rcls = meth.getReturnType();
- if(rcls != Void.TYPE)
- sbuf.append(TypeSignature.getEncodingOfClass(rcls));
- else
- sbuf.append('V');
-
- data_out.writeUTF (sbuf.toString());
- data_out.flush();
- data_out.close ();
-
- md.update(digest_out.toByteArray()); //or:remove this statement
- byte[] sha = md.digest ();
- long result = 0;
- int len = sha.length < 8 ? sha.length : 8;
- for (int i=0; i < len; i++)
- result += (long)(sha[i] & 0xFF) << (8 * i);
- return result;
- }catch(Exception _){
- return -1L;
- }
- }
-
- public static long getInterfaceHash(Class clazz)
- {
- return clazz.hashCode ();
- }
-}
-
diff --git a/libjava/gnu/java/rmi/server/RMIIncomingThread.java b/libjava/gnu/java/rmi/server/RMIIncomingThread.java
deleted file mode 100644
index 990d37bc521..00000000000
--- a/libjava/gnu/java/rmi/server/RMIIncomingThread.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* RMIIncomingThread.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-public class RMIIncomingThread extends Thread {
-
- private String clientHost = null;
-
- public RMIIncomingThread(Runnable runnable, String s_clientHost) {
- super(runnable);
- clientHost = s_clientHost;
- }
-
- public String toString() {
- return "RMIIncoming from " + clientHost + " " + super.toString();
- }
-
- public String getClientHost() {
- return clientHost;
- }
-
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIObjectInputStream.java b/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
deleted file mode 100644
index 888b30bf6b6..00000000000
--- a/libjava/gnu/java/rmi/server/RMIObjectInputStream.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* RMIObjectInputStream.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-import java.lang.reflect.Proxy;
-import java.net.MalformedURLException;
-import java.rmi.server.RMIClassLoader;
-
-public class RMIObjectInputStream
- extends ObjectInputStream {
-
-public RMIObjectInputStream(InputStream strm) throws IOException {
- super(strm);
- enableResolveObject(true);
-}
-
-protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- String annotation = (String)getAnnotation();
-
- try {
- if(annotation == null)
- return (RMIClassLoader.loadClass(desc.getName()));
- else
- return (RMIClassLoader.loadClass(annotation, desc.getName()));
- }
- catch (MalformedURLException _) {
- throw new ClassNotFoundException(desc.getName());
- }
-}
-
-//Separate it for override by MarshalledObject
-protected Object getAnnotation()
- throws IOException, ClassNotFoundException
-{
- return readObject();
-}
-
-protected Class resolveProxyClass(String intfs[])
- throws IOException, ClassNotFoundException
-{
- String annotation = (String)getAnnotation();
-
- Class clss[] = new Class[intfs.length];
- if(annotation == null)
- clss[0] = RMIClassLoader.loadClass(intfs[0]);
- else
- clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]);
-
- //assume all interfaces can be loaded by the same classloader
- ClassLoader loader = clss[0].getClassLoader();
- for (int i = 0; i < intfs.length; i++)
- clss[i] = Class.forName(intfs[i], false, loader);
-
- try {
- return Proxy.getProxyClass(loader, clss);
- } catch (IllegalArgumentException e) {
- throw new ClassNotFoundException(null, e);
- }
-}
-
-protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException {
- if(valueClass.isPrimitive()){
- if(valueClass == Boolean.TYPE)
- return new Boolean(readBoolean());
- if(valueClass == Byte.TYPE)
- return new Byte(readByte());
- if(valueClass == Character.TYPE)
- return new Character(readChar());
- if(valueClass == Short.TYPE)
- return new Short(readShort());
- if(valueClass == Integer.TYPE)
- return new Integer(readInt());
- if(valueClass == Long.TYPE)
- return new Long(readLong());
- if(valueClass == Float.TYPE)
- return new Float(readFloat());
- if(valueClass == Double.TYPE)
- return new Double(readDouble());
- else
- throw new Error("Unsupported primitive class: " + valueClass);
- } else
- return readObject();
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java b/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
deleted file mode 100644
index d42908a4147..00000000000
--- a/libjava/gnu/java/rmi/server/RMIObjectOutputStream.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/* RMIObjectOutputStream.java -
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.rmi.Remote;
-import java.rmi.server.RMIClassLoader;
-import java.rmi.server.RemoteStub;
-
-public class RMIObjectOutputStream
- extends ObjectOutputStream {
-
-public RMIObjectOutputStream(OutputStream strm) throws IOException {
- super(strm);
- enableReplaceObject(true);
-}
-
-//Separate it for override by MarshalledObject
-protected void setAnnotation(String annotation) throws IOException{
- writeObject(annotation);
-}
-
-protected void annotateClass(Class cls) throws IOException {
- setAnnotation(RMIClassLoader.getClassAnnotation(cls));
-}
-
-protected void annotateProxyClass(Class cls)
- throws IOException
-{
- annotateClass(cls);
-}
-
-protected Object replaceObject(Object obj)
- throws IOException
-{
- if((obj instanceof Remote) && !(obj instanceof RemoteStub)){
- UnicastServerRef ref = UnicastServer.getExportedRef((Remote)obj);
- if (ref != null)
- return ref.getStub();
- }
- return obj;
-}
-
-protected void writeValue(Object value, Class valueClass) throws IOException{
- if(valueClass.isPrimitive()){
- if(valueClass == Boolean.TYPE)
- writeBoolean(((Boolean)value).booleanValue());
- else
- if(valueClass == Byte.TYPE)
- writeByte(((Byte)value).byteValue());
- else
- if(valueClass == Character.TYPE)
- writeChar(((Character)value).charValue());
- else
- if(valueClass == Short.TYPE)
- writeShort(((Short)value).shortValue());
- else
- if(valueClass == Integer.TYPE)
- writeInt(((Integer)value).intValue());
- else
- if(valueClass == Long.TYPE)
- writeLong(((Long)value).longValue());
- else
- if(valueClass == Float.TYPE)
- writeFloat(((Float)value).floatValue());
- else
- if(valueClass == Double.TYPE)
- writeDouble(((Double)value).doubleValue());
- else
- throw new Error("Unsupported primitive class: " + valueClass);
- } else
- writeObject(value);
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/RMIVoidValue.java b/libjava/gnu/java/rmi/server/RMIVoidValue.java
deleted file mode 100644
index 8e5546d3523..00000000000
--- a/libjava/gnu/java/rmi/server/RMIVoidValue.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* RMIVoidValue.java --
- Copyright (c) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-/**
- * Package private class used to indicate a void return type.
- * INSTANCE is the only object of this class ever made.
- */
-final class RMIVoidValue
-{
- static RMIVoidValue INSTANCE = new RMIVoidValue();
-
- private RMIVoidValue()
- {
- }
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastConnection.java b/libjava/gnu/java/rmi/server/UnicastConnection.java
deleted file mode 100644
index 216e453e72f..00000000000
--- a/libjava/gnu/java/rmi/server/UnicastConnection.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/* UnicastConnection.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.Socket;
-import java.rmi.RemoteException;
-
-public class UnicastConnection
- implements Runnable, ProtocolConstants {
-
-UnicastConnectionManager manager;
-Socket sock;
-DataInputStream din;
-DataOutputStream dout;
-ObjectInputStream oin;
-ObjectOutputStream oout;
-
-// reviveTime and expireTime make UnicastConnection pool-able
-long reviveTime = 0;
-long expireTime = Long.MAX_VALUE;
-
-UnicastConnection(UnicastConnectionManager man, Socket sock) {
- this.manager = man;
- this.sock = sock;
-}
-
-void acceptConnection() throws IOException {
-//System.out.println("Accepting connection on " + sock);
- //Use BufferedXXXStream would be more efficient
- din = new DataInputStream(new BufferedInputStream(sock.getInputStream()));
- dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
-
- int sig = din.readInt();
- if (sig != PROTOCOL_HEADER) {
- throw new IOException("bad protocol header");
- }
- short ver = din.readShort();
- if (ver != PROTOCOL_VERSION) {
- throw new IOException("bad protocol version");
- }
- int protocol = din.readUnsignedByte();
- if (protocol != SINGLE_OP_PROTOCOL) {
- // Send an ACK
- dout.writeByte(PROTOCOL_ACK);
-
- // Send my hostname and port
- dout.writeUTF(manager.serverName);
- dout.writeInt(manager.serverPort);
- dout.flush();
-
- // Read their hostname and port
- String rhost = din.readUTF();
- int rport = din.readInt();
- }
- // Okay, ready to roll ...
-}
-
-void makeConnection(int protocol) throws IOException {
- //Use BufferedXXXStream would be more efficient
- din = new DataInputStream(new BufferedInputStream(sock.getInputStream()));
-
- dout = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
-
- // Send header
- dout.writeInt(PROTOCOL_HEADER);
- dout.writeShort(PROTOCOL_VERSION);
- dout.writeByte(protocol);
- dout.flush();
-
- if (protocol != SINGLE_OP_PROTOCOL) {
- // Get back ack.
- int ack = din.readUnsignedByte();
- if (ack != PROTOCOL_ACK) {
- throw new RemoteException("Unsupported protocol");
- }
-
- // Read in host and port
- String dicard_rhost = din.readUTF();
- int discard_rport = din.readInt();
-
- // Send them my endpoint
- dout.writeUTF(manager.serverName);
- dout.writeInt(manager.serverPort);
- dout.flush();
- }
- // Okay, ready to roll ...
-}
-
-DataInputStream getDataInputStream() throws IOException {
- return (din);
-}
-
-DataOutputStream getDataOutputStream() throws IOException {
- return (dout);
-}
-
-/*
-*
-* get ObjectInputStream for reading more objects
-*
-*/
-ObjectInputStream getObjectInputStream() throws IOException {
- if (oin == null) {
- throw new IOException("no ObjectInputtream for reading more objects");
- }
- return (oin);
-}
-
-/**
-*
-* starts ObjectInputStream.
-*
-*/
-ObjectInputStream startObjectInputStream() throws IOException {
- return (oin = new RMIObjectInputStream(din));
-}
-
-/**
-*
-* get ObjectOutputStream for sending more objects
-*
-*/
-ObjectOutputStream getObjectOutputStream() throws IOException {
- if (oout == null) {
- throw new IOException("no ObjectOutputStream for sending more objects");
- }
- return (oout);
-}
-
-/**
-*
-* starts ObjectOutputStream.
-*
-*/
-ObjectOutputStream startObjectOutputStream() throws IOException {
- return (oout = new RMIObjectOutputStream(dout));
-}
-
-void disconnect() {
- try {
- if(oout != null)
- oout.close();
- sock.close();
- }
- catch (IOException _) {
- }
-
- oin = null;
- oout = null;
- din = null;
- dout = null;
- sock = null;
-}
-
-public static final long CONNECTION_TIMEOUT = 10000L;
-
-static boolean isExpired(UnicastConnection conn, long l){
- if (l <= conn.expireTime )
- return false;
- return true;
-}
-
-static void resetTime(UnicastConnection conn){
- long l = System.currentTimeMillis();
- conn.reviveTime = l;
- conn.expireTime = l + CONNECTION_TIMEOUT;
-}
-
-/**
- * We run connects on the server. Dispatch it then discard it.
- */
-public void run() {
- do{
- try {
- UnicastServer.dispatch(this);
- //don't discardConnection explicitly, only when
- // exception happens or the connection's expireTime
- // comes
- } catch (Exception e ){
- manager.discardConnection(this);
- break;
- }
- }while(true);
-}
-
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastConnectionManager.java b/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
deleted file mode 100644
index 08f6a9bc394..00000000000
--- a/libjava/gnu/java/rmi/server/UnicastConnectionManager.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/* UnicastConnectionManager.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.rmi.RemoteException;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RMIServerSocketFactory;
-import java.rmi.server.RMISocketFactory;
-import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-public class UnicastConnectionManager
- implements Runnable, ProtocolConstants {
-
-private static String localhost;
-// use different maps for server/client type UnicastConnectionManager
-private static Hashtable servers = new Hashtable();
-// Package-private to avoid trampolines.
-static Hashtable clients = new Hashtable();
-ArrayList connections; //client connection pool
-
-// make serverThread volatile for poll
-private volatile Thread serverThread;
-private ServerSocket ssock;
-String serverName;
-int serverPort;
-
-// Package-private to avoid a trampoline.
-static Thread scavenger;
-
-// If client and server are in the same VM, serverobj represents server
-Object serverobj;
-
-private static RMISocketFactory defaultSocketFactory = RMISocketFactory.getSocketFactory();
-private RMIServerSocketFactory serverFactory;
-private RMIClientSocketFactory clientFactory;
-
-// The following is for debug
-private static int ncsock = 0; //count of client socket
-private static int nssock = 0; //count of server socket
-private static int ncmanager = 0; //count of client manager
-private static int nsmanager = 0; //count of server manager
-
-private static final boolean debug = false;
-
-private static final Object GLOBAL_LOCK = new Object();
-
-static {
- try {
- //Use host address instead of host name to avoid name resolving issues
- //localhost = InetAddress.getLocalHost().getHostName();
- localhost = InetAddress.getLocalHost().getHostAddress();
- }
- catch (UnknownHostException _) {
- localhost = "localhost";
- }
-
-
-}
-
-//Only one scavenger thread running globally
-private static void startScavenger(){
- scavenger = new Thread(new Runnable(){
- public void run(){
- if (debug) System.out.println("************* start scavenger.");
- boolean liveon = true;
- while (liveon){
- // Sleep for the expire timeout
- try{
- Thread.sleep(UnicastConnection.CONNECTION_TIMEOUT);
- }catch(InterruptedException _ie){
- break;
- }
- liveon = false;
- // Scavenge all clients' connections that're expired
- Iterator iter = clients.values().iterator();
- long l = System.currentTimeMillis();
- try{
- while(iter.hasNext()){
- UnicastConnectionManager man = (UnicastConnectionManager)iter.next();
- ArrayList conns = man.connections;
- synchronized(conns) { // is the lock a little coarser?
- for (int last = conns.size() - 1;
- last >= 0;
- --last)
- {
- UnicastConnection conn = (UnicastConnection)conns.get(last);
- if (UnicastConnection.isExpired(conn, l)){
- conns.remove(last);
- conn.disconnect();
- conn = null;
- }else
- liveon = true; //there're still live connections
- }
- }
- }
- }catch(ConcurrentModificationException cme) {
- // handle it lazily
- liveon = true;
- }
- }
- scavenger = null;
- if (debug) System.out.println("************* exit scavenger.");
- }
- });
- // As it is used for client connection, we may put this thread
- // in daemon state to prevent the VM from blocking when exiting.
- scavenger.setDaemon(true);
- scavenger.start();
-}
-
-/**
- * Client UnicastConnectionManager constructor
- */
-private UnicastConnectionManager(String host, int port, RMIClientSocketFactory csf) {
- ssock = null;
- serverName = host;
- serverPort = port;
- serverFactory = null;
- clientFactory = csf;
- connections = new ArrayList();
-}
-
-/**
- * Server UnicastConnectionManager constructor
- */
-private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) throws RemoteException {
-
- try {
- ssock = ssf.createServerSocket(port);
- serverPort = ssock.getLocalPort();
- }
- catch (IOException ioex) {
- ssock = null;
- serverPort = 0;
- throw new java.rmi.server.ExportException("can not create Server Socket on port " + port,ioex);
- }
- serverName = localhost;
- serverFactory = ssf;
- clientFactory = null;
-}
-
-/**
- * Return a client connection manager which will connect to the given
- * host/port.
- */
-public static synchronized UnicastConnectionManager getInstance(String host, int port, RMIClientSocketFactory csf) {
-//System.out.println("getInstance: " + host + "," + port + "," + csf);
- if (csf == null) {
- csf = defaultSocketFactory;
- }
- // change host name to host address to avoid name resolving issues
- try{
- host = InetAddress.getByName(host).getHostAddress();
- }catch(Exception _){}
-
- TripleKey key = new TripleKey(host, port, csf);
- UnicastConnectionManager man = (UnicastConnectionManager)clients.get(key);
- if (man == null) {
- man = new UnicastConnectionManager(host, port, csf);
- if (debug) {
- ncmanager++;
- System.out.println("\n\n ====== " + ncmanager + " client managers.\n\n");
- }
- clients.put(key, man);
-
- // Detect if client and server are in the same VM, i.e., their keys are equal
- UnicastConnectionManager svrman = (UnicastConnectionManager)servers.get(key);
- if(svrman != null){ // server and client are in the same VM
- man.serverobj = svrman.serverobj;
- }
- }
- return (man);
-}
-
-/**
- * Return a server connection manager which will accept connection on the
- * given port.
- */
-public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) throws RemoteException {
-//System.out.println("getInstance: " + port + "," + ssf);
- if (ssf == null) {
- ssf = defaultSocketFactory;
- }
- TripleKey key = new TripleKey(localhost, port, ssf);
- UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key);
- if (man == null) {
- man = new UnicastConnectionManager(port, ssf);
- if (debug) {
- nsmanager++;
- System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n");
- }
- // The provided port might not be the set port.
- key.port = man.serverPort;
- servers.put(key, man);
- }
- return (man);
-}
-
-/**
- * Get a connection from this manager.
- */
-public UnicastConnection getConnection() throws IOException {
- if (ssock == null) {
- return (getClientConnection());
- }
- else {
- return (getServerConnection());
- }
-}
-
-/**
- * Accept a connection to this server.
- */
-private UnicastConnection getServerConnection() throws IOException {
- Socket sock = ssock.accept();
- sock.setTcpNoDelay(true); //??
- UnicastConnection conn = new UnicastConnection(this, sock);
- conn.acceptConnection();
- if (debug){
- nssock++;
- System.out.println("\n\n ****** " + nssock + " server socks.\n\n");
- }
- //System.out.println("Server connection " + sock);
- return (conn);
-}
-
-/**
- * Make a conection from this client to the server.
- */
-private UnicastConnection getClientConnection() throws IOException {
- ArrayList conns = connections;
- UnicastConnection conn;
-
- synchronized(conns) {
- int nconn = conns.size() - 1;
-
- // if there're free connections in connection pool
- if(nconn >= 0) {
- conn = (UnicastConnection)conns.get(nconn);
- //Should we check if conn is alive using Ping??
- conns.remove(nconn);
-
- // Check if the connection is already expired
- long l = System.currentTimeMillis();
- if (!UnicastConnection.isExpired(conn, l)){
- return conn;
- }else {
- conn.disconnect();
- conn = null;
- }
- }
- }
-
- Socket sock = clientFactory.createSocket(serverName, serverPort);
- conn = new UnicastConnection(this, sock);
- conn.makeConnection(DEFAULT_PROTOCOL);
-
- if (debug) {
- ncsock++;
- System.out.println("\n\n ====== " + ncsock + " client socks.\n\n");
- }
-
- return (conn);
-}
-
-/**
- * Discard a connection when we're done with it - maybe it can be
- * recycled.
- */
-public void discardConnection(UnicastConnection conn) {
-//System.out.println("Discarding connection " + conn);
- //conn.disconnect();
- if (ssock != null) //server connection
- conn.disconnect();
- else {
- // To client connection, we'd like to return back to pool
- UnicastConnection.resetTime(conn);
- //Ensure there're only one scavenger globally
- synchronized(GLOBAL_LOCK) {
- connections.add(conn); //borrow this lock to garantee thread safety
- if (scavenger == null)
- startScavenger();
- }
- }
-}
-
-/**
- * Start a server on this manager if it's a server socket and we've not
- * already got one running.
- */
-public void startServer() {
- synchronized(this) {
- if (ssock == null || serverThread != null) {
- return;
- }
- serverThread = new Thread(this);
- // The following is not necessary when java.lang.Thread's constructor do this.
- // serverThread.setContextClassLoader(Thread.currentThread().getContextClassLoader());
- }
- serverThread.start();
-}
-
-/**
- * Stop a server on this manager
- */
-public void stopServer() {
- synchronized(this) {
- if(serverThread != null){
- serverThread = null;
- try{
- ssock.close();
- }catch(Exception _){}
- }
- }
-}
-
-/**
- * Server thread for connection manager.
- */
-public void run() {
- for (;serverThread != null;) { // if serverThread==null, then exit thread
- try {
-//System.out.println("Waiting for connection on " + serverPort);
- UnicastConnection conn = getServerConnection();
-
- // get address of remote host for the RMIIncomingThread object
- String remoteHost = null;
- if (conn.sock != null) {
- remoteHost = conn.sock.getInetAddress().getHostAddress();
- }
-
- // use a thread pool to improve performance
- //ConnectionRunnerPool.dispatchConnection(conn);
- (new RMIIncomingThread(conn, remoteHost)).start();
-// (new Thread(conn)).start();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
-
-/**
- * Serialization routine.
- */
-void write(ObjectOutput out) throws IOException {
- out.writeUTF(serverName);
- out.writeInt(serverPort);
-}
-
-/**
- * Serialization routine.
- */
-static UnicastConnectionManager read(ObjectInput in) throws IOException {
- String host = in.readUTF();
- int port = in.readInt();
- //RMIClientSocketFactory csf = ((RMIObjectInputStream)in).manager.clientFactory;
- //return (getInstance(host, port, csf));
- return (getInstance(host, port, null));
-}
-
-}
-
-/**
- * This is use as the hashkey for the client/server connections.
- */
-class TripleKey {
-
-String host;
-int port;
-Object other;
-
-TripleKey(String host, int port, Object other) {
- this.host = host;
- this.port = port;
- this.other = other;
-}
-
-/**
- * Hash code just include the host and other - we ignore the port since
- * this has unusual matching behaviour.
- */
-public int hashCode() {
- return (host.hashCode() ^ other.hashCode());
-}
-
-public boolean equals(Object obj) {
- if (obj instanceof TripleKey) {
- TripleKey other = (TripleKey)obj;
- if (this.host.equals(other.host) &&
- this.other == other.other &&
- (this.port == other.port /* || this.port == 0 || other.port == 0*/)) {
- return (true);
- }
- }
- return (false);
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastRef.java b/libjava/gnu/java/rmi/server/UnicastRef.java
deleted file mode 100644
index c1b871fb8e5..00000000000
--- a/libjava/gnu/java/rmi/server/UnicastRef.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/* UnicastRef.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.server.ObjID;
-import java.rmi.server.Operation;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RemoteCall;
-import java.rmi.server.RemoteObject;
-import java.rmi.server.RemoteRef;
-import java.rmi.server.UID;
-
-public class UnicastRef
- implements RemoteRef, ProtocolConstants {
-
-public ObjID objid;
-UnicastConnectionManager manager;
-
-/**
- * Used by serialization, and let subclass capable of having default constructor
- */
-// must be public otherwise java.rmi.RemoteObject cannot instantiate this class
-// -- iP
-public UnicastRef() {
-}
-
-public UnicastRef(ObjID objid, String host, int port, RMIClientSocketFactory csf) {
- this(objid);
- manager = UnicastConnectionManager.getInstance(host, port, csf);
-}
-
-public UnicastRef(ObjID objid) {
- this.objid = objid;
-}
-
-public Object invoke(Remote obj, Method method, Object[] params, long opnum) throws Exception {
- // Check if client and server are in the same VM, then local call can be used to
- // replace remote call, but it's somewhat violating remote semantic.
- Object svrobj = manager.serverobj;
-
- // Make sure that the server object is compatible. It could be loaded from a different
- // classloader --iP
- if(svrobj != null && method.getDeclaringClass().isInstance(svrobj)){
- //local call
- Object ret = null;
- try{
- ret = method.invoke(svrobj, params);
- }catch(InvocationTargetException e){
- throw (Exception)e.getTargetException();
- }
- //System.out.println("\n\n ***** local call: " + method + "\nreturn: " + ret + "\n\n");
- return ret;
- }
- //System.out.println("***************** remote call:" + manager.serverPort);
- return (invokeCommon(obj, method, params, -1, opnum));
-}
-
-private Object invokeCommon(Remote obj, Method method, Object[] params, int opnum, long hash) throws Exception {
- UnicastConnection conn;
- try {
- conn = manager.getConnection();
- }
- catch (IOException e1) {
- throw new RemoteException("connection failed to host: " + manager.serverName, e1);
- }
-
- ObjectOutputStream out;
- DataOutputStream dout;
- try {
- dout = conn.getDataOutputStream();
- dout.writeByte(MESSAGE_CALL);
-
- out = conn.startObjectOutputStream(); // (re)start ObjectOutputStream
-
- objid.write(out);
- out.writeInt(opnum);
- out.writeLong(hash);
-
- // must handle primitive class and their wrapper classes
- Class clss[] = method.getParameterTypes();
- for(int i = 0; i < clss.length; i++)
- ((RMIObjectOutputStream)out).writeValue(params[i], clss[i]);
-
- out.flush();
- }
- catch (IOException e2) {
- throw new RemoteException("call failed: ", e2);
- }
-
- int returncode;
- Object returnval;
- DataInputStream din;
- ObjectInputStream in;
- UID ack;
- try {
- din = conn.getDataInputStream();
-
- if ((returncode = din.readUnsignedByte()) != MESSAGE_CALL_ACK) {
- conn.disconnect();
- throw new RemoteException("Call not acked:" + returncode);
- }
-
- in = conn.startObjectInputStream(); // (re)start ObjectInputStream
- returncode = in.readUnsignedByte();
- ack = UID.read(in);
-
- Class cls = method.getReturnType();
-
- if (returncode == RETURN_NACK) {
- returnval = in.readObject(); // get Exception
-
- } else if(cls == Void.TYPE) {
- returnval = null;
- // in.readObject() // not required! returntype 'void' means no field is returned.
- } else {
- returnval = ((RMIObjectInputStream)in).readValue(cls); // get returnvalue
- }
- } catch (IOException e3) {
- //for debug: e3.printStackTrace();
- throw new RemoteException("call return failed: ", e3);
- }
-
- /* if DGCAck is necessary??
- //According to RMI wire protocol, send a DGCAck
- // to indicate receiving return value
- dout.writeByte(MESSAGE_DGCACK);
- ack.write(dout);
- out.flush();
- */
-
- manager.discardConnection(conn);
-
- if (returncode != RETURN_ACK && returnval != null) {
- if (returncode == RETURN_NACK) throw (Exception)returnval;
- else throw new RemoteException("unexpected returncode: " + returncode);
- }
-
- return (returnval);
-}
-
-/**
- * @deprecated
- */
-public RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) throws RemoteException {
- UnicastConnection conn;
-
- try {
- conn = manager.getConnection();
- }
- catch (IOException e1) {
- throw new RemoteException("connection failed to host: " + manager.serverName, e1);
- }
-
- //obj: useless?
-
- return (new UnicastRemoteCall(conn, objid, opnum, hash));
-}
-
-/**
- * @deprecated
- */
-public void invoke(RemoteCall call) throws Exception {
- UnicastRemoteCall c = (UnicastRemoteCall)call;
- call.executeCall();
-}
-
-/**
- * @deprecated
- */
-public void done(RemoteCall call) throws RemoteException {
- UnicastRemoteCall c = (UnicastRemoteCall)call;
- try{
- c.done();
- } catch(IOException e){}
- UnicastConnection conn = c.getConnection();
- manager.discardConnection(conn);
-}
-
-public void writeExternal(ObjectOutput out) throws IOException {
- if (manager == null) {
- throw new IOException("no connection");
- }
- manager.write(out);
- objid.write(out);
- // This byte is somewhat confusing when interoperating with JDK
- out.writeByte(0); //RETURN_ACK);
-}
-
-public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- manager = UnicastConnectionManager.read(in);
- objid = ObjID.read(in);
- byte ack = in.readByte();
- // This byte is somewhat confusing when interoperating with JDK
- if (ack != RETURN_ACK && ack != 0/*jdk ack value*/) {
- throw new IOException("no ack found");
- }
-}
-
-public boolean remoteEquals(RemoteRef ref) {
- throw new Error("Not implemented");
-}
-
-public int remoteHashCode() {
- throw new Error("Not implemented");
-}
-
-public String getRefClass(ObjectOutput out) {
- return ("UnicastRef");
-}
-
-public String remoteToString() {
- throw new Error("Not implemented");
-}
-
-public void dump(UnicastConnection conn) {
- try {
- DataInputStream din = conn.getDataInputStream();
- for (;;) {
- int b = din.readUnsignedByte();
- System.out.print(Integer.toHexString(b));
- if (b >= 32 && b < 128) {
- System.out.print(": " + (char)b);
- }
- System.out.println();
- }
- }
- catch (IOException _) {
- }
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java b/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
deleted file mode 100644
index c5206e76df2..00000000000
--- a/libjava/gnu/java/rmi/server/UnicastRemoteCall.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/* UnicastRemoteCall.java
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.StreamCorruptedException;
-import java.rmi.MarshalException;
-import java.rmi.RemoteException;
-import java.rmi.UnmarshalException;
-import java.rmi.server.ObjID;
-import java.rmi.server.RemoteCall;
-import java.rmi.server.UID;
-import java.util.Vector;
-
-public class UnicastRemoteCall
- implements RemoteCall, ProtocolConstants
-{
-
- private UnicastConnection conn;
- private Object result;
- private Object object;
- private int opnum;
- private long hash;
- // These are package-private due to inner class access.
- Vector vec;
- int ptr;
- private ObjID objid;
-
- private ObjectOutput oout;
- private ObjectInput oin;
-
- /**
- * Incoming call.
- */
- UnicastRemoteCall(UnicastConnection conn)
- {
- this.conn = conn;
- }
-
- /**
- * Outgoing call.
- */
- UnicastRemoteCall(UnicastConnection conn, ObjID objid, int opnum, long hash)
- throws RemoteException
- {
- this.conn = conn;
- this.opnum = opnum;
- this.hash = hash;
- this.objid = objid;
- }
-
- UnicastConnection getConnection()
- {
- return conn;
- }
-
- public ObjectOutput getOutputStream() throws IOException
- {
- if (vec == null)
- vec = new Vector();
- return (new DummyObjectOutputStream());
- }
-
- public void releaseOutputStream() throws IOException
- {
- if (vec != null)
- {
- oout = conn.getObjectOutputStream();
-
- for (int i = 0; i < vec.size(); i += 2)
- {
- boolean primitive = ((Boolean)vec.elementAt(i)).booleanValue();
- Object data = vec.elementAt(i+1);
-
- // No type, this is
- if (!primitive)
- oout.writeObject(data);
- else
- {
- if (data instanceof Boolean)
- oout.writeBoolean(((Boolean)data).booleanValue());
- else if (data instanceof Character)
- oout.writeChar(((Character)data).charValue());
- else if (data instanceof Byte)
- oout.writeByte(((Byte)data).byteValue());
- else if (data instanceof Short)
- oout.writeShort(((Short)data).shortValue());
- else if (data instanceof Integer)
- oout.writeInt(((Integer)data).intValue());
- else if (data instanceof Long)
- oout.writeLong(((Long)data).longValue());
- }
- }
- vec = null;
- }
- if(oout != null)
- oout.flush();
- }
-
- /**
- *
- * (re)starts ObjectInputStream
- *
- */
- public ObjectInput startInputStream() throws IOException
- {
- if (conn != null) {
- return (oin = conn.startObjectInputStream());
- } else {
- return getInputStream(); // dummy Input Stream
- }
-
- }
-
- public ObjectInput getInputStream() throws IOException
- {
- if (conn != null)
- {
- if(oin == null)
- return (oin = conn.getObjectInputStream());
- else
- return oin;
- }
- else
- {
- ptr = 0;
- return (new DummyObjectInputStream());
- }
- }
-
- public void releaseInputStream() throws IOException
- {
- // Does nothing.
- }
-
- public ObjectOutput getResultStream(boolean success)
- throws IOException, StreamCorruptedException
- {
- vec = new Vector();
- return new DummyObjectOutputStream();
- }
-
- public void executeCall() throws Exception
- {
- byte returncode;
- ObjectInput oin;
-
- // signal the call when constructing
- try
- {
- DataOutputStream dout = conn.getDataOutputStream();
- dout.write(MESSAGE_CALL);
-
- oout = conn.startObjectOutputStream(); // (re)start ObjectOutputStream
- objid.write(oout);
- oout.writeInt(opnum);
- oout.writeLong(hash);
- }
- catch(IOException ex)
- {
- throw new MarshalException("Try to write header but failed.", ex);
- }
-
- try
- {
- releaseOutputStream();
- DataInputStream din = conn.getDataInputStream();
- if (din.readByte() != MESSAGE_CALL_ACK)
- throw new RemoteException("Call not acked");
-
- oin = startInputStream();
- returncode = oin.readByte();
- UID.read(oin);
- }
- catch(IOException ex)
- {
- throw new UnmarshalException("Try to read header but failed:", ex);
- }
-
- //check return code
- switch(returncode)
- {
- case RETURN_ACK: //it's ok
- return;
- case RETURN_NACK:
- Object returnobj;
- try
- {
- returnobj = oin.readObject();
- }
- catch(Exception ex2)
- {
- throw new UnmarshalException
- ("Try to read exception object but failed", ex2);
- }
-
- if(!(returnobj instanceof Exception))
- throw new UnmarshalException("Should be Exception type here: "
- + returnobj);
- throw (Exception)returnobj;
-
- default:
- throw new UnmarshalException("Invalid return code");
- }
- }
-
- public void done() throws IOException
- {
- // conn.disconnect();
- }
-
- boolean isReturnValue()
- {
- return vec.size() > 0;
- }
-
- Object returnValue()
- {
- // This is not the first one (Boolean) but the second.
- return vec.elementAt(1);
- }
-
- Object[] getArguments()
- {
- return vec.toArray();
- }
-
- Object getObject()
- {
- return object;
- }
-
- int getOpnum()
- {
- return opnum;
- }
-
- long getHash()
- {
- return hash;
- }
-
- void setReturnValue(Object obj)
- {
- vec.removeAllElements();
- vec.addElement(obj);
- }
-
- /**
- * Dummy object output class.
- */
- private class DummyObjectOutputStream implements ObjectOutput
- {
- /**
- * Non-private constructor to reduce bytecode emitted.
- */
- DummyObjectOutputStream()
- {
- }
-
- public void writeBoolean(boolean v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(Boolean.valueOf(v));
- }
-
- public void writeByte(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Byte((byte) v));
- }
-
- public void writeChar(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Character((char) v));
- }
-
- public void writeDouble(double v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Double(v));
- }
-
- public void writeFloat(float v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Float(v));
- }
-
- public void writeInt(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Integer(v));
- }
-
- public void writeLong(long v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Long(v));
- }
-
- public void writeShort(int v) throws IOException
- {
- vec.addElement(Boolean.TRUE);
- vec.addElement(new Short((short) v));
- }
-
- public void writeObject(Object obj) throws IOException
- {
- vec.addElement(Boolean.FALSE);
- vec.addElement(obj);
- }
-
- public void write(byte b[]) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void write(byte b[], int off, int len) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void write(int b) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void writeBytes(String s) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void writeChars(String s) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void writeUTF(String str) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void flush() throws IOException
- {
- }
-
- public void close() throws IOException
- {
- }
- } // class DummyObjectOutputStream
-
- /**
- * Dummy object input class.
- */
- private class DummyObjectInputStream implements ObjectInput
- {
- /**
- * Non-private constructor to reduce bytecode emitted.
- */
- DummyObjectInputStream()
- {
- }
-
- public boolean readBoolean() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Boolean) obj).booleanValue();
- }
-
- public byte readByte() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Byte) obj).byteValue();
- }
-
- public char readChar() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Character) obj).charValue();
- }
-
- public double readDouble() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Double) obj).doubleValue();
- }
-
- public float readFloat() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Float) obj).floatValue();
- }
-
- public int readInt() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Integer) obj).intValue();
- }
-
- public long readLong() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Long) obj).longValue();
- }
-
- public short readShort() throws IOException
- {
- Object obj = vec.elementAt(ptr++);
- return ((Short) obj).shortValue();
- }
-
- public Object readObject() throws IOException
- {
- return vec.elementAt(ptr++);
- }
-
- public int read(byte b[]) throws IOException
- {
- throw new IOException("not required");
- }
-
- public int read(byte b[], int off, int len) throws IOException
- {
- throw new IOException("not required");
- }
-
- public int read() throws IOException
- {
- throw new IOException("not required");
- }
-
- public long skip(long n) throws IOException
- {
- throw new IOException("not required");
- }
-
- public int available() throws IOException
- {
- throw new IOException("not required");
- }
-
- public void readFully(byte b[]) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void readFully(byte b[], int off, int len) throws IOException
- {
- throw new IOException("not required");
- }
-
- public String readLine() throws IOException
- {
- throw new IOException("not required");
- }
-
- public String readUTF() throws IOException
- {
- throw new IOException("not required");
- }
-
- public int readUnsignedByte() throws IOException
- {
- throw new IOException("not required");
- }
-
- public int readUnsignedShort() throws IOException
- {
- throw new IOException("not required");
- }
-
- public int skipBytes(int n) throws IOException
- {
- throw new IOException("not required");
- }
-
- public void close() throws IOException
- {
- }
- } // class DummyObjectInputStream
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastRemoteStub.java b/libjava/gnu/java/rmi/server/UnicastRemoteStub.java
deleted file mode 100644
index 87e932de559..00000000000
--- a/libjava/gnu/java/rmi/server/UnicastRemoteStub.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* UnicastRemoteStub.java --
- Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.rmi.server;
-
-import java.rmi.server.RemoteRef;
-import java.rmi.server.RemoteStub;
-
-public class UnicastRemoteStub
- extends RemoteStub {
-
-public static void setStubRef(RemoteStub stub, RemoteRef ref) {
- setRef(stub, ref);
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastServer.java b/libjava/gnu/java/rmi/server/UnicastServer.java
deleted file mode 100644
index 065ef8c77ee..00000000000
--- a/libjava/gnu/java/rmi/server/UnicastServer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/* UnicastServer.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import gnu.java.rmi.dgc.DGCImpl;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.rmi.NoSuchObjectException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.ServerError;
-import java.rmi.server.ObjID;
-import java.rmi.server.UID;
-import java.util.Hashtable;
-
-public class UnicastServer
- implements ProtocolConstants {
-
-static private Hashtable objects = new Hashtable(); //mapping OBJID to server ref
-static private Hashtable refcache = new Hashtable(); //mapping obj itself to server ref
-static private DGCImpl dgc;
-
-public static void exportObject(UnicastServerRef obj) {
- startDGC();
- objects.put(obj.objid, obj);
- refcache.put(obj.myself, obj);
- obj.manager.startServer();
-}
-
-// FIX ME: I haven't handle force parameter
-public static boolean unexportObject(UnicastServerRef obj, boolean force) {
- objects.remove(obj.objid);
- refcache.remove(obj.myself);
- obj.manager.stopServer();
- return true;
-}
-
-public static UnicastServerRef getExportedRef(Remote remote){
- return (UnicastServerRef)refcache.get(remote);
-}
-
-private static synchronized void startDGC() {
- if (dgc == null) {
- try {
- dgc = new DGCImpl();
- // Changed DGCImpl to inherit UnicastServerRef directly
- //((UnicastServerRef)dgc.getRef()).exportObject(dgc);
- dgc.exportObject(dgc);
- }
- catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-}
-
-public static void dispatch(UnicastConnection conn) throws Exception {
- switch (conn.getDataInputStream().readUnsignedByte()) {
- case MESSAGE_CALL:
- incomingMessageCall(conn);
- break;
- case MESSAGE_PING:
- // jdk sends a ping before each method call -> answer it!
- DataOutputStream out = conn.getDataOutputStream();
- out.writeByte(MESSAGE_PING_ACK);
- out.flush();
- break;
- default:
- throw new Exception("bad method type");
- }
-}
-
-private static void incomingMessageCall(UnicastConnection conn) throws IOException {
- ObjectInputStream in = conn.startObjectInputStream(); // (re)start ObjectInputStream
-
- ObjID objid = ObjID.read(in);
- int method = in.readInt();
- long hash = in.readLong();
-
-//System.out.println("ObjID: " + objid + ", method: " + method + ", hash: " + hash);
-
- // Use the objid to locate the relevant UnicastServerRef
- UnicastServerRef uref = (UnicastServerRef)objects.get(objid);
- Object returnval;
- int returncode = RETURN_ACK;
- // returnval is from Method.invoke(), so we must check the return class to see
- // if it's primitive type
- Class returncls = null;
- if (uref != null) {
- try {
- // Dispatch the call to it.
- returnval = uref.incomingMessageCall(conn, method, hash);
- returncls = uref.getMethodReturnType(method, hash);
- }
- catch (Exception e) {
- returnval = e;
- returncode = RETURN_NACK;
- }
- catch (Error e) {
- returnval = new ServerError ("An Error is thrown while processing the invocation on the server", e);
- returncode = RETURN_NACK;
- }
- }
- else {
- returnval = new NoSuchObjectException("");
- returncode = RETURN_NACK;
- }
-
- conn.getDataOutputStream().writeByte(MESSAGE_CALL_ACK);
-
- ObjectOutputStream out = conn.startObjectOutputStream(); // (re)start ObjectOutputStream
-
- out.writeByte(returncode);
- (new UID()).write(out);
-
- //System.out.println("returnval=" + returnval + " returncls=" + returncls);
-
- if(returnval != null && returncls != null)
- ((RMIObjectOutputStream)out).writeValue(returnval, returncls);
-
- // 1.1/1.2 void return type detection:
- else if (!(returnval instanceof RMIVoidValue || returncls == Void.TYPE))
- out.writeObject(returnval);
-
- out.flush();
-}
-
-}
diff --git a/libjava/gnu/java/rmi/server/UnicastServerRef.java b/libjava/gnu/java/rmi/server/UnicastServerRef.java
deleted file mode 100644
index 1f6eedec68a..00000000000
--- a/libjava/gnu/java/rmi/server/UnicastServerRef.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/* UnicastServerRef.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.rmi.server;
-
-import java.io.ObjectInputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.server.ObjID;
-import java.rmi.server.RMIServerSocketFactory;
-import java.rmi.server.RemoteRef;
-import java.rmi.server.RemoteServer;
-import java.rmi.server.RemoteStub;
-import java.rmi.server.ServerNotActiveException;
-import java.rmi.server.ServerRef;
-import java.rmi.server.Skeleton;
-import java.util.Hashtable;
-
-public class UnicastServerRef
- extends UnicastRef
- implements ServerRef{ //SHOULD implement ServerRef
-
-final static private Class[] stubprototype = new Class[] { RemoteRef.class };
-
-Remote myself; //save the remote object itself
-private Skeleton skel;
-private RemoteStub stub;
-private Hashtable methods = new Hashtable();
-
-/**
- * Used by serialization.
- */
-UnicastServerRef()
-{
-}
-
-public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) throws RemoteException {
- super(id);
- manager = UnicastConnectionManager.getInstance(port, ssf);
-}
-
-public RemoteStub exportObject(Remote obj) throws RemoteException {
- if (myself == null) {
- myself = obj;
- // Save it to server manager, to let client calls in the same VM to issue
- // local call
- manager.serverobj = obj;
-
- // Find and install the stub
- Class cls = obj.getClass();
- Class expCls;
- try {
- // where ist the _Stub? (check superclasses also)
- expCls = findStubSkelClass(cls);
- } catch (Exception ex) {
- throw new RemoteException("can not find stubs for class: " + cls, ex);
- }
-
- stub = (RemoteStub)getHelperClass(expCls, "_Stub");
- if (stub == null) {
- throw new RemoteException("failed to export: " + cls);
- }
-
- // Find and install the skeleton (if there is one)
- skel = (Skeleton)getHelperClass(expCls, "_Skel");
-
- // Build hash of methods which may be called.
- buildMethodHash(obj.getClass(), true);
-
- // Export it.
- UnicastServer.exportObject(this);
- }
-
- return (stub);
-}
-
-public RemoteStub exportObject(Remote remote, Object obj)
- throws RemoteException
-{
- //FIX ME
- return exportObject(remote);
-}
-
-public RemoteStub getStub(){
- return stub;
-}
-
-
-public boolean unexportObject(Remote obj, boolean force) {
- // Remove all hashes of methods which may be called.
- buildMethodHash(obj.getClass(), false);
- return UnicastServer.unexportObject(this, force);
-}
-
-/**
-*
-* The Subs/Skels might not there for the actual class, but maybe
-* for one of the superclasses.
-*
-*/
-private Class findStubSkelClass(Class startCls) throws Exception {
- Class cls = startCls;
-
- while (true) {
- try {
- String stubClassname = cls.getName() + "_Stub";
- ClassLoader cl = cls.getClassLoader();
- Class scls = cl == null ? Class.forName(stubClassname)
- : cl.loadClass(stubClassname);
- return cls; // found it
- } catch (ClassNotFoundException e) {
- Class superCls = cls.getSuperclass();
- if (superCls == null
- || superCls == java.rmi.server.UnicastRemoteObject.class)
- {
- throw new Exception("Neither " + startCls
- + " nor one of their superclasses (like" + cls + ")"
- + " has a _Stub");
- }
- cls = superCls;
- }
- }
-}
-
-
-
-private Object getHelperClass(Class cls, String type) {
- try {
- String classname = cls.getName();
- ClassLoader cl = cls.getClassLoader();
- Class scls = cl == null ? Class.forName(classname + type)
- : cl.loadClass(classname + type);
- if (type.equals("_Stub")) {
- try {
- // JDK 1.2 stubs
- Constructor con = scls.getConstructor(stubprototype);
- return (con.newInstance(new Object[]{this}));
- }
- catch (NoSuchMethodException e) {
- }
- catch (InstantiationException e) {
- }
- catch (IllegalAccessException e) {
- }
- catch (IllegalArgumentException e) {
- }
- catch (InvocationTargetException e) {
- }
- // JDK 1.1 stubs
- RemoteStub stub = (RemoteStub)scls.newInstance();
- UnicastRemoteStub.setStubRef(stub, this);
- return (stub);
- }
- else {
- // JDK 1.1 skel
- return (scls.newInstance());
- }
- }
- catch (ClassNotFoundException e) {
- }
- catch (InstantiationException e) {
- }
- catch (IllegalAccessException e) {
- }
- return (null);
-}
-
-
-
-public String getClientHost() throws ServerNotActiveException {
- return RemoteServer.getClientHost();
-}
-
-private void buildMethodHash(Class cls, boolean build) {
- Method[] meths = cls.getMethods();
- for (int i = 0; i < meths.length; i++) {
- /* Don't need to include any java.xxx related stuff */
- if (meths[i].getDeclaringClass().getName().startsWith("java.")) {
- continue;
- }
- long hash = RMIHashes.getMethodHash(meths[i]);
- if(build)
- methods.put(new Long (hash), meths[i]);
- else
- methods.remove(new Long (hash));
-//System.out.println("meth = " + meths[i] + ", hash = " + hash);
- }
-}
-
-Class getMethodReturnType(int method, long hash) throws Exception
-{
- if (method == -1) {
- Method meth = (Method)methods.get(new Long (hash));
- return meth.getReturnType();
- }else
- return null;
-}
-
-public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {
-//System.out.println("method = " + method + ", hash = " + hash);
- // If method is -1 then this is JDK 1.2 RMI - so use the hash
- // to locate the method
- if (method == -1) {
- Method meth = (Method)methods.get(new Long (hash));
-//System.out.println("class = " + myself.getClass() + ", meth = " + meth);
- if (meth == null) {
- throw new NoSuchMethodException();
- }
-
- ObjectInputStream in = conn.getObjectInputStream();
- int nrargs = meth.getParameterTypes().length;
- Object[] args = new Object[nrargs];
- for (int i = 0; i < nrargs; i++) {
- /**
- * For debugging purposes - we don't handle CodeBases
- * quite right so we don't always find the stubs. This
- * lets us know that.
- */
- try {
- // need to handle primitive types
- args[i] = ((RMIObjectInputStream)in).readValue(meth.getParameterTypes()[i]);
-
- }
- catch (Exception t) {
- t.printStackTrace();
- throw t;
- }
- }
- //We must reinterpret the exception thrown by meth.invoke()
- //return (meth.invoke(myself, args));
- Object ret = null;
- try{
- ret = meth.invoke(myself, args);
- }catch(InvocationTargetException e){
- Throwable cause = e.getTargetException();
- if (cause instanceof Exception) {
- throw (Exception)cause;
- }
- else if (cause instanceof Error) {
- throw (Error)cause;
- }
- else {
- throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e);
- }
- }
- return ret;
- }
- // Otherwise this is JDK 1.1 style RMI - we find the skeleton
- // and invoke it using the method number. We wrap up our
- // connection system in a UnicastRemoteCall so it appears in a
- // way the Skeleton can handle.
- else {
- if (skel == null) {
- throw new NoSuchMethodException();
- }
- UnicastRemoteCall call = new UnicastRemoteCall(conn);
- skel.dispatch(myself, call, method, hash);
- if (!call.isReturnValue())
- return RMIVoidValue.INSTANCE;
- else
- return (call.returnValue());
- }
-}
-
-}
-
-
diff --git a/libjava/gnu/java/security/Engine.java b/libjava/gnu/java/security/Engine.java
deleted file mode 100644
index b75de5caa95..00000000000
--- a/libjava/gnu/java/security/Engine.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Engine -- generic getInstance method.
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.security;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import java.security.NoSuchAlgorithmException;
-import java.security.Provider;
-
-/**
- * Generic implementation of the getInstance methods in the various
- * engine classes in java.security.
- *
- * policyFile ::= keystoreOrGrantEntries ;
- *
- * keystoreOrGrantEntries ::= keystoreOrGrantEntry |
- * keystoreOrGrantEntries keystoreOrGrantEntry |
- * EMPTY ;
- *
- * keystoreOrGrantEntry ::= keystoreEntry | grantEntry ;
- *
- * keystoreEntry ::= "keystore" keystoreUrl ';' |
- * "keystore" keystoreUrl ',' keystoreAlgorithm ';' ;
- *
- * keystoreUrl ::= URL ;
- * keystoreAlgorithm ::= STRING ;
- *
- * grantEntry ::= "grant" domainParameters '{' permissions '}' ';'
- *
- * domainParameters ::= domainParameter |
- * domainParameter ',' domainParameters ;
- *
- * domainParameter ::= "signedBy" signerNames |
- * "codeBase" codeBaseUrl |
- * "principal" principalClassName principalName |
- * "principal" principalName ;
- *
- * signerNames ::= quotedString ;
- * codeBaseUrl ::= URL ;
- * principalClassName ::= STRING ;
- * principalName ::= quotedString ;
- *
- * quotedString ::= quoteChar STRING quoteChar ;
- * quoteChar ::= '"' | '\'';
- *
- * permissions ::= permission | permissions permission ;
- *
- * permission ::= "permission" permissionClassName permissionTarget permissionAction |
- * "permission" permissionClassName permissionTarget |
- * "permission" permissionClassName;
- *
- *
- * ${property-name}
will be
- * replaced with System.getProperty("property-name")
in
- * quoted strings.
- *
- *
- * @author Casey Marshall (csm@gnu.org)
- * @see java.security.Policy
- */
-public final class PolicyFile extends Policy
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- private static final boolean DEBUG = true;
- // Package-private to avoid a trampoline.
- static void debug(String msg)
- {
- System.err.print(">> PolicyFile: ");
- System.err.println(msg);
- }
-
- private static void debug(Throwable t)
- {
- System.err.println(">> PolicyFile");
- t.printStackTrace(System.err);
- }
-
- private static final String DEFAULT_POLICY = System.getProperty("java.home")
- + System.getProperty("file.separator") + "lib"
- + System.getProperty("file.separator") + "security"
- + System.getProperty("file.separator") + "java.policy";
-
- private final Map cs2pc;
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public PolicyFile()
- {
- cs2pc = new HashMap();
- refresh();
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public PermissionCollection getPermissions(CodeSource codeSource)
- {
- Permissions perms = new Permissions();
- for (Iterator it = cs2pc.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry e = (Map.Entry) it.next();
- CodeSource cs = (CodeSource) e.getKey();
- if (cs.implies(codeSource))
- {
- if (DEBUG) debug(cs+" -> "+codeSource);
- PermissionCollection pc = (PermissionCollection) e.getValue();
- for (Enumeration ee = pc.elements(); ee.hasMoreElements(); )
- {
- perms.add((Permission) ee.nextElement());
- }
- }
- else
- if (DEBUG) debug(cs+" !-> "+codeSource);
- }
- if (DEBUG) debug ("returning permissions " + perms + " for " + codeSource);
- return perms;
- }
-
- public void refresh()
- {
- cs2pc.clear();
- List policyFiles = new LinkedList();
- try
- {
- policyFiles.add(new File(DEFAULT_POLICY).toURL());
- if (DEBUG) debug ("defualt policy is " + DEFAULT_POLICY);
- policyFiles.addAll((List) AccessController.doPrivileged(
- new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- LinkedList l = new LinkedList();
- for (int i = 1; ; i++)
- {
- String s = Security.getProperty("policy.file."+i);
- if (DEBUG) debug("policy.file."+i+"="+s);
- if (s == null)
- break;
- l.add(new URL(s));
- }
- String s = System.getProperty("java.security.policy");
- if (DEBUG) debug("java.security.policy="+s);
- if (s != null)
- l.add(new URL(s));
- return l;
- }
- }));
- }
- catch (PrivilegedActionException pae)
- {
- if (DEBUG) debug(pae);
- }
- catch (MalformedURLException mue)
- {
- if (DEBUG) debug(mue);
- }
- for (Iterator it = policyFiles.iterator(); it.hasNext(); )
- {
- try
- {
- URL url = (URL) it.next();
- parse(url);
- }
- catch (IOException ioe)
- {
- if (DEBUG) debug(ioe);
- }
- }
- }
-
- public String toString()
- {
- return super.toString() + " [ " + cs2pc.toString() + " ]";
- }
-
- // Own methods.
- // -------------------------------------------------------------------------
-
- private static final int STATE_BEGIN = 0;
- private static final int STATE_GRANT = 1;
- private static final int STATE_PERMS = 2;
-
- /**
- * Parse a policy file, incorporating the permission definitions
- * described therein.
- *
- * @param url The URL of the policy file to read.
- * @throws IOException if an I/O error occurs, or if the policy file
- * cannot be parsed.
- */
- private void parse(final URL url) throws IOException
- {
- if (DEBUG) debug ("reading policy file from " + url);
- final StreamTokenizer in = new StreamTokenizer(new InputStreamReader(url.openStream()));
- in.resetSyntax();
- in.slashSlashComments(true);
- in.slashStarComments(true);
- in.wordChars('A', 'Z');
- in.wordChars('a', 'z');
- in.wordChars('0', '9');
- in.wordChars('.', '.');
- in.wordChars('_', '_');
- in.wordChars('$', '$');
- in.whitespaceChars(' ', ' ');
- in.whitespaceChars('\t', '\t');
- in.whitespaceChars('\f', '\f');
- in.whitespaceChars('\n', '\n');
- in.whitespaceChars('\r', '\r');
- in.quoteChar('\'');
- in.quoteChar('"');
-
- int tok;
- int state = STATE_BEGIN;
- List keystores = new LinkedList();
- URL currentBase = null;
- List currentCerts = new LinkedList();
- Permissions currentPerms = new Permissions();
- while ((tok = in.nextToken()) != StreamTokenizer.TT_EOF)
- {
- switch (tok)
- {
- case '{':
- if (state != STATE_GRANT)
- error(url, in, "spurious '{'");
- state = STATE_PERMS;
- tok = in.nextToken();
- break;
- case '}':
- if (state != STATE_PERMS)
- error(url, in, "spurious '}'");
- state = STATE_BEGIN;
- currentPerms.setReadOnly();
- Certificate[] c = null;
- if (!currentCerts.isEmpty())
- c = (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()]);
- cs2pc.put(new CodeSource(currentBase, c), currentPerms);
- currentCerts.clear();
- currentPerms = new Permissions();
- currentBase = null;
- tok = in.nextToken();
- if (tok != ';')
- in.pushBack();
- continue;
- }
- if (tok != StreamTokenizer.TT_WORD)
- {
- error(url, in, "expecting word token");
- }
-
- // keystore "${java.home}/lib/security/java.policy
."policy.file.n"
, for increasing n
- * starting from 1. The sequence stops at the first undefined
- * property, so you must set "policy.file.1"
if you also
- * set "policy.file.2"
, and so on."java.security.policy"
."${property-name}"
into
- * System.getProperty("property-name")
.
- */
- private static String expand(final String s)
- {
- final StringBuffer result = new StringBuffer();
- final StringBuffer prop = new StringBuffer();
- int state = 0;
- for (int i = 0; i < s.length(); i++)
- {
- switch (state)
- {
- case 0:
- if (s.charAt(i) == '$')
- state = 1;
- else
- result.append(s.charAt(i));
- break;
- case 1:
- if (s.charAt(i) == '{')
- state = 2;
- else
- {
- state = 0;
- result.append('$').append(s.charAt(i));
- }
- break;
- case 2:
- if (s.charAt(i) == '}')
- {
- String p = prop.toString();
- if (p.equals("/"))
- p = "file.separator";
- p = System.getProperty(p);
- if (p == null)
- p = "";
- result.append(p);
- prop.setLength(0);
- state = 0;
- }
- else
- prop.append(s.charAt(i));
- break;
- }
- }
- if (state != 0)
- result.append('$').append('{').append(prop);
- return result.toString();
- }
-
- /**
- * I miss macros.
- */
- private static void error(URL base, StreamTokenizer in, String msg)
- throws IOException
- {
- throw new IOException(base+":"+in.lineno()+": "+msg);
- }
-}
diff --git a/libjava/gnu/java/security/action/GetPropertyAction.java b/libjava/gnu/java/security/action/GetPropertyAction.java
deleted file mode 100644
index 2886deb3474..00000000000
--- a/libjava/gnu/java/security/action/GetPropertyAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* GetPropertyAction.java
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.security.action;
-
-import java.security.PrivilegedAction;
-
-/**
- * PrivilegedAction implementation that calls System.getProperty() with
- * the property name passed to its constructor.
- *
- * Example of use:
- *
- * GetPropertyAction action = new GetPropertyAction("http.proxyPort");
- * String port = AccessController.doPrivileged(action);
- *
- */
-public class GetPropertyAction implements PrivilegedAction
-{
- String name;
- String value = null;
-
- public GetPropertyAction()
- {
- }
-
- public GetPropertyAction(String propName)
- {
- setParameters(propName);
- }
-
- public GetPropertyAction(String propName, String defaultValue)
- {
- setParameters(propName, defaultValue);
- }
-
- public Object run()
- {
- return System.getProperty(name, value);
- }
-
- public GetPropertyAction setParameters(String propName)
- {
- this.name = propName;
- this.value = null;
- return this;
- }
-
- public GetPropertyAction setParameters(String propName, String defaultValue)
- {
- this.name = propName;
- this.value = defaultValue;
- return this;
- }
-}
diff --git a/libjava/gnu/java/security/action/GetSecurityPropertyAction.java b/libjava/gnu/java/security/action/GetSecurityPropertyAction.java
deleted file mode 100644
index 97fa15d03e5..00000000000
--- a/libjava/gnu/java/security/action/GetSecurityPropertyAction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* GetSecurityPropertyAction.java
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.security.action;
-
-import java.security.PrivilegedAction;
-import java.security.Security;
-
-/**
- * PrivilegedAction implementation that calls Security.getProperty()
- * with the property name passed to its constructor.
- *
- * Example of use:
- *
- * GetSecurityPropertyAction action = new GetSecurityPropertyAction("javax.net.ssl.trustStorePassword");
- * String passwd = AccessController.doPrivileged(action);
- *
- */
-public class GetSecurityPropertyAction implements PrivilegedAction
-{
- private String name;
- private String value;
-
- public GetSecurityPropertyAction()
- {
- }
-
- public GetSecurityPropertyAction(String propName)
- {
- setParameters(propName);
- }
-
- public GetSecurityPropertyAction(String propName, String defaultValue)
- {
- setParameters(propName, defaultValue);
- }
-
- public GetSecurityPropertyAction setParameters(String propName)
- {
- this.name = propName;
- this.value = null;
- return this;
- }
-
- public GetSecurityPropertyAction setParameters(String propName, String defaultValue)
- {
- this.name = propName;
- this.value = defaultValue;
- return this;
- }
-
- public Object run()
- {
- String val = Security.getProperty(name);
- if (val == null)
- val = value;
- return val;
- }
-}
diff --git a/libjava/gnu/java/security/action/SetAccessibleAction.java b/libjava/gnu/java/security/action/SetAccessibleAction.java
deleted file mode 100644
index 77e5fc988b8..00000000000
--- a/libjava/gnu/java/security/action/SetAccessibleAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* SetAccessibleAction.java
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.security.action;
-
-import java.lang.reflect.AccessibleObject;
-import java.security.PrivilegedAction;
-
-/**
- * PrivilegedAction implementation that calls setAccessible(true) on the
- * AccessibleObject passed to its constructor.
- *
- * Example of use:
- *
- * Field dataField = cl.getDeclaredField("data");
- * AccessController.doPrivileged(new SetAccessibleAction(dataField));
- *
- */
-public class SetAccessibleAction implements PrivilegedAction
-{
- AccessibleObject member;
-
- public SetAccessibleAction()
- {
- }
-
- public SetAccessibleAction(AccessibleObject member)
- {
- this.member = member;
- }
-
- public Object run()
- {
- member.setAccessible(true);
- return null;
- }
-
- public SetAccessibleAction setMember(AccessibleObject member)
- {
- this.member = member;
- return this;
- }
-}
diff --git a/libjava/gnu/java/security/ber/BER.java b/libjava/gnu/java/security/ber/BER.java
deleted file mode 100644
index 7efb1bf90cc..00000000000
--- a/libjava/gnu/java/security/ber/BER.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/* BER.java -- basic encoding rules (BER) constants.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.ber;
-
-import gnu.java.security.der.DER;
-
-public interface BER extends DER
-{
- BERValue END_OF_SEQUENCE = new BERValue(0, null);
-}
diff --git a/libjava/gnu/java/security/ber/BEREncodingException.java b/libjava/gnu/java/security/ber/BEREncodingException.java
deleted file mode 100644
index aad10932cc4..00000000000
--- a/libjava/gnu/java/security/ber/BEREncodingException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* BEREncodingException.java --- BER Encoding Exception
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.ber;
-
-import gnu.java.security.der.DEREncodingException;
-
-public class BEREncodingException extends DEREncodingException
-{
- public BEREncodingException()
- {
- super ();
- }
-
- public BEREncodingException (String msg)
- {
- super (msg);
- }
-}
diff --git a/libjava/gnu/java/security/ber/BERReader.java b/libjava/gnu/java/security/ber/BERReader.java
deleted file mode 100644
index 53a3f3ee9a9..00000000000
--- a/libjava/gnu/java/security/ber/BERReader.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/* BERReader.java -- basic encoding rules (BER) reader.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.ber;
-
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class BERReader extends DERReader implements BER
-{
-
- /**
- * Create a new DER reader from a byte array.
- *
- * @param in The encoded bytes.
- */
- public BERReader(byte[] in)
- {
- super(in);
- }
-
- public BERReader (byte[] in, int off, int len)
- {
- super(in, off, len);
- }
-
- /**
- * Create a new DER readed from an input stream.
- *
- * @param in The encoded bytes.
- */
- public BERReader(InputStream in)
- {
- super(in);
- }
-
- public DERValue read() throws IOException
- {
- in.mark(2);
- int tag = in.read();
- if (tag == -1)
- throw new EOFException();
- int length = in.read();
- if (length == 0)
- {
- if (tag == 0)
- return END_OF_SEQUENCE;
- return new BERValue(tag, CONSTRUCTED_VALUE, new byte[] { (byte) tag, 0 });
- }
- else
- {
- in.reset();
- return super.read();
- }
- }
-
- public int peek() throws IOException
- {
- in.mark(1);
- int ret = in.read();
- in.reset();
- return ret;
- }
-}
diff --git a/libjava/gnu/java/security/ber/BERValue.java b/libjava/gnu/java/security/ber/BERValue.java
deleted file mode 100644
index aeaef39bf2b..00000000000
--- a/libjava/gnu/java/security/ber/BERValue.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* BERReader.java -- basic encoding rules (BER) value.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.ber;
-
-import gnu.java.security.der.DERValue;
-
-public class BERValue extends DERValue
-{
-
- private boolean indefinite;
-
- public BERValue(int tag, Object value, byte[] encoded)
- {
- super(tag, 0, value, encoded);
- indefinite = true;
- }
-
- public BERValue(int tag, int length, Object value, byte[] encoded)
- {
- super(tag, length, value, encoded);
- }
-
- public BERValue(int tag, Object value)
- {
- super(tag, 0, value, null);
- }
-
- public static boolean isIndefinite(DERValue value)
- {
- if (value instanceof BERValue)
- return ((BERValue) value).getIndefinite();
- return false;
- }
-
- public boolean getIndefinite()
- {
- return indefinite;
- }
-
- public int getLength()
- {
- if (indefinite)
- return 0;
- return super.getLength();
- }
-}
diff --git a/libjava/gnu/java/security/der/BitString.java b/libjava/gnu/java/security/der/BitString.java
deleted file mode 100644
index b88b14541b6..00000000000
--- a/libjava/gnu/java/security/der/BitString.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/* BitString.java -- Java representation of the BIT STRING type.
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.der;
-
-import java.math.BigInteger;
-import java.util.Arrays;
-
-/**
- * Immutable representation of a bit string, which is equivalent to a
- * byte array except some number of the rightmost bits are ignored. For
- * example, this could be the bit string:
- *
- * 00010101 11101101 11010xxx
- *
- * true
value
- * corresponding to each "1" in this bit string. The boolean array is
- * cloned before it is returned.
- *
- * @return The boolean array.
- */
- public boolean[] toBooleanArray()
- {
- if (boolVal == null)
- {
- boolVal = new boolean[size()];
- for (int i = 0, j = 7, k = 0; i < boolVal.length; i++)
- {
- boolVal[i] = (bytes[k] & 1 << j--) != 0;
- if (j < 0)
- {
- j = 7;
- k++;
- }
- }
- }
- return (boolean[]) boolVal.clone();
- }
-
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException cce)
- {
- throw new InternalError(cce.getMessage());
- }
- }
-
- public int compareTo(Object o)
- {
- BitString that = (BitString) o;
- if (this.equals(that))
- return 0;
- if (this.bytes.length != that.bytes.length)
- return (this.bytes.length < that.bytes.length) ? -1 : 1;
- if (this.ignoredBits != that.ignoredBits)
- return (this.ignoredBits < that.ignoredBits) ? -1 : 1;
- for (int i = 0; i < this.bytes.length; i++)
- if (this.bytes[i] != that.bytes[i])
- return (this.bytes[i] < that.bytes[i]) ? -1 : 1;
- return 0; // not reached.
- }
-
- public boolean equals(Object o)
- {
- if (!(o instanceof BitString))
- return false;
- BitString that = (BitString) o;
- // True for cloned instances.
- if (this.bytes == that.bytes && this.ignoredBits == that.ignoredBits)
- return true;
- if (this.ignoredBits == that.ignoredBits)
- return Arrays.equals(this.bytes, that.bytes);
- return false;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- for (int i = 0, j = 7, k = 0; i < size(); i++)
- {
- sb.append((bytes[k] & 1 << j) != 0 ? "1" : "0");
- j--;
- if (j < 0)
- {
- j = 7;
- k++;
- }
- }
- return sb.toString();
- }
-}
diff --git a/libjava/gnu/java/security/der/DER.java b/libjava/gnu/java/security/der/DER.java
deleted file mode 100644
index a7eb4a6895e..00000000000
--- a/libjava/gnu/java/security/der/DER.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/* DER.java -- Basic constants in DER sequences.
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.der;
-
-/**
- * The set of tags for DER types.
- *
- * @author Casey Marshall (csm@gnu.org)
- */
-public interface DER
-{
- int UNIVERSAL = 0x00;
- int APPLICATION = 0x40;
- int CONTEXT = 0x80;
- int PRIVATE = 0xC0;
-
- int CONSTRUCTED = 0x20;
-
- int ANY = 0x00;
- int BOOLEAN = 0x01;
- int INTEGER = 0x02;
- int BIT_STRING = 0x03;
- int OCTET_STRING = 0x04;
- int NULL = 0x05;
- int OBJECT_IDENTIFIER = 0x06;
- int REAL = 0x09;
- int ENUMERATED = 0x0a;
- int RELATIVE_OID = 0x0d;
-
- int SEQUENCE = 0x10;
- int SET = 0x11;
-
- Object CONSTRUCTED_VALUE = new Object();
-
- int NUMERIC_STRING = 0x12;
- int PRINTABLE_STRING = 0x13;
- int T61_STRING = 0x14;
- int VIDEOTEX_STRING = 0x15;
- int IA5_STRING = 0x16;
- int GRAPHIC_STRING = 0x19;
- int ISO646_STRING = 0x1A;
- int GENERAL_STRING = 0x1B;
-
- int UTF8_STRING = 0x0C;
- int UNIVERSAL_STRING = 0x1C;
- int BMP_STRING = 0x1E;
-
- int UTC_TIME = 0x17;
- int GENERALIZED_TIME = 0x18;
-}
diff --git a/libjava/gnu/java/security/der/DEREncodingException.java b/libjava/gnu/java/security/der/DEREncodingException.java
deleted file mode 100644
index 90042a3fc54..00000000000
--- a/libjava/gnu/java/security/der/DEREncodingException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* DEREncodingException.java --- DER Encoding Exception
- Copyright (C) 1999,2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.der;
-
-import java.io.IOException;
-
-public class DEREncodingException extends IOException
-{
- public DEREncodingException()
- {
- super ();
- }
-
- public DEREncodingException (String msg)
- {
- super (msg);
- }
-}
diff --git a/libjava/gnu/java/security/der/DERReader.java b/libjava/gnu/java/security/der/DERReader.java
deleted file mode 100644
index cb07f14325f..00000000000
--- a/libjava/gnu/java/security/der/DERReader.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/* DERReader.java -- parses ASN.1 DER sequences
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.der;
-
-import gnu.java.security.OID;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * This class decodes DER sequences into Java objects. The methods of
- * this class do not have knowledge of higher-levels of structure in the
- * DER stream -- such as ASN.1 constructions -- and it is therefore up
- * to the calling application to determine if the data are structured
- * properly by inspecting the {@link DERValue} that is returned.
- *
- * @author Casey Marshall (csm@gnu.org)
- */
-public class DERReader implements DER
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- protected InputStream in;
-
- protected final ByteArrayOutputStream encBuf;
-
- // Constructor.
- // ------------------------------------------------------------------------
-
- /**
- * Create a new DER reader from a byte array.
- *
- * @param in The encoded bytes.
- */
- public DERReader(byte[] in)
- {
- this(new ByteArrayInputStream(in));
- }
-
- public DERReader (byte[] in, int off, int len)
- {
- this (new ByteArrayInputStream (in, off, len));
- }
-
- /**
- * Create a new DER readed from an input stream.
- *
- * @param in The encoded bytes.
- */
- public DERReader(InputStream in)
- {
- if (!in.markSupported())
- this.in = new BufferedInputStream(in, 16384);
- else
- this.in = in;
- encBuf = new ByteArrayOutputStream(2048);
- }
-
- // Class methods.
- // ------------------------------------------------------------------------
-
- /**
- * Convenience method for reading a single primitive value from the
- * given byte array.
- *
- * @param encoded The encoded bytes.
- * @throws IOException If the bytes do not represent an encoded
- * object.
- */
- public static DERValue read(byte[] encoded) throws IOException
- {
- return new DERReader(encoded).read();
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- public void skip (int bytes) throws IOException
- {
- in.skip (bytes);
- }
-
- /**
- * Decode a single value from the input stream, returning it in a new
- * {@link DERValue}. By "single value" we mean any single type in its
- * entirety -- including constructed types such as SEQUENCE and all
- * the values they contain. Usually it is sufficient to call this
- * method once to parse and return the top-level structure, then to
- * inspect the returned value for the proper contents.
- *
- * @return The parsed DER structure.
- * @throws IOException If an error occurs reading from the input
- * stream.
- * @throws DEREncodingException If the input does not represent a
- * valid DER stream.
- */
- public DERValue read() throws IOException
- {
- int tag = in.read();
- if (tag == -1)
- throw new EOFException();
- encBuf.write(tag);
- int len = readLength();
- DERValue value = null;
- if ((tag & CONSTRUCTED) == CONSTRUCTED)
- {
- in.mark(2048);
- byte[] encoded = new byte[len];
- in.read(encoded);
- encBuf.write(encoded);
- value = new DERValue(tag, len, CONSTRUCTED_VALUE, encBuf.toByteArray());
- in.reset();
- encBuf.reset();
- return value;
- }
- switch (tag & 0xC0)
- {
- case UNIVERSAL:
- value = new DERValue(tag, len, readUniversal(tag, len),
- encBuf.toByteArray());
- encBuf.reset();
- break;
- case CONTEXT:
- byte[] encoded = new byte[len];
- in.read(encoded);
- encBuf.write(encoded);
- value = new DERValue(tag, len, encoded, encBuf.toByteArray());
- encBuf.reset();
- break;
- case APPLICATION:
- // This should not be reached, since (I think) APPLICATION is
- // always constructed.
- throw new DEREncodingException("non-constructed APPLICATION data");
- default:
- throw new DEREncodingException("PRIVATE class not supported");
- }
- return value;
- }
-
- protected int readLength() throws IOException
- {
- int i = in.read();
- if (i == -1)
- throw new EOFException();
- encBuf.write(i);
- if ((i & ~0x7F) == 0)
- {
- return i;
- }
- else if (i < 0xFF)
- {
- byte[] octets = new byte[i & 0x7F];
- in.read(octets);
- encBuf.write(octets);
- return new BigInteger(1, octets).intValue();
- }
- throw new DEREncodingException();
- }
-
- // Own methods.
- // ------------------------------------------------------------------------
-
- private Object readUniversal(int tag, int len) throws IOException
- {
- byte[] value = new byte[len];
- in.read(value);
- encBuf.write(value);
- switch (tag & 0x1F)
- {
- case BOOLEAN:
- if (value.length != 1)
- throw new DEREncodingException();
- return Boolean.valueOf(value[0] != 0);
- case NULL:
- if (len != 0)
- throw new DEREncodingException();
- return null;
- case INTEGER:
- case ENUMERATED:
- return new BigInteger(value);
- case BIT_STRING:
- byte[] bits = new byte[len - 1];
- System.arraycopy(value, 1, bits, 0, bits.length);
- return new BitString(bits, value[0] & 0xFF);
- case OCTET_STRING:
- return value;
- case NUMERIC_STRING:
- case PRINTABLE_STRING:
- case T61_STRING:
- case VIDEOTEX_STRING:
- case IA5_STRING:
- case GRAPHIC_STRING:
- case ISO646_STRING:
- case GENERAL_STRING:
- case UNIVERSAL_STRING:
- case BMP_STRING:
- case UTF8_STRING:
- return makeString(tag, value);
- case UTC_TIME:
- case GENERALIZED_TIME:
- return makeTime(tag, value);
- case OBJECT_IDENTIFIER:
- return new OID(value);
- case RELATIVE_OID:
- return new OID(value, true);
- default:
- throw new DEREncodingException("unknown tag " + tag);
- }
- }
-
- private static String makeString(int tag, byte[] value)
- throws IOException
- {
- switch (tag & 0x1F)
- {
- case NUMERIC_STRING:
- case PRINTABLE_STRING:
- case T61_STRING:
- case VIDEOTEX_STRING:
- case IA5_STRING:
- case GRAPHIC_STRING:
- case ISO646_STRING:
- case GENERAL_STRING:
- return fromIso88591(value);
-
- case UNIVERSAL_STRING:
- // XXX The docs say UniversalString is encoded in four bytes
- // per character, but Java has no support (yet) for UTF-32.
- //return new String(buf, "UTF-32");
- case BMP_STRING:
- return fromUtf16Be(value);
-
- case UTF8_STRING:
- return fromUtf8(value);
-
- default:
- throw new DEREncodingException("unknown string tag");
- }
- }
-
- private static String fromIso88591(byte[] bytes)
- {
- StringBuffer str = new StringBuffer(bytes.length);
- for (int i = 0; i < bytes.length; i++)
- str.append((char) (bytes[i] & 0xFF));
- return str.toString();
- }
-
- private static String fromUtf16Be(byte[] bytes) throws IOException
- {
- if ((bytes.length & 0x01) != 0)
- throw new IOException("UTF-16 bytes are odd in length");
- StringBuffer str = new StringBuffer(bytes.length / 2);
- for (int i = 0; i < bytes.length; i += 2)
- {
- char c = (char) ((bytes[i] << 8) & 0xFF);
- c |= (char) (bytes[i+1] & 0xFF);
- str.append(c);
- }
- return str.toString();
- }
-
- private static String fromUtf8(byte[] bytes) throws IOException
- {
- StringBuffer str = new StringBuffer((int)(bytes.length / 1.5));
- for (int i = 0; i < bytes.length; )
- {
- char c = 0;
- if ((bytes[i] & 0xE0) == 0xE0)
- {
- if ((i + 2) >= bytes.length)
- throw new IOException("short UTF-8 input");
- c = (char) ((bytes[i++] & 0x0F) << 12);
- if ((bytes[i] & 0x80) != 0x80)
- throw new IOException("malformed UTF-8 input");
- c |= (char) ((bytes[i++] & 0x3F) << 6);
- if ((bytes[i] & 0x80) != 0x80)
- throw new IOException("malformed UTF-8 input");
- c |= (char) (bytes[i++] & 0x3F);
- }
- else if ((bytes[i] & 0xC0) == 0xC0)
- {
- if ((i + 1) >= bytes.length)
- throw new IOException("short input");
- c = (char) ((bytes[i++] & 0x1F) << 6);
- if ((bytes[i] & 0x80) != 0x80)
- throw new IOException("malformed UTF-8 input");
- c |= (char) (bytes[i++] & 0x3F);
- }
- else if ((bytes[i] & 0xFF) < 0x80)
- {
- c = (char) (bytes[i++] & 0xFF);
- }
- else
- throw new IOException("badly formed UTF-8 sequence");
- str.append(c);
- }
- return str.toString();
- }
-
- private Date makeTime(int tag, byte[] value) throws IOException
- {
- Calendar calendar = Calendar.getInstance();
- String str = makeString(PRINTABLE_STRING, value);
-
- // Classpath's SimpleDateFormat does not work for parsing these
- // types of times, so we do this by hand.
- String date = str;
- String tz = "";
- if (str.indexOf("+") > 0)
- {
- date = str.substring(0, str.indexOf("+"));
- tz = str.substring(str.indexOf("+"));
- }
- else if (str.indexOf("-") > 0)
- {
- date = str.substring(0, str.indexOf("-"));
- tz = str.substring(str.indexOf("-"));
- }
- else if (str.endsWith("Z"))
- {
- date = str.substring(0, str.length()-2);
- tz = "Z";
- }
- if (!tz.equals("Z") && tz.length() > 0)
- calendar.setTimeZone(TimeZone.getTimeZone(tz));
- else
- calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
- if ((tag & 0x1F) == UTC_TIME)
- {
- if (date.length() < 10) // must be at least 10 chars long
- throw new DEREncodingException("cannot parse date");
- // UTCTime is of the form "yyMMddHHmm[ss](Z|(+|-)hhmm)"
- try
- {
- int year = Integer.parseInt(str.substring(0, 2));
- if (year < 50)
- year += 2000;
- else
- year += 1900;
- calendar.set(year,
- Integer.parseInt(str.substring( 2, 4))-1, // month
- Integer.parseInt(str.substring( 4, 6)), // day
- Integer.parseInt(str.substring( 6, 8)), // hour
- Integer.parseInt(str.substring( 8, 10))); // minute
- if (date.length() == 12);
- calendar.set(Calendar.SECOND,
- Integer.parseInt(str.substring(10, 12)));
- }
- catch (NumberFormatException nfe)
- {
- throw new DEREncodingException("cannot parse date");
- }
- }
- else
- {
- if (date.length() < 10) // must be at least 10 chars long
- throw new DEREncodingException("cannot parse date");
- // GeneralTime is of the form "yyyyMMddHH[mm[ss[(.|,)SSSS]]]"
- // followed by "Z" or "(+|-)hh[mm]"
- try
- {
- calendar.set(
- Integer.parseInt(date.substring(0, 4)), // year
- Integer.parseInt(date.substring(4, 6))-1, // month
- Integer.parseInt(date.substring(6, 8)), // day
- Integer.parseInt(date.substring(8, 10)), 0); // hour, min
- switch (date.length())
- {
- case 19:
- case 18:
- case 17:
- case 16:
- calendar.set(Calendar.MILLISECOND,
- Integer.parseInt(date.substring(15)));
- case 14:
- calendar.set(Calendar.SECOND,
- Integer.parseInt(date.substring(12, 14)));
- case 12:
- calendar.set(Calendar.MINUTE,
- Integer.parseInt(date.substring(10, 12)));
- }
- }
- catch (NumberFormatException nfe)
- {
- throw new DEREncodingException("cannot parse date");
- }
- }
- return calendar.getTime();
- }
-}
diff --git a/libjava/gnu/java/security/der/DERValue.java b/libjava/gnu/java/security/der/DERValue.java
deleted file mode 100644
index 9a597d724cc..00000000000
--- a/libjava/gnu/java/security/der/DERValue.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/* DERValue.java -- a value read or written to a DER encoding.
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.der;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class DERValue implements DER
-{
-
- // Fields.
- // ------------------------------------------------------------------------
-
- private final int tagClass;
- private final boolean constructed;
- private final int tag;
- private int length;
- private final Object value;
- private byte[] encoded;
-
- // Constructor.
- // ------------------------------------------------------------------------
-
- public DERValue(int tag, int length, Object value, byte[] encoded)
- {
- tagClass = tag & 0xC0;
- this.tag = tag & 0x1F;
- constructed = (tag & CONSTRUCTED) == CONSTRUCTED;
- this.length = length;
- this.value = value;
- if (encoded != null)
- this.encoded = (byte[]) encoded.clone();
- }
-
- public DERValue(int tag, Object value)
- {
- this(tag, 0, value, null);
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- public int getExternalTag()
- {
- return tagClass | tag | (constructed ? 0x20 : 0x00);
- }
-
- public int getTag()
- {
- return tag;
- }
-
- public int getTagClass()
- {
- return tagClass;
- }
-
- public boolean isConstructed()
- {
- return constructed;
- }
-
- public int getLength()
- {
- if (encoded == null)
- {
- try
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- length = DERWriter.write(out, this);
- encoded = out.toByteArray();
- }
- catch (IOException ioe)
- {
- encoded = new byte[0];
- }
- }
- return length;
- }
-
- public Object getValue()
- {
- return value;
- }
-
- public Object getValueAs (final int derType) throws IOException
- {
- byte[] encoded = getEncoded ();
- encoded[0] = (byte) derType;
- return DERReader.read (encoded).getValue ();
- }
-
- public byte[] getEncoded()
- {
- if (encoded == null)
- {
- try
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- length = DERWriter.write(out, this);
- encoded = out.toByteArray();
- }
- catch (IOException ioe)
- {
- encoded = new byte[0];
- }
- }
- return (byte[]) encoded.clone();
- }
-
- public int getEncodedLength()
- {
- if (encoded == null)
- {
- try
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- length = DERWriter.write(out, this);
- encoded = out.toByteArray();
- }
- catch (IOException ioe)
- {
- encoded = new byte[0];
- }
- }
- return encoded.length;
- }
-
- public String toString()
- {
- return "DERValue [ tag=" + tag + ", class=" + tagClass + ", constructed="
- + constructed + ", value=" + value + " ]";
- }
-}
diff --git a/libjava/gnu/java/security/der/DERWriter.java b/libjava/gnu/java/security/der/DERWriter.java
deleted file mode 100644
index 78524fc949f..00000000000
--- a/libjava/gnu/java/security/der/DERWriter.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/* DERWriter.java -- write Java types in DER format.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.der;
-
-import gnu.java.security.OID;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import java.math.BigInteger;
-
-import java.text.SimpleDateFormat;
-
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TimeZone;
-
-/**
- * Methods that allow various Java types to be written as a DER
- * (Distinguished Encoding Rules) stream to the specified output stream.
- * DER is used to encode ASN.1 constructions, but this class provides no
- * methods for interacting with ASN.1. Rather, callers should construct
- * their output objects properly for whatever ASN.1 construct is being
- * output.
- *
- *
- * SignedData ::= SEQUENCE {
- * version Version,
- * digestAlgorithms DigestAlgorithmIdentifiers,
- * contentInfo ContentInfo,
- * certificates
- * [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL,
- * crls
- * [1] IMPLICIT CertificateRevocationLists OPTIONAL,
- * signerInfos SignerInfos }
- *
- * Version ::= INTEGER
- *
- * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
- *
- * DigestAlgorithmIdentifier ::= AlgorithmIdentifier
- *
- * ContentInfo ::= SEQUENCE {
- * contentType ContentType,
- * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
- *
- * ContentType ::= OBJECT IDENTIFIER
- *
- * ExtendedCertificatesAndCertificates ::=
- * SET OF ExtendedCertificatesAndCertificate
- *
- * ExtendedCertificatesAndCertificate ::= CHOICE {
- * certificate Certificate, -- from X.509
- * extendedCertificate [0] IMPLICIT ExtendedCertificate }
- *
- * CertificateRevocationLists ::= SET OF CertificateRevocationList
- * -- from X.509
- *
- * SignerInfos ::= SET OF SignerInfo
- *
- * SignerInfo ::= SEQUENCE {
- * version Version,
- * issuerAndSerialNumber IssuerAndSerialNumber,
- * digestAlgorithm DigestAlgorithmIdentifier,
- * authenticatedAttributes
- * [0] IMPLICIT Attributes OPTIONAL,
- * digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
- * encryptedDigest EncryptedDigest,
- * unauthenticatedAttributes
- * [1] IMPLICIT Attributes OPTIONAL }
- *
- * EncryptedDigest ::= OCTET STRING
- *
- *
- * PrivateKeyInfo
, as described in
- * PKCS #8. The ASN.1 specification for this structure is:
- *
- *
- *
- *
- * PrivateKeyInfo ::= SEQUENCE {
- * version Version,
- * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
- * privateKey PrivateKey,
- * attributes [0] IMPLICIT Attributes OPTIONAL }
- *
- * Version ::= INTEGER
- *
- * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
- *
- * PrivateKey ::= OCTET STRING
- *
- * Attributes ::= SET OF Attribute
- *
- */
- public byte[] getEncoded()
- {
- if (encodedKey != null)
- return (byte[]) encodedKey.clone();
- try
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ArrayList spki = new ArrayList(2);
- ArrayList alg = new ArrayList(2);
- alg.add(new DERValue(DER.OBJECT_IDENTIFIER,
- new OID("1.2.840.113549.1.1.1")));
- ArrayList params = new ArrayList(3);
- params.add(new DERValue(DER.INTEGER, p));
- params.add(new DERValue(DER.INTEGER, q));
- params.add(new DERValue(DER.INTEGER, g));
- alg.add(new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, params));
- spki.add(new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, alg));
- spki.add(new DERValue(DER.BIT_STRING, new BitString(y.toByteArray())));
- DERWriter.write(out, new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, spki));
- return (byte[]) (encodedKey = out.toByteArray()).clone();
- }
- catch (IOException ioe)
- {
- return null;
- }
- }
-
- public DSAParams getParams()
- {
- if (p == null || q == null || g == null)
- return null;
- return (DSAParams)(new DSAParameterSpec(p,q,g));
- }
-
- public BigInteger getY()
- {
- return y;
- }
-
- public String toString()
- {
- return
- "GnuDSAPublicKey: y=" + (y != null ? y.toString(16) : "(null)") +
- " p=" + (p != null ? p.toString(16) : "(null)") +
- " q=" + (q != null ? q.toString(16) : "(null)") +
- " g=" + (g != null ? g.toString(16) : "(null)");
- }
-}
diff --git a/libjava/gnu/java/security/provider/GnuRSAPrivateKey.java b/libjava/gnu/java/security/provider/GnuRSAPrivateKey.java
deleted file mode 100644
index b09fc88bc5c..00000000000
--- a/libjava/gnu/java/security/provider/GnuRSAPrivateKey.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/* GnuRSAPrivateKey.java -- GNU RSA private key.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERValue;
-
-import java.math.BigInteger;
-import java.security.interfaces.RSAPrivateCrtKey;
-import java.security.spec.RSAPrivateCrtKeySpec;
-import java.util.ArrayList;
-
-class GnuRSAPrivateKey implements RSAPrivateCrtKey
-{
-
- // Fields.
- // -------------------------------------------------------------------------
-
- private final RSAPrivateCrtKeySpec spec;
- private byte[] encodedKey;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public GnuRSAPrivateKey(RSAPrivateCrtKeySpec spec)
- {
- this.spec = spec;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public BigInteger getModulus()
- {
- return spec.getModulus();
- }
-
- public BigInteger getPrivateExponent()
- {
- return spec.getPrivateExponent();
- }
-
- public BigInteger getCrtCoefficient()
- {
- return spec.getCrtCoefficient();
- }
-
- public BigInteger getPrimeExponentP()
- {
- return spec.getPrimeExponentP();
- }
-
- public BigInteger getPrimeExponentQ()
- {
- return spec.getPrimeExponentQ();
- }
-
- public BigInteger getPrimeP()
- {
- return spec.getPrimeP();
- }
-
- public BigInteger getPrimeQ()
- {
- return spec.getPrimeQ();
- }
-
- public BigInteger getPublicExponent()
- {
- return spec.getPublicExponent();
- }
-
- public String getAlgorithm()
- {
- return "RSA";
- }
-
- public String getFormat()
- {
- return "PKCS#8";
- }
-
- /**
- * The encoded form is:
- *
- *
- * SubjectPublicKeyInfo ::= SEQUENCE {
- * algorithm AlgorithmIdentifier,
- * subjectPublicKey BIT STRING }
- *
- * RSAPrivateKey ::= SEQUENCE {
- * version Version,
- * modulus INTEGER, -- n
- * publicExponent INTEGER, -- e
- * privateExponent INTEGER, -- d
- * prime1 INTEGER, -- p
- * prime2 INTEGER, -- q
- * exponent1 INTEGER, -- d mod (p-1)
- * exponent2 INTEGER, -- d mod (q-1)
- * coefficient INTEGER -- (inverse of q) mod p }
- *
- *
- *
- *
- *
- * @param crl The CRL being checked.
- * @param path The path this CRL is being checked against.
- * @param now The value to use as 'now'.
- * @param pubKeySubject The subject of the public key.
- * @param pubKey The public key to check.
- * @return True if the CRL is acceptable.
- */
- private static boolean checkCRL(X509CRL crl, X509Certificate[] path, Date now,
- X509Certificate pubKeyCert, PublicKey pubKey,
- List certStores)
- {
- Date nextUpdate = crl.getNextUpdate();
- if (nextUpdate != null && nextUpdate.compareTo(now) < 0)
- return false;
- if (crl.hasUnsupportedCriticalExtension())
- return false;
- for (int i = 0; i < path.length; i++)
- {
- if (!path[i].getSubjectDN().equals(crl.getIssuerDN()))
- continue;
- boolean[] keyUsage = path[i].getKeyUsage();
- if (keyUsage != null)
- {
- if (!keyUsage[KeyUsage.CRL_SIGN])
- continue;
- }
- try
- {
- crl.verify(path[i].getPublicKey());
- return true;
- }
- catch (Exception x)
- {
- }
- }
- if (crl.getIssuerDN().equals(pubKeyCert.getSubjectDN()))
- {
- try
- {
- boolean[] keyUsage = pubKeyCert.getKeyUsage();
- if (keyUsage != null)
- {
- if (!keyUsage[KeyUsage.CRL_SIGN])
- throw new Exception();
- }
- crl.verify(pubKey);
- return true;
- }
- catch (Exception x)
- {
- }
- }
- try
- {
- X509CertSelectorImpl select = new X509CertSelectorImpl();
- select.addSubjectName(crl.getIssuerDN());
- List certs = new LinkedList();
- for (Iterator it = certStores.iterator(); it.hasNext(); )
- {
- CertStore cs = (CertStore) it.next();
- try
- {
- certs.addAll(cs.getCertificates(select));
- }
- catch (CertStoreException cse)
- {
- }
- }
- for (Iterator it = certs.iterator(); it.hasNext(); )
- {
- X509Certificate c = (X509Certificate) it.next();
- for (int i = 0; i < path.length; i++)
- {
- if (!c.getIssuerDN().equals(path[i].getSubjectDN()))
- continue;
- boolean[] keyUsage = c.getKeyUsage();
- if (keyUsage != null)
- {
- if (!keyUsage[KeyUsage.CRL_SIGN])
- continue;
- }
- try
- {
- c.verify(path[i].getPublicKey());
- crl.verify(c.getPublicKey());
- return true;
- }
- catch (Exception x)
- {
- }
- }
- if (c.getIssuerDN().equals(pubKeyCert.getSubjectDN()))
- {
- c.verify(pubKey);
- crl.verify(c.getPublicKey());
- }
- }
- }
- catch (Exception x)
- {
- }
- return false;
- }
-
- private static Set getCritExts(X509Certificate cert)
- {
- HashSet s = new HashSet();
- if (cert instanceof GnuPKIExtension)
- {
- Collection exts = ((GnuPKIExtension) cert).getExtensions();
- for (Iterator it = exts.iterator(); it.hasNext(); )
- {
- Extension ext = (Extension) it.next();
- if (ext.isCritical() && !ext.isSupported())
- s.add(ext.getOid().toString());
- }
- }
- else
- s.addAll(cert.getCriticalExtensionOIDs());
- return s;
- }
-
- /**
- * Perform a basic sanity check on the CA certificate at index
.
- */
- private static void basicSanity(X509Certificate[] path, int index)
- throws CertPathValidatorException
- {
- X509Certificate cert = path[index];
- int pathLen = 0;
- for (int i = index - 1; i > 0; i--)
- {
- if (!path[i].getIssuerDN().equals(path[i].getSubjectDN()))
- pathLen++;
- }
- Extension e = null;
- if (cert instanceof GnuPKIExtension)
- {
- e = ((GnuPKIExtension) cert).getExtension(BasicConstraints.ID);
- }
- else
- {
- try
- {
- e = new Extension(cert.getExtensionValue(BasicConstraints.ID.toString()));
- }
- catch (Exception x)
- {
- }
- }
- if (e == null)
- throw new CertPathValidatorException("no basicConstraints");
- BasicConstraints bc = (BasicConstraints) e.getValue();
- if (!bc.isCA())
- throw new CertPathValidatorException("certificate cannot be used to verify signatures");
- if (bc.getPathLengthConstraint() >= 0 && bc.getPathLengthConstraint() < pathLen)
- throw new CertPathValidatorException("path is too long");
-
- boolean[] keyUsage = cert.getKeyUsage();
- if (keyUsage != null)
- {
- if (!keyUsage[KeyUsage.KEY_CERT_SIGN])
- throw new CertPathValidatorException("certificate cannot be used to sign certificates");
- }
- }
-
- private static void updatePolicyTree(X509Certificate cert, PolicyNodeImpl root,
- int depth, PKIXParameters params,
- boolean explicitPolicy)
- throws CertPathValidatorException
- {
- if (DEBUG) debug("updatePolicyTree depth == " + depth);
- Set nodes = new HashSet();
- LinkedList stack = new LinkedList();
- Iterator current = null;
- stack.addLast(Collections.singleton(root).iterator());
- do
- {
- current = (Iterator) stack.removeLast();
- while (current.hasNext())
- {
- PolicyNodeImpl p = (PolicyNodeImpl) current.next();
- if (DEBUG) debug("visiting node == " + p);
- if (p.getDepth() == depth - 1)
- {
- if (DEBUG) debug("added node");
- nodes.add(p);
- }
- else
- {
- if (DEBUG) debug("skipped node");
- stack.addLast(current);
- current = p.getChildren();
- }
- }
- }
- while (!stack.isEmpty());
-
- Extension e = null;
- CertificatePolicies policies = null;
- List qualifierInfos = null;
- if (cert instanceof GnuPKIExtension)
- {
- e = ((GnuPKIExtension) cert).getExtension(CertificatePolicies.ID);
- if (e != null)
- policies = (CertificatePolicies) e.getValue();
- }
-
- List cp = null;
- if (policies != null)
- cp = policies.getPolicies();
- else
- cp = Collections.EMPTY_LIST;
- boolean match = false;
- if (DEBUG) debug("nodes are == " + nodes);
- if (DEBUG) debug("cert policies are == " + cp);
- for (Iterator it = nodes.iterator(); it.hasNext(); )
- {
- PolicyNodeImpl parent = (PolicyNodeImpl) it.next();
- if (DEBUG) debug("adding policies to " + parent);
- for (Iterator it2 = cp.iterator(); it2.hasNext(); )
- {
- OID policy = (OID) it2.next();
- if (DEBUG) debug("trying to add policy == " + policy);
- if (policy.toString().equals(ANY_POLICY) &&
- params.isAnyPolicyInhibited())
- continue;
- PolicyNodeImpl child = new PolicyNodeImpl();
- child.setValidPolicy(policy.toString());
- child.addExpectedPolicy(policy.toString());
- if (parent.getExpectedPolicies().contains(policy.toString()))
- {
- parent.addChild(child);
- match = true;
- }
- else if (parent.getExpectedPolicies().contains(ANY_POLICY))
- {
- parent.addChild(child);
- match = true;
- }
- else if (ANY_POLICY.equals (policy.toString()))
- {
- parent.addChild (child);
- match = true;
- }
- if (match && policies != null)
- {
- List qualifiers = policies.getPolicyQualifierInfos (policy);
- if (qualifiers != null)
- child.addAllPolicyQualifiers (qualifiers);
- }
- }
- }
- if (!match && (params.isExplicitPolicyRequired() || explicitPolicy))
- throw new CertPathValidatorException("policy tree building failed");
- }
-
- private boolean checkExplicitPolicy (int depth, List explicitPolicies)
- {
- if (DEBUG) debug ("checkExplicitPolicy depth=" + depth);
- for (Iterator it = explicitPolicies.iterator(); it.hasNext(); )
- {
- int[] i = (int[]) it.next();
- int caDepth = i[0];
- int limit = i[1];
- if (DEBUG) debug (" caDepth=" + caDepth + " limit=" + limit);
- if (depth - caDepth >= limit)
- return true;
- }
- return false;
- }
-}
diff --git a/libjava/gnu/java/security/provider/RSA.java b/libjava/gnu/java/security/provider/RSA.java
deleted file mode 100644
index c3cfbbf79f1..00000000000
--- a/libjava/gnu/java/security/provider/RSA.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/* RSA.java -- RSA PKCS#1 signatures.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import gnu.java.security.OID;
-import gnu.java.security.der.DER;
-import gnu.java.security.der.DERReader;
-import gnu.java.security.der.DERValue;
-import gnu.java.security.der.DERWriter;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.MessageDigest;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.SignatureException;
-import java.security.SignatureSpi;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-import java.util.ArrayList;
-
-public abstract class RSA extends SignatureSpi implements Cloneable
-{
-
- // Constants and fields.
- // -------------------------------------------------------------------------
-
- /**
- * digestAlgorithm OBJECT IDENTIFIER ::=
- * { iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) }
- */
- protected static final OID DIGEST_ALGORITHM = new OID("1.2.840.113549.2");
-
- protected final OID digestAlgorithm;
- protected final MessageDigest md;
- protected RSAPrivateKey signerKey;
- protected RSAPublicKey verifierKey;
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- protected RSA(MessageDigest md, OID digestAlgorithm)
- {
- super();
- this.md = md;
- this.digestAlgorithm = digestAlgorithm;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public Object clone() throws CloneNotSupportedException
- {
- return super.clone();
- }
-
- protected Object engineGetParameter(String param)
- {
- throw new UnsupportedOperationException("deprecated");
- }
-
- protected void engineSetParameter(String param, Object value)
- {
- throw new UnsupportedOperationException("deprecated");
- }
-
- protected void engineInitSign(PrivateKey privateKey)
- throws InvalidKeyException
- {
- if (!(privateKey instanceof RSAPrivateKey))
- throw new InvalidKeyException();
- verifierKey = null;
- signerKey = (RSAPrivateKey) privateKey;
- }
-
- protected void engineInitSign(PrivateKey privateKey, SecureRandom random)
- throws InvalidKeyException
- {
- // This class does not need random bytes.
- engineInitSign(privateKey);
- }
-
- protected void engineInitVerify(PublicKey publicKey)
- throws InvalidKeyException
- {
- if (!(publicKey instanceof RSAPublicKey))
- throw new InvalidKeyException();
- signerKey = null;
- verifierKey = (RSAPublicKey) publicKey;
- }
-
- protected void engineUpdate(byte b) throws SignatureException
- {
- if (signerKey == null && verifierKey == null)
- throw new SignatureException("not initialized");
- md.update(b);
- }
-
- protected void engineUpdate(byte[] buf, int off, int len)
- throws SignatureException
- {
- if (signerKey == null && verifierKey == null)
- throw new SignatureException("not initialized");
- md.update(buf, off, len);
- }
-
- protected byte[] engineSign() throws SignatureException
- {
- if (signerKey == null)
- throw new SignatureException("not initialized for signing");
- //
- // The signature will be the RSA encrypted BER representation of
- // the following:
- //
- // DigestInfo ::= SEQUENCE {
- // digestAlgorithm DigestAlgorithmIdentifier,
- // digest Digest }
- //
- // DigestAlgorithmIdentifier ::= AlgorithmIdentifier
- //
- // Digest ::= OCTET STRING
- //
- ArrayList digestAlg = new ArrayList(2);
- digestAlg.add(new DERValue(DER.OBJECT_IDENTIFIER, digestAlgorithm));
- digestAlg.add(new DERValue(DER.NULL, null));
- ArrayList digestInfo = new ArrayList(2);
- digestInfo.add(new DERValue(DER.SEQUENCE, digestAlg));
- digestInfo.add(new DERValue(DER.OCTET_STRING, md.digest()));
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try
- {
- DERWriter.write(out, new DERValue(DER.SEQUENCE, digestInfo));
- }
- catch (IOException ioe)
- {
- throw new SignatureException(ioe.toString());
- }
- byte[] buf = out.toByteArray();
- md.reset();
-
- // k = octect length of the modulus.
- int k = signerKey.getModulus().bitLength();
- k = (k >>> 3) + ((k & 7) == 0 ? 0 : 1);
- if (buf.length < k - 3)
- {
- throw new SignatureException("RSA modulus too small");
- }
- byte[] d = new byte[k];
-
- // Padding type 1:
- // 00 | 01 | FF | ... | FF | 00 | D
- d[1] = 0x01;
- for (int i = 2; i < k - buf.length - 1; i++)
- d[i] = (byte) 0xFF;
- System.arraycopy(buf, 0, d, k - buf.length, buf.length);
-
- BigInteger eb = new BigInteger(d);
-
- byte[] ed = eb.modPow(signerKey.getPrivateExponent(),
- signerKey.getModulus()).toByteArray();
-
- // Ensure output is k octets long.
- if (ed.length < k)
- {
- byte[] b = new byte[k];
- System.arraycopy(eb, 0, b, k - ed.length, ed.length);
- ed = b;
- }
- else if (ed.length > k)
- {
- if (ed.length != k + 1)
- {
- throw new SignatureException("modPow result is larger than the modulus");
- }
- // Maybe an extra 00 octect.
- byte[] b = new byte[k];
- System.arraycopy(ed, 1, b, 0, k);
- ed = b;
- }
-
- return ed;
- }
-
- protected int engineSign(byte[] out, int off, int len)
- throws SignatureException
- {
- if (out == null || off < 0 || len < 0 || off+len > out.length)
- throw new SignatureException("illegal output argument");
- byte[] result = engineSign();
- if (result.length > len)
- throw new SignatureException("not enough space for signature");
- System.arraycopy(result, 0, out, off, result.length);
- return result.length;
- }
-
- protected boolean engineVerify(byte[] sig) throws SignatureException
- {
- if (verifierKey == null)
- throw new SignatureException("not initialized for verifying");
- if (sig == null)
- throw new SignatureException("no signature specified");
- int k = verifierKey.getModulus().bitLength();
- k = (k >>> 3) + ((k & 7) == 0 ? 0 : 1);
- if (sig.length != k)
- throw new SignatureException("signature is the wrong size (expecting "
- + k + " bytes, got " + sig.length + ")");
- BigInteger ed = new BigInteger(1, sig);
- byte[] eb = ed.modPow(verifierKey.getPublicExponent(),
- verifierKey.getModulus()).toByteArray();
-
- int i = 0;
- if (eb[0] == 0x00)
- {
- for (i = 1; i < eb.length && eb[i] == 0x00; i++);
- if (i == 1)
- throw new SignatureException("wrong RSA padding");
- i--;
- }
- else if (eb[0] == 0x01)
- {
- for (i = 1; i < eb.length && eb[i] != 0x00; i++)
- if (eb[i] != (byte) 0xFF)
- throw new IllegalArgumentException("wrong RSA padding");
- }
- else
- throw new SignatureException("wrong RSA padding type");
-
- byte[] d = new byte[eb.length-i-1];
- System.arraycopy(eb, i+1, d, 0, eb.length-i-1);
-
- DERReader der = new DERReader(d);
- try
- {
- DERValue val = der.read();
- if (val.getTag() != DER.SEQUENCE)
- throw new SignatureException("failed to parse DigestInfo");
- val = der.read();
- if (val.getTag() != DER.SEQUENCE)
- throw new SignatureException("failed to parse DigestAlgorithmIdentifier");
- boolean sequenceIsBer = val.getLength() == 0;
- val = der.read();
- if (val.getTag() != DER.OBJECT_IDENTIFIER)
- throw new SignatureException("failed to parse object identifier");
- if (!val.getValue().equals(digestAlgorithm))
- throw new SignatureException("digest algorithms do not match");
- val = der.read();
- // We should never see parameters here, since they are never used.
- if (val.getTag() != DER.NULL)
- throw new SignatureException("cannot handle digest parameters");
- if (sequenceIsBer)
- der.skip(1); // end-of-sequence byte.
- val = der.read();
- if (val.getTag() != DER.OCTET_STRING)
- throw new SignatureException("failed to parse Digest");
- return MessageDigest.isEqual(md.digest(), (byte[]) val.getValue());
- }
- catch (IOException ioe)
- {
- throw new SignatureException(ioe.toString());
- }
- }
-
- protected boolean engineVerify(byte[] sig, int off, int len)
- throws SignatureException
- {
- if (sig == null || off < 0 || len < 0 || off+len > sig.length)
- throw new SignatureException("illegal parameter");
- byte[] buf = new byte[len];
- System.arraycopy(sig, off, buf, 0, len);
- return engineVerify(buf);
- }
-}
diff --git a/libjava/gnu/java/security/provider/RSAKeyFactory.java b/libjava/gnu/java/security/provider/RSAKeyFactory.java
deleted file mode 100644
index d13cbe510a1..00000000000
--- a/libjava/gnu/java/security/provider/RSAKeyFactory.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/* RSAKeyFactory.java -- RSA key factory.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.KeyFactorySpi;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-
-import java.security.interfaces.RSAPrivateCrtKey;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.KeySpec;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.RSAPrivateCrtKeySpec;
-import java.security.spec.RSAPrivateKeySpec;
-import java.security.spec.RSAPublicKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-
-public class RSAKeyFactory extends KeyFactorySpi
-{
-
- // Default constructor.
- // -------------------------------------------------------------------------
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- protected PrivateKey engineGeneratePrivate(KeySpec spec)
- throws InvalidKeySpecException
- {
- if (spec instanceof RSAPrivateCrtKeySpec)
- {
- return new GnuRSAPrivateKey((RSAPrivateCrtKeySpec) spec);
- }
- if (spec instanceof RSAPrivateKeySpec)
- {
- return new GnuRSAPrivateKey(new RSAPrivateCrtKeySpec(
- ((RSAPrivateKeySpec) spec).getModulus(), null,
- ((RSAPrivateKeySpec) spec).getPrivateExponent(), null,
- null, null, null, null));
- }
- if (spec instanceof PKCS8EncodedKeySpec)
- {
- EncodedKeyFactory ekf = new EncodedKeyFactory();
- PrivateKey pk = ekf.engineGeneratePrivate(spec);
- if (pk instanceof RSAPrivateKey)
- return pk;
- }
- throw new InvalidKeySpecException();
- }
-
- protected PublicKey engineGeneratePublic(KeySpec spec)
- throws InvalidKeySpecException
- {
- if (spec instanceof RSAPublicKeySpec)
- {
- return new GnuRSAPublicKey((RSAPublicKeySpec) spec);
- }
- if (spec instanceof X509EncodedKeySpec)
- {
- EncodedKeyFactory ekf = new EncodedKeyFactory();
- PublicKey pk = ekf.engineGeneratePublic(spec);
- if (pk instanceof RSAPublicKey)
- return pk;
- }
- throw new InvalidKeySpecException();
- }
-
- protected KeySpec engineGetKeySpec(Key key, Class keySpec)
- throws InvalidKeySpecException
- {
- if (keySpec.isAssignableFrom(RSAPrivateCrtKeySpec.class)
- && (key instanceof RSAPrivateCrtKey))
- {
- return new RSAPrivateCrtKeySpec(
- ((RSAPrivateCrtKey) key).getModulus(),
- ((RSAPrivateCrtKey) key).getPublicExponent(),
- ((RSAPrivateCrtKey) key).getPrivateExponent(),
- ((RSAPrivateCrtKey) key).getPrimeP(),
- ((RSAPrivateCrtKey) key).getPrimeQ(),
- ((RSAPrivateCrtKey) key).getPrimeExponentP(),
- ((RSAPrivateCrtKey) key).getPrimeExponentQ(),
- ((RSAPrivateCrtKey) key).getCrtCoefficient());
- }
- if (keySpec.isAssignableFrom(RSAPrivateKeySpec.class)
- && (key instanceof RSAPrivateKey))
- {
- return new RSAPrivateKeySpec(
- ((RSAPrivateCrtKey) key).getModulus(),
- ((RSAPrivateCrtKey) key).getPrivateExponent());
- }
- if (keySpec.isAssignableFrom(RSAPublicKeySpec.class)
- && (key instanceof RSAPublicKey))
- {
- return new RSAPublicKeySpec(
- ((RSAPrivateCrtKey) key).getModulus(),
- ((RSAPrivateCrtKey) key).getPublicExponent());
- }
- if (keySpec.isAssignableFrom(PKCS8EncodedKeySpec.class)
- && key.getFormat().equalsIgnoreCase("PKCS#8"))
- {
- return new PKCS8EncodedKeySpec(key.getEncoded());
- }
- if (keySpec.isAssignableFrom(X509EncodedKeySpec.class)
- && key.getFormat().equalsIgnoreCase("X.509"))
- {
- return new X509EncodedKeySpec(key.getEncoded());
- }
- throw new InvalidKeySpecException();
- }
-
- protected Key engineTranslateKey(Key key) throws InvalidKeyException
- {
- if (key instanceof RSAPrivateCrtKey)
- {
- return new GnuRSAPrivateKey(new RSAPrivateCrtKeySpec(
- ((RSAPrivateCrtKey) key).getModulus(),
- ((RSAPrivateCrtKey) key).getPublicExponent(),
- ((RSAPrivateCrtKey) key).getPrivateExponent(),
- ((RSAPrivateCrtKey) key).getPrimeP(),
- ((RSAPrivateCrtKey) key).getPrimeQ(),
- ((RSAPrivateCrtKey) key).getPrimeExponentP(),
- ((RSAPrivateCrtKey) key).getPrimeExponentQ(),
- ((RSAPrivateCrtKey) key).getCrtCoefficient()));
- }
- if (key instanceof RSAPrivateKey)
- {
- return new GnuRSAPrivateKey(new RSAPrivateCrtKeySpec(
- ((RSAPrivateKey) key).getModulus(), null,
- ((RSAPrivateKey) key).getPrivateExponent(), null,
- null, null, null, null));
- }
- if (key instanceof RSAPublicKey)
- {
- return new GnuRSAPublicKey(new RSAPublicKeySpec(
- ((RSAPrivateCrtKey) key).getModulus(),
- ((RSAPrivateCrtKey) key).getPublicExponent()));
- }
- throw new InvalidKeyException();
- }
-}
diff --git a/libjava/gnu/java/security/provider/SHA.java b/libjava/gnu/java/security/provider/SHA.java
deleted file mode 100644
index e3b09bc5603..00000000000
--- a/libjava/gnu/java/security/provider/SHA.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/* SHA.java -- Class implementing the SHA-1 algorithm as specified in [1].
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import java.security.MessageDigest;
-
-/**
- This class implements the SHA-1 algorithm as described in [1].
-
- [1] Federal Information Processing Standards Publication 180-1.
- Specifications for the Secure Hash Standard. April 17, 1995.
-
- @see java.security.MessageDigest
-*/
-public class SHA extends MessageDigest implements Cloneable
-{
- public SHA ()
- {
- super("SHA");
- engineReset ();
- }
-
- public int engineGetDigestLength()
- {
- return 20;
- }
-
- public void engineUpdate (byte b)
- {
- int i = ((int)bytecount) & 0x3f; //wgs
- int shift = (3 - i % 4) << 3;
- int idx = i / 4;
-
- i = (int)b;
- W[idx] = (W[idx] & ~(0xff << shift)) | ((i & 0xff) << shift);
-
- // if we've filled up a block, then process it
- if (((++bytecount) & 0x3f) == 0)
- munch ();
- }
-
- // This could be optimized.
- public void engineUpdate (byte bytes[], int off, int len)
- {
- if (len < 0)
- throw new ArrayIndexOutOfBoundsException ();
-
- int end = off + len;
- while (off < end)
- engineUpdate (bytes[off++]);
- }
-
- public void engineReset ()
- {
- bytecount = 0;
- // magic numbers from [1] p. 10.
- H0 = 0x67452301;
- H1 = 0xefcdab89;
- H2 = 0x98badcfe;
- H3 = 0x10325476;
- H4 = 0xc3d2e1f0;
- }
-
- public byte[] engineDigest ()
- {
- long bitcount = bytecount << 3;
- engineUpdate ((byte)0x80); // 10000000 in binary; the start of the padding
-
- // add the rest of the padding to fill this block out, but leave 8
- // bytes to put in the original bytecount
- while ((bytecount & 0x3f) != 56)
- engineUpdate ((byte)0);
-
- // add the length of the original, unpadded block to the end of
- // the padding
- W[14] = (int)(bitcount >>> 32);
- W[15] = (int)bitcount;
- bytecount += 8;
-
- // digest the fully padded block
- munch ();
-
- byte[] result
- = new byte[] {(byte)(H0 >>> 24), (byte)(H0 >>> 16),
- (byte)(H0 >>> 8), (byte)H0,
- (byte)(H1 >>> 24), (byte)(H1 >>> 16),
- (byte)(H1 >>> 8), (byte)H1,
- (byte)(H2 >>> 24), (byte)(H2 >>> 16),
- (byte)(H2 >>> 8), (byte)H2,
- (byte)(H3 >>> 24), (byte)(H3 >>> 16),
- (byte)(H3 >>> 8), (byte)H3,
- (byte)(H4 >>> 24), (byte)(H4 >>> 16),
- (byte)(H4 >>> 8), (byte)H4};
-
- engineReset ();
- return result;
- }
-
- // Process a single block. This is pretty much copied verbatim from
- // [1] pp. 9, 10.
- private void munch ()
- {
- for (int t = 16; t < 80; ++ t)
- {
- int Wt = W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16];
- W[t] = Wt << 1 | Wt >>> 31;
- }
-
- int A = H0;
- int B = H1;
- int C = H2;
- int D = H3;
- int E = H4;
-
- for (int t = 0; t < 20; ++ t)
- {
- int TEMP = (A << 5 | A >>> 27) // S^5(A)
- + ((B & C) | (~B & D)) // f_t(B,C,D)
- + E + W[t]
- + 0x5a827999; // K_t
-
- E = D;
- D = C;
- C = B << 30 | B >>> 2; // S^30(B)
- B = A;
- A = TEMP;
- }
-
- for (int t = 20; t < 40; ++ t)
- {
- int TEMP = (A << 5 | A >>> 27) // S^5(A)
- + (B ^ C ^ D) // f_t(B,C,D)
- + E + W[t]
- + 0x6ed9eba1; // K_t
-
- E = D;
- D = C;
- C = B << 30 | B >>> 2; // S^30(B)
- B = A;
- A = TEMP;
- }
-
- for (int t = 40; t < 60; ++ t)
- {
- int TEMP = (A << 5 | A >>> 27) // S^5(A)
- + (B & C | B & D | C & D) // f_t(B,C,D)
- + E + W[t]
- + 0x8f1bbcdc; // K_t
-
- E = D;
- D = C;
- C = B << 30 | B >>> 2; // S^30(B)
- B = A;
- A = TEMP;
- }
-
- for (int t = 60; t < 80; ++ t)
- {
- int TEMP = (A << 5 | A >>> 27) // S^5(A)
- + (B ^ C ^ D) // f_t(B,C,D)
- + E + W[t]
- + 0xca62c1d6; // K_t
-
- E = D;
- D = C;
- C = B << 30 | B >>> 2; // S^30(B)
- B = A;
- A = TEMP;
- }
-
- H0 += A;
- H1 += B;
- H2 += C;
- H3 += D;
- H4 += E;
-
- // Reset W by clearing it.
- for (int t = 0; t < 80; ++ t)
- W[t] = 0;
- }
-
- public Object clone ()
- {
- return new SHA (this);
- }
-
- private SHA (SHA copy)
- {
- this ();
- bytecount = copy.bytecount;
- H0 = copy.H0;
- H1 = copy.H1;
- H2 = copy.H2;
- H3 = copy.H3;
- H4 = copy.H4;
- System.arraycopy (copy.W, 0, W, 0, 80);
- }
-
- private final int W[] = new int[80];
- private long bytecount;
- private int H0;
- private int H1;
- private int H2;
- private int H3;
- private int H4;
-}
diff --git a/libjava/gnu/java/security/provider/SHA1PRNG.java b/libjava/gnu/java/security/provider/SHA1PRNG.java
deleted file mode 100644
index 7f2784881fb..00000000000
--- a/libjava/gnu/java/security/provider/SHA1PRNG.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* SHA1PRNG.java --- Secure Random SPI SHA1PRNG
- Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import java.io.Serializable;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandomSpi;
-import java.util.Random;
-
-public class SHA1PRNG extends SecureRandomSpi implements Serializable
-{
- MessageDigest digest;
- byte seed[];
- byte data[];
- int seedpos;
- int datapos;
- private boolean seeded = false; // set to true when we seed this
-
- public SHA1PRNG()
- {
- try {
- digest = MessageDigest.getInstance("SHA");
- } catch ( NoSuchAlgorithmException nsae) {
-// System.out.println("Failed to find SHA Message Digest: " + nsae);
-// nsae.printStackTrace();
- throw new InternalError ("no SHA implementation found");
- }
-
- seed = new byte[20];
- seedpos = 0;
- data = new byte[40];
- datapos = 20; // try to force hashing a first block
- }
-
- public void engineSetSeed(byte[] seed)
- {
- for(int i = 0; i < seed.length; i++)
- this.seed[seedpos++ % 20] ^= seed[i];
- seedpos %= 20;
-
- }
-
- public void engineNextBytes(byte[] bytes)
- {
- ensureIsSeeded ();
- int loc = 0;
- while (loc < bytes.length)
- {
- int copy = Math.min (bytes.length - loc, 20 - datapos);
-
- if (copy > 0)
- {
- System.arraycopy (data, datapos, bytes, loc, copy);
- datapos += copy;
- loc += copy;
- }
- else
- {
- // No data ready for copying, so refill our buffer.
- System.arraycopy( seed, 0, data, 20, 20);
- byte[] digestdata = digest.digest( data );
- System.arraycopy( digestdata, 0, data, 0, 20);
- datapos = 0;
- }
- }
- }
-
- public byte[] engineGenerateSeed(int numBytes)
- {
- byte tmp[] = new byte[numBytes];
-
- engineNextBytes( tmp );
- return tmp;
- }
-
- private void ensureIsSeeded()
- {
- if (!seeded)
- {
- new Random(0L).nextBytes(seed);
-
- byte[] digestdata = digest.digest(data);
- System.arraycopy(digestdata, 0, data, 0, 20);
-
- seeded = true;
- }
- }
-
-}
diff --git a/libjava/gnu/java/security/provider/SHA1withRSA.java b/libjava/gnu/java/security/provider/SHA1withRSA.java
deleted file mode 100644
index 0e63fdeeb52..00000000000
--- a/libjava/gnu/java/security/provider/SHA1withRSA.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SHA1withRSA.java -- SHA-1 with RSA encryption signatures.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import gnu.java.security.OID;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class SHA1withRSA extends RSA
-{
-
- // Constant.
- // -------------------------------------------------------------------------
-
- private static final OID SHA1 = new OID("1.3.14.3.2.26");
-
- // Constructor.
- // -------------------------------------------------------------------------
-
- public SHA1withRSA() throws NoSuchAlgorithmException
- {
- super(MessageDigest.getInstance("SHA-160"), SHA1);
- }
-}
diff --git a/libjava/gnu/java/security/provider/X509CertificateFactory.java b/libjava/gnu/java/security/provider/X509CertificateFactory.java
deleted file mode 100644
index 1a415eabb05..00000000000
--- a/libjava/gnu/java/security/provider/X509CertificateFactory.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/* X509CertificateFactory.java -- generates X.509 certificates.
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.provider;
-
-import gnu.java.io.Base64InputStream;
-import gnu.java.security.x509.X509CRL;
-import gnu.java.security.x509.X509CertPath;
-import gnu.java.security.x509.X509Certificate;
-
-import java.io.BufferedInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.cert.CRL;
-import java.security.cert.CRLException;
-import java.security.cert.CertPath;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactorySpi;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-public class X509CertificateFactory extends CertificateFactorySpi
-{
-
- // Constants.
- // ------------------------------------------------------------------------
-
- public static final String BEGIN_CERTIFICATE = "-----BEGIN CERTIFICATE-----";
- public static final String END_CERTIFICATE = "-----END CERTIFICATE-----";
- public static final String BEGIN_X509_CRL = "-----BEGIN X509 CRL-----";
- public static final String END_X509_CRL = "-----END X509 CRL-----";
-
- // Constructors.
- // ------------------------------------------------------------------------
-
- public X509CertificateFactory()
- {
- super();
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
-
- public Certificate engineGenerateCertificate(InputStream inStream)
- throws CertificateException
- {
- try
- {
- return generateCert(inStream);
- }
- catch (IOException ioe)
- {
- CertificateException ce = new CertificateException(ioe.getMessage());
- ce.initCause (ioe);
- throw ce;
- }
- }
-
- public Collection engineGenerateCertificates(InputStream inStream)
- throws CertificateException
- {
- LinkedList certs = new LinkedList();
- while (true)
- {
- try
- {
- certs.add(generateCert(inStream));
- }
- catch (EOFException eof)
- {
- break;
- }
- catch (IOException ioe)
- {
- CertificateException ce = new CertificateException(ioe.getMessage());
- ce.initCause (ioe);
- throw ce;
- }
- }
- return certs;
- }
-
- public CRL engineGenerateCRL(InputStream inStream) throws CRLException
- {
- try
- {
- return generateCRL(inStream);
- }
- catch (IOException ioe)
- {
- CRLException crle = new CRLException(ioe.getMessage());
- crle.initCause (ioe);
- throw crle;
- }
- }
-
- public Collection engineGenerateCRLs(InputStream inStream)
- throws CRLException
- {
- LinkedList crls = new LinkedList();
- while (true)
- {
- try
- {
- crls.add(generateCRL(inStream));
- }
- catch (EOFException eof)
- {
- break;
- }
- catch (IOException ioe)
- {
- CRLException crle = new CRLException(ioe.getMessage());
- crle.initCause (ioe);
- throw crle;
- }
- }
- return crls;
- }
-
- public CertPath engineGenerateCertPath(List certs)
- {
- return new X509CertPath(certs);
- }
-
- public CertPath engineGenerateCertPath(InputStream in)
- throws CertificateEncodingException
- {
- return new X509CertPath(in);
- }
-
- public CertPath engineGenerateCertPath(InputStream in, String encoding)
- throws CertificateEncodingException
- {
- return new X509CertPath(in, encoding);
- }
-
- public Iterator engineGetCertPathEncodings()
- {
- return X509CertPath.ENCODINGS.iterator();
- }
-
- // Own methods.
- // ------------------------------------------------------------------------
-
- private X509Certificate generateCert(InputStream inStream)
- throws IOException, CertificateException
- {
- if (inStream == null)
- throw new CertificateException("missing input stream");
- if (!inStream.markSupported())
- inStream = new BufferedInputStream(inStream, 8192);
- inStream.mark(20);
- int i = inStream.read();
- if (i == -1)
- throw new EOFException();
-
- // If the input is in binary DER format, the first byte MUST be
- // 0x30, which stands for the ASN.1 [UNIVERSAL 16], which is the
- // UNIVERSAL SEQUENCE, with the CONSTRUCTED bit (0x20) set.
- //
- // So if we do not see 0x30 here we will assume it is in Base-64.
- if (i != 0x30)
- {
- inStream.reset();
- StringBuffer line = new StringBuffer(80);
- do
- {
- line.setLength(0);
- do
- {
- i = inStream.read();
- if (i == -1)
- throw new EOFException();
- if (i != '\n' && i != '\r')
- line.append((char) i);
- }
- while (i != '\n' && i != '\r');
- }
- while (!line.toString().equals(BEGIN_CERTIFICATE));
- X509Certificate ret = new X509Certificate(
- new BufferedInputStream(new Base64InputStream(inStream), 8192));
- line.setLength(0);
- line.append('-'); // Base64InputStream will eat this.
- do
- {
- i = inStream.read();
- if (i == -1)
- throw new EOFException();
- if (i != '\n' && i != '\r')
- line.append((char) i);
- }
- while (i != '\n' && i != '\r');
- // XXX ???
- if (!line.toString().equals(END_CERTIFICATE))
- throw new CertificateException("no end-of-certificate marker");
- return ret;
- }
- else
- {
- inStream.reset();
- return new X509Certificate(inStream);
- }
- }
-
- private X509CRL generateCRL(InputStream inStream)
- throws IOException, CRLException
- {
- if (inStream == null)
- throw new CRLException("missing input stream");
- if (!inStream.markSupported())
- inStream = new BufferedInputStream(inStream, 8192);
- inStream.mark(20);
- int i = inStream.read();
- if (i == -1)
- throw new EOFException();
-
- // If the input is in binary DER format, the first byte MUST be
- // 0x30, which stands for the ASN.1 [UNIVERSAL 16], which is the
- // UNIVERSAL SEQUENCE, with the CONSTRUCTED bit (0x20) set.
- //
- // So if we do not see 0x30 here we will assume it is in Base-64.
- if (i != 0x30)
- {
- inStream.reset();
- StringBuffer line = new StringBuffer(80);
- do
- {
- line.setLength(0);
- do
- {
- i = inStream.read();
- if (i == -1)
- throw new EOFException();
- if (i != '\n' && i != '\r')
- line.append((char) i);
- }
- while (i != '\n' && i != '\r');
- }
- while (!line.toString().startsWith(BEGIN_X509_CRL));
- X509CRL ret = new X509CRL(
- new BufferedInputStream(new Base64InputStream(inStream), 8192));
- line.setLength(0);
- line.append('-'); // Base64InputStream will eat this.
- do
- {
- i = inStream.read();
- if (i == -1)
- throw new EOFException();
- if (i != '\n' && i != '\r')
- line.append((char) i);
- }
- while (i != '\n' && i != '\r');
- // XXX ???
- if (!line.toString().startsWith(END_X509_CRL))
- throw new CRLException("no end-of-CRL marker");
- return ret;
- }
- else
- {
- inStream.reset();
- return new X509CRL(inStream);
- }
- }
-}
diff --git a/libjava/gnu/java/security/util/Prime.java b/libjava/gnu/java/security/util/Prime.java
deleted file mode 100644
index e493ce67503..00000000000
--- a/libjava/gnu/java/security/util/Prime.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Prime.java --- Prime number generation utilities
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.util;
-import java.math.BigInteger;
-import java.util.Random;
-//import java.security.SecureRandom;
-
-public final class Prime
-{
-
- /*
- See IEEE P1363 A.15.4 (10/05/98 Draft)
- */
- public static BigInteger generateRandomPrime( int pmin, int pmax, BigInteger f )
- {
- BigInteger d;
-
- //Step 1 - generate prime
- BigInteger p = new BigInteger( (pmax + pmin)/2, new Random() );
- if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmin ) ) <= 0 )
- {
- p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin ).subtract( p ) );
- }
-
- //Step 2 - test for even
- if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0)
- p = p.add( BigInteger.valueOf( 1 ) );
-
- for(;;)
- {
- //Step 3
- if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0)
- {
- //Step 3.1
- p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) );
- p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) );
- p = p.subtract( BigInteger.valueOf( 1 ) );
-
- //Step 3.2
- // put step 2 code here so looping code is cleaner
- //Step 2 - test for even
- if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0)
- p = p.add( BigInteger.valueOf( 1 ) );
- continue;
- }
-
- //Step 4 - compute GCD
- d = p.subtract( BigInteger.valueOf(1) );
- d = d.gcd( f );
-
- //Step 5 - test d
- if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0)
- {
- //Step 5.1 - test primality
- if( p.isProbablePrime( 1 ) == true )
- {
- //Step 5.2;
- return p;
- }
- }
- //Step 6
- p = p.add( BigInteger.valueOf( 2 ) );
-
- //Step 7
- }
- }
-
-
- /*
- See IEEE P1363 A.15.5 (10/05/98 Draft)
- */
- public static BigInteger generateRandomPrime( BigInteger r, BigInteger a, int pmin, int pmax, BigInteger f )
- {
- BigInteger d, w;
-
- //Step 1 - generate prime
- BigInteger p = new BigInteger( (pmax + pmin)/2, new Random() );
-
- steptwo:{ //Step 2
- w = p.mod( r.multiply( BigInteger.valueOf(2) ));
-
- //Step 3
- p = p.add( r.multiply( BigInteger.valueOf(2) ) );
- p = p.subtract( w );
- p = p.add(a);
-
- //Step 4 - test for even
- if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0)
- p = p.add( r );
-
- for(;;)
- {
- //Step 5
- if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmax)) > 0)
- {
- //Step 5.1
- p = p.subtract( BigInteger.valueOf( 1 ).shiftLeft( pmax) );
- p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin) );
- p = p.subtract( BigInteger.valueOf( 1 ) );
-
- //Step 5.2 - goto to Step 2
- break steptwo;
- }
-
- //Step 6
- d = p.subtract( BigInteger.valueOf(1) );
- d = d.gcd( f );
-
- //Step 7 - test d
- if( d.compareTo( BigInteger.valueOf( 1 ) ) == 0)
- {
- //Step 7.1 - test primality
- if( p.isProbablePrime( 1 ) == true )
- {
- //Step 7.2;
- return p;
- }
- }
- //Step 8
- p = p.add( r.multiply( BigInteger.valueOf(2) ) );
-
- //Step 9
- }
- }
- //Should never reach here but makes the compiler happy
- return BigInteger.valueOf(0);
- }
-}
diff --git a/libjava/gnu/java/security/x509/GnuPKIExtension.java b/libjava/gnu/java/security/x509/GnuPKIExtension.java
deleted file mode 100644
index 8e74b8b24ac..00000000000
--- a/libjava/gnu/java/security/x509/GnuPKIExtension.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GnuPKIExtension.java -- interface for GNU PKI extensions.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import gnu.java.security.OID;
-import gnu.java.security.x509.ext.Extension;
-
-import java.security.cert.X509Extension;
-import java.util.Collection;
-
-public interface GnuPKIExtension extends X509Extension
-{
-
- /**
- * Returns the extension object for the given object identifier.
- *
- * @param oid The OID of the extension to get.
- * @return The extension, or null if there is no such extension.
- */
- Extension getExtension(OID oid);
-
- Collection getExtensions();
-}
diff --git a/libjava/gnu/java/security/x509/PolicyNodeImpl.java b/libjava/gnu/java/security/x509/PolicyNodeImpl.java
deleted file mode 100644
index 72cb4a9ea91..00000000000
--- a/libjava/gnu/java/security/x509/PolicyNodeImpl.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/* PolicyNodeImpl.java -- An implementation of a policy tree node.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-import java.security.cert.PolicyNode;
-import java.security.cert.PolicyQualifierInfo;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-public final class PolicyNodeImpl implements PolicyNode
-{
-
- // Fields.
- // -------------------------------------------------------------------------
-
- private String policy;
- private final Set expectedPolicies;
- private final Set qualifiers;
- private final Set children;
- private PolicyNodeImpl parent;
- private int depth;
- private boolean critical;
- private boolean readOnly;
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public PolicyNodeImpl()
- {
- expectedPolicies = new HashSet();
- qualifiers = new HashSet();
- children = new HashSet();
- readOnly = false;
- critical = false;
- }
-
- // Instance methods.
- // -------------------------------------------------------------------------
-
- public void addChild(PolicyNodeImpl node)
- {
- if (readOnly)
- throw new IllegalStateException("read only");
- if (node.getParent() != null)
- throw new IllegalStateException("already a child node");
- node.parent = this;
- node.setDepth(depth + 1);
- children.add(node);
- }
-
- public Iterator getChildren()
- {
- return Collections.unmodifiableSet(children).iterator();
- }
-
- public int getDepth()
- {
- return depth;
- }
-
- public void setDepth(int depth)
- {
- if (readOnly)
- throw new IllegalStateException("read only");
- this.depth = depth;
- }
-
- public void addAllExpectedPolicies(Set policies)
- {
- if (readOnly)
- throw new IllegalStateException("read only");
- expectedPolicies.addAll(policies);
- }
-
- public void addExpectedPolicy(String policy)
- {
- if (readOnly)
- throw new IllegalStateException("read only");
- expectedPolicies.add(policy);
- }
-
- public Set getExpectedPolicies()
- {
- return Collections.unmodifiableSet(expectedPolicies);
- }
-
- public PolicyNode getParent()
- {
- return parent;
- }
-
- public void addAllPolicyQualifiers (Collection qualifiers)
- {
- for (Iterator it = qualifiers.iterator(); it.hasNext(); )
- {
- if (!(it.next() instanceof PolicyQualifierInfo))
- throw new IllegalArgumentException ("can only add PolicyQualifierInfos");
- }
- qualifiers.addAll (qualifiers);
- }
-
- public void addPolicyQualifier (PolicyQualifierInfo qualifier)
- {
- if (readOnly)
- throw new IllegalStateException("read only");
- qualifiers.add(qualifier);
- }
-
- public Set getPolicyQualifiers()
- {
- return Collections.unmodifiableSet(qualifiers);
- }
-
- public String getValidPolicy()
- {
- return policy;
- }
-
- public void setValidPolicy(String policy)
- {
- if (readOnly)
- throw new IllegalStateException("read only");
- this.policy = policy;
- }
-
- public boolean isCritical()
- {
- return critical;
- }
-
- public void setCritical(boolean critical)
- {
- if (readOnly)
- throw new IllegalStateException("read only");
- this.critical = critical;
- }
-
- public void setReadOnly()
- {
- if (readOnly)
- return;
- readOnly = true;
- for (Iterator it = getChildren(); it.hasNext(); )
- ((PolicyNodeImpl) it.next()).setReadOnly();
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < depth; i++)
- buf.append(" ");
- buf.append("(");
- buf.append(PolicyNodeImpl.class.getName());
- buf.append(" (oid ");
- buf.append(policy);
- buf.append(") (depth ");
- buf.append(depth);
- buf.append(") (qualifiers ");
- buf.append(qualifiers);
- buf.append(") (critical ");
- buf.append(critical);
- buf.append(") (expectedPolicies ");
- buf.append(expectedPolicies);
- buf.append(") (children (");
- final String nl = System.getProperty("line.separator");
- for (Iterator it = getChildren(); it.hasNext(); )
- {
- buf.append(nl);
- buf.append(it.next().toString());
- }
- buf.append(")))");
- return buf.toString();
- }
-}
diff --git a/libjava/gnu/java/security/x509/Util.java b/libjava/gnu/java/security/x509/Util.java
deleted file mode 100644
index d27392026f8..00000000000
--- a/libjava/gnu/java/security/x509/Util.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Util.java -- Miscellaneous utility methods.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.security.x509;
-
-/**
- * A collection of useful class methods.
- *
- * @author Casey Marshall (rsdio@metastatic.org)
- */
-public final class Util
-{
-
- // Constants.
- // -------------------------------------------------------------------------
-
- public static final String HEX = "0123456789abcdef";
-
- // Class methods.
- // -------------------------------------------------------------------------
-
- /**
- * Convert a byte array to a hexadecimal string, as though it were a
- * big-endian arbitrarily-sized integer.
- *
- * @param buf The bytes to format.
- * @param off The offset to start at.
- * @param len The number of bytes to format.
- * @return A hexadecimal representation of the specified bytes.
- */
- public static String toHexString(byte[] buf, int off, int len)
- {
- StringBuffer str = new StringBuffer();
- for (int i = 0; i < len; i++)
- {
- str.append(HEX.charAt(buf[i+off] >>> 4 & 0x0F));
- str.append(HEX.charAt(buf[i+off] & 0x0F));
- }
- return str.toString();
- }
-
- /**
- * See {@link #toHexString(byte[],int,int)}.
- */
- public static String toHexString(byte[] buf)
- {
- return Util.toHexString(buf, 0, buf.length);
- }
-
- /**
- * Convert a byte array to a hexadecimal string, separating octets
- * with the given character.
- *
- * @param buf The bytes to format.
- * @param off The offset to start at.
- * @param len The number of bytes to format.
- * @param sep The character to insert between octets.
- * @return A hexadecimal representation of the specified bytes.
- */
- public static String toHexString(byte[] buf, int off, int len, char sep)
- {
- StringBuffer str = new StringBuffer();
- for (int i = 0; i < len; i++)
- {
- str.append(HEX.charAt(buf[i+off] >>> 4 & 0x0F));
- str.append(HEX.charAt(buf[i+off] & 0x0F));
- if (i < len - 1)
- str.append(sep);
- }
- return str.toString();
- }
-
- /**
- * See {@link #toHexString(byte[],int,int,char)}.
- */
- public static String toHexString(byte[] buf, char sep)
- {
- return Util.toHexString(buf, 0, buf.length, sep);
- }
-
- /**
- * Create a representation of the given byte array similar to the
- * output of `hexdump -C', which is
- *
- * OFFSET SIXTEEN-BYTES-IN-HEX PRINTABLE-BYTES
- *
- * s
, a set of ranges
- * and the corresponding attributes. This is used to build an iterator.
- * The array ranges
should be formatted as follow:
- * each element of ranges
specifies the index in the string
- * until which the corresponding map of attributes at the same position
- * is applied. For example, if you have:
- *
- * s = "hello";
- * ranges = new int[] { 2, 6 };
- * attributes = new HashMap[2];
- *
- * "he"
will have the attributes attributes[0]
,
- * "llo"
the attributes[1]
.
- */
- public FormatCharacterIterator (String s, int[] ranges, HashMap[] attributes)
- {
- formattedString = s;
- this.ranges = ranges;
- this.attributes = attributes;
- }
-
- /*
- * The following methods are inherited from AttributedCharacterIterator,
- * and thus are already documented.
- */
-
- public Set getAllAttributeKeys()
- {
- if (attributes != null && attributes[attributeIndex] != null)
- return attributes[attributeIndex].keySet();
- else
- return new HashSet();
- }
-
- public Map getAttributes()
- {
- if (attributes != null && attributes[attributeIndex] != null)
- return attributes[attributeIndex];
- else
- return new HashMap();
- }
-
- public Object getAttribute (AttributedCharacterIterator.Attribute attrib)
- {
- if (attributes != null && attributes[attributeIndex] != null)
- return attributes[attributeIndex].get (attrib);
- else
- return null;
- }
-
- public int getRunLimit(Set reqAttrs)
- {
- if (attributes == null)
- return formattedString.length();
-
- int currentAttrIndex = attributeIndex;
- Set newKeys;
-
- do
- {
- currentAttrIndex++;
- if (currentAttrIndex == attributes.length)
- return formattedString.length();
- if (attributes[currentAttrIndex] == null)
- break;
- newKeys = attributes[currentAttrIndex].keySet();
- }
- while (newKeys.containsAll (reqAttrs));
-
- return ranges[currentAttrIndex-1];
- }
-
- public int getRunLimit (AttributedCharacterIterator.Attribute attribute)
- {
- Set s = new HashSet();
-
- s.add (attribute);
- return getRunLimit (s);
- }
-
- public int getRunLimit()
- {
- if (attributes == null)
- return formattedString.length();
- if (attributes[attributeIndex] == null)
- {
- for (int i=attributeIndex+1;inull
.
- *
- * @param text The string to append to the iterator.
- */
- public void append (String text)
- {
- append (text, null);
- }
-
- /**
- * This method adds a set of attributes to a range of character. The
- * bounds are always inclusive. In the case many attributes have to
- * be added it is advised to directly use {@link #mergeAttributes([Ljava.util.HashMap;[I}
- *
- * @param attributes Attributes to merge into the iterator.
- * @param range_start Lower bound of the range of characters which will receive the
- * attribute.
- * @param range_end Upper bound of the range of characters which will receive the
- * attribute.
- *
- * @throws IllegalArgumentException if ranges are out of bounds.
- */
- public void addAttributes(HashMap attributes, int range_start, int range_end)
- {
- if (range_start == 0)
- mergeAttributes(new HashMap[] { attributes }, new int[] { range_end });
- else
- mergeAttributes(new HashMap[] { null, attributes }, new int[] { range_start, range_end });
- }
-
- private void debug(String s)
- {
- if (Configuration.DEBUG)
- System.out.println(s);
- }
-
- private void dumpTable()
- {
- int start_range = 0;
-
- if (!Configuration.DEBUG)
- return;
-
- System.out.println("Dumping internal table:");
- for (int i = 0; i < ranges.length; i++)
- {
- System.out.print("\t" + start_range + " => " + ranges[i] + ":");
- if (attributes[i] == null)
- System.out.println("null");
- else
- {
- Set keyset = attributes[i].keySet();
- if (keyset != null)
- {
- Iterator keys = keyset.iterator();
-
- while (keys.hasNext())
- System.out.print(" " + keys.next());
- }
- else
- System.out.println("keySet null");
- System.out.println();
- }
- }
- System.out.println();
- System.out.flush();
- }
-}
diff --git a/libjava/gnu/java/text/LineBreakIterator.java b/libjava/gnu/java/text/LineBreakIterator.java
deleted file mode 100644
index ad07479fb78..00000000000
--- a/libjava/gnu/java/text/LineBreakIterator.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/* LineBreakIterator.java - Default word BreakIterator.
- Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.text;
-
-import java.text.CharacterIterator;
-
-/**
- * @author Tom Tromey
- *
- * In the default case:
- *
- * doubleEnum = new DoubleEnumeration(enum1, enum2);
- * while (doubleEnum.hasMoreElements()) {
- * Object o = doubleEnum.nextElement();
- * do_something(o);
- * }
- *
- * it calls hasMoreElements of the Enumerations as few times as
- * possible.
- * The references to the Enumerations are cleared as soon as they have no
- * more elements to help garbage collecting.
- *
- * @author Jochen Hoenicke
- * @author Mark Wielaard (mark@klomp.org)
- */
-public class DoubleEnumeration implements Enumeration
-{
- /**
- * This is true as long as one of the enumerations has more
- * elements.
- * Only valid when hasChecked is true.
- * Set in hasMoreElements()
- */
- private boolean hasMore;
- /**
- * This is true, if it is sure that hasMore indicates wether there are
- * more elements.
- * Set to true in hasMoreElements()
.
- * Set to false in getNextElement()
.
- */
- private boolean hasChecked;
- /**
- * The first enumeration.
- */
- private Enumeration e1;
- /**
- * The second enumeration.
- */
- private Enumeration e2;
-
- /**
- * Creates a new Enumeration combining the given two enumerations.
- * The enumerations mustn't be accessed by other classes.
- */
- public DoubleEnumeration(Enumeration e1, Enumeration e2)
- {
- this.e1 = e1;
- this.e2 = e2;
- hasChecked = false;
- }
-
- /**
- * Returns true, if at least one of the two enumerations has more
- * elements.
- */
- public boolean hasMoreElements()
- {
- if (hasChecked)
- return hasMore;
-
- hasMore = (e1 != null && e1.hasMoreElements());
-
- if (!hasMore) {
- e1 = e2;
- e2 = null;
- hasMore = (e1 != null && e1.hasMoreElements());
- }
-
- hasChecked = true;
- return hasMore;
- }
-
- /**
- * Returns the next element. This returns the next element of the
- * first enumeration, if it has more elements, otherwise the next
- * element of the second enumeration. If both enumeration don't have
- * any elements it throws a NoSuchElementException
.
- */
- public Object nextElement()
- {
- if (!hasMoreElements())
- throw new NoSuchElementException();
- else {
- hasChecked = false;
- return e1.nextElement();
- }
- }
-}
diff --git a/libjava/gnu/java/util/EmptyEnumeration.java b/libjava/gnu/java/util/EmptyEnumeration.java
deleted file mode 100644
index 46a82d6cb53..00000000000
--- a/libjava/gnu/java/util/EmptyEnumeration.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/* EmptyEnumeration.java -- a constant empty enumeration
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.util;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * This is a helper class that produces an empty Enumerations. There is only
- * one instance of this class that can be used whenever one needs a
- * non-null but empty enumeration. Using this class prevents multiple
- * small objects and inner classes. getInstance()
returns
- * the only instance of this class. It can be shared by multiple objects and
- * threads.
- *
- * @author Mark Wielaard (mark@klomp.org)
- */
-public final class EmptyEnumeration implements Enumeration, Serializable
-{
- /** The only instance of this class */
- private static final EmptyEnumeration instance = new EmptyEnumeration();
-
- /**
- * Private constructor that creates a new empty Enumeration.
- */
- private EmptyEnumeration()
- {
- }
-
- /**
- * Returns the only instance of this class.
- * It can be shared by multiple objects and threads.
- *
- * @return the common empty enumeration
- */
- public static EmptyEnumeration getInstance()
- {
- return instance;
- }
-
- /**
- * Returns false, since there are no elements.
- *
- * @return false
- */
- public boolean hasMoreElements()
- {
- return false;
- }
-
- /**
- * Always throws NoSuchElementException
, since it is empty.
- *
- * @throws NoSuchElementException this is empty
- */
- public Object nextElement()
- {
- throw new NoSuchElementException();
- }
-}
diff --git a/libjava/gnu/java/util/prefs/FileBasedFactory.java b/libjava/gnu/java/util/prefs/FileBasedFactory.java
deleted file mode 100644
index 70f3558fc6f..00000000000
--- a/libjava/gnu/java/util/prefs/FileBasedFactory.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* FileBasedFactory - Default Classpath implementation of a PreferencesFactory
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.util.prefs;
-
-import java.util.prefs.*;
-
-/**
- * Default Classpath implementation of a PreferencesFactory.
- * Returns system and user root Preferences nodes that are read from files.
- *
- * @author Mark Wielaard (mark@klomp.org)
- */
-public class FileBasedFactory implements PreferencesFactory {
-
- public Preferences systemRoot() {
- return null;
- }
-
- public Preferences userRoot() {
- return null;
- }
-}
diff --git a/libjava/gnu/java/util/prefs/MemoryBasedFactory.java b/libjava/gnu/java/util/prefs/MemoryBasedFactory.java
deleted file mode 100644
index abaf0016f5b..00000000000
--- a/libjava/gnu/java/util/prefs/MemoryBasedFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* MemoryBasedFactory - Memory based PreferencesFactory usefull for testing
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.util.prefs;
-
-import java.util.prefs.*;
-
-/**
- * Memory based PreferencesFactory usefull for testing.
- * Returns completely empty Preferences for system and user roots.
- * All changes are only backed by the current instances in memory.
- *
- * @author Mark Wielaard (mark@klomp.org)
- */
-public class MemoryBasedFactory implements PreferencesFactory {
-
- // Static fields containing the preferences root nodes
- private static final Preferences systemPreferences
- = new MemoryBasedPreferences(null, "", false);
- private static final Preferences userPreferences
- = new MemoryBasedPreferences(null, "", true);
-
- public Preferences systemRoot() {
- return systemPreferences;
- }
-
- public Preferences userRoot() {
- return userPreferences;
- }
-}
diff --git a/libjava/gnu/java/util/prefs/MemoryBasedPreferences.java b/libjava/gnu/java/util/prefs/MemoryBasedPreferences.java
deleted file mode 100644
index b2f321c9c7e..00000000000
--- a/libjava/gnu/java/util/prefs/MemoryBasedPreferences.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/* MemoryBasedPreferences - A Preference node which holds all entries in memory
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.util.prefs;
-
-import java.util.HashMap;
-
-import java.util.prefs.*;
-
-/**
- * A Preference node which holds all entries in memory
- *
- * @author Mark Wielaard (mark@klomp.org)
- */
-public class MemoryBasedPreferences extends AbstractPreferences {
-
- /** True if this is a preference node in the user tree, false otherwise. */
- private final boolean isUser;
-
- /** Contains all the preference entries of this node. */
- private HashMap entries = new HashMap();
-
- /**
- * Creates a new preferences node with the given name and parent.
- * When isUser is true it will be user node otherwise it will be a system
- * node. It will always set the newNode
field to true
- * since there is no real backing store, so all nodes are new.
- */
- public MemoryBasedPreferences(MemoryBasedPreferences parent,
- String name,
- boolean isUser) {
- super(parent, name);
- this.isUser = isUser;
-
- // Since we do not have a real backing store all nodes are new
- newNode = true;
- }
-
- /**
- * Returns true if this node was created as a user node.
- */
- public boolean isUserNode() {
- return isUser;
- }
-
- /**
- * Returns an empty array since all children names are always already
- * chached.
- */
- protected String[] childrenNamesSpi() throws BackingStoreException {
- return new String[0];
- }
-
- /**
- * Returns a new node with the given name with as parent this node and
- * with the isUser
flag set to the same value as this node.
- */
- protected AbstractPreferences childSpi(String childName) {
- return new MemoryBasedPreferences(this, childName, isUser);
- }
-
- /**
- * Returns a (possibly empty) array of keys of the preferences entries of
- * this node.
- */
- protected String[] keysSpi() throws BackingStoreException {
- return (String[]) entries.keySet().toArray(new String[entries.size()]);
- }
-
- /**
- * Returns the associated value from this nodes preferences entries or
- * null when the key has not been set.
- */
- protected String getSpi(String key) {
- return (String) entries.get(key);
- }
-
- /**
- * Sets the value for the given key.
- */
- protected void putSpi(String key, String value) {
- entries.put(key, value);
- }
-
- /**
- * Removes the entry with the given key.
- */
- protected void removeSpi(String key) {
- entries.remove(key);
- }
-
- /**
- * Does nothing since we do not have any backing store.
- */
- protected void flushSpi() {
- }
-
- /**
- * Does nothing since we do not have any backing store.
- */
- protected void syncSpi() {
- }
-
- /**
- * Just removes the entries map of this node.
- */
- protected void removeNodeSpi() {
- entries = null;
- }
-}
diff --git a/libjava/gnu/java/util/prefs/NodeReader.java b/libjava/gnu/java/util/prefs/NodeReader.java
deleted file mode 100644
index 4cd52e5dbf9..00000000000
--- a/libjava/gnu/java/util/prefs/NodeReader.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/* NodeReader - Reads and imports preferences nodes from files
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.util.prefs;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.prefs.InvalidPreferencesFormatException;
-import java.util.prefs.Preferences;
-import java.util.prefs.PreferencesFactory;
-
-/**
- * Reads and imports preferences nodes from files.
- *
- * @author Mark Wielaard (mark@klomp.org)
- */
-public class NodeReader {
-
- private final BufferedReader br;
- private String line = "";
-
- private final PreferencesFactory factory;
-
- public NodeReader(Reader r, PreferencesFactory factory) {
- if(r instanceof BufferedReader) {
- br = (BufferedReader) r;
- } else {
- br = new BufferedReader(r);
- }
- this.factory = factory;
- }
-
- public NodeReader(InputStream is, PreferencesFactory factory) {
- this(new InputStreamReader(is), factory);
- }
-
- public void importPreferences()
- throws InvalidPreferencesFormatException, IOException
- {
- readPreferences();
- }
-
- private void readPreferences()
- throws InvalidPreferencesFormatException, IOException
- {
- // Begin starting tag
- skipTill("writeCloseParents()
after writing the node
- * itself.
- */
- private int writeParents() throws IOException {
- int parents;
- String path = prefs.absolutePath();
- int lastslash = path.lastIndexOf("/");
- if (lastslash > 0) {
- path = path.substring(1, lastslash);
- StringTokenizer st = new StringTokenizer(path);
- parents = st.countTokens();
-
- System.out.println("path: " + path);
- System.out.println("parents: " + parents);
-
- for (int i=0; ignu.javax.swing.text.html.parser.DTD.HTML_4_0_1
, where
- * all fields are initialized to the values, representing HTML 4.01
- * ("-//W3C//DTD HTML 4.01 Frameset//EN") DTD. You can use it if you do not care
- * about the portability between different implementations of the core
- * class libraries. DTDConstants
).
- * @param modifier the modifier of this attribute
- * @param default_value the default value of this attribute or null if
- * it is not specified.
- * @param allowed_values the allowed values of this attribute. The multiple
- * possible values in this parameter are supposed to be separated by
- * '|', same as in SGML DTD <!ATTLIST
tag. This parameter
- * can be null if no list of allowed values is specified.
- * @param atts the previous attribute of this element. This is
- * placed to the field
- * {@link javax.swing.text.html.parser.AttributeList#next },
- * creating a linked list.
- * @return
- */
- public AttributeList defAttributeList(String name, int type, int modifier,
- String default_value,
- String allowed_values,
- AttributeList atts
- )
- {
- return super.defAttributeList(name, type, modifier, default_value,
- allowed_values, atts
- );
- }
-
- /**
- * Define the attributes for the element with the given name.
- * If the element is not exist, it is created. This method is
- * needed if the element attributes are defined befor the
- * element itself.
- * @param forElement
- * @param attributes
- */
- public void defAttrsFor(String forElement, AttributeList attributes)
- {
- super.defineAttributes(forElement, attributes);
- }
-
- /**
- * Creates a new content model.
- * @param type specifies the BNF operation for this content model.
- * The valid operations are documented in the
- * {@link javax.swing.text.html.parser.ContentModel#type }.
- * @param content the content of this content model
- * @param next if the content model is specified by BNF-like
- * expression, contains the rest of this expression.
- * @return The newly created content model.
- */
- public ContentModel defContentModel(int type, Object content,
- ContentModel next
- )
- {
- return super.defContentModel(type, content, next);
- }
-
- /**
- * Defines a new element and adds it to the element table.
- * If the element alredy exists,
- * overrides it settings with the specified values.
- * @param name the name of the new element
- * @param type the type of the element
- * @param headless true if the element needs no starting tag
- * @param tailless true if the element needs no closing tag
- * @param content the element content.
- * @param exclusions the elements that must be excluded from the
- * content of this element, in all levels of the hierarchy.
- * @param inclusions the elements that can be included as the
- * content of this element.
- * @param attributes the element attributes.
- * @return the created or updated element.
- */
- public Element defElement(String name, int type, boolean headless,
- boolean tailless, ContentModel content,
- String[] exclusions, String[] inclusions,
- AttributeList attributes
- )
- {
- return super.defElement(name, type, headless, tailless, content,
- exclusions, inclusions, attributes
- );
- }
-
- /**
- * Defines a new element and adds it to the element table.
- * If the element alredy exists,
- * overrides it settings with the specified values.
- * @param name the name of the new element
- * @param type the type of the element
- * @param headless true if the element needs no starting tag
- * @param tailless true if the element needs no closing tag
- * @param content the element content.
- * @param exclusions the elements that must be excluded from the
- * content of this element, in all levels of the hierarchy.
- * @param inclusions the elements that can be included as the
- * content of this element.
- * @param attributes the element attributes.
- * @return the created or updated element.
- */
- public Element defElement(String name, int type, boolean headless,
- boolean tailless, ContentModel content,
- Collection exclusions, Collection inclusions,
- AttributeList attributes
- )
- {
- return super.defElement(name, type, headless, tailless, content,
- toStringArray(exclusions),
- toStringArray(inclusions), attributes
- );
- }
-
- /**
- * Defines a new element and adds it to the element table.
- * If the element alredy exists,
- * overrides it settings with the specified values.
- * @param name the name of the new element
- * @param type the type of the element
- * @param headless true if the element needs no starting tag
- * @param tailless true if the element needs no closing tag
- * @param content the element content.
- * @param exclusions the elements that must be excluded from the
- * content of this element, in all levels of the hierarchy.
- * @param inclusions the elements that can be included as the
- * content of this element.
- * @param attributes the element attributes (an array and not a
- * linked list). The attributes are chained into the linked list
- * inside this method.
- * @return the created or updated element.
- */
- public Element defElement(String name, int type, boolean headless,
- boolean tailless, ContentModel content,
- String[] exclusions, String[] inclusions,
- AttributeList[] attributes
- )
- {
- AttributeList list;
-
- if (attributes == null || attributes.length == 0)
- list = null;
- else
- {
- if (attributes.length > 1)
- for (int i = 1; i < attributes.length; i++)
- {
- attributes [ i - 1 ].next = attributes [ i ];
- }
- list = attributes [ 0 ];
- }
-
- Element e =
- super.defElement(name, type, headless, tailless, content, exclusions,
- inclusions, list
- );
- return e;
- }
-
- /**
- * Creates, adds into the internal table and returns the
- * character entity like <
- * (means '<
' );
- * This method inactivates the recursive refenrences to the same
- * entity.
- * @param name The entity name (without heading & and closing ;)
- * @param type The entity type
- * @param character The entity value (single character)
- * @return The created entity
- */
- public Entity defEntity(String name, int type, String data)
- {
- int r;
- String eref = "%" + name + ";";
- do
- {
- r = data.indexOf(eref);
- if (r > 0)
- {
- data = data.substring(0, r) + data.substring(r + 1);
- }
- }
- while (r > 0);
-
- return super.defEntity(name, type, data);
- }
-
- /**
- * Summarises the document content into the given PrintStream.
- */
- public void dump(PrintStream p)
- {
- Iterator iter = entityHash.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry item = (Map.Entry) iter.next();
- Entity e = (Entity) item.getValue();
- if (e.isGeneral())
- p.println("Entity " + e.getName() + ": " + e.getString());
- }
-
- iter = elementHash.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry item = (Map.Entry) iter.next();
- Element e = (Element) item.getValue();
- p.println("Element " + e.getName());
-
- System.out.println(" includes:");
- dump(e.inclusions);
- System.out.println(" excludes:");
- dump(e.exclusions);
- System.out.println(" attributes:");
-
- AttributeList atts = e.atts;
- while (atts != null)
- {
- p.print(" " + atts.name + " = " + atts.value);
- if (atts.values == null || atts.values.size() == 0)
- p.println();
- else
- {
- Iterator viter = atts.values.iterator();
- System.out.print(" ( ");
- while (viter.hasNext())
- {
- System.out.print(viter.next());
- if (viter.hasNext())
- System.out.print(" | ");
- }
- System.out.println(" ) ");
- }
- atts = atts.next;
- }
- }
- }
-
- /**
- * Prints the content of the given attribute set to the System.out.
- * @param b
- */
- public void dump(BitSet b)
- {
- if (b != null)
- {
- for (int i = 0; i < b.size(); i++)
- {
- if (b.get(i))
- System.out.println(" " + elements.get(i));
- }
- }
- else
- System.out.println(" NULL set");
- }
-
- /**
- * Creates the attribute.
- * @param name The attribute name.
- * @param type The attribute type.
- * @param modifier The attribute modifier.
- * @param defaultValue Default value (or null)
- * @param allowed_values Allowed values (or null)
- * @return The newly created AttributeList. The next
- * field is initialized to null.
- */
- protected AttributeList attr(String name, String default_value,
- String[] allowed_values, int type, int modifier
- )
- {
- Vector allowed = null;
-
- if (allowed_values != null)
- {
- allowed = new Vector(allowed_values.length);
- for (int i = 0; i < allowed_values.length; i++)
- {
- allowed.add(allowed_values [ i ]);
- }
- }
- ;
-
- AttributeList attr =
- new AttributeList(name, type, modifier, default_value, allowed, null);
-
- return attr;
- }
-
- /**
- * Define the general entity, holding a single character.
- * @param name The entity name (for example, 'amp').
- * The defined entity is stored into the entity table.
- * @param character The entity character (for example, '&').
- */
- protected void defineEntity(String name, int character)
- {
- super.defEntity(name, GENERAL, character);
- }
-
- private String[] toStringArray(Collection c)
- {
- String[] s = new String[ c.size() ];
- Iterator iter = c.iterator();
- for (int i = 0; i < s.length; i++)
- {
- s [ i ] = iter.next().toString();
- }
- return s;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/htmlAttributeSet.java b/libjava/gnu/javax/swing/text/html/parser/htmlAttributeSet.java
deleted file mode 100644
index a4e6f73c523..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/htmlAttributeSet.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/* htmlAttributeSet.java -- A set to store HTML attributes
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser;
-
-import java.util.Enumeration;
-
-import javax.swing.text.AttributeSet;
-import javax.swing.text.SimpleAttributeSet;
-import javax.swing.text.html.HTML;
-
-/**
- * A set, adapted to store HTML attributes.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class htmlAttributeSet
- extends SimpleAttributeSet
-{
- public static final htmlAttributeSet EMPTY_HTML_ATTRIBUTE_SET =
- new htmlAttributeSet();
- AttributeSet parent;
-
- /**
- * Looks in this set and, if not found, later looks in the parent set.
- * Calls toString(), allowing to pass as HTML.Attribute, as String
- * to this method.
- * @param key A key to search for a value.
- * @return The value, if one is defined.
- */
- public Object getAttribute(Object _key)
- {
- Object key = _key.toString().toLowerCase();
-
- Object v = super.getAttribute(key);
- if (v != null)
- return v;
- else if (parent != null)
- return parent.getAttribute(key);
- else
- return null;
- }
-
- /**
- * The name set must return HTML.Attribute and not a string,
- * where applicable.
- */
- public Enumeration getAttributeNames()
- {
- // Replace the string keys by HTML.attribute, where applicable
- final Enumeration enumeration = super.getAttributeNames();
-
- return new Enumeration()
- {
- public boolean hasMoreElements()
- {
- return enumeration.hasMoreElements();
- }
-
- public Object nextElement()
- {
- Object key = enumeration.nextElement();
- HTML.Attribute hKey = HTML.getAttributeKey((String) key);
- if (hKey != null)
- return hKey;
- else
- return key;
- }
- };
- }
-
- /**
- * Set the parent set, containing the default values.
- * @param a_parent
- */
- public void setResolveParent(AttributeSet a_parent)
- {
- parent = a_parent;
- }
-
- /**
- * Get the parent set, containing the default values.
- * @return
- */
- public AttributeSet getResolveParent()
- {
- return parent;
- }
-
- /**
- * Add the attribute to this attribute set.
- * @param key Attribute key (will be case insensitive)
- * @param value Attribute value
- */
- public void addAttribute(Object key, Object value)
- {
- super.addAttribute(key.toString().toLowerCase(), value);
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/htmlValidator.java b/libjava/gnu/javax/swing/text/html/parser/htmlValidator.java
deleted file mode 100644
index 1f9eee03a91..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/htmlValidator.java
+++ /dev/null
@@ -1,610 +0,0 @@
-/* tagStack.java -- The HTML tag stack.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser;
-
-import gnu.javax.swing.text.html.parser.models.node;
-import gnu.javax.swing.text.html.parser.models.transformer;
-
-import java.util.BitSet;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.ListIterator;
-
-import javax.swing.text.SimpleAttributeSet;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.parser.*;
-
-/**
- * list
, the call may be
- * delegeted to the child subnodes.
- * @param a_token A token to compare.
- * @return True if the token matches the token of this node.
- */
- protected boolean compare(Object a_token)
- {
- return performMatch(a_token);
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/models/noTagModel.java b/libjava/gnu/javax/swing/text/html/parser/models/noTagModel.java
deleted file mode 100755
index 8aac14d8e16..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/models/noTagModel.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* noTagModel.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.models;
-
-import java.io.Serializable;
-
-/**
- * Disallows a single given tag at the current content level only.
- *
- * will invoke exactly the handling methods exactly in the same order
- * (and with the same parameters) as if parsing the document:
- * <html><head></head><body><table><
- * tbody><tr><td>a</td><td>b
- * </td><td>c</td></tr><
- * /tbody></table></body></html>get
method. Use add
to
- * create a map for a concrete instance.
- */
- protected abstract void create();
-
- /**
- * Add an id/string pair to this mapper. This is called from
- * the method create
only.
- */
- protected void add(String name, int id)
- {
- Integer i = new Integer(id);
- si_Map.put(name, i);
- is_Map.put(i, name);
- }
-
- private void createTheMap()
- {
- is_Map = new HashMap();
- si_Map = new TreeMap();
- create();
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/support/low/Buffer.java b/libjava/gnu/javax/swing/text/html/parser/support/low/Buffer.java
deleted file mode 100644
index a39330af846..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/support/low/Buffer.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/* Buffer.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.support.low;
-
-/**
- * A string buffer that additionally holds line and absolute postion
- * information.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class Buffer
-{
- public static int INITIAL_SIZE = 2048;
-
- /**
- * True if the \n symbol has been seen.
- */
- public boolean n_seen;
-
- /**
- * True if the \r symbol has been seen.
- */
- public boolean r_seen;
- char[] chr = new char[ INITIAL_SIZE ];
- int[] line = new int[ INITIAL_SIZE ];
- int[] position = new int[ INITIAL_SIZE ];
-
- /**
- * Current line.
- */
- int current_line = 0;
-
- /**
- * Point to the next free position.
- */
- int length;
-
- public Buffer()
- {
- }
-
- public Buffer(String content)
- {
- for (int i = 0; i < content.length(); i++)
- {
- append(content.charAt(i), i);
- }
- }
-
- /**
- * Get the characters into array.
- * @param srcBegin From, inclusive
- * @param srcEnd To, exclusive.
- * @param dst Into
- * @param dstBegin Offset.
- */
- public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
- {
- System.arraycopy(chr, srcBegin, dst, dstBegin, (srcEnd - srcBegin));
- }
-
- /**
- * Return the sequence, used to separate lines in the document.
- * @return one of \n, \r or \r\n.
- */
- public String getEndOfLineSequence()
- {
- if (r_seen && n_seen)
- return "\r\n";
- else if (r_seen)
- return "\r";
- else
-
- // This also is returned for single-line document.
- return "\n";
- }
-
- /**
- * Truncate.
- * @param n The length to truncate till.
- */
- public void setLength(int n)
- {
- length = n;
- }
-
- /**
- * Get location information for the given region.
- * @param from Region start, inclusive.
- * @param to Region end, exclusive.
- * @return The location, covering the region.
- */
- public Location getLocation(int from, int to)
- {
- Location l = new Location();
- l.beginLine = line [ from ];
- l.endLine = line [ to - 1 ];
-
- l.startPosition = position [ from ];
- l.endPosition = position [ to - 1 ] + 1;
-
- return l;
- }
-
- /**
- * Add the character.
- * @param c The character.
- * @param pos The character position in the stream (the line number
- * is handled internally in the buffer).
- */
- public void append(char c, int pos)
- {
- if (length >= chr.length)
- expand();
- chr [ length ] = c;
- position [ length ] = pos;
-
- if (c == '\n')
- {
- if (!r_seen)
- current_line++;
- n_seen = true;
- }
- else if (c == '\r')
- {
- current_line++;
- r_seen = true;
- }
-
- line [ length ] = current_line;
-
- length++;
- }
-
- /**
- * Return char at the given positon.
- */
- public char charAt(int i)
- {
- return chr [ i ];
- }
-
- /**
- * Delete the range
- * @param from Start position, inclusive.
- * @param to End position, exclusive.
- */
- public void delete(int from, int to)
- {
- int len = to - from;
- if (len < 1)
- throw new AssertionError("Deleting " + from + " till " + to);
-
- int tail = length - to;
-
- System.arraycopy(chr, to, chr, from, tail);
- System.arraycopy(position, to, position, from, tail);
- System.arraycopy(line, to, line, from, tail);
- length = length - len;
- }
-
- /**
- * Double the buffer size.
- */
- public void expand()
- {
- int nSize = 2 * chr.length;
-
- char[] nchr = new char[ nSize ];
- int[] nposition = new int[ nSize ];
- int[] nline = new int[ nSize ];
-
- System.arraycopy(chr, 0, nchr, 0, chr.length);
- System.arraycopy(position, 0, nposition, 0, position.length);
- System.arraycopy(line, 0, nline, 0, line.length);
-
- chr = nchr;
- position = nposition;
- line = nline;
- }
-
- /**
- * Return length of the occupied part of the buffer.
- */
- public int length()
- {
- return length;
- }
-
- /**
- * Prepare for parsing the new document.
- */
- public void reset()
- {
- setLength(0);
- r_seen = n_seen = false;
- }
-
- public String toString()
- {
- return new String(chr, 0, length);
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/support/low/Constants.java b/libjava/gnu/javax/swing/text/html/parser/support/low/Constants.java
deleted file mode 100755
index 283d32385ef..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/support/low/Constants.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/* Constants.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.support.low;
-
-import java.util.BitSet;
-
-/**
- * The parser constants and operations, directly related to the parser
- * constants.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class Constants
-{
- /* Single character tokens are reflected into they ASCII codes. */
-
- /**
- * Start of HTML token.
- */
- public static final int BEGIN = '<';
-
- /**
- * End of HTML token.
- */
- public static final int END = '>';
-
- /**
- * Exclamation (indicates SGML or comment).
- */
- public static final int EXCLAMATION = '!';
-
- /**
- * Slash (indicates closing tag).
- */
- public static final int SLASH = '/';
-
- /**
- * Equals sign.
- */
- public static final int EQ = '=';
-
- /**
- * Quoting sign.
- */
- public static final int AP = '\'';
-
- /**
- * Quoting sign.
- */
- public static final int QUOT = '"';
-
- /* The numbers of other tokens start outside the ascii space. */
- /* String tokens */
-
- /**
- * Double dash (--)
- */
- public static final int DOUBLE_DASH = 1000;
-
- /**
- * The STYLE tag (needs special handling).
- */
- public static final int STYLE = 1001;
-
- /**
- * The SCRIPT tag (needs special handling).
- */
- public static final int SCRIPT = 1002;
-
- /* Pattern tokens */
-
- /**
- * HTML whitespace.
- */
- public static final int WS = 1003;
-
- /**
- * Named or numeric entity,
- */
- public static final int ENTITY = 1004;
-
- /**
- * Sequence of valid name characters (can start from digit).
- */
- public static final int NUMTOKEN = 1005;
-
- /* Complex tokens */
-
- /**
- * Comment opening sequence.
- */
- public static final pattern COMMENT_OPEN =
- new pattern(new node[]
- {
- new node(BEGIN), new node(WS, true), new node(EXCLAMATION),
- new node(WS, true), new node(DOUBLE_DASH),
- }
- );
-
- /**
- * Comment closing sequence
- */
- public static final pattern COMMENT_END =
- new pattern(new node[]
- {
- new node(DOUBLE_DASH), new node(WS, true), new node(END)
- }
- );
-
- /**
- * Special case ---> (also is treated as end of comment).
- */
- public static final pattern COMMENT_TRIPLEDASH_END =
- new pattern(new node[]
- {
- new node(DOUBLE_DASH), new node(NUMTOKEN), new node(END)
- }
- );
-
- /**
- * STYLE element heading pattern.
- */
- public static final pattern STYLE_OPEN =
- new pattern(new node[] { new node(BEGIN), new node(WS, true), new node(STYLE) });
-
- /**
- * SCRIPT element heading pattern.
- */
- public static final pattern SCRIPT_OPEN =
- new pattern(new node[] { new node(BEGIN), new node(WS, true), new node(SCRIPT) });
-
- /**
- * SGML element heading pattern.
- */
- public static final pattern SGML =
- new pattern(new node[]
- {
- new node(BEGIN), new node(WS, true), new node(EXCLAMATION)
- }
- );
-
- /**
- * SCRIPT element closing pattern.
- */
- public static final pattern SCRIPT_CLOSE =
- new pattern(new node[]
- {
- new node(BEGIN), new node(WS, true), new node(SLASH),
- new node(WS, true), new node(SCRIPT), new node(WS, true),
- new node(END)
- }
- );
-
- /**
- * STYLE element closing pattern.
- */
- public static final pattern STYLE_CLOSE =
- new pattern(new node[]
- {
- new node(BEGIN), new node(WS, true), new node(SLASH),
- new node(WS, true), new node(STYLE), new node(WS, true),
- new node(END)
- }
- );
-
- /**
- * Ordinary HTML tag heading pattern.
- */
- public static final pattern TAG =
- new pattern(new node[]
- {
- new node(BEGIN), new node(WS, true), new node(SLASH, true),
- new node(WS, true), new node(NUMTOKEN)
- }
- );
-
- /* Special tokens */
-
- /**
- * All other tokens.
- */
- public static final int OTHER = 1999;
-
- /**
- * The UNICODE "end of text" control code
- */
- static final char ETX = 3;
-
- /**
- * End of file.
- */
- public static final int EOF = ETX;
-
- /* Character categories */
-
- /**
- * All single char tokens.
- */
- public static final BitSet bSINGLE_CHAR_TOKEN = new BitSet();
-
- /**
- * Non letters and non numbers, allowed in HTML names.
- */
- public static final BitSet bSPECIAL = new BitSet();
-
- /**
- * All letters, used in HTML names.
- */
- public static final BitSet bLETTER = new BitSet();
-
- /**
- * Digits.
- */
- public static final BitSet bDIGIT = new BitSet();
-
- /**
- * Both line breaks.
- */
- public static final BitSet bLINEBREAK = new BitSet();
-
- /**
- * All whitespace.
- */
- public static final BitSet bWHITESPACE = new BitSet();
-
- /**
- * Both quoting characters.
- */
- public static final BitSet bQUOTING = new BitSet();
-
- /**
- * Valid name characters.
- */
- public static final BitSet bNAME = new BitSet();
-
- /* Entity subcategories */
-
- /**
- * Named entity.
- */
- public static final int ENTITY_NAMED = 1;
-
- /**
- * Numeric entity.
- */
- public static final int ENTITY_NUMERIC = 2;
-
- static
- {
- bQUOTING.set(AP);
- bQUOTING.set(QUOT);
-
- bSINGLE_CHAR_TOKEN.set(BEGIN);
- bSINGLE_CHAR_TOKEN.set(END);
- bSINGLE_CHAR_TOKEN.set(EXCLAMATION);
- bSINGLE_CHAR_TOKEN.set(SLASH);
- bSINGLE_CHAR_TOKEN.set(EQ);
- bSINGLE_CHAR_TOKEN.set(EOF);
-
- bSINGLE_CHAR_TOKEN.or(bQUOTING);
-
- bLINEBREAK.set('\r');
- bLINEBREAK.set('\n');
-
- bWHITESPACE.set(' ');
- bWHITESPACE.set('\t');
- bWHITESPACE.set(0xC);
- bWHITESPACE.or(bLINEBREAK);
-
- for (char i = '0'; i <= '9'; i++)
- {
- bDIGIT.set(i);
- }
-
- for (char i = 'a'; i <= 'z'; i++)
- {
- bLETTER.set(i);
- }
-
- for (char i = 'A'; i <= 'Z'; i++)
- {
- bLETTER.set(i);
- }
-
- bSPECIAL.set('-');
- bSPECIAL.set('_');
- bSPECIAL.set(':');
- bSPECIAL.set('.');
-
- bNAME.or(bLETTER);
- bNAME.or(bDIGIT);
- bNAME.or(bSPECIAL);
- }
-
- /**
- * Verifies if one of the tokens matches the end of string
- * buffer. The last character in the string buffer is the
- * "future character", some tokens needs to verify it the
- * token does not continue "towards the future". If the token
- * matches, it matches till "pre-last" character in the buffer.
- * @param b
- * @return
- */
- public Token endMatches(Buffer b)
- {
- if (b.length() < 2)
- return null;
-
- int p = b.length() - 2;
-
- if (b.length() > 2 && b.charAt(p) == '-' && b.charAt(p - 1) == '-')
- return new Token(DOUBLE_DASH, "--", b.getLocation(p - 1, p + 1));
-
- char last = b.charAt(p);
-
- if (bSINGLE_CHAR_TOKEN.get(last))
- return new Token(last, last, b.getLocation(p, p + 1));
-
- char future = b.charAt(p + 1);
-
- // Check for numtokens, script and style:
- if (bNAME.get(last) && !bNAME.get(future))
- {
- // Scan the history up:
- int u = p - 1;
- while (u >= 0 && bNAME.get(b.charAt(u)))
- u--;
- u++;
-
- char[] token = new char[ p - u + 1 ];
-
- // Found a numtoken
- b.getChars(u, p + 1, token, 0);
-
- // Verify for the built-in tokens:
- String e = new String(token);
-
- // found the entity reference
- if (u > 0 && b.charAt(u - 1) == '&')
- {
- // The subsequent semicolon may be the part of the token
- // as well. The semicolon must be ignored. This must be
- // handled elsewhere.
- return new Token(ENTITY, ENTITY_NAMED, "&" + e,
- b.getLocation(u - 1, p + 1)
- );
- }
-
- // found the numeric entity reference
- if (u > 1 && b.charAt(u - 1) == '#' && b.charAt(u - 2) == '&')
- {
- // The subsequent semicolon may be the part of the token
- // as well. The semicolon must be ignored. This must be
- // handled elsewhere.
- return new Token(ENTITY, ENTITY_NUMERIC, "" + e,
- b.getLocation(u - 2, p + 2)
- );
- }
-
- Location le = b.getLocation(u, p + 1);
-
- if (e.equalsIgnoreCase("SCRIPT"))
- return new Token(SCRIPT, e, le);
- else if (e.equalsIgnoreCase("STYLE"))
- return new Token(STYLE, e, le);
- else
- return new Token(NUMTOKEN, e, le);
- }
-
- // Check for whitespace
- if (bWHITESPACE.get(last) && !bWHITESPACE.get(future))
- {
- // Scan the history up:
- int u = p - 1;
- while (u >= 0 && bWHITESPACE.get(b.charAt(u)))
- u--;
- u++;
-
- char[] token = new char[ p - u + 1 ];
- b.getChars(u, p + 1, token, 0);
-
- return new Token(WS, new String(token), b.getLocation(u, p + 1));
- }
-
- return null;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/support/low/Location.java b/libjava/gnu/javax/swing/text/html/parser/support/low/Location.java
deleted file mode 100644
index 8a1cde1c86c..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/support/low/Location.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Location.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.support.low;
-
-/**
- * Defines a region in the text: its bounding positions and the line number.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class Location
-{
- /**
- * The line number, where the token starts.
- */
- public int beginLine;
-
- /**
- * The line, where the token ends.
- */
- public int endLine;
-
- /**
- * The absolute token end position in the input stream,
- * exclusive.
- */
- public int endPosition;
-
- /**
- * The absolute token start position in the input stream,
- * inclusive.
- */
- public int startPosition;
-
- public Location()
- {
- }
-
- /**
- * Special case, used to mark EOF.
- * @param p The total stream length.
- */
- public Location(int p)
- {
- startPosition = p;
- endPosition = p + 1;
- beginLine = endLine = -1;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/support/low/ParseException.java b/libjava/gnu/javax/swing/text/html/parser/support/low/ParseException.java
deleted file mode 100644
index e71c0c1f651..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/support/low/ParseException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ParseException.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.support.low;
-
-/**
- * This can be thrown from various parsing methods.
- */
-public class ParseException
- extends RuntimeException
-{
- public ParseException(String s, Throwable cause)
- {
- super(s, cause);
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/support/low/Queue.java b/libjava/gnu/javax/swing/text/html/parser/support/low/Queue.java
deleted file mode 100755
index 31cf4bb4d59..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/support/low/Queue.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Queue.java -- a token queue.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.support.low;
-
-import java.util.Arrays;
-
-/**
- * A token queue.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class Queue
-{
- Token[] m = new Token[ 64 ];
- int a = 0;
- int b = 0;
-
- /**
- * True for the empty queue.
- */
- public boolean isEmpty()
- {
- return size() == 0;
- }
-
- /**
- * Add this trace to the end of the queue.
- */
- public void add(Token u)
- {
- if (a < m.length)
- {
- m [ a ] = u;
- a++;
- }
- else // The end of array has been reached.
- {
- if (b > 0) // If some elements were deleted from the start of the queue, shift.
- {
- int d = b;
- System.arraycopy(m, b, m, 0, a - b);
- b = b - d;
- a = a - d;
- m [ a ] = u;
- a++;
- }
- else // Enlarge the queue, doubling the size.
- {
- int n = m.length * 2;
- Token[] nm = new Token[ 2 * n ];
- System.arraycopy(m, 0, nm, 0, m.length);
- Arrays.fill(m, null);
-
- nm [ a ] = u;
- m = nm;
- a++;
- }
- }
- }
-
- /**
- * Clear the queue.
- */
- public void clear()
- {
- a = b = 0;
- Arrays.fill(m, null);
- }
-
- /**
- * Read the value ahead. 0 is the value that will be returned with
- * the following next. This method does not remove values from the
- * queue. To test if there is enough tokens in the queue, size() must
- * be checked before calling this method.
- */
- public Token get(int ahead)
- {
- int p = b + ahead;
- if (p < a)
- return m [ p ];
- else
- throw new ArrayIndexOutOfBoundsException("Not enough tokens");
- }
-
- /**
- * Read the oldest value from the queue and remove this value from
- * the queue.
- */
- public Token next()
- {
- if (a == b)
- throw new ArrayIndexOutOfBoundsException("queue empty");
-
- Token r = m [ b ];
- m [ b ] = null;
- b++;
- return r;
- }
-
- /**
- * Size of the queue.
- */
- public int size()
- {
- return a - b;
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java b/libjava/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java
deleted file mode 100755
index 0ffc6c8b754..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/* ReaderTokenizer.java -- splits the input char sequence int tokens.
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.support.low;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * Reader splits the input char sequence into tokens.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class ReaderTokenizer
- extends Constants
-{
- /**
- * This is set to true each time the getNextToken is called.
- * Used in preventing loops when all patterns refuse to accept
- * the invalid input.
- */
- protected boolean advanced;
-
- /**
- * If true, the returned tokens are also placed in the backup
- * queue.
- */
- protected boolean backupMode;
-
- /**
- * The buffer to read document into.
- */
- Buffer buffer = new Buffer();
-
- /**
- * The queue for supporting mark().
- */
- Queue backup = new Queue();
-
- /**
- * The queue of found tokens.
- */
- Queue queue = new Queue();
-
- /**
- * The reader to read the document from.
- */
- Reader reader;
-
- /**
- * Array of char tokens
- */
- char[] charTokens;
-
- /**
- * Array of string tokens.
- */
- String[] stringTokens;
-
- /**
- * The current reader position.
- */
- int readerPosition = -1;
-
- /**
- * Creates a new ReaderTokenizer. The reset(...) method must be
- * subsequently called to set the reader.
- */
- public ReaderTokenizer()
- {
- }
-
- /**
- * Return the sequence, used to separate lines in the document.
- * @return one of \n, \r or \r\n.
- */
- public String getEndOfLineSequence()
- {
- return buffer.getEndOfLineSequence();
- }
-
- /**
- * Get the next token.
- * @return
- */
- public Token getNextToken()
- {
- Token rt;
- advanced = true;
- try
- {
- if (queue.isEmpty())
- read(1);
-
- if (!queue.isEmpty())
- rt = queue.next();
- else
- rt = new Token(EOF, new Location(readerPosition));
- }
- catch (IOException ex)
- {
- throw new ParseException("IO Exception", ex);
- }
- if (backupMode)
- backup.add(rt);
- return rt;
- }
-
- /**
- * Get a token, lying the given number of tokens
- * ahead. getToken(0) will return the same token,
- * what would be returned by getNextToken().
- * getToken(..) does change the current position
- * in the input stream. If the end of stream is
- * reached, the EOF token is always returned.
- */
- public Token getTokenAhead(int ahead)
- {
- try
- {
- read(ahead - queue.size() + 1);
- return queue.size() >= ahead ? queue.get(ahead) : eofToken();
- }
- catch (IOException ex)
- {
- throw new ParseException("IO Exception", ex);
- }
- }
-
- /**
- * Get a token, bein immediatley ahead.
- * If the end of stream is
- * reached, the EOF token is always returned.
- * The method is equivalent calling getTokenAhead(0).
- */
- public Token getTokenAhead()
- {
- try
- {
- if (queue.isEmpty())
- read(1);
- if (!queue.isEmpty())
- return queue.get(0);
- else
- return eofToken();
- }
- catch (IOException ex)
- {
- throw new ParseException("IO Exception", ex);
- }
- }
-
- /**
- * Invokes the error handler.
- */
- public void error(String msg, Token at)
- {
- System.out.println(msg);
- }
-
- /**
- * Turns the backup mode on or off.
- * It is possible to return where the mark(true) was last called
- * by calling reset().
- * @param mode True if it is required to save tokens, making
- * returning to the current point possible.
- */
- public void mark(boolean mode)
- {
- backup.clear();
- backupMode = mode;
- }
-
- /**
- * Prepare for new parsing from the given stream.
- * @param a_reader A reader to parse from.
- */
- public void reset(Reader a_reader)
- {
- reader = a_reader;
- readerPosition = -1;
- buffer.reset();
- queue.clear();
- }
-
- /**
- * Reset the internal cursor to the position where the mark()
- * was last time called. Switches the backup mode off.
- */
- public void reset()
- {
- if (!backupMode)
- throw new AssertionError("Call mark(true) before using reset()!");
- backupMode = false;
-
- // That is now in the queue, will be appended to the end of backup.
- while (!queue.isEmpty())
- backup.add(queue.next());
-
- Queue t = queue;
- queue = backup;
- backup = t;
- backup.clear();
- }
-
- /**
- * Read the given number of the tokens. Add the needed number of EOF
- * tokens if there are no more data in the stream.
- * @param amount The number of additional tokens to read.
- */
- void read(int numberOfTokens)
- throws IOException
- {
- if (numberOfTokens <= 0)
- return;
-
- reading:
- for (int i = 0; i < numberOfTokens; i++)
- readToken();
- }
-
- /**
- * Read next token from the reader, add it to the queue
- */
- void readToken()
- throws IOException
- {
- Token t;
- int ch;
-
- enlarging:
- while (true)
- {
- t = tokenMatches();
- if (t != null)
- break enlarging;
- else
- {
- ch = reader.read();
- readerPosition++;
- if (ch == ETX)
- ch = ' ';
- if (ch < 0)
- {
- if (buffer.length() == 0)
- {
- queue.add(eofToken());
- return;
- }
- else
- {
- if (buffer.charAt(buffer.length() - 1) != ETX)
- buffer.append(ETX, readerPosition++);
- else
- {
- // Discard terminating ETX
- buffer.setLength(buffer.length() - 1);
- if (buffer.length() > 0)
- {
- t = new Token(OTHER, buffer.toString(),
- buffer.getLocation(0, buffer.length())
- );
- queue.add(t);
- buffer.setLength(0);
- }
- return;
- }
- }
- }
- else
- buffer.append((char) ch, readerPosition);
- }
- }
- }
-
- /**
- * Check if the end of buffer matches one of the tokens. If it does,
- * return this token and remove the token sequence from the end of
- * buffer.
- * @return The matching token.
- */
- Token tokenMatches()
- {
- Token rt = endMatches(buffer);
- if (rt != null) // Remove the matched image
- {
- // Consume future character if it was an entity and the future
- // character is semicolon.
- if (rt.kind == ENTITY)
- {
- if (buffer.charAt(buffer.length() - 1) == ';')
- buffer.setLength(buffer.length() - rt.getImage().length() - 1);
- else
- {
- error("Missing closing semicolon for entity '" + rt.getImage() +
- "'", rt
- );
- consumeBuffer(rt);
- }
- }
- else
- {
- consumeBuffer(rt);
- }
- }
-
- // If the buffer is not empty, some sequence does not match any tokens.
- // Add it to the queue as "OTHER".
- if (rt != null)
- {
- if (buffer.length() > 1)
- {
- String rest = buffer.toString();
- rest = rest.substring(0, rest.length() - 1);
-
- Token other =
- new Token(OTHER, rest, buffer.getLocation(0, buffer.length));
- queue.add(other);
- consumeBuffer(other);
- }
- queue.add(rt);
- }
- return rt;
- }
-
- private void consumeBuffer(Token rt)
- {
- buffer.delete(buffer.length() - rt.getImage().length() - 1,
- buffer.length() - 1
- );
- }
-
- /**
- * Create EOF token.
- */
- private Token eofToken()
- {
- return new Token(EOF, "#", new Location(readerPosition));
- }
-}
diff --git a/libjava/gnu/javax/swing/text/html/parser/support/low/Token.java b/libjava/gnu/javax/swing/text/html/parser/support/low/Token.java
deleted file mode 100644
index d91adf47ab8..00000000000
--- a/libjava/gnu/javax/swing/text/html/parser/support/low/Token.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Token.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.swing.text.html.parser.support.low;
-
-/**
- * A token.
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-public class Token
-{
- /**
- * The place of this token in the document.
- */
- public Location where;
-
- /**
- * The additional category of token.
- */
- public int category;
-
- /**
- * An integer that describes the kind of this token.
- */
- public int kind;
-
- /**
- * The string image of the token, null if the char image must be used.
- */
- private String stringImage;
-
- /**
- * The char image of the token.
- */
- private char charImage;
-
- /**
- * Creates a new token with fields, initialized to the default values.
- */
- public Token()
- {
- }
-
- /**
- * Creates a new token of the given kind.
- */
- public Token(int _kind, Location _where)
- {
- kind = _kind;
- where = _where;
- }
-
- /**
- * Creates a new token of the given kind and given single char image.
- */
- public Token(int _kind, char _image, Location _where)
- {
- kind = _kind;
- charImage = _image;
- where = _where;
- }
-
- /**
- * Creates a new token of the given kind and given string image.
- */
- public Token(int _kind, String _image, Location _where)
- {
- kind = _kind;
- stringImage = _image;
- where = _where;
- }
-
- /**
- * Creates a new token of the given kind, category and given string image.
- */
- public Token(int _kind, int _category, String _image, Location _where)
- {
- kind = _kind;
- category = _category;
- stringImage = _image;
- where = _where;
- }
-
- /**
- * Creates a new token, where location fields are set as for token,
- * spanning over two provided tokens and any tokens between them.
- * The image field is initialized to null, the kind field is set to -1.
- */
- public Token(Token fromInclusive, Token toInclusive)
- {
- where = new Location();
- where.beginLine = fromInclusive.where.beginLine;
- where.startPosition = fromInclusive.where.startPosition;
-
- where.endLine = toInclusive.where.endLine;
- where.endPosition = toInclusive.where.endPosition;
- }
-
- public String getImage()
- {
- if (kind == 3)
- return "#";
- if (stringImage == null)
- {
- if (charImage == 0)
- return null;
- stringImage = new String(new char[] { charImage });
- }
- return stringImage;
- }
-
- /**
- * Append the token image to the given string buffer.
- * This may be more effective that buffer.append(this.getImage()).
- * @param buffer A buffer to append.
- */
- public void appendTo(StringBuffer buffer)
- {
- if (charImage == 0)
- buffer.append(getImage());
- else
- buffer.append(charImage);
- }
-
- /**
- * Returns the string image or, if null, the bounding positions.
- */
- public String toString()
- {
- return getImage() != null ? kind + "'" + getImage()
- : "RESyntax.RE_SYNTAX_PERL5
is used).
- * isMatch
: returns true if the input text in its
- * entirety matches the regular expression pattern.
- * getMatch
: returns the first match found in the
- * input text, or null if no match is found.
- * getAllMatches
: returns an array of all
- * non-overlapping matches found in the input text. If no matches are
- * found, the array is zero-length.
- * substitute
: substitute the first occurence of the
- * pattern in the input text with a replacement string (which may
- * include metacharacters $0-$9, see REMatch.substituteInto).
- * substituteAll
: same as above, but repeat for each
- * match before returning.
- * getMatchEnumeration
: returns an REMatchEnumeration
- * object that allows iteration over the matches (see
- * REMatchEnumeration for some reasons why you may want to do this
- * instead of using getAllMatches
.
- *
- * String s = "food bar fool";
- */
- public static final int REG_NOTBOL = 16;
-
- /**
- * Execution flag.
- * The match-end operator ($) does not match at the end
- * of the input string. Useful for matching on substrings.
- */
- public static final int REG_NOTEOL = 32;
-
- /**
- * Execution flag.
- * When a match method is invoked that starts matching at a non-zero
- * index into the input, treat the input as if it begins at the index
- * given. The effect of this flag is that the engine does not "see"
- * any text in the input before the given index. This is useful so
- * that the match-beginning operator (^) matches not at position 0
- * in the input string, but at the position the search started at
- * (based on the index input given to the getMatch function). See
- * the example under REG_NOTBOL. It also affects the use of the \<
- * and \b operators.
- */
- public static final int REG_ANCHORINDEX = 64;
-
- /**
- * Execution flag.
- * The substitute and substituteAll methods will not attempt to
- * interpolate occurrences of $1-$9 in the replacement text with
- * the corresponding subexpressions. For example, you may want to
- * replace all matches of "one dollar" with "$1".
- */
- public static final int REG_NO_INTERPOLATE = 128;
-
- /** Returns a string representing the version of the gnu.regexp package. */
- public static final String version() {
- return VERSION;
- }
-
- // Retrieves a message from the ResourceBundle
- static final String getLocalizedMessage(String key) {
- return messages.getString(key);
- }
-
- /**
- * Constructs a regular expression pattern buffer without any compilation
- * flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @exception REException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public RE(Object pattern) throws REException {
- this(pattern,0,RESyntax.RE_SYNTAX_PERL5,0,0);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and the default syntax (RESyntax.RE_SYNTAX_PERL5).
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags listed above.
- * @exception REException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public RE(Object pattern, int cflags) throws REException {
- this(pattern,cflags,RESyntax.RE_SYNTAX_PERL5,0,0);
- }
-
- /**
- * Constructs a regular expression pattern buffer using the specified
- * compilation flags and regular expression syntax.
- *
- * @param pattern A regular expression pattern, in the form of a String,
- * StringBuffer, or char[]. Other input types will be converted to
- * strings using the toString() method.
- * @param cflags The logical OR of any combination of the compilation flags listed above.
- * @param syntax The type of regular expression syntax to use.
- * @exception REException The input pattern could not be parsed.
- * @exception NullPointerException The pattern was null.
- */
- public RE(Object pattern, int cflags, RESyntax syntax) throws REException {
- this(pattern,cflags,syntax,0,0);
- }
-
- // internal constructor used for alternation
- private RE(REToken first, REToken last,int subs, int subIndex, int minLength) {
- super(subIndex);
- firstToken = first;
- lastToken = last;
- numSubs = subs;
- minimumLength = minLength;
- addToken(new RETokenEndSub(subIndex));
- }
-
- private RE(Object patternObj, int cflags, RESyntax syntax, int myIndex, int nextSub) throws REException {
- super(myIndex); // Subexpression index of this token.
- initialize(patternObj, cflags, syntax, myIndex, nextSub);
- }
-
- // For use by subclasses
- protected RE() { super(0); }
-
- // The meat of construction
- protected void initialize(Object patternObj, int cflags, RESyntax syntax, int myIndex, int nextSub) throws REException {
- char[] pattern;
- if (patternObj instanceof String) {
- pattern = ((String) patternObj).toCharArray();
- } else if (patternObj instanceof char[]) {
- pattern = (char[]) patternObj;
- } else if (patternObj instanceof StringBuffer) {
- pattern = new char [((StringBuffer) patternObj).length()];
- ((StringBuffer) patternObj).getChars(0,pattern.length,pattern,0);
- } else {
- pattern = patternObj.toString().toCharArray();
- }
-
- int pLength = pattern.length;
-
- numSubs = 0; // Number of subexpressions in this token.
- Vector branches = null;
-
- // linked list of tokens (sort of -- some closed loops can exist)
- firstToken = lastToken = null;
-
- // Precalculate these so we don't pay for the math every time we
- // need to access them.
- boolean insens = ((cflags & REG_ICASE) > 0);
-
- // Parse pattern into tokens. Does anyone know if it's more efficient
- // to use char[] than a String.charAt()? I'm assuming so.
-
- // index tracks the position in the char array
- int index = 0;
-
- // this will be the current parse character (pattern[index])
- CharUnit unit = new CharUnit();
-
- // This is used for {x,y} calculations
- IntPair minMax = new IntPair();
-
- // Buffer a token so we can create a TokenRepeated, etc.
- REToken currentToken = null;
- char ch;
- boolean quot = false;
-
- while (index < pLength) {
- // read the next character unit (including backslash escapes)
- index = getCharUnit(pattern,index,unit,quot);
-
- if (unit.bk)
- if (unit.ch == 'Q') {
- quot = true;
- continue;
- } else if (unit.ch == 'E') {
- quot = false;
- continue;
- }
- if (quot)
- unit.bk = false;
-
- // ALTERNATION OPERATOR
- // \| or | (if RE_NO_BK_VBAR) or newline (if RE_NEWLINE_ALT)
- // not available if RE_LIMITED_OPS is set
-
- // TODO: the '\n' literal here should be a test against REToken.newline,
- // which unfortunately may be more than a single character.
- if ( ( (unit.ch == '|' && (syntax.get(RESyntax.RE_NO_BK_VBAR) ^ (unit.bk || quot)))
- || (syntax.get(RESyntax.RE_NEWLINE_ALT) && (unit.ch == '\n') && !(unit.bk || quot)) )
- && !syntax.get(RESyntax.RE_LIMITED_OPS)) {
- // make everything up to here be a branch. create vector if nec.
- addToken(currentToken);
- RE theBranch = new RE(firstToken, lastToken, numSubs, subIndex, minimumLength);
- minimumLength = 0;
- if (branches == null) {
- branches = new Vector();
- }
- branches.addElement(theBranch);
- firstToken = lastToken = currentToken = null;
- }
-
- // INTERVAL OPERATOR:
- // {x} | {x,} | {x,y} (RE_INTERVALS && RE_NO_BK_BRACES)
- // \{x\} | \{x,\} | \{x,y\} (RE_INTERVALS && !RE_NO_BK_BRACES)
- //
- // OPEN QUESTION:
- // what is proper interpretation of '{' at start of string?
-
- else if ((unit.ch == '{') && syntax.get(RESyntax.RE_INTERVALS) && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ (unit.bk || quot))) {
- int newIndex = getMinMax(pattern,index,minMax,syntax);
- if (newIndex > index) {
- if (minMax.first > minMax.second)
- throw new REException(getLocalizedMessage("interval.order"),REException.REG_BADRPT,newIndex);
- if (currentToken == null)
- throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,newIndex);
- if (currentToken instanceof RETokenRepeated)
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,newIndex);
- if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,newIndex);
- if ((currentToken.getMinimumLength() == 0) && (minMax.second == Integer.MAX_VALUE))
- throw new REException(getLocalizedMessage("repeat.empty.token"),REException.REG_BADRPT,newIndex);
- index = newIndex;
- currentToken = setRepeated(currentToken,minMax.first,minMax.second,index);
- }
- else {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,unit.ch,insens);
- }
- }
-
- // LIST OPERATOR:
- // [...] | [^...]
-
- else if ((unit.ch == '[') && !(unit.bk || quot)) {
- Vector options = new Vector();
- boolean negative = false;
- char lastChar = 0;
- if (index == pLength) throw new REException(getLocalizedMessage("unmatched.bracket"),REException.REG_EBRACK,index);
-
- // Check for initial caret, negation
- if ((ch = pattern[index]) == '^') {
- negative = true;
- if (++index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- ch = pattern[index];
- }
-
- // Check for leading right bracket literal
- if (ch == ']') {
- lastChar = ch;
- if (++index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- }
-
- while ((ch = pattern[index++]) != ']') {
- if ((ch == '-') && (lastChar != 0)) {
- if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- if ((ch = pattern[index]) == ']') {
- options.addElement(new RETokenChar(subIndex,lastChar,insens));
- lastChar = '-';
- } else {
- options.addElement(new RETokenRange(subIndex,lastChar,ch,insens));
- lastChar = 0;
- index++;
- }
- } else if ((ch == '\\') && syntax.get(RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) {
- if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- int posixID = -1;
- boolean negate = false;
- char asciiEsc = 0;
- if (("dswDSW".indexOf(pattern[index]) != -1) && syntax.get(RESyntax.RE_CHAR_CLASS_ESC_IN_LISTS)) {
- switch (pattern[index]) {
- case 'D':
- negate = true;
- case 'd':
- posixID = RETokenPOSIX.DIGIT;
- break;
- case 'S':
- negate = true;
- case 's':
- posixID = RETokenPOSIX.SPACE;
- break;
- case 'W':
- negate = true;
- case 'w':
- posixID = RETokenPOSIX.ALNUM;
- break;
- }
- }
- else if ("nrt".indexOf(pattern[index]) != -1) {
- switch (pattern[index]) {
- case 'n':
- asciiEsc = '\n';
- break;
- case 't':
- asciiEsc = '\t';
- break;
- case 'r':
- asciiEsc = '\r';
- break;
- }
- }
- if (lastChar != 0) options.addElement(new RETokenChar(subIndex,lastChar,insens));
-
- if (posixID != -1) {
- options.addElement(new RETokenPOSIX(subIndex,posixID,insens,negate));
- } else if (asciiEsc != 0) {
- lastChar = asciiEsc;
- } else {
- lastChar = pattern[index];
- }
- ++index;
- } else if ((ch == '[') && (syntax.get(RESyntax.RE_CHAR_CLASSES)) && (index < pLength) && (pattern[index] == ':')) {
- StringBuffer posixSet = new StringBuffer();
- index = getPosixSet(pattern,index+1,posixSet);
- int posixId = RETokenPOSIX.intValue(posixSet.toString());
- if (posixId != -1)
- options.addElement(new RETokenPOSIX(subIndex,posixId,insens,false));
- } else {
- if (lastChar != 0) options.addElement(new RETokenChar(subIndex,lastChar,insens));
- lastChar = ch;
- }
- if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
- } // while in list
- // Out of list, index is one past ']'
-
- if (lastChar != 0) options.addElement(new RETokenChar(subIndex,lastChar,insens));
-
- // Create a new RETokenOneOf
- addToken(currentToken);
- options.trimToSize();
- currentToken = new RETokenOneOf(subIndex,options,negative);
- }
-
- // SUBEXPRESSIONS
- // (...) | \(...\) depending on RE_NO_BK_PARENS
-
- else if ((unit.ch == '(') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot))) {
- boolean pure = false;
- boolean comment = false;
- boolean lookAhead = false;
- boolean negativelh = false;
- if ((index+1 < pLength) && (pattern[index] == '?')) {
- switch (pattern[index+1]) {
- case '!':
- if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
- pure = true;
- negativelh = true;
- lookAhead = true;
- index += 2;
- }
- break;
- case '=':
- if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
- pure = true;
- lookAhead = true;
- index += 2;
- }
- break;
- case ':':
- if (syntax.get(RESyntax.RE_PURE_GROUPING)) {
- pure = true;
- index += 2;
- }
- break;
- case '#':
- if (syntax.get(RESyntax.RE_COMMENTS)) {
- comment = true;
- }
- break;
- default:
- throw new REException(getLocalizedMessage("repeat.no.token"), REException.REG_BADRPT, index);
- }
- }
-
- if (index >= pLength) {
- throw new REException(getLocalizedMessage("unmatched.paren"), REException.REG_ESUBREG,index);
- }
-
- // find end of subexpression
- int endIndex = index;
- int nextIndex = index;
- int nested = 0;
-
- while ( ((nextIndex = getCharUnit(pattern,endIndex,unit,false)) > 0)
- && !(nested == 0 && (unit.ch == ')') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot))) )
- if ((endIndex = nextIndex) >= pLength)
- throw new REException(getLocalizedMessage("subexpr.no.end"),REException.REG_ESUBREG,nextIndex);
- else if (unit.ch == '(' && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot)))
- nested++;
- else if (unit.ch == ')' && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot)))
- nested--;
-
- // endIndex is now position at a ')','\)'
- // nextIndex is end of string or position after ')' or '\)'
-
- if (comment) index = nextIndex;
- else { // not a comment
- // create RE subexpression as token.
- addToken(currentToken);
- if (!pure) {
- numSubs++;
- }
-
- int useIndex = (pure || lookAhead) ? 0 : nextSub + numSubs;
- currentToken = new RE(String.valueOf(pattern,index,endIndex-index).toCharArray(),cflags,syntax,useIndex,nextSub + numSubs);
- numSubs += ((RE) currentToken).getNumSubs();
-
- if (lookAhead) {
- currentToken = new RETokenLookAhead(currentToken,negativelh);
- }
-
- index = nextIndex;
- } // not a comment
- } // subexpression
-
- // UNMATCHED RIGHT PAREN
- // ) or \) throw exception if
- // !syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD)
- else if (!syntax.get(RESyntax.RE_UNMATCHED_RIGHT_PAREN_ORD) && ((unit.ch == ')') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ (unit.bk || quot)))) {
- throw new REException(getLocalizedMessage("unmatched.paren"),REException.REG_EPAREN,index);
- }
-
- // START OF LINE OPERATOR
- // ^
-
- else if ((unit.ch == '^') && !(unit.bk || quot)) {
- addToken(currentToken);
- currentToken = null;
- addToken(new RETokenStart(subIndex,((cflags & REG_MULTILINE) > 0) ? syntax.getLineSeparator() : null));
- }
-
- // END OF LINE OPERATOR
- // $
-
- else if ((unit.ch == '$') && !(unit.bk || quot)) {
- addToken(currentToken);
- currentToken = null;
- addToken(new RETokenEnd(subIndex,((cflags & REG_MULTILINE) > 0) ? syntax.getLineSeparator() : null));
- }
-
- // MATCH-ANY-CHARACTER OPERATOR (except possibly newline and null)
- // .
-
- else if ((unit.ch == '.') && !(unit.bk || quot)) {
- addToken(currentToken);
- currentToken = new RETokenAny(subIndex,syntax.get(RESyntax.RE_DOT_NEWLINE) || ((cflags & REG_DOT_NEWLINE) > 0),syntax.get(RESyntax.RE_DOT_NOT_NULL));
- }
-
- // ZERO-OR-MORE REPEAT OPERATOR
- // *
-
- else if ((unit.ch == '*') && !(unit.bk || quot)) {
- if (currentToken == null)
- throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
- if (currentToken instanceof RETokenRepeated)
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,index);
- if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,index);
- if (currentToken.getMinimumLength() == 0)
- throw new REException(getLocalizedMessage("repeat.empty.token"),REException.REG_BADRPT,index);
- currentToken = setRepeated(currentToken,0,Integer.MAX_VALUE,index);
- }
-
- // ONE-OR-MORE REPEAT OPERATOR / POSSESSIVE MATCHING OPERATOR
- // + | \+ depending on RE_BK_PLUS_QM
- // not available if RE_LIMITED_OPS is set
-
- else if ((unit.ch == '+') && !syntax.get(RESyntax.RE_LIMITED_OPS) && (!syntax.get(RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot))) {
- if (currentToken == null)
- throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
-
- // Check for possessive matching on RETokenRepeated
- if (currentToken instanceof RETokenRepeated) {
- RETokenRepeated tokenRep = (RETokenRepeated)currentToken;
- if (syntax.get(RESyntax.RE_POSSESSIVE_OPS) && !tokenRep.isPossessive() && !tokenRep.isStingy())
- tokenRep.makePossessive();
- else
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,index);
-
- }
- else if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,index);
- else if (currentToken.getMinimumLength() == 0)
- throw new REException(getLocalizedMessage("repeat.empty.token"),REException.REG_BADRPT,index);
- else
- currentToken = setRepeated(currentToken,1,Integer.MAX_VALUE,index);
- }
-
- // ZERO-OR-ONE REPEAT OPERATOR / STINGY MATCHING OPERATOR
- // ? | \? depending on RE_BK_PLUS_QM
- // not available if RE_LIMITED_OPS is set
- // stingy matching if RE_STINGY_OPS is set and it follows a quantifier
-
- else if ((unit.ch == '?') && !syntax.get(RESyntax.RE_LIMITED_OPS) && (!syntax.get(RESyntax.RE_BK_PLUS_QM) ^ (unit.bk || quot))) {
- if (currentToken == null) throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
-
- // Check for stingy matching on RETokenRepeated
- if (currentToken instanceof RETokenRepeated) {
- RETokenRepeated tokenRep = (RETokenRepeated)currentToken;
- if (syntax.get(RESyntax.RE_STINGY_OPS) && !tokenRep.isStingy() && !tokenRep.isPossessive())
- tokenRep.makeStingy();
- else
- throw new REException(getLocalizedMessage("repeat.chained"),REException.REG_BADRPT,index);
- }
- else if (currentToken instanceof RETokenWordBoundary || currentToken instanceof RETokenWordBoundary)
- throw new REException(getLocalizedMessage("repeat.assertion"),REException.REG_BADRPT,index);
- else
- currentToken = setRepeated(currentToken,0,1,index);
- }
-
- // BACKREFERENCE OPERATOR
- // \1 \2 ... \9
- // not available if RE_NO_BK_REFS is set
-
- else if (unit.bk && Character.isDigit(unit.ch) && !syntax.get(RESyntax.RE_NO_BK_REFS)) {
- addToken(currentToken);
- currentToken = new RETokenBackRef(subIndex,Character.digit(unit.ch,10),insens);
- }
-
- // START OF STRING OPERATOR
- // \A if RE_STRING_ANCHORS is set
-
- else if (unit.bk && (unit.ch == 'A') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenStart(subIndex,null);
- }
-
- // WORD BREAK OPERATOR
- // \b if ????
-
- else if (unit.bk && (unit.ch == 'b') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.BEGIN | RETokenWordBoundary.END, false);
- }
-
- // WORD BEGIN OPERATOR
- // \< if ????
- else if (unit.bk && (unit.ch == '<')) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.BEGIN, false);
- }
-
- // WORD END OPERATOR
- // \> if ????
- else if (unit.bk && (unit.ch == '>')) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.END, false);
- }
-
- // NON-WORD BREAK OPERATOR
- // \B if ????
-
- else if (unit.bk && (unit.ch == 'B') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenWordBoundary(subIndex, RETokenWordBoundary.BEGIN | RETokenWordBoundary.END, true);
- }
-
-
- // DIGIT OPERATOR
- // \d if RE_CHAR_CLASS_ESCAPES is set
-
- else if (unit.bk && (unit.ch == 'd') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,false);
- }
-
- // NON-DIGIT OPERATOR
- // \D
-
- else if (unit.bk && (unit.ch == 'D') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,true);
- }
-
- // NEWLINE ESCAPE
- // \n
-
- else if (unit.bk && (unit.ch == 'n')) {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,'\n',false);
- }
-
- // RETURN ESCAPE
- // \r
-
- else if (unit.bk && (unit.ch == 'r')) {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,'\r',false);
- }
-
- // WHITESPACE OPERATOR
- // \s if RE_CHAR_CLASS_ESCAPES is set
-
- else if (unit.bk && (unit.ch == 's') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,false);
- }
-
- // NON-WHITESPACE OPERATOR
- // \S
-
- else if (unit.bk && (unit.ch == 'S') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,true);
- }
-
- // TAB ESCAPE
- // \t
-
- else if (unit.bk && (unit.ch == 't')) {
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,'\t',false);
- }
-
- // ALPHANUMERIC OPERATOR
- // \w
-
- else if (unit.bk && (unit.ch == 'w') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,false);
- }
-
- // NON-ALPHANUMERIC OPERATOR
- // \W
-
- else if (unit.bk && (unit.ch == 'W') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
- addToken(currentToken);
- currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,true);
- }
-
- // END OF STRING OPERATOR
- // \Z
-
- else if (unit.bk && (unit.ch == 'Z') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
- addToken(currentToken);
- currentToken = new RETokenEnd(subIndex,null);
- }
-
- // NON-SPECIAL CHARACTER (or escape to make literal)
- // c | \* for example
-
- else { // not a special character
- addToken(currentToken);
- currentToken = new RETokenChar(subIndex,unit.ch,insens);
- }
- } // end while
-
- // Add final buffered token and an EndSub marker
- addToken(currentToken);
-
- if (branches != null) {
- branches.addElement(new RE(firstToken,lastToken,numSubs,subIndex,minimumLength));
- branches.trimToSize(); // compact the Vector
- minimumLength = 0;
- firstToken = lastToken = null;
- addToken(new RETokenOneOf(subIndex,branches,false));
- }
- else addToken(new RETokenEndSub(subIndex));
-
- }
-
- private static int getCharUnit(char[] input, int index, CharUnit unit, boolean quot) throws REException {
- unit.ch = input[index++];
- if (unit.bk = (unit.ch == '\\' && (!quot || index >= input.length || input[index] == 'E')))
- if (index < input.length)
- unit.ch = input[index++];
- else throw new REException(getLocalizedMessage("ends.with.backslash"),REException.REG_ESCAPE,index);
- return index;
- }
-
- /**
- * Checks if the regular expression matches the input in its entirety.
- *
- * @param input The input text.
- */
- public boolean isMatch(Object input) {
- return isMatch(input,0,0);
- }
-
- /**
- * Checks if the input string, starting from index, is an exact match of
- * this regular expression.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- */
- public boolean isMatch(Object input,int index) {
- return isMatch(input,index,0);
- }
-
-
- /**
- * Checks if the input, starting from index and using the specified
- * execution flags, is an exact match of this regular expression.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- */
- public boolean isMatch(Object input,int index,int eflags) {
- return isMatchImpl(makeCharIndexed(input,index),index,eflags);
- }
-
- private boolean isMatchImpl(CharIndexed input, int index, int eflags) {
- if (firstToken == null) // Trivial case
- return (input.charAt(0) == CharIndexed.OUT_OF_BOUNDS);
- REMatch m = new REMatch(numSubs, index, eflags);
- if (firstToken.match(input, m)) {
- while (m != null) {
- if (input.charAt(m.index) == CharIndexed.OUT_OF_BOUNDS) {
- return true;
- }
- m = m.next;
- }
- }
- return false;
- }
-
- /**
- * Returns the maximum number of subexpressions in this regular expression.
- * If the expression contains branches, the value returned will be the
- * maximum subexpressions in any of the branches.
- */
- public int getNumSubs() {
- return numSubs;
- }
-
- // Overrides REToken.setUncle
- void setUncle(REToken uncle) {
- if (lastToken != null) {
- lastToken.setUncle(uncle);
- } else super.setUncle(uncle); // to deal with empty subexpressions
- }
-
- // Overrides REToken.chain
-
- boolean chain(REToken next) {
- super.chain(next);
- setUncle(next);
- return true;
- }
-
- /**
- * Returns the minimum number of characters that could possibly
- * constitute a match of this regular expression.
- */
- public int getMinimumLength() {
- return minimumLength;
- }
-
- /**
- * Returns an array of all matches found in the input.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @return a non-null (but possibly zero-length) array of matches
- */
- public REMatch[] getAllMatches(Object input) {
- return getAllMatches(input,0,0);
- }
-
- /**
- * Returns an array of all matches found in the input,
- * beginning at the specified index position.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @return a non-null (but possibly zero-length) array of matches
- */
- public REMatch[] getAllMatches(Object input, int index) {
- return getAllMatches(input,index,0);
- }
-
- /**
- * Returns an array of all matches found in the input string,
- * beginning at the specified index position and using the specified
- * execution flags.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return a non-null (but possibly zero-length) array of matches
- */
- public REMatch[] getAllMatches(Object input, int index, int eflags) {
- return getAllMatchesImpl(makeCharIndexed(input,index),index,eflags);
- }
-
- // this has been changed since 1.03 to be non-overlapping matches
- private REMatch[] getAllMatchesImpl(CharIndexed input, int index, int eflags) {
- Vector all = new Vector();
- REMatch m = null;
- while ((m = getMatchImpl(input,index,eflags,null)) != null) {
- all.addElement(m);
- index = m.getEndIndex();
- if (m.end[0] == 0) { // handle pathological case of zero-length match
- index++;
- input.move(1);
- } else {
- input.move(m.end[0]);
- }
- if (!input.isValid()) break;
- }
- REMatch[] mset = new REMatch[all.size()];
- all.copyInto(mset);
- return mset;
- }
-
- /* Implements abstract method REToken.match() */
- boolean match(CharIndexed input, REMatch mymatch) {
- if (firstToken == null) return next(input, mymatch);
-
- // Note the start of this subexpression
- mymatch.start[subIndex] = mymatch.index;
-
- return firstToken.match(input, mymatch);
- }
-
- /**
- * Returns the first match found in the input. If no match is found,
- * null is returned.
- *
- * @param input The input text.
- * @return An REMatch instance referencing the match, or null if none.
- */
- public REMatch getMatch(Object input) {
- return getMatch(input,0,0);
- }
-
- /**
- * Returns the first match found in the input, beginning
- * the search at the specified index. If no match is found,
- * returns null.
- *
- * @param input The input text.
- * @param index The offset within the text to begin looking for a match.
- * @return An REMatch instance referencing the match, or null if none.
- */
- public REMatch getMatch(Object input, int index) {
- return getMatch(input,index,0);
- }
-
- /**
- * Returns the first match found in the input, beginning
- * the search at the specified index, and using the specified
- * execution flags. If no match is found, returns null.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return An REMatch instance referencing the match, or null if none.
- */
- public REMatch getMatch(Object input, int index, int eflags) {
- return getMatch(input,index,eflags,null);
- }
-
- /**
- * Returns the first match found in the input, beginning the search
- * at the specified index, and using the specified execution flags.
- * If no match is found, returns null. If a StringBuffer is
- * provided and is non-null, the contents of the input text from the
- * index to the beginning of the match (or to the end of the input,
- * if there is no match) are appended to the StringBuffer.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @param buffer The StringBuffer to save pre-match text in.
- * @return An REMatch instance referencing the match, or null if none. */
- public REMatch getMatch(Object input, int index, int eflags, StringBuffer buffer) {
- return getMatchImpl(makeCharIndexed(input,index),index,eflags,buffer);
- }
-
- REMatch getMatchImpl(CharIndexed input, int anchor, int eflags, StringBuffer buffer) {
- // Create a new REMatch to hold results
- REMatch mymatch = new REMatch(numSubs, anchor, eflags);
- do {
- // Optimization: check if anchor + minimumLength > length
- if (minimumLength == 0 || input.charAt(minimumLength-1) != CharIndexed.OUT_OF_BOUNDS) {
- if (match(input, mymatch)) {
- // Find longest match of them all to observe leftmost longest
- REMatch longest = mymatch;
- while ((mymatch = mymatch.next) != null) {
- if (mymatch.index > longest.index) {
- longest = mymatch;
- }
- }
-
- longest.end[0] = longest.index;
- longest.finish(input);
- return longest;
- }
- }
- mymatch.clear(++anchor);
- // Append character to buffer if needed
- if (buffer != null && input.charAt(0) != CharIndexed.OUT_OF_BOUNDS) {
- buffer.append(input.charAt(0));
- }
- } while (input.move(1));
-
- // Special handling at end of input for e.g. "$"
- if (minimumLength == 0) {
- if (match(input, mymatch)) {
- mymatch.finish(input);
- return mymatch;
- }
- }
-
- return null;
- }
-
- /**
- * Returns an REMatchEnumeration that can be used to iterate over the
- * matches found in the input text.
- *
- * @param input The input text.
- * @return A non-null REMatchEnumeration instance.
- */
- public REMatchEnumeration getMatchEnumeration(Object input) {
- return getMatchEnumeration(input,0,0);
- }
-
-
- /**
- * Returns an REMatchEnumeration that can be used to iterate over the
- * matches found in the input text.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @return A non-null REMatchEnumeration instance, with its input cursor
- * set to the index position specified.
- */
- public REMatchEnumeration getMatchEnumeration(Object input, int index) {
- return getMatchEnumeration(input,index,0);
- }
-
- /**
- * Returns an REMatchEnumeration that can be used to iterate over the
- * matches found in the input text.
- *
- * @param input The input text.
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return A non-null REMatchEnumeration instance, with its input cursor
- * set to the index position specified.
- */
- public REMatchEnumeration getMatchEnumeration(Object input, int index, int eflags) {
- return new REMatchEnumeration(this,makeCharIndexed(input,index),index,eflags);
- }
-
-
- /**
- * Substitutes the replacement text for the first match found in the input.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @return A String interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substitute(Object input,String replace) {
- return substitute(input,replace,0,0);
- }
-
- /**
- * Substitutes the replacement text for the first match found in the input
- * beginning at the specified index position. Specifying an index
- * effectively causes the regular expression engine to throw away the
- * specified number of characters.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substitute(Object input,String replace,int index) {
- return substitute(input,replace,index,0);
- }
-
- /**
- * Substitutes the replacement text for the first match found in the input
- * string, beginning at the specified index position and using the
- * specified execution flags.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substitute(Object input,String replace,int index,int eflags) {
- return substituteImpl(makeCharIndexed(input,index),replace,index,eflags);
- }
-
- private String substituteImpl(CharIndexed input,String replace,int index,int eflags) {
- StringBuffer buffer = new StringBuffer();
- REMatch m = getMatchImpl(input,index,eflags,buffer);
- if (m==null) return buffer.toString();
- buffer.append( ((eflags & REG_NO_INTERPOLATE) > 0) ?
- replace : m.substituteInto(replace) );
- if (input.move(m.end[0])) {
- do {
- buffer.append(input.charAt(0));
- } while (input.move(1));
- }
- return buffer.toString();
- }
-
- /**
- * Substitutes the replacement text for each non-overlapping match found
- * in the input text.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @return A String interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substituteAll(Object input,String replace) {
- return substituteAll(input,replace,0,0);
- }
-
- /**
- * Substitutes the replacement text for each non-overlapping match found
- * in the input text, starting at the specified index.
- *
- * If the regular expression allows the empty string to match, it will
- * substitute matches at all positions except the end of the input.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substituteAll(Object input,String replace,int index) {
- return substituteAll(input,replace,index,0);
- }
-
- /**
- * Substitutes the replacement text for each non-overlapping match found
- * in the input text, starting at the specified index and using the
- * specified execution flags.
- *
- * @param input The input text.
- * @param replace The replacement text, which may contain $x metacharacters (see REMatch.substituteInto).
- * @param index The offset index at which the search should be begin.
- * @param eflags The logical OR of any execution flags above.
- * @return A String containing the substring of the input, starting
- * at the index position, and interpolating the substituted text.
- * @see REMatch#substituteInto
- */
- public String substituteAll(Object input,String replace,int index,int eflags) {
- return substituteAllImpl(makeCharIndexed(input,index),replace,index,eflags);
- }
-
- private String substituteAllImpl(CharIndexed input,String replace,int index,int eflags) {
- StringBuffer buffer = new StringBuffer();
- REMatch m;
- while ((m = getMatchImpl(input,index,eflags,buffer)) != null) {
- buffer.append( ((eflags & REG_NO_INTERPOLATE) > 0) ?
- replace : m.substituteInto(replace) );
- index = m.getEndIndex();
- if (m.end[0] == 0) {
- char ch = input.charAt(0);
- if (ch != CharIndexed.OUT_OF_BOUNDS)
- buffer.append(ch);
- input.move(1);
- } else {
- input.move(m.end[0]);
- }
-
- if (!input.isValid()) break;
- }
- return buffer.toString();
- }
-
- /* Helper function for constructor */
- private void addToken(REToken next) {
- if (next == null) return;
- minimumLength += next.getMinimumLength();
- if (firstToken == null) {
- lastToken = firstToken = next;
- } else {
- // if chain returns false, it "rejected" the token due to
- // an optimization, and next was combined with lastToken
- if (lastToken.chain(next)) {
- lastToken = next;
- }
- }
- }
-
- private static REToken setRepeated(REToken current, int min, int max, int index) throws REException {
- if (current == null) throw new REException(getLocalizedMessage("repeat.no.token"),REException.REG_BADRPT,index);
- return new RETokenRepeated(current.subIndex,current,min,max);
- }
-
- private static int getPosixSet(char[] pattern,int index,StringBuffer buf) {
- // Precondition: pattern[index-1] == ':'
- // we will return pos of closing ']'.
- int i;
- for (i=index; i<(pattern.length-1); i++) {
- if ((pattern[i] == ':') && (pattern[i+1] == ']'))
- return i+2;
- buf.append(pattern[i]);
- }
- return index; // didn't match up
- }
-
- private int getMinMax(char[] input,int index,IntPair minMax,RESyntax syntax) throws REException {
- // Precondition: input[index-1] == '{', minMax != null
-
- boolean mustMatch = !syntax.get(RESyntax.RE_NO_BK_BRACES);
- int startIndex = index;
- if (index == input.length) {
- if (mustMatch)
- throw new REException(getLocalizedMessage("unmatched.brace"),REException.REG_EBRACE,index);
- else
- return startIndex;
- }
-
- int min,max=0;
- CharUnit unit = new CharUnit();
- StringBuffer buf = new StringBuffer();
-
- // Read string of digits
- do {
- index = getCharUnit(input,index,unit,false);
- if (Character.isDigit(unit.ch))
- buf.append(unit.ch);
- } while ((index != input.length) && Character.isDigit(unit.ch));
-
- // Check for {} tomfoolery
- if (buf.length() == 0) {
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);
- else
- return startIndex;
- }
-
- min = Integer.parseInt(buf.toString());
-
- if ((unit.ch == '}') && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ unit.bk))
- max = min;
- else if (index == input.length)
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.no.end"),REException.REG_EBRACE,index);
- else
- return startIndex;
- else if ((unit.ch == ',') && !unit.bk) {
- buf = new StringBuffer();
- // Read string of digits
- while (((index = getCharUnit(input,index,unit,false)) != input.length) && Character.isDigit(unit.ch))
- buf.append(unit.ch);
-
- if (!((unit.ch == '}') && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ unit.bk)))
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);
- else
- return startIndex;
-
- // This is the case of {x,}
- if (buf.length() == 0) max = Integer.MAX_VALUE;
- else max = Integer.parseInt(buf.toString());
- } else
- if (mustMatch)
- throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);
- else
- return startIndex;
-
- // We know min and max now, and they are valid.
-
- minMax.first = min;
- minMax.second = max;
-
- // return the index following the '}'
- return index;
- }
-
- /**
- * Return a human readable form of the compiled regular expression,
- * useful for debugging.
- */
- public String toString() {
- StringBuffer sb = new StringBuffer();
- dump(sb);
- return sb.toString();
- }
-
- void dump(StringBuffer os) {
- os.append('(');
- if (subIndex == 0)
- os.append("?:");
- if (firstToken != null)
- firstToken.dumpAll(os);
- os.append(')');
- }
-
- // Cast input appropriately or throw exception
- private static CharIndexed makeCharIndexed(Object input, int index) {
- // We could let a String fall through to final input, but since
- // it's the most likely input type, we check it first.
- if (input instanceof String)
- return new CharIndexedString((String) input,index);
- else if (input instanceof char[])
- return new CharIndexedCharArray((char[]) input,index);
- else if (input instanceof StringBuffer)
- return new CharIndexedStringBuffer((StringBuffer) input,index);
- else if (input instanceof InputStream)
- return new CharIndexedInputStream((InputStream) input,index);
- else if (input instanceof CharIndexed)
- return (CharIndexed) input; // do we lose index info?
- else
- return new CharIndexedString(input.toString(), index);
- }
-}
diff --git a/libjava/gnu/regexp/REException.java b/libjava/gnu/regexp/REException.java
deleted file mode 100644
index 73f86fa8add..00000000000
--- a/libjava/gnu/regexp/REException.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/* gnu/regexp/REException.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-
-import java.text.MessageFormat;
-
-/**
- * This is the regular expression exception class. An exception of this type
- * defines the three attributes:
- *
- * RE exp = new RE("^foo.");
- * REMatch m0 = exp.getMatch(s);
- * REMatch m1 = exp.getMatch(s.substring(8));
- * REMatch m2 = exp.getMatch(s.substring(8),0,RE.REG_NOTBOL);
- * REMatch m3 = exp.getMatch(s,8);
- * REMatch m4 = exp.getMatch(s,8,RE.REG_ANCHORINDEX);
- *
- * // m0.toString(): "food"
- * // m1.toString(): "fool"
- * // m2.toString(): null
- * // m3.toString(): null
- * // m4.toString(): "fool"
- *
- *
- *
- * @author Wes Biggs
- */
-
-public class REException extends Exception {
- private int type;
- private int pos;
-
- // Error conditions from GNU regcomp(3) manual
-
- /**
- * Error flag.
- * Invalid use of repetition operators such as using
- * `*' as the first character.
- */
- public static final int REG_BADRPT = 1;
-
- /**
- * Error flag.
- * Invalid use of back reference operator.
- */
- public static final int REG_BADBR = 2;
-
- /**
- * Error flag.
- * Un-matched brace interval operators.
- */
- public static final int REG_EBRACE = 3;
-
- /**
- * Error flag.
- * Un-matched bracket list operators.
- */
- public static final int REG_EBRACK = 4;
-
- /**
- * Error flag.
- * Invalid use of the range operator, eg. the ending
- * point of the range occurs prior to the starting
- * point.
- */
- public static final int REG_ERANGE = 5;
-
- /**
- * Error flag.
- * Unknown character class name. Not implemented.
- */
- public static final int REG_ECTYPE = 6;
-
- /**
- * Error flag.
- * Un-matched parenthesis group operators.
- */
- public static final int REG_EPAREN = 7;
-
- /**
- * Error flag.
- * Invalid back reference to a subexpression.
- */
- public static final int REG_ESUBREG = 8;
-
- /**
- * Error flag.
- * Non specific error. Not implemented.
- */
- public static final int REG_EEND = 9;
-
- /**
- * Error flag.
- * Invalid escape sequence. Not implemented.
- */
- public static final int REG_ESCAPE = 10;
-
- /**
- * Error flag.
- * Invalid use of pattern operators such as group or list.
- */
- public static final int REG_BADPAT = 11;
-
- /**
- * Error flag.
- * Compiled regular expression requires a pattern
- * buffer larger than 64Kb. Not implemented.
- */
- public static final int REG_ESIZE = 12;
-
- /**
- * Error flag.
- * The regex routines ran out of memory. Not implemented.
- */
- public static final int REG_ESPACE = 13;
-
- REException(String msg, int type, int position) {
- super(msg);
- this.type = type;
- this.pos = position;
- }
-
- /**
- * Returns the type of the exception, one of the constants listed above.
- */
-
- public int getType() {
- return type;
- }
-
- /**
- * Returns the position, relative to the string or character array being
- * compiled, where the error occurred. This position is generally the point
- * where the error was detected, not necessarily the starting index of
- * a bad subexpression.
- */
- public int getPosition() {
- return pos;
- }
-
- /**
- * Reports the descriptive message associated with this exception
- * as well as its index position in the string or character array
- * being compiled.
- */
- public String getMessage() {
- Object[] args = {new Integer(pos)};
- StringBuffer sb = new StringBuffer();
- String prefix = RE.getLocalizedMessage("error.prefix");
- sb.append(MessageFormat.format(prefix, args));
- sb.append('\n');
- sb.append(super.getMessage());
- return sb.toString();
- }
-}
diff --git a/libjava/gnu/regexp/REFilterInputStream.java b/libjava/gnu/regexp/REFilterInputStream.java
deleted file mode 100644
index 485de56605d..00000000000
--- a/libjava/gnu/regexp/REFilterInputStream.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* gnu/regexp/REFilterInputStream.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-import java.io.FilterInputStream;
-import java.io.InputStream;
-
-/**
- * Replaces instances of a given RE found within an InputStream
- * with replacement text. The replacements are interpolated into the
- * stream when a match is found.
- *
- * @author Wes Biggs
- * @deprecated This class cannot properly handle all character
- * encodings. For proper handling, use the REFilterReader
- * class instead.
- */
-
-public class REFilterInputStream extends FilterInputStream {
-
- private RE expr;
- private String replace;
- private String buffer;
- private int bufpos;
- private int offset;
- private CharIndexedInputStream stream;
-
- /**
- * Creates an REFilterInputStream. When reading from this stream,
- * occurrences of patterns matching the supplied regular expression
- * will be replaced with the supplied replacement text (the
- * metacharacters $0 through $9 may be used to refer to the full
- * match or subexpression matches).
- *
- * @param stream The InputStream to be filtered.
- * @param expr The regular expression to search for.
- * @param replace The text pattern to replace matches with.
- */
- public REFilterInputStream(InputStream stream, RE expr, String replace) {
- super(stream);
- this.stream = new CharIndexedInputStream(stream,0);
- this.expr = expr;
- this.replace = replace;
- }
-
- /**
- * Reads the next byte from the stream per the general contract of
- * InputStream.read(). Returns -1 on error or end of stream.
- */
- public int read() {
- // If we have buffered replace data, use it.
- if ((buffer != null) && (bufpos < buffer.length())) {
- return (int) buffer.charAt(bufpos++);
- }
-
- // check if input is at a valid position
- if (!stream.isValid()) return -1;
-
- REMatch mymatch = new REMatch(expr.getNumSubs(),offset,0);
- if (expr.match(stream, mymatch)) {
- mymatch.end[0] = mymatch.index;
- mymatch.finish(stream);
- stream.move(mymatch.toString().length());
- offset += mymatch.toString().length();
- buffer = mymatch.substituteInto(replace);
- bufpos = 1;
-
- // This is prone to infinite loops if replace string turns out empty.
- if (buffer.length() > 0) {
- return buffer.charAt(0);
- }
- }
- char ch = stream.charAt(0);
- if (ch == CharIndexed.OUT_OF_BOUNDS) return -1;
- stream.move(1);
- offset++;
- return ch;
- }
-
- /**
- * Returns false. REFilterInputStream does not support mark() and
- * reset() methods.
- */
- public boolean markSupported() {
- return false;
- }
-
- /** Reads from the stream into the provided array. */
- public int read(byte[] b, int off, int len) {
- int i;
- int ok = 0;
- while (len-- > 0) {
- i = read();
- if (i == -1) return (ok == 0) ? -1 : ok;
- b[off++] = (byte) i;
- ok++;
- }
- return ok;
- }
-
- /** Reads from the stream into the provided array. */
- public int read(byte[] b) {
- return read(b,0,b.length);
- }
-}
diff --git a/libjava/gnu/regexp/REMatch.java b/libjava/gnu/regexp/REMatch.java
deleted file mode 100644
index cf25bb331c5..00000000000
--- a/libjava/gnu/regexp/REMatch.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/* gnu/regexp/REMatch.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-import java.io.Serializable;
-
-/**
- * An instance of this class represents a match
- * completed by a gnu.regexp matching function. It can be used
- * to obtain relevant information about the location of a match
- * or submatch.
- *
- * @author Wes Biggs
- */
-public final class REMatch implements Serializable, Cloneable {
- private String matchedText;
-
- // These variables are package scope for fast access within the engine
- int eflags; // execution flags this match was made using
-
- // Offset in source text where match was tried. This is zero-based;
- // the actual position in the source text is given by (offset + anchor).
- int offset;
-
- // Anchor position refers to the index into the source input
- // at which the matching operation began.
- // This is also useful for the ANCHORINDEX option.
- int anchor;
-
- // Package scope; used by RE.
- int index; // used while matching to mark current match position in input
- int[] start; // start positions (relative to offset) for each (sub)exp.
- int[] end; // end positions for the same
- REMatch next; // other possibility (to avoid having to use arrays)
-
- public Object clone() {
- try {
- REMatch copy = (REMatch) super.clone();
- copy.next = null;
-
- copy.start = (int[]) start.clone();
- copy.end = (int[]) end.clone();
-
- return copy;
- } catch (CloneNotSupportedException e) {
- throw new Error(); // doesn't happen
- }
- }
-
- void assignFrom(REMatch other) {
- start = other.start;
- end = other.end;
- index = other.index;
- // need to deep clone?
- next = other.next;
- }
-
- REMatch(int subs, int anchor, int eflags) {
- start = new int[subs+1];
- end = new int[subs+1];
- this.anchor = anchor;
- this.eflags = eflags;
- clear(anchor);
- }
-
- void finish(CharIndexed text) {
- start[0] = 0;
- StringBuffer sb = new StringBuffer();
- int i;
- for (i = 0; i < end[0]; i++)
- sb.append(text.charAt(i));
- matchedText = sb.toString();
- for (i = 0; i < start.length; i++) {
- // If any subexpressions didn't terminate, they don't count
- // TODO check if this code ever gets hit
- if ((start[i] == -1) ^ (end[i] == -1)) {
- start[i] = -1;
- end[i] = -1;
- }
- }
- next = null; // cut off alternates
- }
-
- /** Clears the current match and moves the offset to the new index. */
- 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
- }
-
- /**
- * Returns the string matching the pattern. This makes it convenient
- * to write code like the following:
- *
- * REMatch myMatch = myExpression.getMatch(myString);
- */
- public String toString() {
- return matchedText;
- }
-
- /**
- * Returns the index within the input text where the match in its entirety
- * began.
- */
- public int getStartIndex() {
- return offset + start[0];
- }
-
- /**
- * Returns the index within the input string where the match in
- * its entirety ends. The return value is the next position after
- * the end of the string; therefore, a match created by the
- * following call:
- *
- *
- * if (myMatch != null) System.out.println("Regexp found: "+myMatch);
- * REMatch myMatch = myExpression.getMatch(myString);
- * String theMatch = myString.substring(myMatch.getStartIndex(),
- * myMatch.getEndIndex());
- * toString()
- * method (above) does exactly that for you.
- */
- public int getEndIndex() {
- return offset + end[0];
- }
-
- /**
- * Returns the string matching the given subexpression. The subexpressions
- * are indexed starting with one, not zero. That is, the subexpression
- * identified by the first set of parentheses in a regular expression
- * could be retrieved from an REMatch by calling match.toString(1).
- *
- * @param sub Index of the subexpression.
- */
- public String toString(int sub) {
- if ((sub >= start.length) || (start[sub] == -1)) return "";
- return (matchedText.substring(start[sub],end[sub]));
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number sub begins, or -1
if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- * @deprecated Use getStartIndex(int) instead.
- */
- public int getSubStartIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = start[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number sub begins, or -1
if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- * @since gnu.regexp 1.1.0
- */
- public int getStartIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = start[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number sub ends, or -1
if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- * @deprecated Use getEndIndex(int) instead
- */
- public int getSubEndIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = end[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Returns the index within the input string used to generate this match
- * where subexpression number sub ends, or -1
if
- * the subexpression does not exist. The initial position is zero.
- *
- * @param sub Subexpression index
- */
- public int getEndIndex(int sub) {
- if (sub >= start.length) return -1;
- int x = end[sub];
- return (x == -1) ? x : offset + x;
- }
-
- /**
- * Substitute the results of this match to create a new string.
- * This is patterned after PERL, so the tokens to watch out for are
- * $0
through $9
. $0
matches
- * the full substring matched; $n
matches
- * subexpression number n.
- *
- * @param input A string consisting of literals and $n
tokens.
- */
- public String substituteInto(String input) {
- // a la Perl, $0 is whole thing, $1 - $9 are subexpressions
- StringBuffer output = new StringBuffer();
- int pos;
- for (pos = 0; pos < input.length()-1; pos++) {
- if ((input.charAt(pos) == '$') && (Character.isDigit(input.charAt(pos+1)))) {
- int val = Character.digit(input.charAt(++pos),10);
- if (val < start.length) {
- output.append(toString(val));
- }
- } else output.append(input.charAt(pos));
- }
- if (pos < input.length()) output.append(input.charAt(pos));
- return output.toString();
- }
-}
diff --git a/libjava/gnu/regexp/REMatchEnumeration.java b/libjava/gnu/regexp/REMatchEnumeration.java
deleted file mode 100644
index f164a69af4f..00000000000
--- a/libjava/gnu/regexp/REMatchEnumeration.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/* gnu/regexp/REMatchEnumeration.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * An REMatchEnumeration enumerates regular expression matches over a
- * given input text. You obtain a reference to an enumeration using
- * the getMatchEnumeration()
methods on an instance of
- * RE.
- *
- * getAllMatches()
methods on RE. However, using an
- * enumeration can help speed performance when the entire text does
- * not need to be searched immediately.
- *
- * getMatch()
(see the
- * description of that method for an explanation of why). Enumeration
- * also saves a lot of overhead required when calling
- * getMatch()
multiple times.
- *
- * @author Wes Biggs
- */
-public class REMatchEnumeration implements Enumeration, Serializable {
- private static final int YES = 1;
- private static final int MAYBE = 0;
- private static final int NO = -1;
-
- private int more;
- private REMatch match;
- private RE expr;
- private CharIndexed input;
- private int eflags;
- private int index;
-
- // Package scope constructor is used by RE.getMatchEnumeration()
- REMatchEnumeration(RE expr, CharIndexed input, int index, int eflags) {
- more = MAYBE;
- this.expr = expr;
- this.input = input;
- this.index = index;
- this.eflags = eflags;
- }
-
- /** Returns true if there are more matches in the input text. */
- public boolean hasMoreElements() {
- return hasMoreMatches(null);
- }
-
- /** Returns true if there are more matches in the input text. */
- public boolean hasMoreMatches() {
- return hasMoreMatches(null);
- }
-
- /** Returns true if there are more matches in the input text.
- * Saves the text leading up to the match (or to the end of the input)
- * in the specified buffer.
- */
- public boolean hasMoreMatches(StringBuffer buffer) {
- if (more == MAYBE) {
- match = expr.getMatchImpl(input,index,eflags,buffer);
- if (match != null) {
- input.move((match.end[0] > 0) ? match.end[0] : 1);
-
- index = (match.end[0] > 0) ? match.end[0] + match.offset : index + 1;
- more = YES;
- } else more = NO;
- }
- return (more == YES);
- }
-
- /** Returns the next match in the input text. */
- public Object nextElement() throws NoSuchElementException {
- return nextMatch();
- }
-
- /**
- * Returns the next match in the input text. This method is provided
- * for convenience to avoid having to explicitly cast the return value
- * to class REMatch.
- */
- public REMatch nextMatch() throws NoSuchElementException {
- if (hasMoreElements()) {
- more = (input.isValid()) ? MAYBE : NO;
- return match;
- }
- throw new NoSuchElementException();
- }
-}
-
diff --git a/libjava/gnu/regexp/RESyntax.java b/libjava/gnu/regexp/RESyntax.java
deleted file mode 100644
index 7272b03481b..00000000000
--- a/libjava/gnu/regexp/RESyntax.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/* gnu/regexp/RESyntax.java
- Copyright (C) 1998-2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-import java.io.Serializable;
-import java.util.BitSet;
-
-/**
- * An RESyntax specifies the way a regular expression will be compiled.
- * This class provides a number of predefined useful constants for
- * emulating popular regular expression syntaxes. Additionally the
- * user may construct his or her own syntax, using any combination of the
- * syntax bit constants. The syntax is an optional argument to any of the
- * matching methods on class RE.
- *
- * @author Wes Biggs
- */
-
-public final class RESyntax implements Serializable {
- static final String DEFAULT_LINE_SEPARATOR = System.getProperty("line.separator");
-
- private static final String SYNTAX_IS_FINAL = RE.getLocalizedMessage("syntax.final");
-
- private BitSet bits;
-
- // true for the constant defined syntaxes
- private boolean isFinal = false;
-
- private String lineSeparator = DEFAULT_LINE_SEPARATOR;
-
- // Values for constants are bit indexes
-
- /**
- * Syntax bit. Backslash is an escape character in lists.
- */
- public static final int RE_BACKSLASH_ESCAPE_IN_LISTS = 0;
-
- /**
- * Syntax bit. Use \? instead of ? and \+ instead of +.
- */
- public static final int RE_BK_PLUS_QM = 1;
-
- /**
- * Syntax bit. POSIX character classes ([:...:]) in lists are allowed.
- */
- public static final int RE_CHAR_CLASSES = 2;
-
- /**
- * Syntax bit. ^ and $ are special everywhere.
- * Not implemented.
- */
- public static final int RE_CONTEXT_INDEP_ANCHORS = 3;
-
- /**
- * Syntax bit. Repetition operators are only special in valid positions.
- * Not implemented.
- */
- public static final int RE_CONTEXT_INDEP_OPS = 4;
-
- /**
- * Syntax bit. Repetition and alternation operators are invalid
- * at start and end of pattern and other places.
- * Not implemented.
- */
- public static final int RE_CONTEXT_INVALID_OPS = 5;
-
- /**
- * Syntax bit. Match-any-character operator (.) matches a newline.
- */
- public static final int RE_DOT_NEWLINE = 6;
-
- /**
- * Syntax bit. Match-any-character operator (.) does not match a null.
- */
- public static final int RE_DOT_NOT_NULL = 7;
-
- /**
- * Syntax bit. Intervals ({x}, {x,}, {x,y}) are allowed.
- */
- public static final int RE_INTERVALS = 8;
-
- /**
- * Syntax bit. No alternation (|), match one-or-more (+), or
- * match zero-or-one (?) operators.
- */
- public static final int RE_LIMITED_OPS = 9;
-
- /**
- * Syntax bit. Newline is an alternation operator.
- */
- public static final int RE_NEWLINE_ALT = 10; // impl.
-
- /**
- * Syntax bit. Intervals use { } instead of \{ \}
- */
- public static final int RE_NO_BK_BRACES = 11;
-
- /**
- * Syntax bit. Grouping uses ( ) instead of \( \).
- */
- public static final int RE_NO_BK_PARENS = 12;
-
- /**
- * Syntax bit. Backreferences not allowed.
- */
- public static final int RE_NO_BK_REFS = 13;
-
- /**
- * Syntax bit. Alternation uses | instead of \|
- */
- public static final int RE_NO_BK_VBAR = 14;
-
- /**
- * Syntax bit. Not implemented.
- */
- public static final int RE_NO_EMPTY_RANGES = 15;
-
- /**
- * Syntax bit. An unmatched right parenthesis (')' or '\)', depending
- * on RE_NO_BK_PARENS) will throw an exception when compiling.
- */
- public static final int RE_UNMATCHED_RIGHT_PAREN_ORD = 16;
-
- /**
- * Syntax bit. Not implemented.
- */
- public static final int RE_HAT_LISTS_NOT_NEWLINE = 17;
-
- /**
- * Syntax bit. Stingy matching is allowed (+?, *?, ??, {x,y}?).
- */
- public static final int RE_STINGY_OPS = 18;
-
- /**
- * Syntax bit. Allow character class escapes (\d, \D, \s, \S, \w, \W).
- */
- public static final int RE_CHAR_CLASS_ESCAPES = 19;
-
- /**
- * Syntax bit. Allow use of (?:xxx) grouping (subexpression is not saved).
- */
- public static final int RE_PURE_GROUPING = 20;
-
- /**
- * Syntax bit. Allow use of (?=xxx) and (?!xxx) apply the subexpression
- * to the text following the current position without consuming that text.
- */
- public static final int RE_LOOKAHEAD = 21;
-
- /**
- * Syntax bit. Allow beginning- and end-of-string anchors (\A, \Z).
- */
- public static final int RE_STRING_ANCHORS = 22;
-
- /**
- * Syntax bit. Allow embedded comments, (?#comment), as in Perl5.
- */
- public static final int RE_COMMENTS = 23;
-
- /**
- * Syntax bit. Allow character class escapes within lists, as in Perl5.
- */
- public static final int RE_CHAR_CLASS_ESC_IN_LISTS = 24;
-
- /**
- * Syntax bit. Possessive matching is allowed (++, *+, ?+, {x,y}+).
- */
- public static final int RE_POSSESSIVE_OPS = 25;
-
- private static final int BIT_TOTAL = 26;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the awk utility.
- */
- public static final RESyntax RE_SYNTAX_AWK;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the ed utility.
- */
- public static final RESyntax RE_SYNTAX_ED;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the egrep utility.
- */
- public static final RESyntax RE_SYNTAX_EGREP;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the GNU Emacs editor.
- */
- public static final RESyntax RE_SYNTAX_EMACS;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the grep utility.
- */
- public static final RESyntax RE_SYNTAX_GREP;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the POSIX awk specification.
- */
- public static final RESyntax RE_SYNTAX_POSIX_AWK;
-
- /**
- * Predefined syntax.
- * Emulates POSIX basic regular expression support.
- */
- public static final RESyntax RE_SYNTAX_POSIX_BASIC;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the POSIX egrep specification.
- */
- public static final RESyntax RE_SYNTAX_POSIX_EGREP;
-
- /**
- * Predefined syntax.
- * Emulates POSIX extended regular expression support.
- */
- public static final RESyntax RE_SYNTAX_POSIX_EXTENDED;
-
- /**
- * Predefined syntax.
- * Emulates POSIX basic minimal regular expressions.
- */
- public static final RESyntax RE_SYNTAX_POSIX_MINIMAL_BASIC;
-
- /**
- * Predefined syntax.
- * Emulates POSIX extended minimal regular expressions.
- */
- public static final RESyntax RE_SYNTAX_POSIX_MINIMAL_EXTENDED;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in the sed utility.
- */
- public static final RESyntax RE_SYNTAX_SED;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 4,
- */
- public static final RESyntax RE_SYNTAX_PERL4;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 4,
- * using single line mode (/s modifier).
- */
- public static final RESyntax RE_SYNTAX_PERL4_S; // single line mode (/s)
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 5.
- */
- public static final RESyntax RE_SYNTAX_PERL5;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Larry Wall's perl, version 5,
- * using single line mode (/s modifier).
- */
- public static final RESyntax RE_SYNTAX_PERL5_S;
-
- /**
- * Predefined syntax.
- * Emulates regular expression support in Java 1.4's java.util.regex
- * package.
- */
- public static final RESyntax RE_SYNTAX_JAVA_1_4;
-
- static {
- // Define syntaxes
-
- RE_SYNTAX_EMACS = new RESyntax().makeFinal();
-
- RESyntax RE_SYNTAX_POSIX_COMMON = new RESyntax()
- .set(RE_CHAR_CLASSES)
- .set(RE_DOT_NEWLINE)
- .set(RE_DOT_NOT_NULL)
- .set(RE_INTERVALS)
- .set(RE_NO_EMPTY_RANGES)
- .makeFinal();
-
- RE_SYNTAX_POSIX_BASIC = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_BK_PLUS_QM)
- .makeFinal();
-
- RE_SYNTAX_POSIX_EXTENDED = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INDEP_OPS)
- .set(RE_NO_BK_BRACES)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_VBAR)
- .set(RE_UNMATCHED_RIGHT_PAREN_ORD)
- .makeFinal();
-
- RE_SYNTAX_AWK = new RESyntax()
- .set(RE_BACKSLASH_ESCAPE_IN_LISTS)
- .set(RE_DOT_NOT_NULL)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_REFS)
- .set(RE_NO_BK_VBAR)
- .set(RE_NO_EMPTY_RANGES)
- .set(RE_UNMATCHED_RIGHT_PAREN_ORD)
- .makeFinal();
-
- RE_SYNTAX_POSIX_AWK = new RESyntax(RE_SYNTAX_POSIX_EXTENDED)
- .set(RE_BACKSLASH_ESCAPE_IN_LISTS)
- .makeFinal();
-
- RE_SYNTAX_GREP = new RESyntax()
- .set(RE_BK_PLUS_QM)
- .set(RE_CHAR_CLASSES)
- .set(RE_HAT_LISTS_NOT_NEWLINE)
- .set(RE_INTERVALS)
- .set(RE_NEWLINE_ALT)
- .makeFinal();
-
- RE_SYNTAX_EGREP = new RESyntax()
- .set(RE_CHAR_CLASSES)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INDEP_OPS)
- .set(RE_HAT_LISTS_NOT_NEWLINE)
- .set(RE_NEWLINE_ALT)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_VBAR)
- .makeFinal();
-
- RE_SYNTAX_POSIX_EGREP = new RESyntax(RE_SYNTAX_EGREP)
- .set(RE_INTERVALS)
- .set(RE_NO_BK_BRACES)
- .makeFinal();
-
- /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-
- RE_SYNTAX_ED = new RESyntax(RE_SYNTAX_POSIX_BASIC)
- .makeFinal();
-
- RE_SYNTAX_SED = new RESyntax(RE_SYNTAX_POSIX_BASIC)
- .makeFinal();
-
- RE_SYNTAX_POSIX_MINIMAL_BASIC = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_LIMITED_OPS)
- .makeFinal();
-
- /* Differs from RE_SYNTAX_POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-
- RE_SYNTAX_POSIX_MINIMAL_EXTENDED = new RESyntax(RE_SYNTAX_POSIX_COMMON)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INVALID_OPS)
- .set(RE_NO_BK_BRACES)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_REFS)
- .set(RE_NO_BK_VBAR)
- .set(RE_UNMATCHED_RIGHT_PAREN_ORD)
- .makeFinal();
-
- /* There is no official Perl spec, but here's a "best guess" */
-
- RE_SYNTAX_PERL4 = new RESyntax()
- .set(RE_BACKSLASH_ESCAPE_IN_LISTS)
- .set(RE_CONTEXT_INDEP_ANCHORS)
- .set(RE_CONTEXT_INDEP_OPS) // except for '{', apparently
- .set(RE_INTERVALS)
- .set(RE_NO_BK_BRACES)
- .set(RE_NO_BK_PARENS)
- .set(RE_NO_BK_VBAR)
- .set(RE_NO_EMPTY_RANGES)
- .set(RE_CHAR_CLASS_ESCAPES) // \d,\D,\w,\W,\s,\S
- .makeFinal();
-
- RE_SYNTAX_PERL4_S = new RESyntax(RE_SYNTAX_PERL4)
- .set(RE_DOT_NEWLINE)
- .makeFinal();
-
- RE_SYNTAX_PERL5 = new RESyntax(RE_SYNTAX_PERL4)
- .set(RE_PURE_GROUPING) // (?:)
- .set(RE_STINGY_OPS) // *?,??,+?,{}?
- .set(RE_LOOKAHEAD) // (?=)(?!)
- .set(RE_STRING_ANCHORS) // \A,\Z
- .set(RE_CHAR_CLASS_ESC_IN_LISTS)// \d,\D,\w,\W,\s,\S within []
- .set(RE_COMMENTS) // (?#)
- .makeFinal();
-
- RE_SYNTAX_PERL5_S = new RESyntax(RE_SYNTAX_PERL5)
- .set(RE_DOT_NEWLINE)
- .makeFinal();
-
- RE_SYNTAX_JAVA_1_4 = new RESyntax(RE_SYNTAX_PERL5)
- // XXX
- .set(RE_POSSESSIVE_OPS) // *+,?+,++,{}+
- .makeFinal();
- }
-
- /**
- * Construct a new syntax object with all bits turned off.
- * This is equivalent to RE_SYNTAX_EMACS.
- */
- public RESyntax() {
- bits = new BitSet(BIT_TOTAL);
- }
-
- /**
- * Called internally when constructing predefined syntaxes
- * so their interpretation cannot vary. Conceivably useful
- * for your syntaxes as well. Causes IllegalAccessError to
- * be thrown if any attempt to modify the syntax is made.
- *
- * @return this object for convenient chaining
- */
- public RESyntax makeFinal() {
- isFinal = true;
- return this;
- }
-
- /**
- * Construct a new syntax object with all bits set the same
- * as the other syntax.
- */
- public RESyntax(RESyntax other) {
- bits = (BitSet) other.bits.clone();
- }
-
- /**
- * Check if a given bit is set in this syntax.
- */
- public boolean get(int index) {
- return bits.get(index);
- }
-
- /**
- * Set a given bit in this syntax.
- *
- * @param index the constant (RESyntax.RE_xxx) bit to set.
- * @return a reference to this object for easy chaining.
- */
- public RESyntax set(int index) {
- if (isFinal) throw new IllegalAccessError(SYNTAX_IS_FINAL);
- bits.set(index);
- return this;
- }
-
- /**
- * Clear a given bit in this syntax.
- *
- * @param index the constant (RESyntax.RE_xxx) bit to clear.
- * @return a reference to this object for easy chaining.
- */
- public RESyntax clear(int index) {
- if (isFinal) throw new IllegalAccessError(SYNTAX_IS_FINAL);
- bits.clear(index);
- return this;
- }
-
- /**
- * Changes the line separator string for regular expressions
- * created using this RESyntax. The default separator is the
- * value returned by the system property "line.separator", which
- * should be correct when reading platform-specific files from a
- * filesystem. However, many programs may collect input from
- * sources where the line separator is differently specified (for
- * example, in the applet environment, the text box widget
- * interprets line breaks as single-character newlines,
- * regardless of the host platform.
- *
- * Note that setting the line separator to a character or
- * characters that have specific meaning within the current syntax
- * can cause unexpected chronosynclastic infundibula.
- *
- * @return this object for convenient chaining
- */
- public RESyntax setLineSeparator(String aSeparator) {
- if (isFinal) throw new IllegalAccessError(SYNTAX_IS_FINAL);
- lineSeparator = aSeparator;
- return this;
- }
-
- /**
- * Returns the currently active line separator string. The default
- * is the platform-dependent system property "line.separator".
- */
- public String getLineSeparator() {
- return lineSeparator;
- }
-}
diff --git a/libjava/gnu/regexp/REToken.java b/libjava/gnu/regexp/REToken.java
deleted file mode 100644
index 4eae9ec473c..00000000000
--- a/libjava/gnu/regexp/REToken.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/* gnu/regexp/REToken.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.regexp;
-import java.io.Serializable;
-
-abstract class REToken implements Serializable {
-
- protected REToken next = null;
- protected REToken uncle = null;
- protected int subIndex;
-
- protected REToken(int subIndex) {
- this.subIndex = subIndex;
- }
-
- int getMinimumLength() {
- return 0;
- }
-
- void setUncle(REToken anUncle) {
- uncle = anUncle;
- }
-
- /** Returns true if the match succeeded, false if it failed. */
- abstract boolean match(CharIndexed input, REMatch mymatch);
-
- /** Returns true if the rest of the tokens match, false if they fail. */
- protected boolean next(CharIndexed input, REMatch mymatch) {
- if (next == null) {
- if (uncle == null) {
- return true;
- } else {
- return uncle.match(input, mymatch);
- }
- } else {
- return next.match(input, mymatch);
- }
- }
-
- boolean chain(REToken token) {
- next = token;
- return true; // Token was accepted
- }
-
- abstract void dump(StringBuffer os);
-
- void dumpAll(StringBuffer os) {
- dump(os);
- if (next != null) next.dumpAll(os);
- }
-}
diff --git a/libjava/gnu/regexp/RETokenAny.java b/libjava/gnu/regexp/RETokenAny.java
deleted file mode 100644
index ac032dcb3bf..00000000000
--- a/libjava/gnu/regexp/RETokenAny.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* gnu/regexp/RETokenAny.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-final class RETokenAny extends REToken {
- /** True if '.' can match a newline (RE_DOT_NEWLINE) */
- private boolean newline;
-
- /** True if '.' can't match a null (RE_DOT_NOT_NULL) */
- private boolean matchNull;
-
- RETokenAny(int subIndex, boolean newline, boolean matchNull) {
- super(subIndex);
- this.newline = newline;
- this.matchNull = matchNull;
- }
-
- int getMinimumLength() {
- return 1;
- }
-
- boolean match(CharIndexed input, REMatch mymatch) {
- char ch = input.charAt(mymatch.index);
- if ((ch == CharIndexed.OUT_OF_BOUNDS)
- || (!newline && (ch == '\n'))
- || (matchNull && (ch == 0))) {
- return false;
- }
- ++mymatch.index;
- return next(input, mymatch);
- }
-
- void dump(StringBuffer os) {
- os.append('.');
- }
-}
-
diff --git a/libjava/gnu/regexp/RETokenBackRef.java b/libjava/gnu/regexp/RETokenBackRef.java
deleted file mode 100644
index 674822abd70..00000000000
--- a/libjava/gnu/regexp/RETokenBackRef.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* gnu/regexp/RETokenBackRef.java
- Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.regexp;
-
-final class RETokenBackRef extends REToken {
- private int num;
- private boolean insens;
-
- RETokenBackRef(int subIndex, int num, boolean insens) {
- super(subIndex);
- this.num = num;
- this.insens = insens;
- }
-
- // should implement getMinimumLength() -- any ideas?
-
- boolean match(CharIndexed input, REMatch mymatch) {
- int b,e;
- b = mymatch.start[num];
- e = mymatch.end[num];
- if ((b==-1)||(e==-1)) return false; // this shouldn't happen, but...
- for (int i=b; i
- *
- *
- *
- *
- *
- * Name
- * Notes
- *
- *
- * (URL)/external-general-entities
- * Value defaults to true
- * (URL)/external-parameter-entities
- * Value defaults to true
- * (URL)/is-standalone
- * (PRELIMINARY) Returns true iff the document's parsing
- * has started (some non-error event after startDocument()
- * was reported) and the document's standalone flag is set.
- * (URL)/namespace-prefixes
- * Value defaults to false (but XML 1.0 names are
- * always reported)
- * (URL)/lexical-handler/parameter-entities
- * Value is fixed at true
- * (URL)/namespaces
- * Value defaults to true
- * (URL)/resolve-dtd-uris
- * (PRELIMINARY) Value defaults to true
- * (URL)/string-interning
- * Value is fixed at true
- * (URL)/use-attributes2
- * (PRELIMINARY) Value is fixed at true
- * (URL)/use-entity-resolver2
- * (PRELIMINARY) Value defaults to true
- *
- * (URL)/validation
- * Value is fixed at false
- *
- *
- * (URL)/declaration-handler
- * A declaration handler may be provided.
- * (URL)/lexical-handler
- * A lexical handler may be provided. SAXDriver
class as your entry point, as all
- * internal parser interfaces are subject to change.
- *
- * @author Written by David Megginson <dmeggins@microstar.com>
- * (version 1.2a with bugfixes)
- * @author Updated by David Brownell <dbrownell@users.sourceforge.net>
- * @see SAXDriver
- */
-final class XmlParser
-{
-
- // avoid slow per-character readCh()
- private final static boolean USE_CHEATS = true;
-
- ////////////////////////////////////////////////////////////////////////
- // Constants.
- ////////////////////////////////////////////////////////////////////////
-
- //
- // Constants for element content type.
- //
-
- /**
- * Constant: an element has not been declared.
- * @see #getElementContentType
- */
- public final static int CONTENT_UNDECLARED = 0;
-
- /**
- * Constant: the element has a content model of ANY.
- * @see #getElementContentType
- */
- public final static int CONTENT_ANY = 1;
-
- /**
- * Constant: the element has declared content of EMPTY.
- * @see #getElementContentType
- */
- public final static int CONTENT_EMPTY = 2;
-
- /**
- * Constant: the element has mixed content.
- * @see #getElementContentType
- */
- public final static int CONTENT_MIXED = 3;
-
- /**
- * Constant: the element has element content.
- * @see #getElementContentType
- */
- public final static int CONTENT_ELEMENTS = 4;
-
-
- //
- // Constants for the entity type.
- //
-
- /**
- * Constant: the entity has not been declared.
- * @see #getEntityType
- */
- public final static int ENTITY_UNDECLARED = 0;
-
- /**
- * Constant: the entity is internal.
- * @see #getEntityType
- */
- public final static int ENTITY_INTERNAL = 1;
-
- /**
- * Constant: the entity is external, non-parsable data.
- * @see #getEntityType
- */
- public final static int ENTITY_NDATA = 2;
-
- /**
- * Constant: the entity is external XML data.
- * @see #getEntityType
- */
- public final static int ENTITY_TEXT = 3;
-
- //
- // Attribute type constants are interned literal strings.
- //
-
- //
- // Constants for supported encodings. "external" is just a flag.
- //
- private final static int ENCODING_EXTERNAL = 0;
- private final static int ENCODING_UTF_8 = 1;
- private final static int ENCODING_ISO_8859_1 = 2;
- private final static int ENCODING_UCS_2_12 = 3;
- private final static int ENCODING_UCS_2_21 = 4;
- private final static int ENCODING_UCS_4_1234 = 5;
- private final static int ENCODING_UCS_4_4321 = 6;
- private final static int ENCODING_UCS_4_2143 = 7;
- private final static int ENCODING_UCS_4_3412 = 8;
- private final static int ENCODING_ASCII = 9;
-
- //
- // Constants for attribute default value.
- //
-
- /**
- * Constant: the attribute is not declared.
- * @see #getAttributeDefaultValueType
- */
- public final static int ATTRIBUTE_DEFAULT_UNDECLARED = 30;
-
- /**
- * Constant: the attribute has a literal default value specified.
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- */
- public final static int ATTRIBUTE_DEFAULT_SPECIFIED = 31;
-
- /**
- * Constant: the attribute was declared #IMPLIED.
- * @see #getAttributeDefaultValueType
- */
- public final static int ATTRIBUTE_DEFAULT_IMPLIED = 32;
-
- /**
- * Constant: the attribute was declared #REQUIRED.
- * @see #getAttributeDefaultValueType
- */
- public final static int ATTRIBUTE_DEFAULT_REQUIRED = 33;
-
- /**
- * Constant: the attribute was declared #FIXED.
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- */
- public final static int ATTRIBUTE_DEFAULT_FIXED = 34;
-
- //
- // Constants for input.
- //
- private final static int INPUT_NONE = 0;
- private final static int INPUT_INTERNAL = 1;
- private final static int INPUT_STREAM = 3;
- private final static int INPUT_READER = 5;
-
- //
- // Flags for reading literals.
- //
- // expand general entity refs (attribute values in dtd and content)
- private final static int LIT_ENTITY_REF = 2;
- // normalize this value (space chars) (attributes, public ids)
- private final static int LIT_NORMALIZE = 4;
- // literal is an attribute value
- private final static int LIT_ATTRIBUTE = 8;
- // don't expand parameter entities
- private final static int LIT_DISABLE_PE = 16;
- // don't expand [or parse] character refs
- private final static int LIT_DISABLE_CREF = 32;
- // don't parse general entity refs
- private final static int LIT_DISABLE_EREF = 64;
- // literal is a public ID value
- private final static int LIT_PUBID = 256;
-
- //
- // Flags affecting PE handling in DTDs (if expandPE is true).
- // PEs expand with space padding, except inside literals.
- //
- private final static int CONTEXT_NORMAL = 0;
- private final static int CONTEXT_LITERAL = 1;
-
- // Emit warnings for relative URIs with no base URI.
- static boolean uriWarnings;
- static
- {
- String key = "gnu.xml.aelfred2.XmlParser.uriWarnings";
- GetPropertyAction a = new GetPropertyAction(key);
- uriWarnings = "true".equals(AccessController.doPrivileged(a));
- }
-
- //
- // The current XML handler interface.
- //
- private SAXDriver handler;
-
- //
- // I/O information.
- //
- private Reader reader; // current reader
- private InputStream is; // current input stream
- private int line; // current line number
- private int column; // current column number
- private int sourceType; // type of input source
- private LinkedList inputStack; // stack of input soruces
- private URLConnection externalEntity; // current external entity
- private int encoding; // current character encoding
- private int currentByteCount; // bytes read from current source
- private InputSource scratch; // temporary
-
- //
- // Buffers for decoded but unparsed character input.
- //
- private char[] readBuffer;
- private int readBufferPos;
- private int readBufferLength;
- private int readBufferOverflow; // overflow from last data chunk.
-
- //
- // Buffer for undecoded raw byte input.
- //
- private final static int READ_BUFFER_MAX = 16384;
- private byte[] rawReadBuffer;
-
-
- //
- // Buffer for attribute values, char refs, DTD stuff.
- //
- private static int DATA_BUFFER_INITIAL = 4096;
- private char[] dataBuffer;
- private int dataBufferPos;
-
- //
- // Buffer for parsed names.
- //
- private static int NAME_BUFFER_INITIAL = 1024;
- private char[] nameBuffer;
- private int nameBufferPos;
-
- //
- // Save any standalone flag
- //
- private boolean docIsStandalone;
-
- //
- // Hashtables for DTD information on elements, entities, and notations.
- // Populated until we start ignoring decls (because of skipping a PE)
- //
- private HashMap elementInfo;
- private HashMap entityInfo;
- private HashMap notationInfo;
- private boolean skippedPE;
-
- //
- // Element type currently in force.
- //
- private String currentElement;
- private int currentElementContent;
-
- //
- // Stack of entity names, to detect recursion.
- //
- private LinkedList entityStack;
-
- //
- // PE expansion is enabled in most chunks of the DTD, not all.
- // When it's enabled, literals are treated differently.
- //
- private boolean inLiteral;
- private boolean expandPE;
- private boolean peIsError;
-
- //
- // can't report entity expansion inside two constructs:
- // - attribute expansions (internal entities only)
- // - markup declarations (parameter entities only)
- //
- private boolean doReport;
-
- //
- // Symbol table, for caching interned names.
- //
- // These show up wherever XML names or nmtokens are used: naming elements,
- // attributes, PIs, notations, entities, and enumerated attribute values.
- //
- // NOTE: This hashtable doesn't grow. The default size is intended to be
- // rather large for most documents. Example: one snapshot of the DocBook
- // XML 4.1 DTD used only about 350 such names. As a rule, only pathological
- // documents (ones that don't reuse names) should ever see much collision.
- //
- // Be sure that SYMBOL_TABLE_LENGTH always stays prime, for best hashing.
- // "2039" keeps the hash table size at about two memory pages on typical
- // 32 bit hardware.
- //
- private final static int SYMBOL_TABLE_LENGTH = 2039;
-
- private Object[][] symbolTable;
-
- //
- // Hash table of attributes found in current start tag.
- //
- private String[] tagAttributes;
- private int tagAttributePos;
-
- //
- // Utility flag: have we noticed a CR while reading the last
- // data chunk? If so, we will have to go back and normalise
- // CR or CR/LF line ends.
- //
- private boolean sawCR;
-
- //
- // Utility flag: are we in CDATA? If so, whitespace isn't ignorable.
- //
- private boolean inCDATA;
-
- //
- // Xml version.
- //
- private static final int XML_10 = 0;
- private static final int XML_11 = 1;
- private int xmlVersion = XML_10;
-
- //////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////////
-
- /**
- * Construct a new parser with no associated handler.
- * @see #setHandler
- * @see #parse
- */
- // package private
- XmlParser()
- {
- }
-
- /**
- * Set the handler that will receive parsing events.
- * @param handler The handler to receive callback events.
- * @see #parse
- */
- // package private
- void setHandler(SAXDriver handler)
- {
- this.handler = handler;
- }
-
- /**
- * Parse an XML document from the character stream, byte stream, or URI
- * that you provide (in that order of preference). Any URI that you
- * supply will become the base URI for resolving relative URI, and may
- * be used to acquire a reader or byte stream.
- *
- *
- * [1] document ::= prolog element Misc*
- *
- *
- * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* "-->"
- *
- * <!--
has already been read.)
- */
- private void parseComment()
- throws Exception
- {
- char c;
- boolean saved = expandPE;
-
- expandPE = false;
- parseUntil(endDelimComment);
- require('>');
- expandPE = saved;
- handler.comment(dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
-
- static final char[] startDelimPI = { '<', '?' };
- static final char[] endDelimPI = { '?', '>' };
-
- /**
- * Parse a processing instruction and do a call-back.
- *
- * [16] PI ::= '<?' PITarget
- * (S (Char* - (Char* '?>' Char*)))?
- * '?>'
- * [17] PITarget ::= Name - ( ('X'|'x') ('M'|m') ('L'|l') )
- *
- * <?
has already been read.)
- */
- private void parsePI()
- throws SAXException, IOException
- {
- String name;
- boolean saved = expandPE;
-
- expandPE = false;
- name = readNmtoken(true);
- //NE08
- if (name.indexOf(':') >= 0)
- {
- error("Illegal character(':') in processing instruction name ",
- name, null);
- }
- if ("xml".equalsIgnoreCase(name))
- {
- error("Illegal processing instruction target", name, null);
- }
- if (!tryRead(endDelimPI))
- {
- requireWhitespace();
- parseUntil(endDelimPI);
- }
- expandPE = saved;
- handler.processingInstruction(name, dataBufferToString());
- }
-
- static final char[] endDelimCDATA = { ']', ']', '>' };
-
- private boolean isDirtyCurrentElement;
-
- /**
- * Parse a CDATA section.
- *
- * [18] CDSect ::= CDStart CData CDEnd
- * [19] CDStart ::= '<![CDATA['
- * [20] CData ::= (Char* - (Char* ']]>' Char*))
- * [21] CDEnd ::= ']]>'
- *
- *
- * [22] prolog ::= XMLDecl? Misc* (Doctypedecl Misc*)?
- *
- * <?xml
and whitespace have already been read.)
- * @return the encoding in the declaration, uppercased; or null
- * @see #parseTextDecl
- * @see #setupDecoding
- */
- private String parseXMLDecl(boolean ignoreEncoding)
- throws SAXException, IOException
- {
- String version;
- String encodingName = null;
- String standalone = null;
- int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
- String inputEncoding = null;
-
- switch (this.encoding)
- {
- case ENCODING_EXTERNAL:
- case ENCODING_UTF_8:
- inputEncoding = "UTF-8";
- break;
- case ENCODING_ISO_8859_1:
- inputEncoding = "ISO-8859-1";
- break;
- case ENCODING_UCS_2_12:
- inputEncoding = "UTF-16BE";
- break;
- case ENCODING_UCS_2_21:
- inputEncoding = "UTF-16LE";
- break;
- }
-
- // Read the version.
- require("version");
- parseEq();
- checkLegalVersion(version = readLiteral(flags));
- if (!version.equals("1.0"))
- {
- if (version.equals("1.1"))
- {
- handler.warn("expected XML version 1.0, not: " + version);
- xmlVersion = XML_11;
- }
- else
- {
- error("illegal XML version", version, "1.0 or 1.1");
- }
- }
- else
- {
- xmlVersion = XML_10;
- }
- // Try reading an encoding declaration.
- boolean white = tryWhitespace();
-
- if (tryRead("encoding"))
- {
- if (!white)
- {
- error("whitespace required before 'encoding='");
- }
- parseEq();
- encodingName = readLiteral(flags);
- if (!ignoreEncoding)
- {
- setupDecoding(encodingName);
- }
- }
-
- // Try reading a standalone declaration
- if (encodingName != null)
- {
- white = tryWhitespace();
- }
- if (tryRead("standalone"))
- {
- if (!white)
- {
- error("whitespace required before 'standalone='");
- }
- parseEq();
- standalone = readLiteral(flags);
- if ("yes".equals(standalone))
- {
- docIsStandalone = true;
- }
- else if (!"no".equals(standalone))
- {
- error("standalone flag must be 'yes' or 'no'");
- }
- }
-
- skipWhitespace();
- require("?>");
-
- if (inputEncoding == null)
- {
- inputEncoding = encodingName;
- }
- handler.xmlDecl(version, encodingName, docIsStandalone,
- inputEncoding);
-
- return encodingName;
- }
-
- /**
- * Parse a text declaration.
- *
- * [79] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
- * [80] EncodingDecl ::= S 'encoding' Eq
- * ( '"' EncName '"' | "'" EncName "'" )
- * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
- *
- * <?xml
' and whitespace have already been read.)
- * @return the encoding in the declaration, uppercased; or null
- * @see #parseXMLDecl
- * @see #setupDecoding
- */
- private String parseTextDecl(boolean ignoreEncoding)
- throws SAXException, IOException
- {
- String encodingName = null;
- int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
-
- // Read an optional version.
- if (tryRead ("version"))
- {
- String version;
- parseEq();
- checkLegalVersion(version = readLiteral(flags));
-
- if (version.equals("1.1"))
- {
- if (xmlVersion == XML_10)
- {
- error("external subset has later version number.", "1.0",
- version);
- }
- handler.warn("expected XML version 1.0, not: " + version);
- xmlVersion = XML_11;
- }
- else if (!version.equals("1.0"))
- {
- error("illegal XML version", version, "1.0 or 1.1");
- }
- requireWhitespace();
- }
-
- // Read the encoding.
- require("encoding");
- parseEq();
- encodingName = readLiteral(flags);
- if (!ignoreEncoding)
- {
- setupDecoding(encodingName);
- }
- skipWhitespace();
- require("?>");
-
- return encodingName;
- }
-
- /**
- * Sets up internal state so that we can decode an entity using the
- * specified encoding. This is used when we start to read an entity
- * and we have been given knowledge of its encoding before we start to
- * read any data (e.g. from a SAX input source or from a MIME type).
- *
- *
- * [27] Misc ::= Comment | PI | S
- *
- */
- private void parseMisc()
- throws Exception
- {
- while (true)
- {
- skipWhitespace();
- if (tryRead(startDelimPI))
- {
- parsePI();
- }
- else if (tryRead(startDelimComment))
- {
- parseComment();
- }
- else
- {
- return;
- }
- }
- }
-
- /**
- * Parse a document type declaration.
- *
- * [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
- * ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
- *
- * <!DOCTYPE
has already been read.)
- */
- private void parseDoctypedecl()
- throws Exception
- {
- String rootName;
- ExternalIdentifiers ids;
-
- // Read the document type name.
- requireWhitespace();
- rootName = readNmtoken(true);
-
- // Read the External subset's IDs
- skipWhitespace();
- ids = readExternalIds(false, true);
-
- // report (a) declaration of name, (b) lexical info (ids)
- handler.doctypeDecl(rootName, ids.publicId, ids.systemId);
-
- // Internal subset is parsed first, if present
- skipWhitespace();
- if (tryRead('['))
- {
-
- // loop until the subset ends
- while (true)
- {
- doReport = expandPE = true;
- skipWhitespace();
- doReport = expandPE = false;
- if (tryRead(']'))
- {
- break; // end of subset
- }
- else
- {
- // WFC, PEs in internal subset (only between decls)
- peIsError = expandPE = true;
- parseMarkupdecl();
- peIsError = expandPE = false;
- }
- }
- }
- skipWhitespace();
- require('>');
-
- // Read the external subset, if any
- InputSource subset;
-
- if (ids.systemId == null)
- {
- subset = handler.getExternalSubset(rootName,
- handler.getSystemId());
- }
- else
- {
- subset = null;
- }
- if (ids.systemId != null || subset != null)
- {
- pushString(null, ">");
-
- // NOTE: [dtd] is so we say what SAX2 expects,
- // though it's misleading (subset, not entire dtd)
- if (ids.systemId != null)
- {
- pushURL(true, "[dtd]", ids, null, null, null, true);
- }
- else
- {
- handler.warn("modifying document by adding external subset");
- pushURL(true, "[dtd]",
- new ExternalIdentifiers(subset.getPublicId(),
- subset.getSystemId(),
- null),
- subset.getCharacterStream(),
- subset.getByteStream(),
- subset.getEncoding(),
- false);
- }
-
- // Loop until we end up back at '>'
- while (true)
- {
- doReport = expandPE = true;
- skipWhitespace();
- doReport = expandPE = false;
- if (tryRead('>'))
- {
- break;
- }
- else
- {
- expandPE = true;
- parseMarkupdecl();
- expandPE = false;
- }
- }
-
- // the ">" string isn't popped yet
- if (inputStack.size() != 1)
- {
- error("external subset has unmatched '>'");
- }
- }
-
- // done dtd
- handler.endDoctype();
- expandPE = false;
- doReport = true;
- }
-
- /**
- * Parse a markup declaration in the internal or external DTD subset.
- *
- * [29] markupdecl ::= elementdecl | Attlistdecl | EntityDecl
- * | NotationDecl | PI | Comment
- * [30] extSubsetDecl ::= (markupdecl | conditionalSect
- * | PEReference | S) *
- *
- *
- * [39] element ::= EmptyElementTag | STag content ETag
- * [40] STag ::= '<' Name (S Attribute)* S? '>'
- * [44] EmptyElementTag ::= '<' Name (S Attribute)* S? '/>'
- *
- *
- * [41] Attribute ::= Name Eq AttValue
- *
- * @param name The name of the attribute's element.
- * @see SAXDriver#attribute
- */
- private void parseAttribute(String name)
- throws Exception
- {
- String aname;
- String type;
- String value;
- int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF;
-
- // Read the attribute name.
- aname = readNmtoken(true);
- type = getAttributeType(name, aname);
-
- // Parse '='
- parseEq();
-
- // Read the value, normalizing whitespace
- // unless it is CDATA.
- if (handler.stringInterning)
- {
- if (type == "CDATA" || type == null)
- {
- value = readLiteral(flags);
- }
- else
- {
- value = readLiteral(flags | LIT_NORMALIZE);
- }
- }
- else
- {
- if (type.equals("CDATA") || type == null)
- {
- value = readLiteral(flags);
- }
- else
- {
- value = readLiteral(flags | LIT_NORMALIZE);
- }
- }
-
- // WFC: no duplicate attributes
- for (int i = 0; i < tagAttributePos; i++)
- {
- if (aname.equals(tagAttributes [i]))
- {
- error("duplicate attribute", aname, null);
- }
- }
-
- // Inform the handler about the
- // attribute.
- handler.attribute(aname, value, true);
- dataBufferPos = 0;
-
- // Note that the attribute has been
- // specified.
- if (tagAttributePos == tagAttributes.length)
- {
- String newAttrib[] = new String[tagAttributes.length * 2];
- System.arraycopy(tagAttributes, 0, newAttrib, 0, tagAttributePos);
- tagAttributes = newAttrib;
- }
- tagAttributes[tagAttributePos++] = aname;
- }
-
- /**
- * Parse an equals sign surrounded by optional whitespace.
- *
- * [25] Eq ::= S? '=' S?
- *
- */
- private void parseEq()
- throws SAXException, IOException
- {
- skipWhitespace();
- require('=');
- skipWhitespace();
- }
-
- /**
- * Parse an end tag.
- *
- * [42] ETag ::= '' Name S? '>'
- *
- *
- * [43] content ::= (element | CharData | Reference
- * | CDSect | PI | Comment)*
- * [67] Reference ::= EntityRef | CharRef
- *
- *
- * [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | elements
- *
- */
- private void parseContentspec(String name)
- throws Exception
- {
- // FIXME: move elementDecl() into setElement(), pass EMTPY/ANY ...
- if (tryRead("EMPTY"))
- {
- setElement(name, CONTENT_EMPTY, null, null);
- if (!skippedPE)
- {
- handler.getDeclHandler().elementDecl(name, "EMPTY");
- }
- return;
- }
- else if (tryRead("ANY"))
- {
- setElement(name, CONTENT_ANY, null, null);
- if (!skippedPE)
- {
- handler.getDeclHandler().elementDecl(name, "ANY");
- }
- return;
- }
- else
- {
- String model;
- char[] saved;
-
- require('(');
- saved = readBuffer;
- dataBufferAppend('(');
- skipWhitespace();
- if (tryRead("#PCDATA"))
- {
- dataBufferAppend("#PCDATA");
- parseMixed(saved);
- model = dataBufferToString();
- setElement(name, CONTENT_MIXED, model, null);
- }
- else
- {
- parseElements(saved);
- model = dataBufferToString();
- setElement(name, CONTENT_ELEMENTS, model, null);
- }
- if (!skippedPE)
- {
- handler.getDeclHandler().elementDecl(name, model);
- }
- }
- }
-
- /**
- * Parse an element-content model.
- *
- * [47] elements ::= (choice | seq) ('?' | '*' | '+')?
- * [49] choice ::= '(' S? cp (S? '|' S? cp)+ S? ')'
- * [50] seq ::= '(' S? cp (S? ',' S? cp)* S? ')'
- *
- *
- *
- * [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
- *
- */
- private void parseCp()
- throws Exception
- {
- if (tryRead('('))
- {
- dataBufferAppend('(');
- parseElements(readBuffer);
- }
- else
- {
- dataBufferAppend(readNmtoken(true));
- char c = readCh();
- switch (c)
- {
- case '?':
- case '*':
- case '+':
- dataBufferAppend(c);
- break;
- default:
- unread(c);
- break;
- }
- }
- }
-
- /**
- * Parse mixed content.
- *
- * [51] Mixed ::= '(' S? ( '#PCDATA' (S? '|' S? Name)*) S? ')*'
- * | '(' S? ('#PCDATA') S? ')'
- *
- *
- * @param saved Buffer for entity that should have the terminal ')'
- */
- private void parseMixed(char[] saved)
- throws Exception
- {
- // Check for PCDATA alone.
- skipWhitespace();
- if (tryRead(')'))
- {
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- {
- handler.verror("Illegal Group/PE nesting");
- }
-
- dataBufferAppend(")*");
- tryRead('*');
- return;
- }
-
- // Parse mixed content.
- skipWhitespace();
- while (!tryRead(")"))
- {
- require('|');
- dataBufferAppend('|');
- skipWhitespace();
- dataBufferAppend(readNmtoken(true));
- skipWhitespace();
- }
-
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- {
- handler.verror("Illegal Group/PE nesting");
- }
-
- require('*');
- dataBufferAppend(")*");
- }
-
- /**
- * Parse an attribute list declaration.
- *
- * [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'
- *
- *
- * [53] AttDef ::= S Name S AttType S DefaultDecl
- *
- */
- private void parseAttDef(String elementName)
- throws Exception
- {
- String name;
- String type;
- String enumer = null;
-
- // Read the attribute name.
- name = readNmtoken(true);
-
- // Read the attribute type.
- requireWhitespace();
- type = readAttType();
-
- // Get the string of enumerated values if necessary.
- if (handler.stringInterning)
- {
- if ("ENUMERATION" == type || "NOTATION" == type)
- {
- enumer = dataBufferToString();
- }
- }
- else
- {
- if ("ENUMERATION".equals(type) || "NOTATION".equals(type))
- {
- enumer = dataBufferToString();
- }
- }
-
- // Read the default value.
- requireWhitespace();
- parseDefault(elementName, name, type, enumer);
- }
-
- /**
- * Parse the attribute type.
- *
- * [54] AttType ::= StringType | TokenizedType | EnumeratedType
- * [55] StringType ::= 'CDATA'
- * [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY'
- * | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'
- * [57] EnumeratedType ::= NotationType | Enumeration
- *
- */
- private String readAttType()
- throws Exception
- {
- if (tryRead('('))
- {
- parseEnumeration(false);
- return "ENUMERATION";
- }
- else
- {
- String typeString = readNmtoken(true);
- if (handler.stringInterning)
- {
- if ("NOTATION" == typeString)
- {
- parseNotationType();
- return typeString;
- }
- else if ("CDATA" == typeString
- || "ID" == typeString
- || "IDREF" == typeString
- || "IDREFS" == typeString
- || "ENTITY" == typeString
- || "ENTITIES" == typeString
- || "NMTOKEN" == typeString
- || "NMTOKENS" == typeString)
- {
- return typeString;
- }
- }
- else
- {
- if ("NOTATION".equals(typeString))
- {
- parseNotationType();
- return typeString;
- }
- else if ("CDATA".equals(typeString)
- || "ID".equals(typeString)
- || "IDREF".equals(typeString)
- || "IDREFS".equals(typeString)
- || "ENTITY".equals(typeString)
- || "ENTITIES".equals(typeString)
- || "NMTOKEN".equals(typeString)
- || "NMTOKENS".equals(typeString))
- {
- return typeString;
- }
- }
- error("illegal attribute type", typeString, null);
- return null;
- }
- }
-
- /**
- * Parse an enumeration.
- *
- * [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
- *
- *
- * [58] NotationType ::= 'NOTATION' S '(' S? NameNtoks
- * (S? '|' S? name)* S? ')'
- *
- *
- * [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED'
- * | (('#FIXED' S)? AttValue)
- *
- */
- private void parseDefault(String elementName, String name,
- String type, String enumer)
- throws Exception
- {
- int valueType = ATTRIBUTE_DEFAULT_SPECIFIED;
- String value = null;
- int flags = LIT_ATTRIBUTE;
- boolean saved = expandPE;
- String defaultType = null;
-
- // LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace
- // chars to spaces (doesn't matter when that's done if it doesn't
- // interfere with char refs expanding to whitespace).
-
- if (!skippedPE)
- {
- flags |= LIT_ENTITY_REF;
- if (handler.stringInterning)
- {
- if ("CDATA" != type)
- {
- flags |= LIT_NORMALIZE;
- }
- }
- else
- {
- if (!"CDATA".equals(type))
- {
- flags |= LIT_NORMALIZE;
- }
- }
- }
-
- expandPE = false;
- if (tryRead('#'))
- {
- if (tryRead("FIXED"))
- {
- defaultType = "#FIXED";
- valueType = ATTRIBUTE_DEFAULT_FIXED;
- requireWhitespace();
- value = readLiteral(flags);
- }
- else if (tryRead("REQUIRED"))
- {
- defaultType = "#REQUIRED";
- valueType = ATTRIBUTE_DEFAULT_REQUIRED;
- }
- else if (tryRead("IMPLIED"))
- {
- defaultType = "#IMPLIED";
- valueType = ATTRIBUTE_DEFAULT_IMPLIED;
- }
- else
- {
- error("illegal keyword for attribute default value");
- }
- }
- else
- {
- value = readLiteral(flags);
- }
- expandPE = saved;
- setAttribute(elementName, name, type, enumer, value, valueType);
- if (handler.stringInterning)
- {
- if ("ENUMERATION" == type)
- {
- type = enumer;
- }
- else if ("NOTATION" == type)
- {
- type = "NOTATION " + enumer;
- }
- }
- else
- {
- if ("ENUMERATION".equals(type))
- {
- type = enumer;
- }
- else if ("NOTATION".equals(type))
- {
- type = "NOTATION " + enumer;
- }
- }
- if (!skippedPE)
- {
- handler.getDeclHandler().attributeDecl(elementName, name, type,
- defaultType, value);
- }
- }
-
- /**
- * Parse a conditional section.
- *
- * [61] conditionalSect ::= includeSect || ignoreSect
- * [62] includeSect ::= '<![' S? 'INCLUDE' S? '['
- * extSubsetDecl ']]>'
- * [63] ignoreSect ::= '<![' S? 'IGNORE' S? '['
- * ignoreSectContents* ']]>'
- * [64] ignoreSectContents ::= Ignore
- * ('<![' ignoreSectContents* ']]>' Ignore )*
- * [65] Ignore ::= Char* - (Char* ( '<![' | ']]>') Char* )
- *
- *
- * [66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'
- *
- *
- * [66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'
- *
- *
- * [68] EntityRef ::= '&' Name ';'
- *
- *
- * [69] PEReference ::= '%' Name ';'
- *
- *
- * [70] EntityDecl ::= GEDecl | PEDecl
- * [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'
- * [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
- * [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)
- * [74] PEDef ::= EntityValue | ExternalID
- * [75] ExternalID ::= 'SYSTEM' S SystemLiteral
- * | 'PUBLIC' S PubidLiteral S SystemLiteral
- * [76] NDataDecl ::= S 'NDATA' S Name
- *
- *
- * [82] NotationDecl ::= '<!NOTATION' S Name S
- * (ExternalID | PublicID) S? '>'
- * [83] PublicID ::= 'PUBLIC' S PubidLiteral
- *
- *
- * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
- *
- */
- private void parseCharData()
- throws Exception
- {
- char c;
- int state = 0;
- boolean pureWhite = false;
-
- // assert (dataBufferPos == 0);
-
- // are we expecting pure whitespace? it might be dirty...
- if ((currentElementContent == CONTENT_ELEMENTS) && !isDirtyCurrentElement)
- {
- pureWhite = true;
- }
-
- // always report right out of readBuffer
- // to minimize (pointless) buffer copies
- while (true)
- {
- int lineAugment = 0;
- int columnAugment = 0;
- int i;
-
-loop:
- for (i = readBufferPos; i < readBufferLength; i++)
- {
- switch (c = readBuffer[i])
- {
- case '\n':
- lineAugment++;
- columnAugment = 0;
- // pureWhite unmodified
- break;
- case '\r': // should not happen!!
- case '\t':
- case ' ':
- // pureWhite unmodified
- columnAugment++;
- break;
- case '&':
- case '<':
- columnAugment++;
- // pureWhite unmodified
- // CLEAN end of text sequence
- state = 1;
- break loop;
- case ']':
- // that's not a whitespace char, and
- // can not terminate pure whitespace either
- pureWhite = false;
- if ((i + 2) < readBufferLength)
- {
- if (readBuffer [i + 1] == ']'
- && readBuffer [i + 2] == '>')
- {
- // ERROR end of text sequence
- state = 2;
- break loop;
- }
- }
- else
- {
- // FIXME missing two end-of-buffer cases
- }
- columnAugment++;
- break;
- default:
- if ((c < 0x0020 || c > 0xFFFD)
- || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085)
- && xmlVersion == XML_11))
- {
- error("illegal XML character U+"
- + Integer.toHexString(c));
- }
- // that's not a whitespace char
- pureWhite = false;
- columnAugment++;
- }
- }
-
- // report text thus far
- if (lineAugment > 0)
- {
- line += lineAugment;
- column = columnAugment;
- }
- else
- {
- column += columnAugment;
- }
-
- // report characters/whitspace
- int length = i - readBufferPos;
-
- if (length != 0)
- {
- if (pureWhite)
- {
- handler.ignorableWhitespace(readBuffer,
- readBufferPos, length);
- }
- else
- {
- handler.charData(readBuffer, readBufferPos, length);
- }
- readBufferPos = i;
- }
-
- if (state != 0)
- {
- break;
- }
-
- // fill next buffer from this entity, or
- // pop stack and continue with previous entity
- unread(readCh());
- }
- if (!pureWhite)
- {
- isDirtyCurrentElement = true;
- }
- // finish, maybe with error
- if (state != 1) // finish, no error
- {
- error("character data may not contain ']]>'");
- }
- }
-
- //////////////////////////////////////////////////////////////////////
- // High-level reading and scanning methods.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Require whitespace characters.
- */
- private void requireWhitespace()
- throws SAXException, IOException
- {
- char c = readCh();
- if (isWhitespace(c))
- {
- skipWhitespace();
- }
- else
- {
- error("whitespace required", c, null);
- }
- }
-
- /**
- * Skip whitespace characters.
- *
- * [3] S ::= (#x20 | #x9 | #xd | #xa)+
- *
- */
- private void skipWhitespace()
- throws SAXException, IOException
- {
- // Start with a little cheat. Most of
- // the time, the white space will fall
- // within the current read buffer; if
- // not, then fall through.
- if (USE_CHEATS)
- {
- int lineAugment = 0;
- int columnAugment = 0;
-
-loop:
- for (int i = readBufferPos; i < readBufferLength; i++)
- {
- switch (readBuffer[i])
- {
- case ' ':
- case '\t':
- case '\r':
- columnAugment++;
- break;
- case '\n':
- lineAugment++;
- columnAugment = 0;
- break;
- case '%':
- if (expandPE)
- {
- break loop;
- }
- // else fall through...
- default:
- readBufferPos = i;
- if (lineAugment > 0)
- {
- line += lineAugment;
- column = columnAugment;
- }
- else
- {
- column += columnAugment;
- }
- return;
- }
- }
- }
-
- // OK, do it the slow way.
- char c = readCh ();
- while (isWhitespace(c))
- {
- c = readCh();
- }
- unread(c);
- }
-
- /**
- * Read a name or (when parsing an enumeration) name token.
- *
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- * [7] Nmtoken ::= (NameChar)+
- *
- */
- private String readNmtoken(boolean isName)
- throws SAXException, IOException
- {
- char c;
-
- if (USE_CHEATS)
- {
-loop:
- for (int i = readBufferPos; i < readBufferLength; i++)
- {
- c = readBuffer[i];
- switch (c)
- {
- case '%':
- if (expandPE)
- {
- break loop;
- }
- // else fall through...
-
- // What may legitimately come AFTER a name/nmtoken?
- case '<': case '>': case '&':
- case ',': case '|': case '*': case '+': case '?':
- case ')':
- case '=':
- case '\'': case '"':
- case '[':
- case ' ': case '\t': case '\r': case '\n':
- case ';':
- case '/':
- int start = readBufferPos;
- if (i == start)
- {
- error("name expected", readBuffer[i], null);
- }
- readBufferPos = i;
- return intern(readBuffer, start, i - start);
-
- default:
- // FIXME ... per IBM's OASIS test submission, these:
- // ? U+06dd
- // Combining U+309B
- //these switches are kind of ugly but at least we won't
- //have to go over the whole lits for each char
- if (isName && i == readBufferPos)
- {
- char c2 = (char) (c & 0x00f0);
- switch (c & 0xff00)
- {
- //starting with 01
- case 0x0100:
- switch (c2)
- {
- case 0x0030:
- if (c == 0x0132 || c == 0x0133 || c == 0x013f)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x0040:
- if (c == 0x0140 || c == 0x0149)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x00c0:
- if (c == 0x01c4 || c == 0x01cc)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x00f0:
- if (c == 0x01f1 || c == 0x01f3)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x00b0:
- if (c == 0x01f1 || c == 0x01f3)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- default:
- if (c == 0x017f)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- }
-
- break;
- //starting with 11
- case 0x1100:
- switch (c2)
- {
- case 0x0000:
- if (c == 0x1104 || c == 0x1108 ||
- c == 0x110a || c == 0x110d)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x0030:
- if (c == 0x113b || c == 0x113f)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x0040:
- if (c == 0x1141 || c == 0x114d
- || c == 0x114f )
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x0050:
- if (c == 0x1151 || c == 0x1156)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x0060:
- if (c == 0x1162 || c == 0x1164
- || c == 0x1166 || c == 0x116b
- || c == 0x116f)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- case 0x00b0:
- if (c == 0x11b6 || c == 0x11b9
- || c == 0x11bb || c == 0x116f)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- break;
- default:
- if (c == 0x1174 || c == 0x119f
- || c == 0x11ac || c == 0x11c3
- || c == 0x11f1)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- }
- break;
- default:
- if (c == 0x0e46 || c == 0x1011
- || c == 0x212f || c == 0x0587
- || c == 0x0230 )
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- }
- }
- // punt on exact tests from Appendix A; approximate
- // them using the Unicode ID start/part rules
- if (i == readBufferPos && isName)
- {
- if (!Character.isUnicodeIdentifierStart(c)
- && c != ':' && c != '_')
- {
- error("Not a name start character, U+"
- + Integer.toHexString(c));
- }
- }
- else if (!Character.isUnicodeIdentifierPart(c)
- && c != '-' && c != ':' && c != '_' && c != '.'
- && !isExtender(c))
- {
- error("Not a name character, U+"
- + Integer.toHexString(c));
- }
- }
- }
- }
-
- nameBufferPos = 0;
-
- // Read the first character.
-loop:
- while (true)
- {
- c = readCh();
- switch (c)
- {
- case '%':
- case '<': case '>': case '&':
- case ',': case '|': case '*': case '+': case '?':
- case ')':
- case '=':
- case '\'': case '"':
- case '[':
- case ' ': case '\t': case '\n': case '\r':
- case ';':
- case '/':
- unread(c);
- if (nameBufferPos == 0)
- {
- error ("name expected");
- }
- // punt on exact tests from Appendix A, but approximate them
- if (isName
- && !Character.isUnicodeIdentifierStart(nameBuffer[0])
- && ":_".indexOf(nameBuffer[0]) == -1)
- {
- error("Not a name start character, U+"
- + Integer.toHexString(nameBuffer[0]));
- }
- String s = intern(nameBuffer, 0, nameBufferPos);
- nameBufferPos = 0;
- return s;
- default:
- // punt on exact tests from Appendix A, but approximate them
-
- if ((nameBufferPos != 0 || !isName)
- && !Character.isUnicodeIdentifierPart(c)
- && ":-_.".indexOf(c) == -1
- && !isExtender(c))
- {
- error("Not a name character, U+"
- + Integer.toHexString(c));
- }
- if (nameBufferPos >= nameBuffer.length)
- {
- nameBuffer =
- (char[]) extendArray(nameBuffer,
- nameBuffer.length, nameBufferPos);
- }
- nameBuffer[nameBufferPos++] = c;
- }
- }
- }
-
- private static boolean isExtender(char c)
- {
- // [88] Extender ::= ...
- return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387
- || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005
- || (c >= 0x3031 && c <= 0x3035)
- || (c >= 0x309d && c <= 0x309e)
- || (c >= 0x30fc && c <= 0x30fe);
- }
-
- /**
- * Read a literal. With matching single or double quotes as
- * delimiters (and not embedded!) this is used to parse:
- *
- * [9] EntityValue ::= ... ([^%&] | PEReference | Reference)* ...
- * [10] AttValue ::= ... ([^<&] | Reference)* ...
- * [11] SystemLiteral ::= ... (URLchar - "'")* ...
- * [12] PubidLiteral ::= ... (PubidChar - "'")* ...
- *
- * as well as the quoted strings in XML and text declarations
- * (for version, encoding, and standalone) which have their
- * own constraints.
- */
- private String readLiteral(int flags)
- throws SAXException, IOException
- {
- char delim, c;
- int startLine = line;
- boolean saved = expandPE;
- boolean savedReport = doReport;
-
- // Find the first delimiter.
- delim = readCh();
- if (delim != '"' && delim != '\'')
- {
- error("expected '\"' or \"'\"", delim, null);
- return null;
- }
- inLiteral = true;
- if ((flags & LIT_DISABLE_PE) != 0)
- {
- expandPE = false;
- }
- doReport = false;
-
- // Each level of input source has its own buffer; remember
- // ours, so we won't read the ending delimiter from any
- // other input source, regardless of entity processing.
- char[] ourBuf = readBuffer;
-
- // Read the literal.
- try
- {
- c = readCh();
- boolean ampRead = false;
-loop:
- while (! (c == delim && readBuffer == ourBuf))
- {
- switch (c)
- {
- // attributes and public ids are normalized
- // in almost the same ways
- case '\n':
- case '\r':
- if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0)
- {
- c = ' ';
- }
- break;
- case '\t':
- if ((flags & LIT_ATTRIBUTE) != 0)
- {
- c = ' ';
- }
- break;
- case '&':
- c = readCh();
- // Char refs are expanded immediately, except for
- // all the cases where it's deferred.
- if (c == '#')
- {
- if ((flags & LIT_DISABLE_CREF) != 0)
- {
- dataBufferAppend('&');
- break;
- }
- parseCharRef(false /* Do not do flushDataBuffer */);
-
- // exotic WFness risk: this is an entity literal,
- // dataBuffer [dataBufferPos - 1] == '&', and
- // following chars are a _partial_ entity/char ref
-
- // It looks like an entity ref ...
- }
- else
- {
- unread(c);
- // Expand it?
- if ((flags & LIT_ENTITY_REF) > 0)
- {
- parseEntityRef(false);
- if (String.valueOf(readBuffer).equals("&"))
- {
- ampRead = true;
- }
- //Is it just data?
- }
- else if ((flags & LIT_DISABLE_EREF) != 0)
- {
- dataBufferAppend('&');
-
- // OK, it will be an entity ref -- expanded later.
- }
- else
- {
- String name = readNmtoken(true);
- require(';');
- dataBufferAppend('&');
- dataBufferAppend(name);
- dataBufferAppend(';');
- }
- }
- c = readCh();
- continue loop;
-
- case '<':
- // and why? Perhaps so "&foo;" expands the same
- // inside and outside an attribute?
- if ((flags & LIT_ATTRIBUTE) != 0)
- {
- error("attribute values may not contain '<'");
- }
- break;
-
- // We don't worry about case '%' and PE refs, readCh does.
-
- default:
- break;
- }
- dataBufferAppend(c);
- c = readCh();
- }
- }
- catch (EOFException e)
- {
- error("end of input while looking for delimiter (started on line "
- + startLine + ')', null, new Character(delim).toString());
- }
- inLiteral = false;
- expandPE = saved;
- doReport = savedReport;
-
- // Normalise whitespace if necessary.
- if ((flags & LIT_NORMALIZE) > 0)
- {
- dataBufferNormalize();
- }
-
- // Return the value.
- return dataBufferToString();
- }
-
- /**
- * Try reading external identifiers.
- * A system identifier is not required for notations.
- * @param inNotation Are we parsing a notation decl?
- * @param isSubset Parsing external subset decl (may be omitted)?
- * @return A three-member String array containing the identifiers,
- * or nulls. Order: public, system, baseURI.
- */
- private ExternalIdentifiers readExternalIds(boolean inNotation,
- boolean isSubset)
- throws Exception
- {
- char c;
- ExternalIdentifiers ids = new ExternalIdentifiers();
- int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
-
- if (tryRead("PUBLIC"))
- {
- requireWhitespace();
- ids.publicId = readLiteral(LIT_NORMALIZE | LIT_PUBID | flags);
- if (inNotation)
- {
- skipWhitespace();
- c = readCh();
- unread(c);
- if (c == '"' || c == '\'')
- {
- ids.systemId = readLiteral(flags);
- }
- }
- else
- {
- requireWhitespace();
- ids.systemId = readLiteral(flags);
- }
-
- for (int i = 0; i < ids.publicId.length(); i++)
- {
- c = ids.publicId.charAt(i);
- if (c >= 'a' && c <= 'z')
- {
- continue;
- }
- if (c >= 'A' && c <= 'Z')
- {
- continue;
- }
- if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf(c) != -1)
- {
- continue;
- }
- error("illegal PUBLIC id character U+"
- + Integer.toHexString(c));
- }
- }
- else if (tryRead("SYSTEM"))
- {
- requireWhitespace();
- ids.systemId = readLiteral(flags);
- }
- else if (!isSubset)
- {
- error("missing SYSTEM or PUBLIC keyword");
- }
-
- if (ids.systemId != null)
- {
- if (ids.systemId.indexOf('#') != -1)
- {
- handler.verror("SYSTEM id has a URI fragment: " + ids.systemId);
- }
- ids.baseUri = handler.getSystemId();
- if (ids.baseUri == null && uriWarnings)
- {
- handler.warn("No base URI; hope URI is absolute: "
- + ids.systemId);
- }
- }
-
- return ids;
- }
-
- /**
- * Test if a character is whitespace.
- *
- * [3] S ::= (#x20 | #x9 | #xd | #xa)+
- *
- * @param c The character to test.
- * @return true if the character is whitespace.
- */
- private final boolean isWhitespace(char c)
- {
- if (c > 0x20)
- {
- return false;
- }
- if (c == 0x20 || c == 0x0a || c == 0x09 || c == 0x0d)
- {
- return true;
- }
- return false; // illegal ...
- }
-
- //////////////////////////////////////////////////////////////////////
- // Utility routines.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Add a character to the data buffer.
- */
- private void dataBufferAppend(char c)
- {
- // Expand buffer if necessary.
- if (dataBufferPos >= dataBuffer.length)
- {
- dataBuffer = (char[]) extendArray(dataBuffer,
- dataBuffer.length, dataBufferPos);
- }
- dataBuffer[dataBufferPos++] = c;
- }
-
- /**
- * Add a string to the data buffer.
- */
- private void dataBufferAppend(String s)
- {
- dataBufferAppend(s.toCharArray(), 0, s.length());
- }
-
- /**
- * Append (part of) a character array to the data buffer.
- */
- private void dataBufferAppend(char[] ch, int start, int length)
- {
- dataBuffer = (char[]) extendArray(dataBuffer, dataBuffer.length,
- dataBufferPos + length);
-
- System.arraycopy(ch, start, dataBuffer, dataBufferPos, length);
- dataBufferPos += length;
- }
-
- /**
- * Normalise space characters in the data buffer.
- */
- private void dataBufferNormalize()
- {
- int i = 0;
- int j = 0;
- int end = dataBufferPos;
-
- // Skip spaces at the start.
- while (j < end && dataBuffer[j] == ' ')
- {
- j++;
- }
-
- // Skip whitespace at the end.
- while (end > j && dataBuffer[end - 1] == ' ')
- {
- end --;
- }
-
- // Start copying to the left.
- while (j < end)
- {
-
- char c = dataBuffer[j++];
-
- // Normalise all other spaces to
- // a single space.
- if (c == ' ')
- {
- while (j < end && dataBuffer[j++] == ' ')
- {
- continue;
- }
- dataBuffer[i++] = ' ';
- dataBuffer[i++] = dataBuffer[j - 1];
- }
- else
- {
- dataBuffer[i++] = c;
- }
- }
-
- // The new length is <= the old one.
- dataBufferPos = i;
- }
-
- /**
- * Convert the data buffer to a string.
- */
- private String dataBufferToString()
- {
- String s = new String(dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- return s;
- }
-
- /**
- * Flush the contents of the data buffer to the handler, as
- * appropriate, and reset the buffer for new input.
- */
- private void dataBufferFlush()
- throws SAXException
- {
- if (currentElementContent == CONTENT_ELEMENTS
- && dataBufferPos > 0
- && !inCDATA)
- {
- // We can't just trust the buffer to be whitespace, there
- // are (error) cases when it isn't
- for (int i = 0; i < dataBufferPos; i++)
- {
- if (!isWhitespace(dataBuffer[i]))
- {
- handler.charData(dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
- }
- if (dataBufferPos > 0)
- {
- handler.ignorableWhitespace(dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
- }
- else if (dataBufferPos > 0)
- {
- handler.charData(dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
- }
-
- /**
- * Require a string to appear, or throw an exception.
- * ==
instead of String.equals ()
.
- *
- *
- *
- * @param ename The name of the entity (if any) causing the new input.
- * @see #popInput
- * @see #sourceType
- * @see #externalEntity
- * @see #readBuffer
- * @see #readBufferPos
- * @see #readBufferLength
- * @see #line
- * @see #encoding
- */
- private void pushInput(String ename)
- throws SAXException
- {
- // Check for entity recursion.
- if (ename != null)
- {
- Iterator entities = entityStack.iterator();
- while (entities.hasNext())
- {
- String e = (String) entities.next();
- if (e != null && e == ename)
- {
- error("recursive reference to entity", ename, null);
- }
- }
- }
- entityStack.addLast(ename);
-
- // Don't bother if there is no current input.
- if (sourceType == INPUT_NONE)
- {
- return;
- }
-
- // Set up a snapshot of the current
- // input source.
- Input input = new Input();
-
- input.sourceType = sourceType;
- input.externalEntity = externalEntity;
- input.readBuffer = readBuffer;
- input.readBufferPos = readBufferPos;
- input.readBufferLength = readBufferLength;
- input.line = line;
- input.encoding = encoding;
- input.readBufferOverflow = readBufferOverflow;
- input.is = is;
- input.currentByteCount = currentByteCount;
- input.column = column;
- input.reader = reader;
-
- // Push it onto the stack.
- inputStack.addLast(input);
- }
-
- /**
- * Restore a previous input source.
- * null
.
- */
- public final String getBaseURI()
- {
- return null;
- }
-
- /**
- * Shallow clone of the attribute, breaking all ties with any
- * elements.
- */
- public Object clone()
- {
- DomAttr retval = (DomAttr) super.clone();
- retval.specified = true;
- return retval;
- }
-
- private void mutating(String oldValue, String newValue, short why)
- {
- if (!reportMutations || parent == null)
- {
- return;
- }
-
- // EVENT: DOMAttrModified, target = parent,
- // prev/new values provided, also attr name
- MutationEvent event;
-
- event = (MutationEvent) createEvent ("MutationEvents");
- event.initMutationEvent ("DOMAttrModified",
- true /* bubbles */, false /* nocancel */,
- null, oldValue, newValue, getNodeName (), why);
- parent.dispatchEvent (event);
- }
-
- // DOM Level 3 methods
-
- public TypeInfo getSchemaTypeInfo()
- {
- if (parent != null)
- {
- // DTD implementation
- DomDoctype doctype = (DomDoctype) parent.owner.getDoctype();
- if (doctype != null)
- {
- return doctype.getAttributeTypeInfo(parent.getNodeName(),
- getNodeName());
- }
- // TODO XML Schema implementation
- }
- return null;
- }
-
- public boolean isId()
- {
- if (parent != null)
- {
- DomDoctype doctype = (DomDoctype) parent.owner.getDoctype();
- if (doctype != null)
- {
- DTDAttributeTypeInfo info =
- doctype.getAttributeTypeInfo(parent.getNodeName(),
- getNodeName());
- if (info != null && "ID".equals(info.type))
- {
- return true;
- }
- }
- DomElement element = (DomElement) parent;
- if (element.userIdAttrs != null &&
- element.userIdAttrs.contains(this))
- {
- return true;
- }
- // TODO XML Schema implementation
- }
- return false;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomCDATASection.java b/libjava/gnu/xml/dom/DomCDATASection.java
deleted file mode 100644
index e34359e71bf..00000000000
--- a/libjava/gnu/xml/dom/DomCDATASection.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* DomCDATASection.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.CDATASection;
-
-/**
- * null
.
- * @since DOM Level 3 Core
- */
- public final String getBaseURI()
- {
- return null;
- }
-
- private void mutating(String newValue)
- {
- if (!reportMutations)
- {
- return;
- }
-
- // EVENT: DOMCharacterDataModified, target = this,
- // prev/new values provided
- MutationEvent event;
-
- event = (MutationEvent) createEvent("MutationEvents");
- event.initMutationEvent("DOMCharacterDataModified",
- true /* bubbles */, false /* nocancel */,
- null, text, newValue, null, (short) 0);
- dispatchEvent(event);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/DomComment.java b/libjava/gnu/xml/dom/DomComment.java
deleted file mode 100644
index 71c8160485f..00000000000
--- a/libjava/gnu/xml/dom/DomComment.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* DomComment.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.Comment;
-
-/**
- * null
.
- * See the Infoset Mapping, appendix C.
- */
- public final String getBaseURI()
- {
- return null;
- }
-
- /**
- * Sets the internal "readonly" flag so the node and its associated
- * data (only lists of entities and notations, no type information
- * at the moment) can't be changed.
- */
- public void makeReadonly()
- {
- super.makeReadonly();
- if (entities != null)
- {
- entities.makeReadonly();
- }
- if (notations != null)
- {
- notations.makeReadonly();
- }
- }
-
- void setOwner(DomDocument doc)
- {
- if (entities != null)
- {
- for (DomNode ctx = entities.first; ctx != null; ctx = ctx.next)
- {
- ctx.setOwner(doc);
- }
- }
- if (notations != null)
- {
- for (DomNode ctx = notations.first; ctx != null; ctx = ctx.next)
- {
- ctx.setOwner(doc);
- }
- }
- super.setOwner(doc);
- }
-
- /**
- * DOM L2
- * Consults the DOM implementation to determine if the requested
- * feature is supported.
- */
- final public boolean supports(String feature, String version)
- {
- return implementation.hasFeature(feature, version);
- }
-
- /**
- * Returns the implementation associated with this document type.
- */
- final public DOMImplementation getImplementation()
- {
- return implementation;
- }
-
- public void elementDecl(String name, String model)
- {
- DTDElementTypeInfo info = getElementTypeInfo(name);
- if (info == null)
- {
- info = new DTDElementTypeInfo(name, model);
- elements.put(name, info);
- }
- else
- {
- info.model = model;
- }
- }
-
- DTDElementTypeInfo getElementTypeInfo(String name)
- {
- return (DTDElementTypeInfo) elements.get(name);
- }
-
- public void attributeDecl(String eName, String aName, String type,
- String mode, String value)
- {
- DTDAttributeTypeInfo info = new DTDAttributeTypeInfo(eName, aName, type,
- mode, value);
- DTDElementTypeInfo elementInfo = getElementTypeInfo(eName);
- if (elementInfo == null)
- {
- elementInfo = new DTDElementTypeInfo(eName, null);
- elements.put(eName, elementInfo);
- }
- elementInfo.setAttributeTypeInfo(aName, info);
- if ("ID".equals(type))
- {
- ids = true;
- }
- }
-
- DTDAttributeTypeInfo getAttributeTypeInfo(String elementName, String name)
- {
- DTDElementTypeInfo elementInfo =
- (DTDElementTypeInfo) elements.get(elementName);
- return (elementInfo == null) ? null :
- elementInfo.getAttributeTypeInfo(name);
- }
-
- boolean hasIds()
- {
- return ids;
- }
-
- public boolean isSameNode(Node arg)
- {
- if (equals(arg))
- {
- return true;
- }
- if (!(arg instanceof DocumentType))
- {
- return false;
- }
- DocumentType doctype = (DocumentType) arg;
- if (!equal(getPublicId(), doctype.getPublicId()))
- {
- return false;
- }
- if (!equal(getSystemId(), doctype.getSystemId()))
- {
- return false;
- }
- if (!equal(getInternalSubset(), doctype.getInternalSubset()))
- {
- return false;
- }
- // TODO entities
- // TODO notations
- return true;
- }
-
- /**
- * Shallow clone of the doctype, except that associated
- * entities and notations are (deep) cloned.
- */
- public Object clone()
- {
- DomDoctype node = (DomDoctype) super.clone();
-
- if (entities != null)
- {
- node.entities = new DomNamedNodeMap(node, Node.ENTITY_NODE);
- for (DomNode ctx = entities.first; ctx != null; ctx = ctx.next)
- {
- node.entities.setNamedItem(ctx.cloneNode(true));
- }
- }
- if (notations != null)
- {
- node.notations = new DomNamedNodeMap(node, Node.NOTATION_NODE);
- for (DomNode ctx = notations.first; ctx != null; ctx = ctx.next)
- {
- node.notations.setNamedItem(ctx.cloneNode(true));
- }
- }
- return node;
- }
-
-
-}
diff --git a/libjava/gnu/xml/dom/DomDocument.java b/libjava/gnu/xml/dom/DomDocument.java
deleted file mode 100644
index ec422d1b4de..00000000000
--- a/libjava/gnu/xml/dom/DomDocument.java
+++ /dev/null
@@ -1,1387 +0,0 @@
-/* DomDocument.java --
- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom;
-
-import java.util.Iterator;
-import javax.xml.XMLConstants;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Entity;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.Notation;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-import org.w3c.dom.UserDataHandler;
-import org.w3c.dom.traversal.DocumentTraversal;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-import org.w3c.dom.traversal.TreeWalker;
-import org.w3c.dom.xpath.XPathEvaluator;
-import org.w3c.dom.xpath.XPathException;
-import org.w3c.dom.xpath.XPathExpression;
-import org.w3c.dom.xpath.XPathNSResolver;
-
-/**
- * building
flag.
- * Mutation events in the document are not reported.
- */
- public void setBuilding(boolean flag)
- {
- building = flag;
- }
-
- /**
- * Sets whether to check for document well-formedness.
- * If true, an exception will be raised if a second doctype or root
- * element node is added to the document.
- */
- public void setCheckWellformedness(boolean flag)
- {
- checkingWellformedness = flag;
- }
-
- /**
- * DOM L1
- * Returns the constant "#document".
- */
- final public String getNodeName()
- {
- return "#document";
- }
-
- /**
- * DOM L1
- * Returns the document's root element, or null.
- */
- final public Element getDocumentElement()
- {
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- if (ctx.nodeType == ELEMENT_NODE)
- {
- return (Element) ctx;
- }
- }
- return null;
- }
-
- /**
- * DOM L1
- * Returns the document's DocumentType, or null.
- */
- final public DocumentType getDoctype()
- {
- for (DomNode ctx = first; ctx != null; ctx = ctx.next)
- {
- if (ctx.nodeType == DOCUMENT_TYPE_NODE)
- {
- return (DocumentType) ctx;
- }
- }
- return null;
- }
-
- /**
- * DOM L1
- * Returns the document's DOMImplementation.
- */
- final public DOMImplementation getImplementation()
- {
- return implementation;
- }
-
- /**
- * DOM L1 (relocated in DOM L2)
- * Returns the element with the specified "ID" attribute, or null.
- *
- *
- *
- *
- *
- * <b><i>c</b>d
- * is parsed as <b><i>c</i></b><i>d
.
- *
- * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
- */
-public class DomHTMLParser
- extends gnu.javax.swing.text.html.parser.support.Parser
-{
- /**
- * The target where HTML document will be inserted.
- */
- protected DomHTMLDocument document;
-
- /**
- * The subsequently created new nodes will be inserted as the
- * childs of this cursor.
- */
- protected Node cursor;
-
- /**
- * Create parser using the given DTD.
- *
- * @param dtd the DTD (for example,
- * {@link gnu.javax.swing.text.html.parser.HTML_401F}).
- */
- public DomHTMLParser(DTD dtd)
- {
- super(dtd);
- }
-
- /**
- * Parse SGML insertion ( <! ... > ).
- * Currently just treats it as comment.
- */
- public boolean parseMarkupDeclarations(StringBuffer strBuff)
- throws java.io.IOException
- {
- Node c = document.createComment(strBuff.toString());
- cursor.appendChild(c);
- return false;
- }
-
- /**
- * Read the document, present in the given stream, and
- * return the corresponding {@link HTMLDocument}.
- *
- * @param input a stream to read from.
- * @return a document, reflecting the structure of the provided HTML
- * text.
- *
- * @throws IOException if the reader throws one.
- */
- public HTMLDocument parseDocument(Reader input)
- throws IOException
- {
- try
- {
- document = new DomHTMLDocument();
-
- cursor = document;
-
- parse(input);
-
- DomHTMLDocument h = document;
- document = null;
- return h;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- throw new IOException("Exception: " + ex.getMessage());
- }
- }
-
- /**
- * Create a new node.
- * @param name the name of node, case insensitive.
- * @return the created node.
- */
- protected Node createNode(String name)
- {
- Node new_node = document.createElement(name.toLowerCase());
- AttributeSet hatts = getAttributes();
- NamedNodeMap natts = new_node.getAttributes();
-
- Enumeration enumeration = hatts.getAttributeNames();
- Object key;
- Node attribute;
-
- while (hatts != null)
- {
- while (enumeration.hasMoreElements())
- {
- key = enumeration.nextElement();
- attribute = document.createAttribute(key.toString());
- attribute.setNodeValue(hatts.getAttribute(key).toString());
- natts.setNamedItem(attribute);
- }
-
- // The default values are stored in a parent node.
- hatts = hatts.getResolveParent();
- }
-
- return new_node;
- }
-
- /**
- * Handle comment by inserting the comment node.
- * @param text the comment text.
- */
- protected void handleComment(char[] text)
- {
- Node c = document.createComment(new String(text));
- cursor.appendChild(c);
- }
-
- /**
- * Handle the tag with no content.
- * @param tag the tag to handle.
- */
- protected void handleEmptyTag(TagElement tag)
- {
- String name = tag.getHTMLTag().toString();
-
- if (name.equalsIgnoreCase("#pcdata"))
- return;
-
- Node c = createNode(name);
- cursor.appendChild(c);
- }
-
- /**
- * Close the given tag. Close and reopen all nested tags.
- * @param tag the tag to close.
- */
- protected void handleEndTag(TagElement tag)
- {
- String name = tag.getHTMLTag().toString();
- String nname = cursor.getNodeName();
-
- // Closing the current tag.
- if (nname != null && nname.equalsIgnoreCase(name))
- {
- cursor = cursor.getParentNode();
- }
- else
- {
- Node nCursor = cursor.getParentNode();
-
- // Remember the opened nodes.
- LinkedList open = new LinkedList();
- Node close = cursor;
- while (close != null && !close.getNodeName().equalsIgnoreCase(name))
- {
- if (close != document)
- open.addFirst(close);
- close = close.getParentNode();
- }
-
- if (close == null)
- cursor = document;
- else
- cursor = close.getParentNode();
-
- // Insert the copies of the opened nodes.
- Iterator iter = open.iterator();
- while (iter.hasNext())
- {
- Node item = (Node) iter.next();
- Node copy = item.cloneNode(true);
- cursor.appendChild(copy);
- cursor = copy;
- }
- }
- }
-
- /**
- * Handle the start tag by inserting the HTML element.
- * @param tag the tag to handle.
- */
- protected void handleStartTag(TagElement tag)
- {
- HTML.Tag h = tag.getHTMLTag();
- Node c = createNode(h.toString());
- cursor.appendChild(c);
- cursor = c;
- }
-
- /**
- * Handle text by inserting the text node.
- * @param text the text to insert.
- */
- protected void handleText(char[] text)
- {
- Node c = document.createTextNode(text, 0, text.length);
- cursor.appendChild(c);
- }
-}
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLPreElement.java b/libjava/gnu/xml/dom/html2/DomHTMLPreElement.java
deleted file mode 100644
index 9b36a288700..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLPreElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLPreElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLPreElement;
-
-/**
- * An HTML 'PRE' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLPreElement
- extends DomHTMLElement
- implements HTMLPreElement
-{
-
- protected DomHTMLPreElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public int getWidth()
- {
- return getIntHTMLAttribute("width");
- }
-
- public void setWidth(int width)
- {
- setIntHTMLAttribute("width", width);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLQuoteElement.java b/libjava/gnu/xml/dom/html2/DomHTMLQuoteElement.java
deleted file mode 100644
index 678a5ada697..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLQuoteElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLQuoteElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLQuoteElement;
-
-/**
- * An HTML 'Q' or 'BLOCKQUOTE' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLQuoteElement
- extends DomHTMLElement
- implements HTMLQuoteElement
-{
-
- protected DomHTMLQuoteElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getCite()
- {
- return getHTMLAttribute("cite");
- }
-
- public void setCite(String cite)
- {
- setHTMLAttribute("cite", cite);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLScriptElement.java b/libjava/gnu/xml/dom/html2/DomHTMLScriptElement.java
deleted file mode 100644
index 8f8fff58a82..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLScriptElement.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/* DomHTMLScriptElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLScriptElement;
-
-/**
- * An HTML 'SCRIPT' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLScriptElement
- extends DomHTMLElement
- implements HTMLScriptElement
-{
-
- protected DomHTMLScriptElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getText()
- {
- return getTextContent();
- }
-
- public void setText(String text)
- {
- setTextContent(text);
- }
-
- public String getHtmlFor()
- {
- return getHTMLAttribute("for");
- }
-
- public void setHtmlFor(String htmlFor)
- {
- setHTMLAttribute("for", htmlFor);
- }
-
- public String getEvent()
- {
- return getHTMLAttribute("event");
- }
-
- public void setEvent(String event)
- {
- setHTMLAttribute("event", event);
- }
-
- public String getCharset()
- {
- return getHTMLAttribute("charset");
- }
-
- public void setCharset(String charset)
- {
- setHTMLAttribute("charset", charset);
- }
-
- public boolean getDefer()
- {
- return getBooleanHTMLAttribute("defer");
- }
-
- public void setDefer(boolean defer)
- {
- setBooleanHTMLAttribute("defer", defer);
- }
-
- public String getSrc()
- {
- return getHTMLAttribute("src");
- }
-
- public void setSrc(String src)
- {
- setHTMLAttribute("src", src);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLSelectElement.java b/libjava/gnu/xml/dom/html2/DomHTMLSelectElement.java
deleted file mode 100644
index 09752e1ffe4..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLSelectElement.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/* DomHTMLSelectElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomDOMException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.html2.HTMLElement;
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLOptionElement;
-import org.w3c.dom.html2.HTMLOptionsCollection;
-import org.w3c.dom.html2.HTMLSelectElement;
-
-/**
- * An HTML 'SELECT' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLSelectElement
- extends DomHTMLElement
- implements HTMLSelectElement
-{
-
- protected DomHTMLSelectElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public int getSelectedIndex()
- {
- HTMLOptionsCollection options = getOptions();
- int len = options.getLength();
- for (int i = 0; i < len; i++)
- {
- HTMLOptionElement option = (HTMLOptionElement) options.item(i);
- if (option.getSelected())
- {
- return i;
- }
- }
- return -1;
- }
-
- public void setSelectedIndex(int selectedIndex)
- {
- HTMLOptionsCollection options = getOptions();
- int len = options.getLength();
- if (selectedIndex < 0 || selectedIndex >= len)
- {
- throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
- }
- for (int i = 0; i < len; i++)
- {
- HTMLOptionElement option = (HTMLOptionElement) options.item(i);
- option.setSelected(i == selectedIndex);
- }
- }
-
- public String getValue()
- {
- return getHTMLAttribute("value");
- }
-
- public void setValue(String value)
- {
- setHTMLAttribute("value", value);
- }
-
- public int getLength()
- {
- return getIntHTMLAttribute("length");
- }
-
- public void setLength(int length)
- {
- setIntHTMLAttribute("length", length);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public HTMLOptionsCollection getOptions()
- {
- DomHTMLCollection ret =
- new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
- ret.addNodeName("option");
- ret.evaluate();
- return ret;
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public boolean getMultiple()
- {
- return getBooleanHTMLAttribute("multiple");
- }
-
- public void setMultiple(boolean multiple)
- {
- setBooleanHTMLAttribute("multiple", multiple);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public int getSize()
- {
- return getIntHTMLAttribute("size");
- }
-
- public void setSize(int size)
- {
- setIntHTMLAttribute("size", size);
- }
-
- public int getTabIndex()
- {
- return getIntHTMLAttribute("tabindex");
- }
-
- public void setTabIndex(int tabIndex)
- {
- setIntHTMLAttribute("tabindex", tabIndex);
- }
-
- public void add(HTMLElement element, HTMLElement before)
- {
- insertBefore(before, element);
- }
-
- public void remove(int index)
- {
- HTMLOptionsCollection options = getOptions();
- int len = options.getLength();
- if (index < 0 || index >= len)
- {
- throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
- }
- HTMLOptionElement option = (HTMLOptionElement) options.item(index);
- option.getParentNode().removeChild(option);
- }
-
- public void blur()
- {
- dispatchUIEvent("blur");
- }
-
- public void focus()
- {
- dispatchUIEvent("focus");
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLStyleElement.java b/libjava/gnu/xml/dom/html2/DomHTMLStyleElement.java
deleted file mode 100644
index f6f1fcc6844..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLStyleElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* DomHTMLStyleElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLStyleElement;
-
-/**
- * An HTML 'STYLE' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLStyleElement
- extends DomHTMLElement
- implements HTMLStyleElement
-{
-
- protected DomHTMLStyleElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public String getMedia()
- {
- return getHTMLAttribute("media");
- }
-
- public void setMedia(String media)
- {
- setHTMLAttribute("media", media);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java
deleted file mode 100644
index 28ea3418895..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* DomHTMLTableCaptionElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLTableCaptionElement;
-
-/**
- * An HTML 'CAPTION' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTableCaptionElement
- extends DomHTMLElement
- implements HTMLTableCaptionElement
-{
-
- protected DomHTMLTableCaptionElement(DomHTMLDocument owner,
- String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTableCellElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTableCellElement.java
deleted file mode 100644
index 41d33af26f8..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTableCellElement.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/* DomHTMLTableCellElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLTableCellElement;
-
-/**
- * An HTML 'TH' or 'TD' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTableCellElement
- extends DomHTMLElement
- implements HTMLTableCellElement
-{
-
- protected DomHTMLTableCellElement(DomHTMLDocument owner,
- String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public int getCellIndex()
- {
- return getIndex();
- }
-
- public String getAbbr()
- {
- return getHTMLAttribute("abbr");
- }
-
- public void setAbbr(String abbr)
- {
- setHTMLAttribute("abbr", abbr);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getAxis()
- {
- return getHTMLAttribute("axis");
- }
-
- public void setAxis(String axis)
- {
- setHTMLAttribute("axis", axis);
- }
-
- public String getBgColor()
- {
- return getHTMLAttribute("bgcolor");
- }
-
- public void setBgColor(String bgColor)
- {
- setHTMLAttribute("bgcolor", bgColor);
- }
-
- public String getCh()
- {
- return getHTMLAttribute("char");
- }
-
- public void setCh(String ch)
- {
- setHTMLAttribute("char", ch);
- }
-
- public String getChOff()
- {
- return getHTMLAttribute("charoff");
- }
-
- public void setChOff(String chOff)
- {
- setHTMLAttribute("charoff", chOff);
- }
-
- public int getColSpan()
- {
- return getIntHTMLAttribute("colspan");
- }
-
- public void setColSpan(int colSpan)
- {
- setIntHTMLAttribute("colspan", colSpan);
- }
-
- public String getHeaders()
- {
- return getHTMLAttribute("headers");
- }
-
- public void setHeaders(String headers)
- {
- setHTMLAttribute("headers", headers);
- }
-
- public String getHeight()
- {
- return getHTMLAttribute("height");
- }
-
- public void setHeight(String height)
- {
- setHTMLAttribute("height", height);
- }
-
- public boolean getNoWrap()
- {
- return getBooleanHTMLAttribute("nowrap");
- }
-
- public void setNoWrap(boolean noWrap)
- {
- setBooleanHTMLAttribute("nowrap", noWrap);
- }
-
- public int getRowSpan()
- {
- return getIntHTMLAttribute("rowspan");
- }
-
- public void setRowSpan(int rowSpan)
- {
- setIntHTMLAttribute("rowspan", rowSpan);
- }
-
- public String getScope()
- {
- return getHTMLAttribute("scope");
- }
-
- public void setScope(String scope)
- {
- setHTMLAttribute("scope", scope);
- }
-
- public String getVAlign()
- {
- return getHTMLAttribute("valign");
- }
-
- public void setVAlign(String vAlign)
- {
- setHTMLAttribute("valign", vAlign);
- }
-
- public String getWidth()
- {
- return getHTMLAttribute("width");
- }
-
- public void setWidth(String width)
- {
- setHTMLAttribute("width", width);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTableColElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTableColElement.java
deleted file mode 100644
index 799447dc81e..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTableColElement.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/* DomHTMLTableColElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLTableColElement;
-
-/**
- * An HTML 'COL' or 'COLGROUP' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTableColElement
- extends DomHTMLElement
- implements HTMLTableColElement
-{
-
- protected DomHTMLTableColElement(DomHTMLDocument owner,
- String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getCh()
- {
- return getHTMLAttribute("char");
- }
-
- public void setCh(String ch)
- {
- setHTMLAttribute("char", ch);
- }
-
- public String getChOff()
- {
- return getHTMLAttribute("charoff");
- }
-
- public void setChOff(String chOff)
- {
- setHTMLAttribute("charoff", chOff);
- }
-
- public int getSpan()
- {
- return getIntHTMLAttribute("span");
- }
-
- public void setSpan(int span)
- {
- setIntHTMLAttribute("span", span);
- }
-
- public String getVAlign()
- {
- return getHTMLAttribute("valign");
- }
-
- public void setVAlign(String vAlign)
- {
- setHTMLAttribute("valign", vAlign);
- }
-
- public String getWidth()
- {
- return getHTMLAttribute("width");
- }
-
- public void setWidth(String width)
- {
- setHTMLAttribute("width", width);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTableElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTableElement.java
deleted file mode 100644
index 73a3a45c61d..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTableElement.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/* DomHTMLTableElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomDOMException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.html2.HTMLCollection;
-import org.w3c.dom.html2.HTMLElement;
-import org.w3c.dom.html2.HTMLTableCaptionElement;
-import org.w3c.dom.html2.HTMLTableElement;
-import org.w3c.dom.html2.HTMLTableSectionElement;
-
-/**
- * An HTML 'TABLE' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTableElement
- extends DomHTMLElement
- implements HTMLTableElement
-{
-
- protected DomHTMLTableElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public HTMLTableCaptionElement getCaption()
- {
- return (HTMLTableCaptionElement) getChildElement("caption");
- }
-
- public void setCaption(HTMLTableCaptionElement caption)
- {
- HTMLTableCaptionElement ref = getCaption();
- if (ref == null)
- {
- appendChild(caption);
- }
- else
- {
- replaceChild(caption, ref);
- }
- }
-
- public HTMLTableSectionElement getTHead()
- {
- return (HTMLTableSectionElement) getChildElement("thead");
- }
-
- public void setTHead(HTMLTableSectionElement tHead)
- {
- HTMLTableSectionElement ref = getTHead();
- if (ref == null)
- {
- appendChild(tHead);
- }
- else
- {
- replaceChild(tHead, ref);
- }
- }
-
- public HTMLTableSectionElement getTFoot()
- {
- return (HTMLTableSectionElement) getChildElement("tfoot");
- }
-
- public void setTFoot(HTMLTableSectionElement tFoot)
- {
- HTMLTableSectionElement ref = getTFoot();
- if (ref == null)
- {
- appendChild(tFoot);
- }
- else
- {
- replaceChild(tFoot, ref);
- }
- }
-
- public HTMLCollection getRows()
- {
- DomHTMLCollection ret =
- new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
- ret.addNodeName("tr");
- ret.evaluate();
- return ret;
- }
-
- public HTMLCollection getTBodies()
- {
- DomHTMLCollection ret =
- new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
- ret.addNodeName("tbody");
- ret.evaluate();
- return ret;
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getBgColor()
- {
- return getHTMLAttribute("bgcolor");
- }
-
- public void setBgColor(String bgColor)
- {
- setHTMLAttribute("bgcolor", bgColor);
- }
-
- public String getBorder()
- {
- return getHTMLAttribute("border");
- }
-
- public void setBorder(String border)
- {
- setHTMLAttribute("border", border);
- }
-
- public String getCellPadding()
- {
- return getHTMLAttribute("cellpadding");
- }
-
- public void setCellPadding(String cellPadding)
- {
- setHTMLAttribute("cellpadding", cellPadding);
- }
-
- public String getCellSpacing()
- {
- return getHTMLAttribute("cellspacing");
- }
-
- public void setCellSpacing(String cellSpacing)
- {
- setHTMLAttribute("cellspacing", cellSpacing);
- }
-
- public String getFrame()
- {
- return getHTMLAttribute("frame");
- }
-
- public void setFrame(String frame)
- {
- setHTMLAttribute("frame", frame);
- }
-
- public String getRules()
- {
- return getHTMLAttribute("rules");
- }
-
- public void setRules(String rules)
- {
- setHTMLAttribute("rules", rules);
- }
-
- public String getSummary()
- {
- return getHTMLAttribute("summary");
- }
-
- public void setSummary(String summary)
- {
- setHTMLAttribute("summary", summary);
- }
-
- public String getWidth()
- {
- return getHTMLAttribute("width");
- }
-
- public void setWidth(String width)
- {
- setHTMLAttribute("width", width);
- }
-
- public HTMLElement createTHead()
- {
- HTMLTableSectionElement ref = getTHead();
- if (ref == null)
- {
- return (HTMLElement) getOwnerDocument().createElement("thead");
- }
- else
- {
- return ref;
- }
- }
-
- public void deleteTHead()
- {
- HTMLTableSectionElement ref = getTHead();
- if (ref != null)
- {
- removeChild(ref);
- }
- }
-
- public HTMLElement createTFoot()
- {
- HTMLTableSectionElement ref = getTFoot();
- if (ref == null)
- {
- return (HTMLElement) getOwnerDocument().createElement("tfoot");
- }
- else
- {
- return ref;
- }
- }
-
- public void deleteTFoot()
- {
- HTMLTableSectionElement ref = getTFoot();
- if (ref != null)
- {
- removeChild(ref);
- }
- }
-
- public HTMLElement createCaption()
- {
- HTMLTableCaptionElement ref = getCaption();
- if (ref == null)
- {
- return (HTMLElement) getOwnerDocument().createElement("caption");
- }
- else
- {
- return ref;
- }
- }
-
- public void deleteCaption()
- {
- HTMLTableCaptionElement ref = getCaption();
- if (ref != null)
- {
- removeChild(ref);
- }
- }
-
- public HTMLElement insertRow(int index)
- {
- Node ref = getRow(index);
- Node row = getOwnerDocument().createElement("tr");
- if (ref == null)
- {
- Node tbody = getChildElement("tbody");
- if (tbody == null)
- {
- tbody = getOwnerDocument().createElement("tfoot");
- appendChild(tbody);
- }
- tbody.appendChild(row);
- }
- else
- {
- ref.getParentNode().insertBefore(row, ref);
- }
- return (HTMLElement) row;
- }
-
- public void deleteRow(int index)
- {
- Node ref = getRow(index);
- if (ref == null)
- {
- throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
- }
- ref.getParentNode().removeChild(ref);
- }
-
- Node getRow(final int index)
- {
- int i = 0;
- Node thead = getChildElement("thead");
- if (thead != null)
- {
- for (Node ctx = thead.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (!"tr".equalsIgnoreCase(ctx.getLocalName()))
- {
- continue;
- }
- if (index == i)
- {
- return ctx;
- }
- i++;
- }
- }
- Node tbody = getChildElement("tbody");
- if (tbody == null)
- {
- tbody = this;
- }
- for (Node ctx = tbody.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (!"tr".equalsIgnoreCase(ctx.getLocalName()))
- {
- continue;
- }
- if (index == i)
- {
- return ctx;
- }
- i++;
- }
- Node tfoot = getChildElement("tfoot");
- if (tfoot != null)
- {
- for (Node ctx = tfoot.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (!"tr".equalsIgnoreCase(ctx.getLocalName()))
- {
- continue;
- }
- if (index == i)
- {
- return ctx;
- }
- i++;
- }
- }
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTableRowElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTableRowElement.java
deleted file mode 100644
index 2a1b6785a5d..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTableRowElement.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/* DomHTMLTableRowElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomDOMException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.html2.HTMLCollection;
-import org.w3c.dom.html2.HTMLElement;
-import org.w3c.dom.html2.HTMLTableRowElement;
-
-/**
- * An HTML 'TR' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTableRowElement
- extends DomHTMLElement
- implements HTMLTableRowElement
-{
-
- protected DomHTMLTableRowElement(DomHTMLDocument owner,
- String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public int getRowIndex()
- {
- return getIndex();
- }
-
- public int getSectionRowIndex()
- {
- int index = 0;
- DomHTMLElement parent = (DomHTMLElement) getParentElement("table");
- if (parent != null)
- {
- Node thead = parent.getChildElement("thead");
- if (thead != null)
- {
- for (Node ctx = thead.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx == this)
- {
- return index;
- }
- index++;
- }
- }
- Node tbody = parent.getChildElement("tbody");
- if (tbody != null)
- {
- for (Node ctx = tbody.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx == this)
- {
- return index;
- }
- index++;
- }
- }
- Node tfoot = parent.getChildElement("tfoot");
- if (tfoot != null)
- {
- for (Node ctx = tfoot.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx == this)
- {
- return index;
- }
- index++;
- }
- }
- }
- throw new DomDOMException(DOMException.NOT_FOUND_ERR);
- }
-
- public HTMLCollection getCells()
- {
- DomHTMLCollection ret =
- new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
- ret.addNodeName("th");
- ret.addNodeName("td");
- ret.evaluate();
- return ret;
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getBgColor()
- {
- return getHTMLAttribute("bgcolor");
- }
-
- public void setBgColor(String bgColor)
- {
- setHTMLAttribute("bgcolor", bgColor);
- }
-
- public String getCh()
- {
- return getHTMLAttribute("char");
- }
-
- public void setCh(String ch)
- {
- setHTMLAttribute("char", ch);
- }
-
- public String getChOff()
- {
- return getHTMLAttribute("charoff");
- }
-
- public void setChOff(String chOff)
- {
- setHTMLAttribute("charoff", chOff);
- }
-
- public String getVAlign()
- {
- return getHTMLAttribute("valign");
- }
-
- public void setVAlign(String vAlign)
- {
- setHTMLAttribute("valign", vAlign);
- }
-
- public HTMLElement insertCell(int index)
- {
- Node ref = getCell(index);
- Node cell = getOwnerDocument().createElement("td");
- if (ref == null)
- {
- appendChild(cell);
- }
- else
- {
- insertBefore(cell, ref);
- }
- return (HTMLElement) cell;
- }
-
- public void deleteCell(int index)
- {
- Node ref = getCell(index);
- if (ref == null)
- {
- throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
- }
- removeChild(ref);
- }
-
- Node getCell(final int index)
- {
- int i = 0;
- for (Node ctx = getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- String name = ctx.getLocalName();
- if (!"td".equalsIgnoreCase(name) &&
- !"th".equalsIgnoreCase(name))
- {
- continue;
- }
- if (index == i)
- {
- return ctx;
- }
- i++;
- }
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTableSectionElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTableSectionElement.java
deleted file mode 100644
index 79cce67feeb..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTableSectionElement.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/* DomHTMLTableSectionElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import gnu.xml.dom.DomDOMException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.html2.HTMLCollection;
-import org.w3c.dom.html2.HTMLElement;
-import org.w3c.dom.html2.HTMLTableSectionElement;
-
-/**
- * An HTML 'THEAD', 'TFOOT', or 'TBODY' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTableSectionElement
- extends DomHTMLElement
- implements HTMLTableSectionElement
-{
-
- protected DomHTMLTableSectionElement(DomHTMLDocument owner,
- String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getAlign()
- {
- return getHTMLAttribute("align");
- }
-
- public void setAlign(String align)
- {
- setHTMLAttribute("align", align);
- }
-
- public String getCh()
- {
- return getHTMLAttribute("char");
- }
-
- public void setCh(String ch)
- {
- setHTMLAttribute("char", ch);
- }
-
- public String getChOff()
- {
- return getHTMLAttribute("charoff");
- }
-
- public void setChOff(String chOff)
- {
- setHTMLAttribute("charoff", chOff);
- }
-
- public String getVAlign()
- {
- return getHTMLAttribute("valign");
- }
-
- public void setVAlign(String vAlign)
- {
- setHTMLAttribute("valign", vAlign);
- }
-
- public HTMLCollection getRows()
- {
- DomHTMLCollection ret =
- new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this);
- ret.addNodeName("tr");
- ret.evaluate();
- return ret;
- }
-
- public HTMLElement insertRow(int index)
- {
- Node ref = getRow(index);
- Node row = getOwnerDocument().createElement("tr");
- if (ref == null)
- {
- appendChild(row);
- }
- else
- {
- insertBefore(row, ref);
- }
- return (HTMLElement) row;
- }
-
- public void deleteRow(int index)
- {
- Node ref = getRow(index);
- if (ref == null)
- {
- throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
- }
- removeChild(ref);
- }
-
- Node getRow(final int index)
- {
- int i = 0;
- for (Node ctx = getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (!"tr".equalsIgnoreCase(ctx.getLocalName()))
- {
- continue;
- }
- if (index == i)
- {
- return ctx;
- }
- i++;
- }
- return null;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTextAreaElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTextAreaElement.java
deleted file mode 100644
index 22d6105696f..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTextAreaElement.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/* DomHTMLTextAreaElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLFormElement;
-import org.w3c.dom.html2.HTMLTextAreaElement;
-
-/**
- * An HTML 'TEXTAREA' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTextAreaElement
- extends DomHTMLElement
- implements HTMLTextAreaElement
-{
-
- protected String value;
-
- protected DomHTMLTextAreaElement(DomHTMLDocument owner,
- String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getDefaultValue()
- {
- return getHTMLAttribute("value");
- }
-
- public void setDefaultValue(String defaultValue)
- {
- setHTMLAttribute("value", defaultValue);
- }
-
- public HTMLFormElement getForm()
- {
- return (HTMLFormElement) getParentElement("form");
- }
-
- public String getAccessKey()
- {
- return getHTMLAttribute("accesskey");
- }
-
- public void setAccessKey(String accessKey)
- {
- setHTMLAttribute("accesskey", accessKey);
- }
-
- public int getCols()
- {
- return getIntHTMLAttribute("cols");
- }
-
- public void setCols(int cols)
- {
- setIntHTMLAttribute("cols", cols);
- }
-
- public boolean getDisabled()
- {
- return getBooleanHTMLAttribute("disabled");
- }
-
- public void setDisabled(boolean disabled)
- {
- setBooleanHTMLAttribute("disabled", disabled);
- }
-
- public String getName()
- {
- return getHTMLAttribute("name");
- }
-
- public void setName(String name)
- {
- setHTMLAttribute("name", name);
- }
-
- public boolean getReadOnly()
- {
- return getBooleanHTMLAttribute("readOnly");
- }
-
- public void setReadOnly(boolean readOnly)
- {
- setBooleanHTMLAttribute("readonly", readOnly);
- }
-
- public int getRows()
- {
- return getIntHTMLAttribute("rows");
- }
-
- public void setRows(int rows)
- {
- setIntHTMLAttribute("rows", rows);
- }
-
- public int getTabIndex()
- {
- return getIntHTMLAttribute("tabindex");
- }
-
- public void setTabIndex(int tabIndex)
- {
- setIntHTMLAttribute("tabindex", tabIndex);
- }
-
- public String getType()
- {
- return "textarea";
- }
-
- public String getValue()
- {
- if (value == null)
- {
- value = getDefaultValue();
- }
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public void blur()
- {
- dispatchUIEvent("blur");
- }
-
- public void focus()
- {
- dispatchUIEvent("focus");
- }
-
- public void select()
- {
- dispatchUIEvent("select");
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLTitleElement.java b/libjava/gnu/xml/dom/html2/DomHTMLTitleElement.java
deleted file mode 100644
index f62342d6ff5..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLTitleElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* DomHTMLTitleElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLTitleElement;
-
-/**
- * An HTML 'TITLE' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLTitleElement
- extends DomHTMLElement
- implements HTMLTitleElement
-{
-
- protected DomHTMLTitleElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public String getText()
- {
- return getTextContent();
- }
-
- public void setText(String text)
- {
- setTextContent(text);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/html2/DomHTMLUListElement.java b/libjava/gnu/xml/dom/html2/DomHTMLUListElement.java
deleted file mode 100644
index c07adeabf20..00000000000
--- a/libjava/gnu/xml/dom/html2/DomHTMLUListElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* DomHTMLUListElement.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.html2;
-
-import org.w3c.dom.html2.HTMLUListElement;
-
-/**
- * An HTML 'UL' element node.
- *
- * @author Chris Burdess
- */
-public class DomHTMLUListElement
- extends DomHTMLElement
- implements HTMLUListElement
-{
-
- protected DomHTMLUListElement(DomHTMLDocument owner, String namespaceURI,
- String name)
- {
- super(owner, namespaceURI, name);
- }
-
- public boolean getCompact()
- {
- return getBooleanHTMLAttribute("compact");
- }
-
- public void setCompact(boolean compact)
- {
- setBooleanHTMLAttribute("compact", compact);
- }
-
- public String getType()
- {
- return getHTMLAttribute("type");
- }
-
- public void setType(String type)
- {
- setHTMLAttribute("type", type);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/ls/DomLSException.java b/libjava/gnu/xml/dom/ls/DomLSException.java
deleted file mode 100644
index 6ac49e66934..00000000000
--- a/libjava/gnu/xml/dom/ls/DomLSException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* DomLSException.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import org.w3c.dom.ls.LSException;
-
-/**
- * A DOM LS exception incorporating a cause.
- *
- * @author Chris Burdess
- */
-public class DomLSException
- extends LSException
-{
-
- public DomLSException(short type, Exception cause)
- {
- super(type, (cause == null) ? null : cause.getMessage());
- initCause(cause);
- }
-
-}
diff --git a/libjava/gnu/xml/dom/ls/DomLSInput.java b/libjava/gnu/xml/dom/ls/DomLSInput.java
deleted file mode 100644
index 44274ec4734..00000000000
--- a/libjava/gnu/xml/dom/ls/DomLSInput.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/* DomLSInput.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import org.w3c.dom.ls.LSInput;
-
-/**
- * Specification of XML input to parse.
- *
- * @author Chris Burdess
- */
-public class DomLSInput
- implements LSInput
-{
-
- private InputStream in;
- private String systemId;
- private String publicId;
- private String baseURI;
- private String encoding;
- private boolean certifiedText;
-
- public Reader getCharacterStream()
- {
- return new InputStreamReader(in);
- }
-
- public void setCharacterStream(Reader characterStream)
- {
- in = new ReaderInputStream(characterStream);
- }
-
- public InputStream getByteStream()
- {
- return in;
- }
-
- public void setByteStream(InputStream byteStream)
- {
- in = byteStream;
- }
-
- public String getStringData()
- {
- StringBuffer acc = new StringBuffer();
- Reader reader = getCharacterStream();
- try
- {
- char[] buf = new char[4096];
- for (int len = reader.read(buf); len != -1; len = reader.read(buf))
- {
- acc.append(buf, 0, len);
- }
- }
- catch (IOException e)
- {
- return null; // ?
- }
- return acc.toString();
- }
-
- public void setStringData(String stringData)
- {
- in = new ReaderInputStream(new StringReader(stringData));
- }
-
- public String getSystemId()
- {
- return systemId;
- }
-
- public void setSystemId(String systemId)
- {
- this.systemId = systemId;
- }
-
- public String getPublicId()
- {
- return publicId;
- }
-
- public void setPublicId(String publicId)
- {
- this.publicId = publicId;
- }
-
- public String getBaseURI()
- {
- return baseURI;
- }
-
- public void setBaseURI(String baseURI)
- {
- this.baseURI = baseURI;
- }
-
- public String getEncoding()
- {
- return encoding;
- }
-
- public void setEncoding(String encoding)
- {
- this.encoding = encoding;
- }
-
- public boolean getCertifiedText()
- {
- return certifiedText;
- }
-
- public void setCertifiedText(boolean certifiedText)
- {
- this.certifiedText = certifiedText;
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/ls/DomLSOutput.java b/libjava/gnu/xml/dom/ls/DomLSOutput.java
deleted file mode 100644
index c2f4d4132ce..00000000000
--- a/libjava/gnu/xml/dom/ls/DomLSOutput.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* DomLSOutput.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import org.w3c.dom.ls.LSOutput;
-
-/**
- * Specification of XML output to produce.
- *
- * @author Chris Burdess
- */
-public class DomLSOutput
- implements LSOutput
-{
-
- private OutputStream out;
- private String systemId;
- private String encoding;
-
- public Writer getCharacterStream()
- {
- return new OutputStreamWriter(out);
- }
-
- public void setCharacterStream(Writer characterStream)
- {
- out = new WriterOutputStream(characterStream);
- }
-
- public OutputStream getByteStream()
- {
- return out;
- }
-
- public void setByteStream(OutputStream out)
- {
- this.out = out;
- }
-
- public String getSystemId()
- {
- return systemId;
- }
-
- public void setSystemId(String systemId)
- {
- this.systemId = systemId;
- }
-
- public String getEncoding()
- {
- return encoding;
- }
-
- public void setEncoding(String encoding)
- {
- this.encoding = encoding;
- }
-
-}
diff --git a/libjava/gnu/xml/dom/ls/DomLSParser.java b/libjava/gnu/xml/dom/ls/DomLSParser.java
deleted file mode 100644
index eb7c1c49f3a..00000000000
--- a/libjava/gnu/xml/dom/ls/DomLSParser.java
+++ /dev/null
@@ -1,574 +0,0 @@
-/* DomLSParser.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMStringList;
-import org.w3c.dom.Node;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSException;
-import org.w3c.dom.ls.LSInput;
-import org.w3c.dom.ls.LSParser;
-import org.w3c.dom.ls.LSParserFilter;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import gnu.xml.dom.DomDocument;
-import gnu.xml.dom.DomDOMException;
-
-/**
- * Parser implementation for GNU DOM.
- *
- * @author Chris Burdess
- */
-public class DomLSParser
- implements LSParser, DOMConfiguration, DOMStringList, ErrorHandler
-{
-
- private static final List SUPPORTED_PARAMETERS
- = Arrays.asList(new String[] { "cdata-sections",
- "comments",
- "element-content-whitespace",
- "namespaces",
- "expand-entity-references",
- "coalescing",
- "validating",
- "xinclude-aware",
- "entity-resolver",
- "error-handler" });
-
- private LSParserFilter filter;
- private final boolean async;
- private String schemaType;
- private SAXEventSink eventSink;
- private SAXParserFactory factory;
- private XMLReader reader;
-
- private boolean namespaceAware = true;
- private boolean ignoreWhitespace;
- private boolean expandEntityReferences;
- private boolean ignoreComments;
- private boolean coalescing;
- private boolean validating;
- private boolean xIncludeAware;
- private EntityResolver entityResolver;
- private ErrorHandler errorHandler;
-
- public DomLSParser(short mode, String schemaType)
- throws DOMException
- {
- switch (mode)
- {
- case DOMImplementationLS.MODE_ASYNCHRONOUS:
- async = true;
- break;
- case DOMImplementationLS.MODE_SYNCHRONOUS:
- async = false;
- break;
- default:
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- // TODO schemaType
- this.schemaType = schemaType;
- factory = SAXParserFactory.newInstance();
- }
-
- // -- LSParser --
-
- public DOMConfiguration getDomConfig()
- {
- return this;
- }
-
- public LSParserFilter getFilter()
- {
- return filter;
- }
-
- public void setFilter(LSParserFilter filter)
- {
- this.filter = filter;
- }
-
- public boolean getAsync()
- {
- return async;
- }
-
- public boolean getBusy()
- {
- return eventSink != null;
- }
-
- public Document parse(LSInput input)
- throws DOMException, LSException
- {
- if (async)
- {
- return doParse(input);
- }
- else
- {
- synchronized (this)
- {
- return doParse(input);
- }
- }
- }
-
- public Document parseURI(String uri)
- throws DOMException, LSException
- {
- LSInput input = new DomLSInput();
- input.setSystemId(uri);
- return parse(input);
- }
-
- public Node parseWithContext(LSInput input, Node context, short action)
- throws DOMException, LSException
- {
- Document doc = (context.getNodeType() == Node.DOCUMENT_NODE) ?
- (Document) context : context.getOwnerDocument();
- input.setBaseURI(doc.getDocumentURI());
- // TODO use namespaces defined on context node
- Document ret = parse(input);
- Node root = ret.getDocumentElement();
- root = doc.adoptNode(root);
- switch (action)
- {
- case ACTION_APPEND_AS_CHILDREN:
- context.appendChild(root);
- break;
- case ACTION_REPLACE_CHILDREN:
- Node c1 = context.getFirstChild();
- while (c1 != null)
- {
- Node next = c1.getNextSibling();
- context.removeChild(c1);
- c1 = next;
- }
- context.appendChild(root);
- break;
- case ACTION_INSERT_BEFORE:
- Node p1 = context.getParentNode();
- p1.insertBefore(root, context);
- break;
- case ACTION_INSERT_AFTER:
- Node p2 = context.getParentNode();
- Node r1 = context.getNextSibling();
- if (r1 == null)
- {
- p2.appendChild(root);
- }
- else
- {
- p2.insertBefore(root, r1);
- }
- break;
- case ACTION_REPLACE:
- Node p3 = context.getParentNode();
- Node r2 = context.getNextSibling();
- p3.removeChild(context);
- if (r2 == null)
- {
- p3.appendChild(root);
- }
- else
- {
- p3.insertBefore(root, r2);
- }
- break;
- }
- return root;
- }
-
- public void abort()
- {
- if (eventSink != null)
- {
- eventSink.interrupt();
- }
- }
-
- private Document doParse(LSInput input)
- throws DOMException, LSException
- {
- // create event sink
- if (eventSink != null)
- {
- throw new LSException(LSException.PARSE_ERR, "parse in progress");
- }
- InputSource source = getInputSource(input);
- eventSink = (filter == null) ? new SAXEventSink() :
- new FilteredSAXEventSink(filter);
- // configure sink
- eventSink.namespaceAware = namespaceAware;
- eventSink.ignoreWhitespace = ignoreWhitespace;
- eventSink.expandEntityReferences = expandEntityReferences;
- eventSink.ignoreComments = ignoreComments;
- eventSink.coalescing = coalescing;
- // get and configure reader
- XMLReader reader = getXMLReader();
- try
- {
- reader.setContentHandler(eventSink);
- reader.setDTDHandler(eventSink);
- reader.setProperty("http://xml.org/sax/properties/lexical-handler",
- eventSink);
- reader.setProperty("http://xml.org/sax/properties/declaration-handler",
- eventSink);
- reader.setFeature("http://xml.org/sax/features/namespaces",
- namespaceAware);
- reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
- true);
- reader.setFeature("http://xml.org/sax/features/validation",
- validating);
- try
- {
- reader.setFeature("http://xml.org/sax/features/use-attributes2",
- true);
- }
- catch (SAXNotRecognizedException e)
- {
- // ignore
- }
- try
- {
- reader.setFeature("http://xml.org/sax/features/external-general-entities",
- true);
- }
- catch (SAXNotRecognizedException e)
- {
- // ignore
- }
- reader.setEntityResolver(entityResolver);
- reader.setErrorHandler(errorHandler);
- // parse
- reader.parse(source);
- }
- catch (DOMException e)
- {
- reader = null;
- eventSink = null;
- throw e;
- }
- catch (SAXException e)
- {
- reader = null;
- eventSink = null;
- throw new DomLSException(LSException.PARSE_ERR, e);
- }
- catch (IOException e)
- {
- reader = null;
- eventSink = null;
- throw new DomLSException(LSException.PARSE_ERR, e);
- }
- // return document
- Document ret = eventSink.doc;
- String systemId = input.getSystemId();
- if (systemId != null && ret instanceof DomDocument)
- {
- ((DomDocument) ret).setDocumentURI(systemId);
- }
- eventSink = null;
- return ret;
- }
-
- private XMLReader getXMLReader()
- throws LSException
- {
- if (reader == null)
- {
- factory.setNamespaceAware(namespaceAware);
- factory.setValidating(validating);
- factory.setXIncludeAware(xIncludeAware);
- try
- {
- SAXParser parser = factory.newSAXParser();
- reader = parser.getXMLReader();
- }
- catch (ParserConfigurationException e)
- {
- throw new DomLSException(LSException.PARSE_ERR, e);
- }
- catch (SAXException e)
- {
- throw new DomLSException(LSException.PARSE_ERR, e);
- }
- }
- return reader;
- }
-
- private InputSource getInputSource(LSInput input)
- throws LSException
- {
- InputSource source = null;
- String systemId = input.getSystemId();
- InputStream in = input.getByteStream();
- if (in != null)
- {
- source = new InputSource(in);
- source.setSystemId(systemId);
- }
- if (source == null && entityResolver != null)
- {
- String publicId = input.getPublicId();
- try
- {
- source = entityResolver.resolveEntity(publicId, systemId);
- }
- catch (SAXException e)
- {
- throw new DomLSException(LSException.PARSE_ERR, e);
- }
- catch (IOException e)
- {
- throw new DomLSException(LSException.PARSE_ERR, e);
- }
- }
- if (source == null)
- {
- URL url = null;
- String base = input.getBaseURI();
- try
- {
- try
- {
- URL baseURL = (base == null) ? null : new URL(base);
- url = (baseURL == null) ? new URL(systemId) :
- new URL(baseURL, systemId);
- }
- catch (MalformedURLException e)
- {
- File baseFile = (base == null) ? null : new File(base);
- url = (baseFile == null) ? new File(systemId).toURL() :
- new File(baseFile, systemId).toURL();
- }
- in = url.openStream();
- systemId = url.toString();
- source = new InputSource(in);
- source.setSystemId(systemId);
- }
- catch (IOException e)
- {
- throw new DomLSException(LSException.PARSE_ERR, e);
- }
- }
- return source;
- }
-
- // -- DOMConfiguration --
-
- public void setParameter(String name, Object value)
- throws DOMException
- {
- name = name.toLowerCase();
- if ("cdata-sections".equals(name))
- {
- coalescing = !((Boolean) value).booleanValue();
- }
- else if ("comments".equals(name))
- {
- ignoreComments = !((Boolean) value).booleanValue();
- }
- else if ("element-content-whitespace".equals(name))
- {
- ignoreWhitespace = !((Boolean) value).booleanValue();
- }
- else if ("namespaces".equals(name))
- {
- namespaceAware = ((Boolean) value).booleanValue();
- }
- else if ("expand-entity-references".equals(name))
- {
- expandEntityReferences = ((Boolean) value).booleanValue();
- }
- else if ("coalescing".equals(name))
- {
- coalescing = ((Boolean) value).booleanValue();
- }
- else if ("validating".equals(name))
- {
- validating = ((Boolean) value).booleanValue();
- }
- else if ("xinclude-aware".equals(name))
- {
- xIncludeAware = ((Boolean) value).booleanValue();
- }
- else if ("entity-resolver".equals(name))
- {
- entityResolver = (EntityResolver) value;
- }
- else if ("error-handler".equals(name))
- {
- errorHandler = (ErrorHandler) value;
- }
- else
- {
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- // invalidate reader, a new one will be created
- reader = null;
- }
-
- public Object getParameter(String name)
- throws DOMException
- {
- name = name.toLowerCase();
- if ("cdata-sections".equals(name))
- {
- return coalescing ? Boolean.FALSE : Boolean.TRUE;
- }
- else if ("comments".equals(name))
- {
- return ignoreComments ? Boolean.FALSE : Boolean.TRUE;
- }
- else if ("element-content-whitespace".equals(name))
- {
- return ignoreWhitespace ? Boolean.FALSE : Boolean.TRUE;
- }
- else if ("namespaces".equals(name))
- {
- return namespaceAware ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("expand-entity-references".equals(name))
- {
- return expandEntityReferences ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("coalescing".equals(name))
- {
- return coalescing ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("validating".equals(name))
- {
- return validating ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("xinclude-aware".equals(name))
- {
- return xIncludeAware ? Boolean.TRUE : Boolean.FALSE;
- }
- else if ("entity-resolver".equals(name))
- {
- return entityResolver;
- }
- else if ("error-handler".equals(name))
- {
- return errorHandler;
- }
- else
- {
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- }
-
- public boolean canSetParameter(String name, Object value)
- {
- return contains(name);
- }
-
- public DOMStringList getParameterNames()
- {
- return this;
- }
-
- // -- DOMStringList --
-
- public String item(int i)
- {
- return (String) SUPPORTED_PARAMETERS.get(i);
- }
-
- public int getLength()
- {
- return SUPPORTED_PARAMETERS.size();
- }
-
- public boolean contains(String str)
- {
- return SUPPORTED_PARAMETERS.contains(str);
- }
-
- // -- ErrorHandler --
-
- public void warning(SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null)
- {
- errorHandler.warning(e);
- }
- }
-
- public void error(SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null)
- {
- errorHandler.error(e);
- }
- }
-
- public void fatalError(SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null)
- {
- errorHandler.fatalError(e);
- }
- abort();
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/ls/DomLSSerializer.java b/libjava/gnu/xml/dom/ls/DomLSSerializer.java
deleted file mode 100644
index cedaf151e70..00000000000
--- a/libjava/gnu/xml/dom/ls/DomLSSerializer.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/* DomLSSerializer.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-import java.util.List;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMStringList;
-import org.w3c.dom.Node;
-import org.w3c.dom.ls.LSException;
-import org.w3c.dom.ls.LSOutput;
-import org.w3c.dom.ls.LSSerializer;
-import org.w3c.dom.ls.LSSerializerFilter;
-import org.w3c.dom.traversal.NodeFilter;
-import gnu.xml.dom.DomDOMException;
-import gnu.xml.transform.StreamSerializer;
-
-/**
- * Serialize a DOM node to a stream.
- *
- * @author Chris Burdess
- */
-public class DomLSSerializer
- extends StreamSerializer
- implements LSSerializer, DOMConfiguration, DOMStringList
-{
-
- private static final List SUPPORTED_PARAMETERS =
- Arrays.asList(new String[] {"discard-default-content",
- "xml-declaration"});
-
- private LSSerializerFilter filter;
- private StreamSerializer serializer;
-
- public DomLSSerializer()
- {
- super();
- discardDefaultContent = true;
- }
-
- // -- LSSerializer --
-
- public DOMConfiguration getDomConfig()
- {
- return this;
- }
-
- public String getNewLine()
- {
- return eol;
- }
-
- public void setNewLine(String newLine)
- {
- if (newLine == null)
- {
- newLine = System.getProperty("line.separator");
- }
- eol = newLine;
- }
-
- public LSSerializerFilter getFilter()
- {
- return filter;
- }
-
- public void setFilter(LSSerializerFilter filter)
- {
- this.filter = filter;
- }
-
- public boolean write(Node node, LSOutput output)
- throws LSException
- {
- OutputStream out = output.getByteStream();
- try
- {
- if (out == null)
- {
- String systemId = output.getSystemId();
- try
- {
- URL url = new URL(systemId);
- URLConnection connection = url.openConnection();
- connection.setDoOutput(true);
- if (connection instanceof HttpURLConnection)
- {
- ((HttpURLConnection) connection).setRequestMethod("PUT");
- }
- out = connection.getOutputStream();
- }
- catch (MalformedURLException e)
- {
- File file = new File(systemId);
- out = new FileOutputStream(file);
- }
- }
- serialize(node, out);
- out.flush();
- return true;
- }
- catch (IOException e)
- {
- throw new DomLSException(LSException.SERIALIZE_ERR, e);
- }
- }
-
- public boolean writeToURI(Node node, String uri)
- throws LSException
- {
- LSOutput output = new DomLSOutput();
- output.setSystemId(uri);
- return write(node, output);
- }
-
- public String writeToString(Node node)
- throws DOMException, LSException
- {
- Writer writer = new StringWriter();
- LSOutput output = new DomLSOutput();
- output.setCharacterStream(writer);
- write(node, output);
- return writer.toString();
- }
-
- public void serialize(Node node, OutputStream out)
- throws IOException
- {
- if (filter == null)
- {
- super.serialize(node, out);
- }
- else
- {
- int wts = filter.getWhatToShow();
- if (wts != NodeFilter.SHOW_ALL)
- {
- switch (node.getNodeType())
- {
- case Node.ATTRIBUTE_NODE:
- if ((wts & NodeFilter.SHOW_ATTRIBUTE) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.TEXT_NODE:
- if ((wts & NodeFilter.SHOW_TEXT) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.ELEMENT_NODE:
- if ((wts & NodeFilter.SHOW_ELEMENT) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.CDATA_SECTION_NODE:
- if ((wts & NodeFilter.SHOW_CDATA_SECTION) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.COMMENT_NODE:
- if ((wts & NodeFilter.SHOW_COMMENT) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.DOCUMENT_NODE:
- if ((wts & NodeFilter.SHOW_DOCUMENT) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.DOCUMENT_TYPE_NODE:
- if ((wts & NodeFilter.SHOW_DOCUMENT_TYPE) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.PROCESSING_INSTRUCTION_NODE:
- if ((wts & NodeFilter.SHOW_PROCESSING_INSTRUCTION) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.DOCUMENT_FRAGMENT_NODE:
- if ((wts & NodeFilter.SHOW_DOCUMENT_FRAGMENT) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.ENTITY_NODE:
- if ((wts & NodeFilter.SHOW_ENTITY) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.ENTITY_REFERENCE_NODE:
- if ((wts & NodeFilter.SHOW_ENTITY_REFERENCE) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- case Node.NOTATION_NODE:
- if ((wts & NodeFilter.SHOW_NOTATION) == 0)
- {
- super.serialize(node, out);
- return;
- }
- break;
- }
- }
- switch (filter.acceptNode(node))
- {
- case NodeFilter.FILTER_ACCEPT:
- super.serialize(node, out);
- break;
- case NodeFilter.FILTER_REJECT:
- break;
- case NodeFilter.FILTER_SKIP:
- Node first = node.getFirstChild();
- if (first != null)
- {
- serialize(first, out);
- }
- break;
- }
- }
- }
-
- // -- DOMConfiguration --
-
- public void setParameter(String name, Object value)
- throws DOMException
- {
- if ("discard-default-content".equals(name))
- {
- discardDefaultContent = "true".equals(value.toString());
- }
- else if ("xml-declaration".equals(name))
- {
- xmlDeclaration = "false".equals(value.toString());
- }
- else
- {
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- }
-
- public Object getParameter(String name)
- throws DOMException
- {
- if ("discard-default-content".equals(name))
- {
- return discardDefaultContent ? "true" : "false";
- }
- else if ("xml-declaration".equals(name))
- {
- return xmlDeclaration ? "true" : "false";
- }
- else
- {
- throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
- }
- }
-
- public boolean canSetParameter(String name, Object value)
- {
- return contains(name);
- }
-
- public DOMStringList getParameterNames()
- {
- return this;
- }
-
- // -- DOMStringList --
-
- public String item(int i)
- {
- return (String) SUPPORTED_PARAMETERS.get(i);
- }
-
- public int getLength()
- {
- return SUPPORTED_PARAMETERS.size();
- }
-
- public boolean contains(String str)
- {
- return SUPPORTED_PARAMETERS.contains(str);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/ls/FilteredSAXEventSink.java b/libjava/gnu/xml/dom/ls/FilteredSAXEventSink.java
deleted file mode 100644
index 1c99ee524fa..00000000000
--- a/libjava/gnu/xml/dom/ls/FilteredSAXEventSink.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/* FilteredSAXEventSink.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.util.LinkedList;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import org.w3c.dom.ls.LSParserFilter;
-import org.w3c.dom.traversal.NodeFilter;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * A SAX event sink that calls out to a parser filter in order to decide
- * whether to insert nodes into the tree.
- *
- * @author Chris Burdess
- */
-class FilteredSAXEventSink
- extends SAXEventSink
-{
-
- final LSParserFilter filter;
- final int whatToShow;
-
- /**
- * Stack of elements to insert.
- */
- LinkedList nodes;
-
- /**
- * Corresponding stack of filter decisions about the nodes.
- */
- LinkedList decisions;
-
- /**
- * True when rejecting child nodes.
- */
- boolean rejecting;
-
- FilteredSAXEventSink(LSParserFilter filter)
- {
- this.filter = filter;
- whatToShow = filter.getWhatToShow();
- }
-
- public void startDocument()
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- nodes = new LinkedList();
- decisions = new LinkedList();
-
- super.startDocument();
- }
-
- public void endDocument()
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- super.endDocument();
-
- switch (getDecision(ctx, false))
- {
- case LSParserFilter.FILTER_REJECT:
- ctx = null;
- doc = null;
- break;
- }
-
- nodes = null;
- decisions = null;
- }
-
- public void startElement(String uri, String localName, String qName,
- Attributes atts)
- throws SAXException
- {
- if (rejecting || interrupted)
- {
- return;
- }
- Element element = createElement(uri, localName, qName, atts);
- ctx = element;
-
- short decision = getDecision(element, true);
- nodes.addLast(element);
- decisions.addLast(new Short(decision));
-
- switch (decision)
- {
- case LSParserFilter.FILTER_REJECT:
- rejecting = true;
- break;
- case LSParserFilter.FILTER_INTERRUPT:
- interrupted = true;
- break;
- }
- }
-
- protected Attr createAttr(Attributes atts, int index)
- {
- Attr attr = super.createAttr(atts, index);
- short decision = getDecision(attr, false);
- switch (decision)
- {
- case LSParserFilter.FILTER_REJECT:
- return null;
- case LSParserFilter.FILTER_INTERRUPT:
- interrupted = true;
- return null;
- }
- return attr;
- }
-
- public void endElement(String uri, String localName, String qName)
- throws SAXException
- {
- if (rejecting || interrupted)
- {
- return;
- }
- super.endElement(uri, localName, qName);
-
- Element element = (Element) nodes.removeLast();
- Node parent = nodes.isEmpty() ? doc : (Node) nodes.getLast();
- ctx = parent;
- short decision = ((Short) decisions.removeLast()).shortValue();
- switch (decision)
- {
- case LSParserFilter.FILTER_SKIP:
- // Add all children of element to parent
- for (Node child = element.getFirstChild(); child != null;
- child = child.getNextSibling())
- {
- parent.insertBefore(child, element);
- }
- return;
- case LSParserFilter.FILTER_REJECT:
- rejecting = false;
- break;
- }
- decision = getDecision(element, false);
- switch (decision)
- {
- case LSParserFilter.FILTER_ACCEPT:
- parent.appendChild(element);
- break;
- case LSParserFilter.FILTER_INTERRUPT:
- interrupted = true;
- break;
- }
- }
-
- public void characters(char[] c, int off, int len)
- throws SAXException
- {
- if (rejecting || interrupted)
- {
- return;
- }
- Text text = createText(c, off, len);
- short decision = getDecision(text, false);
- switch (decision)
- {
- case LSParserFilter.FILTER_ACCEPT:
- ctx.appendChild(text);
- break;
- case LSParserFilter.FILTER_INTERRUPT:
- interrupted = true;
- break;
- }
- }
-
- public void processingInstruction(String target, String data)
- throws SAXException
- {
- if (rejecting || interrupted || inDTD)
- {
- return;
- }
- Node pi = createProcessingInstruction(target, data);
- short decision = getDecision(pi, false);
- switch (decision)
- {
- case LSParserFilter.FILTER_ACCEPT:
- ctx.appendChild(pi);
- break;
- case LSParserFilter.FILTER_INTERRUPT:
- interrupted = true;
- break;
- }
- }
-
- public void startDTD(String name, String publicId, String systemId)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- Node doctype = createDocumentType(name, publicId, systemId);
- ctx = doctype;
- inDTD = true;
- nodes.addLast(doctype);
- decisions.addLast(new Short(LSParserFilter.FILTER_ACCEPT));
- }
-
- public void endDTD()
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- Node doctype = (Node) nodes.removeLast();
- decisions.removeLast();
- inDTD = false;
- ctx = doc;
- short decision = getDecision(doctype, false);
- switch (decision)
- {
- case LSParserFilter.FILTER_ACCEPT:
- ctx.appendChild(doctype);
- break;
- case LSParserFilter.FILTER_INTERRUPT:
- interrupted = true;
- break;
- }
- }
-
- public void comment(char[] c, int off, int len)
- throws SAXException
- {
- if (rejecting || interrupted || inDTD)
- {
- return;
- }
- Node comment = createComment(c, off, len);
- short decision = getDecision(comment, false);
- switch (decision)
- {
- case LSParserFilter.FILTER_ACCEPT:
- ctx.appendChild(comment);
- break;
- case LSParserFilter.FILTER_INTERRUPT:
- interrupted = true;
- break;
- }
- }
-
- // TODO declarations
-
- short getDecision(Node node, boolean start)
- {
- boolean show = (whatToShow == NodeFilter.SHOW_ALL);
- if (!show)
- {
- switch (node.getNodeType())
- {
- case Node.ATTRIBUTE_NODE:
- show = ((whatToShow & NodeFilter.SHOW_ATTRIBUTE) != 0);
- break;
- case Node.TEXT_NODE:
- show = ((whatToShow & NodeFilter.SHOW_TEXT) != 0);
- break;
- case Node.CDATA_SECTION_NODE:
- show = ((whatToShow & NodeFilter.SHOW_CDATA_SECTION) != 0);
- break;
- case Node.ELEMENT_NODE:
- show = ((whatToShow & NodeFilter.SHOW_ELEMENT) != 0);
- break;
- case Node.COMMENT_NODE:
- show = ((whatToShow & NodeFilter.SHOW_COMMENT) != 0);
- break;
- case Node.DOCUMENT_NODE:
- show = ((whatToShow & NodeFilter.SHOW_DOCUMENT) != 0);
- break;
- case Node.PROCESSING_INSTRUCTION_NODE:
- show = ((whatToShow & NodeFilter.SHOW_PROCESSING_INSTRUCTION) != 0);
- break;
- case Node.DOCUMENT_FRAGMENT_NODE:
- show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT) != 0);
- break;
- case Node.DOCUMENT_TYPE_NODE:
- show = ((whatToShow & NodeFilter.SHOW_DOCUMENT_TYPE) != 0);
- break;
- case Node.ENTITY_REFERENCE_NODE:
- show = ((whatToShow & NodeFilter.SHOW_ENTITY_REFERENCE) != 0);
- break;
- case Node.ENTITY_NODE:
- show = ((whatToShow & NodeFilter.SHOW_ENTITY) != 0);
- break;
- case Node.NOTATION_NODE:
- show = ((whatToShow & NodeFilter.SHOW_NOTATION) != 0);
- break;
- }
- }
- if (!show)
- {
- return LSParserFilter.FILTER_ACCEPT;
- }
- if (start)
- {
- return filter.startElement((Element) node);
- }
- return filter.acceptNode(node);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/ls/ReaderInputStream.java b/libjava/gnu/xml/dom/ls/ReaderInputStream.java
deleted file mode 100644
index 5b41abd3d74..00000000000
--- a/libjava/gnu/xml/dom/ls/ReaderInputStream.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/* ReaderInputStream.java --
- Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * Character stream wrapper.
- *
- * @author Chris Burdess
- * @author Mark Wielaard
- */
-public class ReaderInputStream
- extends InputStream
-{
-
- private Reader reader;
- private String encoding;
-
- // Holds extra spillover data if necessary
- private byte extra[];
- private int pos;
-
- private byte extra_marked[];
- private int pos_marked;
-
- public ReaderInputStream(Reader reader)
- {
- this.reader = reader;
- this.encoding = "UTF-8";
- }
-
- void setEncoding(String encoding)
- {
- this.encoding = encoding;
- }
-
- public int read()
- throws IOException
- {
- if (extra != null)
- {
- int result = extra[pos];
- pos++;
- if (pos >= extra.length)
- {
- extra = null;
- }
- return result;
- }
- return reader.read();
- }
-
- public int read(byte[] b)
- throws IOException
- {
- return read(b, 0, b.length);
- }
-
- public int read(byte[] b, int off, int len)
- throws IOException
- {
- if (len == 0)
- {
- return 0;
- }
-
- if (extra != null)
- {
- int available = extra.length - pos;
- int l = available < len ? available : len;
- System.arraycopy(extra, 0, b, off, l);
- pos += l;
- if (pos >= extra.length)
- {
- extra = null;
- }
- return l;
- }
-
- char[] c = new char[len];
- int l = reader.read(c, 0, len);
- if (l == -1)
- {
- return -1;
- }
-
- String s = new String(c, 0, l);
- byte[] d = s.getBytes(encoding);
-
- int available = d.length;
- int more = d.length - len;
- if (more > 0)
- {
- extra = new byte[more];
- pos = 0;
- System.arraycopy(d, len, extra, 0, more);
- available -= more;
- }
-
- System.arraycopy(d, 0, b, off, available);
- return available;
- }
-
- public void close()
- throws IOException
- {
- reader.close();
- }
-
- public boolean markSupported()
- {
- return reader.markSupported();
- }
-
- public void mark(int limit)
- {
- if (extra != null)
- {
- extra_marked = new byte[extra.length];
- System.arraycopy(extra, 0, extra_marked, 0, extra.length);
- pos_marked = pos;
- }
- else
- {
- extra_marked = null;
- }
-
- try
- {
- // Note that this might be a bit more than asked for.
- // Because we might also have the extra_marked bytes.
- // That is fine (and necessary for reset() to work).
- reader.mark(limit);
- }
- catch (IOException ioe)
- {
- throw new RuntimeException(ioe);
- }
- }
-
- public void reset()
- throws IOException
- {
- extra = extra_marked;
- pos = pos_marked;
- extra_marked = null;
-
- reader.reset();
- }
-
- public long skip(long n)
- throws IOException
- {
- long done = 0;
- if (extra != null)
- {
- int available = extra.length - pos;
- done = available < n ? available : n;
- pos += done;
- if (pos >= extra.length)
- {
- extra = null;
- }
- }
-
- n -= done;
- if (n > 0)
- {
- return reader.skip(n) + done;
- }
- else
- {
- return done;
- }
- }
-
- /**
- * Returns conservative number of bytes available without blocking.
- * Actual number of bytes that can be read without blocking might
- * be (much) bigger.
- */
- public int available()
- throws IOException
- {
- if (extra != null)
- {
- return pos - extra.length;
- }
-
- return reader.ready() ? 1 : 0;
- }
-
- public String toString()
- {
- return getClass().getName() + "[" + reader + ", " + encoding + "]";
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/ls/SAXEventSink.java b/libjava/gnu/xml/dom/ls/SAXEventSink.java
deleted file mode 100644
index a850460b1e2..00000000000
--- a/libjava/gnu/xml/dom/ls/SAXEventSink.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/* SAXEventSink.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import javax.xml.XMLConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Entity;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import org.xml.sax.Attributes;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.Attributes2;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.LexicalHandler;
-import gnu.xml.aelfred2.ContentHandler2;
-import gnu.xml.dom.DomAttr;
-import gnu.xml.dom.DomDocument;
-import gnu.xml.dom.DomDoctype;
-
-/**
- * A SAX content and lexical handler used to construct a DOM document.
- *
- * @author Chris Burdess
- */
-class SAXEventSink
- implements ContentHandler2, LexicalHandler, DTDHandler, DeclHandler
-{
-
- private static final String XMLNS_URI = XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
- private static final String XMLNS_PREFIX = XMLConstants.XMLNS_ATTRIBUTE;
-
- boolean namespaceAware;
- boolean ignoreWhitespace;
- boolean expandEntityReferences;
- boolean ignoreComments;
- boolean coalescing;
-
- DomDocument doc; // document being constructed
- Node ctx; // current context (parent node)
- LinkedList entityCtx; // entity context
- List pending; // namespace nodes waiting for a declaring element
- Locator locator;
- boolean inCDATA;
- boolean inDTD;
- boolean interrupted;
-
- void interrupt()
- {
- interrupted = true;
- }
-
- // -- ContentHandler2 --
-
- public void setDocumentLocator(Locator locator)
- {
- this.locator = locator;
- }
-
- public void startDocument()
- throws SAXException
- {
- if (namespaceAware)
- {
- pending = new LinkedList();
- }
- doc = new DomDocument();
- doc.setStrictErrorChecking(false);
- doc.setBuilding(true);
- ctx = doc;
- }
-
- public void xmlDecl(String version, String encoding, boolean standalone,
- String inputEncoding)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- doc.setXmlVersion(version);
- doc.setXmlEncoding(encoding);
- doc.setXmlStandalone(standalone);
- doc.setInputEncoding(inputEncoding);
- }
-
- public void endDocument()
- throws SAXException
- {
- doc.setStrictErrorChecking(true);
- doc.setBuilding(false);
- DomDoctype doctype = (DomDoctype) doc.getDoctype();
- if (doctype != null)
- {
- doctype.makeReadonly();
- }
- ctx = null;
- locator = null;
- }
-
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException
- {
- if (namespaceAware)
- {
- String nsName = (prefix != null && prefix.length() > 0) ?
- XMLNS_PREFIX + ":" + prefix : XMLNS_PREFIX;
- DomAttr ns = (DomAttr) doc.createAttributeNS(XMLNS_URI, nsName);
- ns.setNodeValue(uri);
- if (ctx.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- // Add to owner element
- Node target = ((Attr) ctx).getOwnerElement();
- target.getAttributes().setNamedItemNS(ns);
- }
- else
- {
- // Add to pending list; namespace node will be inserted when
- // element is seen
- pending.add(ns);
- }
- }
- }
-
- public void endPrefixMapping(String prefix)
- throws SAXException
- {
- }
-
- public void startElement(String uri, String localName, String qName,
- Attributes atts)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- Element element = createElement(uri, localName, qName, atts);
- // add element to context
- ctx.appendChild(element);
- ctx = element;
- }
-
- protected Element createElement(String uri, String localName, String qName,
- Attributes atts)
- throws SAXException
- {
- // create element node
- Element element = namespaceAware ?
- doc.createElementNS(uri, qName) :
- doc.createElement(qName);
- NamedNodeMap attrs = element.getAttributes();
- if (namespaceAware && !pending.isEmpty())
- {
- // add pending namespace nodes
- for (Iterator i = pending.iterator(); i.hasNext(); )
- {
- Node ns = (Node) i.next();
- attrs.setNamedItemNS(ns);
- }
- pending.clear();
- }
- // add attributes
- int len = atts.getLength();
- for (int i = 0; i < len; i++)
- {
- // create attribute
- Attr attr = createAttr(atts, i);
- if (attr != null)
- {
- // add attribute to element
- if (namespaceAware)
- {
- attrs.setNamedItemNS(attr);
- }
- else
- {
- attrs.setNamedItem(attr);
- }
- }
- }
- return element;
- }
-
- protected Attr createAttr(Attributes atts, int index)
- {
- DomAttr attr;
- if (namespaceAware)
- {
- String a_uri = atts.getURI(index);
- String a_qName = atts.getQName(index);
- attr = (DomAttr) doc.createAttributeNS(a_uri, a_qName);
- }
- else
- {
- String a_qName = atts.getQName(index);
- attr = (DomAttr) doc.createAttribute(a_qName);
- }
- attr.setNodeValue(atts.getValue(index));
- if (atts instanceof Attributes2)
- {
- Attributes2 atts2 = (Attributes2) atts;
- // TODO attr.setDeclared(atts2.isDeclared(index));
- attr.setSpecified(atts2.isSpecified(index));
- }
- return attr;
- }
-
- public void endElement(String uri, String localName, String qName)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- if (namespaceAware)
- {
- pending.clear();
- }
- ctx = ctx.getParentNode();
- }
-
- public void characters(char[] c, int off, int len)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- ctx.appendChild(createText(c, off, len));
- }
-
- protected Text createText(char[] c, int off, int len)
- throws SAXException
- {
- Text text = (inCDATA && !coalescing) ?
- doc.createCDATASection(new String(c, off, len)) :
- doc.createTextNode(new String(c, off, len));
- return text;
- }
-
- public void ignorableWhitespace(char[] c, int off, int len)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- if (!ignoreWhitespace)
- {
- characters(c, off, len);
- }
- }
-
- public void processingInstruction(String target, String data)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- if (!inDTD)
- {
- Node pi = createProcessingInstruction(target, data);
- ctx.appendChild(pi);
- }
- }
-
- protected Node createProcessingInstruction(String target, String data)
- {
- return doc.createProcessingInstruction(target, data);
- }
-
- public void skippedEntity(String name)
- throws SAXException
- {
- // This callback is totally pointless
- }
-
- // -- LexicalHandler --
-
- public void startDTD(String name, String publicId, String systemId)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- Node doctype = createDocumentType(name, publicId, systemId);
- doc.appendChild(doctype);
- ctx = doctype;
- inDTD = true;
- }
-
- protected Node createDocumentType(String name, String publicId,
- String systemId)
- {
- return new DomDoctype(doc, name, publicId, systemId);
- }
-
- public void endDTD()
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- inDTD = false;
- ctx = ctx.getParentNode();
- }
-
- public void startEntity(String name)
- throws SAXException
- {
- DocumentType doctype = doc.getDoctype();
- if (doctype == null)
- {
- throw new SAXException("SAX parser error: " +
- "reference to entity in undeclared doctype");
- }
- if ("[dtd]".equals(name) || name.charAt(0) == '%')
- {
- // Ignore DTD and parameter entities
- ctx = doctype;
- return;
- }
- if ("lt".equals(name) ||
- "gt".equals(name) ||
- "amp".equals(name) ||
- "apos".equals(name) ||
- "quot".equals(name))
- {
- return;
- }
- // Get entity
- NamedNodeMap entities = doctype.getEntities();
- Entity entity = (Entity) entities.getNamedItem(name);
- if (entity == null)
- {
- throw new SAXException("SAX parser error: " +
- "reference to undeclared entity: " + name);
- }
- pushEntity(entity);
- }
-
- public void endEntity(String name)
- throws SAXException
- {
- if ("[dtd]".equals(name) || name.charAt(0) == '%')
- {
- // Ignore DTD and parameter entities
- return;
- }
- if ("lt".equals(name) ||
- "gt".equals(name) ||
- "amp".equals(name) ||
- "apos".equals(name) ||
- "quot".equals(name))
- {
- return;
- }
- // Get entity
- Entity entity = popEntity();
- // TODO resolve external entities to ensure that entity has content
- if (expandEntityReferences)
- {
- // Get entity content
- for (Node child = entity.getFirstChild(); child != null;
- child = child.getNextSibling())
- {
- ctx.appendChild(child);
- }
- }
- else
- {
- Node entityReference = doc.createEntityReference(name);
- ctx.appendChild(entityReference);
- }
- }
-
- void pushEntity(Node entity)
- {
- if (entityCtx == null)
- {
- entityCtx = new LinkedList();
- }
- entityCtx.addLast(ctx);
- ctx = entity;
- }
-
- Entity popEntity()
- {
- Entity ret = (Entity) ctx;
- ctx = (Node) entityCtx.removeLast();
- return ret;
- }
-
- public void startCDATA()
- throws SAXException
- {
- inCDATA = true;
- }
-
- public void endCDATA()
- throws SAXException
- {
- inCDATA = false;
- }
-
- 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);
- }
- }
-
- protected Node createComment(char[] c, int off, int len)
- {
- return doc.createComment(new String(c, off, len));
- }
-
- // -- DTDHandler --
-
- public void notationDecl(String name, String publicId, String systemId)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- DomDoctype doctype = (DomDoctype) ctx;
- doctype.declareNotation(name, publicId, systemId);
- }
-
- public void unparsedEntityDecl(String name, String publicId, String systemId,
- String notationName)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- DomDoctype doctype = (DomDoctype) ctx;
- Entity entity = doctype.declareEntity(name, publicId, systemId,
- notationName);
- }
-
- // -- DeclHandler --
-
- public void elementDecl(String name, String model)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- // Ignore fake element declarations generated by ValidationConsumer.
- // If an element is not really declared in the DTD it will not be
- // declared in the document model.
- if (!(ctx instanceof DomDoctype))
- {
- return;
- }
- DomDoctype doctype = (DomDoctype) ctx;
- doctype.elementDecl(name, model);
- }
-
- public void attributeDecl(String eName, String aName, String type,
- String mode, String value)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- DomDoctype doctype = (DomDoctype) ctx;
- doctype.attributeDecl(eName, aName, type, mode, value);
- }
-
- public void internalEntityDecl(String name, String value)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- DomDoctype doctype = (DomDoctype) ctx;
- Entity entity = doctype.declareEntity(name, null, null, null);
- if (entity != null)
- {
- Node text = doc.createTextNode(value);
- entity.appendChild(text);
- }
- }
-
- public void externalEntityDecl(String name, String publicId, String systemId)
- throws SAXException
- {
- if (interrupted)
- {
- return;
- }
- DomDoctype doctype = (DomDoctype) ctx;
- Entity entity = doctype.declareEntity(name, publicId, systemId, null);
- }
-
-}
-
diff --git a/libjava/gnu/xml/dom/ls/WriterOutputStream.java b/libjava/gnu/xml/dom/ls/WriterOutputStream.java
deleted file mode 100644
index 2fb20614722..00000000000
--- a/libjava/gnu/xml/dom/ls/WriterOutputStream.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* WriterOutputStream.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.dom.ls;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-
-/**
- * Character stream wrapper.
- *
- * @author Chris Burdess
- */
-public class WriterOutputStream
- extends OutputStream
-{
-
- private Writer writer;
- private String encoding;
-
- public WriterOutputStream(Writer writer)
- {
- this.writer = writer;
- this.encoding = "UTF-8";
- }
-
- void setEncoding(String encoding)
- {
- this.encoding = encoding;
- }
-
- public void write(int c)
- throws IOException
- {
- writer.write(c);
- }
-
- public void write(byte[] b)
- throws IOException
- {
- write(b, 0, b.length);
- }
-
- public void write(byte[] b, int off, int len)
- throws IOException
- {
- writer.write(new String(b, off, len, encoding));
- }
-
- public void close()
- throws IOException
- {
- writer.close();
- }
-
- public void flush()
- throws IOException
- {
- writer.flush();
- }
-
-}
-
diff --git a/libjava/gnu/xml/pipeline/CallFilter.java b/libjava/gnu/xml/pipeline/CallFilter.java
deleted file mode 100644
index 3b337517377..00000000000
--- a/libjava/gnu/xml/pipeline/CallFilter.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/* CallFilter.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.net.URL;
-import java.net.URLConnection;
-import java.io.Writer;
-
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import gnu.xml.util.Resolver;
-import gnu.xml.util.XMLWriter;
-
-
-/**
- * Input is sent as an XML request to given URI, and the output of this
- * filter is the parsed response to that request.
- * A connection is opened to the remote URI when the startDocument call is
- * issued through this filter, and the request is finished when the
- * endDocument call is issued. Events should be written quickly enough to
- * prevent the remote HTTP server from aborting the connection due to
- * inactivity; you may want to buffer text in an earlier pipeline stage.
- * If your application requires validity checking of such
- * outputs, have the output pipeline include a validation stage.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * nsfix | validate | write ( stdout )
- *
- *
-
-
- *
-
-
- Stage
- Parameter
- Terminus
- Description
-
-
- dom
- none
- yes
- Applications code can access a DOM Document built
- from the input event stream. When used as a filter, this buffers
- data up to an endDocument call, and then uses a DOM parser
- to report everything that has been recorded (which can easily be
- less than what was reported to it).
-
-
- nsfix
- none
- no
- This stage ensures that the XML element and attribute
- names in its output use namespace prefixes and declarations correctly.
- That is, so that they match the "Namespace plus LocalName" naming data
- with which each XML element and attribute is already associated.
-
-
- null
- none
- yes
- This stage ignores all input event data.
-
-
- server
- required
-
server URL no
- Sends its input as XML request to a remote server,
- normally a web application server using the HTTP or HTTPS protocols.
- The output of this stage is the parsed response from that server.
-
-
-
- tee
- required
-
first pipelineno
- This sends its events down two paths; its parameter
- is a pipeline descriptor for the first path, and the second path
- is the output of this stage.
-
-
- validate
- none
- yes
- This checks for validity errors, and reports them
- through its error handler. The input must include declaration events
- and some lexical events.
-
-
- wf
- none
- yes
- This class provides some basic "well formedness"
- tests on the input event stream, and reports a fatal error if any
- of them fail. One example: start/end calls for elements must match.
- No SAX parser is permitted to produce malformed output, but other
- components can easily do so.
-
-
- write
- required
-
"stdout", "stderr", or filenameyes
- Writes its input to the specified output, as pretty
- printed XML text encoded using UTF-8. Input events must be well
- formed and "namespace fixed", else the output won't be XML (or possibly
- namespace) conformant. The symbolic names represent
- System.out and System.err respectively; names must
- correspond to files which don't yet exist.
-
-
- xhtml
- required
-
"stdout", "stderr", or filenameyes
- Like write (above), except that XHTML rules
- are followed. The XHTML 1.0 Transitional document type is declared,
- and only ASCII characters are written (for interoperability). Other
- characters are written as entity or character references; the text is
- pretty printed.
-
-
- xinclude
- none
- no
- This stage handles XInclude processing.
- This is like entity inclusion, except that the included content
- is declared in-line rather than in the DTD at the beginning of
- a document.
-
-
-
-
- xslt
- required
-
XSLT stylesheet URIno
- This stage handles XSLT transformation
- according to a stylesheet.
- The implementation of the transformation may not actually
- stream data, although if such an XSLT engine is in use
- then that can happen.
-
-
- *
- *
- *
- * xmlns*
- * attributes (rather than omitting either or both).
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * #include
of C/C++ but
- * works for XML documents as well as unparsed text files.
- * Restrictions from the 17-Sept-2002 CR draft of XInclude are as follows:
- *
- *
- *
- *
- *
- * number
instruction.
- *
- * @author Chris Burdess
- */
-abstract class AbstractNumberNode
- extends TemplateNode
-{
-
- static final int ALPHABETIC = 0;
- static final int TRADITIONAL = 1;
-
- final TemplateNode format;
- final String lang;
- final int letterValue;
- final String groupingSeparator;
- final int groupingSize;
-
- AbstractNumberNode(TemplateNode children, TemplateNode next,
- TemplateNode format, String lang,
- int letterValue, String groupingSeparator,
- int groupingSize)
- {
- super(children, next);
- this.format = format;
- this.lang = lang;
- this.letterValue = letterValue;
- this.groupingSeparator = groupingSeparator;
- this.groupingSize = groupingSize;
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- DocumentFragment fragment = doc.createDocumentFragment();
- format.apply(stylesheet, mode, context, pos, len, fragment, null);
- String f = Expr._string(context, Collections.singleton(fragment));
- String value = format(f, compute(stylesheet, context, pos, len));
- Text text = doc.createTextNode(value);
- if (nextSibling != null)
- {
- parent.insertBefore(text, nextSibling);
- }
- else
- {
- parent.appendChild(text);
- }
- // xsl:number doesn't process children
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- String format(String format, int[] number)
- {
- if (number.length == 0)
- {
- return "";
- }
- int start = 0, end = 0, len = format.length(); // region of format
- // Tokenize
- List tokens = new ArrayList((number.length * 2) + 1);
- List types = new ArrayList(tokens.size());
- while (end < len)
- {
- while (end < len && !isAlphanumeric(format.charAt(end)))
- {
- end++;
- }
- if (end > start)
- {
- tokens.add(format.substring(start, end));
- types.add(Boolean.FALSE);
- }
- start = end;
- while (end < len && isAlphanumeric(format.charAt(end)))
- {
- end++;
- }
- if (end > start)
- {
- tokens.add(format.substring(start, end));
- types.add(Boolean.TRUE);
- }
- start = end;
- }
- // Process tokens
- StringBuffer buf = new StringBuffer();
- len = tokens.size();
- int pos = 0;
- for (int i = 0; i < len; i++)
- {
- String token = (i < 0) ? "." : (String) tokens.get(i);
- boolean alpha = (i < 0) ? true :
- ((Boolean) types.get(i)).booleanValue();
- if (!alpha)
- {
- buf.append(token);
- }
- else
- {
- if (pos < number.length)
- {
- format(buf, number[pos++], token);
- if (((i + 1 == len) || (i + 2 == len)) &&
- (pos < number.length))
- {
- // More numbers than tokens, reuse last token
- i -= 2;
- }
- }
- if (pos == number.length && i < (len - 2))
- {
- // No more numbers. Skip to the end...
- i = len - 2;
- if (((Boolean) types.get(i + 1)).booleanValue())
- {
- // number formatting token, ignore
- i++;
- }
- }
- }
- }
- //System.err.println("format: '"+format+"' "+asList(number)+" = '"+buf.toString()+"'");
- return buf.toString();
- }
-
- /*List asList(int[] number)
- {
- List l = new ArrayList();
- for (int i = 0; i < number.length; i++)
- l.add(new Integer(number[i]));
- return l;
- }*/
-
- void format(StringBuffer buf, int number, String formatToken)
- {
- int len = formatToken.length();
- char c = formatToken.charAt(len - 1);
- if (Character.digit(c, 10) == 1)
- {
- // Check preceding characters
- for (int i = len - 2; i >= 0; i--)
- {
- if (formatToken.charAt(i) != (c - 1))
- {
- format(buf, number, "1");
- return;
- }
- }
- // Decimal representation
- String val = Integer.toString(number);
- for (int d = len - val.length(); d > 0; d--)
- {
- buf.append('0');
- }
- buf.append(val);
- }
- else if ("A".equals(formatToken))
- {
- buf.append(alphabetic('@', number));
- }
- else if ("a".equals(formatToken))
- {
- buf.append(alphabetic('`', number));
- }
- else if ("i".equals(formatToken))
- {
- buf.append(roman(false, number));
- }
- else if ("I".equals(formatToken))
- {
- buf.append(roman(true, number));
- }
- else
- {
- // Unknown numbering sequence
- format(buf, number, "1");
- }
- }
-
- static final boolean isAlphanumeric(char c)
- {
- switch (Character.getType(c))
- {
- case Character.DECIMAL_DIGIT_NUMBER: // Nd
- case Character.LETTER_NUMBER: // Nl
- case Character.OTHER_NUMBER: // No
- case Character.UPPERCASE_LETTER: // Lu
- case Character.LOWERCASE_LETTER: // Ll
- case Character.TITLECASE_LETTER: // Lt
- case Character.MODIFIER_LETTER: // Lm
- case Character.OTHER_LETTER: // Lo
- return true;
- default:
- return false;
- }
- }
-
- static final String alphabetic(char offset, int number)
- {
- StringBuffer buf = new StringBuffer();
- while (number > 0)
- {
- int r = number % 26;
- number = number / 26;
- buf.insert(0, (char) (offset + r));
- }
- return buf.toString();
- }
-
- static final int[] roman_numbers = {1, 5, 10, 50, 100, 500, 1000};
- static final char[] roman_chars = {'i', 'v', 'x', 'l', 'c', 'd', 'm'};
-
- static final String roman(boolean upper, int number)
- {
- StringBuffer buf = new StringBuffer();
- for (int pos = roman_numbers.length - 1; pos >= 0; pos -= 2)
- {
- int f = number / roman_numbers[pos];
- if (f != 0)
- {
- number = number % (f * roman_numbers[pos]);
- }
- if (f > 4 && f < 9)
- {
- buf.append(roman_chars[pos + 1]);
- f -= 5;
- }
- if (f == 4)
- {
- buf.append(roman_chars[pos]);
- buf.append(roman_chars[pos + 1]);
- }
- else if (f == 9)
- {
- buf.append(roman_chars[pos]);
- buf.append(roman_chars[pos + 2]);
- }
- else
- {
- for (; f > 0; f--)
- {
- buf.append(roman_chars[pos]);
- }
- }
- }
- return upper ? buf.toString().toUpperCase() : buf.toString();
- }
-
- abstract int[] compute(Stylesheet stylesheet, Node context, int pos, int len)
- throws TransformerException;
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("format=");
- buf.append(format);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/ApplyImportsNode.java b/libjava/gnu/xml/transform/ApplyImportsNode.java
deleted file mode 100644
index 4d171b7acf6..00000000000
--- a/libjava/gnu/xml/transform/ApplyImportsNode.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ApplyImportsNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-
-/**
- * A template node representing an XSLT apply-imports
instruction.
- *
- * @author Chris Burdess
- */
-final class ApplyImportsNode
- extends TemplateNode
-{
-
- ApplyImportsNode(TemplateNode children, TemplateNode next)
- {
- super(children, next);
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new ApplyImportsNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet));
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- TemplateNode t = stylesheet.getTemplate(mode, context, true);
- if (t != null)
- {
- t.apply(stylesheet, mode, context, pos, len,
- parent, nextSibling);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode, context, pos, len,
- parent, nextSibling);
- }
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/ApplyTemplatesNode.java b/libjava/gnu/xml/transform/ApplyTemplatesNode.java
deleted file mode 100644
index bf267212013..00000000000
--- a/libjava/gnu/xml/transform/ApplyTemplatesNode.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/* ApplyTemplatesNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing the XSL apply-templates
- * instruction.
- *
- * @author Chris Burdess
- */
-final class ApplyTemplatesNode
- extends TemplateNode
-{
-
- final Expr select;
- final QName mode;
- final List sortKeys;
- final List withParams;
- final boolean isDefault;
-
- ApplyTemplatesNode(TemplateNode children, TemplateNode next,
- Expr select, QName mode,
- List sortKeys, List withParams, boolean isDefault)
- {
- super(children, next);
- this.select = select;
- this.mode = mode;
- this.sortKeys = sortKeys;
- this.withParams = withParams;
- this.isDefault = isDefault;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- int len = sortKeys.size();
- List sortKeys2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet));
- }
- len = withParams.size();
- List withParams2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- withParams2.add(((WithParam) withParams.get(i)).clone(stylesheet));
- }
- return new ApplyTemplatesNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- select.clone(stylesheet),
- mode, sortKeys2, withParams2, isDefault);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Object ret = select.evaluate(context, pos, len);
- if (ret != null && ret instanceof Collection)
- {
- if (withParams != null)
- {
- // push the parameter context
- stylesheet.bindings.push(false);
- // set the parameters
- for (Iterator i = withParams.iterator(); i.hasNext(); )
- {
- WithParam p = (WithParam) i.next();
- Object value = p.getValue(stylesheet, mode, context, pos, len);
- stylesheet.bindings.set(p.name, value, false);
- }
- }
- Collection ns = (Collection) ret;
- List nodes = new ArrayList(ns);
- if (sortKeys != null)
- {
- for (Iterator i = sortKeys.iterator(); i.hasNext(); )
- {
- SortKey sortKey = (SortKey) i.next();
- sortKey.init(stylesheet, mode, context, pos, len, parent,
- nextSibling);
- }
- Collections.sort(nodes, new XSLComparator(sortKeys));
- }
- else
- {
- Collections.sort(nodes, documentOrderComparator);
- }
- int l = nodes.size();
- QName effectiveMode = isDefault ? mode : this.mode;
- for (int i = 0; i < l; i++)
- {
- Node node = (Node) nodes.get(i);
- TemplateNode t = stylesheet.getTemplate(effectiveMode, node,
- false);
- if (t != null)
- {
- if (stylesheet.debug)
- {
- System.err.println("Applying " + t);
- }
- stylesheet.current = node;
- t.apply(stylesheet, effectiveMode, node, i + 1, l,
- parent, nextSibling);
- }
- }
- if (withParams != null)
- {
- // pop the variable context
- stylesheet.bindings.pop(false);
- }
- }
- // apply-templates doesn't have processable children
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- boolean o = false;
- if (select != null)
- {
- buf.append("select=");
- buf.append(select);
- o = true;
- }
- if (mode != null)
- {
- if (o)
- {
- buf.append(',');
- }
- buf.append("mode=");
- buf.append(mode);
- }
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/AttributeNode.java b/libjava/gnu/xml/transform/AttributeNode.java
deleted file mode 100644
index c26a7f6f52b..00000000000
--- a/libjava/gnu/xml/transform/AttributeNode.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/* AttributeNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing an XSL attribute
instruction.
- *
- * @author Chris Burdess
- */
-final class AttributeNode
- extends TemplateNode
-{
-
- final TemplateNode name;
- final TemplateNode namespace;
- final Node source;
-
- AttributeNode(TemplateNode children, TemplateNode next, TemplateNode name,
- TemplateNode namespace, Node source)
- {
- super(children, next);
- this.name = name;
- this.namespace = namespace;
- this.source = source;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new AttributeNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null : next.clone(stylesheet),
- name.clone(stylesheet),
- (namespace == null) ? null :
- namespace.clone(stylesheet),
- source);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- // Create a document fragment to hold the name
- DocumentFragment fragment = doc.createDocumentFragment();
- // Apply name to the fragment
- name.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- // Use XPath string-value of fragment
- String nameValue = Expr.stringValue(fragment);
-
- String namespaceValue = null;
- if (namespace != null)
- {
- // Create a document fragment to hold the namespace
- fragment = doc.createDocumentFragment();
- // Apply namespace to the fragment
- namespace.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- // Use XPath string-value of fragment
- namespaceValue = Expr.stringValue(fragment);
- if (namespaceValue.length() == 0)
- {
- namespaceValue = null;
- }
- }
-
- String prefix = getPrefix(nameValue);
- if (namespaceValue == null)
- {
- if (prefix != null)
- {
- if (XMLConstants.XML_NS_PREFIX.equals(prefix))
- {
- namespaceValue = XMLConstants.XML_NS_URI;
- }
- else
- {
- // Resolve namespace for this prefix
- namespaceValue = source.lookupNamespaceURI(prefix);
- }
- }
- }
- else
- {
- if (prefix != null)
- {
- String ns2 = source.lookupNamespaceURI(prefix);
- if (ns2 != null && !ns2.equals(namespaceValue))
- {
- // prefix clashes, reset it
- prefix = null;
- int ci = nameValue.indexOf(':');
- nameValue = nameValue.substring(ci + 1);
- }
- }
- }
- if (prefix == null)
- {
- // Resolve prefix for this namespace
- prefix = source.lookupPrefix(namespaceValue);
- if (prefix != null)
- {
- nameValue = prefix + ":" + nameValue;
- }
- else
- {
- if (namespaceValue != null)
- {
- // Must invent a prefix
- prefix = inventPrefix(parent);
- nameValue = prefix + ":" + nameValue;
- }
- }
- }
- NamedNodeMap attrs = parent.getAttributes();
- boolean insert = true;
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceValue) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(nameValue) ||
- nameValue.startsWith("xmlns:"))
- {
- // Namespace declaration, do not output
- insert = false;
- }
- if (prefix != null && namespaceValue == null)
- {
- // Not a QName
- insert = false;
- }
- if (parent.getNodeType() == Node.ELEMENT_NODE &&
- parent.getFirstChild() != null)
- {
- // XSLT 7.1.3 Adding an attribute to an element after children have
- // been added to it is an error
- insert = false;
- }
- if (insert)
- {
- // Insert attribute
- Attr attr = (namespaceValue != null) ?
- doc.createAttributeNS(namespaceValue, nameValue) :
- doc.createAttribute(nameValue);
- if (attrs != null)
- {
- if (namespace != null)
- {
- attrs.setNamedItemNS(attr);
- }
- else
- {
- attrs.setNamedItem(attr);
- }
- }
- if (children != null)
- {
- children.apply(stylesheet, mode,
- context, pos, len,
- attr, null);
- }
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- final String getPrefix(String name)
- {
- int ci = name.indexOf(':');
- return (ci == -1) ? null : name.substring(0, ci);
- }
-
- final String inventPrefix(Node parent)
- {
- String base = "ns";
- int count = 0;
- String ret = base + Integer.toString(count);
- while (parent.lookupNamespaceURI(ret) != null)
- {
- count++;
- ret = base + Integer.toString(count);
- }
- return ret;
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("name=");
- buf.append(name);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/AttributeSet.java b/libjava/gnu/xml/transform/AttributeSet.java
deleted file mode 100644
index 3ece9c83f5e..00000000000
--- a/libjava/gnu/xml/transform/AttributeSet.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* AttributeSet.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-/**
- * An attribute-set entry in a stylesheet.
- *
- * @author Chris Burdess
- */
-final class AttributeSet
-{
-
- final TemplateNode children;
- final String name;
- final String uas;
-
- AttributeSet(TemplateNode children, String name, String uas)
- {
- this.children = children;
- this.name = name;
- this.uas = uas;
- }
-
- AttributeSet clone(Stylesheet stylesheet)
- {
- return new AttributeSet((children == null) ? null :
- children.clone(stylesheet),
- name, uas);
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/Bindings.java b/libjava/gnu/xml/transform/Bindings.java
deleted file mode 100644
index 7bea4e8231d..00000000000
--- a/libjava/gnu/xml/transform/Bindings.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/* Bindings.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathVariableResolver;
-import org.w3c.dom.Node;
-
-/**
- * The set of variable bindings in effect for a stylesheet.
- *
- * @author Chris Burdess
- */
-public class Bindings
- implements XPathVariableResolver, Cloneable
-{
-
- final Stylesheet stylesheet;
-
- /**
- * Global variables.
- */
- final LinkedList variables;
-
- /**
- * Parameter value stack.
- */
- final LinkedList parameters;
-
- Bindings(Stylesheet stylesheet)
- {
- this.stylesheet = stylesheet;
- variables = new LinkedList();
- parameters = new LinkedList();
- push(true);
- push(false);
- }
-
- public Object clone()
- {
- try
- {
- return (Bindings) super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw new Error(e.getMessage());
- }
- }
-
- void push(boolean global)
- {
- if (global)
- {
- variables.addFirst(new HashMap());
- }
- else
- {
- parameters.addFirst(new HashMap());
- }
- }
-
- void pop(boolean global)
- {
- if (global)
- {
- variables.removeFirst();
- }
- else
- {
- parameters.removeFirst();
- }
- }
-
- public boolean containsKey(String name, boolean global)
- {
- Iterator i = global ? variables.iterator() : parameters.iterator();
- while (i.hasNext())
- {
- Map ctx = (Map) i.next();
- if (ctx.containsKey(name))
- {
- return true;
- }
- }
- return false;
- }
-
- public Object get(String name, Node context, int pos, int len)
- {
- //System.err.println("bindings.get: "+name);
- //System.err.println("\t"+toString());
- Object ret = null;
- for (Iterator i = variables.iterator(); i.hasNext() && ret == null; )
- {
- Map vctx = (Map) i.next();
- ret = vctx.get(name);
- }
- if (ret == null)
- {
- for (Iterator i = parameters.iterator(); i.hasNext() && ret == null; )
- {
- Map pctx = (Map) i.next();
- ret = pctx.get(name);
- }
- }
- /*if (ret instanceof Expr && context != null)
- {
- Expr expr = (Expr) ret;
- ret = expr.evaluate(context, 1, 1);
- }*/
- if (ret instanceof Node)
- {
- ret = Collections.singleton(ret);
- }
- if (ret == null)
- {
- ret = "";
- }
- //System.err.println("\tret="+ret);
- return ret;
- }
-
- void set(String name, Object value, boolean global)
- {
- if (global)
- {
- Map context = (Map) variables.getFirst();
- context.put(name, value);
- }
- else
- {
- Map context = (Map) parameters.getFirst();
- context.put(name, value);
- }
- }
-
- public Object resolveVariable(QName qName)
- {
- return get(qName.toString(), null, 1, 1);
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- boolean next = false;
- Collection seen = new HashSet();
- buf.append('{');
- for (Iterator i = variables.iterator(); i.hasNext(); )
- {
- Map ctx = (Map) i.next();
- for (Iterator j = ctx.entrySet().iterator(); j.hasNext(); )
- {
- if (next)
- {
- buf.append(',');
- }
- else
- {
- next = true;
- }
- Map.Entry entry = (Map.Entry) j.next();
- Object key = entry.getKey();
- if (!seen.contains(key))
- {
- buf.append(key);
- buf.append('=');
- buf.append(entry.getValue());
- seen.add(key);
- }
- }
- }
- for (Iterator i = parameters.iterator(); i.hasNext(); )
- {
- Map ctx = (Map) i.next();
- for (Iterator j = ctx.entrySet().iterator(); j.hasNext(); )
- {
- if (next)
- {
- buf.append(',');
- }
- else
- {
- next = true;
- }
- Map.Entry entry = (Map.Entry) j.next();
- Object key = entry.getKey();
- if (!seen.contains(key))
- {
- buf.append(key);
- buf.append('=');
- buf.append(entry.getValue());
- seen.add(key);
- }
- }
- }
- buf.append('}');
- return buf.toString();
- }
-}
diff --git a/libjava/gnu/xml/transform/CallTemplateNode.java b/libjava/gnu/xml/transform/CallTemplateNode.java
deleted file mode 100644
index bb494084f7c..00000000000
--- a/libjava/gnu/xml/transform/CallTemplateNode.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/* CallTemplateNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-
-/**
- * A template node representing the XSL call-template
- * instruction.
- *
- * @author Chris Burdess
- */
-final class CallTemplateNode
- extends TemplateNode
-{
-
- final QName name;
- final List withParams;
-
- CallTemplateNode(TemplateNode children, TemplateNode next,
- QName name, List withParams)
- {
- super(children, next);
- this.name = name;
- this.withParams = withParams;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- int len = withParams.size();
- List withParams2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- withParams2.add(((WithParam) withParams.get(i)).clone(stylesheet));
- }
- return new CallTemplateNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- name, withParams2);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- if (withParams != null)
- {
- // push the parameter context
- stylesheet.bindings.push(false);
- // set the parameters
- for (Iterator i = withParams.iterator(); i.hasNext(); )
- {
- WithParam p = (WithParam) i.next();
- Object value = p.getValue(stylesheet, mode, context, pos, len);
- stylesheet.bindings.set(p.name, value, false);
- }
- }
- TemplateNode t = stylesheet.getTemplate(mode, name);
- if (t != null)
- {
- t.apply(stylesheet, mode, context, pos, len,
- parent, nextSibling);
- }
- if (withParams != null)
- {
- // pop the variable context
- stylesheet.bindings.pop(false);
- }
- // call-template doesn't have processable children
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("name=");
- buf.append(name);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/ChooseNode.java b/libjava/gnu/xml/transform/ChooseNode.java
deleted file mode 100644
index 4a34712e43c..00000000000
--- a/libjava/gnu/xml/transform/ChooseNode.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ChooseNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-
-/**
- * A template node representing an XSL choose
instruction.
- *
- * @author Chris Burdess
- */
-final class ChooseNode
- extends TemplateNode
-{
-
- ChooseNode(TemplateNode children, TemplateNode next)
- {
- super(children, next);
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new ChooseNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet));
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- if (children != null)
- {
- children.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/CommentNode.java b/libjava/gnu/xml/transform/CommentNode.java
deleted file mode 100644
index 969555e8419..00000000000
--- a/libjava/gnu/xml/transform/CommentNode.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/* CommentNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing the XSL comment
instruction.
- *
- * @author Chris Burdess
- */
-final class CommentNode
- extends TemplateNode
-{
-
- CommentNode(TemplateNode children, TemplateNode next)
- {
- super(children, next);
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new CommentNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet));
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- String value = "";
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- if (children != null)
- {
- // Create a document fragment to hold the text
- DocumentFragment fragment = doc.createDocumentFragment();
- // Apply children to the fragment
- children.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- // Use XPath string-value of fragment
- value = Expr.stringValue(fragment);
- }
- Comment comment = doc.createComment(value);
- // Insert into result tree
- if (nextSibling != null)
- {
- parent.insertBefore(comment, nextSibling);
- }
- else
- {
- parent.appendChild(comment);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/CopyNode.java b/libjava/gnu/xml/transform/CopyNode.java
deleted file mode 100644
index b2c81b725ec..00000000000
--- a/libjava/gnu/xml/transform/CopyNode.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/* CopyNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Iterator;
-import java.util.StringTokenizer;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * A template node representing the XSL copy
instruction.
- *
- * @author Chris Burdess
- */
-final class CopyNode
- extends TemplateNode
-{
-
- final String uas;
-
- CopyNode(TemplateNode children, TemplateNode next, String uas)
- {
- super(children, next);
- this.uas = uas;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new CopyNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- uas);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Node copy = parent;
- switch (context.getNodeType())
- {
- case Node.TEXT_NODE:
- case Node.ATTRIBUTE_NODE:
- case Node.ELEMENT_NODE:
- case Node.PROCESSING_INSTRUCTION_NODE:
- case Node.COMMENT_NODE:
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- copy = context.cloneNode(false);
- copy = doc.adoptNode(copy);
- if (copy.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- if (parent.getFirstChild() != null)
- {
- // Ignore attempt to add attribute after children
- }
- else
- {
- NamedNodeMap attrs = parent.getAttributes();
- if (attrs != null)
- {
- attrs.setNamedItemNS(copy);
- }
- }
- }
- else
- {
- if (nextSibling != null)
- {
- parent.insertBefore(copy, nextSibling);
- }
- else
- {
- parent.appendChild(copy);
- }
- }
- }
- if (uas != null)
- {
- StringTokenizer st = new StringTokenizer(uas, " ");
- while (st.hasMoreTokens())
- {
- addAttributeSet(stylesheet, mode, context, pos, len,
- copy, null, st.nextToken());
- }
- }
- if (children != null)
- {
- children.apply(stylesheet, mode,
- context, pos, len,
- copy, null);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- void addAttributeSet(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling, String attributeSet)
- throws TransformerException
- {
- for (Iterator i = stylesheet.attributeSets.iterator(); i.hasNext(); )
- {
- AttributeSet as = (AttributeSet) i.next();
- if (!as.name.equals(attributeSet))
- {
- continue;
- }
- if (as.uas != null)
- {
- StringTokenizer st = new StringTokenizer(as.uas, " ");
- while (st.hasMoreTokens())
- {
- addAttributeSet(stylesheet, mode, context, pos, len,
- parent, nextSibling, st.nextToken());
- }
- }
- if (as.children != null)
- {
- as.children.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/CopyOfNode.java b/libjava/gnu/xml/transform/CopyOfNode.java
deleted file mode 100644
index 4e09eeffb63..00000000000
--- a/libjava/gnu/xml/transform/CopyOfNode.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/* CopyOfNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing an XSLT copy-of
instruction.
- *
- * @author Chris Burdess
- */
-final class CopyOfNode
- extends TemplateNode
-{
-
- final Expr select;
-
- CopyOfNode(TemplateNode children, TemplateNode next, Expr select)
- {
- super(children, next);
- this.select = select;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new CopyOfNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- select.clone(stylesheet));
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Object ret = select.evaluate(context, pos, len);
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- if (ret instanceof Collection)
- {
- Collection ns = (Collection) ret;
- List list = new ArrayList(ns);
- Collections.sort(list, documentOrderComparator);
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- Node src = (Node) i.next();
- short nodeType = src.getNodeType();
- if (nodeType == Node.DOCUMENT_NODE)
- {
- // Use document element
- src = ((Document) src).getDocumentElement();
- if (src == null)
- {
- continue;
- }
- nodeType = Node.ELEMENT_NODE;
- }
- else if (nodeType == Node.ATTRIBUTE_NODE)
- {
- if (parent.getFirstChild() != null)
- {
- // Ignore attempt to add attribute after children
- continue;
- }
- }
- if (parent.getNodeType() == Node.ATTRIBUTE_NODE &&
- nodeType != Node.TEXT_NODE &&
- nodeType != Node.ENTITY_REFERENCE_NODE)
- {
- // Ignore
- continue;
- }
- Node node = src.cloneNode(true);
- node = doc.adoptNode(node);
- if (nodeType == Node.ATTRIBUTE_NODE)
- {
- NamedNodeMap attrs = parent.getAttributes();
- if (attrs != null)
- {
- attrs.setNamedItemNS(node);
- }
- }
- else
- {
- if (nextSibling != null)
- {
- parent.insertBefore(node, nextSibling);
- }
- else
- {
- parent.appendChild(node);
- }
- }
- }
- }
- else
- {
- String value = Expr._string(context, ret);
- if (value != null && value.length() > 0)
- {
- Text textNode = doc.createTextNode(value);
- if (nextSibling != null)
- {
- parent.insertBefore(textNode, nextSibling);
- }
- else
- {
- parent.appendChild(textNode);
- }
- }
- }
- // copy-of doesn't process children
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("select=");
- buf.append(select);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/CurrentFunction.java b/libjava/gnu/xml/transform/CurrentFunction.java
deleted file mode 100644
index 845793ac795..00000000000
--- a/libjava/gnu/xml/transform/CurrentFunction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* CurrentFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Collections;
-import java.util.List;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-
-/**
- * The XSLT current()
function.
- *
- * @author Chris Burdess
- */
-final class CurrentFunction
- extends Expr
- implements Function, XPathFunction
-{
-
- final Stylesheet stylesheet;
-
- CurrentFunction(Stylesheet stylesheet)
- {
- this.stylesheet = stylesheet;
- }
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- // We can't do anything useful here.
- // So much for the JAXP API...
- return Collections.EMPTY_SET;
- }
-
- public void setArguments(List args)
- {
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- return Collections.singleton(stylesheet.current);
- }
-
- public Expr clone(Object context)
- {
- Stylesheet s = stylesheet;
- if (context instanceof Stylesheet)
- {
- s = (Stylesheet) context;
- }
- return new CurrentFunction(s);
- }
-
- public String toString()
- {
- return "current()";
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/DOMSourceLocator.java b/libjava/gnu/xml/transform/DOMSourceLocator.java
deleted file mode 100644
index 9bc8fb1b6c8..00000000000
--- a/libjava/gnu/xml/transform/DOMSourceLocator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* DOMSourceLocator.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.transform.dom.DOMLocator;
-import org.w3c.dom.Node;
-
-/**
- * Simple DOMLocator implementation.
- *
- * @author Chris Burdess
- */
-class DOMSourceLocator
- implements DOMLocator
-{
-
- final Node node;
-
- DOMSourceLocator(Node node)
- {
- this.node = node;
- }
-
- public Node getOriginatingNode()
- {
- return node;
- }
-
- public String getPublicId()
- {
- return null;
- }
-
- public String getSystemId()
- {
- return null;
- }
-
- public int getLineNumber()
- {
- return -1;
- }
-
- public int getColumnNumber()
- {
- return -1;
- }
-
-}
diff --git a/libjava/gnu/xml/transform/DocumentFunction.java b/libjava/gnu/xml/transform/DocumentFunction.java
deleted file mode 100644
index 22dac75db12..00000000000
--- a/libjava/gnu/xml/transform/DocumentFunction.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/* DocumentFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeSet;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Constant;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-import gnu.xml.xpath.IdFunction;
-
-/**
- * The XSLT document()
function.
- *
- * @author Chris Burdess
- */
-final class DocumentFunction
- extends Expr
- implements Function, XPathFunction
-{
-
- final Stylesheet stylesheet;
- final Node base;
- List args;
- List values;
-
- DocumentFunction(Stylesheet stylesheet, Node base)
- {
- this.stylesheet = stylesheet;
- this.base = base;
- }
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- values = args;
- return evaluate(null, 1, 1);
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- int arity = args.size();
- if (values == null)
- {
- values = new ArrayList(arity);
- for (int i = 0; i < arity; i++)
- {
- Expr arg = (Expr) args.get(i);
- values.add(arg.evaluate(context, pos, len));
- }
- }
- Object ret;
- switch (arity)
- {
- case 1:
- Object arg = values.get(0);
- if (arg instanceof Collection)
- {
- Collection ns = (Collection) arg;
- Collection acc = new TreeSet();
- for (Iterator i = ns.iterator(); i.hasNext(); )
- {
- Node node = (Node) i.next();
- String s = Expr.stringValue(node);
- acc.addAll(document(s, node.getBaseURI()));
- }
- ret = acc;
- }
- else
- {
- String s = Expr._string(context, arg);
- ret = document(s, base.getBaseURI());
- }
- break;
- case 2:
- Object arg1 = values.get(0);
- Object arg2 = values.get(1);
- if (!(arg2 instanceof Collection))
- {
- throw new RuntimeException("second argument is not a node-set");
- }
- Collection arg2ns = (Collection) arg2;
- String base2 = arg2ns.isEmpty() ? null :
- ((Node) arg2ns.iterator().next()).getBaseURI();
- if (arg1 instanceof Collection)
- {
- Collection arg1ns = (Collection) arg1;
- Collection acc = new TreeSet();
- for (Iterator i = arg1ns.iterator(); i.hasNext(); )
- {
- Node node = (Node) i.next();
- String s = Expr.stringValue(node);
- acc.addAll(document(s, base2));
- }
- ret = acc;
- }
- else
- {
- String s = Expr._string(context, arg1);
- ret = document(s, base2);
- }
- break;
- default:
- throw new RuntimeException("invalid arity");
- }
- values = null;
- return ret;
- }
-
- /**
- * The XSL document
function.
- * @see XSLT 12.1
- * @param uri the URI from which to retrieve nodes
- * @param base the base URI for relative URIs
- */
- Collection document(String uri, String base)
- {
- if ("".equals(uri) || uri == null)
- {
- uri = this.base.getBaseURI();
- }
-
- // Get fragment
- Expr fragment = null;
- int hi = uri.indexOf('#');
- if (hi != -1)
- {
- String f = uri.substring(hi + 1);
- uri = uri.substring(0, hi);
- // TODO handle xpointer() here
- // this only handles IDs
- fragment = new IdFunction(new Constant(f));
- }
-
- // Get document source
- try
- {
- DOMSource source;
- XSLURIResolver resolver = stylesheet.factory.resolver;
- synchronized (resolver)
- {
- if (stylesheet.transformer != null)
- {
- resolver.setUserResolver(stylesheet.transformer.uriResolver);
- resolver.setUserListener(stylesheet.transformer.errorListener);
- }
- source = resolver.resolveDOM(null, base, uri);
- }
- Node node = source.getNode();
- if (fragment == null)
- {
- return Collections.singleton(node);
- }
- else
- {
- Object ret = fragment.evaluate(node, 1, 1);
- if (!(ret instanceof Collection))
- {
- // XXX Report error?
- return Collections.EMPTY_SET;
- }
- return (Collection) ret;
- }
- }
- catch (TransformerException e)
- {
- String msg = "can't open " + uri;
- if (base != null)
- {
- msg += " with base " + base;
- }
- throw new RuntimeException(msg);
- }
- }
-
- public Expr clone(Object context)
- {
- Stylesheet s = stylesheet;
- if (context instanceof Stylesheet)
- {
- s = (Stylesheet) context;
- }
- DocumentFunction f = new DocumentFunction(s, base);
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
diff --git a/libjava/gnu/xml/transform/ElementAvailableFunction.java b/libjava/gnu/xml/transform/ElementAvailableFunction.java
deleted file mode 100644
index 7cf00d3252d..00000000000
--- a/libjava/gnu/xml/transform/ElementAvailableFunction.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/* ElementAvailableFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.TreeSet;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-
-/**
- * The XSLT element-available
function.
- *
- * @author Chris Burdess
- */
-class ElementAvailableFunction
- extends Expr
- implements Function, XPathFunction
-{
-
- static final Collection elements;
- static
- {
- TreeSet acc = new TreeSet();
- acc.add("stylesheet");
- acc.add("template");
- acc.add("param");
- acc.add("variable");
- acc.add("include");
- acc.add("import");
- acc.add("output");
- acc.add("preserve-space");
- acc.add("strip-space");
- acc.add("key");
- acc.add("decimal-format");
- acc.add("namespace-alias");
- acc.add("attribute-set");
- acc.add("apply-templates");
- acc.add("call-template");
- acc.add("value-of");
- acc.add("for-each");
- acc.add("if");
- acc.add("choose");
- acc.add("when");
- acc.add("otherwise");
- acc.add("element");
- acc.add("attribute");
- acc.add("text");
- acc.add("copy");
- acc.add("processing-instruction");
- acc.add("comment");
- acc.add("number");
- acc.add("copy-of");
- acc.add("message");
- acc.add("sort");
- acc.add("with-param");
- acc.add("fallback");
- acc.add("apply-imports");
- elements = Collections.unmodifiableSet(acc);
- }
-
- final NamespaceContext nsctx;
- List args;
-
- ElementAvailableFunction(NamespaceContext nsctx)
- {
- this.nsctx = nsctx;
- }
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- // Useless...
- return Collections.EMPTY_SET;
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Expr arg = (Expr) args.get(0);
- Object val = arg.evaluate(context, pos, len);
- String name = _string(context, val);
- String prefix, localName, uri;
- int ci = name.indexOf(':');
- if (ci == -1)
- {
- prefix = null;
- localName = name;
- }
- else
- {
- prefix = name.substring(0, ci);
- localName = name.substring(ci + 1);
- }
- uri = nsctx.getNamespaceURI(prefix);
- if (Stylesheet.XSL_NS.equals(uri))
- {
- return elements.contains(localName) ?
- Boolean.TRUE : Boolean.FALSE;
- // TODO extension elements
- }
- return Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- NamespaceContext n = nsctx;
- if (context instanceof NamespaceContext)
- {
- n = (NamespaceContext) context;
- }
- ElementAvailableFunction f = new ElementAvailableFunction(n);
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/ElementNode.java b/libjava/gnu/xml/transform/ElementNode.java
deleted file mode 100644
index 3609f0e0c19..00000000000
--- a/libjava/gnu/xml/transform/ElementNode.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/* ElementNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing an XSL element
instruction.
- *
- * @author Chris Burdess
- */
-final class ElementNode
- extends TemplateNode
-{
-
- final TemplateNode name;
- final TemplateNode namespace;
- final String uas;
- final Node source;
- final Collection elementExcludeResultPrefixes;
-
- ElementNode(TemplateNode children, TemplateNode next, TemplateNode name,
- TemplateNode namespace, String uas, Node source)
- {
- super(children, next);
- this.name = name;
- this.namespace = namespace;
- this.uas = uas;
- this.source = source;
- 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;
- }
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new ElementNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- name.clone(stylesheet),
- (namespace == null) ? null :
- namespace.clone(stylesheet),
- uas, source);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- // Create a document fragment to hold the name
- DocumentFragment fragment = doc.createDocumentFragment();
- // Apply name to the fragment
- name.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- // Use XPath string-value of fragment
- String nameValue = Expr.stringValue(fragment);
-
- String namespaceValue = null;
- if (namespace != null)
- {
- // Create a document fragment to hold the namespace
- fragment = doc.createDocumentFragment();
- // Apply namespace to the fragment
- namespace.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- // Use XPath string-value of fragment
- namespaceValue = Expr.stringValue(fragment);
- if (namespaceValue.length() == 0)
- {
- namespaceValue = null;
- }
- }
-
- String prefix = getPrefix(nameValue);
- if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix))
- {
- int ci = nameValue.indexOf(':');
- nameValue = nameValue.substring(ci + 1);
- }
- else
- {
- // Namespace aliasing
- if (prefix == null)
- {
- prefix = "#default";
- }
- String resultPrefix =
- (String) stylesheet.namespaceAliases.get(prefix);
- if (resultPrefix != null)
- {
- if ("#default".equals(resultPrefix))
- {
- resultPrefix = null;
- }
- namespaceValue = source.lookupNamespaceURI(resultPrefix);
- }
- if (prefix == "#default")
- {
- prefix = null;
- }
- // Look up ordinary namespace for this prefix
- if (namespaceValue == null)
- {
- if (XMLConstants.XML_NS_PREFIX.equals(prefix))
- {
- namespaceValue = XMLConstants.XML_NS_URI;
- }
- else
- {
- // Resolve namespace for this prefix
- namespaceValue = source.lookupNamespaceURI(prefix);
- }
- }
- /*if (prefix == null)
- {
- // Resolve prefix for this namespace
- prefix = parent.lookupPrefix(namespaceValue);
- if (prefix != null)
- {
- nameValue = prefix + ":" + nameValue;
- }
- }*/
- }
- // Create element
- Element element = (namespaceValue != null) ?
- doc.createElementNS(namespaceValue, nameValue) :
- doc.createElement(nameValue);
- if (nextSibling != null)
- {
- parent.insertBefore(element, nextSibling);
- }
- else
- {
- parent.appendChild(element);
- }
- stylesheet.addNamespaceNodes(source, element, doc,
- elementExcludeResultPrefixes);
- if (uas != null)
- {
- StringTokenizer st = new StringTokenizer(uas, " ");
- while (st.hasMoreTokens())
- {
- addAttributeSet(stylesheet, mode, context, pos, len,
- element, null, st.nextToken());
- }
- }
- if (children != null)
- {
- children.apply(stylesheet, mode,
- context, pos, len,
- element, null);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- final String getPrefix(String name)
- {
- int ci = name.indexOf(':');
- return (ci == -1) ? null : name.substring(0, ci);
- }
-
- void addAttributeSet(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling, String attributeSet)
- throws TransformerException
- {
- for (Iterator i = stylesheet.attributeSets.iterator(); i.hasNext(); )
- {
- AttributeSet as = (AttributeSet) i.next();
- if (!as.name.equals(attributeSet))
- {
- continue;
- }
- if (as.uas != null)
- {
- StringTokenizer st = new StringTokenizer(as.uas, " ");
- while (st.hasMoreTokens())
- {
- addAttributeSet(stylesheet, mode, context, pos, len,
- parent, nextSibling, st.nextToken());
- }
- }
- if (as.children != null)
- {
- as.children.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("name=");
- buf.append(name);
- if (uas != null)
- {
- buf.append(",uas=");
- buf.append(uas);
- }
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/ErrorListenerErrorHandler.java b/libjava/gnu/xml/transform/ErrorListenerErrorHandler.java
deleted file mode 100644
index d79bb15467a..00000000000
--- a/libjava/gnu/xml/transform/ErrorListenerErrorHandler.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/* ErrorListenerErrorHandler.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.TransformerException;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-/**
- * An ErrorHandler that wraps an ErrorListener.
- *
- * @author Chris Burdess
- */
-class ErrorListenerErrorHandler
- implements ErrorHandler
-{
-
- final ErrorListener listener;
-
- ErrorListenerErrorHandler(ErrorListener listener)
- {
- this.listener = listener;
- }
-
- public void warning(SAXParseException e)
- throws SAXException
- {
- try
- {
- listener.warning(new TransformerException(e));
- }
- catch (TransformerException e2)
- {
- throw new SAXException(e2);
- }
- }
-
- public void error(SAXParseException e)
- throws SAXException
- {
- try
- {
- listener.error(new TransformerException(e));
- }
- catch (TransformerException e2)
- {
- throw new SAXException(e2);
- }
- }
-
- public void fatalError(SAXParseException e)
- throws SAXException
- {
- try
- {
- listener.fatalError(new TransformerException(e));
- }
- catch (TransformerException e2)
- {
- throw new SAXException(e2);
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/ForEachNode.java b/libjava/gnu/xml/transform/ForEachNode.java
deleted file mode 100644
index fd9797dd474..00000000000
--- a/libjava/gnu/xml/transform/ForEachNode.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/* ForEachNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing an XSLT for-each
instruction.
- *
- * @author Chris Burdess
- */
-final class ForEachNode
- extends TemplateNode
-{
-
- final Expr select;
- final List sortKeys;
-
- ForEachNode(TemplateNode children, TemplateNode next, Expr select,
- List sortKeys)
- {
- super(children, next);
- this.select = select;
- this.sortKeys = sortKeys;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- int len = sortKeys.size();
- List sortKeys2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet));
- }
- return new ForEachNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- select.clone(stylesheet),
- sortKeys2);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- if (children != null)
- {
- // Set current template to null
- Template saved = stylesheet.currentTemplate;
- stylesheet.currentTemplate = null;
- Object ret = select.evaluate(context, pos, len);
- //System.err.println(toString() + ": " + context+" -> "+ret);
- if (ret instanceof Collection)
- {
- Collection ns = (Collection) ret;
- List list = new ArrayList(ns);
- if (sortKeys != null)
- {
- for (Iterator i = sortKeys.iterator(); i.hasNext(); )
- {
- SortKey sortKey = (SortKey) i.next();
- sortKey.init(stylesheet, mode, context, pos, len, parent,
- nextSibling);
- }
- Collections.sort(list, new XSLComparator(sortKeys));
- }
- else
- {
- Collections.sort(list, documentOrderComparator);
- }
- // Perform children for each node
- int l = list.size();
- int p = 1;
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- Node node = (Node) i.next();
- stylesheet.current = node;
- children.apply(stylesheet, mode,
- node, p++, l,
- parent, nextSibling);
- }
- }
- // Restore current template
- stylesheet.currentTemplate = saved;
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("select=");
- buf.append(select);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/FormatNumberFunction.java b/libjava/gnu/xml/transform/FormatNumberFunction.java
deleted file mode 100644
index aaa015b4ae9..00000000000
--- a/libjava/gnu/xml/transform/FormatNumberFunction.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/* FormatNumberFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-
-/**
- * The XSLT format-number()
function.
- *
- * @author Chris Burdess
- */
-final class FormatNumberFunction
- extends Expr
- implements XPathFunction, Function
-{
-
- final Stylesheet stylesheet;
- List args;
-
- FormatNumberFunction(Stylesheet stylesheet)
- {
- this.stylesheet = stylesheet;
- }
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- // Useless...
- return Collections.EMPTY_SET;
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- int arity = args.size();
- List values = new ArrayList(arity);
- for (int i = 0; i < arity; i++)
- {
- Expr arg = (Expr) args.get(i);
- values.add(arg.evaluate(context, pos, len));
- }
- double number = _number(context, values.get(0));
- String pattern = _string(context, values.get(1));
- // Currency symbol ¤ is not supposed to be present
- if (pattern.indexOf('\u00a4') != -1)
- {
- // Replace with $ (Xalan does this)
- pattern = pattern.replace('\u00a4', '$');
- }
- String dfName = null;
- if (arity > 2)
- {
- dfName = _string(context, values.get(2));
- // otherwise the default decimal-format will be used
- }
- DecimalFormat df = (DecimalFormat) stylesheet.decimalFormats.get(dfName);
- if (df == null)
- {
- throw new IllegalArgumentException("No such decimal-format: " +
- dfName);
- }
- df.applyLocalizedPattern(pattern);
- return df.format(number);
- }
-
- public Expr clone(Object context)
- {
- Stylesheet s = stylesheet;
- if (context instanceof Stylesheet)
- {
- s = (Stylesheet) context;
- }
- FormatNumberFunction f = new FormatNumberFunction(s);
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/FunctionAvailableFunction.java b/libjava/gnu/xml/transform/FunctionAvailableFunction.java
deleted file mode 100644
index b7dfb6192ff..00000000000
--- a/libjava/gnu/xml/transform/FunctionAvailableFunction.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/* FunctionAvailableFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.TreeSet;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-
-/**
- * The XSLT function-available
function.
- *
- * @author Chris Burdess
- */
-class FunctionAvailableFunction
- extends Expr
- implements Function, XPathFunction
-{
-
- static final Collection xsltFunctions;
- static final Collection xpathFunctions;
- static
- {
- TreeSet acc = new TreeSet();
- acc.add("document");
- acc.add("key");
- acc.add("format-number");
- acc.add("current");
- acc.add("unparsed-entity-uri");
- acc.add("generate-id");
- acc.add("system-property");
- acc.add("element-available");
- acc.add("function-available");
- xsltFunctions = Collections.unmodifiableSet(acc);
- acc = new TreeSet();
- acc.add("boolean");
- acc.add("ceiling");
- acc.add("concat");
- acc.add("contains");
- acc.add("count");
- acc.add("false");
- acc.add("floor");
- acc.add("id");
- acc.add("lang");
- acc.add("last");
- acc.add("local-name");
- acc.add("name");
- acc.add("namespace-uri");
- acc.add("normalize-space");
- acc.add("not");
- acc.add("number");
- acc.add("position");
- acc.add("round");
- acc.add("starts-with");
- acc.add("string");
- acc.add("string-length");
- acc.add("substring-after");
- acc.add("substring-before");
- acc.add("substring");
- acc.add("sum");
- acc.add("translate");
- acc.add("true");
- xpathFunctions = Collections.unmodifiableSet(acc);
- }
-
- final NamespaceContext nsctx;
- List args;
-
- FunctionAvailableFunction(NamespaceContext nsctx)
- {
- this.nsctx = nsctx;
- }
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- // Useless...
- return Collections.EMPTY_SET;
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Expr arg = (Expr) args.get(0);
- Object val = arg.evaluate(context, pos, len);
- String name = _string(context, val);
- String prefix, localName, uri;
- int ci = name.indexOf(':');
- if (ci == -1)
- {
- prefix = null;
- localName = name;
- }
- else
- {
- prefix = name.substring(0, ci);
- localName = name.substring(ci + 1);
- }
- uri = nsctx.getNamespaceURI(prefix);
- if (uri == null)
- {
- return xsltFunctions.contains(localName) ||
- xpathFunctions.contains(localName) ?
- Boolean.TRUE : Boolean.FALSE;
- // TODO extension functions
- }
- return Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- NamespaceContext n = nsctx;
- if (context instanceof NamespaceContext)
- {
- n = (NamespaceContext) context;
- }
- FunctionAvailableFunction f = new FunctionAvailableFunction(n);
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/GenerateIdFunction.java b/libjava/gnu/xml/transform/GenerateIdFunction.java
deleted file mode 100644
index a7682c91802..00000000000
--- a/libjava/gnu/xml/transform/GenerateIdFunction.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* GenerateIdFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-
-/**
- * The XSLT generate-id()
function.
- *
- * @author Chris Burdess
- */
-final class GenerateIdFunction
- extends Expr
- implements XPathFunction, Function
-{
-
- List args;
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- // Useless...
- return Collections.EMPTY_SET;
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- int arity = args.size();
- List values = new ArrayList(arity);
- for (int i = 0; i < arity; i++)
- {
- Expr arg = (Expr) args.get(i);
- values.add(arg.evaluate(context, pos, len));
- }
- Node node;
- Collection ns = (arity == 0) ? Collections.EMPTY_SET :
- (Collection) values.get(0);
- if (ns.isEmpty())
- {
- node = context;
- }
- else
- {
- List list = new ArrayList(ns);
- Collections.sort(list, documentOrderComparator);
- node = (Node) list.get(0);
- }
-
- String name = node.getNodeName();
- int index = 0, depth = 0;
- for (Node ctx = node.getPreviousSibling(); ctx != null;
- ctx = ctx.getPreviousSibling())
- {
- index++;
- }
- for (Node ctx = node.getParentNode(); ctx != null;
- ctx = ctx.getParentNode())
- {
- depth++;
- }
- return name + "-" + index + "-" + depth;
- }
-
- public Expr clone(Object context)
- {
- GenerateIdFunction f = new GenerateIdFunction();
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/IfNode.java b/libjava/gnu/xml/transform/IfNode.java
deleted file mode 100644
index f277cce07b9..00000000000
--- a/libjava/gnu/xml/transform/IfNode.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* IfNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing an XSL if
instruction.
- *
- * @author Chris Burdess
- */
-final class IfNode
- extends TemplateNode
-{
-
- final Expr test;
-
- IfNode(TemplateNode children, TemplateNode next, Expr test)
- {
- super(children, next);
- this.test = test;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new IfNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- test.clone(stylesheet));
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Object ret = test.evaluate(context, pos, len);
- boolean success = (ret instanceof Boolean) ?
- ((Boolean) ret).booleanValue() :
- Expr._boolean(context, ret);
- if (success)
- {
- if (children != null)
- {
- children.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("test=");
- buf.append(test);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/Key.java b/libjava/gnu/xml/transform/Key.java
deleted file mode 100644
index 72bd90aedb0..00000000000
--- a/libjava/gnu/xml/transform/Key.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Key.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Pattern;
-
-/**
- * An XSL key.
- *
- * @author Chris Burdess
- */
-class Key
-{
-
- final QName name;
- final Pattern match;
- final Expr use;
-
- Key(QName name, Pattern match, Expr use)
- {
- this.name = name;
- this.match = match;
- this.use = use;
- }
-
- Key clone(Stylesheet stylesheet)
- {
- return new Key(name,
- (Pattern) match.clone(stylesheet),
- use.clone(stylesheet));
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/KeyFunction.java b/libjava/gnu/xml/transform/KeyFunction.java
deleted file mode 100644
index eb842f289c9..00000000000
--- a/libjava/gnu/xml/transform/KeyFunction.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/* KeyFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-import gnu.xml.xpath.Pattern;
-
-/**
- * The XSLT key()
function.
- *
- * @author Chris Burdess
- */
-final class KeyFunction
- extends Pattern
- implements XPathFunction, Function
-{
-
- final Stylesheet stylesheet;
- List args;
-
- KeyFunction(Stylesheet stylesheet)
- {
- this.stylesheet = stylesheet;
- }
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- // Useless...
- return Collections.EMPTY_SET;
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public boolean matches(Node context)
- {
- Object ret = evaluate(context, 1, 1);
- return !((Collection) ret).isEmpty();
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- // Evaluate arguments
- int arity = args.size();
- List values = new ArrayList(arity);
- for (int i = 0; i < arity; i++)
- {
- Expr arg = (Expr) args.get(i);
- values.add(arg.evaluate(context, pos, len));
- }
- // Get key name
- QName keyName = QName.valueOf(_string(context, values.get(0)));
- // Expand qualified name
- String uri = keyName.getNamespaceURI();
- String prefix = keyName.getPrefix();
- if ((uri == null || uri.length() == 0) &&
- (prefix != null && prefix.length() > 0))
- {
- uri = stylesheet.getNamespaceURI(prefix);
- if (uri != null && uri.length() > 0)
- {
- String localName = keyName.getLocalPart();
- keyName = new QName(uri, localName, prefix);
- }
- }
- // Compute matching key set
- Collection keySet = new LinkedList();
- for (Iterator i = stylesheet.keys.iterator(); i.hasNext(); )
- {
- Key key = (Key) i.next();
- if (key.name.equals(keyName))
- {
- keySet.add(key);
- }
- }
- // Get target
- Object target = values.get(1);
- Collection acc = new LinkedHashSet();
- Document doc = (context instanceof Document) ? (Document) context :
- context.getOwnerDocument();
- if (target instanceof Collection)
- {
- for (Iterator i = ((Collection) target).iterator(); i.hasNext(); )
- {
- String val = Expr.stringValue((Node) i.next());
- addKeyNodes(doc, keySet, val, acc);
- }
- }
- else
- {
- String val = Expr._string(context, target);
- addKeyNodes(doc, keySet, val, acc);
- }
- List ret = new ArrayList(acc);
- Collections.sort(ret, documentOrderComparator);
- return ret;
- }
-
- final void addKeyNodes(Node node, Collection keySet,
- String value, Collection acc)
- {
- addKeyNodeIfMatch(node, keySet, value, acc);
- // Apply children
- for (Node ctx = node.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- addKeyNodes(ctx, keySet, value, acc);
- }
- }
-
- final void addKeyNodeIfMatch(Node node, Collection keySet,
- String value, Collection acc)
- {
- for (Iterator i = keySet.iterator(); i.hasNext(); )
- {
- Key key = (Key) i.next();
- if (key.match.matches(node))
- {
- Object eval = key.use.evaluate(node, 1, 1);
- if (eval instanceof Collection)
- {
- for (Iterator j = ((Collection) eval).iterator();
- j.hasNext(); )
- {
- String keyValue = Expr.stringValue((Node) j.next());
- if (value.equals(keyValue))
- {
- acc.add(node);
- return;
- }
- }
- }
- else
- {
- String keyValue = Expr._string(node, eval);
- if (value.equals(keyValue))
- {
- acc.add(node);
- return;
- }
- }
- }
- }
- }
-
- public Expr clone(Object context)
- {
- Stylesheet s = stylesheet;
- if (context instanceof Stylesheet)
- {
- s = (Stylesheet) context;
- }
- KeyFunction f = new KeyFunction(s);
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/LiteralNode.java b/libjava/gnu/xml/transform/LiteralNode.java
deleted file mode 100644
index b053727d7f3..00000000000
--- a/libjava/gnu/xml/transform/LiteralNode.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/* LiteralNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.StringTokenizer;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * A template node that copies a DOM node in the template to the result
- * tree.
- *
- * @author Chris Burdess
- */
-final class LiteralNode
- extends TemplateNode
-{
-
- /**
- * The source node in the XSL template.
- */
- final Node source;
-
- final Collection elementExcludeResultPrefixes;
-
- LiteralNode(TemplateNode children, TemplateNode next, Node source)
- {
- super(children, next);
- 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)
- {
- return new LiteralNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- source);
- }
-
- 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--;
- }
- }
- }
- result = doc.adoptNode(result);
- if (result == null)
- {
- String msg = "Error adopting node to result tree";
- DOMSourceLocator l = new DOMSourceLocator(context);
- throw new TransformerException(msg, l);
- }
- }
- 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);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("source=");
- buf.append(source);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/MessageNode.java b/libjava/gnu/xml/transform/MessageNode.java
deleted file mode 100644
index 9feeb752788..00000000000
--- a/libjava/gnu/xml/transform/MessageNode.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/* MessageNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * An XSL message
instruction.
- *
- * @author Chris Burdess
- */
-final class MessageNode
- extends TemplateNode
-{
-
- final boolean terminate;
-
- MessageNode(TemplateNode children, TemplateNode next, boolean terminate)
- {
- super(children, next);
- this.terminate = terminate;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new MessageNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- terminate);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- if (children != null)
- {
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- DocumentFragment fragment = doc.createDocumentFragment();
- children.apply(stylesheet, mode, context, pos, len, fragment, null);
- String message = Expr.stringValue(fragment);
- System.err.println(message);
- if (terminate)
- {
- stylesheet.terminated = true;
- }
- }
- if (next != null && !terminate)
- {
- next.apply(stylesheet, mode, context, pos, len, parent, nextSibling);
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/NodeNumberNode.java b/libjava/gnu/xml/transform/NodeNumberNode.java
deleted file mode 100644
index 99ffe8bbb24..00000000000
--- a/libjava/gnu/xml/transform/NodeNumberNode.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/* NodeNumberNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Pattern;
-import gnu.xml.xpath.Selector;
-import gnu.xml.xpath.UnionExpr;
-
-/**
- * A template node representing the XSL number
instruction
- * with no value
expression, i.e. the value is computed from
- * the document position of the context node.
- *
- * @author Chris Burdess
- */
-final class NodeNumberNode
- extends AbstractNumberNode
-{
-
- static final int SINGLE = 0;
- static final int MULTIPLE = 1;
- static final int ANY = 2;
-
- final int level;
- final Pattern count;
- final Pattern from;
-
- NodeNumberNode(TemplateNode children, TemplateNode next,
- int level, Pattern count, Pattern from,
- TemplateNode format, String lang,
- int letterValue, String groupingSeparator, int groupingSize)
- {
- super(children, next, format, lang, letterValue, groupingSeparator,
- groupingSize);
- this.level = level;
- this.count = count;
- this.from = from;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new NodeNumberNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- level,
- (count == null) ? null :
- (Pattern) count.clone(stylesheet),
- (from == null) ? from :
- (Pattern) from.clone(stylesheet),
- format, lang, letterValue,
- groupingSeparator, groupingSize);
- }
-
- int[] compute(Stylesheet stylesheet, Node context, int pos, int len)
- throws TransformerException
- {
- /*if (from != null)
- {
- Object ret = from.evaluate(context, pos, len);
- if (ret instanceof Collection)
- {
- Collection ns = (Collection) ret;
- if (ns.size() > 0)
- {
- List list = new ArrayList(ns);
- Collections.sort(list, documentOrderComparator);
- context = (Node) list.get(0);
- }
- else
- {
- return new int[0];
- }
- }
- else
- {
- return new int[0];
- }
- }*/
- Node current = context;
- switch (level)
- {
- case SINGLE:
- if (from == null)
- {
- while (context != null && !countMatches(current, context))
- {
- context = context.getParentNode();
- }
- }
- else
- {
- while (context != null && !countMatches(current, context) &&
- !fromMatches(context))
- {
- context = context.getParentNode();
- }
- }
- return (context == null) ? new int[0] :
- new int[] { (context == current) ? pos : getIndex(current, context) };
- case MULTIPLE:
- List ancestors = new ArrayList();
- while (context != null)
- {
- if (countMatches(current, context))
- {
- if (from == null || fromMatches(context))
- {
- ancestors.add(context);
- }
- }
- context = context.getParentNode();
- }
- Collections.sort(ancestors, documentOrderComparator);
- int[] ret = new int[ancestors.size()];
- for (int i = 0; i < ret.length; i++)
- {
- ret[i] = getIndex(current, (Node) ancestors.get(i));
- }
- return ret;
- case ANY:
- Expr preceding = new Selector(Selector.PRECEDING,
- Collections.EMPTY_LIST);
- Expr ancestorOrSelf = new Selector(Selector.ANCESTOR_OR_SELF,
- Collections.EMPTY_LIST);
- Expr any = new UnionExpr(preceding, ancestorOrSelf);
- Object eval = any.evaluate(context, pos, len);
- if (eval instanceof Collection)
- {
- Collection ns = (Collection) eval;
- List candidates = new ArrayList();
- for (Iterator i = ns.iterator(); i.hasNext(); )
- {
- Node candidate = (Node) i.next();
- if (countMatches(current, candidate))
- {
- candidates.add(candidate);
- if (from != null && from.matches(candidate))
- {
- break;
- }
- }
- }
- return new int[] { candidates.size() };
- }
- return new int[0];
- default:
- throw new TransformerException("invalid level");
- }
- }
-
- boolean countMatches(Node current, Node node)
- {
- if (count == null)
- {
- int cnt = current.getNodeType();
- int nnt = node.getNodeType();
- if (cnt != nnt)
- {
- return false;
- }
- if (nnt == Node.ELEMENT_NODE || nnt == Node.ATTRIBUTE_NODE)
- {
- String curi = current.getNamespaceURI();
- String nuri = node.getNamespaceURI();
- if ((curi == null && nuri != null) ||
- (curi != null && !curi.equals(nuri)))
- {
- return false;
- }
- String cn = current.getLocalName();
- String nn = current.getLocalName();
- if (!cn.equals(nn))
- {
- return false;
- }
- }
- return true;
- }
- else
- {
- return count.matches(node);
- }
- }
-
- boolean fromMatches(Node node)
- {
- for (Node ctx = node.getParentNode(); ctx != null;
- ctx = ctx.getParentNode())
- {
- if (from.matches(ctx))
- {
- return true;
- }
- }
- return false;
- }
-
- int getIndex(Node current, Node node)
- {
- int index = 0;
- do
- {
- do
- {
- node = node.getPreviousSibling();
- }
- while (node != null && !countMatches(current, node));
- index++;
- }
- while (node != null);
- return index;
- }
-
-}
diff --git a/libjava/gnu/xml/transform/NumberNode.java b/libjava/gnu/xml/transform/NumberNode.java
deleted file mode 100644
index c16324b63a4..00000000000
--- a/libjava/gnu/xml/transform/NumberNode.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* NumberNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing the XSL number
instruction
- * with a value
expression.
- *
- * @author Chris Burdess
- */
-final class NumberNode
- extends AbstractNumberNode
-{
-
- final Expr value;
-
- NumberNode(TemplateNode children, TemplateNode next,
- Expr value, TemplateNode format, String lang,
- int letterValue, String groupingSeparator, int groupingSize)
- {
- super(children, next, format, lang, letterValue, groupingSeparator,
- groupingSize);
- this.value = value;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new NumberNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- value.clone(stylesheet),
- format, lang, letterValue,
- groupingSeparator, groupingSize);
- }
-
- int[] compute(Stylesheet stylesheet, Node context, int pos, int len)
- throws TransformerException
- {
- Object ret = value.evaluate(context, pos, len);
- Double d = (ret instanceof Double) ? ((Double) ret) :
- new Double(Expr._number(context, ret));
- return new int[] { d.intValue() };
- }
-
-}
diff --git a/libjava/gnu/xml/transform/OtherwiseNode.java b/libjava/gnu/xml/transform/OtherwiseNode.java
deleted file mode 100644
index 00a3d9d3c81..00000000000
--- a/libjava/gnu/xml/transform/OtherwiseNode.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* OtherwiseNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-
-/**
- * A template node representing an XSL otherwise
instruction.
- *
- * @author Chris Burdess
- */
-final class OtherwiseNode
- extends TemplateNode
-{
-
- OtherwiseNode(TemplateNode children, TemplateNode next)
- {
- super(children, next);
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new OtherwiseNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet));
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- if (children != null)
- {
- children.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/ParameterNode.java b/libjava/gnu/xml/transform/ParameterNode.java
deleted file mode 100644
index 8d709f80115..00000000000
--- a/libjava/gnu/xml/transform/ParameterNode.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/* ParameterNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Collections;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node that sets a variable or parameter during template
- * processing.
- *
- * @author Chris Burdess
- */
-final class ParameterNode
- extends TemplateNode
-{
-
- final String name;
- final Expr select;
- final boolean global;
-
- ParameterNode(TemplateNode children, TemplateNode next,
- String name, Expr select, boolean global)
- {
- super(children, next);
- this.name = name;
- this.select = select;
- this.global = global;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new ParameterNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- name,
- select.clone(stylesheet),
- global);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- boolean apply = global || !stylesheet.bindings.containsKey(name, global);
- if (apply)
- {
- // push the variable context
- stylesheet.bindings.push(global);
- // set the variable
- Object value = getValue(stylesheet, mode, context, pos, len);
- if (value != null)
- {
- stylesheet.bindings.set(name, value, global);
- }
- }
- // variable and param don't process children as such
- // all subsequent instructions are processed with that variable context
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- if (apply)
- {
- // pop the variable context
- stylesheet.bindings.pop(global);
- }
- }
-
- Object getValue(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len)
- throws TransformerException
- {
- if (select != null)
- {
- return select.evaluate(context, pos, len);
- }
- else if (children != null)
- {
- Document doc = (context instanceof Document) ? (Document) context :
- context.getOwnerDocument();
- DocumentFragment fragment = doc.createDocumentFragment();
- children.apply(stylesheet, mode, context, pos, len, fragment, null);
- return Collections.singleton(fragment);
- }
- else
- {
- return null;
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("name=");
- buf.append(name);
- if (select != null)
- {
- buf.append(",select=");
- buf.append(select);
- }
- if (global)
- {
- buf.append(",global");
- }
- buf.append(']');
- return buf.toString();
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/ProcessingInstructionNode.java b/libjava/gnu/xml/transform/ProcessingInstructionNode.java
deleted file mode 100644
index e6823a5b2c6..00000000000
--- a/libjava/gnu/xml/transform/ProcessingInstructionNode.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* ProcessingInstructionNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-import org.w3c.dom.ProcessingInstruction;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing the XSL processing-instruction
- * instruction.
- *
- * @author Chris Burdess
- */
-final class ProcessingInstructionNode
- extends TemplateNode
-{
-
- final String name;
-
- ProcessingInstructionNode(TemplateNode children, TemplateNode next,
- String name)
- {
- super(children, next);
- this.name = name;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new ProcessingInstructionNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- name);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- String data = null;
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- if (children != null)
- {
- // Create a document fragment to hold the text
- DocumentFragment fragment = doc.createDocumentFragment();
- // Apply children to the fragment
- children.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- // Use XPath string-value of fragment
- data = Expr.stringValue(fragment);
- }
- ProcessingInstruction pi = doc.createProcessingInstruction(name, data);
- // Insert into result tree
- if (nextSibling != null)
- {
- parent.insertBefore(pi, nextSibling);
- }
- else
- {
- parent.appendChild(pi);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("name=");
- buf.append(name);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/SAXSerializer.java b/libjava/gnu/xml/transform/SAXSerializer.java
deleted file mode 100644
index 9650e3e052d..00000000000
--- a/libjava/gnu/xml/transform/SAXSerializer.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/* SAXSerializer.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
-
-/**
- * Serializes a DOM node to a sequence of SAX events.
- *
- * @author Chris Burdess
- */
-class SAXSerializer
- implements Attributes
-{
-
- transient NamedNodeMap attrs;
- transient LinkedList namespaces = new LinkedList();
-
- boolean isDefined(String prefix, String uri)
- {
- for (Iterator i = namespaces.iterator(); i.hasNext(); )
- {
- HashMap ctx = (HashMap) i.next();
- if (uri.equals(ctx.get(prefix)))
- {
- return true;
- }
- }
- return false;
- }
-
- void define(String prefix, String uri)
- {
- for (Iterator i = namespaces.iterator(); i.hasNext(); )
- {
- HashMap ctx = (HashMap) i.next();
- if (ctx.containsKey(prefix))
- {
- HashMap newCtx = new HashMap();
- newCtx.put(prefix, uri);
- namespaces.addFirst(newCtx);
- return;
- }
- }
- HashMap ctx;
- if (namespaces.isEmpty())
- {
- ctx = new HashMap();
- namespaces.add(ctx);
- }
- else
- {
- ctx = (HashMap) namespaces.getFirst();
- }
- ctx.put(prefix, uri);
- }
-
- void undefine(String prefix, String uri)
- {
- for (Iterator i = namespaces.iterator(); i.hasNext(); )
- {
- HashMap ctx = (HashMap) i.next();
- if (uri.equals(ctx.get(prefix)))
- {
- ctx.remove(prefix);
- if (ctx.isEmpty())
- {
- namespaces.remove(ctx);
- }
- return;
- }
- }
- }
-
- public int getLength()
- {
- return attrs.getLength();
- }
-
- public String getURI(int index)
- {
- return attrs.item(index).getNamespaceURI();
- }
-
- public String getLocalName(int index)
- {
- return attrs.item(index).getLocalName();
- }
-
- public String getQName(int index)
- {
- return attrs.item(index).getNodeName();
- }
-
- public String getType(int index)
- {
- Attr attr = (Attr) attrs.item(index);
- return attr.isId() ? "ID" : "CDATA";
- }
-
- public String getValue(int index)
- {
- return attrs.item(index).getNodeValue();
- }
-
- public int getIndex(String uri, String localName)
- {
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String a_uri = attr.getNamespaceURI();
- String a_localName = attr.getLocalName();
- if (((a_uri == null && uri == null) ||
- (a_uri != null && a_uri.equals(uri))) &&
- a_localName.equals(localName))
- {
- return i;
- }
- }
- return -1;
- }
-
- public int getIndex(String qName)
- {
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String a_name = attr.getNodeName();
- if (a_name.equals(qName))
- {
- return i;
- }
- }
- return -1;
- }
-
- public String getType(String uri, String localName)
- {
- Attr attr = (Attr) attrs.getNamedItemNS(uri, localName);
- return attr.isId() ? "ID" : "CDATA";
- }
-
- public String getType(String qName)
- {
- Attr attr = (Attr) attrs.getNamedItem(qName);
- return attr.isId() ? "ID" : "CDATA";
- }
-
- public String getValue(String uri, String localName)
- {
- return attrs.getNamedItemNS(uri, localName).getNodeValue();
- }
-
- public String getValue(String qName)
- {
- return attrs.getNamedItem(qName).getNodeValue();
- }
-
- void serialize(Node node, ContentHandler ch, LexicalHandler lh)
- throws SAXException
- {
- attrs = node.getAttributes();
- Node children;
- Node next = node.getNextSibling();
- switch (node.getNodeType())
- {
- case Node.ELEMENT_NODE:
- String uri = node.getNamespaceURI();
- String prefix = node.getPrefix();
- boolean defined = isDefined(prefix, uri);
- if (!defined)
- {
- define(prefix, uri);
- ch.startPrefixMapping(prefix, uri);
- }
- String localName = node.getLocalName();
- String qName = node.getNodeName();
- ch.startElement(uri, localName, qName, this);
- children = node.getFirstChild();
- if (children != null)
- {
- serialize(children, ch, lh);
- }
- ch.endElement(uri, localName, qName);
- if (!defined)
- {
- ch.endPrefixMapping(prefix);
- undefine(prefix, uri);
- }
- break;
- case Node.TEXT_NODE:
- char[] chars = node.getNodeValue().toCharArray();
- ch.characters(chars, 0, chars.length);
- break;
- case Node.CDATA_SECTION_NODE:
- char[] cdata = node.getNodeValue().toCharArray();
- if (lh != null)
- {
- lh.startCDATA();
- ch.characters(cdata, 0, cdata.length);
- lh.endCDATA();
- }
- else
- {
- ch.characters(cdata, 0, cdata.length);
- }
- break;
- case Node.COMMENT_NODE:
- if (lh != null)
- {
- char[] comment = node.getNodeValue().toCharArray();
- lh.comment(comment, 0, comment.length);
- }
- break;
- case Node.DOCUMENT_NODE:
- case Node.DOCUMENT_FRAGMENT_NODE:
- ch.startDocument();
- children = node.getFirstChild();
- if (children != null)
- {
- serialize(children, ch, lh);
- }
- ch.endDocument();
- break;
- case Node.DOCUMENT_TYPE_NODE:
- if (lh != null)
- {
- DocumentType doctype = (DocumentType) node;
- String publicId = doctype.getPublicId();
- String systemId = doctype.getSystemId();
- lh.startDTD(node.getNodeName(), publicId, systemId);
- NamedNodeMap entities = doctype.getEntities();
- int len = entities.getLength();
- for (int i = 0; i < len; i++)
- {
- Node entity = entities.item(i);
- String entityName = entity.getNodeName();
- lh.startEntity(entityName);
- lh.endEntity(entityName);
- }
- lh.endDTD();
- }
- break;
- case Node.PROCESSING_INSTRUCTION_NODE:
- ch.processingInstruction(node.getNodeName(), node.getNodeValue());
- break;
- case Node.ENTITY_REFERENCE_NODE:
- ch.skippedEntity(node.getNodeName());
- break;
- }
- attrs = null;
- if (next != null)
- {
- serialize(next, ch, lh);
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/SortKey.java b/libjava/gnu/xml/transform/SortKey.java
deleted file mode 100644
index 1ec9bdd57b9..00000000000
--- a/libjava/gnu/xml/transform/SortKey.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/* SortKey.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * An XSL sort key.
- *
- * @author Chris Burdess
- */
-final class SortKey
-{
-
- static final int DEFAULT = 0;
- static final int UPPER_FIRST = 1;
- static final int LOWER_FIRST = 2;
-
- final Expr select;
- final TemplateNode langTemplate;
- final TemplateNode dataTypeTemplate;
- final TemplateNode orderTemplate;
- final TemplateNode caseOrderTemplate;
-
- transient String lang;
- transient String dataType;
- transient boolean descending;
- transient int caseOrder;
-
- SortKey(Expr select, TemplateNode lang, TemplateNode dataType,
- TemplateNode order, TemplateNode caseOrder)
- {
- this.select = select;
- this.langTemplate = lang;
- this.dataTypeTemplate = dataType;
- this.orderTemplate = order;
- this.caseOrderTemplate = caseOrder;
- }
-
- String key(Node node)
- {
- Object ret = select.evaluate(node, 1, 1);
- if (ret instanceof String)
- {
- return (String) ret;
- }
- else
- {
- return Expr._string(node, ret);
- }
- }
-
- /**
- * Prepare for a sort.
- * This sets all transient variables from their AVTs.
- */
- void init(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Document doc = (context instanceof Document) ? (Document) context :
- context.getOwnerDocument();
- if (langTemplate == null)
- {
- lang = null;
- }
- else
- {
- DocumentFragment fragment = doc.createDocumentFragment();
- langTemplate.apply(stylesheet, mode, context, pos, len,
- fragment, null);
- lang = Expr.stringValue(fragment);
- }
- if (dataTypeTemplate == null)
- {
- dataType = "text";
- }
- else
- {
- DocumentFragment fragment = doc.createDocumentFragment();
- dataTypeTemplate.apply(stylesheet, mode, context, pos, len,
- fragment, null);
- dataType = Expr.stringValue(fragment);
- }
- if (orderTemplate == null)
- {
- descending = false;
- }
- else
- {
- DocumentFragment fragment = doc.createDocumentFragment();
- orderTemplate.apply(stylesheet, mode, context, pos, len,
- fragment, null);
- String order = Expr.stringValue(fragment);
- descending = "descending".equals(order);
- }
- if (caseOrderTemplate == null)
- {
- caseOrder = DEFAULT;
- }
- else
- {
- DocumentFragment fragment = doc.createDocumentFragment();
- caseOrderTemplate.apply(stylesheet, mode, context, pos, len,
- fragment, null);
- String co = Expr.stringValue(fragment);
- caseOrder = "upper-first".equals(co) ? UPPER_FIRST :
- "lower-first".equals(co) ? LOWER_FIRST :
- DEFAULT;
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/StreamSerializer.java b/libjava/gnu/xml/transform/StreamSerializer.java
deleted file mode 100644
index 80a1f7016a5..00000000000
--- a/libjava/gnu/xml/transform/StreamSerializer.java
+++ /dev/null
@@ -1,632 +0,0 @@
-/* StreamSerializer.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.XMLConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Serializes a DOM node to an output stream.
- *
- * @author Chris Burdess
- */
-public class StreamSerializer
-{
-
- static final int SPACE = 0x20;
- static final int BANG = 0x21; // !
- static final int APOS = 0x27; // '
- static final int SLASH = 0x2f; // /
- static final int BRA = 0x3c; // <
- static final int KET = 0x3e; // >
- static final int EQ = 0x3d; // =
-
- protected String encoding;
- boolean compatibilityMode;
- final int mode;
- final Map namespaces;
- protected String eol;
- Collection cdataSectionElements = Collections.EMPTY_SET;
-
- protected boolean discardDefaultContent;
- protected boolean xmlDeclaration = true;
-
- public StreamSerializer()
- {
- this(Stylesheet.OUTPUT_XML, null, null);
- }
-
- public StreamSerializer(String encoding)
- {
- this(Stylesheet.OUTPUT_XML, encoding, null);
- }
-
- public StreamSerializer(int mode, String encoding, String eol)
- {
- this.mode = mode;
- if (encoding == null)
- {
- encoding = "UTF-8";
- }
- this.encoding = encoding.intern();
- compatibilityMode = true;
- if (encoding.length() > 3)
- {
- String p = encoding.substring(0, 3);
- if (p.equalsIgnoreCase("UTF") ||
- p.equalsIgnoreCase("UCS"))
- {
- compatibilityMode = false;
- }
- }
- this.eol = (eol != null) ? eol : System.getProperty("line.separator");
- namespaces = new HashMap();
- }
-
- void setCdataSectionElements(Collection c)
- {
- cdataSectionElements = c;
- }
-
- public void serialize(final Node node, final OutputStream out)
- throws IOException
- {
- serialize(node, out, false);
- }
-
- void serialize(final Node node, final OutputStream out,
- boolean convertToCdata)
- throws IOException
- {
- if (out == null)
- {
- throw new NullPointerException("no output stream");
- }
- String value, prefix;
- Node children;
- Node next = node.getNextSibling();
- String uri = node.getNamespaceURI();
- boolean defined = false;
- short nt = node.getNodeType();
- if (convertToCdata && nt == Node.TEXT_NODE)
- {
- nt = Node.CDATA_SECTION_NODE;
- }
- switch (nt)
- {
- case Node.ATTRIBUTE_NODE:
- prefix = node.getPrefix();
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) ||
- (prefix != null && prefix.startsWith("xmlns:")))
- {
- String nsuri = node.getNodeValue();
- if (isDefined(nsuri))
- {
- break;
- }
- define(nsuri, node.getLocalName());
- }
- else if (uri != null && !isDefined(uri))
- {
- prefix = define(uri, prefix);
- String nsname = (prefix == null) ? "xmlns" : "xmlns:" + prefix;
- out.write(SPACE);
- out.write(encodeText(nsname));
- out.write(EQ);
- String nsvalue = "'" + encode(uri, true, true) + "'";
- out.write(nsvalue.getBytes(encoding));
- defined = true;
- }
- out.write(SPACE);
- String a_nodeName = node.getNodeName();
- out.write(encodeText(a_nodeName));
- String a_nodeValue = node.getNodeValue();
- if (mode == Stylesheet.OUTPUT_HTML &&
- a_nodeName.equals(a_nodeValue))
- {
- break;
- }
- out.write(EQ);
- value = "'" + encode(a_nodeValue, true, true) + "'";
- out.write(encodeText(value));
- break;
- case Node.ELEMENT_NODE:
- value = node.getNodeName();
- out.write(BRA);
- out.write(encodeText(value));
- if (uri != null && !isDefined(uri))
- {
- prefix = define(uri, node.getPrefix());
- String nsname = (prefix == null) ? "xmlns" : "xmlns:" + prefix;
- out.write(SPACE);
- out.write(encodeText(nsname));
- out.write(EQ);
- String nsvalue = "'" + encode(uri, true, true) + "'";
- out.write(encodeText(nsvalue));
- defined = true;
- }
- NamedNodeMap attrs = node.getAttributes();
- if (attrs != null)
- {
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Attr attr = (Attr) attrs.item(i);
- if (discardDefaultContent && !attr.getSpecified())
- {
- // NOOP
- }
- else
- {
- serialize(attr, out, false);
- }
- }
- }
- convertToCdata = cdataSectionElements.contains(value);
- children = node.getFirstChild();
- if (children == null)
- {
- out.write(SLASH);
- out.write(KET);
- }
- else
- {
- out.write(KET);
- serialize(children, out, convertToCdata);
- out.write(BRA);
- out.write(SLASH);
- out.write(encodeText(value));
- out.write(KET);
- }
- break;
- case Node.TEXT_NODE:
- value = node.getNodeValue();
- if (!"yes".equals(node.getUserData("disable-output-escaping")))
- {
- value = encode(value, false, false);
- }
- out.write(encodeText(value));
- break;
- case Node.CDATA_SECTION_NODE:
- value = "";
- out.write(encodeText(value));
- break;
- case Node.COMMENT_NODE:
- value = "";
- out.write(encodeText(value));
- Node cp = node.getParentNode();
- if (cp != null && cp.getNodeType() == Node.DOCUMENT_NODE)
- {
- out.write(encodeText(eol));
- }
- break;
- case Node.DOCUMENT_NODE:
- case Node.DOCUMENT_FRAGMENT_NODE:
- if (mode == Stylesheet.OUTPUT_XML)
- {
- if ("UTF-16".equalsIgnoreCase(encoding))
- {
- out.write(0xfe);
- out.write(0xff);
- }
- if (!"yes".equals(node.getUserData("omit-xml-declaration")) &&
- xmlDeclaration)
- {
- Document doc = (node instanceof Document) ?
- (Document) node : null;
- String version = (doc != null) ? doc.getXmlVersion() : null;
- if (version == null)
- {
- version = (String) node.getUserData("version");
- }
- if (version == null)
- {
- version = "1.0";
- }
- out.write(BRA);
- out.write(0x3f);
- out.write("xml version='".getBytes("US-ASCII"));
- out.write(version.getBytes("US-ASCII"));
- out.write(APOS);
- if (!("UTF-8".equalsIgnoreCase(encoding)))
- {
- out.write(" encoding='".getBytes("US-ASCII"));
- out.write(encoding.getBytes("US-ASCII"));
- out.write(APOS);
- }
- if ((doc != null && doc.getXmlStandalone()) ||
- "yes".equals(node.getUserData("standalone")))
- {
- out.write(" standalone='yes'".getBytes("US-ASCII"));
- }
- out.write(0x3f);
- out.write(KET);
- out.write(encodeText(eol));
- }
- // TODO warn if not outputting the declaration would be a
- // problem
- }
- else if (mode == Stylesheet.OUTPUT_HTML)
- {
- // Ensure that encoding is accessible
- String mediaType = (String) node.getUserData("media-type");
- if (mediaType == null)
- {
- mediaType = "text/html";
- }
- String contentType = mediaType + "; charset=" +
- ((encoding.indexOf(' ') != -1) ?
- "\"" + encoding + "\"" :
- encoding);
- Document doc = (node instanceof Document) ? (Document) node :
- node.getOwnerDocument();
- Node html = null;
- for (Node ctx = node.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx.getNodeType() == Node.ELEMENT_NODE)
- {
- html = ctx;
- break;
- }
- }
- if (html == null)
- {
- html = doc.createElement("html");
- node.appendChild(html);
- }
- Node head = null;
- for (Node ctx = html.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx.getNodeType() == Node.ELEMENT_NODE &&
- "head".equalsIgnoreCase(ctx.getLocalName()))
- {
- head = ctx;
- break;
- }
- }
- if (head == null)
- {
- head = doc.createElement("head");
- Node c1 = null;
- for (Node ctx = html.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx.getNodeType() == Node.ELEMENT_NODE)
- {
- c1 = ctx;
- break;
- }
- }
- if (c1 != null)
- {
- html.insertBefore(head, c1);
- }
- else
- {
- html.appendChild(head);
- }
- }
- Node meta = null;
- Node metaContent = null;
- for (Node ctx = head.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- if (ctx.getNodeType() == Node.ELEMENT_NODE &&
- "meta".equalsIgnoreCase(ctx.getLocalName()))
- {
- NamedNodeMap metaAttrs = ctx.getAttributes();
- int len = metaAttrs.getLength();
- String httpEquiv = null;
- Node content = null;
- for (int i = 0; i < len; i++)
- {
- Node attr = metaAttrs.item(i);
- String attrName = attr.getNodeName();
- if ("http-equiv".equalsIgnoreCase(attrName))
- {
- httpEquiv = attr.getNodeValue();
- }
- else if ("content".equalsIgnoreCase(attrName))
- {
- content = attr;
- }
- }
- if ("Content-Type".equalsIgnoreCase(httpEquiv))
- {
- meta = ctx;
- metaContent = content;
- break;
- }
- }
- }
- if (meta == null)
- {
- meta = doc.createElement("meta");
- // Insert first
- Node first = head.getFirstChild();
- if (first == null)
- {
- head.appendChild(meta);
- }
- else
- {
- head.insertBefore(meta, first);
- }
- Node metaHttpEquiv = doc.createAttribute("http-equiv");
- meta.getAttributes().setNamedItem(metaHttpEquiv);
- metaHttpEquiv.setNodeValue("Content-Type");
- }
- if (metaContent == null)
- {
- metaContent = doc.createAttribute("content");
- meta.getAttributes().setNamedItem(metaContent);
- }
- metaContent.setNodeValue(contentType);
- // phew
- }
- children = node.getFirstChild();
- if (children != null)
- {
- serialize(children, out, convertToCdata);
- }
- break;
- case Node.DOCUMENT_TYPE_NODE:
- DocumentType doctype = (DocumentType) node;
- out.write(BRA);
- out.write(BANG);
- value = doctype.getNodeName();
- out.write(encodeText(value));
- String publicId = doctype.getPublicId();
- if (publicId != null)
- {
- out.write(encodeText(" PUBLIC "));
- out.write(APOS);
- out.write(encodeText(publicId));
- out.write(APOS);
- }
- String systemId = doctype.getSystemId();
- if (systemId != null)
- {
- out.write(encodeText(" SYSTEM "));
- out.write(APOS);
- out.write(encodeText(systemId));
- out.write(APOS);
- }
- String internalSubset = doctype.getInternalSubset();
- if (internalSubset != null)
- {
- out.write(encodeText(internalSubset));
- }
- out.write(KET);
- out.write(eol.getBytes(encoding));
- break;
- case Node.ENTITY_REFERENCE_NODE:
- value = "&" + node.getNodeValue() + ";";
- out.write(encodeText(value));
- break;
- case Node.PROCESSING_INSTRUCTION_NODE:
- value = "" + node.getNodeName() + " " + node.getNodeValue() + "?>";
- out.write(encodeText(value));
- Node pp = node.getParentNode();
- if (pp != null && pp.getNodeType() == Node.DOCUMENT_NODE)
- {
- out.write(encodeText(eol));
- }
- break;
- }
- if (defined)
- {
- undefine(uri);
- }
- if (next != null)
- {
- serialize(next, out, convertToCdata);
- }
- }
-
- boolean isDefined(String uri)
- {
- return XMLConstants.XML_NS_URI.equals(uri) ||
- XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) ||
- namespaces.containsKey(uri);
- }
-
- String define(String uri, String prefix)
- {
- while (namespaces.containsValue(prefix))
- {
- // Fabricate new prefix
- prefix = prefix + "_";
- }
- namespaces.put(uri, prefix);
- return prefix;
- }
-
- void undefine(String uri)
- {
- namespaces.remove(uri);
- }
-
- final byte[] encodeText(String text)
- throws UnsupportedEncodingException
- {
- if (compatibilityMode)
- {
- int len = text.length();
- StringBuffer buf = null;
- for (int i = 0; i < len; i++)
- {
- char c = text.charAt(i);
- if (c >= 127)
- {
- if (buf == null)
- {
- buf = new StringBuffer(text.substring(0, i));
- }
- buf.append('&');
- buf.append('#');
- buf.append((int) c);
- buf.append(';');
- }
- else if (buf != null)
- {
- buf.append(c);
- }
- }
- if (buf != null)
- {
- text = buf.toString();
- }
- }
- return text.getBytes(encoding);
- }
-
- String encode(String text, boolean encodeCtl, boolean inAttr)
- {
- int len = text.length();
- StringBuffer buf = null;
- for (int i = 0; i < len; i++)
- {
- char c = text.charAt(i);
- if (c == '<')
- {
- if (buf == null)
- {
- buf = new StringBuffer(text.substring(0, i));
- }
- buf.append("<");
- }
- else if (c == '>')
- {
- if (buf == null)
- {
- buf = new StringBuffer(text.substring(0, i));
- }
- buf.append(">");
- }
- else if (c == '&')
- {
- if (mode == Stylesheet.OUTPUT_HTML && (i + 1) < len &&
- text.charAt(i + 1) == '{')
- {
- if (buf != null)
- {
- buf.append(c);
- }
- }
- else
- {
- if (buf == null)
- {
- buf = new StringBuffer(text.substring(0, i));
- }
- buf.append("&");
- }
- }
- else if (c == '\'' && inAttr)
- {
- if (buf == null)
- {
- buf = new StringBuffer(text.substring(0, i));
- }
- buf.append("'");
- }
- else if (c == '"' && inAttr)
- {
- if (buf == null)
- {
- buf = new StringBuffer(text.substring(0, i));
- }
- buf.append(""");
- }
- else if (encodeCtl)
- {
- if (c < 0x20)
- {
- if (buf == null)
- {
- buf = new StringBuffer(text.substring(0, i));
- }
- buf.append('&');
- buf.append('#');
- buf.append((int) c);
- buf.append(';');
- }
- else if (buf != null)
- {
- buf.append(c);
- }
- }
- else if (buf != null)
- {
- buf.append(c);
- }
- }
- return (buf == null) ? text : buf.toString();
- }
-
- String toString(Node node)
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try
- {
- serialize(node, out);
- return new String(out.toByteArray(), encoding);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e.getMessage());
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/Stylesheet.java b/libjava/gnu/xml/transform/Stylesheet.java
deleted file mode 100644
index 5efd5ca3e3e..00000000000
--- a/libjava/gnu/xml/transform/Stylesheet.java
+++ /dev/null
@@ -1,1728 +0,0 @@
-/* Stylesheet.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.TreeSet;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionResolver;
-import javax.xml.xpath.XPathExpressionException;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import org.w3c.dom.UserDataHandler;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.NameTest;
-import gnu.xml.xpath.NodeTypeTest;
-import gnu.xml.xpath.Pattern;
-import gnu.xml.xpath.Selector;
-import gnu.xml.xpath.Root;
-import gnu.xml.xpath.Test;
-import gnu.xml.xpath.XPathImpl;
-
-/**
- * An XSL stylesheet.
- *
- * @author Chris Burdess
- */
-class Stylesheet
- implements NamespaceContext, XPathFunctionResolver, UserDataHandler, Cloneable
-{
-
- static final String XSL_NS = "http://www.w3.org/1999/XSL/Transform";
-
- static final int OUTPUT_XML = 0;
- static final int OUTPUT_HTML = 1;
- static final int OUTPUT_TEXT = 2;
-
- final TransformerFactoryImpl factory;
- TransformerImpl transformer;
- Stylesheet parent;
- final XPathImpl xpath;
- final String systemId;
- final int precedence;
-
- final boolean debug;
-
- /**
- * Version of XSLT.
- */
- String version;
-
- Collection extensionElementPrefixes;
- Collection excludeResultPrefixes;
-
- /**
- * Set of element names for which we should strip whitespace.
- */
- Set stripSpace;
-
- /**
- * Set of element names for which we should preserve whitespace.
- */
- Set preserveSpace;
-
- /**
- * Output options.
- */
- int outputMethod;
- String outputVersion;
- String outputEncoding;
- boolean outputOmitXmlDeclaration;
- boolean outputStandalone;
- String outputPublicId;
- String outputSystemId;
- Collection outputCdataSectionElements;
- boolean outputIndent;
- String outputMediaType;
-
- /**
- * Keys.
- */
- Collection keys;
-
- /**
- * Decimal formats.
- */
- Map decimalFormats;
-
- /**
- * Namespace aliases.
- */
- Map namespaceAliases;
-
- /**
- * Attribute-sets.
- */
- List attributeSets;
-
- /**
- * Variables.
- */
- List variables;
-
- /**
- * Variable and parameter bindings.
- */
- Bindings bindings;
-
- /**
- * Templates.
- */
- LinkedList templates;
-
- TemplateNode builtInNodeTemplate;
- TemplateNode builtInTextTemplate;
-
- /**
- * Holds the current node while parsing.
- * Necessary to associate the document function with its declaring node,
- * to resolve namespaces, and to maintain the current node for the
- * current() function.
- */
- Node current;
-
- /**
- * Set by a terminating message.
- */
- transient boolean terminated;
-
- /**
- * Current template in force.
- */
- transient Template currentTemplate;
-
- Stylesheet(TransformerFactoryImpl factory,
- Stylesheet parent,
- Document doc,
- String systemId,
- int precedence)
- throws TransformerConfigurationException
- {
- this.factory = factory;
- this.systemId = systemId;
- this.precedence = precedence;
- this.parent = parent;
- extensionElementPrefixes = new HashSet();
- excludeResultPrefixes = new HashSet();
- stripSpace = new LinkedHashSet();
- preserveSpace = new LinkedHashSet();
- outputCdataSectionElements = new LinkedHashSet();
- xpath = (XPathImpl) factory.xpathFactory.newXPath();
- if (parent == null)
- {
- bindings = new Bindings(this);
- attributeSets = new LinkedList();
- variables = new LinkedList();
- namespaceAliases = new LinkedHashMap();
- templates = new LinkedList();
- keys = new LinkedList();
- decimalFormats = new LinkedHashMap();
- initDefaultDecimalFormat();
- xpath.setNamespaceContext(this);
- xpath.setXPathFunctionResolver(this);
- }
- else
- {
- /* Test for import circularity */
- for (Stylesheet ctx = this; ctx.parent != null; ctx = ctx.parent)
- {
- if (systemId != null && systemId.equals(ctx.parent.systemId))
- {
- String msg = "circularity importing " + systemId;
- throw new TransformerConfigurationException(msg);
- }
- }
- /* OK */
- Stylesheet root = getRootStylesheet();
- bindings = root.bindings;
- attributeSets = root.attributeSets;
- variables = root.variables;
- namespaceAliases = root.namespaceAliases;
- templates = root.templates;
- keys = root.keys;
- decimalFormats = root.decimalFormats;
- xpath.setNamespaceContext(root);
- xpath.setXPathFunctionResolver(root);
- }
- xpath.setXPathVariableResolver(bindings);
-
- Test anyNode = new NodeTypeTest((short) 0);
- List tests = Collections.singletonList(anyNode);
- builtInNodeTemplate =
- new ApplyTemplatesNode(null, null,
- new Selector(Selector.CHILD, tests),
- null, null, null, true);
- builtInTextTemplate =
- new ValueOfNode(null, null,
- new Selector(Selector.SELF, tests),
- false);
-
- parse(doc.getDocumentElement(), true);
- current = doc; // Alow namespace resolution during processing
-
- debug = ("yes".equals(System.getProperty("xsl.debug")));
-
- if (debug)
- {
- System.err.println("Stylesheet: " + doc.getDocumentURI());
- for (Iterator i = templates.iterator(); i.hasNext(); )
- {
- Template t = (Template) i.next();
- t.list(System.err);
- System.err.println("--------------------");
- }
- }
- }
-
- Stylesheet getRootStylesheet()
- {
- Stylesheet stylesheet = this;
- while (stylesheet.parent != null)
- {
- stylesheet = stylesheet.parent;
- }
- return stylesheet;
- }
-
- void initDefaultDecimalFormat()
- {
- DecimalFormat defaultDecimalFormat = new DecimalFormat();
- DecimalFormatSymbols symbols = new DecimalFormatSymbols();
- symbols.setDecimalSeparator('.');
- symbols.setGroupingSeparator(',');
- symbols.setPercent('%');
- symbols.setPerMill('\u2030');
- symbols.setZeroDigit('0');
- symbols.setDigit('#');
- symbols.setPatternSeparator(';');
- symbols.setInfinity("Infinity");
- symbols.setNaN("NaN");
- symbols.setMinusSign('-');
- defaultDecimalFormat.setDecimalFormatSymbols(symbols);
- decimalFormats.put(null, defaultDecimalFormat);
- }
-
- // -- Cloneable --
-
- public Object clone()
- {
- try
- {
- Stylesheet clone = (Stylesheet) super.clone();
- clone.bindings = (Bindings) bindings.clone();
-
- LinkedList templates2 = new LinkedList();
- for (Iterator i = templates.iterator(); i.hasNext(); )
- {
- Template t = (Template) i.next();
- templates2.add(t.clone(clone));
- }
- clone.templates = templates2;
-
- LinkedList attributeSets2 = new LinkedList();
- for (Iterator i = attributeSets.iterator(); i.hasNext(); )
- {
- AttributeSet as = (AttributeSet) i.next();
- attributeSets2.add(as.clone(clone));
- }
- clone.attributeSets = attributeSets2;
-
- LinkedList variables2 = new LinkedList();
- for (Iterator i = variables.iterator(); i.hasNext(); )
- {
- ParameterNode var = (ParameterNode) i.next();
- variables2.add(var.clone(clone));
- }
- clone.variables = variables2;
-
- LinkedList keys2 = new LinkedList();
- for (Iterator i = keys.iterator(); i.hasNext(); )
- {
- Key k = (Key) i.next();
- keys2.add(k.clone(clone));
- }
- clone.keys = keys2;
-
- return clone;
- }
- catch (CloneNotSupportedException e)
- {
- throw new Error(e.getMessage());
- }
- }
-
- // -- Variable evaluation --
-
- void initTopLevelVariables(Node context)
- throws TransformerException
- {
- for (Iterator i = variables.iterator(); i.hasNext(); )
- {
- ParameterNode var = (ParameterNode) i.next();
- bindings.set(var.name,
- var.getValue(this, null, context, 1, 1),
- var.global);
- }
- }
-
- // -- NamespaceContext --
-
- public String getNamespaceURI(String prefix)
- {
- return (current == null) ? null : current.lookupNamespaceURI(prefix);
- }
-
- public String getPrefix(String namespaceURI)
- {
- return (current == null) ? null : current.lookupPrefix(namespaceURI);
- }
-
- public Iterator getPrefixes(String namespaceURI)
- {
- // TODO
- return Collections.singleton(getPrefix(namespaceURI)).iterator();
- }
-
- // -- Template selection --
-
- TemplateNode getTemplate(QName mode, Node context, boolean applyImports)
- throws TransformerException
- {
- //System.err.println("getTemplate: mode="+mode+" context="+context);
- Set candidates = new TreeSet();
- for (Iterator j = templates.iterator(); j.hasNext(); )
- {
- Template t = (Template) j.next();
- boolean isMatch = t.matches(mode, context);
- if (applyImports)
- {
- if (currentTemplate == null)
- {
- String msg = "current template may not be null " +
- "during apply-imports";
- throw new TransformerException(msg);
- }
- if (!currentTemplate.imports(t))
- {
- isMatch = false;
- }
- }
- //System.err.println("\t"+context+" "+t+"="+isMatch);
- if (isMatch)
- {
- candidates.add(t);
- }
- }
- //System.err.println("\tcandidates="+candidates);
- if (candidates.isEmpty())
- {
- // Apply built-in template
- // Current template is unchanged
- //System.err.println("\tbuiltInTemplate context="+context);
- switch (context.getNodeType())
- {
- case Node.ELEMENT_NODE:
- case Node.DOCUMENT_NODE:
- case Node.DOCUMENT_FRAGMENT_NODE:
- case Node.PROCESSING_INSTRUCTION_NODE:
- case Node.COMMENT_NODE:
- return builtInNodeTemplate;
- case Node.TEXT_NODE:
- case Node.ATTRIBUTE_NODE:
- return builtInTextTemplate;
- default:
- return null;
- }
- }
- else
- {
- Template t = (Template) candidates.iterator().next();
- // Set current template
- currentTemplate = t;
- //System.err.println("\ttemplate="+t+" context="+context);
- return t.node;
- }
- }
-
- TemplateNode getTemplate(QName mode, QName name)
- throws TransformerException
- {
- //System.err.println("getTemplate: mode="+mode+" name="+name);
- Set candidates = new TreeSet();
- for (Iterator j = templates.iterator(); j.hasNext(); )
- {
- Template t = (Template) j.next();
- boolean isMatch = t.matches(name);
- //System.err.println("\t"+name+" "+t+"="+isMatch);
- if (isMatch)
- {
- candidates.add(t);
- }
- }
- if (candidates.isEmpty())
- {
- return null;
- //throw new TransformerException("template '" + name + "' not found");
- }
- Template t = (Template) candidates.iterator().next();
- //System.err.println("\ttemplate="+t+" context="+context);
- return t.node;
- }
-
- /**
- * template
- */
- final Template parseTemplate(Node node, NamedNodeMap attrs)
- throws TransformerConfigurationException, XPathExpressionException
- {
- String n = getAttribute(attrs, "name");
- QName name = (n == null) ? null : getQName(n);
- String m = getAttribute(attrs, "match");
- Pattern match = null;
- if (m != null)
- {
- try
- {
- match = (Pattern) xpath.compile(m);
- }
- catch (ClassCastException e)
- {
- String msg = "illegal pattern: " + m;
- throw new TransformerConfigurationException(msg);
- }
- }
- String p = getAttribute(attrs, "priority");
- String mm = getAttribute(attrs, "mode");
- QName mode = (mm == null) ? null : getQName(mm);
- double priority = (p == null) ? Template.DEFAULT_PRIORITY :
- Double.parseDouble(p);
- return new Template(this, name, match, parse(node.getFirstChild()),
- precedence, priority, mode);
- }
-
- /**
- * output
- */
- final void parseOutput(Node node, NamedNodeMap attrs)
- throws TransformerConfigurationException
- {
- String method = getAttribute(attrs, "method");
- if ("xml".equals(method) || method == null)
- {
- outputMethod = OUTPUT_XML;
- }
- else if ("html".equals(method))
- {
- outputMethod = OUTPUT_HTML;
- }
- else if ("text".equals(method))
- {
- outputMethod = OUTPUT_TEXT;
- }
- else
- {
- String msg = "unsupported output method: " + method;
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(msg, l);
- }
- outputPublicId = getAttribute(attrs, "public-id");
- outputSystemId = getAttribute(attrs, "system-id");
- outputEncoding = getAttribute(attrs, "encoding");
- String indent = getAttribute(attrs, "indent");
- if (indent != null)
- {
- outputIndent = "yes".equals(indent);
- }
- outputVersion = getAttribute(attrs, "version");
- String omitXmlDecl = getAttribute(attrs, "omit-xml-declaration");
- if (omitXmlDecl != null)
- {
- outputOmitXmlDeclaration = "yes".equals(omitXmlDecl);
- }
- String standalone = getAttribute(attrs, "standalone");
- if (standalone != null)
- {
- outputStandalone = "yes".equals(standalone);
- }
- outputMediaType = getAttribute(attrs, "media-type");
- String cdataSectionElements =
- getAttribute(attrs, "cdata-section-elements");
- if (cdataSectionElements != null)
- {
- StringTokenizer st = new StringTokenizer(cdataSectionElements, " ");
- while (st.hasMoreTokens())
- {
- outputCdataSectionElements.add(st.nextToken());
- }
- }
- }
-
- /**
- * key
- */
- final void parseKey(Node node, NamedNodeMap attrs)
- throws TransformerConfigurationException, XPathExpressionException
- {
- String n = getRequiredAttribute(attrs, "name", node);
- String m = getRequiredAttribute(attrs, "match", node);
- String u = getRequiredAttribute(attrs, "use", node);
- QName name = getQName(n);
- Expr use = (Expr) xpath.compile(u);
- try
- {
- Pattern match = (Pattern) xpath.compile(m);
- Key key = new Key(name, match, use);
- keys.add(key);
- }
- catch (ClassCastException e)
- {
- throw new TransformerConfigurationException("invalid pattern: " + m);
- }
- }
-
- /**
- * decimal-format
- */
- final void parseDecimalFormat(Node node, NamedNodeMap attrs)
- throws TransformerConfigurationException
- {
- String dfName = getAttribute(attrs, "name");
- DecimalFormat df = new DecimalFormat();
- DecimalFormatSymbols symbols = new DecimalFormatSymbols();
- symbols.setDecimalSeparator(parseDFChar(attrs, "decimal-separator", '.'));
- symbols.setGroupingSeparator(parseDFChar(attrs, "grouping-separator", ','));
- symbols.setInfinity(parseDFString(attrs, "infinity", "Infinity"));
- symbols.setMinusSign(parseDFChar(attrs, "minus-sign", '-'));
- symbols.setNaN(parseDFString(attrs, "NaN", "NaN"));
- symbols.setPercent(parseDFChar(attrs, "percent", '%'));
- symbols.setPerMill(parseDFChar(attrs, "per-mille", '\u2030'));
- symbols.setZeroDigit(parseDFChar(attrs, "zero-digit", '0'));
- symbols.setDigit(parseDFChar(attrs, "digit", '#'));
- symbols.setPatternSeparator(parseDFChar(attrs, "pattern-separator", ';'));
- df.setDecimalFormatSymbols(symbols);
- decimalFormats.put(dfName, df);
- }
-
- private final char parseDFChar(NamedNodeMap attrs, String name, char def)
- throws TransformerConfigurationException
- {
- Node attr = attrs.getNamedItem(name);
- try
- {
- return (attr == null) ? def : attr.getNodeValue().charAt(0);
- }
- catch (StringIndexOutOfBoundsException e)
- {
- throw new TransformerConfigurationException("empty attribute '" +
- name +
- "' in decimal-format", e);
- }
- }
-
- private final String parseDFString(NamedNodeMap attrs, String name,
- String def)
- {
- Node attr = attrs.getNamedItem(name);
- return (attr == null) ? def : attr.getNodeValue();
- }
-
- /**
- * namespace-alias
- */
- final void parseNamespaceAlias(Node node, NamedNodeMap attrs)
- throws TransformerConfigurationException
- {
- String sp = getRequiredAttribute(attrs, "stylesheet-prefix", node);
- String rp = getRequiredAttribute(attrs, "result-prefix", node);
- namespaceAliases.put(sp, rp);
- }
-
- /**
- * attribute-set
- */
- final void parseAttributeSet(Node node, NamedNodeMap attrs)
- throws TransformerConfigurationException, XPathExpressionException
- {
- TemplateNode children = parse(node.getFirstChild());
- String name = getRequiredAttribute(attrs, "name", node);
- String uas = getAttribute(attrs, "use-attribute-sets");
- attributeSets.add(new AttributeSet(children, name, uas));
- }
-
- /**
- * Parse top-level elements.
- */
- void parse(Node node, boolean root)
- throws TransformerConfigurationException
- {
- if (node == null)
- {
- return;
- }
- current = node;
- try
- {
- String namespaceUri = node.getNamespaceURI();
- if (XSL_NS.equals(namespaceUri) &&
- node.getNodeType() == Node.ELEMENT_NODE)
- {
- String name = node.getLocalName();
- NamedNodeMap attrs = node.getAttributes();
- if ("stylesheet".equals(name))
- {
- version = getAttribute(attrs, "version");
- String eep = getAttribute(attrs, "extension-element-prefixes");
- if (eep != null)
- {
- StringTokenizer st = new StringTokenizer(eep);
- while (st.hasMoreTokens())
- {
- extensionElementPrefixes.add(st.nextToken());
- }
- }
- String erp = getAttribute(attrs, "exclude-result-prefixes");
- if (erp != null)
- {
- StringTokenizer st = new StringTokenizer(erp);
- while (st.hasMoreTokens())
- {
- excludeResultPrefixes.add(st.nextToken());
- }
- }
- parse(node.getFirstChild(), false);
- return;
- }
- else if ("template".equals(name))
- {
- templates.addFirst(parseTemplate(node, attrs));
- }
- else if ("param".equals(name) ||
- "variable".equals(name))
- {
- boolean global = "variable".equals(name);
- TemplateNode content = parse(node.getFirstChild());
- String paramName = getRequiredAttribute(attrs, "name", node);
- String select = getAttribute(attrs, "select");
- if (select != null && select.length() > 0)
- {
- if (content != null)
- {
- String msg = "parameter '" + paramName +
- "' has both select and content";
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(msg, l);
- }
- Expr expr = (Expr) xpath.compile(select);
- variables.add(new ParameterNode(null, null,
- paramName,
- expr, global));
- }
- else
- {
- variables.add(new ParameterNode(content, null,
- paramName,
- null, global));
- }
- bindings.set(paramName, content, global);
- }
- else if ("include".equals(name) || "import".equals(name))
- {
- int delta = "import".equals(name) ? -1 : 0;
- String href = getRequiredAttribute(attrs, "href", node);
- Source source;
- synchronized (factory.resolver)
- {
- if (transformer != null)
- {
- factory.resolver
- .setUserResolver(transformer.getURIResolver());
- factory.resolver
- .setUserListener(transformer.getErrorListener());
- }
- source = factory.resolver.resolve(systemId, href);
- }
- factory.newStylesheet(source, precedence + delta, this);
- }
- else if ("output".equals(name))
- {
- parseOutput(node, attrs);
- }
- else if ("preserve-space".equals(name))
- {
- String elements =
- getRequiredAttribute(attrs, "elements", node);
- StringTokenizer st = new StringTokenizer(elements,
- " \t\n\r");
- while (st.hasMoreTokens())
- {
- preserveSpace.add(parseNameTest(st.nextToken()));
- }
- }
- else if ("strip-space".equals(name))
- {
- String elements =
- getRequiredAttribute(attrs, "elements", node);
- StringTokenizer st = new StringTokenizer(elements,
- " \t\n\r");
- while (st.hasMoreTokens())
- {
- stripSpace.add(parseNameTest(st.nextToken()));
- }
- }
- else if ("key".equals(name))
- {
- parseKey(node, attrs);
- }
- else if ("decimal-format".equals(name))
- {
- parseDecimalFormat(node, attrs);
- }
- else if ("namespace-alias".equals(name))
- {
- parseNamespaceAlias(node, attrs);
- }
- else if ("attribute-set".equals(name))
- {
- parseAttributeSet(node, attrs);
- }
- parse(node.getNextSibling(), false);
- }
- else if (root)
- {
- // Literal document element
- Attr versionNode =
- ((Element)node).getAttributeNodeNS(XSL_NS, "version");
- if (versionNode == null)
- {
- String msg = "no xsl:version attribute on literal result node";
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(msg, l);
- }
- version = versionNode.getValue();
- Node rootClone = node.cloneNode(true);
- NamedNodeMap attrs = rootClone.getAttributes();
- attrs.removeNamedItemNS(XSL_NS, "version");
- templates.add(new Template(this, null, new Root(),
- parse(rootClone),
- precedence,
- Template.DEFAULT_PRIORITY,
- null));
- }
- else
- {
- // Skip unknown elements, text, comments, etc
- parse(node.getNextSibling(), false);
- }
- }
- catch (TransformerException e)
- {
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(e.getMessage(), l, e);
- }
- catch (DOMException e)
- {
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(e.getMessage(), l, e);
- }
- catch (XPathExpressionException e)
- {
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(e.getMessage(), l, e);
- }
- }
-
- final NameTest parseNameTest(String token)
- {
- if ("*".equals(token))
- {
- return new NameTest(null, true, true);
- }
- else if (token.endsWith(":*"))
- {
- QName qName = getQName(token.substring(0, token.length() - 2));
- return new NameTest(qName, true, false);
- }
- else
- {
- QName qName = getQName(token);
- return new NameTest(qName, false, false);
- }
- }
-
- final QName getQName(String name)
- {
- QName qName = QName.valueOf(name);
- String prefix = qName.getPrefix();
- String uri = qName.getNamespaceURI();
- if (prefix != null && (uri == null || uri.length() == 0))
- {
- uri = getNamespaceURI(prefix);
- String localName = qName.getLocalPart();
- qName = new QName(uri, localName, prefix);
- }
- return qName;
- }
-
- final TemplateNode parseAttributeValueTemplate(String value, Node source)
- throws TransformerConfigurationException, XPathExpressionException
- {
- current = source;
- // Tokenize
- int len = value.length();
- int off = 0;
- List tokens = new ArrayList(); // text tokens
- List types = new ArrayList(); // literal or expression
- int depth = 0;
- for (int i = 0; i < len; i++)
- {
- char c = value.charAt(i);
- if (c == '{')
- {
- if (i < (len - 1) && value.charAt(i + 1) == '{')
- {
- tokens.add(value.substring(off, i + 1));
- types.add(Boolean.FALSE);
- i++;
- off = i + 1;
- continue;
- }
- if (depth == 0)
- {
- if (i - off > 0)
- {
- tokens.add(value.substring(off, i));
- types.add(Boolean.FALSE);
- }
- off = i + 1;
- }
- depth++;
- }
- else if (c == '}')
- {
- if (i < (len - 1) && value.charAt(i + 1) == '}')
- {
- tokens.add(value.substring(off, i + 1));
- types.add(Boolean.FALSE);
- i++;
- off = i + 1;
- continue;
- }
- if (depth == 1)
- {
- if (i - off > 0)
- {
- tokens.add(value.substring(off, i));
- types.add(Boolean.TRUE);
- }
- else
- {
- String msg = "attribute value template " +
- "must contain expression: " + value;
- DOMSourceLocator l = new DOMSourceLocator(source);
- throw new TransformerConfigurationException(msg, l);
- }
- off = i + 1;
- }
- depth--;
- }
- }
- if (depth > 0)
- {
- String msg = "invalid attribute value template: " + value;
- throw new TransformerConfigurationException(msg);
- }
- if (len - off > 0)
- {
- // Trailing text
- tokens.add(value.substring(off));
- types.add(Boolean.FALSE);
- }
-
- // Construct template node tree
- TemplateNode ret = null;
- Document doc = source.getOwnerDocument();
- len = tokens.size();
- for (int i = len - 1; i >= 0; i--)
- {
- String token = (String) tokens.get(i);
- Boolean type = (Boolean) types.get(i);
- if (type == Boolean.TRUE)
- {
- // Expression text
- Expr select = (Expr) xpath.compile(token);
- ret = new ValueOfNode(null, ret, select, false);
- }
- else
- {
- // Verbatim text
- ret = new LiteralNode(null, ret, doc.createTextNode(token));
- }
- }
- return ret;
- }
-
- boolean isPreserved(Text text)
- throws TransformerConfigurationException
- {
- // Check characters in text
- String value = text.getData();
- if (value != null)
- {
- int len = value.length();
- for (int i = 0; i < len; i++)
- {
- char c = value.charAt(i);
- if (c != 0x20 && c != 0x09 && c != 0x0a && c != 0x0d)
- {
- return true;
- }
- }
- }
- // Check parent node
- Node ctx = text.getParentNode();
- if (!preserveSpace.isEmpty())
- {
- for (Iterator i = preserveSpace.iterator(); i.hasNext(); )
- {
- NameTest preserveTest = (NameTest) i.next();
- if (preserveTest.matches(ctx, 1, 1))
- {
- boolean override = false;
- if (!stripSpace.isEmpty())
- {
- for (Iterator j = stripSpace.iterator(); j.hasNext(); )
- {
- NameTest stripTest = (NameTest) j.next();
- if (stripTest.matches(ctx, 1, 1))
- {
- override = true;
- break;
- }
- }
- }
- if (!override)
- {
- return true;
- }
- }
- }
- }
- // Check whether any ancestor specified xml:space
- while (ctx != null)
- {
- if (ctx.getNodeType() == Node.ELEMENT_NODE)
- {
- Element element = (Element) ctx;
- String xmlSpace = element.getAttribute("xml:space");
- if ("default".equals(xmlSpace))
- {
- break;
- }
- else if ("preserve".equals(xmlSpace))
- {
- return true;
- }
- else if (xmlSpace.length() > 0)
- {
- String msg = "Illegal value for xml:space: " + xmlSpace;
- throw new TransformerConfigurationException(msg);
- }
- else if ("text".equals(ctx.getLocalName()) &&
- XSL_NS.equals(ctx.getNamespaceURI()))
- {
- // xsl:text implies xml:space='preserve'
- return true;
- }
- }
- ctx = ctx.getParentNode();
- }
- return false;
- }
-
- public XPathFunction resolveFunction(QName name, int arity)
- {
- String uri = name.getNamespaceURI();
- if (XSL_NS.equals(uri) || uri == null || uri.length() == 0)
- {
- String localName = name.getLocalPart();
- if ("document".equals(localName) && (arity == 1 || arity == 2))
- {
- if (current == null)
- {
- throw new RuntimeException("current is null");
- }
- return new DocumentFunction(getRootStylesheet(), current);
- }
- else if ("key".equals(localName) && (arity == 2))
- {
- return new KeyFunction(getRootStylesheet());
- }
- else if ("format-number".equals(localName) &&
- (arity == 2 || arity == 3))
- {
- return new FormatNumberFunction(getRootStylesheet());
- }
- else if ("current".equals(localName) && (arity == 0))
- {
- return new CurrentFunction(getRootStylesheet());
- }
- else if ("unparsed-entity-uri".equals(localName) && (arity == 1))
- {
- return new UnparsedEntityUriFunction();
- }
- else if ("generate-id".equals(localName) &&
- (arity == 1 || arity == 0))
- {
- return new GenerateIdFunction();
- }
- else if ("system-property".equals(localName) && (arity == 1))
- {
- return new SystemPropertyFunction();
- }
- else if ("element-available".equals(localName) && (arity == 1))
- {
- return new ElementAvailableFunction(this);
- }
- else if ("function-available".equals(localName) && (arity == 1))
- {
- return new FunctionAvailableFunction(this);
- }
- }
- return null;
- }
-
- // -- Parsing --
-
- /**
- * apply-templates
- */
- final TemplateNode parseApplyTemplates(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String m = getAttribute(attrs, "mode");
- QName mode = (m == null) ? null : getQName(m);
- String s = getAttribute(attrs, "select");
- if (s == null)
- {
- s = "child::node()";
- }
- List sortKeys = parseSortKeys(children);
- List withParams = parseWithParams(children);
- Expr select = (Expr) xpath.compile(s);
- return new ApplyTemplatesNode(null, parse(next),
- select, mode,
- sortKeys, withParams, false);
- }
-
- /**
- * call-template
- */
- final TemplateNode parseCallTemplate(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String n = getRequiredAttribute(attrs, "name", node);
- QName name = getQName(n);
- List withParams = parseWithParams(children);
- return new CallTemplateNode(null, parse(next), name,
- withParams);
- }
-
- /**
- * value-of
- */
- final TemplateNode parseValueOf(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String s = getRequiredAttribute(attrs, "select", node);
- String doe = getAttribute(attrs, "disable-output-escaping");
- boolean d = "yes".equals(doe);
- Expr select = (Expr) xpath.compile(s);
- return new ValueOfNode(null, parse(next), select, d);
- }
-
- /**
- * for-each
- */
- final TemplateNode parseForEach(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String s = getRequiredAttribute(attrs, "select", node);
- List sortKeys = parseSortKeys(children);
- Expr select = (Expr) xpath.compile(s);
- return new ForEachNode(parse(children), parse(next), select, sortKeys);
- }
-
- /**
- * if
- */
- final TemplateNode parseIf(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String t = getRequiredAttribute(attrs, "test", node);
- Expr test = (Expr) xpath.compile(t);
- return new IfNode(parse(children), parse(next), test);
- }
-
- /**
- * when
- */
- final TemplateNode parseWhen(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String t = getRequiredAttribute(attrs, "test", node);
- Expr test = (Expr) xpath.compile(t);
- return new WhenNode(parse(children), parse(next), test);
- }
-
- /**
- * element
- */
- final TemplateNode parseElement(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String name = getRequiredAttribute(attrs, "name", node);
- String namespace = getAttribute(attrs, "namespace");
- String uas = getAttribute(attrs, "use-attribute-sets");
- TemplateNode n = parseAttributeValueTemplate(name, node);
- TemplateNode ns = (namespace == null) ? null :
- parseAttributeValueTemplate(namespace, node);
- return new ElementNode(parse(children), parse(next), n, ns, uas, node);
- }
-
- /**
- * attribute
- */
- final TemplateNode parseAttribute(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String name = getRequiredAttribute(attrs, "name", node);
- String namespace = getAttribute(attrs, "namespace");
- TemplateNode n = parseAttributeValueTemplate(name, node);
- TemplateNode ns = (namespace == null) ? null :
- parseAttributeValueTemplate(namespace, node);
- return new AttributeNode(parse(children), parse(next), n, ns, node);
- }
-
- /**
- * text
- */
- final TemplateNode parseText(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String doe = getAttribute(attrs, "disable-output-escaping");
- boolean d = "yes".equals(doe);
- return new TextNode(parse(children), parse(next), d);
- }
-
- /**
- * copy
- */
- final TemplateNode parseCopy(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String uas = getAttribute(attrs, "use-attribute-sets");
- return new CopyNode(parse(children), parse(next), uas);
- }
-
- /**
- * processing-instruction
- */
- final TemplateNode parseProcessingInstruction(Node node, Node children,
- Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String name = getRequiredAttribute(attrs, "name", node);
- return new ProcessingInstructionNode(parse(children),
- parse(next), name);
- }
-
- /**
- * number
- */
- final TemplateNode parseNumber(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String v = getAttribute(attrs, "value");
- String ff = getAttribute(attrs, "format");
- if (ff == null)
- {
- ff = "1";
- }
- TemplateNode format = parseAttributeValueTemplate(ff, node);
- String lang = getAttribute(attrs, "lang");
- String lv = getAttribute(attrs, "letter-value");
- int letterValue = "traditional".equals(lv) ?
- AbstractNumberNode.TRADITIONAL :
- AbstractNumberNode.ALPHABETIC;
- String gs = getAttribute(attrs, "grouping-separator");
- String gz = getAttribute(attrs, "grouping-size");
- int gz2 = (gz != null && gz.length() > 0) ?
- Integer.parseInt(gz) : 1;
- if (v != null && v.length() > 0)
- {
- Expr value = (Expr) xpath.compile(v);
- return new NumberNode(parse(children), parse(next),
- value, format, lang,
- letterValue, gs, gz2);
- }
- else
- {
- String l = getAttribute(attrs, "level");
- int level =
- "multiple".equals(l) ? NodeNumberNode.MULTIPLE :
- "any".equals(l) ? NodeNumberNode.ANY :
- NodeNumberNode.SINGLE;
- String c = getAttribute(attrs, "count");
- String f = getAttribute(attrs, "from");
- Pattern count = null;
- Pattern from = null;
- if (c != null)
- {
- try
- {
- count = (Pattern) xpath.compile(c);
- }
- catch (ClassCastException e)
- {
- String msg = "invalid pattern: " + c;
- throw new TransformerConfigurationException(msg);
- }
- }
- if (f != null)
- {
- try
- {
- from = (Pattern) xpath.compile(f);
- }
- catch (ClassCastException e)
- {
- String msg = "invalid pattern: " + f;
- throw new TransformerConfigurationException(msg);
- }
- }
- return new NodeNumberNode(parse(children), parse(next),
- level, count, from,
- format, lang,
- letterValue, gs, gz2);
- }
- }
-
- /**
- * copy-of
- */
- final TemplateNode parseCopyOf(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String s = getRequiredAttribute(attrs, "select", node);
- Expr select = (Expr) xpath.compile(s);
- return new CopyOfNode(parse(children), parse(next), select);
- }
-
- /**
- * message
- */
- final TemplateNode parseMessage(Node node, Node children, Node next)
- throws TransformerConfigurationException, XPathExpressionException
- {
- NamedNodeMap attrs = node.getAttributes();
- String t = getAttribute(attrs, "terminate");
- boolean terminate = "yes".equals(t);
- return new MessageNode(parse(children), parse(next), terminate);
- }
-
- /**
- * Parse template-level elements.
- */
- final TemplateNode parse(Node node)
- throws TransformerConfigurationException
- {
- if (node == null)
- {
- return null;
- }
- // Hack to associate the document function with its declaring node
- current = node;
- Node children = node.getFirstChild();
- Node next = node.getNextSibling();
- try
- {
- String namespaceUri = node.getNamespaceURI();
- if (Stylesheet.XSL_NS.equals(namespaceUri) &&
- Node.ELEMENT_NODE == node.getNodeType())
- {
- String name = node.getLocalName();
- if ("apply-templates".equals(name))
- {
- return parseApplyTemplates(node, children, next);
- }
- else if ("call-template".equals(name))
- {
- return parseCallTemplate(node, children, next);
- }
- else if ("value-of".equals(name))
- {
- return parseValueOf(node, children, next);
- }
- else if ("for-each".equals(name))
- {
- return parseForEach(node, children, next);
- }
- else if ("if".equals(name))
- {
- return parseIf(node, children, next);
- }
- else if ("choose".equals(name))
- {
- return new ChooseNode(parse(children), parse(next));
- }
- else if ("when".equals(name))
- {
- return parseWhen(node, children, next);
- }
- else if ("otherwise".equals(name))
- {
- return new OtherwiseNode(parse(children), parse(next));
- }
- else if ("element".equals(name))
- {
- return parseElement(node, children, next);
- }
- else if ("attribute".equals(name))
- {
- return parseAttribute(node, children, next);
- }
- else if ("text".equals(name))
- {
- return parseText(node, children, next);
- }
- else if ("copy".equals(name))
- {
- return parseCopy(node, children, next);
- }
- else if ("processing-instruction".equals(name))
- {
- return parseProcessingInstruction(node, children, next);
- }
- else if ("comment".equals(name))
- {
- return new CommentNode(parse(children), parse(next));
- }
- else if ("number".equals(name))
- {
- return parseNumber(node, children, next);
- }
- else if ("param".equals(name) ||
- "variable".equals(name))
- {
- boolean global = "variable".equals(name);
- NamedNodeMap attrs = node.getAttributes();
- TemplateNode content = parse(children);
- String paramName = getRequiredAttribute(attrs, "name", node);
- String select = getAttribute(attrs, "select");
- if (select != null)
- {
- if (content != null)
- {
- String msg = "parameter '" + paramName +
- "' has both select and content";
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(msg, l);
- }
- Expr expr = (Expr) xpath.compile(select);
- return new ParameterNode(null, parse(next),
- paramName, expr, global);
- }
- else
- {
- return new ParameterNode(content, parse(next),
- paramName, null, global);
- }
- }
- else if ("copy-of".equals(name))
- {
- return parseCopyOf(node, children, next);
- }
- else if ("message".equals(name))
- {
- return parseMessage(node, children, next);
- }
- else if ("apply-imports".equals(name))
- {
- return new ApplyImportsNode(parse(children), parse(next));
- }
- else
- {
- // xsl:fallback
- // Pass over any other XSLT nodes
- return parse(next);
- }
- }
- String prefix = node.getPrefix();
- if (extensionElementPrefixes.contains(prefix))
- {
- // Pass over extension elements
- return parse(next);
- }
- switch (node.getNodeType())
- {
- case Node.TEXT_NODE:
- // Determine whether to strip whitespace
- Text text = (Text) node;
- if (!isPreserved(text))
- {
- // Strip
- text.getParentNode().removeChild(text);
- return parse(next);
- }
- break;
- case Node.COMMENT_NODE:
- // Ignore comments
- return parse(next);
- case Node.ELEMENT_NODE:
- // Check for attribute value templates and use-attribute-sets
- NamedNodeMap attrs = node.getAttributes();
- boolean convert = false;
- String useAttributeSets = null;
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String value = attr.getNodeValue();
- if (Stylesheet.XSL_NS.equals(attr.getNamespaceURI()) &&
- "use-attribute-sets".equals(attr.getLocalName()))
- {
- useAttributeSets = value;
- convert = true;
- break;
- }
- int start = value.indexOf('{');
- int end = value.indexOf('}');
- if (start != -1 || end != -1)
- {
- convert = true;
- break;
- }
- }
- if (convert)
- {
- // Create an element-producing template node instead
- // with appropriate attribute-producing child template nodes
- TemplateNode child = parse(children);
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String ans = attr.getNamespaceURI();
- String aname = attr.getNodeName();
- if (Stylesheet.XSL_NS.equals(ans) &&
- "use-attribute-sets".equals(attr.getLocalName()))
- {
- continue;
- }
- String value = attr.getNodeValue();
- TemplateNode grandchild =
- parseAttributeValueTemplate(value, node);
- TemplateNode n =
- parseAttributeValueTemplate(aname, node);
- TemplateNode ns = (ans == null) ? null :
- parseAttributeValueTemplate(ans, node);
- child = new AttributeNode(grandchild, child, n, ns, attr);
- }
- String ename = node.getNodeName();
- TemplateNode n = parseAttributeValueTemplate(ename, node);
- TemplateNode ns = (namespaceUri == null) ? null :
- parseAttributeValueTemplate(namespaceUri, node);
- return new ElementNode(child, parse(next),
- n, ns, useAttributeSets,
- node);
- }
- // Otherwise fall through
- break;
- }
- }
- catch (XPathExpressionException e)
- {
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(e.getMessage(), l, e);
- }
- return new LiteralNode(parse(children), parse(next), node);
- }
-
- final List parseSortKeys(Node node)
- throws TransformerConfigurationException, XPathExpressionException
- {
- List ret = new LinkedList();
- while (node != null)
- {
- String namespaceUri = node.getNamespaceURI();
- if (Stylesheet.XSL_NS.equals(namespaceUri) &&
- Node.ELEMENT_NODE == node.getNodeType() &&
- "sort".equals(node.getLocalName()))
- {
- NamedNodeMap attrs = node.getAttributes();
- String s = getAttribute(attrs, "select");
- if (s == null)
- {
- s = ".";
- }
- Expr select = (Expr) xpath.compile(s);
- String l = getAttribute(attrs, "lang");
- TemplateNode lang = (l == null) ? null :
- parseAttributeValueTemplate(l, node);
- String dt = getAttribute(attrs, "data-type");
- TemplateNode dataType = (dt == null) ? null :
- parseAttributeValueTemplate(dt, node);
- String o = getAttribute(attrs, "order");
- TemplateNode order = (o == null) ? null :
- parseAttributeValueTemplate(o, node);
- String co = getAttribute(attrs, "case-order");
- TemplateNode caseOrder = (co == null) ? null :
- parseAttributeValueTemplate(co, node);
- ret.add(new SortKey(select, lang, dataType, order, caseOrder));
- }
- node = node.getNextSibling();
- }
- return ret.isEmpty() ? null : ret;
- }
-
- final List parseWithParams(Node node)
- throws TransformerConfigurationException, XPathExpressionException
- {
- List ret = new LinkedList();
- while (node != null)
- {
- String namespaceUri = node.getNamespaceURI();
- if (Stylesheet.XSL_NS.equals(namespaceUri) &&
- Node.ELEMENT_NODE == node.getNodeType() &&
- "with-param".equals(node.getLocalName()))
- {
- NamedNodeMap attrs = node.getAttributes();
- TemplateNode content = parse(node.getFirstChild());
- String name = getRequiredAttribute(attrs, "name", node);
- String select = getAttribute(attrs, "select");
- if (select != null)
- {
- if (content != null)
- {
- String msg = "parameter '" + name +
- "' has both select and content";
- DOMSourceLocator l = new DOMSourceLocator(node);
- throw new TransformerConfigurationException(msg, l);
- }
- Expr expr = (Expr) xpath.compile(select);
- ret.add(new WithParam(name, expr));
- }
- else
- {
- ret.add(new WithParam(name, content));
- }
- }
- node = node.getNextSibling();
- }
- return ret.isEmpty() ? null : ret;
- }
-
- /**
- * Created element nodes have a copy of the namespace nodes in the
- * stylesheet, except the XSLT namespace, extension namespaces, and
- * exclude-result-prefixes.
- */
- final void addNamespaceNodes(Node source, Node target, Document doc,
- Collection elementExcludeResultPrefixes)
- {
- NamedNodeMap attrs = source.getAttributes();
- if (attrs != null)
- {
- int len = attrs.getLength();
- for (int i = 0; i < len; i++)
- {
- Node attr = attrs.item(i);
- String uri = attr.getNamespaceURI();
- if (uri == XMLConstants.XMLNS_ATTRIBUTE_NS_URI)
- {
- String prefix = attr.getLocalName();
- if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix))
- {
- prefix = "#default";
- }
- String ns = attr.getNodeValue();
- // Should the namespace be excluded?
- if (XSL_NS.equals(ns) ||
- extensionElementPrefixes.contains(prefix) ||
- elementExcludeResultPrefixes.contains(prefix) ||
- excludeResultPrefixes.contains(prefix))
- {
- continue;
- }
- // Is the namespace already defined on the target?
- if (prefix == "#default")
- {
- prefix = null;
- }
- if (target.lookupNamespaceURI(prefix) != null)
- {
- continue;
- }
- attr = attr.cloneNode(true);
- attr = doc.adoptNode(attr);
- target.getAttributes().setNamedItemNS(attr);
- }
- }
- }
- Node parent = source.getParentNode();
- if (parent != null)
- {
- addNamespaceNodes(parent, target, doc, elementExcludeResultPrefixes);
- }
- }
-
- static final String getAttribute(NamedNodeMap attrs, String name)
- {
- Node attr = attrs.getNamedItem(name);
- if (attr == null)
- {
- return null;
- }
- String ret = attr.getNodeValue();
- if (ret.length() == 0)
- {
- return null;
- }
- return ret;
- }
-
- static final String getRequiredAttribute(NamedNodeMap attrs, String name,
- Node source)
- throws TransformerConfigurationException
- {
- String value = getAttribute(attrs, name);
- if (value == null || value.length() == 0)
- {
- String msg =
- name + " attribute is required on " + source.getNodeName();
- DOMSourceLocator l = new DOMSourceLocator(source);
- throw new TransformerConfigurationException(msg, l);
- }
- return value;
- }
-
- // Handle user data changes when nodes are cloned etc
-
- public void handle(short op, String key, Object data, Node src, Node dst)
- {
- dst.setUserData(key, data, this);
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/SystemPropertyFunction.java b/libjava/gnu/xml/transform/SystemPropertyFunction.java
deleted file mode 100644
index 33616d39628..00000000000
--- a/libjava/gnu/xml/transform/SystemPropertyFunction.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/* SystemPropertyFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-
-/**
- * The XSLT system-property()
function.
- *
- * @author Chris Burdess
- */
-final class SystemPropertyFunction
- extends Expr
- implements XPathFunction, Function
-{
-
- List args;
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- String name = (String) args.get(0);
- return systemProperty(QName.valueOf(name));
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- int arity = args.size();
- List values = new ArrayList(arity);
- for (int i = 0; i < arity; i++)
- {
- Expr arg = (Expr) args.get(i);
- values.add(arg.evaluate(context, pos, len));
- }
- String name = _string(context, values.get(0));
- return systemProperty(QName.valueOf(name));
- }
-
- Object systemProperty(QName name)
- {
- String localName = name.getLocalPart();
- String prefix = name.getPrefix();
- String uri = name.getNamespaceURI();
- if (Stylesheet.XSL_NS.equals(uri) ||
- "xsl".equals(prefix))
- {
- if ("version".equals(localName))
- {
- return new Double(1.0d);
- }
- else if ("vendor".equals(localName))
- {
- return "The Free Software Foundation";
- }
- else if ("vendor-url".equals(localName))
- {
- return "http://www.gnu.org/";
- }
- else
- {
- return "";
- }
- }
- return System.getProperty(localName);
- }
-
- public Expr clone(Object context)
- {
- SystemPropertyFunction f = new SystemPropertyFunction();
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/Template.java b/libjava/gnu/xml/transform/Template.java
deleted file mode 100644
index 1673a8aa63b..00000000000
--- a/libjava/gnu/xml/transform/Template.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/* Template.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.io.PrintStream;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.NameTest;
-import gnu.xml.xpath.NodeTypeTest;
-import gnu.xml.xpath.Pattern;
-import gnu.xml.xpath.Selector;
-import gnu.xml.xpath.Test;
-
-/**
- * A template in an XSL stylesheet.
- *
- * @author Chris Burdess
- */
-class Template
- implements Comparable
-{
-
- static final double DEFAULT_PRIORITY = 0.5d;
-
- final Stylesheet stylesheet;
- final QName name;
- final Pattern match;
- final TemplateNode node;
- final double priority;
- final int precedence;
- final QName mode;
-
- Template(Stylesheet stylesheet,
- QName name, Pattern match, TemplateNode node,
- int precedence, double priority, QName mode)
- {
- this.stylesheet = stylesheet;
- this.name = name;
- this.match = match;
- this.node = node;
- // adjust priority if necessary
- // see XSLT section 5.5
- Test test = getNodeTest(match);
- if (test != null)
- {
- if (test instanceof NameTest)
- {
- NameTest nameTest = (NameTest) test;
- if (nameTest.matchesAny() ||
- nameTest.matchesAnyLocalName())
- {
- priority = -0.25d;
- }
- else
- {
- priority = 0.0d;
- }
- }
- else
- {
- NodeTypeTest nodeTypeTest = (NodeTypeTest) test;
- if (nodeTypeTest.getNodeType() ==
- Node.PROCESSING_INSTRUCTION_NODE &&
- nodeTypeTest.getData() != null)
- {
- priority = 0.0d;
- }
- else
- {
- priority = -0.5d;
- }
- }
- }
- this.precedence = precedence;
- this.priority = priority;
- this.mode = mode;
- }
-
- Template clone(Stylesheet stylesheet)
- {
- // FIXME by cloning we lose the imports() functionality, so
- // apply-imports will be broken.
- return new Template(stylesheet,
- name,
- (match == null) ? null :
- (Pattern) match.clone(stylesheet),
- (node == null) ? null : node.clone(stylesheet),
- precedence,
- priority,
- mode);
- }
-
- public int compareTo(Object other)
- {
- if (other instanceof Template)
- {
- Template t = (Template) other;
- int d = t.precedence - precedence;
- if (d != 0)
- {
- return d;
- }
- double d2 = t.priority - priority;
- if (d2 != 0.0d)
- {
- return (int) Math.round(d2 * 1000.0d);
- }
- }
- return 0;
- }
-
- Test getNodeTest(Expr expr)
- {
- if (expr instanceof Selector)
- {
- Selector selector = (Selector) expr;
- Test[] tests = selector.getTests();
- if (tests.length > 0)
- {
- return tests[0];
- }
- }
- return null;
- }
-
- boolean matches(QName mode, Node node)
- {
- if ((mode == null && this.mode != null) ||
- (mode != null && !mode.equals(this.mode)))
- {
- return false;
- }
- if (match == null)
- {
- return false;
- }
- return match.matches(node);
- }
-
- boolean matches(QName name)
- {
- return name.equals(this.name);
- }
-
- boolean imports(Template other)
- {
- for (Stylesheet ctx = other.stylesheet.parent;
- ctx != null;
- ctx = ctx.parent)
- {
- if (ctx == stylesheet)
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @param stylesheet the stylesheet
- * @param parent the parent of result nodes
- * @param context the context node in the source document
- * @param pos the context position
- * @param len the context size
- * @param nextSibling if non-null, add result nodes before this node
- */
- void apply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- //System.err.println("...applying " + toString() + " to " + context);
- if (node != null)
- {
- node.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- if (name != null)
- {
- buf.append("name=");
- buf.append(name);
- }
- else if (match != null)
- {
- buf.append("match=");
- buf.append(match);
- }
- if (mode != null)
- {
- buf.append(",mode=");
- buf.append(mode);
- }
- buf.append(']');
- return buf.toString();
-
- //return (name != null) ? name.toString() : match.toString();
- }
-
- void list(PrintStream out)
- {
- out.println(toString());
- if (node != null)
- {
- node.list(1, out, true);
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/TemplateNode.java b/libjava/gnu/xml/transform/TemplateNode.java
deleted file mode 100644
index df13a4d1ec0..00000000000
--- a/libjava/gnu/xml/transform/TemplateNode.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/* TemplateNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.io.PrintStream;
-import java.util.Comparator;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.DocumentOrderComparator;
-
-/**
- * Wrapper for a source node in a template.
- *
- * @author Chris Burdess
- */
-abstract class TemplateNode
-{
-
- static final Comparator documentOrderComparator =
- new DocumentOrderComparator();
-
- final TemplateNode children;
- final TemplateNode next;
-
- TemplateNode(TemplateNode children, TemplateNode next)
- {
- this.children = children;
- this.next = next;
- }
-
- final void apply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- if (stylesheet.terminated)
- {
- return;
- }
- if (Thread.currentThread().isInterrupted())
- {
- // Try to head off any infinite loops at the pass
- return;
- }
- if (stylesheet.debug)
- {
- System.err.println("Applying " + toString());
- }
- doApply(stylesheet, mode, context, pos, len, parent, nextSibling);
- }
-
- abstract void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException;
-
- abstract TemplateNode clone(Stylesheet stylesheet);
-
- /**
- * Debugging
- */
- void list(int depth, PrintStream out, boolean listNext)
- {
- for (int i = 0; i < depth; i++)
- {
- out.print(" ");
- }
- out.println(toString());
- if (children != null)
- {
- children.list(depth + 1, out, true);
- }
- if (listNext && next != null)
- {
- next.list(depth, out, listNext);
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/TemplatesImpl.java b/libjava/gnu/xml/transform/TemplatesImpl.java
deleted file mode 100644
index 527bd979db0..00000000000
--- a/libjava/gnu/xml/transform/TemplatesImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* TemplatesImpl.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Properties;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-
-/**
- * GNU precompiled stylesheet implementation.
- *
- * @author Chris Burdess
- */
-class TemplatesImpl
- implements Templates
-{
-
- final TransformerFactoryImpl factory;
- final Stylesheet stylesheet;
- final Properties outputProperties;
-
- TemplatesImpl(TransformerFactoryImpl factory, Stylesheet stylesheet)
- {
- this.factory = factory;
- this.stylesheet = stylesheet;
- outputProperties = new TransformerOutputProperties(stylesheet);
- }
-
- public Transformer newTransformer()
- throws TransformerConfigurationException
- {
- Stylesheet stylesheet = (Stylesheet) this.stylesheet.clone();
- TransformerImpl transformer =
- new TransformerImpl(factory, stylesheet, outputProperties);
- stylesheet.transformer = transformer;
- return transformer;
- }
-
- public Properties getOutputProperties()
- {
- return (Properties) outputProperties.clone();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/TextNode.java b/libjava/gnu/xml/transform/TextNode.java
deleted file mode 100644
index b5ea1b57af7..00000000000
--- a/libjava/gnu/xml/transform/TextNode.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/* TextNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing the XSL text
instruction.
- *
- * @author Chris Burdess
- */
-final class TextNode
- extends TemplateNode
-{
-
- final boolean disableOutputEscaping;
-
- TextNode(TemplateNode children, TemplateNode next,
- boolean disableOutputEscaping)
- {
- super(children, next);
- this.disableOutputEscaping = disableOutputEscaping;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new TextNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- disableOutputEscaping);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- String value = "";
- Document doc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- if (children != null)
- {
- // Create a document fragment to hold the text
- DocumentFragment fragment = doc.createDocumentFragment();
- // Apply children to the fragment
- children.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- // Use XPath string-value of fragment
- value = Expr.stringValue(fragment);
- }
- Text text = doc.createTextNode(value);
- if (disableOutputEscaping)
- {
- text.setUserData("disable-output-escaping", "yes", stylesheet);
- }
- // Insert into result tree
- if (nextSibling != null)
- {
- parent.insertBefore(text, nextSibling);
- }
- else
- {
- parent.appendChild(text);
- }
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/TransformerFactoryImpl.java b/libjava/gnu/xml/transform/TransformerFactoryImpl.java
deleted file mode 100644
index dde2017ff6b..00000000000
--- a/libjava/gnu/xml/transform/TransformerFactoryImpl.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/* TransformerFactoryImpl.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Properties;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.xpath.XPathFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import gnu.xml.dom.DomDocument;
-
-/**
- * GNU transformer factory implementation.
- *
- * @author Chris Burdess
- */
-public class TransformerFactoryImpl
- extends TransformerFactory
-{
-
- final XPathFactory xpathFactory;
- final XSLURIResolver resolver;
- ErrorListener userListener;
- URIResolver userResolver;
-
- public TransformerFactoryImpl()
- {
- xpathFactory = new gnu.xml.xpath.XPathFactoryImpl();
- resolver = new XSLURIResolver();
- }
-
- public Transformer newTransformer(Source source)
- throws TransformerConfigurationException
- {
- Stylesheet stylesheet = newStylesheet(source, 0, null);
- Properties outputProperties =
- new TransformerOutputProperties(stylesheet);
- TransformerImpl transformer =
- new TransformerImpl(this, stylesheet, outputProperties);
- stylesheet.transformer = transformer;
- return transformer;
- }
-
- public Transformer newTransformer()
- throws TransformerConfigurationException
- {
- return new TransformerImpl(this, null, new Properties());
- }
-
- public Templates newTemplates(Source source)
- throws TransformerConfigurationException
- {
- Stylesheet stylesheet = newStylesheet(source, 0, null);
- return new TemplatesImpl(this, stylesheet);
- }
-
- Stylesheet newStylesheet(Source source, int precedence, Stylesheet parent)
- throws TransformerConfigurationException
- {
- Document doc = null;
- String systemId = null;
- if (source != null)
- {
- try
- {
- DOMSource ds;
- synchronized (resolver)
- {
- resolver.setUserResolver(userResolver);
- resolver.setUserListener(userListener);
- ds = resolver.resolveDOM(source, null, null);
- }
- Node node = ds.getNode();
- if (node == null)
- {
- throw new TransformerConfigurationException("no source document");
- }
- doc = (node instanceof Document) ? (Document) node :
- node.getOwnerDocument();
- systemId = ds.getSystemId();
- }
- catch (TransformerException e)
- {
- throw new TransformerConfigurationException(e);
- }
- }
- return new Stylesheet(this, parent, doc, systemId, precedence);
- }
-
- public Source getAssociatedStylesheet(Source source,
- String media,
- String title,
- String charset)
- throws TransformerConfigurationException
- {
- try
- {
- DOMSource ds;
- synchronized (resolver)
- {
- resolver.setUserResolver(userResolver);
- resolver.setUserListener(userListener);
- ds = resolver.resolveDOM(source, null, null);
- }
- Node node = ds.getNode();
- if (node == null)
- {
- throw new TransformerConfigurationException("no source document");
- }
- Document doc = (node instanceof Document) ? (Document) node :
- node.getOwnerDocument();
- LinkedList matches = new LinkedList();
- for (node = doc.getFirstChild();
- node != null;
- node = node.getNextSibling())
- {
- if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE &&
- "xml-stylesheet".equals(node.getNodeName()))
- {
- Map params = parseParameters(node.getNodeValue());
- if (media != null && !media.equals(params.get("media")))
- {
- continue;
- }
- if (title != null && !title.equals(params.get("title")))
- {
- continue;
- }
- if (charset != null && !charset.equals(params.get("charset")))
- {
- continue;
- }
- String href = (String) params.get("href");
- URL url = resolver.resolveURL(null, node.getBaseURI(), href);
- matches.add(url);
- }
- }
- switch (matches.size())
- {
- case 0:
- return null;
- case 1:
- return new StreamSource(((URL) matches.getFirst()).toString());
- default:
- // Create a source representing a stylesheet with a list of
- // imports
- DomDocument ssDoc = new DomDocument();
- ssDoc.setBuilding(true);
- // Create document element
- Node root =
- ssDoc.createElementNS(Stylesheet.XSL_NS, "stylesheet");
- Node version =
- ssDoc.createAttributeNS(null, "version");
- version.setNodeValue("1.0");
- root.getAttributes().setNamedItemNS(version);
- ssDoc.appendChild(root);
- // Create xsl:import for each URL
- for (Iterator i = matches.iterator(); i.hasNext(); )
- {
- URL url = (URL) i.next();
- Node imp =
- ssDoc.createElementNS(Stylesheet.XSL_NS, "import");
- Node href =
- ssDoc.createAttributeNS(null, "href");
- href.setNodeValue(url.toString());
- imp.getAttributes().setNamedItemNS(href);
- root.appendChild(imp);
- }
- ssDoc.setBuilding(false);
- return new DOMSource(ssDoc);
- }
- }
- catch (IOException e)
- {
- throw new TransformerConfigurationException(e);
- }
- catch (TransformerException e)
- {
- throw new TransformerConfigurationException(e);
- }
- }
-
- Map parseParameters(String data)
- {
- Map ret = new LinkedHashMap();
- int len = data.length();
- String key = null;
- int start = 0;
- char quoteChar = '\u0000';
- for (int i = 0; i < len; i++)
- {
- char c = data.charAt(i);
- if (quoteChar == '\u0000' && c == ' ')
- {
- if (key == null && start < i)
- {
- key = data.substring(start, i);
- }
- else
- {
- String val = unquote(data.substring(start, i).trim());
- ret.put(key, val);
- key = null;
- }
- start = i + 1;
- }
- else if (c == '"')
- {
- quoteChar = (quoteChar == c) ? '\u0000' : c;
- }
- else if (c == '\'')
- {
- quoteChar = (quoteChar == c) ? '\u0000' : c;
- }
- }
- if (start < len && key != null)
- {
- String val = unquote(data.substring(start, len).trim());
- ret.put(key, val);
- }
- return ret;
- }
-
- String unquote(String text)
- {
- int end = text.length() - 1;
- if (text.charAt(0) == '\'' && text.charAt(end) == '\'')
- {
- return text.substring(1, end);
- }
- if (text.charAt(0) == '"' && text.charAt(end) == '"')
- {
- return text.substring(1, end);
- }
- return text;
- }
-
- public void setURIResolver(URIResolver resolver)
- {
- userResolver = resolver;
- }
-
- public URIResolver getURIResolver()
- {
- return userResolver;
- }
-
- public void setFeature(String name, boolean value)
- throws TransformerConfigurationException
- {
- throw new TransformerConfigurationException("not supported");
- }
-
- public boolean getFeature(String name)
- {
- if (SAXSource.FEATURE.equals(name) ||
- SAXResult.FEATURE.equals(name) ||
- StreamSource.FEATURE.equals(name) ||
- StreamResult.FEATURE.equals(name) ||
- DOMSource.FEATURE.equals(name) ||
- DOMResult.FEATURE.equals(name))
- {
- return true;
- }
- return false;
- }
-
- public void setAttribute(String name, Object value)
- throws IllegalArgumentException
- {
- throw new IllegalArgumentException("not supported");
- }
-
- public Object getAttribute(String name)
- throws IllegalArgumentException
- {
- throw new IllegalArgumentException("not supported");
- }
-
- public void setErrorListener(ErrorListener listener)
- throws IllegalArgumentException
- {
- userListener = listener;
- }
-
- public ErrorListener getErrorListener()
- {
- return userListener;
- }
-
-}
diff --git a/libjava/gnu/xml/transform/TransformerImpl.java b/libjava/gnu/xml/transform/TransformerImpl.java
deleted file mode 100644
index 73c4c0a4e08..00000000000
--- a/libjava/gnu/xml/transform/TransformerImpl.java
+++ /dev/null
@@ -1,580 +0,0 @@
-/* TransformerImpl.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.io.BufferedOutputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.UnknownServiceException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Collection;
-import java.util.Properties;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
-import gnu.xml.dom.DomDoctype;
-import gnu.xml.dom.DomDocument;
-import gnu.xml.dom.ls.WriterOutputStream;
-
-/**
- * The transformation process for a given stylesheet.
- *
- * @author Chris Burdess
- */
-class TransformerImpl
- extends Transformer
-{
-
- final TransformerFactoryImpl factory;
- final Stylesheet stylesheet;
- URIResolver uriResolver;
- ErrorListener errorListener;
- Properties outputProperties;
-
- TransformerImpl(TransformerFactoryImpl factory,
- Stylesheet stylesheet,
- Properties outputProperties)
- throws TransformerConfigurationException
- {
- this.factory = factory;
- uriResolver = factory.userResolver;
- errorListener = factory.userListener;
- this.stylesheet = stylesheet;
- this.outputProperties = outputProperties;
- if (stylesheet != null)
- {
- // Set up parameter context for this transformer
- stylesheet.bindings.push(false);
- }
- }
-
- public void transform(Source xmlSource, Result outputTarget)
- throws TransformerException
- {
- // Get the source tree
- DOMSource source;
- synchronized (factory.resolver)
- {
- factory.resolver.setUserResolver(uriResolver);
- factory.resolver.setUserListener(errorListener);
- source = factory.resolver.resolveDOM(xmlSource, null, null);
- }
- Node context = source.getNode();
- Document doc = (context instanceof Document) ? (Document) context :
- context.getOwnerDocument();
- if (doc instanceof DomDocument)
- {
- // Suppress mutation events
- ((DomDocument) doc).setBuilding(true);
- // TODO find a better/more generic way of doing this than
- // casting
- }
- // Get the result tree
- Node parent = null, nextSibling = null;
- if (outputTarget instanceof DOMResult)
- {
- DOMResult dr = (DOMResult) outputTarget;
- parent = dr.getNode();
- nextSibling = dr.getNextSibling();
-
- Document rdoc = (parent instanceof Document) ? (Document) parent :
- parent.getOwnerDocument();
- if (rdoc instanceof DomDocument)
- {
- // Suppress mutation events and allow multiple root elements
- DomDocument drdoc = (DomDocument) rdoc;
- drdoc.setBuilding(true);
- drdoc.setCheckWellformedness(false);
- // TODO find a better/more generic way of doing this than
- // casting
- }
- }
- boolean created = false;
- // Transformation
- if (stylesheet != null)
- {
- if (parent == null)
- {
- // Create a new document to hold the result
- DomDocument resultDoc = new DomDocument();
- resultDoc.setBuilding(true);
- resultDoc.setCheckWellformedness(false);
- parent = resultDoc;
- created = true;
- }
- // Make a copy of the source node, and strip it
- context = context.cloneNode(true);
- strip(context);
- // XSLT transformation
- try
- {
- // Set output properties in the underlying stylesheet
- ((TransformerOutputProperties) outputProperties).apply();
- stylesheet.initTopLevelVariables(context);
- TemplateNode t = stylesheet.getTemplate(null, context, false);
- if (t != null)
- {
- stylesheet.current = context;
- t.apply(stylesheet, null, context, 1, 1, parent, nextSibling);
- }
- }
- catch (TransformerException e)
- {
- // Done transforming, reset document
- if (doc instanceof DomDocument)
- {
- ((DomDocument) doc).setBuilding(false);
- }
- throw e;
- }
- }
- else
- {
- // Identity transform
- Node clone = context.cloneNode(true);
- if (context.getNodeType() != Node.DOCUMENT_NODE)
- {
- Document resultDoc;
- if (parent == null)
- {
- // Create a new document to hold the result
- DomDocument rd = new DomDocument();
- rd.setBuilding(true);
- rd.setCheckWellformedness(false);
- parent = resultDoc = rd;
- created = true;
- }
- else
- {
- resultDoc = (parent instanceof Document) ?
- (Document) parent :
- parent.getOwnerDocument();
- }
- Document sourceDoc = context.getOwnerDocument();
- if (sourceDoc != resultDoc)
- {
- clone = resultDoc.adoptNode(clone);
- }
- if (nextSibling != null)
- {
- parent.insertBefore(clone, nextSibling);
- }
- else
- {
- parent.appendChild(clone);
- }
- }
- else
- {
- // Cannot append document to another tree
- parent = clone;
- created = true;
- }
- }
- String method = outputProperties.getProperty(OutputKeys.METHOD);
- int outputMethod = "html".equals(method) ? Stylesheet.OUTPUT_HTML :
- "text".equals(method) ? Stylesheet.OUTPUT_TEXT :
- Stylesheet.OUTPUT_XML;
- String encoding = outputProperties.getProperty(OutputKeys.ENCODING);
- String publicId = outputProperties.getProperty(OutputKeys.DOCTYPE_PUBLIC);
- String systemId = outputProperties.getProperty(OutputKeys.DOCTYPE_SYSTEM);
- String version = outputProperties.getProperty(OutputKeys.VERSION);
- boolean omitXmlDeclaration =
- "yes".equals(outputProperties.getProperty(OutputKeys.OMIT_XML_DECLARATION));
- boolean standalone =
- "yes".equals(outputProperties.getProperty(OutputKeys.STANDALONE));
- String mediaType = outputProperties.getProperty(OutputKeys.MEDIA_TYPE);
- // TODO cdata-section-elements
- // TODO indent
- if (created)
- {
- // Discover document element
- DomDocument resultDoc = (DomDocument) parent;
- Node root = resultDoc.getDocumentElement();
- // Add doctype if specified
- if ((publicId != null || systemId != null) &&
- root != null)
- {
- // We must know the name of the root element to
- // create the document type
- resultDoc.appendChild(new DomDoctype(resultDoc,
- root.getNodeName(),
- publicId,
- systemId));
- }
- resultDoc.setBuilding(false);
- resultDoc.setCheckWellformedness(true);
- }
- else if (publicId != null || systemId != null)
- {
- switch (parent.getNodeType())
- {
- case Node.DOCUMENT_NODE:
- case Node.DOCUMENT_FRAGMENT_NODE:
- Document resultDoc = (parent instanceof Document) ?
- (Document) parent :
- parent.getOwnerDocument();
- DOMImplementation impl = resultDoc.getImplementation();
- DocumentType doctype =
- impl.createDocumentType(resultDoc.getNodeName(),
- publicId,
- systemId);
- // Try to insert doctype before first element
- Node ctx = parent.getFirstChild();
- for (; ctx != null &&
- ctx.getNodeType() != Node.ELEMENT_NODE;
- ctx = ctx.getNextSibling())
- {
- }
- if (ctx != null)
- {
- parent.insertBefore(doctype, ctx);
- }
- else
- {
- parent.appendChild(doctype);
- }
- }
- }
- if (version != null)
- {
- parent.setUserData("version", version, stylesheet);
- }
- if (omitXmlDeclaration)
- {
- parent.setUserData("omit-xml-declaration", "yes", stylesheet);
- }
- if (standalone)
- {
- parent.setUserData("standalone", "yes", stylesheet);
- }
- if (mediaType != null)
- {
- parent.setUserData("media-type", mediaType, stylesheet);
- }
- // Render result to the target device
- if (outputTarget instanceof DOMResult)
- {
- if (created)
- {
- DOMResult dr = (DOMResult) outputTarget;
- dr.setNode(parent);
- dr.setNextSibling(null);
- }
- }
- else if (outputTarget instanceof StreamResult)
- {
- StreamResult sr = (StreamResult) outputTarget;
- IOException ex = null;
- try
- {
- writeStreamResult(parent, sr, outputMethod, encoding);
- }
- catch (UnsupportedEncodingException e)
- {
- try
- {
- writeStreamResult(parent, sr, outputMethod, "UTF-8");
- }
- catch (IOException e2)
- {
- ex = e2;
- }
- }
- catch (IOException e)
- {
- ex = e;
- }
- if (ex != null)
- {
- if (errorListener != null)
- {
- errorListener.error(new TransformerException(ex));
- }
- else
- {
- ex.printStackTrace(System.err);
- }
- }
- }
- else if (outputTarget instanceof SAXResult)
- {
- SAXResult sr = (SAXResult) outputTarget;
- try
- {
- ContentHandler ch = sr.getHandler();
- LexicalHandler lh = sr.getLexicalHandler();
- if (lh == null && ch instanceof LexicalHandler)
- {
- lh = (LexicalHandler) ch;
- }
- SAXSerializer serializer = new SAXSerializer();
- serializer.serialize(parent, ch, lh);
- }
- catch (SAXException e)
- {
- if (errorListener != null)
- {
- errorListener.error(new TransformerException(e));
- }
- else
- {
- e.printStackTrace(System.err);
- }
- }
- }
- }
-
- /**
- * Strip whitespace from the source tree.
- */
- void strip(Node node)
- throws TransformerConfigurationException
- {
- short nt = node.getNodeType();
- if (nt == Node.ENTITY_REFERENCE_NODE)
- {
- // Replace entity reference with its content
- Node parent = node.getParentNode();
- Node child = node.getFirstChild();
- if (child != null)
- {
- strip(child);
- }
- while (child != null)
- {
- Node next = child.getNextSibling();
- node.removeChild(child);
- parent.insertBefore(child, node);
- child = next;
- }
- parent.removeChild(node);
- }
- if (nt == Node.TEXT_NODE) // CDATA sections ?
- {
- if (!stylesheet.isPreserved((Text) node))
- {
- node.getParentNode().removeChild(node);
- }
- }
- else
- {
- for (Node child = node.getFirstChild(); child != null;
- child = child.getNextSibling())
- {
- strip(child);
- }
- }
- }
-
- /**
- * Obtain a suitable output stream for writing the result to,
- * and use the StreamSerializer to write the result tree to the stream.
- */
- void writeStreamResult(Node node, StreamResult sr, int outputMethod,
- String encoding)
- throws IOException
- {
- OutputStream out = null;
- try
- {
- out = sr.getOutputStream();
- if (out == null)
- {
- Writer writer = sr.getWriter();
- if (writer != null)
- {
- out = new WriterOutputStream(writer);
- }
- }
- if (out == null)
- {
- String systemId = sr.getSystemId();
- try
- {
- URL url = new URL(systemId);
- URLConnection connection = url.openConnection();
- connection.setDoOutput(true);
- out = connection.getOutputStream();
- }
- catch (MalformedURLException e)
- {
- out = new FileOutputStream(systemId);
- }
- catch (UnknownServiceException e)
- {
- URL url = new URL(systemId);
- out = new FileOutputStream(url.getPath());
- }
- }
- out = new BufferedOutputStream(out);
- StreamSerializer serializer =
- new StreamSerializer(outputMethod, encoding, null);
- if (stylesheet != null)
- {
- Collection celem = stylesheet.outputCdataSectionElements;
- serializer.setCdataSectionElements(celem);
- }
- serializer.serialize(node, out);
- out.flush();
- }
- finally
- {
- try
- {
- if (out != null)
- {
- out.close();
- }
- }
- catch (IOException e)
- {
- }
- }
- }
-
- void copyChildren(Document dstDoc, Node src, Node dst)
- {
- Node srcChild = src.getFirstChild();
- while (srcChild != null)
- {
- Node dstChild = dstDoc.adoptNode(srcChild);
- dst.appendChild(dstChild);
- srcChild = srcChild.getNextSibling();
- }
- }
-
- public void setParameter(String name, Object value)
- {
- if (stylesheet != null)
- {
- stylesheet.bindings.set(name, value, false);
- }
- }
-
- public Object getParameter(String name)
- {
- if (stylesheet != null)
- {
- return stylesheet.bindings.get(name, null, 1, 1);
- }
- return null;
- }
-
- public void clearParameters()
- {
- if (stylesheet != null)
- {
- stylesheet.bindings.pop(false);
- stylesheet.bindings.push(false);
- }
- }
-
- public void setURIResolver(URIResolver resolver)
- {
- uriResolver = resolver;
- }
-
- public URIResolver getURIResolver()
- {
- return uriResolver;
- }
-
- public void setOutputProperties(Properties oformat)
- throws IllegalArgumentException
- {
- if (oformat == null)
- {
- outputProperties.clear();
- }
- else
- {
- outputProperties.putAll(oformat);
- }
- }
-
- public Properties getOutputProperties()
- {
- return (Properties) outputProperties.clone();
- }
-
- public void setOutputProperty(String name, String value)
- throws IllegalArgumentException
- {
- outputProperties.put(name, value);
- }
-
- public String getOutputProperty(String name)
- throws IllegalArgumentException
- {
- return outputProperties.getProperty(name);
- }
-
- public void setErrorListener(ErrorListener listener)
- {
- errorListener = listener;
- }
-
- public ErrorListener getErrorListener()
- {
- return errorListener;
- }
-
-}
diff --git a/libjava/gnu/xml/transform/TransformerOutputProperties.java b/libjava/gnu/xml/transform/TransformerOutputProperties.java
deleted file mode 100644
index cc8593c4601..00000000000
--- a/libjava/gnu/xml/transform/TransformerOutputProperties.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/* TransformerOutputProperties.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import javax.xml.transform.OutputKeys;
-
-/**
- * Helper class to manage JAXP user setting of output properties.
- *
- * @author Chris Burdess
- */
-class TransformerOutputProperties
- extends Properties
-{
-
- final Properties defaultProperties;
- final Stylesheet stylesheet;
- boolean dirty;
-
- TransformerOutputProperties(Stylesheet stylesheet)
- {
- this.stylesheet = stylesheet;
- defaultProperties = new Properties();
- switch (stylesheet.outputMethod)
- {
- case Stylesheet.OUTPUT_XML:
- defaultProperties.put(OutputKeys.METHOD, "xml");
- break;
- case Stylesheet.OUTPUT_HTML:
- defaultProperties.put(OutputKeys.METHOD, "html");
- break;
- case Stylesheet.OUTPUT_TEXT:
- defaultProperties.put(OutputKeys.METHOD, "text");
- break;
- }
- if (stylesheet.outputVersion != null)
- {
- defaultProperties.put(OutputKeys.VERSION, stylesheet.outputVersion);
- }
- if (stylesheet.outputEncoding != null)
- {
- defaultProperties.put(OutputKeys.ENCODING, stylesheet.outputEncoding);
- }
- defaultProperties.put(OutputKeys.OMIT_XML_DECLARATION,
- stylesheet.outputOmitXmlDeclaration ? "yes" : "no");
- defaultProperties.put(OutputKeys.STANDALONE,
- stylesheet.outputStandalone ? "yes" : "no");
- if (stylesheet.outputPublicId != null)
- {
- defaultProperties.put(OutputKeys.DOCTYPE_PUBLIC,
- stylesheet.outputPublicId);
- }
- if (stylesheet.outputSystemId != null)
- {
- defaultProperties.put(OutputKeys.DOCTYPE_SYSTEM,
- stylesheet.outputSystemId);
- }
- StringBuffer buf = new StringBuffer();
- for (Iterator i = stylesheet.outputCdataSectionElements.iterator();
- i.hasNext(); )
- {
- if (buf.length() > 0)
- {
- buf.append(' ');
- }
- buf.append((String) i.next());
- }
- defaultProperties.put(OutputKeys.CDATA_SECTION_ELEMENTS, buf.toString());
- defaultProperties.put(OutputKeys.INDENT,
- stylesheet.outputIndent ? "yes" : "no");
- if (stylesheet.outputMediaType != null)
- {
- defaultProperties.put(OutputKeys.MEDIA_TYPE,
- stylesheet.outputMediaType);
- }
- }
-
- public String getProperty(String key)
- {
- String val = super.getProperty(key);
- if (val == null)
- {
- val = defaultProperties.getProperty(key);
- }
- return val;
- }
-
- public Object put(Object key, Object value)
- {
- Object ret = super.put(key, value);
- dirty = true;
- return ret;
- }
-
- public void clear()
- {
- super.clear();
- dirty = true;
- }
-
- /**
- * Applies the current set of properties to the underlying stylesheet.
- */
- void apply()
- {
- if (!dirty)
- {
- return;
- }
- String method = getProperty(OutputKeys.METHOD);
- if ("xml".equals(method))
- {
- stylesheet.outputMethod = Stylesheet.OUTPUT_XML;
- }
- else if ("html".equals(method))
- {
- stylesheet.outputMethod = Stylesheet.OUTPUT_HTML;
- }
- else if ("text".equals(method))
- {
- stylesheet.outputMethod = Stylesheet.OUTPUT_TEXT;
- }
- stylesheet.outputVersion = getProperty(OutputKeys.VERSION);
- stylesheet.outputEncoding = getProperty(OutputKeys.ENCODING);
- stylesheet.outputOmitXmlDeclaration =
- "yes".equals(getProperty(OutputKeys.OMIT_XML_DECLARATION));
- stylesheet.outputStandalone =
- "yes".equals(getProperty(OutputKeys.STANDALONE));
- stylesheet.outputPublicId = getProperty(OutputKeys.DOCTYPE_PUBLIC);
- stylesheet.outputSystemId = getProperty(OutputKeys.DOCTYPE_SYSTEM);
- StringTokenizer st =
- new StringTokenizer(getProperty(OutputKeys.CDATA_SECTION_ELEMENTS));
- Collection acc = new LinkedHashSet();
- while (st.hasMoreTokens())
- {
- acc.add(st.nextToken());
- }
- stylesheet.outputCdataSectionElements = acc;
- stylesheet.outputIndent = "yes".equals(getProperty(OutputKeys.INDENT));
- stylesheet.outputMediaType = getProperty(OutputKeys.MEDIA_TYPE);
- dirty = false;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/URIResolverEntityResolver.java b/libjava/gnu/xml/transform/URIResolverEntityResolver.java
deleted file mode 100644
index 762416fde36..00000000000
--- a/libjava/gnu/xml/transform/URIResolverEntityResolver.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* URIResolverEntityResolver.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.io.IOException;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.sax.SAXSource;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * EntityResolver that wraps a URIResolver.
- *
- * @author Chris Burdess
- */
-class URIResolverEntityResolver
- implements EntityResolver
-{
-
- final URIResolver resolver;
-
- URIResolverEntityResolver(URIResolver resolver)
- {
- this.resolver = resolver;
- }
-
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException
- {
- try
- {
- Source source = resolver.resolve(null, systemId);
- if (source == null)
- {
- return null;
- }
- return SAXSource.sourceToInputSource(source);
- }
- catch (TransformerException e)
- {
- throw new SAXException(e);
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/UnparsedEntityUriFunction.java b/libjava/gnu/xml/transform/UnparsedEntityUriFunction.java
deleted file mode 100644
index ca72b6534df..00000000000
--- a/libjava/gnu/xml/transform/UnparsedEntityUriFunction.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/* UnparsedEntityUriFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.Notation;
-import gnu.xml.xpath.Expr;
-import gnu.xml.xpath.Function;
-
-/**
- * The XSLT unparsed-entity-uri()
function.
- *
- * @author Chris Burdess
- */
-final class UnparsedEntityUriFunction
- extends Expr
- implements XPathFunction, Function
-{
-
- List args;
-
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- // Useless...
- return Collections.EMPTY_SET;
- }
-
- public void setArguments(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- int arity = args.size();
- List values = new ArrayList(arity);
- for (int i = 0; i < arity; i++)
- {
- Expr arg = (Expr) args.get(i);
- values.add(arg.evaluate(context, pos, len));
- }
- String name = _string(context, values.get(0));
- DocumentType doctype = context.getOwnerDocument().getDoctype();
- if (doctype != null)
- {
- NamedNodeMap notations = doctype.getNotations();
- Notation notation = (Notation) notations.getNamedItem(name);
- if (notation != null)
- {
- String systemId = notation.getSystemId();
- // XXX absolutize?
- if (systemId != null)
- {
- return systemId;
- }
- }
- }
- return "";
- }
-
- public Expr clone(Object context)
- {
- UnparsedEntityUriFunction f = new UnparsedEntityUriFunction();
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- f.setArguments(args2);
- return f;
- }
-
-}
-
diff --git a/libjava/gnu/xml/transform/ValueOfNode.java b/libjava/gnu/xml/transform/ValueOfNode.java
deleted file mode 100644
index 88ab166911d..00000000000
--- a/libjava/gnu/xml/transform/ValueOfNode.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* ValueOfNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing an XSLT value-of
instruction.
- *
- * @author Chris Burdess
- */
-final class ValueOfNode
- extends TemplateNode
-{
-
- final Expr select;
- final boolean disableOutputEscaping;
-
- ValueOfNode(TemplateNode children, TemplateNode next, Expr select,
- boolean disableOutputEscaping)
- {
- super(children, next);
- this.select = select;
- this.disableOutputEscaping = disableOutputEscaping;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new ValueOfNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- select.clone(stylesheet),
- disableOutputEscaping);
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Object ret = select.evaluate(context, pos, len);
- String value = Expr._string(context, ret);
- //System.err.println("value-of: "+context+" "+ select + " -> "+ value);
- if (value != null && value.length() > 0)
- {
- Document doc = (parent instanceof Document) ?
- (Document) parent : parent.getOwnerDocument();
- Text textNode = doc.createTextNode(value);
- if (disableOutputEscaping)
- {
- textNode.setUserData("disable-output-escaping", "yes", stylesheet);
- }
- if (nextSibling != null)
- {
- parent.insertBefore(textNode, nextSibling);
- }
- else
- {
- parent.appendChild(textNode);
- }
- }
- // value-of doesn't process children
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("select=");
- buf.append(select);
- if (disableOutputEscaping)
- {
- buf.append(",disableOutputEscaping");
- }
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/WhenNode.java b/libjava/gnu/xml/transform/WhenNode.java
deleted file mode 100644
index 8c292fb279b..00000000000
--- a/libjava/gnu/xml/transform/WhenNode.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/* WhenNode.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A template node representing an XSL when
instruction.
- *
- * @author Chris Burdess
- */
-final class WhenNode
- extends TemplateNode
-{
-
- final Expr test;
-
- WhenNode(TemplateNode children, TemplateNode next, Expr test)
- {
- super(children, next);
- this.test = test;
- }
-
- TemplateNode clone(Stylesheet stylesheet)
- {
- return new WhenNode((children == null) ? null :
- children.clone(stylesheet),
- (next == null) ? null :
- next.clone(stylesheet),
- test.clone(stylesheet));
- }
-
- void doApply(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len,
- Node parent, Node nextSibling)
- throws TransformerException
- {
- Object ret = test.evaluate(context, pos, len);
- boolean success = (ret instanceof Boolean) ?
- ((Boolean) ret).booleanValue() :
- Expr._boolean(context, ret);
- if (success)
- {
- if (children != null)
- {
- children.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
- else
- {
- if (next != null)
- {
- next.apply(stylesheet, mode,
- context, pos, len,
- parent, nextSibling);
- }
- }
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append('[');
- buf.append("test=");
- buf.append(test);
- buf.append(']');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/transform/WithParam.java b/libjava/gnu/xml/transform/WithParam.java
deleted file mode 100644
index 7c3379833ce..00000000000
--- a/libjava/gnu/xml/transform/WithParam.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/* WithParam.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Collections;
-import javax.xml.namespace.QName;
-import javax.xml.transform.TransformerException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * A specification for setting a variable or parameter during template
- * processing with apply-templates
or
- * call-template
.
- *
- * @author Chris Burdess
- */
-final class WithParam
-{
-
- final String name;
- final Expr select;
- final TemplateNode content;
-
- WithParam(String name, Expr select)
- {
- this.name = name;
- this.select = select;
- content = null;
- }
-
- WithParam(String name, TemplateNode content)
- {
- this.name = name;
- this.content = content;
- select = null;
- }
-
- Object getValue(Stylesheet stylesheet, QName mode,
- Node context, int pos, int len)
- throws TransformerException
- {
- if (select != null)
- {
- return select.evaluate(context, pos, len);
- }
- else
- {
- Document doc = (context instanceof Document) ? (Document) context :
- context.getOwnerDocument();
- DocumentFragment fragment = doc.createDocumentFragment();
- content.apply(stylesheet, mode,
- context, pos, len,
- fragment, null);
- return Collections.singleton(fragment);
- }
- }
-
- WithParam clone(Stylesheet stylesheet)
- {
- if (content == null)
- {
- return new WithParam(name,
- select.clone(stylesheet));
- }
- else
- {
- return new WithParam(name,
- content.clone(stylesheet));
- }
- }
-
-}
diff --git a/libjava/gnu/xml/transform/XSLComparator.java b/libjava/gnu/xml/transform/XSLComparator.java
deleted file mode 100644
index 222f370c8b9..00000000000
--- a/libjava/gnu/xml/transform/XSLComparator.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/* XSLComparator.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.text.Collator;
-import org.w3c.dom.Node;
-import gnu.xml.xpath.Expr;
-
-/**
- * Comparator for sorting lists of nodes according to a list of sort keys.
- *
- * @author Chris Burdess
- */
-class XSLComparator
- implements Comparator
-{
-
- final List sortKeys;
-
- XSLComparator(List sortKeys)
- {
- this.sortKeys = sortKeys;
- }
-
- public int compare(Object o1, Object o2)
- {
- if (o1 instanceof Node && o2 instanceof Node)
- {
- Node n1 = (Node) o1;
- Node n2 = (Node) o2;
- for (Iterator i = sortKeys.iterator(); i.hasNext(); )
- {
- SortKey sortKey = (SortKey) i.next();
- String k1 = sortKey.key(n1);
- String k2 = sortKey.key(n2);
- if ("text".equals(sortKey.dataType))
- {
- Locale locale = (sortKey.lang == null) ? Locale.getDefault() :
- new Locale(sortKey.lang);
- Collator collator = Collator.getInstance(locale);
- int d = collator.compare(k1, k2);
- if (d != 0)
- {
- switch (sortKey.caseOrder)
- {
- case SortKey.UPPER_FIRST:
- // TODO
- break;
- case SortKey.LOWER_FIRST:
- // TODO
- break;
- }
- if (sortKey.descending)
- {
- d = -d;
- }
- return d;
- }
- }
- else if ("number".equals(sortKey.dataType))
- {
- double kn1 = Expr._number(n1, k1);
- double kn2 = Expr._number(n2, k2);
- int d;
- if (Double.isNaN(kn1) || Double.isInfinite(kn2))
- {
- d = -1;
- }
- else if (Double.isNaN(kn2) || Double.isInfinite(kn1))
- {
- d = 1;
- }
- else
- {
- // conversion to int may give 0 for small numbers
- d = (kn1 > kn2) ? 1 : (kn1 < kn2) ? -1 : 0;
- }
- return (sortKey.descending) ? -d : d;
- }
- }
- }
- return 0;
- }
-
-}
diff --git a/libjava/gnu/xml/transform/XSLURIResolver.java b/libjava/gnu/xml/transform/XSLURIResolver.java
deleted file mode 100644
index 2e4e6545a87..00000000000
--- a/libjava/gnu/xml/transform/XSLURIResolver.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/* XSLURIResolver.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.transform;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamSource;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import gnu.xml.dom.ls.ReaderInputStream;
-
-/**
- * URI resolver for XSLT.
- * This resolver parses external entities into DOMSources. It
- * maintains a cache of URIs to DOMSources to avoid expensive re-parsing.
- *
- * @author Chris Burdess
- */
-class XSLURIResolver
- implements URIResolver
-{
-
- Map lastModifiedCache = new HashMap();
- Map nodeCache = new HashMap();
- DocumentBuilder builder;
- URIResolver userResolver;
- ErrorListener userListener;
-
- void setUserResolver(URIResolver userResolver)
- {
- this.userResolver = userResolver;
- }
-
- void setUserListener(ErrorListener userListener)
- {
- this.userListener = userListener;
- }
-
- /**
- * Clear the cache.
- */
- void flush()
- {
- lastModifiedCache.clear();
- nodeCache.clear();
- }
-
- public Source resolve(String href, String base)
- throws TransformerException
- {
- Source source = null;
- if (userResolver != null)
- {
- source = userResolver.resolve(base, href);
- }
- return resolveDOM(source, href, base);
- }
-
- DOMSource resolveDOM(Source source, String base, String href)
- throws TransformerException
- {
- if (source != null && source instanceof DOMSource)
- {
- return (DOMSource) source;
- }
- String systemId = (source == null) ? null : source.getSystemId();
- long lastModified = 0L, lastLastModified = 0L;
-
- try
- {
- URL url = resolveURL(systemId, base, href);
- Node node = null;
- InputStream in = null;
- if (source instanceof StreamSource)
- {
- StreamSource ss = (StreamSource) source;
- in = ss.getInputStream();
- if (in == null)
- {
- Reader reader = ss.getReader();
- if (reader != null)
- {
- in = new ReaderInputStream(reader);
- }
- }
- }
- if (in == null && url != null)
- {
- systemId = url.toString();
- node = (Node) nodeCache.get(systemId);
- // Is the resource up to date?
- URLConnection conn = url.openConnection();
- Long llm = (Long) lastModifiedCache.get(systemId);
- if (llm != null)
- {
- lastLastModified = llm.longValue();
- conn.setIfModifiedSince(lastLastModified);
- }
- conn.connect();
- lastModified = conn.getLastModified();
- if (node != null &&
- lastModified > 0L &&
- lastModified <= lastLastModified)
- {
- // Resource unchanged
- return new DOMSource(node, systemId);
- }
- else
- {
- // Resource new or modified
- in = conn.getInputStream();
- nodeCache.put(systemId, node);
- lastModifiedCache.put(systemId, new Long(lastModified));
- }
- }
- InputSource input = new InputSource(in);
- input.setSystemId(systemId);
- DocumentBuilder builder = getDocumentBuilder();
- node = builder.parse(input);
- return new DOMSource(node, systemId);
- }
- catch (IOException e)
- {
- throw new TransformerException(e);
- }
- catch (SAXException e)
- {
- throw new TransformerException(e);
- }
- }
-
- URL resolveURL(String systemId, String base, String href)
- throws IOException
- {
- URL url = null;
- try
- {
- if (systemId != null)
- {
- try
- {
- url = new URL(systemId);
- }
- catch (MalformedURLException e)
- {
- // Try building from base + href
- }
- }
- if (url == null)
- {
- if (base != null)
- {
- URL baseURL = new URL(base);
- url = new URL(baseURL, href);
- }
- else if (href != null)
- {
- url = new URL(href);
- }
- }
- return url;
- }
- catch (MalformedURLException e)
- {
- // Fall back to local filesystem
- File file = null;
- if (href == null)
- {
- href = systemId;
- }
- if (base != null)
- {
- int lsi = base.lastIndexOf(File.separatorChar);
- if (lsi != -1 && lsi < base.length() - 1)
- {
- base = base.substring(0, lsi);
- }
- File baseFile = new File(base);
- file = new File(baseFile, href);
- }
- else if (href != null)
- {
- file = new File(href);
- }
- return (file == null) ? null : file.toURL();
- }
- }
-
- DocumentBuilder getDocumentBuilder()
- throws TransformerException
- {
- try
- {
- if (builder == null)
- {
- DocumentBuilderFactory factory =
- DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- factory.setExpandEntityReferences(true);
- builder = factory.newDocumentBuilder();
- }
- if (userResolver != null)
- {
- builder.setEntityResolver(new URIResolverEntityResolver(userResolver));
- }
- if (userListener != null)
- {
- builder.setErrorHandler(new ErrorListenerErrorHandler(userListener));
- }
- return builder;
- }
- catch (Exception e)
- {
- throw new TransformerException(e);
- }
- }
-
-}
-
diff --git a/libjava/gnu/xml/util/DoParse.java b/libjava/gnu/xml/util/DoParse.java
deleted file mode 100644
index 5da086ed8f9..00000000000
--- a/libjava/gnu/xml/util/DoParse.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/* DoParse.java --
- Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.util;
-
-import java.io.IOException;
-
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import gnu.xml.pipeline.EventConsumer;
-import gnu.xml.pipeline.EventFilter;
-import gnu.xml.pipeline.NSFilter;
-import gnu.xml.pipeline.PipelineFactory;
-import gnu.xml.pipeline.TeeConsumer;
-import gnu.xml.pipeline.ValidationConsumer;
-import gnu.xml.pipeline.WellFormednessFilter;
-
-/**
- * This class provides a driver which may be invoked from the command line
- * to process a document using a SAX2 parser and a specified XML processing
- * pipeline.
- * This facilitates some common types of command line tools, such as parsing an
- * XML document in order test it for well formedness or validity.
- *
- *
- *
- * nsfix | validate to validate the input document
- * nsfix | write ( stdout ) to echo the file as XML text
- * dom | nsfix | write ( stdout ) parse into DOM, print the result
- *
- *
- *
- *
- *
- *
- *
- *
- * Name
- * Notes
- *
- *
- * (URL)/external-general-entities
- * false (does no parsing)
- * (URL)/external-parameter-entities
- * false (does no parsing)
- * (URL)/namespaces
- * Value is fixed at true
- * (URL)/namespace-prefixes
- * Value is settable, defaulting to false
- * ( xmlns
attributes hidden, and names aren't prefixed)
- *
- * (URL)/string-interning
- * Value is fixed at false (DOM provides no
- * guarantees as to interning)
- * (URL)/validation
- * false (does no parsing)
- *
- * (URL)/lexical-handler/parameter-entities
- * false (DOM doesn't do parameter entities)
- *
- *
- *
- * (URL)/dom-node
- * This property may be set before parsing to hold a DOM
- * Document node; any arguments given to parse
- * methods are ignored. When retrieved
- * during a parse, this value contains the "current" DOM node.
- *
- * (URL)/declaration-handler
- * A declaration handler may be provided. Declaration of external
- * general entities is exposed, but not parameter entities; none of the
- * entity names reported here will begin with "%".
- * (URL)/lexical-handler
- * A lexical handler may be provided. While the start and end of
- * any external subset are reported, expansion of other parameter
- * entities (e.g. inside attribute list declarations) is not exposed.
- * Expansion of general entities within attributes is also not exposed
- * (see below). charset=...
attribute
- */
- static public String getEncoding (String contentType)
- {
- // currently a dumb parsing algorithm that works "mostly" and handles
- // ..anything...charset=ABC
- // ..anything...charset=ABC;otherAttr=DEF
- // ..anything...charset=ABC (comment);otherAttr=DEF
- // ..anything...charset= "ABC" (comment);otherAttr=DEF
-
- int temp;
- String encoding;
- String defValue = null;
-
- if (contentType.startsWith ("text/"))
- defValue = contentType.startsWith ("text/html")
- ? "ISO-8859-1" : "US-ASCII";
-
- // Assumes 'charset' is only an attribute name, not part
- // of a value, comment, or other attribute name
- // ALSO assumes no escaped values like "\;" or "\)"
- if ((temp = contentType.indexOf ("charset")) != -1) {
- // strip out everything up to '=' ...
- temp = contentType.indexOf ('=', temp);
- if (temp == -1)
- return defValue;
- encoding = contentType.substring (temp + 1);
- // ... and any subsequent attributes
- if ((temp = encoding.indexOf (';')) != -1)
- encoding = encoding.substring (0, temp);
- // ... and any comments after value
- if ((temp = encoding.indexOf ('(')) != -1)
- encoding = encoding.substring (0, temp);
- // ... then whitespace, and any (double) quotes
- encoding = encoding.trim ();
- if (encoding.charAt (0) == '"')
- encoding = encoding.substring (1, encoding.length () - 1);
- } else
- encoding = defValue;
- return encoding;
- }
-
-
- /**
- * Uses a local dictionary of public identifiers to resolve URIs,
- * normally with the goal of minimizing network traffic or latencies.
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws IOException, SAXException
- {
- InputSource retval = null;
- String uri;
-
- if (publicId != null
- && ((uri = (String) pubidMapping.get (publicId)) != null)) {
- retval = new InputSource (uri);
- retval.setPublicId (publicId);
- }
-
- // Could do URN resolution here
-
- // URL resolution always done by parser
-
- // FIXME: chain to "next" resolver
-
- return retval;
- }
-}
diff --git a/libjava/gnu/xml/util/SAXNullTransformerFactory.java b/libjava/gnu/xml/util/SAXNullTransformerFactory.java
deleted file mode 100644
index 81ad8231270..00000000000
--- a/libjava/gnu/xml/util/SAXNullTransformerFactory.java
+++ /dev/null
@@ -1,676 +0,0 @@
-/* SAXNullTransformerFactory.java --
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.util;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Hashtable;
-import java.util.Properties;
-
-import gnu.xml.dom.Consumer;
-import gnu.xml.dom.DomDocument;
-import gnu.xml.pipeline.DomConsumer;
-import gnu.xml.pipeline.EventFilter;
-
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.sax.*;
-import javax.xml.transform.stream.*;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.XMLReaderFactory;
-import org.xml.sax.helpers.LocatorImpl;
-
-
-/**
- * Implements null transforms. XSLT stylesheets are not supported.
- * This class provides a way to translate three representations of
- * XML data (SAX event stream, DOM tree, and XML text) into each other.
- * In essence it's a thinnish wrapper around basic SAX event
- * pipeline facilities, which
- * exposes only limited functionality. The javax.xml.transform
- * functionality is implemented as follows:
- *
- *
- *
- *
- * XCat catalog = new XCat ();
- * catalog.setErrorHandler (diagnosticErrorHandler);
- * catalog.loadCatalog ("file:/local/catalogs/catalog.cat");
- * catalog.loadCatalog ("http://shared/catalog.cat");
- * ...
- * catalog.disableLoading ();
- * parser1.setEntityResolver (catalog);
- * parser2.setEntityResolver (catalog);
- * ...
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * boolean
function converts its argument to a boolean as
- * follows:
- *
- *
- *
- * @author Chris Burdess
- */
-final class BooleanFunction
- extends Expr
-{
-
- final Expr arg;
-
- BooleanFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- BooleanFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- return _boolean(context, val) ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- return new BooleanFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "boolean(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/CeilingFunction.java b/libjava/gnu/xml/xpath/CeilingFunction.java
deleted file mode 100644
index 50dc45d550f..00000000000
--- a/libjava/gnu/xml/xpath/CeilingFunction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* CeilingFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The ceiling
function returns the smallest (closest to
- * negative infinity) number that is not less than the argument and that
- * is an integer.
- *
- * @author Chris Burdess
- */
-final class CeilingFunction
- extends Expr
-{
-
- final Expr arg;
-
- CeilingFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- CeilingFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- double n = _number(context, val);
- return new Double(Math.ceil(n));
- }
-
- public Expr clone(Object context)
- {
- return new CeilingFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "ceiling(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/ConcatFunction.java b/libjava/gnu/xml/xpath/ConcatFunction.java
deleted file mode 100644
index 60802081d92..00000000000
--- a/libjava/gnu/xml/xpath/ConcatFunction.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ConcatFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The concat
function returns the concatenation of its arguments.
- *
- * @author Chris Burdess
- */
-final class ConcatFunction
- extends Expr
-{
-
- final List args;
-
- ConcatFunction(List args)
- {
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- StringBuffer buf = new StringBuffer();
- for (Iterator i = args.iterator(); i.hasNext(); )
- {
- Expr arg = (Expr) i.next();
- Object val = arg.evaluate(context, pos, len);
- buf.append(_string(context, val));
- }
- return buf.toString();
- }
-
- public Expr clone(Object context)
- {
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- return new ConcatFunction(args2);
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer("concat(");
- int len = args.size();
- for (int i = 0; i < len; i++)
- {
- if (i > 0)
- {
- buf.append(',');
- }
- buf.append(args.get(i));
- }
- buf.append(')');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Constant.java b/libjava/gnu/xml/xpath/Constant.java
deleted file mode 100644
index ca7c1d674b0..00000000000
--- a/libjava/gnu/xml/xpath/Constant.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Constant.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Constant value (string literal or number).
- *
- * @author Chris Burdess
- */
-public final class Constant
- extends Expr
-{
-
- final Object value;
-
- public Constant(Object value)
- {
- this.value = value;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- return value;
- }
-
- public Expr clone(Object context)
- {
- return new Constant(value);
- }
-
- public String toString()
- {
- String ret = value.toString();
- if (value instanceof String)
- {
- if (ret.indexOf('\'') == -1)
- {
- return '\'' + ret + '\'';
- }
- else
- {
- return '"' + ret + '"';
- }
- }
- if (value instanceof Double)
- {
- if (ret.endsWith(".0"))
- {
- ret = ret.substring(0, ret.length() - 2);
- }
- }
- return ret;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/ContainsFunction.java b/libjava/gnu/xml/xpath/ContainsFunction.java
deleted file mode 100644
index 3910d15ef26..00000000000
--- a/libjava/gnu/xml/xpath/ContainsFunction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ContainsFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The contains
function returns true if the first argument
- * string contains the second argument string, and otherwise returns false.
- *
- * @author Chris Burdess
- */
-final class ContainsFunction
- extends Expr
-{
-
- final Expr arg1;
- final Expr arg2;
-
- ContainsFunction(List args)
- {
- this((Expr) args.get(0), (Expr) args.get(1));
- }
-
- ContainsFunction(Expr arg1, Expr arg2)
- {
- this.arg1 = arg1;
- this.arg2 = arg2;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val1 = arg1.evaluate(context, pos, len);
- Object val2 = arg2.evaluate(context, pos, len);
- String s1 = _string(context, val1);
- String s2 = _string(context, val2);
- return (s1.indexOf(s2) != -1) ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- return new ContainsFunction(arg1.clone(context), arg2.clone(context));
- }
-
- public String toString()
- {
- return "contains(" + arg1 + "," + arg2 + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/CountFunction.java b/libjava/gnu/xml/xpath/CountFunction.java
deleted file mode 100644
index 4164f69f321..00000000000
--- a/libjava/gnu/xml/xpath/CountFunction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* CountFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The count
function returns the number of nodes in the
- * argument node-set.
- *
- * @author Chris Burdess
- */
-final class CountFunction
- extends Expr
-{
-
- final Expr arg;
-
- CountFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- CountFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- return new Double((double) ((Collection) val).size());
- }
-
- public Expr clone(Object context)
- {
- return new CountFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "count(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/DocumentOrderComparator.java b/libjava/gnu/xml/xpath/DocumentOrderComparator.java
deleted file mode 100644
index c7d7de9f7c7..00000000000
--- a/libjava/gnu/xml/xpath/DocumentOrderComparator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* DocumentOrderComparator.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Comparator;
-import org.w3c.dom.Node;
-
-/**
- * Sorts nodes into document order.
- *
- * @author Chris Burdess
- */
-public class DocumentOrderComparator
- implements Comparator
-{
-
- public int compare(Object o1, Object o2)
- {
- if (o1 instanceof Node && o2 instanceof Node)
- {
- Node n1 = (Node)o1;
- Node n2 = (Node)o2;
- return (int) n1.compareDocumentPosition(n2);
- }
- return 0;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/EqualityExpr.java b/libjava/gnu/xml/xpath/EqualityExpr.java
deleted file mode 100644
index d4a2f6890f0..00000000000
--- a/libjava/gnu/xml/xpath/EqualityExpr.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/* EqualityExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.Iterator;
-import org.w3c.dom.Node;
-
-/**
- * Boolean equality expression.
- *
- * @author Chris Burdess
- */
-final class EqualityExpr
- extends Expr
-{
-
- final Expr lhs;
- final Expr rhs;
- final boolean invert;
-
- EqualityExpr(Expr lhs, Expr rhs, boolean invert)
- {
- this.lhs = lhs;
- this.rhs = rhs;
- this.invert = invert;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- boolean val = evaluateImpl(context, pos, len);
- if (invert)
- {
- return val ? Boolean.FALSE : Boolean.TRUE;
- }
- else
- {
- return val ? Boolean.TRUE : Boolean.FALSE;
- }
- }
-
- private boolean evaluateImpl(Node context, int pos, int len)
- {
- Object left = lhs.evaluate(context, pos, len);
- Object right = rhs.evaluate(context, pos, len);
-
- /*
- * If both objects to be compared are node-sets, then the comparison
- * will be true if and only if there is a node in the first node-set and
- * a node in the second node-set such that the result of performing the
- * comparison on the string-values of the two nodes is true.
- */
- boolean flns = left instanceof Collection;
- boolean frns = right instanceof Collection;
- if (flns && frns)
- {
- Collection lns = (Collection) left;
- Collection rns = (Collection) right;
- boolean all = true;
- for (Iterator i = lns.iterator(); i.hasNext(); )
- {
- Node ltest = (Node) i.next();
- for (Iterator j = rns.iterator(); j.hasNext(); )
- {
- Node rtest = (Node) j.next();
- if (ltest == rtest || ltest.equals(rtest))
- {
- // much shorter
- if (!invert)
- {
- return true;
- }
- }
- else if (stringValue(ltest).equals(stringValue(rtest)))
- {
- if (!invert)
- {
- return true;
- }
- }
- else
- {
- all = false;
- }
- }
- }
- return false;
- }
- /*
- * If one object to be compared is a node-set and the other is a number,
- * then the comparison will be true if and only if there is a node in
- * the node-set such that the result of performing the comparison on the
- * number to be compared and on the result of converting the
- * string-value of that node to a number using the number function is
- * true.
- */
- boolean fln = left instanceof Double;
- boolean frn = right instanceof Double;
- if ((flns && frn) || (frns && fln))
- {
- Collection ns = flns ? (Collection) left : (Collection) right;
- double n = fln ? ((Double) left).doubleValue() :
- ((Double) right).doubleValue();
- boolean all = true;
- for (Iterator i = ns.iterator(); i.hasNext(); )
- {
- Node test = (Node) i.next();
- double nn = _number(context, stringValue(test));
- if (nn == n)
- {
- if (!invert)
- {
- return true;
- }
- }
- else
- {
- all = false;
- }
- }
- return invert ? all : false;
- }
- /*
- * If one object to be compared is a node-set and the other is a
- * string, then the comparison will be true if and only if there is a
- * node in the node-set such that the result of performing the
- * comparison on the string-value of the node and the other string is
- * true.
- */
- boolean fls = left instanceof String;
- boolean frs = right instanceof String;
- if ((flns && frs) || (frns && fls))
- {
- Collection ns = flns ? (Collection) left : (Collection) right;
- String s = fls ? (String) left : (String) right;
- boolean all = true;
- for (Iterator i = ns.iterator(); i.hasNext(); )
- {
- Node test = (Node) i.next();
- if (stringValue(test).equals(s))
- {
- if (!invert)
- {
- return true;
- }
- }
- else
- {
- all = false;
- }
- }
- return invert ? all : false;
- }
- /*
- * If one object to be compared is a node-set and the other is a
- * boolean, then the comparison will be true if and only if the result
- * of performing the comparison on the boolean and on the result of
- * converting the node-set to a boolean using the boolean function is
- * true.
- */
- boolean flb = left instanceof Boolean;
- boolean frb = right instanceof Boolean;
- if ((flns && frb) || (frns && flb))
- {
- Collection ns = flns ? (Collection) left : (Collection) right;
- boolean b = flb ? ((Boolean) left).booleanValue() :
- ((Boolean) right).booleanValue();
- return _boolean(context, ns) == b;
- }
- /*
- * If at least one object to be compared is a boolean, then each object
- * to be compared is converted to a boolean as if by applying the
- * boolean function.
- */
- if (flb || frb)
- {
- boolean lb = flb ? ((Boolean) left).booleanValue() :
- _boolean(context, left);
- boolean rb = frb ? ((Boolean) right).booleanValue() :
- _boolean(context, right);
- return lb == rb;
- }
- /*
- * Otherwise, if at least one object to be compared is
- * a number, then each object to be compared is converted to a number as
- * if by applying the number function.
- */
- if (fln || frn)
- {
- double ln = fln ? ((Double) left).doubleValue() :
- _number(context, left);
- double rn = frn ? ((Double) right).doubleValue() :
- _number(context, right);
- return ln == rn;
- }
- /*
- * Otherwise, both objects to be
- * compared are converted to strings as if by applying the string
- * function.
- */
- String ls = fls ? (String) left : _string(context, left);
- String rs = frs ? (String) right : _string(context, right);
- return ls.equals(rs);
- }
-
- public Expr clone(Object context)
- {
- return new EqualityExpr(lhs.clone(context), rhs.clone(context), invert);
- }
-
- public String toString()
- {
- if (invert)
- {
- return lhs + " != " + rhs;
- }
- else
- {
- return lhs + " = " + rhs;
- }
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Expr.java b/libjava/gnu/xml/xpath/Expr.java
deleted file mode 100644
index 5957828522e..00000000000
--- a/libjava/gnu/xml/xpath/Expr.java
+++ /dev/null
@@ -1,474 +0,0 @@
-/* Expr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.io.IOException;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.StringTokenizer;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * An XPath expression.
- * This can be evaluated in the context of a node to produce a result.
- *
- * @author Chris Burdess
- */
-public abstract class Expr
- implements XPathExpression
-{
-
- protected static final Comparator documentOrderComparator =
- new DocumentOrderComparator();
-
- protected static final DecimalFormat decimalFormat =
- new DecimalFormat("####################################################" +
- ".####################################################",
- new DecimalFormatSymbols(Locale.US));
-
- public Object evaluate(Object item, QName returnType)
- throws XPathExpressionException
- {
- Object ret = null;
- Node context = null;
- if (item instanceof Node)
- {
- context = (Node) item;
- ret = evaluate(context, 1, 1);
- if (XPathConstants.STRING == returnType &&
- !(ret instanceof String))
- {
- ret = _string(context, ret);
- }
- else if (XPathConstants.NUMBER == returnType &&
- !(ret instanceof Double))
- {
- ret = new Double(_number(context, ret));
- }
- else if (XPathConstants.BOOLEAN == returnType &&
- !(ret instanceof Boolean))
- {
- ret = _boolean(context, ret) ? Boolean.TRUE : Boolean.FALSE;
- }
- else if (XPathConstants.NODE == returnType)
- {
- if (ret instanceof Collection)
- {
- Collection ns = (Collection) ret;
- switch (ns.size())
- {
- case 0:
- ret = null;
- break;
- case 1:
- ret = (Node) ns.iterator().next();
- break;
- default:
- throw new XPathExpressionException("multiple nodes in node-set");
- }
- }
- else if (ret != null)
- {
- throw new XPathExpressionException("return value is not a node-set");
- }
- }
- else if (XPathConstants.NODESET == returnType)
- {
- if (ret != null && !(ret instanceof Collection))
- {
- throw new XPathExpressionException("return value is not a node-set");
- }
- }
- }
- return ret;
- }
-
- public String evaluate(Object item)
- throws XPathExpressionException
- {
- return (String) evaluate(item, XPathConstants.STRING);
- }
-
- public Object evaluate(InputSource source, QName returnType)
- throws XPathExpressionException
- {
- try
- {
- DocumentBuilderFactory factory =
- new gnu.xml.dom.JAXPFactory();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(source);
- return evaluate(doc, returnType);
- }
- catch (ParserConfigurationException e)
- {
- throw new XPathExpressionException(e);
- }
- catch (SAXException e)
- {
- throw new XPathExpressionException(e);
- }
- catch (IOException e)
- {
- throw new XPathExpressionException(e);
- }
- }
-
- public String evaluate(InputSource source)
- throws XPathExpressionException
- {
- return (String) evaluate(source, XPathConstants.STRING);
- }
-
- public abstract Object evaluate(Node context, int pos, int len);
-
- public abstract Expr clone(Object context);
-
- /* -- 4.1 Node Set Functions -- */
-
- /**
- * The id function selects elements by their unique ID.
- * When the argument to id is of type node-set, then the result is
- * the union of the result of applying id to the string-value of each of
- * the nodes in the argument node-set. When the argument to id is of any
- * other type, the argument is converted to a string as if by a call to
- * the string function; the string is split into a whitespace-separated
- * list of tokens (whitespace is any sequence of characters matching the
- * production S); the result is a node-set containing the elements in the
- * same document as the context node that have a unique ID equal to any of
- * the tokens in the list.
- */
- public static Collection _id(Node context, Object object)
- {
- Set ret = new HashSet();
- if (object instanceof Collection)
- {
- Collection nodeSet = (Collection) object;
- for (Iterator i = nodeSet.iterator(); i.hasNext(); )
- {
- String string = stringValue((Node) i.next());
- ret.addAll(_id (context, string));
- }
- }
- else
- {
- Document doc = (context instanceof Document) ? (Document) context :
- context.getOwnerDocument();
- String string = _string(context, object);
- StringTokenizer st = new StringTokenizer(string, " \t\r\n");
- while (st.hasMoreTokens())
- {
- Node element = doc.getElementById(st.nextToken());
- if (element != null)
- {
- ret.add(element);
- }
- }
- }
- return ret;
- }
-
- /**
- * The local-name function returns the local part of the expanded-name of
- * the node in the argument node-set that is first in document order. If
- * the argument node-set is empty or the first node has no expanded-name,
- * an empty string is returned. If the argument is omitted, it defaults to
- * a node-set with the context node as its only member.
- */
- public static String _local_name(Node context, Collection nodeSet)
- {
- Node node = (nodeSet == null || nodeSet.size() == 0) ? context :
- firstNode(nodeSet);
- return node.getLocalName();
- }
-
- /**
- * The namespace-uri function returns the namespace URI of the
- * expanded-name of the node in the argument node-set that is first in
- * document order. If the argument node-set is empty, the first node has
- * no expanded-name, or the namespace URI of the expanded-name is null, an
- * empty string is returned. If the argument is omitted, it defaults to a
- * node-set with the context node as its only member.
- */
- public static String _namespace_uri(Node context, Collection nodeSet)
- {
- Node node = (nodeSet == null || nodeSet.size() == 0) ? context :
- firstNode(nodeSet);
- return node.getNamespaceURI();
- }
-
- /**
- * The name function returns a string containing a QName representing the
- * expanded-name of the node in the argument node-set that is first in
- * document order. The QName must represent the expanded-name with respect
- * to the namespace declarations in effect on the node whose expanded-name
- * is being represented. Typically, this will be the QName that occurred
- * in the XML source. This need not be the case if there are namespace
- * declarations in effect on the node that associate multiple prefixes
- * with the same namespace. However, an implementation may include
- * information about the original prefix in its representation of nodes;
- * in this case, an implementation can ensure that the returned string is
- * always the same as the QName used in the XML source. If the argument
- * node-set is empty or the first node has no expanded-name, an empty
- * string is returned. If the argument it omitted, it defaults to a
- * node-set with the context node as its only member.
- */
- public static String _name(Node context, Collection nodeSet)
- {
- Node node = (nodeSet == null || nodeSet.size() == 0) ? context :
- firstNode(nodeSet);
- switch (node.getNodeType())
- {
- case Node.ATTRIBUTE_NODE:
- case Node.ELEMENT_NODE:
- case Node.PROCESSING_INSTRUCTION_NODE:
- return node.getNodeName();
- default:
- return "";
- }
- }
-
- /**
- * Returns the first node in the set in document order.
- */
- static Node firstNode(Collection nodeSet)
- {
- List list = new ArrayList(nodeSet);
- Collections.sort(list, documentOrderComparator);
- return (Node) list.get(0);
- }
-
- /* -- 4.2 String Functions -- */
-
- /**
- * Implementation of the XPath string
function.
- */
- public static String _string(Node context, Object object)
- {
- if (object == null)
- {
- return stringValue(context);
- }
- if (object instanceof String)
- {
- return (String) object;
- }
- if (object instanceof Boolean)
- {
- return object.toString();
- }
- if (object instanceof Double)
- {
- double d = ((Double) object).doubleValue();
- if (Double.isNaN(d))
- {
- return "NaN";
- }
- else if (d == 0.0d)
- {
- return "0";
- }
- else if (Double.isInfinite(d))
- {
- if (d < 0)
- {
- return "-Infinity";
- }
- else
- {
- return "Infinity";
- }
- }
- else
- {
- String ret = decimalFormat.format(d);
- if (ret.endsWith (".0"))
- {
- ret = ret.substring(0, ret.length() - 2);
- }
- return ret;
- }
- }
- if (object instanceof Collection)
- {
- Collection nodeSet = (Collection) object;
- if (nodeSet.isEmpty())
- {
- return "";
- }
- Node node = firstNode(nodeSet);
- return stringValue(node);
- }
- throw new IllegalArgumentException(object.toString());
- }
-
- /* -- 4.3 Boolean Functions -- */
-
- /**
- * Implementation of the XPath boolean
function.
- */
- public static boolean _boolean(Node context, Object object)
- {
- if (object instanceof Boolean)
- {
- return ((Boolean) object).booleanValue();
- }
- if (object instanceof Double)
- {
- return ((Double) object).doubleValue() != 0.0;
- }
- if (object instanceof String)
- {
- return ((String) object).length() != 0;
- }
- if (object instanceof Collection)
- {
- return ((Collection) object).size() != 0;
- }
- return false; // TODO user defined types
- }
-
- /* -- 4.4 Number Functions -- */
-
- /**
- * Implementation of the XPath number
function.
- */
- public static double _number(Node context, Object object)
- {
- if (object == null)
- {
- object = Collections.singleton(context);
- }
- if (object instanceof Double)
- {
- return ((Double) object).doubleValue();
- }
- if (object instanceof Boolean)
- {
- return ((Boolean) object).booleanValue() ? 1.0 : 0.0;
- }
- if (object instanceof Collection)
- {
- // Convert node-set to string
- object = stringValue((Collection) object);
- }
- if (object instanceof String)
- {
- String string = ((String) object).trim();
- try
- {
- return Double.parseDouble(string);
- }
- catch (NumberFormatException e)
- {
- return Double.NaN;
- }
- }
- return Double.NaN; // TODO user-defined types
- }
-
- /**
- * Computes the XPath string-value of the specified node-set.
- */
- public static String stringValue(Collection nodeSet)
- {
- StringBuffer buf = new StringBuffer();
- for (Iterator i = nodeSet.iterator(); i.hasNext(); )
- {
- buf.append(stringValue((Node) i.next()));
- }
- return buf.toString();
- }
-
- /**
- * Computes the XPath string-value of the specified node.
- */
- public static String stringValue(Node node)
- {
- return stringValue(node, false);
- }
-
- static String stringValue(Node node, boolean elementMode)
- {
- switch (node.getNodeType())
- {
- case Node.DOCUMENT_NODE: // 5.1 Root Node
- case Node.DOCUMENT_FRAGMENT_NODE:
- case Node.ELEMENT_NODE: // 5.2 Element Nodes
- StringBuffer buf = new StringBuffer();
- for (Node ctx = node.getFirstChild(); ctx != null;
- ctx = ctx.getNextSibling())
- {
- buf.append(stringValue(ctx, true));
- }
- return buf.toString();
- case Node.TEXT_NODE: // 5.7 Text Nodes
- case Node.CDATA_SECTION_NODE:
- return node.getNodeValue();
- case Node.ATTRIBUTE_NODE: // 5.3 Attribute Nodes
- case Node.PROCESSING_INSTRUCTION_NODE: // 5.5 Processing Instruction
- case Node.COMMENT_NODE: // 5.6 Comment Nodes
- if (!elementMode)
- {
- return node.getNodeValue();
- }
- default:
- return "";
- }
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/FalseFunction.java b/libjava/gnu/xml/xpath/FalseFunction.java
deleted file mode 100644
index ca07b7870e8..00000000000
--- a/libjava/gnu/xml/xpath/FalseFunction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* FalseFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * The false
function returns false.
- *
- * @author Chris Burdess
- */
-final class FalseFunction
- extends Expr
-{
-
- public Object evaluate(Node context, int pos, int len)
- {
- return Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- return new FalseFunction();
- }
-
- public String toString()
- {
- return "false()";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/FloorFunction.java b/libjava/gnu/xml/xpath/FloorFunction.java
deleted file mode 100644
index c8608cdc1f5..00000000000
--- a/libjava/gnu/xml/xpath/FloorFunction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* FloorFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The floor
function returns the largest (closest to positive
- * infinity) number that is not greater than the argument and that is an
- * integer.
- *
- * @author Chris Burdess
- */
-final class FloorFunction
- extends Expr
-{
-
- final Expr arg;
-
- FloorFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- FloorFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- double n = _number(context, val);
- return new Double(Math.floor(n));
- }
-
- public Expr clone(Object context)
- {
- return new FloorFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "floor(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Function.java b/libjava/gnu/xml/xpath/Function.java
deleted file mode 100644
index aecd49d9c73..00000000000
--- a/libjava/gnu/xml/xpath/Function.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Function.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-
-/**
- * Interface to be implemented by external functions that need to receive
- * parameter values.
- *
- * @author Chris Burdess
- */
-public interface Function
-{
-
- /**
- * Sets the list of expressions to evaluate as parameter values.
- */
- void setArguments(List args);
-
-}
-
diff --git a/libjava/gnu/xml/xpath/FunctionCall.java b/libjava/gnu/xml/xpath/FunctionCall.java
deleted file mode 100644
index 97763e09764..00000000000
--- a/libjava/gnu/xml/xpath/FunctionCall.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/* FunctionCall.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathFunction;
-import javax.xml.xpath.XPathFunctionException;
-import javax.xml.xpath.XPathFunctionResolver;
-import org.w3c.dom.Node;
-
-/**
- * Executes an XPath core or extension function.
- *
- * @author Chris Burdess
- */
-public final class FunctionCall
- extends Expr
-{
-
- final XPathFunctionResolver resolver;
- final String name;
- final List args;
-
- public FunctionCall(XPathFunctionResolver resolver, String name)
- {
- this(resolver, name, Collections.EMPTY_LIST);
- }
-
- public FunctionCall(XPathFunctionResolver resolver, String name, List args)
- {
- this.resolver = resolver;
- this.name = name;
- this.args = args;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- if (resolver != null)
- {
- QName qname = QName.valueOf(name);
- int arity = args.size();
- XPathFunction function = resolver.resolveFunction(qname, arity);
- if (function != null)
- {
- //System.err.println("Calling "+toString()+" with "+values);
- if (function instanceof Expr)
- {
- if (function instanceof Function)
- {
- ((Function) function).setArguments(args);
- }
- return ((Expr) function).evaluate(context, pos, len);
- }
- else
- {
- List values = new ArrayList(arity);
- for (int i = 0; i < arity; i++)
- {
- Expr arg = (Expr) args.get(i);
- values.add(arg.evaluate(context, pos, len));
- }
- try
- {
- return function.evaluate(values);
- }
- catch (XPathFunctionException e)
- {
- e.printStackTrace(System.err); // FIXME
- throw new RuntimeException(e.getMessage(), e);
- }
- }
- }
- }
- throw new IllegalArgumentException("Invalid function call: " +
- toString());
- }
-
- public Expr clone(Object context)
- {
- int len = args.size();
- List args2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- args2.add(((Expr) args.get(i)).clone(context));
- }
- XPathFunctionResolver r = resolver;
- if (context instanceof XPathFunctionResolver)
- {
- r = (XPathFunctionResolver) context;
- }
- return new FunctionCall(r, name, args2);
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- buf.append(name);
- buf.append('(');
- int len = args.size();
- for (int i = 0; i < len; i++)
- {
- if (i > 0)
- {
- buf.append(',');
- }
- buf.append(args.get(i));
- }
- buf.append(')');
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/IdFunction.java b/libjava/gnu/xml/xpath/IdFunction.java
deleted file mode 100644
index 164e141a7c4..00000000000
--- a/libjava/gnu/xml/xpath/IdFunction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/* IdFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The id
function selects elements by their unique ID.
- * When the argument to id is of type node-set, then the result is
- * the union of the result of applying id to the string-value of each of the
- * nodes in the argument node-set. When the argument to id is of any other
- * type, the argument is converted to a string as if by a call to the string
- * function; the string is split into a whitespace-separated list of tokens
- * (whitespace is any sequence of characters matching the production S); the
- * result is a node-set containing the elements in the same document as the
- * context node that have a unique ID equal to any of the tokens in the
- * list.
- *
- * @author Chris Burdess
- */
-public final class IdFunction
- extends Pattern
-{
-
- final Expr arg;
-
- IdFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- public IdFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public boolean matches(Node context)
- {
- Object ret = evaluate(context, 1, 1);
- return !((Collection) ret).isEmpty();
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- return _id(context, val);
- }
-
- public Expr clone(Object context)
- {
- return new IdFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "id(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/LangFunction.java b/libjava/gnu/xml/xpath/LangFunction.java
deleted file mode 100644
index fbf3af1f95c..00000000000
--- a/libjava/gnu/xml/xpath/LangFunction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/* LangFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * The lang
function returns true or false depending on whether
- * the language of the context node as specified by xml:lang attributes is
- * the same as or is a sublanguage of the language specified by the argument
- * string. The language of the context node is determined by the value of
- * the xml:lang attribute on the context node, or, if the context node has
- * no xml:lang attribute, by the value of the xml:lang attribute on the
- * nearest ancestor of the context node that has an xml:lang attribute. If
- * there is no such attribute, then lang returns false. If there is such an
- * attribute, then lang returns true if the attribute value is equal to the
- * argument ignoring case, or if there is some suffix starting with - such
- * that the attribute value is equal to the argument ignoring that suffix of
- * the attribute value and ignoring case.
- *
- * @author Chris Burdess
- */
-final class LangFunction
- extends Expr
-{
-
- final Expr arg;
-
- LangFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- LangFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- String lang = _string(context, val);
- String clang = getLang(context);
- while (clang == null && context != null)
- {
- context = context.getParentNode();
- clang = getLang(context);
- }
- boolean ret = (clang == null) ? false :
- clang.toLowerCase().startsWith(lang.toLowerCase());
- return ret ? Boolean.TRUE : Boolean.FALSE;
- }
-
- String getLang(Node node)
- {
- if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- return ((Element) node).getAttribute("xml:lang");
- }
- return null;
- }
-
- public Expr clone(Object context)
- {
- return new IdFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "lang(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/LastFunction.java b/libjava/gnu/xml/xpath/LastFunction.java
deleted file mode 100644
index b24e0482d90..00000000000
--- a/libjava/gnu/xml/xpath/LastFunction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* LastFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * The last
function returns a number equal to the context
- * size from the expression evaluation context.
- *
- * @author Chris Burdess
- */
-final class LastFunction
- extends Expr
-{
-
- public Object evaluate(Node context, int pos, int len)
- {
- return new Double((double) len);
- }
-
- public Expr clone(Object context)
- {
- return new LastFunction();
- }
-
- public String toString()
- {
- return "last()";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/LocalNameFunction.java b/libjava/gnu/xml/xpath/LocalNameFunction.java
deleted file mode 100644
index 342d9331a74..00000000000
--- a/libjava/gnu/xml/xpath/LocalNameFunction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* LocalNameFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The local-name
function returns the local part of the
- * expanded-name of the node in the argument node-set that is first in
- * document order.
- * If the argument node-set is empty or the first node has no expanded-name,
- * an empty string is returned. If the argument is omitted, it defaults to a
- * node-set with the context node as its only member.
- *
- * @author Chris Burdess
- */
-final class LocalNameFunction
- extends Expr
-{
-
- final Expr arg;
-
- LocalNameFunction(List args)
- {
- this(args.size() > 0 ? (Expr) args.get(0) : null);
- }
-
- LocalNameFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
- return _local_name(context, (Collection) val);
- }
-
- public Expr clone(Object context)
- {
- return new LocalNameFunction((arg == null) ? null :
- arg.clone(context));
- }
-
- public String toString()
- {
- return (arg == null) ? "local-name()" : "local-name(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NameFunction.java b/libjava/gnu/xml/xpath/NameFunction.java
deleted file mode 100644
index bd34325a097..00000000000
--- a/libjava/gnu/xml/xpath/NameFunction.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* NameFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The name
function returns a string containing a QName
- * representing the expanded-name of the node in the argument node-set that
- * is first in document order. The QName must represent the expanded-name
- * with respect to the namespace declarations in effect on the node whose
- * expanded-name is being represented. Typically, this will be the QName
- * that occurred in the XML source. This need not be the case if there are
- * namespace declarations in effect on the node that associate multiple
- * prefixes with the same namespace. However, an implementation may include
- * information about the original prefix in its representation of nodes; in
- * this case, an implementation can ensure that the returned string is
- * always the same as the QName used in the XML source. If the argument
- * node-set is empty or the first node has no expanded-name, an empty string
- * is returned. If the argument it omitted, it defaults to a node-set with
- * the context node as its only member.
- *
- * @author Chris Burdess
- */
-final class NameFunction
- extends Expr
-{
-
- final Expr arg;
-
- NameFunction(List args)
- {
- this(args.size() > 0 ? (Expr) args.get(0) : null);
- }
-
- NameFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
- return _name(context, (Collection) val);
- }
-
- public Expr clone(Object context)
- {
- return new NameFunction((arg == null) ? null :
- arg.clone(context));
- }
-
- public String toString()
- {
- return (arg == null) ? "name()" : "name(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NameTest.java b/libjava/gnu/xml/xpath/NameTest.java
deleted file mode 100644
index d2e892beb2b..00000000000
--- a/libjava/gnu/xml/xpath/NameTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* NameTest.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import org.w3c.dom.Node;
-
-/**
- * Tests whether a node has the specified name.
- *
- * @author Chris Burdess
- */
-public final class NameTest
- extends Test
-{
-
- final QName qName;
- final boolean anyLocalName;
- final boolean any;
-
- public NameTest(QName qName, boolean anyLocalName, boolean any)
- {
- this.anyLocalName = anyLocalName;
- this.any = any;
- this.qName = qName;
- }
-
- public boolean matchesAny()
- {
- return any;
- }
-
- public boolean matchesAnyLocalName()
- {
- return anyLocalName;
- }
-
- public boolean matches(Node node, int pos, int len)
- {
- switch (node.getNodeType())
- {
- case Node.ATTRIBUTE_NODE:
- // Do not match namespace attributes
- String uri = node.getNamespaceURI();
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName()))
- {
- return false;
- }
- // Fall through
- case Node.ELEMENT_NODE:
- break;
- default:
- return false;
- }
- if (any)
- {
- return true;
- }
- String uri = qName.getNamespaceURI();
- if (!equal(uri, node.getNamespaceURI()))
- {
- return false;
- }
- if (anyLocalName)
- {
- return true;
- }
- String localName = qName.getLocalPart();
- return (localName.equals(node.getLocalName()));
- }
-
- final boolean equal(String s1, String s2)
- {
- return (((s1 == null || s1.length() == 0) &&
- (s2 == null || s2.length() == 0)) ||
- s1 != null && s1.equals(s2));
- }
-
- public Test clone(Object context)
- {
- return new NameTest(qName, anyLocalName, any);
- }
-
- public String toString ()
- {
- if (any)
- {
- return "*";
- }
- return qName.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NamespaceTest.java b/libjava/gnu/xml/xpath/NamespaceTest.java
deleted file mode 100644
index 8240bf8deaf..00000000000
--- a/libjava/gnu/xml/xpath/NamespaceTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/* NamespaceTest.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import org.w3c.dom.Node;
-
-/**
- * Tests whether a namespace attribute has the specified name.
- *
- * @author Chris Burdess
- */
-public final class NamespaceTest
- extends Test
-{
-
- final QName qName;
- final boolean anyLocalName;
- final boolean any;
-
- public NamespaceTest(QName qName, boolean anyLocalName, boolean any)
- {
- this.anyLocalName = anyLocalName;
- this.any = any;
- this.qName = qName;
- }
-
- public boolean matchesAny()
- {
- return any;
- }
-
- public boolean matchesAnyLocalName()
- {
- return anyLocalName;
- }
-
- public boolean matches(Node node, int pos, int len)
- {
- switch (node.getNodeType())
- {
- case Node.ATTRIBUTE_NODE:
- // Only match namespace attributes
- String uri = node.getNamespaceURI();
- if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName()))
- {
- break;
- }
- // Fall through
- default:
- // Only process namespace attributes
- return false;
- }
- if (any)
- {
- return true;
- }
- if (anyLocalName)
- {
- return true;
- }
- String localName = qName.getLocalPart();
- return (localName.equals(node.getLocalName()));
- }
-
- public Test clone(Object context)
- {
- return new NamespaceTest(qName, anyLocalName, any);
- }
-
- public String toString ()
- {
- if (any)
- {
- return "*";
- }
- return qName.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NamespaceUriFunction.java b/libjava/gnu/xml/xpath/NamespaceUriFunction.java
deleted file mode 100644
index 9a42e775488..00000000000
--- a/libjava/gnu/xml/xpath/NamespaceUriFunction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* NamespaceUriFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The namespace-uri
function returns the namespace URI of the
- * expanded-name of the node in the argument node-set that is first in
- * document order. If the argument node-set is empty, the first node has no
- * expanded-name, or the namespace URI of the expanded-name is null, an
- * empty string is returned. If the argument is omitted, it defaults to a
- * node-set with the context node as its only member.
- *
- * @author Chris Burdess
- */
-final class NamespaceUriFunction
- extends Expr
-{
-
- final Expr arg;
-
- NamespaceUriFunction(List args)
- {
- this(args.size() > 0 ? (Expr) args.get(0) : null);
- }
-
- NamespaceUriFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
- return _namespace_uri(context, (Collection) val);
- }
-
- public Expr clone(Object context)
- {
- return new NamespaceUriFunction((arg == null) ? null :
- arg.clone(context));
- }
-
- public String toString()
- {
- return (arg == null) ? "namespace-uri()" : "namespace-uri(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NegativeExpr.java b/libjava/gnu/xml/xpath/NegativeExpr.java
deleted file mode 100644
index bb84eebf05e..00000000000
--- a/libjava/gnu/xml/xpath/NegativeExpr.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* NegativeExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Unary negative.
- *
- * @author Chris Burdess
- */
-final class NegativeExpr
- extends Expr
-{
-
- final Expr expr;
-
- NegativeExpr(Expr expr)
- {
- this.expr = expr;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = expr.evaluate(context, pos, len);
- double n = _number(context, val);
- return new Double(-n);
- }
-
- public Expr clone(Object context)
- {
- return new NegativeExpr(expr.clone(context));
- }
-
- public String toString()
- {
- return "-" + expr;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NodeTypeTest.java b/libjava/gnu/xml/xpath/NodeTypeTest.java
deleted file mode 100644
index 521104cdb75..00000000000
--- a/libjava/gnu/xml/xpath/NodeTypeTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/* NodeTypeTest.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Tests whether a node is of a given type.
- *
- * @author Chris Burdess
- */
-public final class NodeTypeTest
- extends Test
-{
-
- final short type;
- final String data;
-
- public NodeTypeTest(short type)
- {
- this(type, null);
- }
-
- public NodeTypeTest(short type, String data)
- {
- this.type = type;
- this.data = data;
- }
-
- public short getNodeType()
- {
- return type;
- }
-
- public String getData()
- {
- return data;
- }
-
- public boolean matches(Node node, int pos, int len)
- {
- short nodeType = node.getNodeType();
- switch (nodeType)
- {
- case Node.ELEMENT_NODE:
- case Node.ATTRIBUTE_NODE:
- case Node.TEXT_NODE:
- case Node.CDATA_SECTION_NODE:
- case Node.COMMENT_NODE:
- case Node.PROCESSING_INSTRUCTION_NODE:
- if (type > 0)
- {
- if (nodeType != type)
- {
- return false;
- }
- if (data != null && !data.equals(node.getNodeValue()))
- {
- return false;
- }
- }
- return true;
- default:
- // Not part of XPath data model
- return false;
- }
- }
-
- public Test clone(Object context)
- {
- return new NodeTypeTest(type, data);
- }
-
- public String toString()
- {
- switch (type)
- {
- case 0:
- return "node()";
- case Node.TEXT_NODE:
- return "text()";
- case Node.COMMENT_NODE:
- return "comment()";
- case Node.PROCESSING_INSTRUCTION_NODE:
- if (data != null)
- {
- return "processing-instruction('" + data + "')";
- }
- return "processing-instruction()";
- default:
- throw new IllegalStateException();
- }
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NormalizeSpaceFunction.java b/libjava/gnu/xml/xpath/NormalizeSpaceFunction.java
deleted file mode 100644
index a61e118f2e5..00000000000
--- a/libjava/gnu/xml/xpath/NormalizeSpaceFunction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* NormalizeSpaceFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import java.util.StringTokenizer;
-import org.w3c.dom.Node;
-
-/**
- * The normalize-space
function returns the argument string
- * with whitespace normalized by stripping leading and trailing whitespace
- * and replacing sequences of whitespace characters by a single space.
- * Whitespace characters are the same as those allowed by the S production
- * in XML. If the argument is omitted, it defaults to the context node
- * converted to a string, in other words the string-value of the context
- * node.
- *
- * @author Chris Burdess
- */
-final class NormalizeSpaceFunction
- extends Expr
-{
-
- final Expr arg;
-
- NormalizeSpaceFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- NormalizeSpaceFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
- String s = _string(context, val);
- StringTokenizer st = new StringTokenizer(s, " \t\r\n");
- StringBuffer buf = new StringBuffer();
- if (st.hasMoreTokens())
- {
- buf.append(st.nextToken());
- while (st.hasMoreTokens())
- {
- buf.append(' ');
- buf.append(st.nextToken());
- }
- }
- return buf.toString();
- }
-
- public Expr clone(Object context)
- {
- return new NormalizeSpaceFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return (arg == null) ? "normalize-space()" : "normalize-space(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NotFunction.java b/libjava/gnu/xml/xpath/NotFunction.java
deleted file mode 100644
index dcb7ad4fb68..00000000000
--- a/libjava/gnu/xml/xpath/NotFunction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* NotFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The not
function returns true if its argument is false,
- * and false otherwise.
- *
- * @author Chris Burdess
- */
-final class NotFunction
- extends Expr
-{
-
- final Expr arg;
-
- NotFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- NotFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- return _boolean(context, val) ? Boolean.FALSE : Boolean.TRUE;
- }
-
- public Expr clone(Object context)
- {
- return new NotFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "not(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/NumberFunction.java b/libjava/gnu/xml/xpath/NumberFunction.java
deleted file mode 100644
index a27eb7a46cf..00000000000
--- a/libjava/gnu/xml/xpath/NumberFunction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/* NumberFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The number
function converts its argument to a number as
- * follows:
- *
- *
- * If the argument is omitted, it defaults to a node-set with the context
- * node as its only member.
- *
- * @author Chris Burdess
- */
-final class NumberFunction
- extends Expr
-{
-
- final Expr arg;
-
- NumberFunction(List args)
- {
- this(args.size() > 0 ? (Expr) args.get(0) : null);
- }
-
- NumberFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
- return new Double(_number(context, val));
- }
-
- public Expr clone(Object context)
- {
- return new NumberFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "number(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/OrExpr.java b/libjava/gnu/xml/xpath/OrExpr.java
deleted file mode 100644
index ca3fd227718..00000000000
--- a/libjava/gnu/xml/xpath/OrExpr.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* OrExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Logical or.
- *
- * @author Chris Burdess
- */
-public final class OrExpr
- extends Expr
-{
-
- final Expr lhs;
- final Expr rhs;
-
- public OrExpr(Expr lhs, Expr rhs)
- {
- this.lhs = lhs;
- this.rhs = rhs;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object left = lhs.evaluate(context, pos, len);
- if (_boolean(context, left))
- {
- return Boolean.TRUE;
- }
- Object right = rhs.evaluate(context, pos, len);
- return _boolean(context, right) ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- return new OrExpr(lhs.clone(context), rhs.clone(context));
- }
-
- public String toString()
- {
- return lhs + " or " + rhs;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/ParenthesizedExpr.java b/libjava/gnu/xml/xpath/ParenthesizedExpr.java
deleted file mode 100644
index 6a8bb12fa32..00000000000
--- a/libjava/gnu/xml/xpath/ParenthesizedExpr.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ParenthesizedExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * Simple subexpression.
- *
- * @author Chris Burdess
- */
-final class ParenthesizedExpr
- extends Expr
-{
-
- final Expr expr;
-
- ParenthesizedExpr(Expr expr)
- {
- this.expr = expr;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object ret = expr.evaluate(context, pos, len);
- if (ret instanceof Collection)
- {
- List list = new ArrayList((Collection) ret);
- Collections.sort(list, documentOrderComparator);
- ret = list;
- }
- return ret;
- }
-
- public Expr clone(Object context)
- {
- return new ParenthesizedExpr(expr.clone(context));
- }
-
- public String toString()
- {
- return "(" + expr + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Path.java b/libjava/gnu/xml/xpath/Path.java
deleted file mode 100644
index 4b01f0918ab..00000000000
--- a/libjava/gnu/xml/xpath/Path.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Path.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import org.w3c.dom.Node;
-
-/**
- * An XPath path component expression.
- *
- * @author Chris Burdess
- */
-abstract class Path
- extends Pattern
-{
-
- abstract Collection evaluate(Node context, Collection nodeSet);
-
-}
diff --git a/libjava/gnu/xml/xpath/Pattern.java b/libjava/gnu/xml/xpath/Pattern.java
deleted file mode 100644
index d992c6d4e63..00000000000
--- a/libjava/gnu/xml/xpath/Pattern.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Pattern.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Interface implemented by expressions that can for part of XSL patterns.
- *
- * @author Chris Burdess
- */
-public abstract class Pattern
- extends Expr
-{
-
- public abstract boolean matches(Node context);
-
-}
-
diff --git a/libjava/gnu/xml/xpath/PositionFunction.java b/libjava/gnu/xml/xpath/PositionFunction.java
deleted file mode 100644
index 790b0e005cf..00000000000
--- a/libjava/gnu/xml/xpath/PositionFunction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* PositionFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * The position
function returns a number equal to the context
- * position from the expression evaluation context.
- *
- * @author Chris Burdess
- */
-final class PositionFunction
- extends Expr
-{
-
- public Object evaluate(Node context, int pos, int len)
- {
- return new Double((double) pos);
- }
-
- public Expr clone(Object context)
- {
- return new PositionFunction();
- }
-
- public String toString()
- {
- return "position()";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Predicate.java b/libjava/gnu/xml/xpath/Predicate.java
deleted file mode 100644
index d495440fdbb..00000000000
--- a/libjava/gnu/xml/xpath/Predicate.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Predicate.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Tests whether an expression matches against a given context node.
- *
- * @author Chris Burdess
- */
-class Predicate
- extends Test
-{
-
- final Expr expr;
-
- Predicate(Expr expr)
- {
- this.expr = expr;
- }
-
- public boolean matches(Node node, int pos, int len)
- {
- Object ret = expr.evaluate(node, pos, len);
- if (ret instanceof Double)
- {
- // Same as [position() = x]
- return ((Double) ret).intValue() == pos;
- }
- return Expr._boolean(node, expr.evaluate(node, pos, len));
- }
-
- public Test clone(Object context)
- {
- return new Predicate(expr.clone(context));
- }
-
- public String toString()
- {
- return "[" + expr + "]";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/RelationalExpr.java b/libjava/gnu/xml/xpath/RelationalExpr.java
deleted file mode 100644
index 622d2290106..00000000000
--- a/libjava/gnu/xml/xpath/RelationalExpr.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/* RelationalExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * Numerical comparison expression.
- *
- * @author Chris Burdess
- */
-final class RelationalExpr
- extends Expr
-{
-
- final Expr lhs;
- final Expr rhs;
- final boolean lt;
- final boolean eq;
-
- RelationalExpr(Expr lhs, Expr rhs, boolean lt, boolean eq)
- {
- this.lhs = lhs;
- this.rhs = rhs;
- this.lt = lt;
- this.eq = eq;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object left = lhs.evaluate(context, pos, len);
- Object right = rhs.evaluate(context, pos, len);
- double ln = _number(context, left);
- double rn = _number(context, right);
- if (eq && ln == rn)
- {
- return Boolean.TRUE;
- }
- if (lt)
- {
- if (ln < rn || Double.isInfinite(rn))
- {
- return Boolean.TRUE;
- }
- }
- else
- {
- if (ln > rn || Double.isInfinite(ln))
- {
- return Boolean.TRUE;
- }
- }
- return Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- return new RelationalExpr(lhs.clone(context), rhs.clone(context), lt, eq);
- }
-
- public String toString()
- {
- return lhs + " " + (lt ? "<" : ">") + (eq ? "=" : "") + " " + rhs;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Root.java b/libjava/gnu/xml/xpath/Root.java
deleted file mode 100644
index cf8f8d17e54..00000000000
--- a/libjava/gnu/xml/xpath/Root.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Root.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.Collections;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Expression that evaluates to the document root.
- *
- * @author Chris Burdess
- */
-public final class Root
- extends Path
-{
-
- public boolean matches(Node node)
- {
- return (node.getNodeType() == Node.DOCUMENT_NODE);
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- return evaluate(context, Collections.EMPTY_SET);
- }
-
- Collection evaluate(Node context, Collection ns)
- {
- Document doc = (context instanceof Document) ? (Document) context :
- context.getOwnerDocument();
- return Collections.singleton(doc);
- }
-
- public Expr clone(Object context)
- {
- return new Root();
- }
-
- public String toString()
- {
- return "/";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/RoundFunction.java b/libjava/gnu/xml/xpath/RoundFunction.java
deleted file mode 100644
index 7f9ff2a96a3..00000000000
--- a/libjava/gnu/xml/xpath/RoundFunction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/* RoundFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The round
function returns the number that is closest to the
- * argument and that is an integer. If there are two such numbers, then the
- * one that is closest to positive infinity is returned. If the argument is
- * NaN, then NaN is returned. If the argument is positive infinity, then
- * positive infinity is returned. If the argument is negative infinity, then
- * negative infinity is returned. If the argument is positive zero, then
- * positive zero is returned. If the argument is negative zero, then
- * negative zero is returned. If the argument is less than zero, but greater
- * than or equal to -0.5, then negative zero is returned.
- *
- * @author Chris Burdess
- */
-final class RoundFunction
- extends Expr
-{
-
- final Expr arg;
-
- RoundFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- RoundFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- double n = _number(context, val);
- return (Double.isNaN(n) || Double.isInfinite(n)) ?
- new Double(n) : new Double(Math.round(n));
- }
-
- public Expr clone(Object context)
- {
- return new RoundFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "round(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Selector.java b/libjava/gnu/xml/xpath/Selector.java
deleted file mode 100644
index 383893d9280..00000000000
--- a/libjava/gnu/xml/xpath/Selector.java
+++ /dev/null
@@ -1,498 +0,0 @@
-/* Selector.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import javax.xml.XMLConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * A single component of a location path.
- *
- * @author Chris Burdess
- */
-public final class Selector
- extends Path
-{
-
- public static final int ANCESTOR = 0;
- public static final int ANCESTOR_OR_SELF = 1;
- public static final int ATTRIBUTE = 2;
- public static final int CHILD = 3;
- public static final int DESCENDANT = 4;
- public static final int DESCENDANT_OR_SELF = 5;
- public static final int FOLLOWING = 6;
- public static final int FOLLOWING_SIBLING = 7;
- public static final int NAMESPACE = 8;
- public static final int PARENT = 9;
- public static final int PRECEDING = 10;
- public static final int PRECEDING_SIBLING = 11;
- public static final int SELF = 12;
-
- /**
- * Axis to select nodes in.
- */
- final int axis;
-
- /**
- * List of tests to perform on candidates.
- */
- final Test[] tests;
-
- public Selector(int axis, List tests)
- {
- this.axis = axis;
- this.tests = new Test[tests.size()];
- tests.toArray(this.tests);
- if (axis == NAMESPACE &&
- this.tests.length > 0 &&
- this.tests[0] instanceof NameTest)
- {
- NameTest nt = (NameTest) this.tests[0];
- this.tests[0] = new NamespaceTest(nt.qName, nt.anyLocalName, nt.any);
- }
- }
-
- /**
- * Returns the list of tests to perform on candidates.
- */
- public Test[] getTests()
- {
- return tests;
- }
-
- public boolean matches(Node context)
- {
- short nodeType = context.getNodeType();
- switch (axis)
- {
- case CHILD:
- if (nodeType == Node.ATTRIBUTE_NODE)
- {
- return false;
- }
- break;
- case ATTRIBUTE:
- case NAMESPACE:
- if (nodeType != Node.ATTRIBUTE_NODE)
- {
- return false;
- }
- break;
- case DESCENDANT_OR_SELF:
- return true;
- default:
- return false;
- }
- int tlen = tests.length;
- if (tlen > 0)
- {
- int pos = getContextPosition(context);
- int len = getContextSize(context);
- for (int j = 0; j < tlen && len > 0; j++)
- {
- Test test = tests[j];
- if (!test.matches(context, pos, len))
- {
- return false;
- }
- }
- }
- return true;
- }
-
- private int getContextPosition(Node ctx)
- {
- int pos = 1;
- for (ctx = ctx.getPreviousSibling(); ctx != null;
- ctx = ctx.getPreviousSibling())
- {
- pos++;
- }
- return pos;
- }
-
- private int getContextSize(Node ctx)
- {
- if (ctx.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- Node parent = ((Attr) ctx).getOwnerElement();
- return parent.getAttributes().getLength();
- }
- Node parent = ctx.getParentNode();
- if (parent != null)
- {
- return parent.getChildNodes().getLength();
- }
- return 1;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Set acc = new LinkedHashSet();
- addCandidates(context, acc);
- List candidates = new ArrayList(acc);
- //Collections.sort(candidates, documentOrderComparator);
- List ret = filterCandidates(candidates, false);
- return ret;
- }
-
- Collection evaluate(Node context, Collection ns)
- {
- Set acc = new LinkedHashSet();
- for (Iterator i = ns.iterator(); i.hasNext(); )
- {
- addCandidates((Node) i.next(), acc);
- }
- List candidates = new ArrayList(acc);
- //Collections.sort(candidates, documentOrderComparator);
- List ret = filterCandidates(candidates, true);
- return ret;
- }
-
- /**
- * Filter the given list of candidates according to the node tests.
- */
- List filterCandidates(List candidates, boolean cascade)
- {
- int len = candidates.size();
- int tlen = tests.length;
- if (tlen > 0 && len > 0)
- {
- // Present the result of each successful generation to the next test
- for (int j = 0; j < tlen && len > 0; j++)
- {
- Test test = tests[j];
- List successful = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- Node node = (Node) candidates.get(i);
- if (cascade)
- {
- // Documents and DocumentFragments should be considered
- // if part of a location path where the axis involves
- // the SELF concept
- short nodeType = node.getNodeType();
- if ((nodeType == Node.DOCUMENT_NODE ||
- nodeType == Node.DOCUMENT_FRAGMENT_NODE) &&
- (axis == DESCENDANT_OR_SELF ||
- axis == ANCESTOR_OR_SELF ||
- axis == SELF) &&
- (tests.length == 1 &&
- tests[0] instanceof NodeTypeTest &&
- ((NodeTypeTest) tests[0]).type == (short) 0))
- {
- successful.add(node);
- continue;
- }
- }
- if (test.matches(node, i + 1, len))
- {
- successful.add(node);
- }
- /*
- System.err.println("Testing "+node);
- int p = getContextPosition(node);
- int l = getContextSize(node);
- if (test.matches(node, p, l))
- {
- successful.add(node);
- }*/
- }
- candidates = successful;
- len = candidates.size();
- }
- }
- return candidates;
- }
-
- void addCandidates(Node context, Collection candidates)
- {
- // Build list of candidates
- switch (axis)
- {
- case CHILD:
- addChildNodes(context, candidates, false);
- break;
- case DESCENDANT:
- addChildNodes(context, candidates, true);
- break;
- case DESCENDANT_OR_SELF:
- candidates.add (context);
- addChildNodes(context, candidates, true);
- break;
- case PARENT:
- addParentNode(context, candidates, false);
- break;
- case ANCESTOR:
- addParentNode(context, candidates, true);
- break;
- case ANCESTOR_OR_SELF:
- candidates.add(context);
- addParentNode(context, candidates, true);
- break;
- case FOLLOWING_SIBLING:
- addFollowingNodes(context, candidates, false);
- break;
- case PRECEDING_SIBLING:
- addPrecedingNodes(context, candidates, false);
- break;
- case FOLLOWING:
- addFollowingNodes(context, candidates, true);
- break;
- case PRECEDING:
- addPrecedingNodes(context, candidates, true);
- break;
- case ATTRIBUTE:
- addAttributes(context, candidates);
- break;
- case NAMESPACE:
- addNamespaceAttributes(context, candidates);
- break;
- case SELF:
- candidates.add(context);
- break;
- }
- }
-
- void addChildNodes(Node context, Collection acc, boolean recurse)
- {
- Node child = context.getFirstChild();
- while (child != null)
- {
- acc.add(child);
- if (recurse)
- {
- addChildNodes(child, acc, recurse);
- }
- child = child.getNextSibling();
- }
- }
-
- void addParentNode(Node context, Collection acc, boolean recurse)
- {
- Node parent = (context.getNodeType() == Node.ATTRIBUTE_NODE) ?
- ((Attr) context).getOwnerElement() : context.getParentNode();
- if (parent != null)
- {
- acc.add(parent);
- if (recurse)
- {
- addParentNode(parent, acc, recurse);
- }
- }
- }
-
- void addFollowingNodes(Node context, Collection acc, boolean recurse)
- {
- Node cur = context.getNextSibling();
- while (cur != null)
- {
- acc.add(cur);
- if (recurse)
- {
- addChildNodes(cur, acc, true);
- }
- cur = cur.getNextSibling();
- }
- if (recurse)
- {
- context = (context.getNodeType() == Node.ATTRIBUTE_NODE) ?
- ((Attr) context).getOwnerElement() : context.getParentNode();
- if (context != null)
- {
- addFollowingNodes(context, acc, recurse);
- }
- }
- }
-
- void addPrecedingNodes(Node context, Collection acc, boolean recurse)
- {
- Node cur = context.getPreviousSibling();
- while (cur != null)
- {
- acc.add(cur);
- if (recurse)
- {
- addChildNodes(cur, acc, true);
- }
- cur = cur.getPreviousSibling();
- }
- if (recurse)
- {
- context = (context.getNodeType() == Node.ATTRIBUTE_NODE) ?
- ((Attr) context).getOwnerElement() : context.getParentNode();
- if (context != null)
- {
- addPrecedingNodes(context, acc, recurse);
- }
- }
- }
-
- void addAttributes(Node context, Collection acc)
- {
- NamedNodeMap attrs = context.getAttributes();
- if (attrs != null)
- {
- int attrLen = attrs.getLength();
- for (int i = 0; i < attrLen; i++)
- {
- Node attr = attrs.item(i);
- if (!isNamespaceAttribute(attr))
- {
- acc.add(attr);
- }
- }
- }
- }
-
- void addNamespaceAttributes(Node context, Collection acc)
- {
- NamedNodeMap attrs = context.getAttributes();
- if (attrs != null)
- {
- int attrLen = attrs.getLength();
- for (int i = 0; i < attrLen; i++)
- {
- Node attr = attrs.item(i);
- if (isNamespaceAttribute(attr))
- {
- acc.add(attr);
- }
- }
- }
- }
-
- final boolean isNamespaceAttribute(Node node)
- {
- String uri = node.getNamespaceURI();
- return (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(uri) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(node.getPrefix()) ||
- XMLConstants.XMLNS_ATTRIBUTE.equals(node.getNodeName()));
- }
-
- public Expr clone(Object context)
- {
- int len = tests.length;
- List tests2 = new ArrayList(len);
- for (int i = 0; i < len; i++)
- {
- tests2.add(tests[i].clone(context));
- }
- return new Selector(axis, tests2);
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- switch (axis)
- {
- case ANCESTOR:
- buf.append("ancestor::");
- break;
- case ANCESTOR_OR_SELF:
- buf.append("ancestor-or-self::");
- break;
- case ATTRIBUTE:
- buf.append("attribute::");
- break;
- case CHILD:
- //buf.append("child::");
- break;
- case DESCENDANT:
- buf.append("descendant::");
- break;
- case DESCENDANT_OR_SELF:
- buf.append("descendant-or-self::");
- break;
- case FOLLOWING:
- buf.append("following::");
- break;
- case FOLLOWING_SIBLING:
- buf.append("following-sibling::");
- break;
- case NAMESPACE:
- buf.append("namespace::");
- break;
- case PARENT:
- if (tests.length == 0 ||
- (tests[0] instanceof NodeTypeTest &&
- ((NodeTypeTest) tests[0]).type == 0))
- {
- return "..";
- }
- buf.append("parent::");
- break;
- case PRECEDING:
- buf.append("preceding::");
- break;
- case PRECEDING_SIBLING:
- buf.append("preceding-sibling::");
- break;
- case SELF:
- if (tests.length == 0 ||
- (tests[0] instanceof NodeTypeTest &&
- ((NodeTypeTest) tests[0]).type == 0))
- {
- return ".";
- }
- buf.append("self::");
- break;
- }
- if (tests.length == 0)
- {
- buf.append('*');
- }
- else
- {
- for (int i = 0; i < tests.length; i++)
- {
- buf.append(tests[i]);
- }
- }
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/StartsWithFunction.java b/libjava/gnu/xml/xpath/StartsWithFunction.java
deleted file mode 100644
index 2cee8555fbf..00000000000
--- a/libjava/gnu/xml/xpath/StartsWithFunction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/* StartsWithFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The starts-with
function returns true if the first argument
- * string starts with the second argument string, and otherwise returns false.
- *
- * @author Chris Burdess
- */
-final class StartsWithFunction
- extends Expr
-{
-
- final Expr arg1;
- final Expr arg2;
-
- StartsWithFunction(List args)
- {
- this((Expr) args.get(0), (Expr) args.get(1));
- }
-
- StartsWithFunction(Expr arg1, Expr arg2)
- {
- this.arg1 = arg1;
- this.arg2 = arg2;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val1 = arg1.evaluate(context, pos, len);
- Object val2 = arg2.evaluate(context, pos, len);
- String s1 = _string(context, val1);
- String s2 = _string(context, val2);
- return s1.startsWith(s2) ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public Expr clone(Object context)
- {
- return new StartsWithFunction(arg1.clone(context), arg2.clone(context));
- }
-
- public String toString()
- {
- return "starts-with(" + arg1 + "," + arg2 + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Steps.java b/libjava/gnu/xml/xpath/Steps.java
deleted file mode 100644
index e8cbc4e619b..00000000000
--- a/libjava/gnu/xml/xpath/Steps.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/* Steps.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-
-/**
- * A list of transitions between components in a location path.
- *
- * @author Chris Burdess
- */
-public final class Steps
- extends Path
-{
-
- final LinkedList path;
-
- public Steps()
- {
- this(new LinkedList());
- }
-
- Steps(LinkedList path)
- {
- this.path = path;
- }
-
- public boolean matches(Node context)
- {
- // Right to left
- return matches(context, path.size() - 1);
- }
-
- boolean matches(Node context, int pos)
- {
- Pattern right = (Pattern) path.get(pos);
- if (!right.matches(context))
- {
- return false;
- }
- if (pos > 0)
- {
- Pattern left = (Pattern) path.get(pos - 1);
- Iterator j = possibleContexts(right, context).iterator();
- while (j.hasNext())
- {
- Node candidate = (Node) j.next();
- if (left.matches(candidate) &&
- matches(candidate, pos - 1))
- {
- return true;
- }
- // keep going, there may be another candidate
- }
- return false;
- }
- return true;
- }
-
- /**
- * Essentially the reverse of Selector.addCandidates.
- * The idea is to determine possible context nodes for a match.
- */
- Collection possibleContexts(Pattern pattern, Node context)
- {
- if (pattern instanceof Selector)
- {
- Selector s = (Selector) pattern;
- Collection candidates = new LinkedHashSet();
- switch (s.axis)
- {
- case Selector.PARENT:
- s.addChildNodes(context, candidates, false);
- break;
- case Selector.ANCESTOR:
- s.addChildNodes(context, candidates, true);
- break;
- case Selector.ANCESTOR_OR_SELF:
- candidates.add (context);
- s.addChildNodes(context, candidates, true);
- break;
- case Selector.CHILD:
- s.addParentNode(context, candidates, false);
- break;
- case Selector.DESCENDANT:
- s.addParentNode(context, candidates, true);
- break;
- case Selector.DESCENDANT_OR_SELF:
- candidates.add(context);
- s.addParentNode(context, candidates, true);
- break;
- case Selector.PRECEDING_SIBLING:
- s.addFollowingNodes(context, candidates, false);
- break;
- case Selector.FOLLOWING_SIBLING:
- s.addPrecedingNodes(context, candidates, false);
- break;
- case Selector.PRECEDING:
- s.addFollowingNodes(context, candidates, true);
- break;
- case Selector.FOLLOWING:
- s.addPrecedingNodes(context, candidates, true);
- break;
- case Selector.ATTRIBUTE:
- case Selector.NAMESPACE:
- if (context.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- candidates.add(((Attr) context).getOwnerElement());
- }
- break;
- case Selector.SELF:
- candidates.add(context);
- break;
- }
- return candidates;
- }
- return Collections.EMPTY_SET;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- //System.err.println(toString()+" evaluate");
- // Left to right
- Iterator i = path.iterator();
- Expr lhs = (Expr) i.next();
- Object val = lhs.evaluate(context, pos, len);
- //System.err.println("\tevaluate "+lhs+" = "+val);
- while (val instanceof Collection && i.hasNext())
- {
- Path rhs = (Path) i.next();
- val = rhs.evaluate(context, (Collection) val);
- //System.err.println("\tevaluate "+rhs+" = "+val);
- }
- return val;
- }
-
- Collection evaluate(Node context, Collection ns)
- {
- // Left to right
- Iterator i = path.iterator();
- Expr lhs = (Expr) i.next();
- if (lhs instanceof Path)
- {
- ns = ((Path) lhs).evaluate(context, ns);
- }
- else
- {
- Set acc = new LinkedHashSet();
- int pos = 1, len = ns.size();
- for (Iterator j = ns.iterator(); j.hasNext(); )
- {
- Node node = (Node) j.next();
- Object ret = lhs.evaluate(node, pos++, len);
- if (ret instanceof Collection)
- {
- acc.addAll((Collection) ret);
- }
- }
- ns = acc;
- }
- while (i.hasNext())
- {
- Path rhs = (Path) i.next();
- ns = rhs.evaluate(context, ns);
- }
- return ns;
- }
-
- public Expr clone(Object context)
- {
- int len = path.size();
- LinkedList path2 = new LinkedList();
- for (int i = 0; i < len; i++)
- {
- path2.add(((Expr) path.get(i)).clone(context));
- }
- return new Steps(path2);
- }
-
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- Iterator i = path.iterator();
- Expr expr = (Expr) i.next();
- if (!(expr instanceof Root))
- {
- buf.append(expr);
- }
- while (i.hasNext())
- {
- expr = (Expr) i.next();
- buf.append('/');
- buf.append(expr);
- }
- return buf.toString();
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/StringFunction.java b/libjava/gnu/xml/xpath/StringFunction.java
deleted file mode 100644
index fac15050aaf..00000000000
--- a/libjava/gnu/xml/xpath/StringFunction.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* StringFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The string function converts an object to a string as follows:
- *
for a given
- *
- * If the argument is omitted, it defaults to a node-set with the context
- * node as its only member.
- *
- * @author Chris Burdess
- */
-final class StringFunction
- extends Expr
-{
-
- final Expr arg;
-
- StringFunction(List args)
- {
- this(args.size() > 0 ? (Expr) args.get(0) : null);
- }
-
- StringFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
- return _string(context, val);
- }
-
- public Expr clone(Object context)
- {
- return new StringFunction((arg == null) ? null :
- arg.clone(context));
- }
-
- public String toString()
- {
- return (arg == null) ? "string()" : "string(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/StringLengthFunction.java b/libjava/gnu/xml/xpath/StringLengthFunction.java
deleted file mode 100644
index 4545c895fec..00000000000
--- a/libjava/gnu/xml/xpath/StringLengthFunction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* StringLengthFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The
- *
- * string-length
function returns the number of characters
- * in the string.
- * If the argument is omitted, it defaults to the context node converted to
- * a string, in other words the string-value of the context node.
- *
- * @author Chris Burdess
- */
-final class StringLengthFunction
- extends Expr
-{
-
- final Expr arg;
-
- StringLengthFunction(List args)
- {
- this(args.isEmpty() ? null : (Expr) args.get(0));
- }
-
- StringLengthFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
- String s = _string(context, val);
- return new Double((double) s.length());
- }
-
- public Expr clone(Object context)
- {
- return new StringLengthFunction((arg == null) ? null :
- arg.clone(context));
- }
-
- public String toString()
- {
- return (arg == null) ? "string-length()" : "string-length(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/SubstringAfterFunction.java b/libjava/gnu/xml/xpath/SubstringAfterFunction.java
deleted file mode 100644
index dcdff31f165..00000000000
--- a/libjava/gnu/xml/xpath/SubstringAfterFunction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* SubstringAfterFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The substring-after
function returns the substring of the
- * first argument string that follows the first occurrence of the second
- * argument string in the first argument string, or the empty string if the
- * first argument string does not contain the second argument string. For
- * example, substring-after("1999/04/01","/") returns 04/01, and
- * substring-after("1999/04/01","19") returns 99/04/01.
- *
- * @author Chris Burdess
- */
-final class SubstringAfterFunction
- extends Expr
-{
-
- final Expr arg1;
- final Expr arg2;
-
- SubstringAfterFunction(List args)
- {
- this((Expr) args.get(0), (Expr) args.get(1));
- }
-
- SubstringAfterFunction(Expr arg1, Expr arg2)
- {
- this.arg1 = arg1;
- this.arg2 = arg2;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val1 = arg1.evaluate(context, pos, len);
- Object val2 = arg2.evaluate(context, pos, len);
- String s1 = _string(context, val1);
- String s2 = _string(context, val2);
- int index = s1.indexOf(s2);
- return (index == -1) ? "" : s1.substring(index + s2.length());
- }
-
- public Expr clone(Object context)
- {
- return new SubstringAfterFunction(arg1.clone(context),
- arg2.clone(context));
- }
-
- public String toString()
- {
- return "substring-after(" + arg1 + "," + arg2 + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/SubstringBeforeFunction.java b/libjava/gnu/xml/xpath/SubstringBeforeFunction.java
deleted file mode 100644
index 4322bcd691b..00000000000
--- a/libjava/gnu/xml/xpath/SubstringBeforeFunction.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* SubstringBeforeFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The substring-before
function returns the substring of the
- * first argument string that precedes the first occurrence of the second
- * argument string in the first argument string, or the empty string if the
- * first argument string does not contain the second argument string. For
- * example, substring-before("1999/04/01","/") returns 1999.
- *
- * @author Chris Burdess
- */
-final class SubstringBeforeFunction
- extends Expr
-{
-
- final Expr arg1;
- final Expr arg2;
-
- SubstringBeforeFunction(List args)
- {
- this((Expr) args.get(0), (Expr) args.get(1));
- }
-
- SubstringBeforeFunction(Expr arg1, Expr arg2)
- {
- this.arg1 = arg1;
- this.arg2 = arg2;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val1 = arg1.evaluate(context, pos, len);
- Object val2 = arg2.evaluate(context, pos, len);
- String s1 = _string(context, val1);
- String s2 = _string(context, val2);
- int index = s1.indexOf(s2);
- return (index == -1) ? "" : s1.substring(0, index);
- }
-
- public Expr clone(Object context)
- {
- return new SubstringBeforeFunction(arg1.clone(context),
- arg2.clone(context));
- }
-
- public String toString()
- {
- return "substring-before(" + arg1 + "," + arg2 + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/SubstringFunction.java b/libjava/gnu/xml/xpath/SubstringFunction.java
deleted file mode 100644
index a554045cff0..00000000000
--- a/libjava/gnu/xml/xpath/SubstringFunction.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/* SubstringFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The substring function returns the substring of the first argument
- * starting at the position specified in the second argument with length
- * specified in the third argument. For example, substring("12345",2,3)
- * returns "234". If the third argument is not specified, it returns the
- * substring starting at the position specified in the second argument and
- * continuing to the end of the string. For example, substring("12345",2)
- * returns "2345".
- *
- * @author Chris Burdess
- */
-final class SubstringFunction
- extends Expr
-{
-
- final Expr arg1;
- final Expr arg2;
- final Expr arg3;
-
- SubstringFunction(List args)
- {
- this((Expr) args.get(0), (Expr) args.get(1),
- (args.size() > 2) ? (Expr) args.get(2) : null);
- }
-
- SubstringFunction(Expr arg1, Expr arg2, Expr arg3)
- {
- this.arg1 = arg1;
- this.arg2 = arg2;
- this.arg3 = arg3;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val1 = arg1.evaluate(context, pos, len);
- Object val2 = arg2.evaluate(context, pos, len);
- String s = _string(context, val1);
- int p = (val2 instanceof Double) ?
- ((Double) val2).intValue() :
- (int) Math.round(_number(context, val2));
- p--;
- if (p < 0)
- {
- p = 0;
- }
-
- int l = s.length() - p;
- if (l <= 0)
- {
- return "";
- }
-
- if (arg3 != null)
- {
- Object val3 = arg3.evaluate(context, pos, len);
- int v3 = (val3 instanceof Double) ?
- ((Double) val3).intValue() :
- (int) Math.round(_number(context, val3));
- if (v3 < l)
- {
- l = v3;
- }
- }
-
- return s.substring(p, p + l);
- }
-
- public Expr clone(Object context)
- {
- return new SubstringFunction(arg1.clone(context), arg2.clone(context),
- (arg3 == null) ? null : arg3.clone(context));
- }
-
- public String toString()
- {
- return (arg3 == null) ? "substring(" + arg1 + "," + arg2 + ")" :
- "substring(" + arg1 + "," + arg2 + "," + arg3 + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/SumFunction.java b/libjava/gnu/xml/xpath/SumFunction.java
deleted file mode 100644
index 61452f80947..00000000000
--- a/libjava/gnu/xml/xpath/SumFunction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* SumFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The sum
function returns the sum, for each node in the
- * argument node-set, of the result of converting the string-values of the
- * node to a number.
- *
- * @author Chris Burdess
- */
-final class SumFunction
- extends Expr
-{
-
- final Expr arg;
-
- SumFunction(List args)
- {
- this((Expr) args.get(0));
- }
-
- SumFunction(Expr arg)
- {
- this.arg = arg;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val = arg.evaluate(context, pos, len);
- double sum = 0.0d;
- if (val instanceof Collection)
- {
- for (Iterator i = ((Collection) val).iterator(); i.hasNext(); )
- {
- Node node = (Node) i.next();
- String s = stringValue(node);
- sum += _number(context, s);
- }
- }
- return new Double(sum);
- }
-
- public Expr clone(Object context)
- {
- return new SumFunction(arg.clone(context));
- }
-
- public String toString()
- {
- return "sum(" + arg + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/Test.java b/libjava/gnu/xml/xpath/Test.java
deleted file mode 100644
index 1ea4bc473a4..00000000000
--- a/libjava/gnu/xml/xpath/Test.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Test.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * A test that can be performed on a node to determine whether to include it
- * in a selection.
- *
- * @author Chris Burdess
- */
-public abstract class Test
-{
-
- public abstract boolean matches(Node node, int pos, int len);
-
- public abstract Test clone(Object context);
-
-}
diff --git a/libjava/gnu/xml/xpath/TranslateFunction.java b/libjava/gnu/xml/xpath/TranslateFunction.java
deleted file mode 100644
index b62180734ce..00000000000
--- a/libjava/gnu/xml/xpath/TranslateFunction.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* TranslateFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.List;
-import org.w3c.dom.Node;
-
-/**
- * The translate
function returns the first argument string
- * with occurrences of characters in the second argument string replaced by
- * the character at the corresponding position in the third argument string.
- * For example, translate("bar","abc","ABC") returns the string BAr. If
- * there is a character in the second argument string with no character at a
- * corresponding position in the third argument string (because the second
- * argument string is longer than the third argument string), then
- * occurrences of that character in the first argument string are removed.
- * For example, translate("--aaa--","abc-","ABC") returns "AAA". If a
- * character occurs more than once in the second argument string, then the
- * first occurrence determines the replacement character. If the third
- * argument string is longer than the second argument string, then excess
- * characters are ignored.
- *
- * @author Chris Burdess
- */
-final class TranslateFunction
- extends Expr
-{
-
- final Expr arg1;
- final Expr arg2;
- final Expr arg3;
-
- TranslateFunction(List args)
- {
- this((Expr) args.get(0), (Expr) args.get(1), (Expr) args.get(2));
- }
-
- TranslateFunction(Expr arg1, Expr arg2, Expr arg3)
- {
- this.arg1 = arg1;
- this.arg2 = arg2;
- this.arg3 = arg3;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object val1 = arg1.evaluate(context, pos, len);
- Object val2 = arg2.evaluate(context, pos, len);
- Object val3 = arg3.evaluate(context, pos, len);
- String string = _string(context, val1);
- String search = _string(context, val2);
- String replace = _string(context, val3);
- StringBuffer buf = new StringBuffer();
- int l1 = string.length();
- int l2 = search.length();
- int l3 = replace.length();
- for (int i = 0; i < l1; i++)
- {
- char c = string.charAt(i);
- boolean replaced = false;
- for (int j = 0; j < l2; j++)
- {
- if (c == search.charAt(j))
- {
- if (j < l3)
- {
- buf.append(replace.charAt(j));
- }
- replaced = true;
- }
- }
- if (!replaced)
- {
- buf.append(c);
- }
- }
- return new String(buf);
- }
-
- public Expr clone(Object context)
- {
- return new TranslateFunction(arg1.clone(context), arg2.clone(context),
- arg3.clone(context));
- }
-
- public String toString()
- {
- return "translate(" + arg1 + "," + arg2 + "," + arg3 + ")";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/TrueFunction.java b/libjava/gnu/xml/xpath/TrueFunction.java
deleted file mode 100644
index 3dd68bd5aa4..00000000000
--- a/libjava/gnu/xml/xpath/TrueFunction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* TrueFunction.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import org.w3c.dom.Node;
-
-/**
- * The true
function returns true.
- *
- * @author Chris Burdess
- */
-final class TrueFunction
- extends Expr
-{
-
- public Object evaluate(Node context, int pos, int len)
- {
- return Boolean.TRUE;
- }
-
- public Expr clone(Object context)
- {
- return new TrueFunction();
- }
-
- public String toString()
- {
- return "true()";
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/UnionExpr.java b/libjava/gnu/xml/xpath/UnionExpr.java
deleted file mode 100644
index 58c28a4d176..00000000000
--- a/libjava/gnu/xml/xpath/UnionExpr.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* UnionExpr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.w3c.dom.Node;
-
-/**
- * The union of two node-sets.
- *
- * @author Chris Burdess
- */
-public final class UnionExpr
- extends Pattern
-{
-
- final Expr lhs;
- final Expr rhs;
-
- public UnionExpr(Expr lhs, Expr rhs)
- {
- this.lhs = lhs;
- this.rhs = rhs;
- }
-
- public boolean matches(Node context)
- {
- if (lhs instanceof Pattern && rhs instanceof Pattern)
- {
- return ((Pattern) lhs).matches(context) ||
- ((Pattern) rhs).matches(context);
- }
- return false;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- Object left = lhs.evaluate(context, pos, len);
- Object right = rhs.evaluate(context, pos, len);
- if (left instanceof Collection && right instanceof Collection)
- {
- Set set = new HashSet();
- set.addAll ((Collection) left);
- set.addAll ((Collection) right);
- List list = new ArrayList(set);
- Collections.sort(list, documentOrderComparator);
- return list;
- }
- return Collections.EMPTY_SET;
- }
-
- public Expr clone(Object context)
- {
- return new UnionExpr(lhs.clone(context), rhs.clone(context));
- }
-
- public String toString()
- {
- return lhs + " | " + rhs;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/VariableReference.java b/libjava/gnu/xml/xpath/VariableReference.java
deleted file mode 100644
index e53d1faa858..00000000000
--- a/libjava/gnu/xml/xpath/VariableReference.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/* VariableReference.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathVariableResolver;
-import org.w3c.dom.Node;
-import gnu.xml.transform.Bindings;
-
-public class VariableReference
- extends Expr
-{
-
- final XPathVariableResolver resolver;
- final String name;
-
- public VariableReference(XPathVariableResolver resolver, String name)
- {
- this.resolver = resolver;
- this.name = name;
- }
-
- public Object evaluate(Node context, int pos, int len)
- {
- if (resolver != null)
- {
- if (resolver instanceof Bindings)
- {
- // Needs context to operate properly
- return ((Bindings) resolver).get(name, context, pos, len);
- }
- QName qname = QName.valueOf(name);
- return resolver.resolveVariable(qname);
- }
- throw new IllegalStateException("no variable resolver");
- }
-
- public Expr clone(Object context)
- {
- XPathVariableResolver r = resolver;
- if (context instanceof XPathVariableResolver)
- {
- r = (XPathVariableResolver) context;
- }
- return new VariableReference(r, name);
- }
-
- public String toString()
- {
- return "$" + name;
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/XPathFactoryImpl.java b/libjava/gnu/xml/xpath/XPathFactoryImpl.java
deleted file mode 100644
index 45dc57ed14a..00000000000
--- a/libjava/gnu/xml/xpath/XPathFactoryImpl.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/* XPathFactoryImpl.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathFactory;
-import javax.xml.xpath.XPathFactoryConfigurationException;
-import javax.xml.xpath.XPathFunctionResolver;
-import javax.xml.xpath.XPathVariableResolver;
-
-/**
- * GNU XPath factory implementation.
- *
- * @author Chris Burdess
- */
-public class XPathFactoryImpl
- extends XPathFactory
-{
-
- XPathVariableResolver variableResolver;
- XPathFunctionResolver functionResolver;
-
- public boolean isObjectModelSupported(String objectModel)
- {
- return XPathFactory.DEFAULT_OBJECT_MODEL_URI.equals(objectModel);
- }
-
- public void setFeature(String name, boolean value)
- throws XPathFactoryConfigurationException
- {
- throw new XPathFactoryConfigurationException(name);
- }
-
- public boolean getFeature(String name)
- throws XPathFactoryConfigurationException
- {
- throw new XPathFactoryConfigurationException(name);
- }
-
- public void setXPathVariableResolver(XPathVariableResolver resolver)
- {
- variableResolver = resolver;
- }
-
- public void setXPathFunctionResolver(XPathFunctionResolver resolver)
- {
- functionResolver = resolver;
- }
-
- public XPath newXPath()
- {
- return new XPathImpl(null, variableResolver, functionResolver);
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/XPathImpl.java b/libjava/gnu/xml/xpath/XPathImpl.java
deleted file mode 100644
index 3511834ca90..00000000000
--- a/libjava/gnu/xml/xpath/XPathImpl.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/* XPathImpl.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.io.IOException;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFunctionResolver;
-import javax.xml.xpath.XPathVariableResolver;
-import org.xml.sax.InputSource;
-
-/**
- * JAXP XPath implementation.
- *
- * @author Chris Burdess
- */
-public class XPathImpl
- implements XPath
-{
-
- XPathParser parser;
- NamespaceContext namespaceContext;
- XPathVariableResolver variableResolver;
- XPathFunctionResolver functionResolver;
-
- XPathImpl(NamespaceContext namespaceContext,
- XPathVariableResolver variableResolver,
- XPathFunctionResolver functionResolver)
- {
- parser = new XPathParser();
- this.namespaceContext = namespaceContext;
- this.variableResolver = variableResolver;
- this.functionResolver = functionResolver;
- reset();
- }
-
- public void reset()
- {
- parser.namespaceContext = namespaceContext;
- parser.variableResolver = variableResolver;
- parser.functionResolver = functionResolver;
- }
-
- public void setXPathVariableResolver(XPathVariableResolver resolver)
- {
- parser.variableResolver = resolver;
- }
-
- public XPathVariableResolver getXPathVariableResolver()
- {
- return parser.variableResolver;
- }
-
- public void setXPathFunctionResolver(XPathFunctionResolver resolver)
- {
- parser.functionResolver = resolver;
- }
-
- public XPathFunctionResolver getXPathFunctionResolver()
- {
- return parser.functionResolver;
- }
-
- public void setNamespaceContext(NamespaceContext nsContext)
- {
- parser.namespaceContext = nsContext;
- }
-
- public NamespaceContext getNamespaceContext()
- {
- return parser.namespaceContext;
- }
-
- public XPathExpression compile(String expression)
- throws XPathExpressionException
- {
- XPathTokenizer tokenizer = new XPathTokenizer(expression);
- try
- {
- return (Expr) parser.yyparse(tokenizer);
- }
- catch (IOException e)
- {
- throw new XPathExpressionException(e);
- }
- catch (XPathParser.yyException e)
- {
- throw new XPathExpressionException(expression);
- }
- }
-
- public Object evaluate(String expression,
- Object item,
- QName returnType)
- throws XPathExpressionException
- {
- XPathExpression expr = compile(expression);
- return expr.evaluate(item, returnType);
- }
-
- public String evaluate(String expression,
- Object item)
- throws XPathExpressionException
- {
- XPathExpression expr = compile(expression);
- return expr.evaluate(item);
- }
-
- public Object evaluate(String expression,
- InputSource source,
- QName returnType)
- throws XPathExpressionException
- {
- XPathExpression expr = compile(expression);
- return expr.evaluate(source, returnType);
- }
-
- public String evaluate(String expression,
- InputSource source)
- throws XPathExpressionException
- {
- XPathExpression expr = compile(expression);
- return expr.evaluate(source);
- }
-
-}
diff --git a/libjava/gnu/xml/xpath/XPathParser.java b/libjava/gnu/xml/xpath/XPathParser.java
deleted file mode 100644
index 01c744790dc..00000000000
--- a/libjava/gnu/xml/xpath/XPathParser.java
+++ /dev/null
@@ -1,1461 +0,0 @@
-// created by jay 0.8 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
-
- // line 2 "XPathParser.y"
-/* XPathParser.java -- An XPath 1.0 parser.
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathFunctionResolver;
-import javax.xml.xpath.XPathVariableResolver;
-import org.w3c.dom.Node;
-
-/**
- * An XPath 1.0 parser.
- *
- * @author Chris Burdess
- */
-public class XPathParser
-{
-
- NamespaceContext namespaceContext;
- XPathVariableResolver variableResolver;
- XPathFunctionResolver functionResolver;
-
- QName getQName(String name)
- {
- QName qName = QName.valueOf(name);
- if (namespaceContext != null)
- {
- String prefix = qName.getPrefix();
- String uri = qName.getNamespaceURI();
- if (prefix != null && (uri == null || uri.length() == 0))
- {
- uri = namespaceContext.getNamespaceURI(prefix);
- String localName = qName.getLocalPart();
- qName = new QName(uri, localName, prefix);
- }
- }
- return qName;
- }
-
- Expr lookupFunction(String name, List args)
- {
- int arity = args.size();
- if ("position".equals(name) && arity == 0)
- {
- return new PositionFunction();
- }
- else if ("last".equals(name) && arity == 0)
- {
- return new LastFunction();
- }
- else if ("string".equals(name) && (arity == 1 || arity == 0))
- {
- return new StringFunction(args);
- }
- else if ("number".equals(name) && (arity == 1 || arity == 0))
- {
- return new NumberFunction(args);
- }
- else if ("boolean".equals(name) && arity == 1)
- {
- return new BooleanFunction(args);
- }
- else if ("count".equals(name) && arity == 1)
- {
- return new CountFunction(args);
- }
- else if ("not".equals(name) && arity == 1)
- {
- return new NotFunction(args);
- }
- else if ("id".equals(name) && arity == 1)
- {
- return new IdFunction(args);
- }
- else if ("concat".equals(name) && arity > 1)
- {
- return new ConcatFunction(args);
- }
- else if ("true".equals(name) && arity == 0)
- {
- return new TrueFunction();
- }
- else if ("false".equals(name) && arity == 0)
- {
- return new FalseFunction();
- }
- else if ("name".equals(name) && (arity == 1 || arity == 0))
- {
- return new NameFunction(args);
- }
- else if ("local-name".equals(name) && (arity == 1 || arity == 0))
- {
- return new LocalNameFunction(args);
- }
- else if ("namespace-uri".equals(name) && (arity == 1 || arity == 0))
- {
- return new NamespaceUriFunction(args);
- }
- else if ("starts-with".equals(name) && arity == 2)
- {
- return new StartsWithFunction(args);
- }
- else if ("contains".equals(name) && arity == 2)
- {
- return new ContainsFunction(args);
- }
- else if ("string-length".equals(name) && (arity == 1 || arity == 0))
- {
- return new StringLengthFunction(args);
- }
- else if ("translate".equals(name) && arity == 3)
- {
- return new TranslateFunction(args);
- }
- else if ("normalize-space".equals(name) && (arity == 1 || arity == 0))
- {
- return new NormalizeSpaceFunction(args);
- }
- else if ("substring".equals(name) && (arity == 2 || arity == 3))
- {
- return new SubstringFunction(args);
- }
- else if ("substring-before".equals(name) && arity == 2)
- {
- return new SubstringBeforeFunction(args);
- }
- else if ("substring-after".equals(name) && arity == 2)
- {
- return new SubstringAfterFunction(args);
- }
- else if ("lang".equals(name) && arity == 1)
- {
- return new LangFunction(args);
- }
- else if ("sum".equals(name) && arity == 1)
- {
- return new SumFunction(args);
- }
- else if ("floor".equals(name) && arity == 1)
- {
- return new FloorFunction(args);
- }
- else if ("ceiling".equals(name) && arity == 1)
- {
- return new CeilingFunction(args);
- }
- else if ("round".equals(name) && arity == 1)
- {
- return new RoundFunction(args);
- }
- else if (functionResolver != null)
- {
- QName qName = QName.valueOf(name);
- Object function = functionResolver.resolveFunction(qName, arity);
- if (function != null &&
- function instanceof Function &&
- function instanceof Expr)
- {
- Function f = (Function) function;
- f.setArguments(args);
- return (Expr) function;
- }
- }
- return new FunctionCall(functionResolver, name, args);
- }
-
- // line 210 "-"
-// %token constants
-
- public static final int LITERAL = 257;
- public static final int DIGITS = 258;
- public static final int NAME = 259;
- public static final int LP = 260;
- public static final int RP = 261;
- public static final int LB = 262;
- public static final int RB = 263;
- public static final int COMMA = 264;
- public static final int PIPE = 265;
- public static final int SLASH = 266;
- public static final int DOUBLE_SLASH = 267;
- public static final int EQ = 268;
- public static final int NE = 269;
- public static final int GT = 270;
- public static final int LT = 271;
- public static final int GTE = 272;
- public static final int LTE = 273;
- public static final int PLUS = 274;
- public static final int MINUS = 275;
- public static final int AT = 276;
- public static final int STAR = 277;
- public static final int DOLLAR = 278;
- public static final int COLON = 279;
- public static final int DOUBLE_COLON = 280;
- public static final int DOT = 281;
- public static final int DOUBLE_DOT = 282;
- public static final int ANCESTOR = 283;
- public static final int ANCESTOR_OR_SELF = 284;
- public static final int ATTRIBUTE = 285;
- public static final int CHILD = 286;
- public static final int DESCENDANT = 287;
- public static final int DESCENDANT_OR_SELF = 288;
- public static final int FOLLOWING = 289;
- public static final int FOLLOWING_SIBLING = 290;
- public static final int NAMESPACE = 291;
- public static final int PARENT = 292;
- public static final int PRECEDING = 293;
- public static final int PRECEDING_SIBLING = 294;
- public static final int SELF = 295;
- public static final int DIV = 296;
- public static final int MOD = 297;
- public static final int OR = 298;
- public static final int AND = 299;
- public static final int COMMENT = 300;
- public static final int PROCESSING_INSTRUCTION = 301;
- public static final int TEXT = 302;
- public static final int NODE = 303;
- public static final int UNARY = 304;
- public static final int yyErrorCode = 256;
-
- /** thrown for irrecoverable syntax errors and stack overflow.
- */
- public static class yyException extends java.lang.Exception {
- public yyException (String message) {
- super(message);
- }
- }
-
- /** must be implemented by a scanner object to supply input to the parser.
- */
- public interface yyInput {
- /** move on to next token.
- @return false if positioned beyond tokens.
- @throws IOException on input error.
- */
- boolean advance () throws java.io.IOException;
- /** classifies current token.
- Should not be called if advance() returned false.
- @return current %token or single character.
- */
- int token ();
- /** associated with current token.
- Should not be called if advance() returned false.
- @return value for token().
- */
- Object value ();
- }
-
- /** simplified error message.
- @see yyerror
- */
- public void yyerror (String message) {
- yyerror(message, null);
- }
-
- /** (syntax) error message.
- Can be overwritten to control message format.
- @param message text to be displayed.
- @param expected vector of acceptable tokens, if available.
- */
- public void yyerror (String message, String[] expected) {
- if (expected != null && expected.length > 0) {
- System.err.print(message+", expecting");
- for (int n = 0; n < expected.length; ++ n)
- System.err.print(" "+expected[n]);
- System.err.println();
- } else
- System.err.println(message);
- }
-
- /** debugging support, requires the package jay.yydebug.
- Set to null to suppress debugging messages.
- */
-//t protected jay.yydebug.yyDebug yydebug;
-
- protected static final int yyFinal = 30;
-
- /** index-checked interface to yyName[].
- @param token single character or %token value.
- @return token name or [illegal] or [unknown].
- */
-//t public static final String yyname (int token) {
-//t if (token < 0 || token > YyNameClass.yyName.length) return "[illegal]";
-//t String name;
-//t if ((name = YyNameClass.yyName[token]) != null) return name;
-//t return "[unknown]";
-//t }
-
- /** computes list of expected tokens on error by tracing the tables.
- @param state for which to compute the list.
- @return list of token names.
- */
- protected String[] yyExpecting (int state) {
- int token, n, len = 0;
- boolean[] ok = new boolean[YyNameClass.yyName.length];
-
- if ((n = YySindexClass.yySindex[state]) != 0)
- for (token = n < 0 ? -n : 0;
- token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
- if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
- ++ len;
- ok[token] = true;
- }
- if ((n = YyRindexClass.yyRindex[state]) != 0)
- for (token = n < 0 ? -n : 0;
- token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
- if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
- ++ len;
- ok[token] = true;
- }
-
- String result[] = new String[len];
- for (n = token = 0; n < len; ++ token)
- if (ok[token]) result[n++] = YyNameClass.yyName[token];
- return result;
- }
-
- /** the generated parser, with debugging messages.
- Maintains a state and a value stack, currently with fixed maximum size.
- @param yyLex scanner.
- @param yydebug debug message writer implementing yyDebug, or null.
- @return result of the last reduction, if any.
- @throws yyException on irrecoverable parse error.
- */
- public Object yyparse (yyInput yyLex, Object yydebug)
- throws java.io.IOException, yyException {
-//t this.yydebug = (jay.yydebug.yyDebug)yydebug;
- return yyparse(yyLex);
- }
-
- /** initial size and increment of the state/value stack [default 256].
- This is not final so that it can be overwritten outside of invocations
- of yyparse().
- */
- protected int yyMax;
-
- /** executed at the beginning of a reduce action.
- Used as $$ = yyDefault($1), prior to the user-specified action, if any.
- Can be overwritten to provide deep copy, etc.
- @param first value for $1, or null.
- @return first.
- */
- protected Object yyDefault (Object first) {
- return first;
- }
-
- /** the generated parser.
- Maintains a state and a value stack, currently with fixed maximum size.
- @param yyLex scanner.
- @return result of the last reduction, if any.
- @throws yyException on irrecoverable parse error.
- */
- public Object yyparse (yyInput yyLex)
- throws java.io.IOException, yyException {
- if (yyMax <= 0) yyMax = 256; // initial size
- int yyState = 0, yyStates[] = new int[yyMax]; // state stack
- Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
- int yyToken = -1; // current input
- int yyErrorFlag = 0; // #tks to shift
-
- yyLoop: for (int yyTop = 0;; ++ yyTop) {
- if (yyTop >= yyStates.length) { // dynamically increase
- int[] i = new int[yyStates.length+yyMax];
- System.arraycopy(yyStates, 0, i, 0, yyStates.length);
- yyStates = i;
- Object[] o = new Object[yyVals.length+yyMax];
- System.arraycopy(yyVals, 0, o, 0, yyVals.length);
- yyVals = o;
- }
- yyStates[yyTop] = yyState;
- yyVals[yyTop] = yyVal;
-//t if (yydebug != null) yydebug.push(yyState, yyVal);
-
- yyDiscarded: for (;;) { // discarding a token does not change stack
- int yyN;
- if ((yyN = YyDefRedClass.yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
- if (yyToken < 0) {
- yyToken = yyLex.advance() ? yyLex.token() : 0;
-//t if (yydebug != null)
-//t yydebug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
- }
- if ((yyN = YySindexClass.yySindex[yyState]) != 0 && (yyN += yyToken) >= 0
- && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken) {
-//t if (yydebug != null)
-//t yydebug.shift(yyState, YyTableClass.yyTable[yyN], yyErrorFlag-1);
- yyState = YyTableClass.yyTable[yyN]; // shift to yyN
- yyVal = yyLex.value();
- yyToken = -1;
- if (yyErrorFlag > 0) -- yyErrorFlag;
- continue yyLoop;
- }
- if ((yyN = YyRindexClass.yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
- && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken)
- yyN = YyTableClass.yyTable[yyN]; // reduce (yyN)
- else
- switch (yyErrorFlag) {
-
- case 0:
- yyerror("syntax error", yyExpecting(yyState));
-//t if (yydebug != null) yydebug.error("syntax error");
-
- case 1: case 2:
- yyErrorFlag = 3;
- do {
- if ((yyN = YySindexClass.yySindex[yyStates[yyTop]]) != 0
- && (yyN += yyErrorCode) >= 0 && yyN < YyTableClass.yyTable.length
- && YyCheckClass.yyCheck[yyN] == yyErrorCode) {
-//t if (yydebug != null)
-//t yydebug.shift(yyStates[yyTop], YyTableClass.yyTable[yyN], 3);
- yyState = YyTableClass.yyTable[yyN];
- yyVal = yyLex.value();
- continue yyLoop;
- }
-//t if (yydebug != null) yydebug.pop(yyStates[yyTop]);
- } while (-- yyTop >= 0);
-//t if (yydebug != null) yydebug.reject();
- throw new yyException("irrecoverable syntax error");
-
- case 3:
- if (yyToken == 0) {
-//t if (yydebug != null) yydebug.reject();
- throw new yyException("irrecoverable syntax error at end-of-file");
- }
-//t if (yydebug != null)
-//t yydebug.discard(yyState, yyToken, yyname(yyToken),
-//t yyLex.value());
- yyToken = -1;
- continue yyDiscarded; // leave stack alone
- }
- }
- int yyV = yyTop + 1-YyLenClass.yyLen[yyN];
-//t if (yydebug != null)
-//t yydebug.reduce(yyState, yyStates[yyV-1], yyN, YyRuleClass.yyRule[yyN], YyLenClass.yyLen[yyN]);
- yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
- switch (yyN) {
-case 4:
- // line 276 "XPathParser.y"
- {
- yyVal = new Root();
- }
- break;
-case 5:
- // line 280 "XPathParser.y"
- {
- Steps steps;
- if (yyVals[0+yyTop] instanceof Steps)
- {
- steps = (Steps) yyVals[0+yyTop];
- }
- else
- {
- steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
- }
- steps.path.addFirst(new Root());
- yyVal = steps;
- /*$$ = new Step(new Root(), (Path) $2);*/
- }
- break;
-case 6:
- // line 296 "XPathParser.y"
- {
- Test nt = new NodeTypeTest((short) 0);
- Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
- Collections.singletonList (nt));
- Steps steps;
- if (yyVals[0+yyTop] instanceof Steps)
- {
- steps = (Steps) yyVals[0+yyTop];
- }
- else
- {
- steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
- }
- steps.path.addFirst(s);
- steps.path.addFirst(new Root());
- yyVal = steps;
- /*Step step = new Step(s, (Path) $2);*/
- /*$$ = new Step(new Root(), step);*/
- }
- break;
-case 8:
- // line 321 "XPathParser.y"
- {
- Steps steps;
- if (yyVals[-2+yyTop] instanceof Steps)
- {
- steps = (Steps) yyVals[-2+yyTop];
- }
- else
- {
- steps = new Steps();
- steps.path.addFirst(yyVals[-2+yyTop]);
- }
- steps.path.addLast(yyVals[0+yyTop]);
- yyVal = steps;
- /*$$ = new Step((Expr) $1, (Path) $3);*/
- }
- break;
-case 9:
- // line 337 "XPathParser.y"
- {
- Test nt = new NodeTypeTest((short) 0);
- Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
- Collections.singletonList (nt));
- Steps steps;
- if (yyVals[-2+yyTop] instanceof Steps)
- {
- steps = (Steps) yyVals[-2+yyTop];
- }
- else
- {
- steps = new Steps();
- steps.path.addFirst(yyVals[-2+yyTop]);
- }
- steps.path.addLast(s);
- steps.path.addLast(yyVals[0+yyTop]);
- yyVal = steps;
- /*Step step = new Step(s, (Path) $3);*/
- /*$$ = new Step((Expr) $1, step);*/
- }
- break;
-case 10:
- // line 361 "XPathParser.y"
- {
- yyVal = new Selector (Selector.CHILD, (List) yyVals[0+yyTop]);
- }
- break;
-case 11:
- // line 365 "XPathParser.y"
- {
- yyVal = new Selector (Selector.ATTRIBUTE, (List) yyVals[0+yyTop]);
- }
- break;
-case 12:
- // line 369 "XPathParser.y"
- {
- yyVal = new Selector (((Integer) yyVals[-2+yyTop]).intValue (), (List) yyVals[0+yyTop]);
- }
- break;
-case 13:
- // line 373 "XPathParser.y"
- {
- yyVal = new Selector (Selector.SELF, Collections.EMPTY_LIST);
- }
- break;
-case 14:
- // line 377 "XPathParser.y"
- {
- yyVal = new Selector (Selector.PARENT, Collections.EMPTY_LIST);
- }
- break;
-case 15:
- // line 384 "XPathParser.y"
- {
- List list = new ArrayList();
- list.add(yyVals[0+yyTop]);
- yyVal = list;
- }
- break;
-case 16:
- // line 390 "XPathParser.y"
- {
- List list = (List)yyVals[-1+yyTop];
- list.add(yyVals[0+yyTop]);
- yyVal = list;
- }
- break;
-case 17:
- // line 414 "XPathParser.y"
- {
- yyVal = new Integer(Selector.ANCESTOR);
- }
- break;
-case 18:
- // line 418 "XPathParser.y"
- {
- yyVal = new Integer(Selector.ANCESTOR_OR_SELF);
- }
- break;
-case 19:
- // line 422 "XPathParser.y"
- {
- yyVal = new Integer(Selector.ATTRIBUTE);
- }
- break;
-case 20:
- // line 426 "XPathParser.y"
- {
- yyVal = new Integer(Selector.CHILD);
- }
- break;
-case 21:
- // line 430 "XPathParser.y"
- {
- yyVal = new Integer(Selector.DESCENDANT);
- }
- break;
-case 22:
- // line 434 "XPathParser.y"
- {
- yyVal = new Integer(Selector.DESCENDANT_OR_SELF);
- }
- break;
-case 23:
- // line 438 "XPathParser.y"
- {
- yyVal = new Integer(Selector.FOLLOWING);
- }
- break;
-case 24:
- // line 442 "XPathParser.y"
- {
- yyVal = new Integer(Selector.FOLLOWING_SIBLING);
- }
- break;
-case 25:
- // line 446 "XPathParser.y"
- {
- yyVal = new Integer(Selector.NAMESPACE);
- }
- break;
-case 26:
- // line 450 "XPathParser.y"
- {
- yyVal = new Integer(Selector.PARENT);
- }
- break;
-case 27:
- // line 454 "XPathParser.y"
- {
- yyVal = new Integer(Selector.PRECEDING);
- }
- break;
-case 28:
- // line 458 "XPathParser.y"
- {
- yyVal = new Integer(Selector.PRECEDING_SIBLING);
- }
- break;
-case 29:
- // line 462 "XPathParser.y"
- {
- yyVal = new Integer(Selector.SELF);
- }
- break;
-case 31:
- // line 471 "XPathParser.y"
- {
- yyVal = new NodeTypeTest(Node.PROCESSING_INSTRUCTION_NODE, (String) yyVals[-1+yyTop]);
- }
- break;
-case 32:
- // line 476 "XPathParser.y"
- {
- yyVal = new NodeTypeTest(((Short) yyVals[-1+yyTop]).shortValue());
- }
- break;
-case 33:
- // line 483 "XPathParser.y"
- {
- yyVal = new Predicate((Expr) yyVals[-1+yyTop]);
- }
- break;
-case 35:
- // line 491 "XPathParser.y"
- {
- yyVal = new ParenthesizedExpr((Expr) yyVals[-1+yyTop]);
- }
- break;
-case 36:
- // line 495 "XPathParser.y"
- {
- yyVal = new Constant(yyVals[0+yyTop]);
- }
- break;
-case 37:
- // line 499 "XPathParser.y"
- {
- yyVal = new Constant(yyVals[0+yyTop]);
- }
- break;
-case 39:
- // line 507 "XPathParser.y"
- {
- yyVal = lookupFunction((String) yyVals[-2+yyTop], Collections.EMPTY_LIST);
- }
- break;
-case 40:
- // line 511 "XPathParser.y"
- {
- yyVal = lookupFunction((String) yyVals[-3+yyTop], (List) yyVals[-1+yyTop]);
- }
- break;
-case 41:
- // line 518 "XPathParser.y"
- {
- List list = new ArrayList();
- list.add(yyVals[0+yyTop]);
- yyVal = list;
- }
- break;
-case 42:
- // line 524 "XPathParser.y"
- {
- List list = (List) yyVals[0+yyTop];
- list.add(0, yyVals[-2+yyTop]);
- yyVal = list;
- }
- break;
-case 44:
- // line 534 "XPathParser.y"
- {
- yyVal = new UnionExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
- }
- break;
-case 47:
- // line 543 "XPathParser.y"
- {
- Steps steps;
- if (yyVals[0+yyTop] instanceof Steps)
- {
- steps = (Steps) yyVals[0+yyTop];
- }
- else
- {
- steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
- }
- steps.path.addFirst(yyVals[-2+yyTop]);
- yyVal = steps;
- /*$$ = new Step ((Expr) $1, (Path) $3);*/
- }
- break;
-case 48:
- // line 559 "XPathParser.y"
- {
- Test nt = new NodeTypeTest((short) 0);
- Selector s = new Selector(Selector.DESCENDANT_OR_SELF,
- Collections.singletonList(nt));
- Steps steps;
- if (yyVals[0+yyTop] instanceof Steps)
- {
- steps = (Steps) yyVals[0+yyTop];
- }
- else
- {
- steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
- }
- steps.path.addFirst(s);
- steps.path.addFirst(yyVals[-2+yyTop]);
- yyVal = steps;
- /*Step step = new Step (s, (Path) $3);*/
- /*$$ = new Step ((Expr) $1, step);*/
- }
- break;
-case 50:
- // line 584 "XPathParser.y"
- {
- Predicate filter = (Predicate) yyVals[0+yyTop];
- Selector s = new Selector(Selector.SELF,
- Collections.singletonList(filter));
- Steps steps;
- if (yyVals[-1+yyTop] instanceof Steps)
- {
- steps = (Steps) yyVals[-1+yyTop];
- }
- else
- {
- steps = new Steps();
- steps.path.addFirst(yyVals[-1+yyTop]);
- }
- steps.path.addLast(s);
- yyVal = steps;
- /*$$ = new Step ((Expr) $1, s);*/
- }
- break;
-case 52:
- // line 607 "XPathParser.y"
- {
- yyVal = new OrExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
- }
- break;
-case 54:
- // line 615 "XPathParser.y"
- {
- yyVal = new AndExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop]);
- }
- break;
-case 56:
- // line 623 "XPathParser.y"
- {
- yyVal = new EqualityExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false);
- }
- break;
-case 57:
- // line 627 "XPathParser.y"
- {
- yyVal = new EqualityExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true);
- }
- break;
-case 59:
- // line 635 "XPathParser.y"
- {
- yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true, false);
- }
- break;
-case 60:
- // line 639 "XPathParser.y"
- {
- yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false, false);
- }
- break;
-case 61:
- // line 643 "XPathParser.y"
- {
- yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], true, true);
- }
- break;
-case 62:
- // line 647 "XPathParser.y"
- {
- yyVal = new RelationalExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], false, true);
- }
- break;
-case 64:
- // line 655 "XPathParser.y"
- {
- yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.ADD);
- }
- break;
-case 65:
- // line 659 "XPathParser.y"
- {
- yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.SUBTRACT);
- }
- break;
-case 67:
- // line 667 "XPathParser.y"
- {
- yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.MULTIPLY);
- }
- break;
-case 68:
- // line 671 "XPathParser.y"
- {
- yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.DIVIDE);
- }
- break;
-case 69:
- // line 675 "XPathParser.y"
- {
- yyVal = new ArithmeticExpr((Expr) yyVals[-2+yyTop], (Expr) yyVals[0+yyTop], ArithmeticExpr.MODULO);
- }
- break;
-case 71:
- // line 683 "XPathParser.y"
- {
- yyVal = new NegativeExpr((Expr) yyVals[0+yyTop]);
- }
- break;
-case 72:
- // line 690 "XPathParser.y"
- {
- yyVal = new Double((String) yyVals[0+yyTop] + ".0");
- }
- break;
-case 73:
- // line 694 "XPathParser.y"
- {
- yyVal = new Double((String) yyVals[-1+yyTop] + ".0");
- }
- break;
-case 74:
- // line 698 "XPathParser.y"
- {
- yyVal = new Double((String) yyVals[-2+yyTop] + "." + (String) yyVals[0+yyTop]);
- }
- break;
-case 75:
- // line 702 "XPathParser.y"
- {
- yyVal = new Double("0." + (String) yyVals[0+yyTop]);
- }
- break;
-case 77:
- // line 731 "XPathParser.y"
- {
- yyVal = new VariableReference(variableResolver, (String) yyVals[0+yyTop]);
- }
- break;
-case 78:
- // line 738 "XPathParser.y"
- {
- yyVal = new NameTest(null, true, true);
- }
- break;
-case 79:
- // line 742 "XPathParser.y"
- {
- QName qName = getQName((String) yyVals[-2+yyTop]);
- yyVal = new NameTest(qName, true, false);
- }
- break;
-case 80:
- // line 747 "XPathParser.y"
- {
- QName qName = getQName((String) yyVals[0+yyTop]);
- yyVal = new NameTest(qName, false, false);
- }
- break;
-case 82:
- // line 756 "XPathParser.y"
- {
- yyVal = (String) yyVals[-2+yyTop] + ':' + (String) yyVals[0+yyTop];
- }
- break;
-case 83:
- // line 763 "XPathParser.y"
- {
- yyVal = new Short(Node.COMMENT_NODE);
- }
- break;
-case 84:
- // line 767 "XPathParser.y"
- {
- yyVal = new Short(Node.TEXT_NODE);
- }
- break;
-case 85:
- // line 771 "XPathParser.y"
- {
- yyVal = new Short(Node.PROCESSING_INSTRUCTION_NODE);
- }
- break;
-case 86:
- // line 775 "XPathParser.y"
- {
- yyVal = new Short((short) 0);
- }
- break;
- // line 986 "-"
- }
- yyTop -= YyLenClass.yyLen[yyN];
- yyState = yyStates[yyTop];
- int yyM = YyLhsClass.yyLhs[yyN];
- if (yyState == 0 && yyM == 0) {
-//t if (yydebug != null) yydebug.shift(0, yyFinal);
- yyState = yyFinal;
- if (yyToken < 0) {
- yyToken = yyLex.advance() ? yyLex.token() : 0;
-//t if (yydebug != null)
-//t yydebug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
- }
- if (yyToken == 0) {
-//t if (yydebug != null) yydebug.accept(yyVal);
- return yyVal;
- }
- continue yyLoop;
- }
- if ((yyN = YyGindexClass.yyGindex[yyM]) != 0 && (yyN += yyState) >= 0
- && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyState)
- yyState = YyTableClass.yyTable[yyN];
- else
- yyState = YyDgotoClass.yyDgoto[yyM];
-//t if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
- continue yyLoop;
- }
- }
- }
-
- protected static final class YyLhsClass {
-
- public static final short yyLhs [] = { -1,
- 0, 2, 2, 4, 4, 4, 3, 3, 3, 5,
- 5, 5, 5, 5, 6, 6, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 8,
- 8, 8, 9, 12, 12, 12, 12, 12, 15, 15,
- 17, 17, 18, 18, 19, 19, 19, 19, 20, 20,
- 1, 1, 21, 21, 22, 22, 22, 23, 23, 23,
- 23, 23, 24, 24, 24, 25, 25, 25, 25, 26,
- 26, 14, 14, 14, 14, 16, 13, 10, 10, 10,
- 27, 27, 11, 11, 11, 11,
- };
- } /* End of class YyLhsClass */
-
- protected static final class YyLenClass {
-
- public static final short yyLen [] = { 2,
- 1, 1, 1, 1, 2, 2, 1, 3, 3, 1,
- 2, 3, 1, 1, 1, 2, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 3, 2, 3, 1, 3, 1, 1, 1, 3, 4,
- 1, 3, 1, 3, 1, 1, 3, 3, 1, 2,
- 1, 3, 1, 3, 1, 3, 3, 1, 3, 3,
- 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
- 2, 1, 2, 3, 2, 1, 2, 1, 3, 1,
- 1, 3, 1, 1, 1, 1,
- };
- } /* End class YyLenClass */
-
- protected static final class YyDefRedClass {
-
- public static final short yyDefRed [] = { 0,
- 36, 0, 0, 0, 0, 0, 0, 0, 78, 0,
- 0, 14, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 83, 0, 84, 86, 0,
- 0, 45, 0, 3, 7, 0, 0, 15, 30, 0,
- 49, 34, 37, 38, 0, 0, 43, 0, 0, 0,
- 0, 0, 0, 66, 0, 0, 0, 0, 13, 0,
- 80, 0, 71, 0, 0, 77, 75, 0, 0, 0,
- 0, 0, 16, 0, 32, 0, 0, 0, 0, 50,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 74, 82, 79, 35, 0, 31, 0, 8,
- 9, 0, 0, 39, 0, 0, 44, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 67, 68,
- 69, 33, 0, 40, 42,
- };
- } /* End of class YyDefRedClass */
-
- protected static final class YyDgotoClass {
-
- public static final short yyDgoto [] = { 105,
- 31, 32, 33, 34, 35, 36, 37, 38, 73, 39,
- 40, 41, 42, 43, 44, 45, 106, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55,
- };
- } /* End of class YyDgotoClass */
-
- protected static final class YySindexClass {
-
- public static final short yySindex [] = { -97,
- 0, -271, -267, -97, -239, -239, -97, -199, 0, -236,
- -222, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, -218, 0, 0, 0,
- -257, 0, -241, 0, 0, -205, -221, 0, 0, -194,
- 0, 0, 0, 0, -190, -185, 0, -238, -211, -234,
- -255, -209, -275, 0, 0, -169, -250, -168, 0, -241,
- 0, -241, 0, -205, -187, 0, 0, -167, -97, -239,
- -239, -97, 0, -199, 0, -151, -43, -239, -239, 0,
- -97, -97, -97, -97, -97, -97, -97, -97, -97, -97,
- -97, -97, 0, 0, 0, 0, -164, 0, -211, 0,
- 0, -166, -205, 0, -165, -163, 0, -241, -241, -234,
- -255, -255, -209, -209, -209, -209, -275, -275, 0, 0,
- 0, 0, -97, 0, 0,
- };
- } /* End of class YySindexClass */
-
- protected static final class YyRindexClass {
-
- public static final short yyRindex [] = { 0,
- 0, 58, 1, 0, 420, 0, 0, 0, 0, 0,
- 129, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, -161, 0, 0, 0,
- 40, 0, 237, 0, 0, 168, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 459, 0, 277, 557, 544,
- 656, 561, 474, 0, 19, 75, 0, 0, 0, 295,
- 0, 334, 0, 183, 114, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 686, 0,
- 0, 0, 222, 0, -156, 0, 0, 351, 405, 553,
- 665, 697, 577, 600, 617, 639, 513, 528, 0, 0,
- 0, 0, 0, 0, 0,
- };
- } /* End of class YyRindexClass */
-
- protected static final class YyGindexClass {
-
- public static final short yyGindex [] = { 7,
- 0, 0, 8, 0, 3, -3, 0, 0, 48, 0,
- 0, 0, 0, 0, 0, 0, -12, 0, 35, 0,
- 44, 36, -1, -54, 2, -7, -2,
- };
- } /* End of class YyGindexClass */
-
- protected static final class YyTableClass {
-
- public static final short yyTable [] = { 63,
- 81, 90, 61, 61, 64, 61, 30, 66, 94, 56,
- 58, 57, 60, 62, 84, 85, 86, 87, 80, 3,
- 91, 92, 65, 72, 70, 71, 95, 78, 79, 113,
- 114, 115, 116, 82, 83, 67, 8, 9, 68, 1,
- 69, 59, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 72, 72, 74, 3,
- 26, 27, 28, 29, 88, 89, 75, 61, 61, 76,
- 103, 61, 100, 101, 73, 61, 61, 9, 102, 77,
- 111, 112, 119, 120, 121, 108, 109, 81, 93, 117,
- 118, 97, 96, 98, 94, 80, 122, 124, 123, 85,
- 26, 27, 28, 29, 41, 1, 2, 3, 4, 104,
- 125, 107, 99, 81, 5, 6, 110, 0, 0, 0,
- 0, 0, 0, 7, 8, 9, 10, 0, 13, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 0, 0, 0, 0, 26, 27,
- 28, 29, 0, 0, 0, 0, 0, 0, 0, 1,
- 2, 3, 4, 0, 0, 0, 0, 10, 5, 6,
- 0, 0, 0, 0, 0, 0, 0, 7, 8, 9,
- 10, 0, 11, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 0, 0,
- 0, 0, 26, 27, 28, 29, 0, 0, 0, 0,
- 0, 0, 0, 1, 2, 3, 4, 0, 0, 0,
- 0, 12, 5, 6, 0, 0, 0, 0, 0, 0,
- 0, 0, 8, 9, 10, 0, 2, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 0, 0, 0, 0, 26, 27, 28, 29,
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
- 81, 81, 81, 81, 81, 81, 46, 81, 76, 80,
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 5, 80, 81, 81, 81, 81,
- 1, 0, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 80, 80, 80, 80, 72, 72,
- 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
- 72, 72, 72, 6, 72, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 47, 73, 0, 72, 72, 72, 72, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 73, 73, 73, 73, 81, 81, 81, 81, 81, 81,
- 81, 81, 81, 81, 81, 81, 81, 81, 81, 13,
- 81, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 48, 13, 0, 0, 0, 81,
- 81, 81, 81, 0, 0, 0, 0, 0, 0, 4,
- 0, 0, 0, 0, 13, 13, 13, 13, 10, 0,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 11, 10, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 70, 11,
- 0, 0, 0, 10, 10, 10, 10, 0, 0, 0,
- 0, 0, 0, 63, 0, 0, 0, 0, 11, 11,
- 11, 11, 12, 0, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 2, 12, 2,
- 2, 2, 0, 0, 2, 2, 2, 2, 2, 2,
- 2, 2, 64, 2, 0, 0, 0, 12, 12, 12,
- 12, 0, 0, 0, 0, 0, 0, 65, 0, 0,
- 0, 0, 2, 2, 2, 2, 0, 46, 0, 46,
- 46, 46, 0, 53, 46, 46, 46, 46, 46, 46,
- 46, 46, 54, 46, 0, 5, 51, 5, 5, 5,
- 58, 0, 5, 5, 5, 5, 5, 5, 5, 5,
- 0, 5, 46, 46, 46, 46, 60, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 5, 5, 5, 5, 6, 0, 6, 6, 6, 59,
- 0, 6, 6, 6, 6, 6, 6, 6, 6, 0,
- 6, 47, 0, 47, 47, 47, 62, 0, 47, 47,
- 47, 47, 47, 47, 47, 47, 0, 47, 0, 6,
- 6, 6, 6, 0, 0, 0, 0, 0, 61, 0,
- 0, 0, 0, 0, 0, 0, 47, 47, 47, 47,
- 0, 0, 0, 0, 0, 55, 0, 0, 0, 0,
- 0, 0, 0, 0, 56, 48, 0, 48, 48, 48,
- 0, 0, 48, 48, 48, 48, 48, 48, 48, 48,
- 4, 48, 4, 4, 4, 52, 0, 4, 4, 4,
- 4, 4, 4, 4, 4, 0, 57, 0, 0, 0,
- 48, 48, 48, 48, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 4, 4, 4, 4, 70,
- 0, 70, 70, 0, 0, 0, 70, 70, 70, 70,
- 70, 70, 70, 70, 63, 70, 63, 63, 0, 0,
- 0, 63, 63, 63, 63, 63, 63, 63, 63, 0,
- 0, 0, 0, 0, 70, 70, 70, 70, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 63, 63, 64, 0, 64, 64, 0, 0, 0,
- 64, 64, 64, 64, 64, 64, 64, 64, 65, 0,
- 65, 65, 0, 0, 0, 65, 65, 65, 65, 65,
- 65, 65, 65, 0, 53, 0, 53, 53, 0, 0,
- 64, 64, 0, 54, 0, 54, 54, 51, 0, 51,
- 51, 58, 0, 58, 58, 65, 65, 0, 58, 58,
- 58, 58, 58, 58, 0, 0, 0, 60, 0, 60,
- 60, 53, 53, 0, 60, 60, 60, 60, 60, 60,
- 54, 54, 0, 0, 51, 0, 0, 0, 58, 58,
- 59, 0, 59, 59, 0, 0, 0, 59, 59, 59,
- 59, 59, 59, 0, 60, 60, 0, 62, 0, 62,
- 62, 0, 0, 0, 62, 62, 62, 62, 62, 62,
- 0, 0, 0, 0, 0, 0, 0, 59, 59, 61,
- 0, 61, 61, 0, 0, 0, 61, 61, 61, 61,
- 61, 61, 0, 0, 62, 62, 55, 0, 55, 55,
- 0, 0, 0, 55, 55, 56, 0, 56, 56, 0,
- 0, 0, 56, 56, 0, 0, 61, 61, 0, 0,
- 0, 0, 0, 0, 0, 0, 52, 0, 52, 52,
- 0, 0, 0, 55, 55, 0, 0, 57, 0, 57,
- 57, 0, 56, 56, 57, 57, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 52, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 57, 57,
- };
- } /* End of class YyTableClass */
-
- protected static final class YyCheckClass {
-
- public static final short yyCheck [] = { 7,
- 0, 277, 5, 6, 8, 8, 0, 10, 259, 281,
- 4, 279, 5, 6, 270, 271, 272, 273, 0, 259,
- 296, 297, 259, 262, 266, 267, 277, 266, 267, 84,
- 85, 86, 87, 268, 269, 258, 276, 277, 257, 0,
- 298, 281, 282, 283, 284, 285, 286, 287, 288, 289,
- 290, 291, 292, 293, 294, 295, 262, 0, 280, 259,
- 300, 301, 302, 303, 274, 275, 261, 70, 71, 260,
- 74, 74, 70, 71, 0, 78, 79, 277, 72, 265,
- 82, 83, 90, 91, 92, 78, 79, 299, 258, 88,
- 89, 279, 261, 261, 259, 48, 263, 261, 264, 261,
- 300, 301, 302, 303, 261, 257, 258, 259, 260, 261,
- 123, 77, 69, 0, 266, 267, 81, -1, -1, -1,
- -1, -1, -1, 275, 276, 277, 278, -1, 0, 281,
- 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
- 292, 293, 294, 295, -1, -1, -1, -1, 300, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, 257,
- 258, 259, 260, -1, -1, -1, -1, 0, 266, 267,
- -1, -1, -1, -1, -1, -1, -1, 275, 276, 277,
- 278, -1, 0, 281, 282, 283, 284, 285, 286, 287,
- 288, 289, 290, 291, 292, 293, 294, 295, -1, -1,
- -1, -1, 300, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, 257, 258, 259, 260, -1, -1, -1,
- -1, 0, 266, 267, -1, -1, -1, -1, -1, -1,
- -1, -1, 276, 277, 278, -1, 0, 281, 282, 283,
- 284, 285, 286, 287, 288, 289, 290, 291, 292, 293,
- 294, 295, -1, -1, -1, -1, 300, 301, 302, 303,
- 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
- 270, 271, 272, 273, 274, 275, 0, 277, 260, 261,
- 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
- 272, 273, 274, 275, 0, 277, 296, 297, 298, 299,
- 261, -1, 263, 264, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 296, 297, 298, 299, 261, 262,
- 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
- 273, 274, 275, 0, 277, 261, 262, 263, 264, 265,
- 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
- 0, 277, -1, 296, 297, 298, 299, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 296, 297, 298, 299, 261, 262, 263, 264, 265, 266,
- 267, 268, 269, 270, 271, 272, 273, 274, 275, 261,
- 277, 263, 264, 265, 266, 267, 268, 269, 270, 271,
- 272, 273, 274, 275, 0, 277, -1, -1, -1, 296,
- 297, 298, 299, -1, -1, -1, -1, -1, -1, 0,
- -1, -1, -1, -1, 296, 297, 298, 299, 261, -1,
- 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
- 273, 274, 275, 261, 277, 263, 264, 265, 266, 267,
- 268, 269, 270, 271, 272, 273, 274, 275, 0, 277,
- -1, -1, -1, 296, 297, 298, 299, -1, -1, -1,
- -1, -1, -1, 0, -1, -1, -1, -1, 296, 297,
- 298, 299, 261, -1, 263, 264, 265, 266, 267, 268,
- 269, 270, 271, 272, 273, 274, 275, 261, 277, 263,
- 264, 265, -1, -1, 268, 269, 270, 271, 272, 273,
- 274, 275, 0, 277, -1, -1, -1, 296, 297, 298,
- 299, -1, -1, -1, -1, -1, -1, 0, -1, -1,
- -1, -1, 296, 297, 298, 299, -1, 261, -1, 263,
- 264, 265, -1, 0, 268, 269, 270, 271, 272, 273,
- 274, 275, 0, 277, -1, 261, 0, 263, 264, 265,
- 0, -1, 268, 269, 270, 271, 272, 273, 274, 275,
- -1, 277, 296, 297, 298, 299, 0, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 296, 297, 298, 299, 261, -1, 263, 264, 265, 0,
- -1, 268, 269, 270, 271, 272, 273, 274, 275, -1,
- 277, 261, -1, 263, 264, 265, 0, -1, 268, 269,
- 270, 271, 272, 273, 274, 275, -1, 277, -1, 296,
- 297, 298, 299, -1, -1, -1, -1, -1, 0, -1,
- -1, -1, -1, -1, -1, -1, 296, 297, 298, 299,
- -1, -1, -1, -1, -1, 0, -1, -1, -1, -1,
- -1, -1, -1, -1, 0, 261, -1, 263, 264, 265,
- -1, -1, 268, 269, 270, 271, 272, 273, 274, 275,
- 261, 277, 263, 264, 265, 0, -1, 268, 269, 270,
- 271, 272, 273, 274, 275, -1, 0, -1, -1, -1,
- 296, 297, 298, 299, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 296, 297, 298, 299, 261,
- -1, 263, 264, -1, -1, -1, 268, 269, 270, 271,
- 272, 273, 274, 275, 261, 277, 263, 264, -1, -1,
- -1, 268, 269, 270, 271, 272, 273, 274, 275, -1,
- -1, -1, -1, -1, 296, 297, 298, 299, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 298, 299, 261, -1, 263, 264, -1, -1, -1,
- 268, 269, 270, 271, 272, 273, 274, 275, 261, -1,
- 263, 264, -1, -1, -1, 268, 269, 270, 271, 272,
- 273, 274, 275, -1, 261, -1, 263, 264, -1, -1,
- 298, 299, -1, 261, -1, 263, 264, 261, -1, 263,
- 264, 261, -1, 263, 264, 298, 299, -1, 268, 269,
- 270, 271, 272, 273, -1, -1, -1, 261, -1, 263,
- 264, 298, 299, -1, 268, 269, 270, 271, 272, 273,
- 298, 299, -1, -1, 298, -1, -1, -1, 298, 299,
- 261, -1, 263, 264, -1, -1, -1, 268, 269, 270,
- 271, 272, 273, -1, 298, 299, -1, 261, -1, 263,
- 264, -1, -1, -1, 268, 269, 270, 271, 272, 273,
- -1, -1, -1, -1, -1, -1, -1, 298, 299, 261,
- -1, 263, 264, -1, -1, -1, 268, 269, 270, 271,
- 272, 273, -1, -1, 298, 299, 261, -1, 263, 264,
- -1, -1, -1, 268, 269, 261, -1, 263, 264, -1,
- -1, -1, 268, 269, -1, -1, 298, 299, -1, -1,
- -1, -1, -1, -1, -1, -1, 261, -1, 263, 264,
- -1, -1, -1, 298, 299, -1, -1, 261, -1, 263,
- 264, -1, 298, 299, 268, 269, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 298, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 298, 299,
- };
- } /* End of class YyCheckClass */
-
-
-//t protected static final class YyRuleClass {
-
-//t public static final String yyRule [] = {
-//t "$accept : expr",
-//t "expr : or_expr",
-//t "location_path : relative_location_path",
-//t "location_path : absolute_location_path",
-//t "absolute_location_path : SLASH",
-//t "absolute_location_path : SLASH relative_location_path",
-//t "absolute_location_path : DOUBLE_SLASH relative_location_path",
-//t "relative_location_path : step",
-//t "relative_location_path : relative_location_path SLASH step",
-//t "relative_location_path : relative_location_path DOUBLE_SLASH step",
-//t "step : step_node_test",
-//t "step : AT step_node_test",
-//t "step : axis_name DOUBLE_COLON step_node_test",
-//t "step : DOT",
-//t "step : DOUBLE_DOT",
-//t "step_node_test : node_test",
-//t "step_node_test : step_node_test predicate",
-//t "axis_name : ANCESTOR",
-//t "axis_name : ANCESTOR_OR_SELF",
-//t "axis_name : ATTRIBUTE",
-//t "axis_name : CHILD",
-//t "axis_name : DESCENDANT",
-//t "axis_name : DESCENDANT_OR_SELF",
-//t "axis_name : FOLLOWING",
-//t "axis_name : FOLLOWING_SIBLING",
-//t "axis_name : NAMESPACE",
-//t "axis_name : PARENT",
-//t "axis_name : PRECEDING",
-//t "axis_name : PRECEDING_SIBLING",
-//t "axis_name : SELF",
-//t "node_test : name_test",
-//t "node_test : PROCESSING_INSTRUCTION LITERAL RP",
-//t "node_test : node_type RP",
-//t "predicate : LB expr RB",
-//t "primary_expr : variable_reference",
-//t "primary_expr : LP expr RP",
-//t "primary_expr : LITERAL",
-//t "primary_expr : number",
-//t "primary_expr : function_call",
-//t "function_call : function_name LP RP",
-//t "function_call : function_name LP argument_list RP",
-//t "argument_list : expr",
-//t "argument_list : expr COMMA argument_list",
-//t "union_expr : path_expr",
-//t "union_expr : union_expr PIPE path_expr",
-//t "path_expr : location_path",
-//t "path_expr : filter_expr",
-//t "path_expr : filter_expr SLASH relative_location_path",
-//t "path_expr : filter_expr DOUBLE_SLASH relative_location_path",
-//t "filter_expr : primary_expr",
-//t "filter_expr : filter_expr predicate",
-//t "or_expr : and_expr",
-//t "or_expr : or_expr OR and_expr",
-//t "and_expr : equality_expr",
-//t "and_expr : and_expr AND equality_expr",
-//t "equality_expr : relational_expr",
-//t "equality_expr : equality_expr EQ relational_expr",
-//t "equality_expr : equality_expr NE relational_expr",
-//t "relational_expr : additive_expr",
-//t "relational_expr : relational_expr LT additive_expr",
-//t "relational_expr : relational_expr GT additive_expr",
-//t "relational_expr : relational_expr LTE additive_expr",
-//t "relational_expr : relational_expr GTE additive_expr",
-//t "additive_expr : multiplicative_expr",
-//t "additive_expr : additive_expr PLUS multiplicative_expr",
-//t "additive_expr : additive_expr MINUS multiplicative_expr",
-//t "multiplicative_expr : unary_expr",
-//t "multiplicative_expr : multiplicative_expr STAR unary_expr",
-//t "multiplicative_expr : multiplicative_expr DIV unary_expr",
-//t "multiplicative_expr : multiplicative_expr MOD unary_expr",
-//t "unary_expr : union_expr",
-//t "unary_expr : MINUS unary_expr",
-//t "number : DIGITS",
-//t "number : DIGITS DOT",
-//t "number : DIGITS DOT DIGITS",
-//t "number : DOT DIGITS",
-//t "function_name : qname",
-//t "variable_reference : DOLLAR qname",
-//t "name_test : STAR",
-//t "name_test : NAME COLON STAR",
-//t "name_test : qname",
-//t "qname : NAME",
-//t "qname : NAME COLON NAME",
-//t "node_type : COMMENT",
-//t "node_type : TEXT",
-//t "node_type : PROCESSING_INSTRUCTION",
-//t "node_type : NODE",
-//t };
-//t } /* End of class YyRuleClass */
-
- protected static final class YyNameClass {
-
- public static final String yyName [] = {
- "end-of-file",null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,"LITERAL","DIGITS","NAME","LP",
- "RP","LB","RB","COMMA","PIPE","SLASH","DOUBLE_SLASH","EQ","NE","GT",
- "LT","GTE","LTE","PLUS","MINUS","AT","STAR","DOLLAR","COLON",
- "DOUBLE_COLON","DOT","DOUBLE_DOT","ANCESTOR","ANCESTOR_OR_SELF",
- "ATTRIBUTE","CHILD","DESCENDANT","DESCENDANT_OR_SELF","FOLLOWING",
- "FOLLOWING_SIBLING","NAMESPACE","PARENT","PRECEDING",
- "PRECEDING_SIBLING","SELF","DIV","MOD","OR","AND","COMMENT",
- "PROCESSING_INSTRUCTION","TEXT","NODE","UNARY",
- };
- } /* End of class YyNameClass */
-
-
- // line 781 "XPathParser.y"
-
-}
- // line 1461 "-"
diff --git a/libjava/gnu/xml/xpath/XPathTokenizer.java b/libjava/gnu/xml/xpath/XPathTokenizer.java
deleted file mode 100644
index a287137827b..00000000000
--- a/libjava/gnu/xml/xpath/XPathTokenizer.java
+++ /dev/null
@@ -1,592 +0,0 @@
-/* XPathTokenizer.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.xml.xpath;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Map;
-import java.util.TreeMap;
-
-/*import antlr.Token;
-import antlr.TokenStream;
-import antlr.TokenStreamException;
-import antlr.TokenStreamIOException;*/
-
-/**
- * XPath 1.0 expression tokenizer.
- *
- * @author Chris Burdess
- */
-public class XPathTokenizer
-implements XPathParser.yyInput
-//implements TokenStream
-{
-
- static class XPathToken
- //extends Token
- {
-
- int type;
- String val;
-
- XPathToken (int type)
- {
- this (type, null);
- }
-
- XPathToken (int type, String val)
- {
- //super (type);
- this.type = type;
- this.val = val;
- }
-
- public String getText ()
- {
- return val;
- }
-
- public String toString ()
- {
- return val;
- }
-
- }
-
- static final Map keywords = new TreeMap ();
- static
- {
- keywords.put ("ancestor", new Integer (XPathParser.ANCESTOR));
- keywords.put ("ancestor-or-self", new Integer (XPathParser.ANCESTOR_OR_SELF));
- keywords.put ("attribute", new Integer (XPathParser.ATTRIBUTE));
- keywords.put ("child", new Integer (XPathParser.CHILD));
- keywords.put ("descendant", new Integer (XPathParser.DESCENDANT));
- keywords.put ("descendant-or-self", new Integer (XPathParser.DESCENDANT_OR_SELF));
- keywords.put ("following", new Integer (XPathParser.FOLLOWING));
- keywords.put ("following-sibling", new Integer (XPathParser.FOLLOWING_SIBLING));
- keywords.put ("namespace", new Integer (XPathParser.NAMESPACE));
- keywords.put ("parent", new Integer (XPathParser.PARENT));
- keywords.put ("preceding", new Integer (XPathParser.PRECEDING));
- keywords.put ("preceding-sibling", new Integer (XPathParser.PRECEDING_SIBLING));
- keywords.put ("self", new Integer (XPathParser.SELF));
- keywords.put ("div", new Integer (XPathParser.DIV));
- keywords.put ("mod", new Integer (XPathParser.MOD));
- keywords.put ("or", new Integer (XPathParser.OR));
- keywords.put ("and", new Integer (XPathParser.AND));
- keywords.put ("comment", new Integer (XPathParser.COMMENT));
- keywords.put ("processing-instruction", new Integer (XPathParser.PROCESSING_INSTRUCTION));
- keywords.put ("text", new Integer (XPathParser.TEXT));
- keywords.put ("node", new Integer (XPathParser.NODE));
- }
-
- Reader in;
- XPathToken token;
- XPathToken lastToken;
-
- public XPathTokenizer (String expr)
- {
- this (new StringReader (expr));
- }
-
- XPathTokenizer (Reader in)
- {
- this.in = in.markSupported () ? in : new BufferedReader (in);
- }
-
- /* Begin ANTLR specific *
-
- public Token nextToken ()
- throws TokenStreamException
- {
- try
- {
- if (!advance ())
- {
- throw new TokenStreamException ("eof");
- }
- token ();
- return token;
- }
- catch (IOException e)
- {
- throw new TokenStreamIOException (e);
- }
- }
-
- * End ANTLR specific */
-
- public boolean advance ()
- throws IOException
- {
- lastToken = token;
- int c = in.read ();
- switch (c)
- {
- case -1: // eof
- return false;
- case 0x20:
- case 0x09:
- case 0x0d:
- case 0x0a: // skip whitespace
- return advance ();
- case 0x22: // "
- case 0x27: // '
- token = consume_literal (c);
- break;
- case 0x28: // (
- token = new XPathToken (XPathParser.LP);
- break;
- case 0x29: // )
- token = new XPathToken (XPathParser.RP);
- break;
- case 0x5b: // [
- token = new XPathToken (XPathParser.LB);
- break;
- case 0x5d: // ]
- token = new XPathToken (XPathParser.RB);
- break;
- case 0x2c: // ,
- token = new XPathToken (XPathParser.COMMA);
- break;
- case 0x7c: // |
- token = new XPathToken (XPathParser.PIPE);
- break;
- case 0x2f: // /
- in.mark (1);
- int d1 = in.read ();
- if (d1 == 0x2f)
- {
- token = new XPathToken (XPathParser.DOUBLE_SLASH);
- }
- else
- {
- in.reset ();
- token = new XPathToken (XPathParser.SLASH);
- }
- break;
- case 0x3d: // =
- token = new XPathToken (XPathParser.EQ);
- break;
- case 0x21: // !
- in.mark (1);
- int d2 = in.read ();
- if (d2 == 0x3d) // =
- {
- token = new XPathToken (XPathParser.NE);
- }
- else
- {
- in.reset ();
- token = new XPathToken (XPathParser.yyErrorCode);
- }
- break;
- case 0x3e: // >
- in.mark (1);
- int d3 = in.read ();
- if (d3 == 0x3d) // =
- {
- token = new XPathToken (XPathParser.GTE);
- }
- else
- {
- in.reset ();
- token = new XPathToken (XPathParser.GT);
- }
- break;
- case 0x3c: // <
- in.mark (1);
- int d4 = in.read ();
- if (d4 == 0x3d) // =
- {
- token = new XPathToken (XPathParser.LTE);
- }
- else
- {
- in.reset ();
- token = new XPathToken (XPathParser.LT);
- }
- break;
- case 0x2b: // +
- token = new XPathToken (XPathParser.PLUS);
- break;
- case 0x2d: // -
- token = new XPathToken (XPathParser.MINUS);
- break;
- case 0x40: // @
- token = new XPathToken (XPathParser.AT);
- break;
- case 0x2a: // *
- token = new XPathToken (XPathParser.STAR);
- break;
- case 0x24: // $
- token = new XPathToken (XPathParser.DOLLAR);
- break;
- case 0x3a: // :
- in.mark (1);
- int d5 = in.read ();
- if (d5 == 0x3a)
- {
- token = new XPathToken (XPathParser.DOUBLE_COLON);
- }
- else
- {
- in.reset ();
- token = new XPathToken (XPathParser.COLON);
- }
- break;
- case 0x2e: // .
- in.mark (1);
- int d6 = in.read ();
- if (d6 == 0x2e)
- {
- token = new XPathToken (XPathParser.DOUBLE_DOT);
- }
- else
- {
- in.reset ();
- token = new XPathToken (XPathParser.DOT);
- }
- break;
- default:
- if (c >= 0x30 && c <= 0x39)
- {
- token = consume_digits (c);
- }
- else if (c == 0x5f || Character.isLetter ((char) c))
- {
- token = consume_name (c);
- }
- else
- {
- token = new XPathToken (XPathParser.yyErrorCode);
- }
- }
- return true;
- }
-
- public int token ()
- {
- return token.type;
- }
-
- public Object value ()
- {
- return token.val;
- }
-
- XPathToken consume_literal (int delimiter)
- throws IOException
- {
- StringBuffer buf = new StringBuffer ();
- while (true)
- {
- int c = in.read ();
- if (c == -1)
- {
- return new XPathToken (XPathParser.yyErrorCode);
- }
- else if (c == delimiter)
- {
- return new XPathToken (XPathParser.LITERAL, buf.toString ());
- }
- else
- {
- buf.append ((char) c);
- }
- }
- }
-
- XPathToken consume_digits (int c)
- throws IOException
- {
- StringBuffer buf = new StringBuffer ();
- buf.append ((char) c);
- while (true)
- {
- in.mark (1);
- c = in.read ();
- if (c >= 0x30 && c <= 0x39)
- {
- buf.append ((char) c);
- }
- else
- {
- in.reset ();
- return new XPathToken (XPathParser.DIGITS, buf.toString ());
- }
- }
- }
-
- XPathToken consume_name (int c)
- throws IOException
- {
- StringBuffer buf = new StringBuffer ();
- buf.append ((char) c);
- while (true)
- {
- in.mark (1);
- c = in.read ();
- if (isNameChar (c))
- {
- buf.append ((char) c);
- }
- else
- {
- in.reset ();
- String name = buf.toString ();
- Integer keyword = (Integer) keywords.get (name);
- if (keyword == null)
- {
- return new XPathToken (XPathParser.NAME, name);
- }
- else
- {
- int val = keyword.intValue ();
- switch (val)
- {
- case XPathParser.NODE:
- case XPathParser.COMMENT:
- case XPathParser.TEXT:
- case XPathParser.PROCESSING_INSTRUCTION:
- // Consume subsequent (
- in.mark (1);
- do
- {
- c = in.read ();
- }
- while (c == 0x20 || c == 0x09);
- if (c != 0x28)
- {
- in.reset ();
- return new XPathToken (XPathParser.NAME, name);
- }
- break;
- case XPathParser.CHILD:
- case XPathParser.PARENT:
- case XPathParser.SELF:
- case XPathParser.DESCENDANT:
- case XPathParser.ANCESTOR:
- case XPathParser.DESCENDANT_OR_SELF:
- case XPathParser.ANCESTOR_OR_SELF:
- case XPathParser.ATTRIBUTE:
- case XPathParser.NAMESPACE:
- case XPathParser.FOLLOWING:
- case XPathParser.FOLLOWING_SIBLING:
- case XPathParser.PRECEDING:
- case XPathParser.PRECEDING_SIBLING:
- // Check that this is an axis specifier
- in.mark(1);
- do
- {
- c = in.read();
- }
- while (c == 0x20 || c == 0x09);
- if (c == 0x3a)
- {
- c = in.read();
- if (c == 0x3a)
- {
- in.reset();
- return new XPathToken(val);
- }
- }
- in.reset();
- return new XPathToken(XPathParser.NAME, name);
- case XPathParser.DIV:
- case XPathParser.MOD:
- // May be a name
- if (lastToken == null)
- {
- return new XPathToken(XPathParser.NAME, name);
- }
- switch (lastToken.type)
- {
- case XPathParser.LP:
- case XPathParser.LB:
- case XPathParser.COMMA:
- case XPathParser.PIPE:
- case XPathParser.EQ:
- case XPathParser.NE:
- case XPathParser.GT:
- case XPathParser.LT:
- case XPathParser.GTE:
- case XPathParser.LTE:
- case XPathParser.PLUS:
- case XPathParser.MINUS:
- case XPathParser.STAR:
- case XPathParser.AT:
- case XPathParser.DOLLAR:
- case XPathParser.COLON:
- case XPathParser.DOUBLE_COLON:
- case XPathParser.DIV:
- case XPathParser.MOD:
- case XPathParser.OR:
- case XPathParser.AND:
- case XPathParser.SLASH:
- return new XPathToken(XPathParser.NAME, name);
- }
- break;
- }
- return new XPathToken (val);
- }
- }
- }
- }
-
- boolean isNameChar (int c)
- {
- /* Name */
- return (c == 0x5f
- || c == 0x2d
- || c == 0x2e
- || (c >= 0x30 && c <= 0x39)
- /* CombiningChar */
- || (c >= 0x0300 && c <= 0x0345)
- || (c >= 0x0360 && c <= 0x0361)
- || (c >= 0x0483 && c <= 0x0486)
- || (c >= 0x0591 && c <= 0x05A1)
- || (c >= 0x05A3 && c <= 0x05B9)
- || (c >= 0x05BB && c <= 0x05BD)
- || c == 0x05BF
- || (c >= 0x05C1 && c <= 0x05C2)
- || c == 0x05C4
- || (c >= 0x064B && c <= 0x0652)
- || c == 0x0670
- || (c >= 0x06D6 && c <= 0x06DC)
- || (c >= 0x06DD && c <= 0x06DF)
- || (c >= 0x06E0 && c <= 0x06E4)
- || (c >= 0x06E7 && c <= 0x06E8)
- || (c >= 0x06EA && c <= 0x06ED)
- || (c >= 0x0901 && c <= 0x0903)
- || c == 0x093C
- || (c >= 0x093E && c <= 0x094C)
- || c == 0x094D
- || (c >= 0x0951 && c <= 0x0954)
- || (c >= 0x0962 && c <= 0x0963)
- || (c >= 0x0981 && c <= 0x0983)
- || c == 0x09BC
- || c == 0x09BE
- || c == 0x09BF
- || (c >= 0x09C0 && c <= 0x09C4)
- || (c >= 0x09C7 && c <= 0x09C8)
- || (c >= 0x09CB && c <= 0x09CD)
- || c == 0x09D7
- || (c >= 0x09E2 && c <= 0x09E3)
- || c == 0x0A02
- || c == 0x0A3C
- || c == 0x0A3E
- || c == 0x0A3F
- || (c >= 0x0A40 && c <= 0x0A42)
- || (c >= 0x0A47 && c <= 0x0A48)
- || (c >= 0x0A4B && c <= 0x0A4D)
- || (c >= 0x0A70 && c <= 0x0A71)
- || (c >= 0x0A81 && c <= 0x0A83)
- || c == 0x0ABC
- || (c >= 0x0ABE && c <= 0x0AC5)
- || (c >= 0x0AC7 && c <= 0x0AC9)
- || (c >= 0x0ACB && c <= 0x0ACD)
- || (c >= 0x0B01 && c <= 0x0B03)
- || c == 0x0B3C
- || (c >= 0x0B3E && c <= 0x0B43)
- || (c >= 0x0B47 && c <= 0x0B48)
- || (c >= 0x0B4B && c <= 0x0B4D)
- || (c >= 0x0B56 && c <= 0x0B57)
- || (c >= 0x0B82 && c <= 0x0B83)
- || (c >= 0x0BBE && c <= 0x0BC2)
- || (c >= 0x0BC6 && c <= 0x0BC8)
- || (c >= 0x0BCA && c <= 0x0BCD)
- || c == 0x0BD7
- || (c >= 0x0C01 && c <= 0x0C03)
- || (c >= 0x0C3E && c <= 0x0C44)
- || (c >= 0x0C46 && c <= 0x0C48)
- || (c >= 0x0C4A && c <= 0x0C4D)
- || (c >= 0x0C55 && c <= 0x0C56)
- || (c >= 0x0C82 && c <= 0x0C83)
- || (c >= 0x0CBE && c <= 0x0CC4)
- || (c >= 0x0CC6 && c <= 0x0CC8)
- || (c >= 0x0CCA && c <= 0x0CCD)
- || (c >= 0x0CD5 && c <= 0x0CD6)
- || (c >= 0x0D02 && c <= 0x0D03)
- || (c >= 0x0D3E && c <= 0x0D43)
- || (c >= 0x0D46 && c <= 0x0D48)
- || (c >= 0x0D4A && c <= 0x0D4D)
- || c == 0x0D57
- || c == 0x0E31
- || (c >= 0x0E34 && c <= 0x0E3A)
- || (c >= 0x0E47 && c <= 0x0E4E)
- || c == 0x0EB1
- || (c >= 0x0EB4 && c <= 0x0EB9)
- || (c >= 0x0EBB && c <= 0x0EBC)
- || (c >= 0x0EC8 && c <= 0x0ECD)
- || (c >= 0x0F18 && c <= 0x0F19)
- || c == 0x0F35
- || c == 0x0F37
- || c == 0x0F39
- || c == 0x0F3E
- || c == 0x0F3F
- || (c >= 0x0F71 && c <= 0x0F84)
- || (c >= 0x0F86 && c <= 0x0F8B)
- || (c >= 0x0F90 && c <= 0x0F95)
- || c == 0x0F97
- || (c >= 0x0F99 && c <= 0x0FAD)
- || (c >= 0x0FB1 && c <= 0x0FB7)
- || c == 0x0FB9
- || (c >= 0x20D0 && c <= 0x20DC)
- || c == 0x20E1
- || (c >= 0x302A && c <= 0x302F)
- || c == 0x3099
- || c == 0x309A
- /* Extender */
- || c == 0x00B7
- || c == 0x02D0
- || c == 0x02D1
- || c == 0x0387
- || c == 0x0640
- || c == 0x0E46
- || c == 0x0EC6
- || c == 0x3005
- || (c >= 0x3031 && c <= 0x3035)
- || (c >= 0x309D && c <= 0x309E)
- || (c >= 0x30FC && c <= 0x30FE)
- /* Name */
- || Character.isLetter ((char) c));
- }
-
-}
diff --git a/libjava/include/Makefile.am b/libjava/include/Makefile.am
index f1d78390061..77cd99cea90 100644
--- a/libjava/include/Makefile.am
+++ b/libjava/include/Makefile.am
@@ -9,4 +9,4 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
target_noncanonical = @target_noncanonical@
tool_include_dir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
-tool_include__HEADERS = jni.h jni_md.h jawt.h jawt_md.h jvmpi.h
+tool_include__HEADERS = jni_md.h jawt.h jawt_md.h jvmpi.h
diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in
index 582be691c2e..704313cb2c6 100644
--- a/libjava/include/Makefile.in
+++ b/libjava/include/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -42,14 +42,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(tool_include__HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
- $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gxx-include-dir.m4 \
$(top_srcdir)/../config/iconv.m4 \
$(top_srcdir)/../config/lcmessage.m4 \
- $(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
- $(top_srcdir)/../config/lib-prefix.m4 $(top_srcdir)/pkg.m4 \
+ $(top_srcdir)/../config/lib-prefix.m4 \
$(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
@@ -297,7 +295,7 @@ AUTOMAKE_OPTIONS = foreign
# May be used by various substitution variables.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
tool_include_dir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
-tool_include__HEADERS = jni.h jni_md.h jawt.h jawt_md.h jvmpi.h
+tool_include__HEADERS = jni_md.h jawt.h jawt_md.h jvmpi.h
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/libjava/include/jni.h b/libjava/include/jni.h
deleted file mode 100644
index 8ebf3f7f7e9..00000000000
--- a/libjava/include/jni.h
+++ /dev/null
@@ -1,1599 +0,0 @@
-/* jni.h
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-/* Note: this file must be compilable by the C compiler (for now,
- assuming GNU C is ok). This means you must never use `//'
- comments, and all C++-specific code must be conditional on
- __cplusplus. */
-
-#ifndef _CLASSPATH_JNI_H
-#define _CLASSPATH_JNI_H
-
-/* We include true
if this applet is active
- */
- public boolean isActive()
- {
- return stub.isActive();
- }
-
- /**
- * Returns the basename URL of the document this applet is embedded in. This
- * is everything up to the final '/'.
- *
- * @return the URL of the document this applet is embedded in
- * @see #getCodeBase()
- */
- public URL getDocumentBase()
- {
- return stub.getDocumentBase();
- }
-
- /**
- * Returns the URL of the code base for this applet.
- *
- * @return the URL of the code base for this applet
- */
- public URL getCodeBase()
- {
- return stub.getCodeBase();
- }
-
- /**
- * Returns the value of the specified parameter that was specified in
- * the <APPLET>
tag for this applet.
- *
- * @param name the parameter name
- * @return the parameter value, or null if the parameter does not exist
- * @throws NullPointerException if name is null
- */
- public String getParameter(String name)
- {
- return stub.getParameter(name);
- }
-
- /**
- * Returns the applet context for this applet.
- *
- * @return the applet context for this applet
- */
- public AppletContext getAppletContext()
- {
- return stub.getAppletContext();
- }
-
- /**
- * Requests that the applet window for this applet be resized.
- *
- * @param width the new width in pixels
- * @param height the new height in pixels
- */
- public void resize(int width, int height)
- {
- if (stub == null)
- {
- this.width = width;
- this.height = height;
- }
- else
- stub.appletResize(width, height);
- }
-
- /**
- * Requests that the applet window for this applet be resized.
- *
- * @param dim the requested dimensions
- * @throws NullPointerException if dim is null
- */
- public void resize(Dimension dim)
- {
- resize(dim.width, dim.height);
- }
-
- /**
- * Displays the specified message in the status window if that window
- * exists.
- *
- * @param message the status message, may be null
- */
- public void showStatus(String message)
- {
- getAppletContext().showStatus(message);
- }
-
- /**
- * Returns an image from the specified URL. Note that the image is not
- * actually retrieved until the applet attempts to display it, so this
- * method returns immediately.
- *
- * @param url the URL of the image
- * @return the retrieved image
- * @throws NullPointerException if url is null
- */
- public Image getImage(URL url)
- {
- return getAppletContext().getImage(url);
- }
-
- /**
- * Returns an image from the specified absolute URL, and relative path
- * from that URL. Note that the image is not actually retrieved until the
- * applet attempts to display it, so this method returns immediately.
- * This calls getImage(new URL(url, name))
, but if building
- * the new URL fails, this returns null.
- *
- * @param url the base URL of the image
- * @param name the name of the image relative to the URL
- * @return the retrieved image, or null on failure
- * @see #getImage(URL)
- */
- public Image getImage(URL url, String name)
- {
- try
- {
- return getImage(new URL(url, name));
- }
- catch (MalformedURLException e)
- {
- return null;
- }
- }
-
- /**
- * Returns an audio clip from the specified URL. This clip is not tied to
- * any particular applet.
- *
- * XXX Classpath does not yet implement this.
- *
- * @param url the URL of the audio clip
- * @return the retrieved audio clip
- * @throws NullPointerException if url is null
- * @see #getAudioClip(URL)
- * @since 1.2
- */
- public static final AudioClip newAudioClip(URL url)
- {
- // This requires an implementation of AudioClip in gnu.java.applet.
- throw new Error("Not implemented");
- }
-
- /**
- * Returns an audio clip from the specified URL. Note that the clip is not
- * actually retrieved until the applet attempts to play it, so this method
- * returns immediately.
- *
- * @param url the URL of the audio clip
- * @return the retrieved audio clip
- * @throws NullPointerException if url is null
- */
- public AudioClip getAudioClip(URL url)
- {
- return getAppletContext().getAudioClip(url);
- }
-
- /**
- * Returns an audio clip from the specified absolute URL, and relative path
- * from that URL. Note that the clip is not actually retrieved until the
- * applet attempts to play it, so this method returns immediately. This
- * calls getAudioClip(new URL(url, name))
, but if building
- * the new URL fails, this returns null.
- *
- * @param url the base URL of the audio clip
- * @param name the name of the clip relative to the URL
- * @return the retrieved audio clip, or null on failure
- * @see #getAudioClip(URL)
- */
- public AudioClip getAudioClip(URL url, String name)
- {
- try
- {
- return getAudioClip(new URL(url, name));
- }
- catch (MalformedURLException e)
- {
- return null;
- }
- }
-
- /**
- * Returns a descriptive string with applet defined information. The
- * implementation in this class returns null
, so subclasses
- * must override to return information.
- *
- * @return a string describing the author, version, and applet copyright
- */
- public String getAppletInfo()
- {
- return null;
- }
-
- /**
- * Returns the locale for this applet, if it has been set. If no applet
- * specific locale has been set, the default locale is returned.
- *
- * @return the locale for this applet
- * @see Component#setLocale(Locale)
- * @since 1.1
- */
- public Locale getLocale()
- {
- return super.getLocale();
- }
-
- /**
- * Returns a list of parameters this applet supports. Each element of
- * the outer array is an array of three strings with the name of the
- * parameter, the data type or valid values, and a description. This
- * method is optional and the default implementation returns null.
- *
- * @return the list of parameters supported by this applet
- */
- public String[][] getParameterInfo()
- {
- return null;
- }
-
- /**
- * Loads and plays the audio clip pointed to by the specified URL. This does
- * nothing if the URL does not point to a valid audio clip.
- *
- * @param url the URL of the audio clip
- * @throws NullPointerException if url is null
- * @see #getAudioClip(URL)
- */
- public void play(URL url)
- {
- AudioClip ac = getAudioClip(url);
- try
- {
- ac.play();
- }
- catch (Exception ignored)
- {
- }
- }
-
- /**
- * Loads and plays the audio clip pointed to by the specified absolute URL,
- * and relative path from that URL. This does nothing if the URL cannot be
- * constructed, or if it does not point to a valid audio clip.
- *
- * @param url the base URL of the audio clip
- * @param name the name of the audio clip relative to the URL
- * @see #getAudioClip(URL, String)
- * @see #play(URL)
- */
- public void play(URL url, String name)
- {
- try
- {
- getAudioClip(url, name).play();
- }
- catch (Exception ignored)
- {
- }
- }
-
- /**
- * This method is called when the applet is first loaded, before start().
- * The default implementation does nothing; override to do any one-time
- * initialization.
- *
- * @see #start()
- * @see #stop()
- * @see #destroy()
- */
- public void init()
- {
- }
-
- /**
- * This method is called when the applet should start running. This is
- * normally each time a web page containing it is loaded. The default
- * implemention does nothing; override for your applet to be useful.
- *
- * @see #init()
- * @see #stop()
- * @see #destroy()
- */
- public void start()
- {
- }
-
- /**
- * This method is called when the applet should stop running. This is
- * normally when the next web page is loaded. The default implementation
- * does nothing; override for your applet to stop using resources when
- * it is no longer visible, but may be restarted soon.
- *
- * @see #init()
- * @see #start()
- * @see #destroy()
- */
- public void stop()
- {
- }
-
- /**
- * This method is called when the applet is being unloaded. The default
- * implementation does nothing; override for your applet to clean up
- * resources on exit.
- *
- * @see #init()
- * @see #start()
- * @see #stop()
- */
- public void destroy()
- {
- }
-
- /**
- * Gets the AccessibleContext associated with this applet, creating one if
- * necessary. This always returns an instance of {@link AccessibleApplet}.
- *
- * @return the accessibility context of this applet
- * @since 1.3
- */
- public AccessibleContext getAccessibleContext()
- {
- if (accessibleContext == null)
- accessibleContext = new AccessibleApplet();
- return accessibleContext;
- }
-
- /**
- * Read an applet from an object stream. This checks for a headless
- * environment, then does the normal read.
- *
- * @param s the stream to read from
- * @throws ClassNotFoundException if a class is not found
- * @throws IOException if deserialization fails
- * @throws HeadlessException if this is a headless environment
- * @see GraphicsEnvironment#isHeadless()
- * @since 1.4
- */
- private void readObject(ObjectInputStream s)
- throws ClassNotFoundException, IOException
- {
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException();
- s.defaultReadObject();
- }
-
- /**
- * This class provides accessibility support for Applets, and is the
- * runtime type returned by {@link #getAccessibleContext()}.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- */
- protected class AccessibleApplet extends AccessibleAWTPanel
- {
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = 8127374778187708896L;
-
- /**
- * The default constructor.
- */
- protected AccessibleApplet()
- {
- }
-
- /**
- * Get the role of this accessible object, a frame.
- *
- * @return the role of the object
- * @see AccessibleRole#FRAME
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.FRAME;
- }
-
- /**
- * Get the state set of this accessible object. In addition to the default
- * states of a Component, the applet can also be active.
- *
- * @return the role of the object
- * @see AccessibleState
- */
- public AccessibleStateSet getAccessibleStateSet()
- {
- AccessibleStateSet s = super.getAccessibleStateSet();
- if (isActive())
- s.add(AccessibleState.ACTIVE);
- return s;
- }
- } // class AccessibleApplet
-} // class Applet
diff --git a/libjava/java/applet/AppletContext.java b/libjava/java/applet/AppletContext.java
deleted file mode 100644
index a17508fd4a4..00000000000
--- a/libjava/java/applet/AppletContext.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/* AppletContext.java -- access the applet's runtime environment
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.applet;
-
-import java.awt.Image;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Iterator;
-
-/**
- * This interface allows an applet access to the browser to retrieve
- * additional data files and display documents. It also allows the
- * applet to find out other applets in the same document.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.0
- * @status updated to 1.4
- */
-public interface AppletContext
-{
- /**
- * Returns an audio clip from the specified URL.
- *
- * @param url the URL of the audio clip
- * @return the retrieved audio clip
- * @throws NullPointerException if url is null
- */
- AudioClip getAudioClip(URL url);
-
- /**
- * Returns an image from the specified URL. Note that the image is not
- * actually retrieved until the applet attempts to display it, so this
- * method returns immediately.
- *
- * @param url the absolute URL of the image
- * @return the retrieved image
- * @throws NullPointerException if url is null
- */
- Image getImage(URL url);
-
- /**
- * Returns the applet in the document for this object that has the
- * specified name.
- *
- * @param name the applet name
- * @return the requested applet, or null
if not found
- */
- Applet getApplet(String name);
-
- /**
- * Returns a list of all the applets in the document for this object.
- *
- * @return a list of all the applets
- */
- Enumeration getApplets();
-
- /**
- * Displays the web page pointed to by the specified URL in the window
- * for this object. This page replaces the document that is currently
- * there.
- *
- * @param url the URL of the web page to load; unspecified on an error
- */
- void showDocument(URL url);
-
- /**
- * Displays the web page pointed to be the sepcified URL in the window
- * with the specified name. The standard names "_top", "_blank",
- * "_parent", and "_self" are allowed. An applet viewer may disregard
- * this request.
- *
- * @param url the URL of the web page to load
- * @param target the target window
- */
- void showDocument(URL url, String target);
-
- /**
- * Displays the specified message in the status window if that window
- * exists.
- *
- * @param message the status message, may be null
- */
- void showStatus(String message);
-
- /**
- * Associate a stream to a key for this applet context, possibly replacing
- * the old value. Stream associations are local to the applet context, for
- * security purposes.
- *
- * @param key the key to associate with
- * @param stream the stream value to tie to the key, or null to remove
- * @throws IOException if the stream is too large
- * @since 1.4
- */
- void setStream(String key, InputStream stream) throws IOException;
-
- /**
- * Return the stream associated with a given key in this applet context, or
- * null if nothing is associated. Stream associations are local to the
- * applet context, for security purposes.
- *
- * @param key the key to look up
- * @return the associated stream, or null
- * @since 1.4
- */
- InputStream getStream(String key);
-
- /**
- * Iterate over all keys that have associated streams. Stream associated
- * are local to the applet context, for security purposes.
- *
- * @return an iterator over the association keys
- * @since 1.4
- */
- Iterator getStreamKeys();
-} // interface AppletContext
diff --git a/libjava/java/applet/AppletStub.java b/libjava/java/applet/AppletStub.java
deleted file mode 100644
index 879a01638a5..00000000000
--- a/libjava/java/applet/AppletStub.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/* AppletStub.java -- low level interface to the browser
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.applet;
-
-import java.net.URL;
-
-/**
- * This interface is the low level interface between the applet and the
- * browser.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see Applet#setStub(AppletStub)
- * @since 1.0
- * @status updated to 1.4
- */
-public interface AppletStub
-{
- /**
- * Tests whether or not this applet is currently active. An applet is active
- * just before the browser invokes start(), and becomes inactive just
- * before the browser invokes stop().
- *
- * @return true
if this applet is active
- */
- boolean isActive();
-
- /**
- * Returns the basename URL of the document this applet is embedded in. This
- * is everything up to the final '/'.
- *
- * @return the URL of the document this applet is embedded in
- * @see #getCodeBase()
- */
- URL getDocumentBase();
-
- /**
- * Returns the URL of the code base for this applet.
- *
- * @return the URL of the code base for this applet
- */
- URL getCodeBase();
-
- /**
- * Returns the value of the specified parameter that was specified in
- * the <APPLET>
tag for this applet.
- *
- * @param name the parameter name
- * @return the parameter value, or null if the parameter does not exist
- * @throws NullPointerException if name is null
- */
- String getParameter(String name);
-
- /**
- * Returns the applet context for this applet.
- *
- * @return the applet context for this applet
- */
- AppletContext getAppletContext();
-
- /**
- * Requests that the applet window for this applet be resized.
- *
- * @param width the new width in pixels
- * @param height the new height in pixels
- */
- void appletResize(int width, int height);
-} // interface AppletStub
diff --git a/libjava/java/applet/AudioClip.java b/libjava/java/applet/AudioClip.java
deleted file mode 100644
index eeafa8aa7a8..00000000000
--- a/libjava/java/applet/AudioClip.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* AudioClip.java -- play an audio clip in an applet
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.applet;
-
-
-/**
- * This interface provides a simple mechanism for playing audio clips.
- * If multiple clips are played at once, the browser combines them into a
- * composite clip.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.0
- * @status updated to 1.4
- */
-public interface AudioClip
-{
- /**
- * Plays the audio clip starting from the beginning.
- */
- void play();
-
- /**
- * Stops playing this audio clip. There is no mechanism for restarting
- * at the point where the clip is stopped.
- */
- void stop();
-
- /**
- * Plays this audio clip in a continuous loop.
- */
- void loop();
-} // interface AudioClip
diff --git a/libjava/java/awt/AWTError.java b/libjava/java/awt/AWTError.java
deleted file mode 100644
index 80356eee440..00000000000
--- a/libjava/java/awt/AWTError.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* AWTError.java -- A serious AWT error occurred.
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This error is thrown when a critical Abstract Window Toolkit (AWT) error
- * occurs.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @status updated to 1.4
- */
-public class AWTError extends Error
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -1819846354050686206L;
-
- /**
- * Create a new instance with the specified descriptive error message.
- *
- * @param message the descriptive error message
- */
- public AWTError(String message)
- {
- super(message);
- }
-} // class AWTError
diff --git a/libjava/java/awt/AWTEvent.java b/libjava/java/awt/AWTEvent.java
deleted file mode 100644
index b90a9090988..00000000000
--- a/libjava/java/awt/AWTEvent.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/* AWTEvent.java -- the root event in AWT
- Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.util.EventObject;
-
-/**
- * AWTEvent is the root event class for all AWT events in the JDK 1.1 event
- * model. It supersedes the Event class from JDK 1.0. Subclasses outside of
- * the java.awt package should have IDs greater than RESERVED_ID_MAX.
- *
- * enableEvents
to select event types not selected by registered
- * listeners. Event masks are appropriately set when registering on
- * components.
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class AWTEvent extends EventObject
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -1825314779160409405L;
-
- /**
- * The ID of the event.
- *
- * @see #getID()
- * @see #AWTEvent(Object, int)
- * @serial the identifier number of this event
- */
- protected int id;
-
- /**
- * Indicates if the event has been consumed. False mean it is passed to
- * the peer, true means it has already been processed. Semantic events
- * generated by low-level events always have the value true.
- *
- * @see #consume()
- * @see #isConsumed()
- * @serial whether the event has been consumed
- */
- protected boolean consumed;
-
- /**
- * Who knows? It's in the serial version.
- *
- * @serial No idea what this is for.
- */
- byte[] bdata;
-
- /** Mask for selecting component events. */
- public static final long COMPONENT_EVENT_MASK = 0x00001;
-
- /** Mask for selecting container events. */
- public static final long CONTAINER_EVENT_MASK = 0x00002;
-
- /** Mask for selecting component focus events. */
- public static final long FOCUS_EVENT_MASK = 0x00004;
-
- /** Mask for selecting keyboard events. */
- public static final long KEY_EVENT_MASK = 0x00008;
-
- /** Mask for mouse button events. */
- public static final long MOUSE_EVENT_MASK = 0x00010;
-
- /** Mask for mouse motion events. */
- public static final long MOUSE_MOTION_EVENT_MASK = 0x00020;
-
- /** Mask for window events. */
- public static final long WINDOW_EVENT_MASK = 0x00040;
-
- /** Mask for action events. */
- public static final long ACTION_EVENT_MASK = 0x00080;
-
- /** Mask for adjustment events. */
- public static final long ADJUSTMENT_EVENT_MASK = 0x00100;
-
- /** Mask for item events. */
- public static final long ITEM_EVENT_MASK = 0x00200;
-
- /** Mask for text events. */
- public static final long TEXT_EVENT_MASK = 0x00400;
-
- /**
- * Mask for input method events.
- * @since 1.3
- */
- public static final long INPUT_METHOD_EVENT_MASK = 0x00800;
-
- /**
- * Mask if input methods are enabled. Package visible only.
- */
- static final long INPUT_ENABLED_EVENT_MASK = 0x01000;
-
- /**
- * Mask for paint events.
- * @since 1.3
- */
- public static final long PAINT_EVENT_MASK = 0x02000;
-
- /**
- * Mask for invocation events.
- * @since 1.3
- */
- public static final long INVOCATION_EVENT_MASK = 0x04000;
-
- /**
- * Mask for hierarchy events.
- * @since 1.3
- */
- public static final long HIERARCHY_EVENT_MASK = 0x08000;
-
- /**
- * Mask for hierarchy bounds events.
- * @since 1.3
- */
- public static final long HIERARCHY_BOUNDS_EVENT_MASK = 0x10000;
-
- /**
- * Mask for mouse wheel events.
- * @since 1.4
- */
- public static final long MOUSE_WHEEL_EVENT_MASK = 0x20000;
-
- /**
- * Mask for window state events.
- * @since 1.4
- */
- public static final long WINDOW_STATE_EVENT_MASK = 0x40000;
-
- /**
- * Mask for window focus events.
- * @since 1.4
- */
- public static final long WINDOW_FOCUS_EVENT_MASK = 0x80000;
-
- /**
- * This is the highest number for event ids that are reserved for use by
- * the AWT system itself. Subclasses outside of java.awt should use higher
- * ids.
- */
- public static final int RESERVED_ID_MAX = 1999;
-
-
- /**
- * Initializes a new AWTEvent from the old Java 1.0 event object.
- *
- * @param event the old-style event
- * @throws NullPointerException if event is null
- */
- public AWTEvent(Event event)
- {
- this(event.target, event.id);
- consumed = event.consumed;
- }
-
- /**
- * Create an event on the specified source object and id.
- *
- * @param source the object that caused the event
- * @param id the event id
- * @throws IllegalArgumentException if source is null
- */
- public AWTEvent(Object source, int id)
- {
- super(source);
- this.id = id;
- }
-
- /**
- * Retarget the event, such as converting a heavyweight component to a
- * lightweight child of the original. This is not for general use, but
- * is for event targeting systems like KeyboardFocusManager.
- *
- * @param source the new source
- */
- public void setSource(Object source)
- {
- this.source = source;
- }
-
- /**
- * Returns the event type id.
- *
- * @return the id number of this event
- */
- public int getID()
- {
- return id;
- }
-
- /**
- * Create a string that represents this event in the format
- * classname[eventstring] on sourcecomponentname
.
- *
- * @return a string representing this event
- */
- public String toString ()
- {
- String string = null;
-
- if (source instanceof Component)
- string = getClass ().getName () + "[" + paramString () + "] on "
- + ((Component) source).getName ();
- else if (source instanceof MenuComponent)
- string = getClass ().getName () + "[" + paramString () + "] on "
- + ((MenuComponent) source).getName ();
- else
- string = getClass ().getName () + "[" + paramString () + "] on "
- + source;
-
- return string;
- }
-
- /**
- * Returns a string representation of the state of this event. It may be
- * empty, but must not be null; it is implementation defined.
- *
- * @return a string representation of this event
- */
- public String paramString()
- {
- return "";
- }
-
- /**
- * Consumes this event so that it will not be processed in the default
- * manner.
- */
- protected void consume()
- {
- consumed = true;
- }
-
- /**
- * Tests whether not not this event has been consumed. A consumed event
- * is not processed in the default manner.
- *
- * @return true if this event has been consumed
- */
- protected boolean isConsumed()
- {
- return consumed;
- }
-} // class AWTEvent
diff --git a/libjava/java/awt/AWTEventMulticaster.java b/libjava/java/awt/AWTEventMulticaster.java
deleted file mode 100644
index f7b9163cf67..00000000000
--- a/libjava/java/awt/AWTEventMulticaster.java
+++ /dev/null
@@ -1,1209 +0,0 @@
-/* AWTEventMulticaster.java -- allows multicast chaining of listeners
- Copyright (C) 1999, 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.AdjustmentEvent;
-import java.awt.event.AdjustmentListener;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.ContainerEvent;
-import java.awt.event.ContainerListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.HierarchyBoundsListener;
-import java.awt.event.HierarchyEvent;
-import java.awt.event.HierarchyListener;
-import java.awt.event.InputMethodEvent;
-import java.awt.event.InputMethodListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.MouseWheelListener;
-import java.awt.event.TextEvent;
-import java.awt.event.TextListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowFocusListener;
-import java.awt.event.WindowListener;
-import java.awt.event.WindowStateListener;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.EventListener;
-
-/**
- * This class is used to implement a chain of event handlers. Dispatching
- * using this class is thread safe. Here is a quick example of how to
- * add and delete listeners using this class. For this example, we will
- * assume are firing AdjustmentEvent
's. However, this
- * same approach is useful for all events in the java.awt.event
- * package, and more if this class is subclassed.
- *
- *
- * AdjustmentListener al;
- * public void addAdjustmentListener(AdjustmentListener listener)
- * {
- * al = AWTEventMulticaster.add(al, listener);
- * }
- * public void removeAdjustmentListener(AdjustmentListener listener)
- * {
- * al = AWTEventMulticaster.remove(al, listener);
- * }
- *
- *
- * al
,
- * assuming it is not null
, and all listeners in the chain will
- * be fired.
- *
- * add
is called it is passed
- * null
and listener
as its arguments. This
- * starts building the chain. This class returns listener
- * which becomes the new al
. The next time, add
- * is called with al
and listener
and the
- * new listener is then chained to the old.
- *
- * @author Bryce McKinlay
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public class AWTEventMulticaster
- implements ComponentListener, ContainerListener, FocusListener, KeyListener,
- MouseListener, MouseMotionListener, WindowListener,
- WindowFocusListener, WindowStateListener, ActionListener,
- ItemListener, AdjustmentListener, TextListener,
- InputMethodListener, HierarchyListener, HierarchyBoundsListener,
- MouseWheelListener
-{
- /**
- * A variable in the event chain.
- */
- protected final EventListener a;
-
- /**
- * A variable in the event chain.
- */
- protected final EventListener b;
-
- /**
- * Initializes a new instance of AWTEventMulticaster
with
- * the specified event listener parameters. The parameters should not be
- * null, although it is not required to enforce this with a
- * NullPointerException.
- *
- * @param a the "a" listener object
- * @param b the "b" listener object
- */
- protected AWTEventMulticaster(EventListener a, EventListener b)
- {
- this.a = a;
- this.b = b;
- }
-
- /**
- * Removes one instance of the specified listener from this multicaster
- * chain. This descends recursively if either child is a multicaster, and
- * returns a multicaster chain with the old listener removed.
- *
- * @param oldl the object to remove from this multicaster
- * @return the resulting multicaster with the specified listener removed
- */
- protected EventListener remove(EventListener oldl)
- {
- // If oldl is an immediate child, return the other child.
- if (a == oldl)
- return b;
- if (b == oldl)
- return a;
- // If a and/or b are Multicaster's, search them recursively.
- if (a instanceof AWTEventMulticaster)
- {
- EventListener newa = ((AWTEventMulticaster) a).remove(oldl);
- if (newa != a)
- return new AWTEventMulticaster(newa, b);
- }
- if (b instanceof AWTEventMulticaster)
- {
- EventListener newb = ((AWTEventMulticaster) b).remove(oldl);
- if (newb != b)
- return new AWTEventMulticaster(a, newb);
- }
- // oldl was not found.
- return this;
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void componentResized(ComponentEvent e)
- {
- ((ComponentListener) a).componentResized(e);
- ((ComponentListener) b).componentResized(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void componentMoved(ComponentEvent e)
- {
- ((ComponentListener) a).componentMoved(e);
- ((ComponentListener) b).componentMoved(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void componentShown(ComponentEvent e)
- {
- ((ComponentListener) a).componentShown(e);
- ((ComponentListener) b).componentShown(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void componentHidden(ComponentEvent e)
- {
- ((ComponentListener) a).componentHidden(e);
- ((ComponentListener) b).componentHidden(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void componentAdded(ContainerEvent e)
- {
- ((ContainerListener) a).componentAdded(e);
- ((ContainerListener) b).componentAdded(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void componentRemoved(ContainerEvent e)
- {
- ((ContainerListener) a).componentRemoved(e);
- ((ContainerListener) b).componentRemoved(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void focusGained(FocusEvent e)
- {
- ((FocusListener) a).focusGained(e);
- ((FocusListener) b).focusGained(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void focusLost(FocusEvent e)
- {
- ((FocusListener) a).focusLost(e);
- ((FocusListener) b).focusLost(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void keyTyped(KeyEvent e)
- {
- ((KeyListener) a).keyTyped(e);
- ((KeyListener) b).keyTyped(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void keyPressed(KeyEvent e)
- {
- ((KeyListener) a).keyPressed(e);
- ((KeyListener) b).keyPressed(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void keyReleased(KeyEvent e)
- {
- ((KeyListener) a).keyReleased(e);
- ((KeyListener) b).keyReleased(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void mouseClicked(MouseEvent e)
- {
- ((MouseListener) a).mouseClicked(e);
- ((MouseListener) b).mouseClicked(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void mousePressed(MouseEvent e)
- {
- ((MouseListener) a).mousePressed(e);
- ((MouseListener) b).mousePressed(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void mouseReleased(MouseEvent e)
- {
- ((MouseListener) a).mouseReleased(e);
- ((MouseListener) b).mouseReleased(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void mouseEntered(MouseEvent e)
- {
- ((MouseListener) a).mouseEntered(e);
- ((MouseListener) b).mouseEntered(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void mouseExited(MouseEvent e)
- {
- ((MouseListener) a).mouseExited(e);
- ((MouseListener) b).mouseExited(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void mouseDragged(MouseEvent e)
- {
- ((MouseMotionListener) a).mouseDragged(e);
- ((MouseMotionListener) b).mouseDragged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void mouseMoved(MouseEvent e)
- {
- ((MouseMotionListener) a).mouseMoved(e);
- ((MouseMotionListener) b).mouseMoved(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void windowOpened(WindowEvent e)
- {
- ((WindowListener) a).windowOpened(e);
- ((WindowListener) b).windowOpened(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void windowClosing(WindowEvent e)
- {
- ((WindowListener) a).windowClosing(e);
- ((WindowListener) b).windowClosing(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void windowClosed(WindowEvent e)
- {
- ((WindowListener) a).windowClosed(e);
- ((WindowListener) b).windowClosed(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void windowIconified(WindowEvent e)
- {
- ((WindowListener) a).windowIconified(e);
- ((WindowListener) b).windowIconified(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void windowDeiconified(WindowEvent e)
- {
- ((WindowListener) a).windowDeiconified(e);
- ((WindowListener) b).windowDeiconified(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void windowActivated(WindowEvent e)
- {
- ((WindowListener) a).windowActivated(e);
- ((WindowListener) b).windowActivated(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void windowDeactivated(WindowEvent e)
- {
- ((WindowListener) a).windowDeactivated(e);
- ((WindowListener) b).windowDeactivated(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.4
- */
- public void windowStateChanged(WindowEvent e)
- {
- ((WindowStateListener) a).windowStateChanged(e);
- ((WindowStateListener) b).windowStateChanged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.4
- */
- public void windowGainedFocus(WindowEvent e)
- {
- ((WindowFocusListener) a).windowGainedFocus(e);
- ((WindowFocusListener) b).windowGainedFocus(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.4
- */
- public void windowLostFocus(WindowEvent e)
- {
- ((WindowFocusListener) a).windowLostFocus(e);
- ((WindowFocusListener) b).windowLostFocus(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void actionPerformed(ActionEvent e)
- {
- ((ActionListener) a).actionPerformed(e);
- ((ActionListener) b).actionPerformed(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void itemStateChanged(ItemEvent e)
- {
- ((ItemListener) a).itemStateChanged(e);
- ((ItemListener) b).itemStateChanged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void adjustmentValueChanged(AdjustmentEvent e)
- {
- ((AdjustmentListener) a).adjustmentValueChanged(e);
- ((AdjustmentListener) b).adjustmentValueChanged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- */
- public void textValueChanged(TextEvent e)
- {
- ((TextListener) a).textValueChanged(e);
- ((TextListener) b).textValueChanged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.2
- */
- public void inputMethodTextChanged(InputMethodEvent e)
- {
- ((InputMethodListener) a).inputMethodTextChanged(e);
- ((InputMethodListener) b).inputMethodTextChanged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.2
- */
- public void caretPositionChanged(InputMethodEvent e)
- {
- ((InputMethodListener) a).caretPositionChanged(e);
- ((InputMethodListener) b).caretPositionChanged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.3
- */
- public void hierarchyChanged(HierarchyEvent e)
- {
- ((HierarchyListener) a).hierarchyChanged(e);
- ((HierarchyListener) b).hierarchyChanged(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.3
- */
- public void ancestorMoved(HierarchyEvent e)
- {
- ((HierarchyBoundsListener) a).ancestorMoved(e);
- ((HierarchyBoundsListener) b).ancestorMoved(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.3
- */
- public void ancestorResized(HierarchyEvent e)
- {
- ((HierarchyBoundsListener) a).ancestorResized(e);
- ((HierarchyBoundsListener) b).ancestorResized(e);
- }
-
- /**
- * Handles this event by dispatching it to the "a" and "b" listener
- * instances.
- *
- * @param e the event to handle
- * @since 1.4
- */
- public void mouseWheelMoved(MouseWheelEvent e)
- {
- ((MouseWheelListener) a).mouseWheelMoved(e);
- ((MouseWheelListener) b).mouseWheelMoved(e);
- }
-
- /**
- * Chain ComponentListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static ComponentListener add(ComponentListener a, ComponentListener b)
- {
- return (ComponentListener) addInternal(a, b);
- }
-
- /**
- * Chain ContainerListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static ContainerListener add(ContainerListener a, ContainerListener b)
- {
- return (ContainerListener) addInternal(a, b);
- }
-
- /**
- * Chain FocusListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static FocusListener add(FocusListener a, FocusListener b)
- {
- return (FocusListener) addInternal(a, b);
- }
-
- /**
- * Chain KeyListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static KeyListener add(KeyListener a, KeyListener b)
- {
- return (KeyListener) addInternal(a, b);
- }
-
- /**
- * Chain MouseListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static MouseListener add(MouseListener a, MouseListener b)
- {
- return (MouseListener) addInternal(a, b);
- }
-
- /**
- * Chain MouseMotionListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static MouseMotionListener add(MouseMotionListener a,
- MouseMotionListener b)
- {
- return (MouseMotionListener) addInternal(a, b);
- }
-
- /**
- * Chain WindowListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static WindowListener add(WindowListener a, WindowListener b)
- {
- return (WindowListener) addInternal(a, b);
- }
-
- /**
- * Chain WindowStateListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- * @since 1.4
- */
- public static WindowStateListener add(WindowStateListener a,
- WindowStateListener b)
- {
- return (WindowStateListener) addInternal(a, b);
- }
-
- /**
- * Chain WindowFocusListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- * @since 1.4
- */
- public static WindowFocusListener add(WindowFocusListener a,
- WindowFocusListener b)
- {
- return (WindowFocusListener) addInternal(a, b);
- }
-
- /**
- * Chain ActionListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static ActionListener add(ActionListener a, ActionListener b)
- {
- return (ActionListener) addInternal(a, b);
- }
-
- /**
- * Chain ItemListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static ItemListener add(ItemListener a, ItemListener b)
- {
- return (ItemListener) addInternal(a, b);
- }
-
- /**
- * Chain AdjustmentListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static AdjustmentListener add(AdjustmentListener a,
- AdjustmentListener b)
- {
- return (AdjustmentListener) addInternal(a, b);
- }
-
- /**
- * Chain AdjustmentListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- public static TextListener add(TextListener a, TextListener b)
- {
- return (TextListener) addInternal(a, b);
- }
-
- /**
- * Chain InputMethodListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- * @since 1.2
- */
- public static InputMethodListener add(InputMethodListener a,
- InputMethodListener b)
- {
- return (InputMethodListener) addInternal(a, b);
- }
-
- /**
- * Chain HierarchyListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- * @since 1.3
- */
- public static HierarchyListener add(HierarchyListener a, HierarchyListener b)
- {
- return (HierarchyListener) addInternal(a, b);
- }
-
- /**
- * Chain HierarchyBoundsListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- * @since 1.3
- */
- public static HierarchyBoundsListener add(HierarchyBoundsListener a,
- HierarchyBoundsListener b)
- {
- return (HierarchyBoundsListener) addInternal(a, b);
- }
-
- /**
- * Chain MouseWheelListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- * @since 1.4
- */
- public static MouseWheelListener add(MouseWheelListener a,
- MouseWheelListener b)
- {
- return (MouseWheelListener) addInternal(a, b);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static ComponentListener remove(ComponentListener l,
- ComponentListener oldl)
- {
- return (ComponentListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static ContainerListener remove(ContainerListener l,
- ContainerListener oldl)
- {
- return (ContainerListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static FocusListener remove(FocusListener l, FocusListener oldl)
- {
- return (FocusListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static KeyListener remove(KeyListener l, KeyListener oldl)
- {
- return (KeyListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static MouseListener remove(MouseListener l, MouseListener oldl)
- {
- return (MouseListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static MouseMotionListener remove(MouseMotionListener l,
- MouseMotionListener oldl)
- {
- return (MouseMotionListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static WindowListener remove(WindowListener l, WindowListener oldl)
- {
- return (WindowListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- * @since 1.4
- */
- public static WindowStateListener remove(WindowStateListener l,
- WindowStateListener oldl)
- {
- return (WindowStateListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- * @since 1.4
- */
- public static WindowFocusListener remove(WindowFocusListener l,
- WindowFocusListener oldl)
- {
- return (WindowFocusListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static ActionListener remove(ActionListener l, ActionListener oldl)
- {
- return (ActionListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static ItemListener remove(ItemListener l, ItemListener oldl)
- {
- return (ItemListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static AdjustmentListener remove(AdjustmentListener l,
- AdjustmentListener oldl)
- {
- return (AdjustmentListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- public static TextListener remove(TextListener l, TextListener oldl)
- {
- return (TextListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- * @since 1.2
- */
- public static InputMethodListener remove(InputMethodListener l,
- InputMethodListener oldl)
- {
- return (InputMethodListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- * @since 1.3
- */
- public static HierarchyListener remove(HierarchyListener l,
- HierarchyListener oldl)
- {
- return (HierarchyListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- * @since 1.3
- */
- public static HierarchyBoundsListener remove(HierarchyBoundsListener l,
- HierarchyBoundsListener oldl)
- {
- return (HierarchyBoundsListener) removeInternal(l, oldl);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- * @since 1.4
- */
- public static MouseWheelListener remove(MouseWheelListener l,
- MouseWheelListener oldl)
- {
- return (MouseWheelListener) removeInternal(l, oldl);
- }
-
- /**
- * Chain EventListener
a and b.
- *
- * @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
- * @return latest entry in the chain
- */
- protected static EventListener addInternal(EventListener a, EventListener b)
- {
- if (a == null)
- return b;
- if (b == null)
- return a;
- return new AWTEventMulticaster(a, b);
- }
-
- /**
- * Removes the listener oldl
from the listener l
.
- *
- * @param l the listener chain to reduce
- * @param oldl the listener to remove
- * @return the resulting listener chain
- */
- protected static EventListener removeInternal(EventListener l,
- EventListener oldl)
- {
- if (l == oldl)
- return null;
- if (l instanceof AWTEventMulticaster)
- return ((AWTEventMulticaster) l).remove(oldl);
- return l;
- }
-
- /**
- * Saves all Serializable listeners to a serialization stream.
- *
- * @param s the stream to save to
- * @param k a prefix stream put before each serializable listener
- * @throws IOException if serialization fails
- */
- protected void saveInternal(ObjectOutputStream s, String k)
- throws IOException
- {
- // This is not documented by Sun, but I think it is correct.
- if (a instanceof AWTEventMulticaster)
- ((AWTEventMulticaster) a).saveInternal(s, k);
- else if (a instanceof Serializable)
- {
- s.writeObject(k);
- s.writeObject(a);
- }
- if (b instanceof AWTEventMulticaster)
- ((AWTEventMulticaster) b).saveInternal(s, k);
- else if (b instanceof Serializable)
- {
- s.writeObject(k);
- s.writeObject(b);
- }
- }
-
- /**
- * Saves a Serializable listener chain to a serialization stream.
- *
- * @param s the stream to save to
- * @param k a prefix stream put before each serializable listener
- * @param l the listener chain to save
- * @throws IOException if serialization fails
- */
- protected static void save(ObjectOutputStream s, String k, EventListener l)
- throws IOException
- {
- // This is not documented by Sun, but I think it is correct.
- if (l instanceof AWTEventMulticaster)
- ((AWTEventMulticaster) l).saveInternal(s, k);
- else if (l instanceof Serializable)
- {
- s.writeObject(k);
- s.writeObject(l);
- }
- }
-
- /**
- * Returns an array of all chained listeners of the specified type in the
- * given chain. A null listener returns an empty array, and a listener
- * which is not an AWTEventMulticaster returns an array of one element. If
- * no listeners in the chain are of the specified type, an empty array is
- * returned.
- *
- * @param l the listener chain to convert to an array
- * @param type the type of listeners to collect
- * @return an array of the listeners of that type in the chain
- * @throws ClassCastException if type is not assignable from EventListener
- * @throws NullPointerException if type is null
- * @throws IllegalArgumentException if type is Void.TYPE
- * @since 1.4
- */
- public static EventListener[] getListeners(EventListener l, Class type)
- {
- ArrayList list = new ArrayList();
- if (l instanceof AWTEventMulticaster)
- ((AWTEventMulticaster) l).getListeners(list, type);
- else if (type.isInstance(l))
- list.add(l);
- EventListener[] r = (EventListener[]) Array.newInstance(type, list.size());
- list.toArray(r);
- return r;
- }
-
- /**
- * Collects all instances of the given type in the chain into the list.
- *
- * @param l the list to collect into
- * @param type the type of listeners to collect
- * @throws NullPointerException if type is null
- * @see #getListeners(EventListener, Class)
- */
- private void getListeners(ArrayList l, Class type)
- {
- if (a instanceof AWTEventMulticaster)
- ((AWTEventMulticaster) a).getListeners(l, type);
- else if (type.isInstance(a))
- l.add(a);
- if (b instanceof AWTEventMulticaster)
- ((AWTEventMulticaster) b).getListeners(l, type);
- else if (type.isInstance(b))
- l.add(b);
- }
-} // class AWTEventMulticaster
diff --git a/libjava/java/awt/AWTException.java b/libjava/java/awt/AWTException.java
deleted file mode 100644
index 2df3dd80102..00000000000
--- a/libjava/java/awt/AWTException.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* AWTException.java -- Generic AWT exception
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This is a generic exception that indicates an exception occurred in the
- * Abstract Window Toolkit (AWT) system.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @status updated to 1.4
- */
-public class AWTException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -1900414231151323879L;
-
- /**
- * Create a new instance with the specified detailed error message.
- *
- * @param message the detailed error message
- */
- public AWTException(String message)
- {
- super(message);
- }
-} // class AWTException
diff --git a/libjava/java/awt/AWTKeyStroke.java b/libjava/java/awt/AWTKeyStroke.java
deleted file mode 100644
index 01d169366e0..00000000000
--- a/libjava/java/awt/AWTKeyStroke.java
+++ /dev/null
@@ -1,659 +0,0 @@
-/* AWTKeyStroke.java -- an immutable key stroke
- Copyright (C) 2002, 2004, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.KeyEvent;
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * This class mirrors KeyEvents, representing both low-level key presses and
- * key releases, and high level key typed inputs. However, this class forms
- * immutable strokes, and can be efficiently reused via the factory methods
- * for creating them.
- *
- * Character
instead of a
- * char
to avoid accidental ambiguity with
- * getAWTKeyStroke(int, int)
. The modifiers are the bitwise
- * or of the masks found in {@link InputEvent}; the new style (*_DOWN_MASK)
- * is preferred, but the old style will work.
- *
- * @param keyChar the typed character
- * @param modifiers the modifiers, or 0
- * @return the specified keystroke
- * @throws IllegalArgumentException if keyChar is null
- */
- public static AWTKeyStroke getAWTKeyStroke(Character keyChar, int modifiers)
- {
- if (keyChar == null)
- throw new IllegalArgumentException();
- return getAWTKeyStroke(keyChar.charValue(), KeyEvent.VK_UNDEFINED,
- extend(modifiers), false);
- }
-
- /**
- * Returns a keystroke representing a pressed or released key event, with
- * the given modifiers. The "virtual key" should be one of the VK_*
- * constants in {@link KeyEvent}. The modifiers are the bitwise or of the
- * masks found in {@link InputEvent}; the new style (*_DOWN_MASK) is
- * preferred, but the old style will work.
- *
- * @param keyCode the virtual key
- * @param modifiers the modifiers, or 0
- * @param release true if this is a key release instead of a key press
- * @return the specified keystroke
- */
- public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers,
- boolean release)
- {
- return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode,
- extend(modifiers), release);
- }
-
- /**
- * Returns a keystroke representing a pressed key event, with the given
- * modifiers. The "virtual key" should be one of the VK_* constants in
- * {@link KeyEvent}. The modifiers are the bitwise or of the masks found
- * in {@link InputEvent}; the new style (*_DOWN_MASK) is preferred, but the
- * old style will work.
- *
- * @param keyCode the virtual key
- * @param modifiers the modifiers, or 0
- * @return the specified keystroke
- */
- public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers)
- {
- return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode,
- extend(modifiers), false);
- }
-
- /**
- * Returns a keystroke representing what caused the key event.
- *
- * @param event the key event to convert
- * @return the specified keystroke, or null if the event is invalid
- * @throws NullPointerException if event is null
- */
- public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent event)
- {
- switch (event.id)
- {
- case KeyEvent.KEY_TYPED:
- return getAWTKeyStroke(event.getKeyChar(), KeyEvent.VK_UNDEFINED,
- extend(event.getModifiersEx()), false);
- case KeyEvent.KEY_PRESSED:
- return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(),
- extend(event.getModifiersEx()), false);
- case KeyEvent.KEY_RELEASED:
- return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(),
- extend(event.getModifiersEx()), true);
- default:
- return null;
- }
- }
-
- /**
- * Parses a string and returns the keystroke that it represents. The syntax
- * for keystrokes is listed below, with tokens separated by an arbitrary
- * number of spaces:
- *
- * keyStroke := <modifiers>* ( <typedID> | <codeID> )
- * modifiers := ( shift | control | ctrl | meta | alt
- * | button1 | button2 | button3 )
- * typedID := typed <single Unicode character>
- * codeID := ( pressed | released )? <name>
- * name := <the KeyEvent field name less the leading "VK_">
- *
- *
- *
- *
- * "INSERT" => getAWTKeyStroke(KeyEvent.VK_INSERT, 0);
- *
- * @param s the string to parse
- * @throws IllegalArgumentException if s is null or cannot be parsed
- * @return the specified keystroke
- */
- public static AWTKeyStroke getAWTKeyStroke(String s)
- {
- if (s == null)
- throw new IllegalArgumentException("null argument");
- StringTokenizer t = new StringTokenizer(s, " ");
- if (! t.hasMoreTokens())
- throw new IllegalArgumentException("no tokens '" + s + "'");
- int modifiers = 0;
- boolean released = false;
- String token = null;
- do
- {
- token = t.nextToken();
- if ("shift".equals(token))
- modifiers |= KeyEvent.SHIFT_DOWN_MASK;
- else if ("ctrl".equals(token) || "control".equals(token))
- modifiers |= KeyEvent.CTRL_DOWN_MASK;
- else if ("meta".equals(token))
- modifiers |= KeyEvent.META_DOWN_MASK;
- else if ("alt".equals(token))
- modifiers |= KeyEvent.ALT_DOWN_MASK;
- else if ("button1".equals(token))
- modifiers |= KeyEvent.BUTTON1_DOWN_MASK;
- else if ("button2".equals(token))
- modifiers |= KeyEvent.BUTTON2_DOWN_MASK;
- else if ("button3".equals(token))
- modifiers |= KeyEvent.BUTTON3_DOWN_MASK;
- else if ("typed".equals(token))
- {
- if (t.hasMoreTokens())
- {
- token = t.nextToken();
- if (! t.hasMoreTokens() && token.length() == 1)
- return getAWTKeyStroke(token.charAt(0),
- KeyEvent.VK_UNDEFINED, modifiers,
- false);
- }
- throw new IllegalArgumentException("Invalid 'typed' argument '"
- + s + "'");
- }
- else if ("pressed".equals(token))
- {
- if (t.hasMoreTokens())
- token = t.nextToken();
- break;
- }
- else if ("released".equals(token))
- {
- released = true;
- if (t.hasMoreTokens())
- token = t.nextToken();
- break;
- }
- else
- break;
- }
- while (t.hasMoreTokens());
- // Now token contains the VK name we must parse.
- Integer code = (Integer) vktable.get(token);
- if (code == null)
- throw new IllegalArgumentException("Unknown token '" + token
- + "' in '" + s + "'");
- if (t.hasMoreTokens())
- throw new IllegalArgumentException("Too many tokens: " + s);
- return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, code.intValue(),
- modifiers, released);
- }
-
- /**
- * Returns the character of this keystroke, if it was typed.
- *
- * @return the character value, or CHAR_UNDEFINED
- * @see #getAWTKeyStroke(char)
- */
- public final char getKeyChar()
- {
- return keyChar;
- }
-
- /**
- * Returns the virtual key code of this keystroke, if it was pressed or
- * released. This will be a VK_* constant from KeyEvent.
- *
- * @return the virtual key code value, or VK_UNDEFINED
- * @see #getAWTKeyStroke(int, int)
- */
- public final int getKeyCode()
- {
- return keyCode;
- }
-
- /**
- * Returns the modifiers for this keystroke. This will be a bitwise or of
- * constants from InputEvent; it includes the old style masks for shift,
- * control, alt, meta, and alt-graph (but not button1); as well as the new
- * style of extended modifiers for all modifiers.
- *
- * @return the modifiers
- * @see #getAWTKeyStroke(Character, int)
- * @see #getAWTKeyStroke(int, int)
- */
- public final int getModifiers()
- {
- return modifiers;
- }
-
- /**
- * Tests if this keystroke is a key release.
- *
- * @return true if this is a key release
- * @see #getAWTKeyStroke(int, int, boolean)
- */
- public final boolean isOnKeyRelease()
- {
- return onKeyRelease;
- }
-
- /**
- * Returns the AWT event type of this keystroke. This is one of
- * {@link KeyEvent#KEY_TYPED}, {@link KeyEvent#KEY_PRESSED}, or
- * {@link KeyEvent#KEY_RELEASED}.
- *
- * @return the key event type
- */
- public final int getKeyEventType()
- {
- return keyCode == KeyEvent.VK_UNDEFINED ? KeyEvent.KEY_TYPED
- : onKeyRelease ? KeyEvent.KEY_RELEASED : KeyEvent.KEY_PRESSED;
- }
-
- /**
- * Returns a hashcode for this key event. It is not documented, but appears
- * to be:
- * "control DELETE" =>
- * getAWTKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
- * "alt shift X" => getAWTKeyStroke(KeyEvent.VK_X,
- * InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
- * "alt shift released X" => getAWTKeyStroke(KeyEvent.VK_X,
- * InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
- * "typed a" => getAWTKeyStroke('a');
- * (getKeyChar() + 1) * (getKeyCode() + 1)
- * * (getModifiers() + 1) * 2 + (isOnKeyRelease() ? 1 : 2)
.
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- return (keyChar + 1) * (keyCode + 1) * (modifiers + 1) * 2
- + (onKeyRelease ? 1 : 2);
- }
-
- /**
- * Tests two keystrokes for equality.
- *
- * @param o the object to test
- * @return true if it is equal
- */
- public final boolean equals(Object o)
- {
- if (! (o instanceof AWTKeyStroke))
- return false;
- AWTKeyStroke s = (AWTKeyStroke) o;
- return this == o || (keyChar == s.keyChar && keyCode == s.keyCode
- && modifiers == s.modifiers
- && onKeyRelease == s.onKeyRelease);
- }
-
- /**
- * Returns a string representation of this keystroke. For typed keystrokes,
- * this is "keyChar " + KeyEvent.getKeyModifiersText(getModifiers())
- + getKeyChar()
; for pressed and released keystrokes, this is
- * "keyCode " + KeyEvent.getKeyModifiersText(getModifiers())
- * + KeyEvent.getKeyText(getKeyCode())
- * + (isOnKeyRelease() ? "-R" : "-P")
.
- *
- * @return a string representation
- */
- public String toString()
- {
- if (keyCode == KeyEvent.VK_UNDEFINED)
- return "keyChar " + KeyEvent.getKeyModifiersText(modifiers) + keyChar;
- return "keyCode " + KeyEvent.getKeyModifiersText(modifiers)
- + KeyEvent.getKeyText(keyCode) + (onKeyRelease ? "-R" : "-P");
- }
-
- /**
- * Returns a cached version of the deserialized keystroke, if available.
- *
- * @return a cached replacement
- * @throws ObjectStreamException if something goes wrong
- */
- protected Object readResolve() throws ObjectStreamException
- {
- AWTKeyStroke s = (AWTKeyStroke) cache.get(this);
- if (s != null)
- return s;
- cache.put(this, this);
- return this;
- }
-
- /**
- * Gets the appropriate keystroke, creating one if necessary.
- *
- * @param keyChar the keyChar
- * @param keyCode the keyCode
- * @param modifiers the modifiers
- * @param release true for key release
- * @return the specified keystroke
- */
- private static AWTKeyStroke getAWTKeyStroke(char keyChar, int keyCode,
- int modifiers, boolean release)
- {
- // Check level 0 cache.
- AWTKeyStroke stroke = recent; // Avoid thread races.
- if (stroke != null && stroke.keyChar == keyChar
- && stroke.keyCode == keyCode && stroke.modifiers == modifiers
- && stroke.onKeyRelease == release)
- return stroke;
- // Create a new object, on the assumption that if it has a match in the
- // cache, the VM can easily garbage collect it as it is temporary.
- Constructor c = ctor; // Avoid thread races.
- if (c == null)
- stroke = new AWTKeyStroke(keyChar, keyCode, modifiers, release);
- else
- try
- {
- stroke = (AWTKeyStroke) c.newInstance(null);
- stroke.keyChar = keyChar;
- stroke.keyCode = keyCode;
- stroke.modifiers = modifiers;
- stroke.onKeyRelease = release;
- }
- catch (Exception e)
- {
- throw (Error) new InternalError().initCause(e);
- }
- // Check level 1 cache.
- AWTKeyStroke cached = (AWTKeyStroke) cache.get(stroke);
- if (cached == null)
- cache.put(stroke, stroke);
- else
- stroke = cached;
- return recent = stroke;
- }
-
- /**
- * Converts the modifiers to the appropriate format.
- *
- * @param mod the modifiers to convert
- * @return the adjusted modifiers
- */
- private static int extend(int mod)
- {
- if ((mod & (KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK)) != 0)
- mod |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
- if ((mod & (KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK)) != 0)
- mod |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;
- if ((mod & (KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK)) != 0)
- mod |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
- if ((mod & (KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK)) != 0)
- mod |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
- if ((mod & (KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK)) != 0)
- mod |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
- if ((mod & KeyEvent.BUTTON1_MASK) != 0)
- mod |= KeyEvent.BUTTON1_DOWN_MASK;
- return mod & MODIFIERS_MASK;
- }
-} // class AWTKeyStroke
diff --git a/libjava/java/awt/AWTPermission.java b/libjava/java/awt/AWTPermission.java
deleted file mode 100644
index 3e50c059f88..00000000000
--- a/libjava/java/awt/AWTPermission.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/* AWTPermission.java -- AWT related permissions
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.security.BasicPermission;
-
-/**
- * This class implements permissions for AWT. This is a named
- * permission. No actions are defined.
- *
- *
- *
- *
- *
- * @author Tom Tromey (tromey@redhat.com)
- * @since 1.2
- * @status updated to 1.4
- */
-public final class AWTPermission extends BasicPermission
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 8890392402588814465L;
-
- /**
- * Construct a AWTPermission with the given name.
- *
- * @param name the permission name
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException if name is invalid
- */
- public AWTPermission(String name)
- {
- super(name);
- }
-
- /**
- * Create a new permission with the specified name. The actions argument
- * is ignored, as AWT permissions have no actions.
- *
- * @param name the permission name
- * @param actions ignored
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException if name is invalid
- */
- public AWTPermission(String name, String actions)
- {
- super(name);
- }
-} // class AWTPermission
diff --git a/libjava/java/awt/ActiveEvent.java b/libjava/java/awt/ActiveEvent.java
deleted file mode 100644
index e42959fe3d6..00000000000
--- a/libjava/java/awt/ActiveEvent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ActiveEvent.java -- a self-dispatching event
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * An interface for events which can dispatch themselves in another thread.
- * This has two uses: first, if your code is in a critical section, calling a
- * synchronized method might deadlock. But by using an ActiveEvent to call
- * the second section, it will not obtain the lock until you have left the
- * critical section, avoiding deadlock. The second use is for calling
- * untrusted code. For example, system code should use an ActiveEvent to
- * invoke user code securely.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @since 1.2
- * @status updated to 1.4
- */
-public interface ActiveEvent
-{
- /**
- * Dispatch the event, according to what the event needs done. Invoked
- * automatically if this is placed on the Permission Name Permission Allows Risks
- *
- *
- *
- * accessClipboard
posting and reading the AWT clipboard
- * the clipboard may contain sensitive data
- *
- *
- * accessEventQueue
access to the AWT event queue
- * malicious code could remove real events and replace them with bogus
- * ones, including simulating the user granting permission
- *
- *
- * listenToAllAWTEvents
listen to system-wide AWT events
- * malicious code can read passwords entered in an AWT event, and in
- * combination with accessEventQueue, could fake system events
- *
- *
- * showWindowWithoutWarningBanner
display a window without a banner notification of insecurity
- * malicious code could install a Trojan horse applet that looks like
- * a normal window, and thus steal data like passwords
- *
- *
- * readDisplayPixels
read back pixels from the display screen
- * malicious code could snoop on the user's actions
- *
- *
- * createRobot
create an instance of java.awt.Robot
- * these objects can generate events as though they were the user; so
- * malicious code could control the system
- *
- *
- * fullScreenExclusive
enter full-screen exclusive mode
- * malicious code could masquerade as a trusted program EventDispatchQueue
.
- */
- void dispatch();
-} // interface ActiveEvent
diff --git a/libjava/java/awt/Adjustable.java b/libjava/java/awt/Adjustable.java
deleted file mode 100644
index 8f633e91a62..00000000000
--- a/libjava/java/awt/Adjustable.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Adjustable.java -- Objects with a numeric adjustment scale
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.AdjustmentListener;
-
-/**
- * This interface is for objects that take a numeric value that can be
- * adjusted within a bounded range. For example, a scroll bar.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.0
- * @status updated to 1.4
- */
-public interface Adjustable
-{
- /** Constant for an adjustable object with horizontal orientation. */
- int HORIZONTAL = 0;
-
- /** Constant for an adjustable object with vertical orientation. */
- int VERTICAL = 1;
-
- /** Constant for an adjustable object with no orientation. */
- int NO_ORIENTATION = 2;
-
- /**
- * Returns a constant representing the orientation of the object.
- *
- * @return the orientation of this object
- * @see #HORIZONTAL
- * @see #VERTICAL
- * @see #NO_ORIENTATION
- */
- int getOrientation();
-
- /**
- * Sets the minimum value this object can have.
- *
- * @param minimum the new minimum value
- */
- void setMinimum(int minimum);
-
- /**
- * Returns the minimum value this object can have.
- *
- * @return the minimum value
- */
- int getMinimum();
-
- /**
- * Sets the maximum value this object can have.
- *
- * @param maximum the new maximum value
- */
- void setMaximum(int maximum);
-
- /**
- * Returns the maximum value this object can have.
- *
- * @return the maximum value
- */
- int getMaximum();
-
- /**
- * Sets the increment value for incrementing the value by units.
- *
- * @param increment the unit increment value
- */
- void setUnitIncrement(int increment);
-
- /**
- * Returns the increment value for incrementing the value by units.
- *
- * @return the unit increment value
- */
- int getUnitIncrement();
-
- /**
- * Sets the increment value for incrementing the value by blocks.
- *
- * @param increment the block increment value
- */
- void setBlockIncrement(int increment);
-
- /**
- * Returns the increment value for incrementing the value by blocks.
- *
- * @return the block increment value
- */
- int getBlockIncrement();
-
- /**
- * Sets the length of the indicator for this object to the specified value.
- *
- * @param length the indicator length
- */
- void setVisibleAmount(int length);
-
- /**
- * Returns the length of the indicator for this object.
- *
- * @return the indicator length
- */
- int getVisibleAmount();
-
- /**
- * Sets the current value of the object.
- *
- * @param value the new value
- */
- void setValue(int value);
-
- /**
- * Returns the current value of the object.
- *
- * @return the current value
- */
- int getValue();
-
- /**
- * Adds a listener that will receive adjustment events for this object.
- *
- * @param listener the adjustment listener to add
- * @see java.awt.event.AdjustmentEvent
- */
- void addAdjustmentListener(AdjustmentListener listener);
-
- /**
- * Removes an adjustment listener from this object.
- *
- * @param listener the adjustment listener to remove
- * @see java.awt.event.AdjustmentEvent
- */
- void removeAdjustmentListener(AdjustmentListener listener);
-} // interface Adjustable
diff --git a/libjava/java/awt/AlphaComposite.java b/libjava/java/awt/AlphaComposite.java
deleted file mode 100644
index 435cfd054c3..00000000000
--- a/libjava/java/awt/AlphaComposite.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/* AlphaComposite.java -- provides a context for performing alpha compositing
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.ColorModel;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Composite
- * @see CompositeContext
- * @since 1.3
- * @status updated to 1.4 except for createContext, needs documentation
- */
-public final class AlphaComposite implements Composite
-{
- /** Map Long to AlphaComposites. See getInstance for details. */
- private static final LinkedHashMap cache = new LinkedHashMap(11, 0.75f, true)
- {
- /** The largest the alpha composite cache can grow. */
- private static final int MAX_CACHE_SIZE = 2048;
-
- /** Prune stale entries. */
- protected boolean removeEldestEntry(Map.Entry eldest)
- { // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround.
- return size() > MAX_CACHE_SIZE;
- }
- };
-
- public static final int CLEAR = 1;
- public static final int SRC = 2;
- public static final int DST = 9;
- public static final int SRC_OVER = 3;
- public static final int DST_OVER = 4;
- public static final int SRC_IN = 5;
- public static final int DST_IN = 6;
- public static final int SRC_OUT = 7;
- public static final int DST_OUT = 8;
- public static final int SRC_ATOP = 10;
- public static final int DST_ATOP = 11;
- public static final int XOR = 12;
- public static final AlphaComposite Clear = getInstance(CLEAR);
- public static final AlphaComposite Src = getInstance(SRC);
- public static final AlphaComposite Dst = getInstance(DST);
- public static final AlphaComposite SrcOver = getInstance(SRC_OVER);
- public static final AlphaComposite DstOver = getInstance(DST_OVER);
- public static final AlphaComposite SrcIn = getInstance(SRC_IN);
- public static final AlphaComposite DstIn = getInstance(DST_IN);
- public static final AlphaComposite SrcOut = getInstance(SRC_OUT);
- public static final AlphaComposite DstOut = getInstance(DST_OUT);
- public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP);
- public static final AlphaComposite DstAtop = getInstance(DST_ATOP);
- public static final AlphaComposite Xor = getInstance(XOR);
-
- private final int rule;
- private final float alpha;
- private AlphaComposite(int rule, float alpha)
- {
- this.rule = rule;
- this.alpha = alpha;
- }
-
- /**
- * Creates an AlphaComposite object with the specified rule.
- *
- * @param rule The compositing rule.
- *
- * @exception IllegalArgumentException If rule is not one of the following:
- * CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT,
- * SRC_ATOP, DST_ATOP, or XOR.
- */
- public static AlphaComposite getInstance(int rule)
- {
- return getInstance(rule, 1);
- }
-
- /**
- * Creates an AlphaComposite object with the specified rule and the constant
- * alpha to multiply with the alpha of the source. The source is multiplied
- * with the specified alpha before being composited with the destination.
- *
- * @param rule The compositing rule.
- *
- * @exception IllegalArgumentException If rule is not one of the following:
- * CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT,
- * SRC_ATOP, DST_ATOP, or XOR.
- */
- public static AlphaComposite getInstance(int rule, float alpha)
- {
- if (rule < CLEAR || rule > XOR || ! (alpha >= 0 && alpha <= 1))
- throw new IllegalArgumentException();
- // This long is guaranteed unique for all valid alpha composites.
- Long l = new Long(rule + Double.doubleToLongBits(alpha));
- AlphaComposite a = (AlphaComposite) cache.get(l);
- if (a == null)
- {
- a = new AlphaComposite(rule, alpha);
- cache.put(l, a);
- }
- return a;
- }
- public CompositeContext createContext(ColorModel srcColorModel,
- ColorModel dstColorModel,
- RenderingHints hints)
- {
- // XXX Implement. Sun uses undocumented implementation class
- // sun.java2d.SunCompositeContext.
- throw new Error("not implemented");
- }
- public float getAlpha()
- {
- return alpha;
- }
- public int getRule()
- {
- return rule;
- }
- public int hashCode()
- {
- return 31 * Float.floatToIntBits(alpha) + rule;
- }
- public boolean equals(Object o)
- {
- if (! (o instanceof AlphaComposite))
- return false;
- AlphaComposite a = (AlphaComposite) o;
- return rule == a.rule && alpha == a.alpha;
- }
-} // class AlphaComposite
diff --git a/libjava/java/awt/AttributeValue.java b/libjava/java/awt/AttributeValue.java
deleted file mode 100644
index 080e92e221f..00000000000
--- a/libjava/java/awt/AttributeValue.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* AttributeValue.java -- parent of type-safe enums of attributes
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This class is undocumented by Sun, but it is the parent of several other
- * classes, all of which are type-safe enumerations. This takes care of
- * equals
, toString
, and hashCode
, so
- * that you don't have to (although hashCode is commonly overridden).
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
-class AttributeValue
-{
- /** The value of the enumeration. Package visible for speed. */
- final int value;
-
- /** The list of enumeration names for the given subclass. */
- private final String[] names;
-
- /**
- * Construct a type-safe enumeration element. For example,
- *
- * class Foo extends AttributeValue
- * {
- * private static final String[] names = { "one", "two" }
- * public static final Foo ONE = new Foo(0);
- * public static final Foo TWO = new Foo(1);
- * private Foo(int value) { super(value, names); }
- * }
- *
- *
- * @param value the position of this enumeration element, consecutive from 0
- * @param names the constant list of enumeration names for the subclass
- */
- AttributeValue(int value, String[] names)
- {
- this.value = value;
- this.names = names;
- }
-
- /**
- * Returns the hashcode of this element. This is the index of the element
- * in the enumeration. Note that equals defaults to the == relation.
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- return value;
- }
-
- /**
- * Returns the name of this enumeration element.
- *
- * @return the element name
- */
- public String toString()
- {
- return names[value];
- }
-} // class AttributeValue
diff --git a/libjava/java/awt/BasicStroke.java b/libjava/java/awt/BasicStroke.java
deleted file mode 100644
index bb008e4c791..00000000000
--- a/libjava/java/awt/BasicStroke.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/* BasicStroke.java --
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.util.Arrays;
-
-/**
- * STUB CLASS ONLY
- */
-public class BasicStroke implements Stroke
-{
- public static final int JOIN_MITER = 0;
- public static final int JOIN_ROUND = 1;
- public static final int JOIN_BEVEL = 2;
-
- public static final int CAP_BUTT = 0;
- public static final int CAP_ROUND = 1;
- public static final int CAP_SQUARE = 2;
-
- private final float width;
- private final int cap;
- private final int join;
- private final float limit;
- private final float[] dash;
- private final float phase;
-
- /**
- * Creates a basic stroke.
- *
- * @param width May not be negative .
- * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE.
- * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER.
- * @param miterlimit the limit to trim the miter join. The miterlimit must be
- * greater than or equal to 1.0f.
- * @param dash The array representing the dashing pattern. There must be at
- * least one non-zero entry.
- * @param dashPhase is negative and dash is not null.
- *
- * @exception IllegalArgumentException If one input parameter doesn't meet
- * its needs.
- */
- public BasicStroke(float width, int cap, int join, float miterlimit,
- float[] dash, float dashPhase)
- {
- if (width < 0.0f )
- throw new IllegalArgumentException("width " + width + " < 0");
- else if (cap < CAP_BUTT || cap > CAP_SQUARE)
- throw new IllegalArgumentException("cap " + cap + " out of range ["
- + CAP_BUTT + ".." + CAP_SQUARE + "]");
- else if (miterlimit < 1.0f && join == JOIN_MITER)
- throw new IllegalArgumentException("miterlimit " + miterlimit
- + " < 1.0f while join == JOIN_MITER");
- else if (join < JOIN_MITER || join > JOIN_BEVEL)
- throw new IllegalArgumentException("join " + join + " out of range ["
- + JOIN_MITER + ".." + JOIN_BEVEL
- + "]");
- else if (dashPhase < 0.0f && dash != null)
- throw new IllegalArgumentException("dashPhase " + dashPhase
- + " < 0.0f while dash != null");
- else if (dash != null)
- if (dash.length == 0)
- throw new IllegalArgumentException("dash.length is 0");
- else
- {
- boolean allZero = true;
-
- for ( int i = 0; i < dash.length; ++i)
- {
- if (dash[i] != 0.0f)
- {
- allZero = false;
- break;
- }
- }
-
- if (allZero)
- throw new IllegalArgumentException("all dashes are 0.0f");
- }
-
- this.width = width;
- this.cap = cap;
- this.join = join;
- limit = miterlimit;
- this.dash = dash == null ? null : (float[]) dash.clone();
- phase = dashPhase;
- }
-
- /**
- * Creates a basic stroke.
- *
- * @param width The width of the BasicStroke. May not be negative .
- * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE.
- * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER.
- * @param miterlimit the limit to trim the miter join. The miterlimit must be
- * greater than or equal to 1.0f.
- *
- * @exception IllegalArgumentException If one input parameter doesn't meet
- * its needs.
- */
- public BasicStroke(float width, int cap, int join, float miterlimit)
- {
- this(width, cap, join, miterlimit, null, 0);
- }
-
- /**
- * Creates a basic stroke.
- *
- * @param width The width of the BasicStroke. May not be nehative.
- * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE.
- * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER.
- *
- * @exception IllegalArgumentException If one input parameter doesn't meet
- * its needs.
- * @exception IllegalArgumentException FIXME
- */
- public BasicStroke(float width, int cap, int join)
- {
- this(width, cap, join, 10, null, 0);
- }
-
- /**
- * Creates a basic stroke.
- *
- * @param width The width of the BasicStroke.
- *
- * @exception IllegalArgumentException If width is negative.
- */
- public BasicStroke(float width)
- {
- this(width, CAP_SQUARE, JOIN_MITER, 10, null, 0);
- }
-
- /**
- * Creates a basic stroke.
- */
- public BasicStroke()
- {
- this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0);
- }
-
- public Shape createStrokedShape(Shape s)
- {
- throw new Error("not implemented");
- }
-
- public float getLineWidth()
- {
- return width;
- }
-
- public int getEndCap()
- {
- return cap;
- }
-
- public int getLineJoin()
- {
- return join;
- }
-
- public float getMiterLimit()
- {
- return limit;
- }
-
- public float[] getDashArray()
- {
- return dash;
- }
-
- public float getDashPhase()
- {
- return phase;
- }
-
- /**
- * Returns the hash code for this object. The hash is calculated by
- * xoring the hash, cap, join, limit, dash array and phase values
- * (converted to int
first with
- * Float.floatToIntBits()
if the value is a
- * float
).
- */
- public int hashCode()
- {
- int hash = Float.floatToIntBits(width);
- hash ^= cap;
- hash ^= join;
- hash ^= Float.floatToIntBits(limit);
-
- if (dash != null)
- for (int i = 0; i < dash.length; i++)
- hash ^= Float.floatToIntBits(dash[i]);
-
- hash ^= Float.floatToIntBits(phase);
-
- return hash;
- }
-
- /**
- * Returns true if the given Object is an instance of BasicStroke
- * and the width, cap, join, limit, dash array and phase are all
- * equal.
- */
- public boolean equals(Object o)
- {
- if (! (o instanceof BasicStroke))
- return false;
- BasicStroke s = (BasicStroke) o;
- return width == s.width && cap == s.cap && join == s.join
- && limit == s.limit && Arrays.equals(dash, s.dash) && phase == s.phase;
- }
-} // class BasicStroke
diff --git a/libjava/java/awt/BorderLayout.java b/libjava/java/awt/BorderLayout.java
deleted file mode 100644
index c9eb5dd8c37..00000000000
--- a/libjava/java/awt/BorderLayout.java
+++ /dev/null
@@ -1,731 +0,0 @@
-/* BorderLayout.java -- A layout manager class
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This class implements a layout manager that positions components
- * in certain sectors of the parent container.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public class BorderLayout implements LayoutManager2, java.io.Serializable
-{
-
-/*
- * Static Variables
- */
-
-/**
- * Constant indicating the top of the container
- */
-public static final String NORTH = "North";
-
-/**
- * Constant indicating the bottom of the container
- */
-public static final String SOUTH = "South";
-
-/**
- * Constant indicating the right side of the container
- */
-public static final String EAST = "East";
-
-/**
- * Constant indicating the left side of the container
- */
-public static final String WEST = "West";
-
-/**
- * Constant indicating the center of the container
- */
-public static final String CENTER = "Center";
-
-
- /**
- * The constant indicating the position before the first line of the
- * layout. The exact position depends on the writing system: For a
- * top-to-bottom orientation, it is the same as {@link #NORTH}, for
- * a bottom-to-top orientation, it is the same as {@link #SOUTH}.
- *
- * BorderLayout
with no
- * horiztonal or vertical gaps between components.
- */
-public
-BorderLayout()
-{
- this(0,0);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of BorderLayout
with the
- * specified horiztonal and vertical gaps between components.
- *
- * @param hgap The horizontal gap between components.
- * @param vgap The vertical gap between components.
- */
-public
-BorderLayout(int hgap, int vgap)
-{
- this.hgap = hgap;
- this.vgap = vgap;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * Returns the horitzontal gap value.
- *
- * @return The horitzontal gap value.
- */
-public int
-getHgap()
-{
- return(hgap);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the horizontal gap to the specified value.
- *
- * @param hgap The new horizontal gap.
- */
-public void
-setHgap(int hgap)
-{
- this.hgap = hgap;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the vertical gap value.
- *
- * @return The vertical gap value.
- */
-public int
-getVgap()
-{
- return(vgap);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the vertical gap to the specified value.
- *
- * @param vgap The new vertical gap value.
- */
-public void
-setVgap(int vgap)
-{
- this.vgap = vgap;
-}
-
-/*************************************************************************/
-
-/**
- * Adds a component to the layout in the specified constraint position,
- * which must be one of the string constants defined in this class.
- *
- * @param component The component to add.
- * @param constraints The constraint string.
- *
- * @exception IllegalArgumentException If the constraint object is not
- * a string, or is not one of the specified constants in this class.
- */
-public void
-addLayoutComponent(Component component, Object constraints)
-{
- if (constraints != null && ! (constraints instanceof String))
- throw new IllegalArgumentException("Constraint must be a string");
-
- addLayoutComponent((String) constraints, component);
-}
-
-/*************************************************************************/
-
-/**
- * Adds a component to the layout in the specified constraint position,
- * which must be one of the string constants defined in this class.
- *
- * @param constraints The constraint string.
- * @param component The component to add.
- *
- * @exception IllegalArgumentException If the constraint object is not
- * one of the specified constants in this class.
- *
- * @deprecated This method is deprecated in favor of
- * addLayoutComponent(Component, Object)
.
- */
-public void
-addLayoutComponent(String constraints, Component component)
-{
- String str = constraints;
-
- if (str == null || str.equals(CENTER))
- center = component;
- else if (str.equals(NORTH))
- north = component;
- else if (str.equals(SOUTH))
- south = component;
- else if (str.equals(EAST))
- east = component;
- else if (str.equals(WEST))
- west = component;
- else if (str.equals(BEFORE_FIRST_LINE))
- firstLine = component;
- else if (str.equals(AFTER_LAST_LINE))
- lastLine = component;
- else if (str.equals(BEFORE_LINE_BEGINS))
- firstItem = component;
- else if (str.equals(AFTER_LINE_ENDS))
- lastItem = component;
- else
- throw new IllegalArgumentException("Constraint value not valid: " + str);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified component from the layout.
- *
- * @param component The component to remove from the layout.
- */
-public void
-removeLayoutComponent(Component component)
-{
- if (north == component)
- north = null;
- if (south == component)
- south = null;
- if (east == component)
- east = null;
- if (west == component)
- west = null;
- if (center == component)
- center = null;
- if (firstItem == component)
- firstItem = null;
- if (lastItem == component)
- lastItem = null;
- if (firstLine == component)
- firstLine = null;
- if (lastLine == component)
- lastLine = null;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size of the specified container using this layout.
- *
- * @param target The container to calculate the minimum size for.
- *
- * @return The minimum size of the container
- */
-public Dimension
-minimumLayoutSize(Container target)
-{
- return calcSize(target, MIN);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size of the specified container using this layout.
- *
- * @param target The container to calculate the preferred size for.
- *
- * @return The preferred size of the container
- */
-public Dimension
-preferredLayoutSize(Container target)
-{
- return calcSize(target, PREF);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the maximum size of the specified container using this layout.
- *
- * @param target The container to calculate the maximum size for.
- *
- * @return The maximum size of the container
- */
-public Dimension
-maximumLayoutSize(Container target)
-{
- return calcSize(target, MAX);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the X axis alignment, which is a float
indicating
- * where along the X axis this container wishs to position its layout.
- * 0 indicates align to the left, 1 indicates align to the right, and 0.5
- * indicates align to the center.
- *
- * @param parent The parent container.
- *
- * @return The X alignment value.
- */
-public float
-getLayoutAlignmentX(Container parent)
-{
- return(parent.getAlignmentX());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the Y axis alignment, which is a float
indicating
- * where along the Y axis this container wishs to position its layout.
- * 0 indicates align to the top, 1 indicates align to the bottom, and 0.5
- * indicates align to the center.
- *
- * @param parent The parent container.
- *
- * @return The Y alignment value.
- */
-public float
-getLayoutAlignmentY(Container parent)
-{
- return(parent.getAlignmentY());
-}
-
-/*************************************************************************/
-
-/**
- * Instructs this object to discard any layout information it might
- * have cached.
- *
- * @param parent The parent container.
- */
-public void
-invalidateLayout(Container parent)
-{
-}
-
-/*************************************************************************/
-
-/**
- * Lays out the specified container according to the constraints
- * in this object.
- *
- * @param target The container to lay out.
- */
-public void
-layoutContainer(Container target)
-{
- synchronized (target.getTreeLock ())
- {
- Insets i = target.getInsets();
-
- ComponentOrientation orient = target.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- Component my_north = north;
- Component my_east = east;
- Component my_south = south;
- Component my_west = west;
-
- // Note that we currently don't handle vertical layouts. Neither
- // does JDK 1.3.
- if (firstLine != null)
- my_north = firstLine;
- if (lastLine != null)
- my_south = lastLine;
- if (firstItem != null)
- {
- if (left_to_right)
- my_west = firstItem;
- else
- my_east = firstItem;
- }
- if (lastItem != null)
- {
- if (left_to_right)
- my_east = lastItem;
- else
- my_west = lastItem;
- }
-
- Dimension c = calcCompSize(center, PREF);
- Dimension n = calcCompSize(my_north, PREF);
- Dimension s = calcCompSize(my_south, PREF);
- Dimension e = calcCompSize(my_east, PREF);
- Dimension w = calcCompSize(my_west, PREF);
- Dimension t = target.getSize();
-
- /*
- <-> hgap <-> hgap
- +----------------------------+ }
- |t | } i.top
- | +----------------------+ | --- y1 }
- | |n | |
- | +----------------------+ | } vgap
- | +---+ +----------+ +---+ | --- y2 } }
- | |w | |c | |e | | } hh
- | +---+ +----------+ +---+ | } vgap }
- | +----------------------+ | --- y3 }
- | |s | |
- | +----------------------+ | }
- | | } i.bottom
- +----------------------------+ }
- |x1 |x2 |x3
- <---------------------->
- <--> ww <-->
- i.left i.right
- */
-
- int x1 = i.left;
- int x2 = x1 + w.width + hgap;
- int x3;
- if (t.width <= i.right + e.width)
- x3 = x2 + w.width + hgap;
- else
- x3 = t.width - i.right - e.width;
- int ww = t.width - i.right - i.left;
-
- int y1 = i.top;
- int y2 = y1 + n.height + vgap;
- int midh = Math.max(e.height, Math.max(w.height, c.height));
- int y3;
- if (t.height <= i.bottom + s.height)
- y3 = y2 + midh + vgap;
- else
- y3 = t.height - i.bottom - s.height;
- int hh = y3-y2-vgap;
-
- setBounds(center, x2, y2, x3-x2-hgap, hh);
- setBounds(my_north, x1, y1, ww, n.height);
- setBounds(my_south, x1, y3, ww, s.height);
- setBounds(my_west, x1, y2, w.width, hh);
- setBounds(my_east, x3, y2, e.width, hh);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this layout manager.
- *
- * @return A string representation of this object.
- */
-public String
-toString()
-{
- return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";
-}
-
-private void
-setBounds(Component comp, int x, int y, int w, int h)
-{
- if (comp == null)
- return;
- comp.setBounds(x, y, w, h);
-}
-
-// Some constants for use with calcSize().
-private static final int MIN = 0;
-private static final int MAX = 1;
-private static final int PREF = 2;
-
-private Dimension
-calcCompSize(Component comp, int what)
-{
- if (comp == null || !comp.isVisible())
- return new Dimension(0, 0);
- if (what == MIN)
- return comp.getMinimumSize();
- else if (what == MAX)
- return comp.getMaximumSize();
- return comp.getPreferredSize();
-}
-
-// This is a helper function used to compute the various sizes for
-// this layout.
-private Dimension
-calcSize(Container target, int what)
-{
- synchronized (target.getTreeLock ())
- {
- Insets ins = target.getInsets();
-
- ComponentOrientation orient = target.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- Component my_north = north;
- Component my_east = east;
- Component my_south = south;
- Component my_west = west;
-
- // Note that we currently don't handle vertical layouts. Neither
- // does JDK 1.3.
- if (firstLine != null)
- my_north = firstLine;
- if (lastLine != null)
- my_south = lastLine;
- if (firstItem != null)
- {
- if (left_to_right)
- my_west = firstItem;
- else
- my_east = firstItem;
- }
- if (lastItem != null)
- {
- if (left_to_right)
- my_east = lastItem;
- else
- my_west = lastItem;
- }
-
- Dimension ndim = calcCompSize(my_north, what);
- Dimension sdim = calcCompSize(my_south, what);
- Dimension edim = calcCompSize(my_east, what);
- Dimension wdim = calcCompSize(my_west, what);
- Dimension cdim = calcCompSize(center, what);
-
- int width = edim.width + cdim.width + wdim.width + (hgap * 2);
- // check for overflow
- if (width < edim.width || width < cdim.width || width < cdim.width)
- width = Integer.MAX_VALUE;
-
- if (ndim.width > width)
- width = ndim.width;
- if (sdim.width > width)
- width = sdim.width;
-
- width += (ins.left + ins.right);
-
- int height = edim.height;
- if (cdim.height > height)
- height = cdim.height;
- if (wdim.height > height)
- height = wdim.height;
-
- int addedHeight = height + (ndim.height + sdim.height + (vgap * 2)
- + ins.top + ins.bottom);
- // check for overflow
- if (addedHeight < height)
- height = Integer.MAX_VALUE;
- else
- height = addedHeight;
-
- return(new Dimension(width, height));
- }
-}
-} // class BorderLayout
diff --git a/libjava/java/awt/BufferCapabilities.java b/libjava/java/awt/BufferCapabilities.java
deleted file mode 100644
index 7cc49730cdc..00000000000
--- a/libjava/java/awt/BufferCapabilities.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/* BufferCapabilities.java -- double-buffering capabilities descriptor
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * A double-buffering capability descriptor. This class exposes
- * details about the double-buffering algorithms used by image
- * buffers.
- *
- * BufferCapabilities represents algorithms that involve at least two
- * buffers but it can also specify so-called "multi-buffer" schemes
- * involving more than two buffers. This class describes the
- * capabilities of the front and back buffers as well as the results
- * of "flipping" -- that is, what happens when an image is transferred
- * from the back buffer to the front buffer.
- *
- * Flipping may or may not be supported or may be supported only in
- * fullscreen mode. If it is not supported then "blitting" is implied
- * -- that is, the contents of the back buffer are copied using a fast
- * block transfer operation from the back buffer to the front buffer.
- *
- * The front buffer is the one that is displayed.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- *
- * @see BufferStrategy#getCapabilities()
- * @see GraphicsConfiguration#getCapabilities()
- *
- * @since 1.4
- */
-public class BufferCapabilities implements Cloneable
-{
- /**
- * A type-safe enumeration of buffer flipping results.
- *
- * @see AttributeValue
- */
- public static final class FlipContents extends AttributeValue
- {
- /**
- * The names of the different flipping results.
- */
- private static final String[] NAMES
- = { "undefined", "background", "prior", "copied" };
-
- /**
- * The contents of the back buffer are undefined after flipping.
- */
- public static final FlipContents UNDEFINED = new FlipContents(0);
-
- /**
- * The back buffer is cleared with the background color after
- * flipping.
- */
- public static final FlipContents BACKGROUND = new FlipContents(1);
-
- /**
- * The back buffer contains the pre-flipping contents of the front
- * buffer after flipping. In other words a true "flip" has been
- * performed.
- */
- public static final FlipContents PRIOR = new FlipContents(2);
-
- /**
- * The back buffer has the same contents as the front buffer after
- * flipping.
- */
- public static final FlipContents COPIED = new FlipContents(3);
-
- /**
- * Create a new flipping result descriptor.
- *
- * @param value the enumeration value
- */
- private FlipContents(int value)
- {
- super(value, NAMES);
- }
- }
-
- /**
- * Front buffer capabilities descriptor.
- */
- private final ImageCapabilities front;
-
- /**
- * Back buffer capabilities descriptor.
- */
- private final ImageCapabilities back;
-
- /**
- * Describes the results of a "flip" operation.
- */
- private final FlipContents flip;
-
- /**
- * Creates a buffer capabilities object.
- *
- * @param frontCaps front buffer capabilities descriptor
- * @param backCaps back buffer capabilities descriptor
- * @param flip the results of a flip operation or null if
- * flipping is not supported
- *
- * @exception IllegalArgumentException if frontCaps or backCaps is
- * null
- */
- public BufferCapabilities(ImageCapabilities frontCaps,
- ImageCapabilities backCaps,
- FlipContents flip)
- {
- if (frontCaps == null || backCaps == null)
- throw new IllegalArgumentException();
- this.front = frontCaps;
- this.back = backCaps;
- this.flip = flip;
- }
-
- /**
- * Retrieve the front buffer's image capabilities.
- *
- * @return the front buffer's image capabilities
- */
- public ImageCapabilities getFrontBufferCapabilities()
- {
- return front;
- }
-
- /**
- * Retrieve the back buffer's image capabilities.
- *
- * @return the back buffer's image capabilities
- */
- public ImageCapabilities getBackBufferCapabilities()
- {
- return back;
- }
-
- /**
- * Return whether or not flipping is supported.
- *
- * @return true if flipping is supported, false otherwise
- */
- public boolean isPageFlipping()
- {
- return flip != null;
- }
-
- /**
- * Retrieve the result of a flipping operation. If this method
- * returns null then flipping is not supported. This implies that
- * "blitting", a fast block transfer, is used to copy the contents
- * of the back buffer to the front buffer. Other possible return
- * values are:
- *
- *
- *
- * @return the result of a flipping operation or null if flipping is
- * not supported
- */
- public FlipContents getFlipContents()
- {
- return flip;
- }
-
- /**
- * Returns true if flipping is only supported in fullscreen mode.
- *
- * @return true if flipping is only supported in fullscreen mode,
- * false otherwise
- */
- public boolean isFullScreenRequired()
- {
- return true;
- }
-
- /**
- * Returns true if flipping can involve more than two buffers. One
- * or more intermediate buffers may be available in addition to the
- * front and back buffers.
- *
- * @return true if there are more than two buffers available for
- * flipping, false otherwise
- */
- public boolean isMultiBufferAvailable()
- {
- return false;
- }
-
- /**
- * Clone this buffering capability descriptor.
- *
- * @return a clone of this buffer capability descriptor
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e);
- }
- }
-}
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java
deleted file mode 100644
index 90be1e5b111..00000000000
--- a/libjava/java/awt/Button.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/* Button.java -- AWT button widget
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.peer.ButtonPeer;
-import java.lang.reflect.Array;
-import java.util.EventListener;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleAction;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleValue;
-
-/**
- * This class provides a button widget for the AWT.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class Button extends Component
- implements java.io.Serializable, Accessible
-{
-
-/*
- * Static Variables
- */
-
-// FIXME: Need readObject/writeObject for serialization
-
-// Serialization version constant
-private static final long serialVersionUID = -8774683716313001058L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The action command name for this button.
- * This is package-private to avoid an accessor method.
- */
-String actionCommand;
-
-/**
- * @serial The label for this button.
- * This is package-private to avoid an accessor method.
- */
-String label;
-
-// List of ActionListeners for this class.
-private transient ActionListener action_listeners;
-
- /*
- * The number used to generate the name returned by getName.
- */
- private static transient long next_button_number;
-
- protected class AccessibleAWTButton extends AccessibleAWTComponent
- implements AccessibleAction, AccessibleValue
- {
- protected AccessibleAWTButton()
- {
- // Do nothing here.
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
- */
- public int getAccessibleActionCount()
- {
- // Only 1 action possible
- return 1;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
- */
- public String getAccessibleActionDescription(int i)
- {
- // JDK 1.4.2 returns the string "click" for action 0. However, the API
- // docs don't say what the string to be returned is, beyond being a
- // description of the action. So we return the same thing for
- // compatibility with 1.4.2.
- if (i == 0)
- return "click";
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
- */
- public boolean doAccessibleAction(int i)
- {
- if (i != 0)
- return false;
- processActionEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
- return true;
- }
-
- public String getAccessibleName()
- {
- return label;
- }
-
- public AccessibleAction getAccessibleAction()
- {
- return this;
- }
-
- public AccessibleValue getAccessibleValue()
- {
- return this;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
- */
- public Number getCurrentAccessibleValue()
- {
- // Docs say return 1 if selected, but buttons can't be selected, right?
- return new Integer(0);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
- */
- public boolean setCurrentAccessibleValue(Number number)
- {
- // Since there's no selection with buttons, we're ignoring this.
- // TODO someone who knows shoulw check this.
- return false;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
- */
- public Number getMinimumAccessibleValue()
- {
- return new Integer(0);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
- */
- public Number getMaximumAccessibleValue()
- {
- return new Integer(0);
- }
-
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.PUSH_BUTTON;
- }
- }
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of FlipContents.UNDEFINED
the contents of the
- * back buffer are undefined after flipping.FlipContents.BACKGROUND
the contents of the
- * back buffer are cleared to the background color after
- * flipping.FlipContents.PRIOR
the back buffer contains
- * the pre-flipping contents of the front * buffer after
- * flipping.FlipContents.COPIED
the back buffer has the
- * same contents as the front buffer after flipping.Button
with no label.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true
- */
-public
-Button()
-{
- this("");
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Button
with the specified
- * label. The action command name is also initialized to this value.
- *
- * @param label The label to display on the button.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true
- */
-public
-Button(String label)
-{
- this.label = label;
- actionCommand = label;
-
- if (GraphicsEnvironment.isHeadless ())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * Returns the label for this button.
- *
- * @return The label for this button.
- */
-public String
-getLabel()
-{
- return(label);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the label for this button to the specified value.
- *
- * @param label The new label for this button.
- */
-public synchronized void
-setLabel(String label)
-{
- this.label = label;
- actionCommand = label;
- if (peer != null)
- {
- ButtonPeer bp = (ButtonPeer) peer;
- bp.setLabel (label);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns the action command name for this button.
- *
- * @return The action command name for this button.
- */
-public String
-getActionCommand()
-{
- return(actionCommand);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the action command name for this button to the specified value.
- *
- * @param actionCommand The new action command name.
- */
-public void
-setActionCommand(String actionCommand)
-{
- this.actionCommand = actionCommand == null ? label : actionCommand;
-}
-
-/*************************************************************************/
-
-/**
- * Adds a new entry to the list of listeners that will receive
- * action events from this button.
- *
- * @param listener The listener to add.
- */
-public synchronized void
-addActionListener(ActionListener listener)
-{
- action_listeners = AWTEventMulticaster.add(action_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified listener from the list of listeners that will
- * receive action events from this button.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeActionListener(ActionListener listener)
-{
- action_listeners = AWTEventMulticaster.remove(action_listeners, listener);
-}
-
- /**
- * Returns all added ActionListener
objects.
- *
- * @return an array of listeners
- *
- * @since 1.4
- */
- public synchronized ActionListener[] getActionListeners()
- {
- return (ActionListener[])
- AWTEventMulticaster.getListeners(action_listeners,
- ActionListener.class);
- }
-
-/**
- * Returns all registered EventListers of the given listenerType.
- * listenerType must be a subclass of EventListener, or a
- * ClassClassException is thrown.
- *
- * @param listenerType the listener type to return
- *
- * @return an array of listeners
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements @see java.util.EventListener.
- *
- * @since 1.3
- */
- public EventListener[] getListeners(Class listenerType)
- {
- if (listenerType == ActionListener.class)
- return getActionListeners();
- return (EventListener[]) Array.newInstance(listenerType, 0);
- }
-
-/*************************************************************************/
-
-/**
- * Notifies this button that it should create its native peer object.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createButton (this);
- super.addNotify();
-}
-
-/*************************************************************************/
-
-/**
- * Processes an event for this button. If the specified event is an
- * instance of ActionEvent
, then the
- * processActionEvent()
method is called to dispatch it
- * to any registered listeners. Otherwise, the superclass method
- * will be invoked. Note that this method will not be called at all
- * unless ActionEvent
's are enabled. This will be done
- * implicitly if any listeners are added.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof ActionEvent)
- processActionEvent((ActionEvent)event);
- else
- super.processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * This method dispatches an action event for this button to any
- * registered listeners.
- *
- * @param event The event to process.
- */
-protected void
-processActionEvent(ActionEvent event)
-{
- if (action_listeners != null)
- action_listeners.actionPerformed(event);
-}
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= ActionEvent.ACTION_LAST
- && e.id >= ActionEvent.ACTION_FIRST
- && (action_listeners != null
- || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this button.
- *
- * @return A debugging string for this button.
- */
-protected String
-paramString()
-{
- return getName () + "," + getX () + "," + getY () + ","
- + getWidth () + "x" + getHeight () + ",label=" + getLabel ();
-}
-
-/**
- * Gets the AccessibleContext associated with this Button
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
-public AccessibleContext getAccessibleContext()
-{
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTButton();
- return accessibleContext;
-}
-
- /**
- * Generate a unique name for this button.
- *
- * @return A unique name for this button.
- */
- String generateName ()
- {
- return "button" + getUniqueLong ();
- }
-
- private static synchronized long getUniqueLong ()
- {
- return next_button_number++;
- }
-
-} // class Button
-
diff --git a/libjava/java/awt/Canvas.java b/libjava/java/awt/Canvas.java
deleted file mode 100644
index 79f836edca3..00000000000
--- a/libjava/java/awt/Canvas.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/* Canvas.java --
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.BufferStrategy;
-import java.awt.peer.ComponentPeer;
-import java.io.Serializable;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * The Canvas
component provides a blank rectangular
- * area, which the client application can use for drawing and for
- * capturing events. By overriding the paint()
method,
- * the canvas can be used for anything from simple line drawings to
- * full-scale custom components.
- *
- * @author Original author unknown
- * @author Tom Tromey (tromey@redhat.com)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.0
- */
-
-public class Canvas
- extends Component
- implements Serializable, Accessible
-{
-
- /**
- * Compatible with Sun's JDK.
- */
- private static final long serialVersionUID = -2284879212465893870L;
-
- /**
- * The graphics configuration associated with the canvas.
- */
- transient GraphicsConfiguration graphicsConfiguration;
-
- /**
- * The buffer strategy associated with this canvas.
- */
- transient BufferStrategy bufferStrategy;
-
- /**
- * Initializes a new instance of Canvas
.
- */
- public Canvas()
- {
- }
-
- /**
- * Initializes a new instance of Canvas
- * with the supplied graphics configuration.
- *
- * @param graphicsConfiguration the graphics configuration to use
- * for this particular canvas.
- */
- public Canvas(GraphicsConfiguration graphicsConfiguration)
- {
- this.graphicsConfiguration = graphicsConfiguration;
- }
-
- GraphicsConfiguration getGraphicsConfigurationImpl()
- {
- if (graphicsConfiguration != null)
- return graphicsConfiguration;
- return super.getGraphicsConfigurationImpl();
- }
-
- /**
- * Creates the native peer for this object.
- */
- public void addNotify()
- {
- if (peer == null)
- peer = (ComponentPeer) getToolkit().createCanvas(this);
- super.addNotify();
- }
-
- /**
- * Repaints the canvas window. This method should be overridden by
- * a subclass to do something useful, as this method simply paints
- * the window with the background color.
- *
- * @param gfx the Graphics
to use for painting
- */
- public void paint(Graphics gfx)
- {
- /* This implementation doesn't make much sense since the filling
- of background color is guaranteed for heavyweight components
- such as this. But there's no need to worry, since paint() is
- usually overridden anyway. */
- gfx.setColor(getBackground());
- Dimension size = getSize();
- gfx.fillRect(0, 0, size.width, size.height);
- }
-
- /**
- * This class provides accessibility support for the canvas.
- */
- protected class AccessibleAWTCanvas
- extends AccessibleAWTComponent
- {
- /**
- * For compatability with Sun's JDK
- */
- private static final long serialVersionUID = -6325592262103146699L;
-
- /**
- * Constructor for the accessible canvas.
- */
- protected AccessibleAWTCanvas()
- {
- }
-
- /**
- * Returns the accessible role for the canvas.
- *
- * @return an instance of AccessibleRole
, describing
- * the role of the canvas.
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.CANVAS;
- }
-
- }
-
- /**
- * Gets the AccessibleContext associated with this Canvas
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTCanvas();
- return accessibleContext;
- }
-
- /**
- * A BltBufferStrategy for canvases.
- */
- private class CanvasBltBufferStrategy extends BltBufferStrategy
- {
- /**
- * Creates a block transfer strategy for this canvas.
- *
- * @param numBuffers the number of buffers in this strategy
- * @param accelerated true if the buffer should be accelerated,
- * false otherwise
- */
- CanvasBltBufferStrategy(int numBuffers, boolean accelerated)
- {
- super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(accelerated),
- new ImageCapabilities(accelerated),
- BufferCapabilities.FlipContents.COPIED));
- }
- }
-
- /**
- * A FlipBufferStrategy for canvases.
- */
- private class CanvasFlipBufferStrategy extends FlipBufferStrategy
- {
- /**
- * Creates a flip buffer strategy for this canvas.
- *
- * @param numBuffers the number of buffers in this strategy
- *
- * @throws AWTException if the requested number of buffers is not
- * supported
- */
- CanvasFlipBufferStrategy(int numBuffers)
- throws AWTException
- {
- super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(true),
- new ImageCapabilities(true),
- BufferCapabilities.FlipContents.COPIED));
- }
- }
-
- /**
- * Creates a buffering strategy that manages how this canvas is
- * repainted. This method attempts to create the optimum strategy
- * based on the desired number of buffers. Hardware or software
- * acceleration may be used.
- *
- * createBufferStrategy attempts different levels of optimization,
- * but guarantees that some strategy with the requested number of
- * buffers will be created even if it is not optimal. First it
- * attempts to create a page flipping strategy, then an accelerated
- * blitting strategy, then an unaccelerated blitting strategy.
- *
- * Calling this method causes any existing buffer strategy to be
- * destroyed.
- *
- * @param numBuffers the number of buffers in this strategy
- *
- * @throws IllegalArgumentException if requested number of buffers
- * is less than one
- * @throws IllegalStateException if this canvas is not displayable
- *
- * @since 1.4
- */
- public void createBufferStrategy(int numBuffers)
- {
- if (numBuffers < 1)
- throw new IllegalArgumentException("Canvas.createBufferStrategy: number"
- + " of buffers is less than one");
-
- if (!isDisplayable())
- throw new IllegalStateException("Canvas.createBufferStrategy: canvas is"
- + " not displayable");
-
- // try a flipping strategy
- try
- {
- bufferStrategy = new CanvasFlipBufferStrategy(numBuffers);
- return;
- }
- catch (AWTException e)
- {
- }
-
- // try an accelerated blitting strategy
- try
- {
- bufferStrategy = new CanvasBltBufferStrategy(numBuffers, true);
- }
- catch (AWTException e)
- {
- }
-
- // fall back to an unaccelerated blitting strategy
- try
- {
- bufferStrategy = new CanvasBltBufferStrategy(numBuffers, false);
- }
- catch (AWTException e)
- {
- }
- }
-
- /**
- * Creates a buffering strategy that manages how this canvas is
- * repainted. This method attempts to create a strategy based on
- * the specified capabilities and throws an exception if the
- * requested strategy is not supported.
- *
- * Calling this method causes any existing buffer strategy to be
- * destroyed.
- *
- * @param numBuffers the number of buffers in this strategy
- * @param caps the requested buffering capabilities
- *
- * @throws AWTException if the requested capabilities are not
- * supported
- * @throws IllegalArgumentException if requested number of buffers
- * is less than one or if caps is null
- *
- * @since 1.4
- */
- public void createBufferStrategy(int numBuffers,
- BufferCapabilities caps)
- {
- if (numBuffers < 1)
- throw new IllegalArgumentException("Canvas.createBufferStrategy: number"
- + " of buffers is less than one");
-
- if (caps == null)
- throw new IllegalArgumentException("Canvas.createBufferStrategy:"
- + " capabilities object is null");
-
- // a flipping strategy was requested
- if (caps.isPageFlipping())
- {
- try
- {
- bufferStrategy = new CanvasFlipBufferStrategy(numBuffers);
- }
- catch (AWTException e)
- {
- }
- }
- else
- bufferStrategy = new CanvasBltBufferStrategy(numBuffers, true);
- }
-
- /**
- * Returns the buffer strategy used by the canvas.
- *
- * @return the buffer strategy.
- * @since 1.4
- */
- public BufferStrategy getBufferStrategy()
- {
- return bufferStrategy;
- }
-
- /**
- * Updates the canvas in response to a request to
- * repaint()
it. The canvas is cleared
- * with the current background colour, before paint()
- * is called to add the new contents. Subclasses
- * which override this method should either call this
- * method via super.update(graphics)
or re-implement
- * this behaviour, so as to ensure that the canvas is
- * clear before painting takes place.
- *
- * @param graphics the graphics context.
- */
- public void update(Graphics graphics)
- {
- Dimension size;
-
- /* Clear the canvas */
- size = getSize();
- graphics.clearRect(0, 0, size.width, size.height);
- /* Call the paint method */
- paint(graphics);
- }
-}
diff --git a/libjava/java/awt/CardLayout.java b/libjava/java/awt/CardLayout.java
deleted file mode 100644
index 8582c5f099b..00000000000
--- a/libjava/java/awt/CardLayout.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/* CardLayout.java -- Card-based layout engine
- Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-/**
- * This class implements a card-based layout scheme. Each included
- * component is treated as a card. Only one card can be shown at a
- * time. This class includes methods for changing which card is
- * shown.
- *
- * @author Tom Tromey (tromey@redhat.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class CardLayout implements LayoutManager2, Serializable
-{
- private static final long serialVersionUID = -4328196481005934313L;
-
- /**
- * Initializes a new instance of CardLayout
with horizontal
- * and vertical gaps of 0.
- */
- public CardLayout ()
- {
- this (0, 0);
- }
-
- /**
- * Create a new CardLayout
object with the specified
- * horizontal and vertical gaps.
- *
- * @param hgap The horizontal gap
- * @param vgap The vertical gap
- */
- public CardLayout (int hgap, int vgap)
- {
- this.hgap = hgap;
- this.vgap = vgap;
- this.tab = new Hashtable ();
- }
-
- /**
- * Add a new component to the layout. The constraint must be a
- * string which is used to name the component. This string can
- * later be used to refer to the particular component.
- *
- * @param comp The component to add
- * @param constraints The name by which the component can later be called
- *
- * @exception IllegalArgumentException If `constraints' is not a
- * String
- */
- public void addLayoutComponent (Component comp, Object constraints)
- {
- if (! (constraints instanceof String))
- throw new IllegalArgumentException ("Object " + constraints
- + " is not a string");
- addLayoutComponent ((String) constraints, comp);
- }
-
- /**
- * Add a new component to the layout. The name can be used later
- * to refer to the component.
- *
- * @param name The name by which the component can later be called
- * @param comp The component to add
- *
- * @deprecated This method is deprecated in favor of
- * addLayoutComponent(Component, Object)
.
- */
- public void addLayoutComponent (String name, Component comp)
- {
- tab.put (name, comp);
- // First component added is the default component.
- comp.setVisible(tab.size() == 1);
- }
-
- /**
- * Cause the first component in the container to be displayed.
- *
- * @param parent The parent container
- */
- public void first (Container parent)
- {
- gotoComponent (parent, FIRST);
- }
-
- /**
- * Return this layout manager's horizontal gap.
- *
- * @return the horizontal gap
- */
- public int getHgap ()
- {
- return hgap;
- }
-
- /**
- * Return this layout manager's x alignment. This method always
- * returns Component.CENTER_ALIGNMENT.
- *
- * @param parent Container using this layout manager instance
- *
- * @return the x-axis alignment
- */
- public float getLayoutAlignmentX (Container parent)
- {
- return Component.CENTER_ALIGNMENT;
- }
-
- /**
- * Returns this layout manager's y alignment. This method always
- * returns Component.CENTER_ALIGNMENT.
- *
- * @param parent Container using this layout manager instance
- *
- * @return the y-axis alignment
- */
- public float getLayoutAlignmentY (Container parent)
- {
- return Component.CENTER_ALIGNMENT;
- }
-
- /**
- * Return this layout manager's vertical gap.
- *
- * @return the vertical gap
- */
- public int getVgap ()
- {
- return vgap;
- }
-
- /**
- * Invalidate this layout manager's state.
- */
- public void invalidateLayout (Container target)
- {
- // Do nothing.
- }
-
- /**
- * Cause the last component in the container to be displayed.
- *
- * @param parent The parent container
- */
- public void last (Container parent)
- {
- gotoComponent (parent, LAST);
- }
-
- /**
- * Lays out the container. This is done by resizing the child components
- * to be the same size as the parent, less insets and gaps.
- *
- * @param parent The parent container.
- */
- public void layoutContainer (Container parent)
- {
- synchronized (parent.getTreeLock ())
- {
- int width = parent.width;
- int height = parent.height;
-
- Insets ins = parent.getInsets ();
-
- int num = parent.ncomponents;
- Component[] comps = parent.component;
-
- int x = ins.left + hgap;
- int y = ins.top + vgap;
- width = width - 2 * hgap - ins.left - ins.right;
- height = height - 2 * vgap - ins.top - ins.bottom;
-
- for (int i = 0; i < num; ++i)
- comps[i].setBounds (x, y, width, height);
- }
- }
-
- /**
- * Get the maximum layout size of the container.
- *
- * @param target The parent container
- *
- * @return the maximum layout size
- */
- public Dimension maximumLayoutSize (Container target)
- {
- // The JCL says that this returns Integer.MAX_VALUE for both
- // dimensions. But that just seems wrong to me.
- return getSize (target, MAX);
- }
-
- /**
- * Get the minimum layout size of the container.
- *
- * @param target The parent container
- *
- * @return the minimum layout size
- */
- public Dimension minimumLayoutSize (Container target)
- {
- return getSize (target, MIN);
- }
-
- /**
- * Cause the next component in the container to be displayed. If
- * this current card is the last one in the deck, the first
- * component is displayed.
- *
- * @param parent The parent container
- */
- public void next (Container parent)
- {
- gotoComponent (parent, NEXT);
- }
-
- /**
- * Get the preferred layout size of the container.
- *
- * @param parent The parent container
- *
- * @return the preferred layout size
- */
- public Dimension preferredLayoutSize (Container parent)
- {
- return getSize (parent, PREF);
- }
-
- /**
- * Cause the previous component in the container to be displayed.
- * If this current card is the first one in the deck, the last
- * component is displayed.
- *
- * @param parent The parent container
- */
- public void previous (Container parent)
- {
- gotoComponent (parent, PREV);
- }
-
- /**
- * Remove the indicated component from this layout manager.
- *
- * @param comp The component to remove
- */
- public void removeLayoutComponent (Component comp)
- {
- Enumeration e = tab.keys ();
- while (e.hasMoreElements ())
- {
- Object key = e.nextElement ();
- if (tab.get (key) == comp)
- {
- tab.remove (key);
- Container parent = comp.getParent();
- next(parent);
- break;
- }
- }
- }
-
- /**
- * Set this layout manager's horizontal gap.
- *
- * @param hgap The new gap
- */
- public void setHgap (int hgap)
- {
- this.hgap = hgap;
- }
-
- /**
- * Set this layout manager's vertical gap.
- *
- * @param vgap The new gap
- */
- public void setVgap (int vgap)
- {
- this.vgap = vgap;
- }
-
- /**
- * Cause the named component to be shown. If the component name is
- * unknown, this method does nothing.
- *
- * @param parent The parent container
- * @param name The name of the component to show
- */
- public void show (Container parent, String name)
- {
- Object target = tab.get (name);
- if (target != null)
- {
- int num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
- for (int i = 0; i < num; ++i)
- {
- if (comps[i].isVisible())
- {
- if (target == comps[i])
- return;
- comps[i].setVisible (false);
- }
- }
- ((Component) target).setVisible (true);
- }
- }
-
- /**
- * Returns a string representation of this layout manager.
- *
- * @return A string representation of this object.
- */
- public String toString ()
- {
- return getClass ().getName () + "[" + hgap + "," + vgap + "]";
- }
-
- /**
- * This implements first(), last(), next(), and previous().
- *
- * @param parent The parent container
- * @param what The type of goto: FIRST, LAST, NEXT or PREV
- */
- private void gotoComponent (Container parent, int what)
- {
- synchronized (parent.getTreeLock ())
- {
- int num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- if (num == 1)
- {
- comps[0].setVisible(true);
- return;
- }
-
- int choice = -1;
-
- if (what == FIRST)
- choice = 0;
- else if (what == LAST)
- choice = num - 1;
-
- for (int i = 0; i < num; ++i)
- {
- if (comps[i].isVisible ())
- {
- if (what == NEXT)
- {
- choice = i + 1;
- if (choice == num)
- choice = 0;
- }
- else if (what == PREV)
- {
- choice = i - 1;
- if (choice < 0)
- choice = num - 1;
- }
- else if (choice == i)
- {
- // Do nothing if we're already looking at the right
- // component.
- return;
- }
- comps[i].setVisible (false);
-
- if (choice >= 0)
- break;
- }
- }
-
- if (choice >= 0 && choice < num)
- comps[choice].setVisible (true);
- }
- }
-
- // Compute the size according to WHAT.
- private Dimension getSize (Container parent, int what)
- {
- synchronized (parent.getTreeLock ())
- {
- int w = 0, h = 0, num = parent.ncomponents;
- Component[] comps = parent.component;
-
- for (int i = 0; i < num; ++i)
- {
- Dimension d;
-
- if (what == MIN)
- d = comps[i].getMinimumSize ();
- else if (what == MAX)
- d = comps[i].getMaximumSize ();
- else
- d = comps[i].getPreferredSize ();
-
- w = Math.max (d.width, w);
- h = Math.max (d.height, h);
- }
-
- Insets i = parent.getInsets ();
- w += 2 * hgap + i.right + i.left;
- h += 2 * vgap + i.bottom + i.top;
-
- // Handle overflow.
- if (w < 0)
- w = Integer.MAX_VALUE;
- if (h < 0)
- h = Integer.MAX_VALUE;
-
- return new Dimension (w, h);
- }
- }
-
- /**
- * @serial Horizontal gap value.
- */
- private int hgap;
-
- /**
- * @serial Vertical gap value.
- */
- private int vgap;
-
- /**
- * @serial Table of named components.
- */
- private Hashtable tab;
-
- // These constants are used by the private gotoComponent method.
- private static final int FIRST = 0;
- private static final int LAST = 1;
- private static final int NEXT = 2;
- private static final int PREV = 3;
-
- // These constants are used by the private getSize method.
- private static final int MIN = 0;
- private static final int MAX = 1;
- private static final int PREF = 2;
-}
diff --git a/libjava/java/awt/Checkbox.java b/libjava/java/awt/Checkbox.java
deleted file mode 100644
index cd39ad43617..00000000000
--- a/libjava/java/awt/Checkbox.java
+++ /dev/null
@@ -1,649 +0,0 @@
-/* Checkbox.java -- An AWT checkbox widget
- Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.peer.CheckboxPeer;
-import java.io.Serializable;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleAction;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-import javax.accessibility.AccessibleValue;
-
-/**
- * This class implements a component which has an on/off state. Two
- * or more Checkboxes can be grouped by a CheckboxGroup.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@redhat.com)
- */
-public class Checkbox extends Component
- implements ItemSelectable, Accessible, Serializable
-{
-
-// FIXME: Need readObject/writeObject for this.
-
-/*
- * Static Variables
- */
-
-// Serialization Constant
-private static final long serialVersionUID = 7270714317450821763L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The checkbox group for this checkbox.
- */
-private CheckboxGroup group;
-
-/**
- * @serial The label on this checkbox.
- */
-private String label;
-
-/**
- * @serial The state of this checkbox.
- * This is package-private to avoid an accessor method.
- */
-boolean state;
-
-// The list of listeners for this object.
-private transient ItemListener item_listeners;
-
- /*
- * The number used to generate the name returned by getName.
- */
- private static transient long next_checkbox_number;
-
-/**
- * This class provides accessibility support for the
- * checkbox.
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-protected class AccessibleAWTCheckbox
- extends AccessibleAWTComponent
- implements ItemListener, AccessibleAction, AccessibleValue
-{
- /**
- * Serialization constant to match JDK 1.5
- */
- private static final long serialVersionUID = 7881579233144754107L;
-
- /**
- * Default constructor which simply calls the
- * super class for generic component accessibility
- * handling.
- */
- public AccessibleAWTCheckbox()
- {
- super();
- }
-
- /**
- * Captures changes to the state of the checkbox and
- * fires appropriate accessible property change events.
- *
- * @param event the event fired.
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- */
- public void itemStateChanged(ItemEvent event)
- {
- firePropertyChange(ACCESSIBLE_STATE_PROPERTY,
- state ? null : AccessibleState.CHECKED,
- state ? AccessibleState.CHECKED : null);
- }
-
- /**
- * Returns an implementation of the AccessibleAction
- * interface for this accessible object. In this case, the
- * current instance is simply returned (with a more appropriate
- * type), as it also implements the accessible action as well as
- * the context.
- *
- * @return the accessible action associated with this context.
- * @see javax.accessibility.AccessibleAction
- */
- public AccessibleAction getAccessibleAction()
- {
- return this;
- }
-
- /**
- * Returns an implementation of the AccessibleValue
- * interface for this accessible object. In this case, the
- * current instance is simply returned (with a more appropriate
- * type), as it also implements the accessible value as well as
- * the context.
- *
- * @return the accessible value associated with this context.
- * @see javax.accessibility.AccessibleValue
- */
- public AccessibleValue getAccessibleValue()
- {
- return this;
- }
-
- /*
- * The following methods are implemented in the JDK (up to
- * 1.5) as stubs. We do likewise here.
- */
-
- /**
- * Returns the number of actions associated with this accessible
- * object. This default implementation returns 0.
- *
- * @return the number of accessible actions available.
- * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
- */
- public int getAccessibleActionCount()
- {
- // 1.4.1 and 1.5 do this
- return 0;
- }
-
- /**
- * Returns a description of the action with the supplied id.
- * This default implementation always returns null.
- *
- * @param i the id of the action whose description should be
- * retrieved.
- * @return a String
describing the action.
- * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
- */
- public String getAccessibleActionDescription(int i)
- {
- // 1.5 does this
- return null;
- }
-
- /**
- * Executes the action with the specified id. This
- * default implementation simply returns false.
- *
- * @param i the id of the action to perform.
- * @return true if the action was performed.
- * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
- */
- public boolean doAccessibleAction(int i)
- {
- // 1.5 does this
- return false;
- }
-
- /**
- * Returns the current value of this accessible object.
- * If no value has been set, null is returned. This
- * default implementation always returns null, regardless.
- *
- * @return the numeric value of this object, or null if
- * no value has been set.
- * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
- */
- public Number getCurrentAccessibleValue()
- {
- // 1.5 does this
- return null;
- }
-
- /**
- * Sets the current value of this accessible object
- * to that supplied. In this default implementation,
- * the value is never set and the method always returns
- * false.
- *
- * @param number the new accessible value.
- * @return true if the value was set.
- * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
- */
- public boolean setCurrentAccessibleValue(Number number)
- {
- // 1.5 does this
- return false;
- }
-
- /**
- * Returns the minimum acceptable accessible value used
- * by this object, or null if no minimum value exists.
- * This default implementation always returns null.
- *
- * @return the minimum acceptable accessible value, or null
- * if there is no minimum.
- * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
- */
- public Number getMinimumAccessibleValue()
- {
- return null;
- }
-
- /**
- * Returns the maximum acceptable accessible value used
- * by this object, or null if no maximum value exists.
- * This default implementation always returns null.
- *
- * @return the maximum acceptable accessible value, or null
- * if there is no maximum.
- * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
- */
- public Number getMaximumAccessibleValue()
- {
- return null;
- }
-
- /**
- * Returns the role of this accessible object.
- *
- * @return the instance of AccessibleRole
,
- * which describes this object.
- * @see javax.accessibility.AccessibleRole
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.CHECK_BOX;
- }
-
- /**
- * Returns the state set of this accessible object.
- *
- * @return a set of AccessibleState
s
- * which represent the current state of the
- * accessible object.
- * @see javax.accessibility.AccessibleState
- * @see javax.accessibility.AccessibleStateSet
- */
- public AccessibleStateSet getAccessibleStateSet()
- {
- AccessibleStateSet set = super.getAccessibleStateSet();
- if (state)
- set.add(AccessibleState.CHECKED);
- return set;
- }
-
-}
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of Checkbox
with no label,
- * an initial state of off, and that is not part of any checkbox group.
- */
-public
-Checkbox()
-{
- this("", false, null);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Checkbox
with the specified
- * label, an initial state of off, and that is not part of any checkbox
- * group.
- *
- * @param label The label for this checkbox.
- */
-public
-Checkbox(String label)
-{
- this(label, false, null);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Checkbox
with the specified
- * label and initial state, and that is not part of any checkbox
- * group.
- *
- * @param label The label for this checkbox.
- * @param state The initial state of the checkbox, true
for
- * on, false
for off.
- */
-public
-Checkbox(String label, boolean state)
-{
- this(label, state, null);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Checkbox
with the specified
- * label, initial state, and checkbox group.
- *
- * @param label The label for this checkbox.
- * @param group The checkbox group for this box, or null
- * if there is no checkbox group.
- * @param state The initial state of the checkbox, true
for
- * on, false
for off.
- */
-public
-Checkbox(String label, CheckboxGroup group, boolean state)
-{
- this(label, state, group);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Checkbox
with the specified
- * label, initial state, and checkbox group.
- *
- * @param label The label for this checkbox.
- * @param state The initial state of the checkbox, true
for
- * on, false
for off.
- * @param group The checkbox group for this box, or null
- * if there is no checkbox group.
- */
-public
-Checkbox(String label, boolean state, CheckboxGroup group)
-{
- this.label = label;
- this.state = state;
- this.group = group;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * Returns the label for this checkbox.
- *
- * @return The label for this checkbox.
- */
-public String
-getLabel()
-{
- return(label);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the label for this checkbox to the specified value.
- *
- * @param label The new checkbox label.
- */
-public synchronized void
-setLabel(String label)
-{
- this.label = label;
- if (peer != null)
- {
- CheckboxPeer cp = (CheckboxPeer) peer;
- cp.setLabel(label);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns the state of this checkbox.
- *
- * @return The state of this checkbox, which will be true
for
- * on and false
for off.
- */
-public boolean
-getState()
-{
- return(state);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the state of this checkbox to the specified value.
- *
- * @param state The new state of the checkbox, which will be true
- * for on or false
for off.
- */
-public synchronized void
-setState(boolean state)
-{
- this.state = state;
- if (peer != null)
- {
- CheckboxPeer cp = (CheckboxPeer) peer;
- cp.setState (state);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns an array of length one containing the checkbox label if this
- * checkbox is selected. Otherwise null
is returned.
- *
- * @return The selection state of this checkbox.
- */
-public Object[]
-getSelectedObjects()
-{
- if (state == false)
- return(null);
-
- Object[] objs = new Object[1];
- objs[0] = label;
-
- return(objs);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the checkbox group this object is a member of, if any.
- *
- * @return This object's checkbox group, of null
if it is
- * not a member of any group.
- */
-public CheckboxGroup
-getCheckboxGroup()
-{
- return(group);
-}
-
-/*************************************************************************/
-
-/**
- * Sets this object's checkbox group to the specified group.
- *
- * @param group The new checkbox group, or null
to make this
- * object part of no checkbox group.
- */
-public synchronized void
-setCheckboxGroup(CheckboxGroup group)
-{
- this.group = group;
- if (peer != null)
- {
- CheckboxPeer cp = (CheckboxPeer) peer;
- cp.setCheckboxGroup (group);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Creates this object's native peer.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createCheckbox (this);
- super.addNotify ();
-}
-
- public ItemListener[] getItemListeners ()
- {
- return (ItemListener[])
- AWTEventMulticaster.getListeners (item_listeners, ItemListener.class);
- }
-
-/**
- * Adds a new listeners to the list of registered listeners for this object.
- *
- * @param listener The new listener to add.
- */
-public synchronized void
-addItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.add(item_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Removes a listener from the list of registered listeners for this object.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.remove(item_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Processes this event by calling processItemEvent()
if it
- * is any instance of ItemEvent
. Otherwise it is passed to
- * the superclass for processing.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof ItemEvent)
- processItemEvent((ItemEvent)event);
- else
- super.processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * Processes this event by dispatching it to any registered listeners.
- *
- * @param event The ItemEvent
to process.
- */
-protected void
-processItemEvent(ItemEvent event)
-{
- if (item_listeners != null)
- item_listeners.itemStateChanged(event);
-}
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= ItemEvent.ITEM_LAST
- && e.id >= ItemEvent.ITEM_FIRST
- && (item_listeners != null
- || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this object.
- */
-protected String
-paramString()
-{
- return ("label=" + label + ",state=" + state + ",group=" + group
- + "," + super.paramString());
-}
-
-/**
- * Gets the AccessibleContext associated with this Checkbox
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
-public AccessibleContext getAccessibleContext()
-{
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- {
- AccessibleAWTCheckbox ac = new AccessibleAWTCheckbox();
- accessibleContext = ac;
- addItemListener(ac);
- }
- return accessibleContext;
-}
-
- /**
- * Generate a unique name for this checkbox.
- *
- * @return A unique name for this checkbox.
- */
- String generateName()
- {
- return "checkbox" + getUniqueLong();
- }
-
- private static synchronized long getUniqueLong()
- {
- return next_checkbox_number++;
- }
-}
diff --git a/libjava/java/awt/CheckboxGroup.java b/libjava/java/awt/CheckboxGroup.java
deleted file mode 100644
index 31b573e654d..00000000000
--- a/libjava/java/awt/CheckboxGroup.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* CheckboxGroup.java -- A grouping class for checkboxes.
- Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This class if for combining checkboxes into groups so that only
- * one checkbox in the group can be selected at any one time.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@redhat.com)
- */
-public class CheckboxGroup implements java.io.Serializable
-{
-
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = 3729780091441768983L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The currently selected checkbox.
- */
-private Checkbox selectedCheckbox;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of CheckboxGroup
.
- */
-public
-CheckboxGroup()
-{
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the currently selected checkbox, or null
if none
- * of the checkboxes in this group are selected.
- *
- * @return The selected checkbox.
- */
-public Checkbox
-getSelectedCheckbox()
-{
- return getCurrent ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns the currently selected checkbox, or null
if none
- * of the checkboxes in this group are selected.
- *
- * @return The selected checkbox.
- *
- * @deprecated This method is deprecated in favor of
- * getSelectedCheckbox()
.
- */
-public Checkbox
-getCurrent()
-{
- return(selectedCheckbox);
-}
-
-/*************************************************************************/
-
-/**
- * This method sets the specified checkbox to be the selected on in this
- * group, and unsets all others.
- *
- * @param selectedCheckbox The new selected checkbox.
- */
-public void
-setSelectedCheckbox(Checkbox selectedCheckbox)
-{
- setCurrent (selectedCheckbox);
-}
-
-/*************************************************************************/
-
-/**
- * This method sets the specified checkbox to be the selected on in this
- * group, and unsets all others.
- *
- * @param selectedCheckbox The new selected checkbox.
- *
- * @deprecated This method is deprecated in favor of
- * setSelectedCheckbox()
.
- */
-public void
-setCurrent(Checkbox selectedCheckbox)
-{
- if (this.selectedCheckbox != null)
- {
- if (this.selectedCheckbox.getCheckboxGroup() != this)
- return;
-
- this.selectedCheckbox.setState(false);
- }
-
- this.selectedCheckbox = selectedCheckbox;
- if (selectedCheckbox != null)
- selectedCheckbox.setState(true);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this checkbox group.
- *
- * @return A string representation of this checkbox group.
- */
-public String
-toString()
-{
- return(getClass().getName() + "[selectedCheckbox=" + selectedCheckbox + "]");
-}
-
-} // class CheckboxGroup
-
diff --git a/libjava/java/awt/CheckboxMenuItem.java b/libjava/java/awt/CheckboxMenuItem.java
deleted file mode 100644
index 5e446b84c8b..00000000000
--- a/libjava/java/awt/CheckboxMenuItem.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/* CheckboxMenuItem.java -- A menu option with a checkbox on it.
- Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.peer.CheckboxMenuItemPeer;
-import java.util.EventListener;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleAction;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleValue;
-
-/**
- * This class implements a menu item that has a checkbox on it indicating
- * the selected state of some option.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@redhat.com)
- */
-public class CheckboxMenuItem extends MenuItem
- implements ItemSelectable, Accessible
-{
-
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = 6190621106981774043L;
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The state of the checkbox, with true
being on and
- * false
being off.
- */
-private boolean state;
-
-// List of registered ItemListeners
-private transient ItemListener item_listeners;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of CheckboxMenuItem
with no
- * label and an initial state of off.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
-public
-CheckboxMenuItem()
-{
- this("", false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of CheckboxMenuItem
with the
- * specified label and an initial state of off.
- *
- * @param label The label of the menu item.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
-public
-CheckboxMenuItem(String label)
-{
- this(label, false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of CheckboxMenuItem
with the
- * specified label and initial state.
- *
- * @param label The label of the menu item.
- * @param state The initial state of the menu item, where true
- * is on, and false
is off.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
-public
-CheckboxMenuItem(String label, boolean state)
-{
- super(label);
- this.state = state;
-
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the state of this menu item.
- *
- * @return The state of this menu item.
- */
-public boolean
-getState()
-{
- return(state);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the state of this menu item.
- *
- * @param state The initial state of the menu item, where true
- * is on, and false
is off.
- */
-public synchronized void
-setState(boolean state)
-{
- this.state = state;
- if (peer != null)
- {
- CheckboxMenuItemPeer cp = (CheckboxMenuItemPeer) peer;
- cp.setState (state);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns an array of length 1 with the menu item label for this object
- * if the state is on. Otherwise null
is returned.
- *
- * @return An array with this menu item's label if it has a state of on,
- * or null
otherwise.
- */
-public Object[]
-getSelectedObjects()
-{
- if (state == false)
- return(null);
-
- Object[] obj = new Object[1];
- obj[0] = getLabel();
-
- return(obj);
-}
-
-/*************************************************************************/
-
-/**
- * Create's this object's native peer
- */
-public synchronized void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit().createCheckboxMenuItem(this);
-
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified listener to the list of registered item listeners
- * for this object.
- *
- * @param listener The listener to add.
- */
-public synchronized void
-addItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.add(item_listeners, listener);
-
- enableEvents(AWTEvent.ITEM_EVENT_MASK);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified listener from the list of registered item
- * listeners for this object.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.remove(item_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified event by calling processItemEvent()
- * if it is an instance of ItemEvent
or calling the superclass
- * method otherwise.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof ItemEvent)
- processItemEvent((ItemEvent)event);
- else
- super.processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified event by dispatching it to any registered listeners.
- *
- * @param event The event to process.
- */
-protected void
-processItemEvent(ItemEvent event)
-{
- if (item_listeners != null)
- item_listeners.itemStateChanged(event);
-}
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e instanceof ItemEvent)
- {
- synchronized (this)
- {
- state = (((ItemEvent) e).getStateChange() == ItemEvent.SELECTED);
- }
- }
-
- if (e.id <= ItemEvent.ITEM_LAST
- && e.id >= ItemEvent.ITEM_FIRST
- && (item_listeners != null
- || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
-public String
-paramString()
-{
- return ("label=" + getLabel() + ",state=" + state
- + "," + super.paramString());
-}
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this CheckboxMenuItem
. FooListeners are registered using
- * the addFooListener method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements java.util.EventListener.
- */
- public EventListener[] getListeners (Class listenerType)
- {
- if (listenerType == ItemListener.class)
- return AWTEventMulticaster.getListeners (item_listeners, listenerType);
-
- return super.getListeners (listenerType);
- }
-
- /**
- * Returns an aray of all item listeners currently registered to this
- * CheckBoxMenuItem
.
- */
- public ItemListener[] getItemListeners ()
- {
- return (ItemListener[]) getListeners (ItemListener.class);
- }
-
-
- protected class AccessibleAWTCheckboxMenuItem extends AccessibleAWTMenuItem
- implements AccessibleAction, AccessibleValue
- {
- // I think the base class provides the necessary implementation
- }
-
- /**
- * Gets the AccessibleContext associated with this CheckboxMenuItem
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTCheckboxMenuItem();
- return accessibleContext;
- }
-
-} // class CheckboxMenuItem
-
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
deleted file mode 100644
index 5075ea92d83..00000000000
--- a/libjava/java/awt/Choice.java
+++ /dev/null
@@ -1,638 +0,0 @@
-/* Choice.java -- Java choice button widget.
- Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.peer.ChoicePeer;
-import java.io.Serializable;
-import java.util.EventListener;
-import java.util.Vector;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleAction;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * This class implements a drop down choice list.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Choice extends Component
- implements ItemSelectable, Serializable, Accessible
-{
-
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = -4075310674757313071L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial A list of items for the choice box, which can be null
.
- * This is package-private to avoid an accessor method.
- */
-Vector pItems = new Vector();
-
-/**
- * @serial The index of the selected item in the choice box.
- */
-private int selectedIndex = -1;
-
-// Listener chain
-private ItemListener item_listeners;
-
-/**
- * This class provides accessibility support for the
- * combo box.
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
- protected class AccessibleAWTChoice
- extends AccessibleAWTComponent
- implements AccessibleAction
- {
-
- /**
- * Serialization constant to match JDK 1.5
- */
- private static final long serialVersionUID = 7175603582428509322L;
-
- /**
- * Default constructor which simply calls the
- * super class for generic component accessibility
- * handling.
- */
- public AccessibleAWTChoice()
- {
- super();
- }
-
- /**
- * Returns an implementation of the AccessibleAction
- * interface for this accessible object. In this case, the
- * current instance is simply returned (with a more appropriate
- * type), as it also implements the accessible action as well as
- * the context.
- *
- * @return the accessible action associated with this context.
- * @see javax.accessibility.AccessibleAction
- */
- public AccessibleAction getAccessibleAction()
- {
- return this;
- }
-
- /**
- * Returns the role of this accessible object.
- *
- * @return the instance of AccessibleRole
,
- * which describes this object.
- * @see javax.accessibility.AccessibleRole
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.COMBO_BOX;
- }
-
- /**
- * Returns the number of actions associated with this accessible
- * object. In this case, it is the number of choices available.
- *
- * @return the number of choices available.
- * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
- */
- public int getAccessibleActionCount()
- {
- return pItems.size();
- }
-
- /**
- * Returns a description of the action with the supplied id.
- * In this case, it is the text used in displaying the particular
- * choice on-screen.
- *
- * @param i the id of the choice whose description should be
- * retrieved.
- * @return the String
used to describe the choice.
- * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
- */
- public String getAccessibleActionDescription(int i)
- {
- return (String) pItems.get(i);
- }
-
- /**
- * Executes the action with the specified id. In this case,
- * calling this method provides the same behaviour as would
- * choosing a choice from the list in a visual manner.
- *
- * @param i the id of the choice to select.
- * @return true if a valid choice was specified.
- * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
- */
- public boolean doAccessibleAction(int i)
- {
- if (i < 0 || i >= pItems.size())
- return false;
-
- Choice.this.processItemEvent(new ItemEvent(Choice.this,
- ItemEvent.ITEM_STATE_CHANGED,
- this, ItemEvent.SELECTED));
- return true;
- }
- }
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
- /**
- * Initializes a new instance of Choice
.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true
- */
- public Choice()
- {
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
- }
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the number of items in the list.
- *
- * @return The number of items in the list.
- */
-public int
-getItemCount()
-{
- return countItems ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns the number of items in the list.
- *
- * @return The number of items in the list.
- *
- * @deprecated This method is deprecated in favor of getItemCount
.
- */
-public int
-countItems()
-{
- return(pItems.size());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the item at the specified index in the list.
- *
- * @param index The index into the list to return the item from.
- *
- * @exception ArrayIndexOutOfBoundsException If the index is invalid.
- */
-public String
-getItem(int index)
-{
- return((String)pItems.elementAt(index));
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified item to this choice box.
- *
- * @param item The item to add.
- *
- * @exception NullPointerException If the item's value is null
- *
- * @since 1.1
- */
-public synchronized void
-add(String item)
-{
- if (item == null)
- throw new NullPointerException ("item must be non-null");
-
- pItems.addElement(item);
-
- int i = pItems.size () - 1;
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.add (item, i);
- }
- else if (selectedIndex == -1)
- select(0);
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified item to this choice box.
- *
- * This method is oboslete since Java 2 platform 1.1. Please use @see add
- * instead.
- *
- * @param item The item to add.
- *
- * @exception NullPointerException If the item's value is equal to null
- */
-public synchronized void
-addItem(String item)
-{
- add(item);
-}
-
-/*************************************************************************/
-
-/** Inserts an item into this Choice. Existing items are shifted
- * upwards. If the new item is the only item, then it is selected.
- * If the currently selected item is shifted, then the first item is
- * selected. If the currently selected item is not shifted, then it
- * remains selected.
- *
- * @param item The item to add.
- * @param index The index at which the item should be inserted.
- *
- * @exception IllegalArgumentException If index is less than 0
- */
-public synchronized void
-insert(String item, int index)
-{
- if (index < 0)
- throw new IllegalArgumentException ("index may not be less then 0");
-
- if (index > getItemCount ())
- index = getItemCount ();
-
- pItems.insertElementAt(item, index);
-
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.add (item, index);
- }
- else if (selectedIndex == -1 || selectedIndex >= index)
- select(0);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified item from the choice box.
- *
- * @param item The item to remove.
- *
- * @exception IllegalArgumentException If the specified item doesn't exist.
- */
-public synchronized void
-remove(String item)
-{
- int index = pItems.indexOf(item);
- if (index == -1)
- throw new IllegalArgumentException ("item \""
- + item + "\" not found in Choice");
- remove(index);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the item at the specified index from the choice box.
- *
- * @param index The index of the item to remove.
- *
- * @exception IndexOutOfBoundsException If the index is not valid.
- */
-public synchronized void
-remove(int index)
-{
- if ((index < 0) || (index > getItemCount()))
- throw new IllegalArgumentException("Bad index: " + index);
-
- pItems.removeElementAt(index);
-
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.remove (index);
- }
- else
- {
- if (getItemCount() == 0)
- selectedIndex = -1;
- else if (index == selectedIndex)
- select(0);
- }
-
- if (selectedIndex > index)
- --selectedIndex;
-}
-
-/*************************************************************************/
-
-/**
- * Removes all of the objects from this choice box.
- */
-public synchronized void
-removeAll()
-{
- if (getItemCount() <= 0)
- return;
-
- pItems.removeAllElements ();
-
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.removeAll ();
- }
-
- selectedIndex = -1;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the currently selected item, or null if no item is
- * selected.
- *
- * @return The currently selected item.
- */
-public synchronized String
-getSelectedItem()
-{
- return (selectedIndex == -1
- ? null
- : ((String)pItems.elementAt(selectedIndex)));
-}
-
-/*************************************************************************/
-
-/**
- * Returns an array with one row containing the selected item.
- *
- * @return An array containing the selected item.
- */
-public synchronized Object[]
-getSelectedObjects()
-{
- if (selectedIndex == -1)
- return null;
-
- Object[] objs = new Object[1];
- objs[0] = pItems.elementAt(selectedIndex);
-
- return(objs);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the index of the selected item.
- *
- * @return The index of the selected item.
- */
-public int
-getSelectedIndex()
-{
- return(selectedIndex);
-}
-
-/*************************************************************************/
-
-/**
- * Forces the item at the specified index to be selected.
- *
- * @param index The index of the row to make selected.
- *
- * @exception IllegalArgumentException If the specified index is invalid.
- */
-public synchronized void
-select(int index)
-{
- if ((index < 0) || (index > getItemCount()))
- throw new IllegalArgumentException("Bad index: " + index);
-
- this.selectedIndex = index;
- if (peer != null)
- {
- ChoicePeer cp = (ChoicePeer) peer;
- cp.select (index);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Forces the named item to be selected.
- *
- * @param item The item to be selected.
- *
- * @exception IllegalArgumentException If the specified item does not exist.
- */
-public synchronized void
-select(String item)
-{
- int index = pItems.indexOf(item);
- if (index >= 0)
- select(index);
-}
-
-/*************************************************************************/
-
-/**
- * Creates the native peer for this object.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createChoice (this);
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified listener to the list of registered listeners for
- * this object.
- *
- * @param listener The listener to add.
- */
-public synchronized void
-addItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.add(item_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified listener from the list of registered listeners for
- * this object.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.remove(item_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Processes this event by invoking processItemEvent()
if the
- * event is an instance of ItemEvent
, otherwise the event
- * is passed to the superclass.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof ItemEvent)
- processItemEvent((ItemEvent)event);
- else
- super.processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * Processes item event by dispatching to any registered listeners.
- *
- * @param event The event to process.
- */
-protected void
-processItemEvent(ItemEvent event)
-{
- if (item_listeners != null)
- item_listeners.itemStateChanged(event);
-}
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= ItemEvent.ITEM_LAST
- && e.id >= ItemEvent.ITEM_FIRST
- && (item_listeners != null
- || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
-protected String
-paramString()
-{
- return ("selectedIndex=" + selectedIndex + "," + super.paramString());
-}
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this Choice. FooListeners are registered using the addFooListener
- * method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements java.util.EventListener.
- *
- * @since 1.3
- */
- public EventListener[] getListeners (Class listenerType)
- {
- if (listenerType == ItemListener.class)
- return AWTEventMulticaster.getListeners (item_listeners, listenerType);
-
- return super.getListeners (listenerType);
- }
-
- /**
- * Returns all registered item listeners.
- *
- * @since 1.4
- */
- public ItemListener[] getItemListeners ()
- {
- return (ItemListener[]) getListeners (ItemListener.class);
- }
-
- /**
- * Gets the AccessibleContext associated with this Choice
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTChoice();
- return accessibleContext;
- }
-} // class Choice
diff --git a/libjava/java/awt/Color.java b/libjava/java/awt/Color.java
deleted file mode 100644
index 4ad46d0c07c..00000000000
--- a/libjava/java/awt/Color.java
+++ /dev/null
@@ -1,1008 +0,0 @@
-/* Color.java -- represents a color in Java
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.color.ColorSpace;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.ColorModel;
-import java.io.Serializable;
-
-/**
- * This class represents a color value in the AWT system. It uses the sRGB
- * (standard Red-Green-Blue) system, along with an alpha value ranging from
- * transparent (0.0f or 0) and opaque (1.0f or 255). The color is not
- * pre-multiplied by the alpha value an any of the accessor methods. Further
- * information about sRGB can be found at
- *
- * http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ColorSpace
- * @see AlphaComposite
- * @since 1.0
- * @status updated to 1.4
- */
-public class Color implements Paint, Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 118526816881161077L;
-
- /** Constant for the color white: R=255, G=255, B=255. */
- public static final Color white = new Color(0xffffff, false);
-
- /**
- * Constant for the color white: R=255, G=255, B=255.
- *
- * @since 1.4
- */
- public static final Color WHITE = white;
-
- /** Constant for the color light gray: R=192, G=192, B=192. */
- public static final Color lightGray = new Color(0xc0c0c0, false);
-
- /**
- * Constant for the color light gray: R=192, G=192, B=192.
- *
- * @since 1.4
- */
- public static final Color LIGHT_GRAY = lightGray;
-
- /** Constant for the color gray: R=128, G=128, B=128. */
- public static final Color gray = new Color(0x808080, false);
-
- /**
- * Constant for the color gray: R=128, G=128, B=128.
- *
- * @since 1.4
- */
- public static final Color GRAY = gray;
-
- /** Constant for the color dark gray: R=64, G=64, B=64. */
- public static final Color darkGray = new Color(0x404040, false);
-
- /**
- * Constant for the color dark gray: R=64, G=64, B=64.
- *
- * @since 1.4
- */
- public static final Color DARK_GRAY = darkGray;
-
- /** Constant for the color black: R=0, G=0, B=0. */
- public static final Color black = new Color(0x000000, false);
-
- /**
- * Constant for the color black: R=0, G=0, B=0.
- *
- * @since 1.4
- */
- public static final Color BLACK = black;
-
- /** Constant for the color red: R=255, G=0, B=0. */
- public static final Color red = new Color(0xff0000, false);
-
- /**
- * Constant for the color red: R=255, G=0, B=0.
- *
- * @since 1.4
- */
- public static final Color RED = red;
-
- /** Constant for the color pink: R=255, G=175, B=175. */
- public static final Color pink = new Color(0xffafaf, false);
-
- /**
- * Constant for the color pink: R=255, G=175, B=175.
- *
- * @since 1.4
- */
- public static final Color PINK = pink;
-
- /** Constant for the color orange: R=255, G=200, B=0. */
- public static final Color orange = new Color(0xffc800, false);
-
- /**
- * Constant for the color orange: R=255, G=200, B=0.
- *
- * @since 1.4
- */
- public static final Color ORANGE = orange;
-
- /** Constant for the color yellow: R=255, G=255, B=0. */
- public static final Color yellow = new Color(0xffff00, false);
-
- /**
- * Constant for the color yellow: R=255, G=255, B=0.
- *
- * @since 1.4
- */
- public static final Color YELLOW = yellow;
-
- /** Constant for the color green: R=0, G=255, B=0. */
- public static final Color green = new Color(0x00ff00, false);
-
- /**
- * Constant for the color green: R=0, G=255, B=0.
- *
- * @since 1.4
- */
- public static final Color GREEN = green;
-
- /** Constant for the color magenta: R=255, G=0, B=255. */
- public static final Color magenta = new Color(0xff00ff, false);
-
- /**
- * Constant for the color magenta: R=255, G=0, B=255.
- *
- * @since 1.4
- */
- public static final Color MAGENTA = magenta;
-
- /** Constant for the color cyan: R=0, G=255, B=255. */
- public static final Color cyan = new Color(0x00ffff, false);
-
- /**
- * Constant for the color cyan: R=0, G=255, B=255.
- *
- * @since 1.4
- */
- public static final Color CYAN = cyan;
-
- /** Constant for the color blue: R=0, G=0, B=255. */
- public static final Color blue = new Color(0x0000ff, false);
-
- /**
- * Constant for the color blue: R=0, G=0, B=255.
- *
- * @since 1.4
- */
- public static final Color BLUE = blue;
-
- /** Internal mask for red. */
- private static final int RED_MASK = 255 << 16;
-
- /** Internal mask for green. */
- private static final int GREEN_MASK = 255 << 8;
-
- /** Internal mask for blue. */
- private static final int BLUE_MASK = 255;
-
- /** Internal mask for alpha. Package visible for use in subclass. */
- static final int ALPHA_MASK = 255 << 24;
-
- /** Amount to scale a color by when brightening or darkening. */
- private static final float BRIGHT_SCALE = 0.7f;
-
- /**
- * The color value, in sRGB. Note that the actual color may be more
- * precise if frgbvalue or fvalue is non-null. This class stores alpha, red,
- * green, and blue, each 0-255, packed in an int. However, the subclass
- * SystemColor stores an index into an array. Therefore, for serial
- * compatibility (and because of poor design on Sun's part), this value
- * cannot be used directly; instead you must use getRGB()
.
- *
- * @see #getRGB()
- * @serial the value of the color, whether an RGB literal or array index
- */
- final int value;
-
- /**
- * The color value, in sRGB. This may be null if the color was constructed
- * with ints; and it does not include alpha. This stores red, green, and
- * blue, in the range 0.0f - 1.0f.
- *
- * @see #getRGBColorComponents(float[])
- * @see #getRGBComponents(float[])
- * @serial the rgb components of the value
- * @since 1.2
- */
- private float[] frgbvalue;
-
- /**
- * The color value, in the native ColorSpace components. This may be null
- * if the color was constructed with ints or in the sRGB color space; and
- * it does not include alpha.
- *
- * @see #getRGBColorComponents(float[])
- * @see #getRGBComponents(float[])
- * @serial the original color space components of the color
- * @since 1.2
- */
- private float[] fvalue;
-
- /**
- * The alpha value. This is in the range 0.0f - 1.0f, but is invalid if
- * deserialized as 0.0 when frgbvalue is null.
- *
- * @see #getRGBComponents(float[])
- * @see #getComponents(float[])
- * @serial the alpha component of this color
- * @since 1.2
- */
- private final float falpha;
-
- /**
- * The ColorSpace. Null means the default sRGB space.
- *
- * @see #getColor(String)
- * @see #getColorSpace()
- * @see #getColorComponents(float[])
- * @serial the color space for this color
- * @since 1.2
- */
- private final ColorSpace cs;
-
- /**
- * The paint context for this solid color. Package visible for use in
- * subclass.
- */
- transient ColorPaintContext context;
-
- /**
- * Initializes a new instance of Color
using the specified
- * red, green, and blue values, which must be given as integers in the
- * range of 0-255. Alpha will default to 255 (opaque). When drawing to
- * screen, the actual color may be adjusted to the best match of hardware
- * capabilities.
- *
- * @param red the red component of the RGB value
- * @param green the green component of the RGB value
- * @param blue the blue component of the RGB value
- * @throws IllegalArgumentException if the values are out of range 0-255
- * @see #getRed()
- * @see #getGreen()
- * @see #getBlue()
- * @see #getRGB()
- * @see #Color(int, int, int, int)
- */
- public Color(int red, int green, int blue)
- {
- this(red, green, blue, 255);
- }
-
- /**
- * Initializes a new instance of Color
using the specified
- * red, green, blue, and alpha values, which must be given as integers in
- * the range of 0-255. When drawing to screen, the actual color may be
- * adjusted to the best match of hardware capabilities.
- *
- * @param red the red component of the RGB value
- * @param green the green component of the RGB value
- * @param blue the blue component of the RGB value
- * @param alpha the alpha value of the color
- * @throws IllegalArgumentException if the values are out of range 0-255
- * @see #getRed()
- * @see #getGreen()
- * @see #getBlue()
- * @see #getAlpha()
- * @see #getRGB()
- */
- public Color(int red, int green, int blue, int alpha)
- {
- if ((red & 255) != red || (green & 255) != green || (blue & 255) != blue
- || (alpha & 255) != alpha)
- throw new IllegalArgumentException("Bad RGB values"
- +" red=0x"+Integer.toHexString(red)
- +" green=0x"+Integer.toHexString(green)
- +" blue=0x"+Integer.toHexString(blue)
- +" alpha=0x"+Integer.toHexString(alpha) );
-
- value = (alpha << 24) | (red << 16) | (green << 8) | blue;
- falpha = 1;
- cs = null;
- }
-
- /**
- * Initializes a new instance of Color
using the specified
- * RGB value. The blue value is in bits 0-7, green in bits 8-15, and
- * red in bits 16-23. The other bits are ignored. The alpha value is set
- * to 255 (opaque). When drawing to screen, the actual color may be
- * adjusted to the best match of hardware capabilities.
- *
- * @param value the RGB value
- * @see ColorModel#getRGBdefault()
- * @see #getRed()
- * @see #getGreen()
- * @see #getBlue()
- * @see #getRGB()
- * @see #Color(int, boolean)
- */
- public Color(int value)
- {
- this(value, false);
- }
-
- /**
- * Initializes a new instance of Color
using the specified
- * RGB value. The blue value is in bits 0-7, green in bits 8-15, and
- * red in bits 16-23. The alpha value is in bits 24-31, unless hasalpha
- * is false, in which case alpha is set to 255. When drawing to screen, the
- * actual color may be adjusted to the best match of hardware capabilities.
- *
- * @param value the RGB value
- * @param hasalpha true if value includes the alpha
- * @see ColorModel#getRGBdefault()
- * @see #getRed()
- * @see #getGreen()
- * @see #getBlue()
- * @see #getAlpha()
- * @see #getRGB()
- */
- public Color(int value, boolean hasalpha)
- {
- // Note: SystemColor calls this constructor, setting falpha to 0; but
- // code in getRGBComponents correctly reports falpha as 1.0 to the user
- // for all instances of SystemColor since frgbvalue is left null here.
- if (hasalpha)
- falpha = ((value & ALPHA_MASK) >> 24) / 255f;
- else
- {
- value |= ALPHA_MASK;
- falpha = 1;
- }
- this.value = value;
- cs = null;
- }
-
- /**
- * Initializes a new instance of Color
using the specified
- * RGB values. These must be in the range of 0.0-1.0. Alpha is assigned
- * the value of 1.0 (opaque). When drawing to screen, the actual color may
- * be adjusted to the best match of hardware capabilities.
- *
- * @param red the red component of the RGB value
- * @param green the green component of the RGB value
- * @param blue the blue component of the RGB value
- * @throws IllegalArgumentException tf the values are out of range 0.0f-1.0f
- * @see #getRed()
- * @see #getGreen()
- * @see #getBlue()
- * @see #getRGB()
- * @see #Color(float, float, float, float)
- */
- public Color(float red, float green, float blue)
- {
- this(red, green, blue, 1.0f);
- }
-
- /**
- * Initializes a new instance of Color
using the specified
- * RGB and alpha values. These must be in the range of 0.0-1.0. When drawing
- * to screen, the actual color may be adjusted to the best match of
- * hardware capabilities.
- *
- * @param red the red component of the RGB value
- * @param green the green component of the RGB value
- * @param blue the blue component of the RGB value
- * @param alpha the alpha value of the color
- * @throws IllegalArgumentException tf the values are out of range 0.0f-1.0f
- * @see #getRed()
- * @see #getGreen()
- * @see #getBlue()
- * @see #getAlpha()
- * @see #getRGB()
- */
- public Color(float red, float green, float blue, float alpha)
- {
- value = convert(red, green, blue, alpha);
- frgbvalue = new float[] {red, green, blue};
- falpha = alpha;
- cs = null;
- }
-
- /**
- * Creates a color in the given ColorSpace with the specified alpha. The
- * array must be non-null and have enough elements for the color space
- * (for example, RGB requires 3 elements, CMYK requires 4). When drawing
- * to screen, the actual color may be adjusted to the best match of
- * hardware capabilities.
- *
- * @param space the color space of components
- * @param components the color components, except alpha
- * @param alpha the alpha value of the color
- * @throws NullPointerException if cpsace or components is null
- * @throws ArrayIndexOutOfBoundsException if components is too small
- * @throws IllegalArgumentException if alpha or any component is out of range
- * @see #getComponents(float[])
- * @see #getColorComponents(float[])
- */
- public Color(ColorSpace space, float[] components, float alpha)
- {
- frgbvalue = space.toRGB(components);
- fvalue = components;
- falpha = alpha;
- cs = space;
- value = convert(frgbvalue[0], frgbvalue[1], frgbvalue[2], alpha);
- }
-
- /**
- * Returns the red value for this color, as an integer in the range 0-255
- * in the sRGB color space.
- *
- * @return the red value for this color
- * @see #getRGB()
- */
- public int getRed()
- {
- // Do not inline getRGB() to value, because of SystemColor.
- return (getRGB() & RED_MASK) >> 16;
- }
-
- /**
- * Returns the green value for this color, as an integer in the range 0-255
- * in the sRGB color space.
- *
- * @return the green value for this color
- * @see #getRGB()
- */
- public int getGreen()
- {
- // Do not inline getRGB() to value, because of SystemColor.
- return (getRGB() & GREEN_MASK) >> 8;
- }
-
- /**
- * Returns the blue value for this color, as an integer in the range 0-255
- * in the sRGB color space.
- *
- * @return the blue value for this color
- * @see #getRGB()
- */
- public int getBlue()
- {
- // Do not inline getRGB() to value, because of SystemColor.
- return getRGB() & BLUE_MASK;
- }
-
- /**
- * Returns the alpha value for this color, as an integer in the range 0-255.
- *
- * @return the alpha value for this color
- * @see #getRGB()
- */
- public int getAlpha()
- {
- // Do not inline getRGB() to value, because of SystemColor.
- return (getRGB() & ALPHA_MASK) >>> 24;
- }
-
- /**
- * Returns the RGB value for this color, in the sRGB color space. The blue
- * value will be in bits 0-7, green in 8-15, red in 16-23, and alpha value in
- * 24-31.
- *
- * @return the RGB value for this color
- * @see ColorModel#getRGBdefault()
- * @see #getRed()
- * @see #getGreen()
- * @see #getBlue()
- * @see #getAlpha()
- */
- public int getRGB()
- {
- return value;
- }
-
- /**
- * Returns a brighter version of this color. This is done by increasing the
- * RGB values by an arbitrary scale factor. The new color is opaque (an
- * alpha of 255). Note that this method and the darker()
- * method are not necessarily inverses.
- *
- * @return a brighter version of this color
- * @see #darker()
- */
- public Color brighter()
- {
- // Do not inline getRGB() to this.value, because of SystemColor.
- int value = getRGB();
- int red = (value & RED_MASK) >> 16;
- int green = (value & GREEN_MASK) >> 8;
- int blue = value & BLUE_MASK;
- // We have to special case 0-2 because they won't scale by division.
- red = red < 3 ? 3 : (int) Math.min(255, red / BRIGHT_SCALE);
- green = green < 3 ? 3 : (int) Math.min(255, green / BRIGHT_SCALE);
- blue = blue < 3 ? 3 : (int) Math.min(255, blue / BRIGHT_SCALE);
- return new Color(red, green, blue, 255);
- }
-
- /**
- * Returns a darker version of this color. This is done by decreasing the
- * RGB values by an arbitrary scale factor. The new color is opaque (an
- * alpha of 255). Note that this method and the brighter()
- * method are not necessarily inverses.
- *
- * @return a darker version of this color
- * @see #brighter()
- */
- public Color darker()
- {
- // Do not inline getRGB() to this.value, because of SystemColor.
- int value = getRGB();
- return new Color((int) (((value & RED_MASK) >> 16) * BRIGHT_SCALE),
- (int) (((value & GREEN_MASK) >> 8) * BRIGHT_SCALE),
- (int) ((value & BLUE_MASK) * BRIGHT_SCALE), 255);
- }
-
- /**
- * Returns a hash value for this color. This is simply the color in 8-bit
- * precision, in the format 0xAARRGGBB (alpha, red, green, blue).
- *
- * @return a hash value for this color
- */
- public int hashCode()
- {
- return value;
- }
-
- /**
- * Tests this object for equality against the specified object. This will
- * be true if and only if the specified object is an instance of
- * Color
and has the same 8-bit integer red, green, and blue
- * values as this object. Note that two colors may be slightly different
- * as float values, but round to the same integer values. Also note that
- * this does not accurately compare SystemColors, since that class does
- * not store its internal data in RGB format like regular colors.
- *
- * @param obj the object to compare to
- * @return true if the specified object is semantically equal to this one
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Color && ((Color) obj).value == value;
- }
-
- /**
- * Returns a string representation of this object. Subclasses may return
- * any desired format, except for null, but this implementation returns
- * getClass().getName() + "[r=" + getRed() + ",g=" + getGreen()
- * + ",b=" + getBlue() + ']'
.
- *
- * @return a string representation of this object
- */
- public String toString()
- {
- return getClass().getName() + "[r=" + ((value & RED_MASK) >> 16)
- + ",g=" + ((value & GREEN_MASK) >> 8) + ",b=" + (value & BLUE_MASK)
- + ']';
- }
-
- /**
- * Converts the specified string to a number, using Integer.decode, and
- * creates a new instance of Color
from the value. The alpha
- * value will be 255 (opaque).
- *
- * @param str the numeric color string
- * @return a new instance of Color
for the string
- * @throws NumberFormatException if the string cannot be parsed
- * @throws NullPointerException if the string is null
- * @see Integer#decode(String)
- * @see #Color(int)
- * @since 1.1
- */
- public static Color decode(String str)
- {
- return new Color(Integer.decode(str).intValue(), false);
- }
-
- /**
- * Returns a new instance of Color
from the value of the
- * system property named by the specified string. If the property does not
- * exist, or cannot be parsed, then null
will be returned.
- *
- * @param prop the system property to retrieve
- * @throws SecurityException if getting the property is denied
- * @see #getColor(String, Color)
- * @see Integer#getInteger(String)
- */
- public static Color getColor(String prop)
- {
- return getColor(prop, null);
- }
-
- /**
- * Returns a new instance of Color
from the value of the
- * system property named by the specified string. If the property does
- * not exist, or cannot be parsed, then the default color value will be
- * returned.
- *
- * @param prop the system property to retrieve
- * @param defcolor the default color
- * @throws SecurityException if getting the property is denied
- * @see Integer#getInteger(String)
- */
- public static Color getColor(String prop, Color defcolor)
- {
- Integer val = Integer.getInteger(prop, null);
- return val == null ? defcolor
- : new Color(val.intValue(), false);
- }
-
- /**
- * Returns a new instance of Color
from the value of the
- * system property named by the specified string. If the property does
- * not exist, or cannot be parsed, then the default RGB value will be
- * used to create a return value.
- *
- * @param prop the system property to retrieve
- * @param defrgb the default RGB value
- * @throws SecurityException if getting the property is denied
- * @see #getColor(String, Color)
- * @see Integer#getInteger(String, int)
- */
- public static Color getColor(String prop, int defrgb)
- {
- Color c = getColor(prop, null);
- return c == null ? new Color(defrgb, false) : c;
- }
-
- /**
- * Converts from the HSB (hue, saturation, brightness) color model to the
- * RGB (red, green, blue) color model. The hue may be any floating point;
- * it's fractional portion is used to select the angle in the HSB model.
- * The saturation and brightness must be between 0 and 1. The result is
- * suitable for creating an RGB color with the one-argument constructor.
- *
- * @param hue the hue of the HSB value
- * @param saturation the saturation of the HSB value
- * @param brightness the brightness of the HSB value
- * @return the RGB value
- * @see #getRGB()
- * @see #Color(int)
- * @see ColorModel#getRGBdefault()
- */
- public static int HSBtoRGB(float hue, float saturation, float brightness)
- {
- if (saturation == 0)
- return convert(brightness, brightness, brightness, 0);
- if (saturation < 0 || saturation > 1 || brightness < 0 || brightness > 1)
- throw new IllegalArgumentException();
- hue = hue - (float) Math.floor(hue);
- int i = (int) (6 * hue);
- float f = 6 * hue - i;
- float p = brightness * (1 - saturation);
- float q = brightness * (1 - saturation * f);
- float t = brightness * (1 - saturation * (1 - f));
- switch (i)
- {
- case 0:
- return convert(brightness, t, p, 0);
- case 1:
- return convert(q, brightness, p, 0);
- case 2:
- return convert(p, brightness, t, 0);
- case 3:
- return convert(p, q, brightness, 0);
- case 4:
- return convert(t, p, brightness, 0);
- case 5:
- return convert(brightness, p, q, 0);
- default:
- throw new InternalError("impossible");
- }
- }
-
- /**
- * Converts from the RGB (red, green, blue) color model to the HSB (hue,
- * saturation, brightness) color model. If the array is null, a new one
- * is created, otherwise it is recycled. The results will be in the range
- * 0.0-1.0 if the inputs are in the range 0-255.
- *
- * @param red the red part of the RGB value
- * @param green the green part of the RGB value
- * @param blue the blue part of the RGB value
- * @param array an array for the result (at least 3 elements), or null
- * @return the array containing HSB value
- * @throws ArrayIndexOutOfBoundsException of array is too small
- * @see #getRGB()
- * @see #Color(int)
- * @see ColorModel#getRGBdefault()
- */
- public static float[] RGBtoHSB(int red, int green, int blue, float array[])
- {
- if (array == null)
- array = new float[3];
- // Calculate brightness.
- int min;
- int max;
- if (red < green)
- {
- min = red;
- max = green;
- }
- else
- {
- min = green;
- max = red;
- }
- if (blue > max)
- max = blue;
- else if (blue < min)
- min = blue;
- array[2] = max / 255f;
- // Calculate saturation.
- if (max == 0)
- array[1] = 0;
- else
- array[1] = (max - min) / max;
- // Calculate hue.
- if (array[1] == 0)
- array[0] = 0;
- else
- {
- float delta = (max - min) * 6;
- if (red == max)
- array[0] = (green - blue) / delta;
- else if (green == max)
- array[0] = 1f / 3 + (blue - red) / delta;
- else
- array[0] = 2f / 3 + (red - green) / delta;
- if (array[0] < 0)
- array[0]++;
- }
- return array;
- }
-
- /**
- * Returns a new instance of Color
based on the specified
- * HSB values. The hue may be any floating point; it's fractional portion
- * is used to select the angle in the HSB model. The saturation and
- * brightness must be between 0 and 1.
- *
- * @param hue the hue of the HSB value
- * @param saturation the saturation of the HSB value
- * @param brightness the brightness of the HSB value
- * @return the new Color
object
- */
- public static Color getHSBColor(float hue, float saturation,
- float brightness)
- {
- return new Color(HSBtoRGB(hue, saturation, brightness), false);
- }
-
- /**
- * Returns a float array with the red, green, and blue components, and the
- * alpha value, in the default sRGB space, with values in the range 0.0-1.0.
- * If the array is null, a new one is created, otherwise it is recycled.
- *
- * @param array the array to put results into (at least 4 elements), or null
- * @return the RGB components and alpha value
- * @throws ArrayIndexOutOfBoundsException if array is too small
- */
- public float[] getRGBComponents(float[] array)
- {
- if (array == null)
- array = new float[4];
- getRGBColorComponents(array);
- // Stupid serialization issues require this check.
- array[3] = (falpha == 0 && frgbvalue == null
- ? ((getRGB() & ALPHA_MASK) >> 24) / 255f : falpha);
- return array;
- }
-
- /**
- * Returns a float array with the red, green, and blue components, in the
- * default sRGB space, with values in the range 0.0-1.0. If the array is
- * null, a new one is created, otherwise it is recycled.
- *
- * @param array the array to put results into (at least 3 elements), or null
- * @return the RGB components
- * @throws ArrayIndexOutOfBoundsException if array is too small
- */
- public float[] getRGBColorComponents(float[] array)
- {
- if (array == null)
- array = new float[3];
- else if (array == frgbvalue)
- return array; // Optimization for getColorComponents(float[]).
- if (frgbvalue == null)
- {
- // Do not inline getRGB() to this.value, because of SystemColor.
- int value = getRGB();
- frgbvalue = new float[] { ((value & RED_MASK) >> 16) / 255f,
- ((value & GREEN_MASK) >> 8) / 255f,
- (value & BLUE_MASK) / 255f };
- }
- array[0] = frgbvalue[0];
- array[1] = frgbvalue[1];
- array[2] = frgbvalue[2];
- return array;
- }
-
- /**
- * Returns a float array containing the color and alpha components of this
- * color in the ColorSpace it was created with (the constructors which do
- * not take a ColorSpace parameter use a default sRGB ColorSpace). If the
- * array is null, a new one is created, otherwise it is recycled, and must
- * have at least one more position than components used in the color space.
- *
- * @param array the array to put results into, or null
- * @return the original color space components and alpha value
- * @throws ArrayIndexOutOfBoundsException if array is too small
- */
- public float[] getComponents(float[] array)
- {
- int numComponents = cs == null ? 3 : cs.getNumComponents();
- if (array == null)
- array = new float[1 + numComponents];
- getColorComponents(array);
- // Stupid serialization issues require this check.
- array[numComponents] = (falpha == 0 && frgbvalue == null
- ? ((getRGB() & ALPHA_MASK) >> 24) / 255f : falpha);
- return array;
- }
-
- /**
- * Returns a float array containing the color components of this color in
- * the ColorSpace it was created with (the constructors which do not take
- * a ColorSpace parameter use a default sRGB ColorSpace). If the array is
- * null, a new one is created, otherwise it is recycled, and must have at
- * least as many positions as used in the color space.
- *
- * @param array the array to put results into, or null
- * @return the original color space components
- * @throws ArrayIndexOutOfBoundsException if array is too small
- */
- public float[] getColorComponents(float[] array)
- {
- int numComponents = cs == null ? 3 : cs.getNumComponents();
- if (array == null)
- array = new float[numComponents];
- if (fvalue == null) // If fvalue is null, cs should be null too.
- fvalue = getRGBColorComponents(frgbvalue);
- System.arraycopy(fvalue, 0, array, 0, numComponents);
- return array;
- }
-
- /**
- * Returns a float array containing the color and alpha components of this
- * color in the given ColorSpace. If the array is null, a new one is
- * created, otherwise it is recycled, and must have at least one more
- * position than components used in the color space.
- *
- * @param space the color space to translate to
- * @param array the array to put results into, or null
- * @return the color space components and alpha value
- * @throws ArrayIndexOutOfBoundsException if array is too small
- * @throws NullPointerException if space is null
- */
- public float[] getComponents(ColorSpace space, float[] array)
- {
- int numComponents = space.getNumComponents();
- if (array == null)
- array = new float[1 + numComponents];
- getColorComponents(space, array);
- // Stupid serialization issues require this check.
- array[numComponents] = (falpha == 0 && frgbvalue == null
- ? ((getRGB() & ALPHA_MASK) >> 24) / 255f : falpha);
- return array;
- }
-
- /**
- * Returns a float array containing the color components of this color in
- * the given ColorSpace. If the array is null, a new one is created,
- * otherwise it is recycled, and must have at least as many positions as
- * used in the color space.
- *
- * @param space the color space to translate to
- * @return the color space components
- * @throws ArrayIndexOutOfBoundsException if array is too small
- * @throws NullPointerException if space is null
- */
- public float[] getColorComponents(ColorSpace space, float[] array)
- {
- float[] components = space.fromRGB(getRGBColorComponents(frgbvalue));
- if (array == null)
- return components;
- System.arraycopy(components, 0, array, 0, components.length);
- return array;
- }
-
- /**
- * Returns the color space of this color. Except for the constructor which
- * takes a ColorSpace argument, this will be an implementation of
- * ColorSpace.CS_sRGB.
- *
- * @return the color space
- */
- public ColorSpace getColorSpace()
- {
- return cs == null ? ColorSpace.getInstance(ColorSpace.CS_sRGB) : cs;
- }
-
- /**
- * Returns a paint context, used for filling areas of a raster scan with
- * this color. Since the color is constant across the entire rectangle, and
- * since it is always in sRGB space, this implementation returns the same
- * object, regardless of the parameters. Subclasses, however, may have a
- * mutable result.
- *
- * @param cm the requested color model
- * @param deviceBounds the bounding box in device coordinates, ignored
- * @param userBounds the bounding box in user coordinates, ignored
- * @param xform the bounds transformation, ignored
- * @param hints any rendering hints, ignored
- * @return a context for painting this solid color
- */
- public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
- Rectangle2D userBounds,
- AffineTransform xform,
- RenderingHints hints)
- {
- if (context == null || !context.getColorModel().equals(cm))
- context = new ColorPaintContext(cm,value);
- return context;
- }
-
- /**
- * Returns the transparency level of this color.
- *
- * @return one of {@link #OPAQUE}, {@link #BITMASK}, or {@link #TRANSLUCENT}
- */
- public int getTransparency()
- {
- // Do not inline getRGB() to this.value, because of SystemColor.
- int alpha = getRGB() & ALPHA_MASK;
- return alpha == (255 << 24) ? OPAQUE : alpha == 0 ? BITMASK : TRANSLUCENT;
- }
-
- /**
- * Converts float values to integer value.
- *
- * @param red the red value
- * @param green the green value
- * @param blue the blue value
- * @param alpha the alpha value
- * @return the integer value made of 8-bit sections
- * @throws IllegalArgumentException if parameters are out of range 0.0-1.0
- */
- private static int convert(float red, float green, float blue, float alpha)
- {
- if (red < 0 || red > 1 || green < 0 || green > 1 || blue < 0 || blue > 1
- || alpha < 0 || alpha > 1)
- throw new IllegalArgumentException("Bad RGB values");
- int redval = Math.round(255 * red);
- int greenval = Math.round(255 * green);
- int blueval = Math.round(255 * blue);
- int alphaval = Math.round(255 * alpha);
- return (alphaval << 24) | (redval << 16) | (greenval << 8) | blueval;
- }
-} // class Color
diff --git a/libjava/java/awt/ColorPaintContext.java b/libjava/java/awt/ColorPaintContext.java
deleted file mode 100644
index 8396fcd6317..00000000000
--- a/libjava/java/awt/ColorPaintContext.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/* ColorPaintContext.java -- context for painting solid colors
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.ColorModel;
-import java.awt.image.Raster;
-
-/**
- * This class provides a paint context which will fill a rectanglar region of
- * a raster scan with the given color. However, it is not yet completely
- * implemented.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
-class ColorPaintContext implements PaintContext
-{
- /**
- * The color to fill any raster with. Package visible for use in
- * SystemColor.
- */
- final int color;
- final ColorModel colorModel;
-
- private ColorRaster cachedRaster;
-
-
- /**
- * Create the context for a given color.
- *
- * @param c The solid color to use.
- */
- ColorPaintContext(int colorRGB)
- {
- this(ColorModel.getRGBdefault(), colorRGB);
- }
-
- /**
- * Create the context for a given color.
- *
- * @param cm The color model of this context.
- * @param c The solid color to use.
- */
- ColorPaintContext(ColorModel cm,int colorRGB)
- {
- color = colorRGB;
- colorModel = cm;
- }
-
- /**
- * Release the resources allocated for the paint. As the color is constant,
- * there aren't any resources.
- */
- public void dispose()
- {
- }
-
- /**
- * Return the color model of this context.
- *
- * @return the context color model
- */
- public ColorModel getColorModel()
- {
- return colorModel;
- }
-
- /**
- * Return a raster containing the colors for the graphics operation.
- *
- * @param x the x-coordinate, in device space
- * @param y the y-coordinate, in device space
- * @param w the width, in device space
- * @param h the height, in device space
- * @return a raster for the given area and color
- */
- public Raster getRaster(int x, int y, int width, int height)
- {
- if( cachedRaster == null
- || cachedRaster.getWidth() < width
- || cachedRaster.getHeight() < height)
- {
- cachedRaster = new ColorRaster(colorModel, 0, 0, width, height, color);
- }
- return cachedRaster.createChild(0 ,0 ,width ,height ,x ,y , null);
- }
-
- /**
- * A ColorRaster is a raster that is completely filled with one color. The
- * data layout is taken from the color model given to the constructor.
- */
- private class ColorRaster extends Raster
- {
-
- /**
- * Create a raster that is compaltible with the given color model and
- * filled with the given color.
- * @param cm The color model for this raster.
- * @param x The smallest horizontal corrdinate in the raster.
- * @param y The smallest vertical coordinate in the raster.
- * @param width The width of the raster.
- * @param height The height of the raster.
- * @param rgbPixel The RGB value of the color for this raster.
- */
- ColorRaster(ColorModel cm,int x, int y, int width, int height, int rgbPixel)
- {
- super(cm.createCompatibleSampleModel(width,height),new Point(x,y));
- Object pixel = cm.getDataElements(rgbPixel,null);
- getSampleModel().setDataElements(0, 0,
- width, height,
- multiplyData(pixel,null,width*height),
- dataBuffer);
- }
-
-
-
- private Object multiplyData(Object src, Object dest, int factor)
- {
- Object from;
- int srcLength = 0;
- if (src instanceof byte[])
- {
- srcLength = ((byte[])src).length;
-
- if (dest == null) dest = new byte[factor * srcLength];
- }
- else if (src instanceof short[])
- {
- srcLength = ((short[])src).length;
- if (dest == null) dest = new short[factor * srcLength];
- }
- else if (src instanceof int[])
- {
- srcLength = ((int[]) src).length;
- if (dest == null) dest = new int[factor * srcLength];
- }
- else
- {
- throw new ClassCastException("Unknown data buffer type");
- }
-
- System.arraycopy(src,0,dest,0,srcLength);
-
- int count = 1;
- while(count*2 < factor)
- {
- System.arraycopy(dest, 0, dest, count * srcLength, count*srcLength);
- count *= 2;
- }
-
- if(factor > count)
- System.arraycopy(dest,0, dest, count * srcLength,
- (factor - count) * srcLength );
-
- return dest;
- }
-
- }
-
-} // class ColorPaintContext
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
deleted file mode 100644
index 8b99321a64d..00000000000
--- a/libjava/java/awt/Component.java
+++ /dev/null
@@ -1,6005 +0,0 @@
-/* Component.java -- a graphics component
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.dnd.DropTarget;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.HierarchyBoundsListener;
-import java.awt.event.HierarchyEvent;
-import java.awt.event.HierarchyListener;
-import java.awt.event.InputEvent;
-import java.awt.event.InputMethodEvent;
-import java.awt.event.InputMethodListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.MouseWheelListener;
-import java.awt.event.PaintEvent;
-import java.awt.event.WindowEvent;
-import java.awt.im.InputContext;
-import java.awt.im.InputMethodRequests;
-import java.awt.image.BufferStrategy;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.image.VolatileImage;
-import java.awt.peer.ComponentPeer;
-import java.awt.peer.LightweightPeer;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.util.Collections;
-import java.util.EventListener;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleComponent;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-
-/**
- * The root of all evil. All graphical representations are subclasses of this
- * giant class, which is designed for screen display and user interaction.
- * This class can be extended directly to build a lightweight component (one
- * not associated with a native window); lightweight components must reside
- * inside a heavyweight window.
- *
- *
- * import java.awt.*;
- * import java.awt.event.*;
- * import java.io.Serializable;
- * class MyApp implements Serializable
- * {
- * BigObjectThatShouldNotBeSerializedWithAButton bigOne;
- * // Serializing aButton will not suck in an instance of MyApp, with its
- * // accompanying field bigOne.
- * Button aButton = new Button();
- * class MyActionListener implements ActionListener
- * {
- * public void actionPerformed(ActionEvent e)
- * {
- * System.out.println("Hello There");
- * }
- * }
- * MyApp()
- * {
- * aButton.addActionListener(new MyActionListener());
- * }
- * }
- *
- *
- * getAlignmentY
method to indicate
- * that the component wishes to be aligned to the top relative to
- * other components.
- *
- * @see #getAlignmentY()
- */
- public static final float TOP_ALIGNMENT = 0;
-
- /**
- * Constant returned by the getAlignmentY
and
- * getAlignmentX
methods to indicate
- * that the component wishes to be aligned to the center relative to
- * other components.
- *
- * @see #getAlignmentX()
- * @see #getAlignmentY()
- */
- public static final float CENTER_ALIGNMENT = 0.5f;
-
- /**
- * Constant returned by the getAlignmentY
method to indicate
- * that the component wishes to be aligned to the bottom relative to
- * other components.
- *
- * @see #getAlignmentY()
- */
- public static final float BOTTOM_ALIGNMENT = 1;
-
- /**
- * Constant returned by the getAlignmentX
method to indicate
- * that the component wishes to be aligned to the right relative to
- * other components.
- *
- * @see #getAlignmentX()
- */
- public static final float RIGHT_ALIGNMENT = 1;
-
- /**
- * Constant returned by the getAlignmentX
method to indicate
- * that the component wishes to be aligned to the left relative to
- * other components.
- *
- * @see #getAlignmentX()
- */
- public static final float LEFT_ALIGNMENT = 0;
-
- /**
- * Make the treelock a String so that it can easily be identified
- * in debug dumps. We clone the String in order to avoid a conflict in
- * the unlikely event that some other package uses exactly the same string
- * as a lock object.
- */
- static final Object treeLock = new String("AWT_TREE_LOCK");
-
- // Serialized fields from the serialization spec.
-
- /**
- * The x position of the component in the parent's coordinate system.
- *
- * @see #getLocation()
- * @serial the x position
- */
- int x;
-
- /**
- * The y position of the component in the parent's coordinate system.
- *
- * @see #getLocation()
- * @serial the y position
- */
- int y;
-
- /**
- * The component width.
- *
- * @see #getSize()
- * @serial the width
- */
- int width;
-
- /**
- * The component height.
- *
- * @see #getSize()
- * @serial the height
- */
- int height;
-
- /**
- * The foreground color for the component. This may be null.
- *
- * @see #getForeground()
- * @see #setForeground(Color)
- * @serial the foreground color
- */
- Color foreground;
-
- /**
- * The background color for the component. This may be null.
- *
- * @see #getBackground()
- * @see #setBackground(Color)
- * @serial the background color
- */
- Color background;
-
- /**
- * The default font used in the component. This may be null.
- *
- * @see #getFont()
- * @see #setFont(Font)
- * @serial the font
- */
- Font font;
-
- /**
- * The font in use by the peer, or null if there is no peer.
- *
- * @serial the peer's font
- */
- Font peerFont;
-
- /**
- * The cursor displayed when the pointer is over this component. This may
- * be null.
- *
- * @see #getCursor()
- * @see #setCursor(Cursor)
- */
- Cursor cursor;
-
- /**
- * The locale for the component.
- *
- * @see #getLocale()
- * @see #setLocale(Locale)
- */
- Locale locale = Locale.getDefault ();
-
- /**
- * True if the object should ignore repaint events (usually because it is
- * not showing).
- *
- * @see #getIgnoreRepaint()
- * @see #setIgnoreRepaint(boolean)
- * @serial true to ignore repaints
- * @since 1.4
- */
- boolean ignoreRepaint;
-
- /**
- * True when the object is visible (although it is only showing if all
- * ancestors are likewise visible). For component, this defaults to true.
- *
- * @see #isVisible()
- * @see #setVisible(boolean)
- * @serial true if visible
- */
- boolean visible = true;
-
- /**
- * True if the object is enabled, meaning it can interact with the user.
- * For component, this defaults to true.
- *
- * @see #isEnabled()
- * @see #setEnabled(boolean)
- * @serial true if enabled
- */
- boolean enabled = true;
-
- /**
- * True if the object is valid. This is set to false any time a size
- * adjustment means the component need to be layed out again.
- *
- * @see #isValid()
- * @see #validate()
- * @see #invalidate()
- * @serial true if layout is valid
- */
- boolean valid;
-
- /**
- * The DropTarget for drag-and-drop operations.
- *
- * @see #getDropTarget()
- * @see #setDropTarget(DropTarget)
- * @serial the drop target, or null
- * @since 1.2
- */
- DropTarget dropTarget;
-
- /**
- * The list of popup menus for this component.
- *
- * @see #add(PopupMenu)
- * @serial the list of popups
- */
- Vector popups;
-
- /**
- * The component's name. May be null, in which case a default name is
- * generated on the first use.
- *
- * @see #getName()
- * @see #setName(String)
- * @serial the name
- */
- String name;
-
- /**
- * True once the user has set the name. Note that the user may set the name
- * to null.
- *
- * @see #name
- * @see #getName()
- * @see #setName(String)
- * @serial true if the name has been explicitly set
- */
- boolean nameExplicitlySet;
-
- /**
- * Indicates if the object can be focused. Defaults to true for components.
- *
- * @see #isFocusable()
- * @see #setFocusable(boolean)
- * @since 1.4
- */
- boolean focusable = true;
-
- /**
- * Tracks whether this component's {@link #isFocusTraversable}
- * method has been overridden.
- *
- * @since 1.4
- */
- int isFocusTraversableOverridden;
-
- /**
- * The focus traversal keys, if not inherited from the parent or
- * default keyboard focus manager. These sets will contain only
- * AWTKeyStrokes that represent press and release events to use as
- * focus control.
- *
- * @see #getFocusTraversalKeys(int)
- * @see #setFocusTraversalKeys(int, Set)
- * @since 1.4
- */
- Set[] focusTraversalKeys;
-
- /**
- * True if focus traversal keys are enabled. This defaults to true for
- * Component. If this is true, keystrokes in focusTraversalKeys are trapped
- * and processed automatically rather than being passed on to the component.
- *
- * @see #getFocusTraversalKeysEnabled()
- * @see #setFocusTraversalKeysEnabled(boolean)
- * @since 1.4
- */
- boolean focusTraversalKeysEnabled = true;
-
- /**
- * Cached information on the minimum size. Should have been transient.
- *
- * @serial ignore
- */
- Dimension minSize;
-
- /**
- * Cached information on the preferred size. Should have been transient.
- *
- * @serial ignore
- */
- Dimension prefSize;
-
- /**
- * Set to true if an event is to be handled by this component, false if
- * it is to be passed up the hierarcy.
- *
- * @see #dispatchEvent(AWTEvent)
- * @serial true to process event locally
- */
- boolean newEventsOnly;
-
- /**
- * Set by subclasses to enable event handling of particular events, and
- * left alone when modifying listeners. For component, this defaults to
- * enabling only input methods.
- *
- * @see #enableInputMethods(boolean)
- * @see AWTEvent
- * @serial the mask of events to process
- */
- long eventMask = AWTEvent.INPUT_ENABLED_EVENT_MASK;
-
- /**
- * Describes all registered PropertyChangeListeners.
- *
- * @see #addPropertyChangeListener(PropertyChangeListener)
- * @see #removePropertyChangeListener(PropertyChangeListener)
- * @see #firePropertyChange(String, Object, Object)
- * @serial the property change listeners
- * @since 1.2
- */
- PropertyChangeSupport changeSupport;
-
- /**
- * True if the component has been packed (layed out).
- *
- * @serial true if this is packed
- */
- boolean isPacked;
-
- /**
- * The serialization version for this class. Currently at version 4.
- *
- * XXX How do we handle prior versions?
- *
- * @serial the serialization version
- */
- int componentSerializedDataVersion = 4;
-
- /**
- * The accessible context associated with this component. This is only set
- * by subclasses.
- *
- * @see #getAccessibleContext()
- * @serial the accessibility context
- * @since 1.2
- */
- AccessibleContext accessibleContext;
-
-
- // Guess what - listeners are special cased in serialization. See
- // readObject and writeObject.
-
- /** Component listener chain. */
- transient ComponentListener componentListener;
-
- /** Focus listener chain. */
- transient FocusListener focusListener;
-
- /** Key listener chain. */
- transient KeyListener keyListener;
-
- /** Mouse listener chain. */
- transient MouseListener mouseListener;
-
- /** Mouse motion listener chain. */
- transient MouseMotionListener mouseMotionListener;
-
- /**
- * Mouse wheel listener chain.
- *
- * @since 1.4
- */
- transient MouseWheelListener mouseWheelListener;
-
- /**
- * Input method listener chain.
- *
- * @since 1.2
- */
- transient InputMethodListener inputMethodListener;
-
- /**
- * Hierarcy listener chain.
- *
- * @since 1.3
- */
- transient HierarchyListener hierarchyListener;
-
- /**
- * Hierarcy bounds listener chain.
- *
- * @since 1.3
- */
- transient HierarchyBoundsListener hierarchyBoundsListener;
-
- // Anything else is non-serializable, and should be declared "transient".
-
- /** The parent. */
- transient Container parent;
-
- /** The associated native peer. */
- transient ComponentPeer peer;
-
- /** The preferred component orientation. */
- transient ComponentOrientation orientation = ComponentOrientation.UNKNOWN;
-
- /**
- * The associated graphics configuration.
- *
- * @since 1.4
- */
- transient GraphicsConfiguration graphicsConfig;
-
- /**
- * The buffer strategy for repainting.
- *
- * @since 1.4
- */
- transient BufferStrategy bufferStrategy;
-
- /**
- * true if requestFocus was called on this component when its
- * top-level ancestor was not focusable.
- */
- private transient FocusEvent pendingFocusRequest = null;
-
- /**
- * The system properties that affect image updating.
- */
- private static transient boolean incrementalDraw;
- private static transient Long redrawRate;
-
- static
- {
- incrementalDraw = Boolean.getBoolean ("awt.image.incrementalDraw");
- redrawRate = Long.getLong ("awt.image.redrawrate");
- }
-
- // Public and protected API.
-
- /**
- * Default constructor for subclasses. When Component is extended directly,
- * it forms a lightweight component that must be hosted in an opaque native
- * container higher in the tree.
- */
- protected Component()
- {
- }
-
- /**
- * Returns the name of this component.
- *
- * @return the name of this component
- * @see #setName(String)
- * @since 1.1
- */
- public String getName()
- {
- if (name == null && ! nameExplicitlySet)
- name = generateName();
- return name;
- }
-
- /**
- * Sets the name of this component to the specified name.
- *
- * @param name the new name of this component
- * @see #getName()
- * @since 1.1
- */
- public void setName(String name)
- {
- nameExplicitlySet = true;
- this.name = name;
- }
-
- /**
- * Returns the parent of this component.
- *
- * @return the parent of this component
- */
- public Container getParent()
- {
- return parent;
- }
-
- /**
- * Returns the native windowing system peer for this component. Only the
- * platform specific implementation code should call this method.
- *
- * @return the peer for this component
- * @deprecated user programs should not directly manipulate peers; use
- * {@link #isDisplayable()} instead
- */
- // Classpath's Gtk peers rely on this.
- public ComponentPeer getPeer()
- {
- return peer;
- }
-
- /**
- * Set the associated drag-and-drop target, which receives events when this
- * is enabled.
- *
- * @param dt the new drop target
- * @see #isEnabled()
- */
- public void setDropTarget(DropTarget dt)
- {
- this.dropTarget = dt;
- }
-
- /**
- * Gets the associated drag-and-drop target, if there is one.
- *
- * @return the drop target
- */
- public DropTarget getDropTarget()
- {
- return dropTarget;
- }
-
- /**
- * Returns the graphics configuration of this component, if there is one.
- * If it has not been set, it is inherited from the parent.
- *
- * @return the graphics configuration, or null
- * @since 1.3
- */
- public GraphicsConfiguration getGraphicsConfiguration()
- {
- return getGraphicsConfigurationImpl();
- }
-
- /**
- * Returns the object used for synchronization locks on this component
- * when performing tree and layout functions.
- *
- * @return the synchronization lock for this component
- */
- public final Object getTreeLock()
- {
- return treeLock;
- }
-
- /**
- * Returns the toolkit in use for this component. The toolkit is associated
- * with the frame this component belongs to.
- *
- * @return the toolkit for this component
- */
- public Toolkit getToolkit()
- {
- if (peer != null)
- {
- Toolkit tk = peer.getToolkit();
- if (tk != null)
- return tk;
- }
- // Get toolkit for lightweight component.
- if (parent != null)
- return parent.getToolkit();
- return Toolkit.getDefaultToolkit();
- }
-
- /**
- * Tests whether or not this component is valid. A invalid component needs
- * to have its layout redone.
- *
- * @return true if this component is valid
- * @see #validate()
- * @see #invalidate()
- */
- public boolean isValid()
- {
- return valid;
- }
-
- /**
- * Tests if the component is displayable. It must be connected to a native
- * screen resource, and all its ancestors must be displayable. A containment
- * hierarchy is made displayable when a window is packed or made visible.
- *
- * @return true if the component is displayable
- * @see Container#add(Component)
- * @see Container#remove(Component)
- * @see Window#pack()
- * @see Window#show()
- * @see Window#dispose()
- * @since 1.2
- */
- public boolean isDisplayable()
- {
- if (parent != null)
- return parent.isDisplayable();
- return false;
- }
-
- /**
- * Tests whether or not this component is visible. Except for top-level
- * frames, components are initially visible.
- *
- * @return true if the component is visible
- * @see #setVisible(boolean)
- */
- public boolean isVisible()
- {
- return visible;
- }
-
- /**
- * Tests whether or not this component is actually being shown on
- * the screen. This will be true if and only if it this component is
- * visible and its parent components are all visible.
- *
- * @return true if the component is showing on the screen
- * @see #setVisible(boolean)
- */
- public boolean isShowing()
- {
- if (! visible || peer == null)
- return false;
-
- return parent == null ? true : parent.isShowing();
- }
-
- /**
- * Tests whether or not this component is enabled. Components are enabled
- * by default, and must be enabled to receive user input or generate events.
- *
- * @return true if the component is enabled
- * @see #setEnabled(boolean)
- */
- public boolean isEnabled()
- {
- return enabled;
- }
-
- /**
- * Enables or disables this component. The component must be enabled to
- * receive events (except that lightweight components always receive mouse
- * events).
- *
- * @param enabled true to enable this component
- *
- * @see #isEnabled()
- * @see #isLightweight()
- *
- * @since 1.1
- */
- public void setEnabled(boolean enabled)
- {
- enable(enabled);
- }
-
- /**
- * Enables this component.
- *
- * @deprecated use {@link #setEnabled(boolean)} instead
- */
- public void enable()
- {
- this.enabled = true;
- if (peer != null)
- peer.setEnabled (true);
- }
-
- /**
- * Enables or disables this component.
- *
- * @param enabled true to enable this component
- *
- * @deprecated use {@link #setEnabled(boolean)} instead
- */
- public void enable(boolean enabled)
- {
- if (enabled)
- enable();
- else
- disable();
- }
-
- /**
- * Disables this component.
- *
- * @deprecated use {@link #setEnabled(boolean)} instead
- */
- public void disable()
- {
- this.enabled = false;
- if (peer != null)
- peer.setEnabled (false);
- }
-
- /**
- * Checks if this image is painted to an offscreen image buffer that is
- * later copied to screen (double buffering reduces flicker). This version
- * returns false, so subclasses must override it if they provide double
- * buffering.
- *
- * @return true if this is double buffered; defaults to false
- */
- public boolean isDoubleBuffered()
- {
- return false;
- }
-
- /**
- * Enables or disables input method support for this component. By default,
- * components have this enabled. Input methods are given the opportunity
- * to process key events before this component and its listeners.
- *
- * @param enable true to enable input method processing
- * @see #processKeyEvent(KeyEvent)
- * @since 1.2
- */
- public void enableInputMethods(boolean enable)
- {
- // XXX Implement.
- throw new Error("not implemented");
- }
-
- /**
- * Makes this component visible or invisible. Note that it wtill might
- * not show the component, if a parent is invisible.
- *
- * @param visible true to make this component visible
- *
- * @see #isVisible()
- *
- * @since 1.1
- */
- public void setVisible(boolean visible)
- {
- // Inspection by subclassing shows that Sun's implementation calls
- // show(boolean) which then calls show() or hide(). It is the show()
- // method that is overriden in subclasses like Window.
- show(visible);
- }
-
- /**
- * Makes this component visible on the screen.
- *
- * @deprecated use {@link #setVisible(boolean)} instead
- */
- public void show()
- {
- // We must set visible before showing the peer. Otherwise the
- // peer could post paint events before visible is true, in which
- // case lightweight components are not initially painted --
- // Container.paint first calls isShowing () before painting itself
- // and its children.
- if(!isVisible())
- {
- this.visible = true;
- if (peer != null)
- peer.setVisible(true);
- invalidate();
- ComponentEvent ce =
- new ComponentEvent(this,ComponentEvent.COMPONENT_SHOWN);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- }
-
- /**
- * Makes this component visible or invisible.
- *
- * @param visible true to make this component visible
- *
- * @deprecated use {@link #setVisible(boolean)} instead
- */
- public void show(boolean visible)
- {
- if (visible)
- show();
- else
- hide();
- }
-
- /**
- * Hides this component so that it is no longer shown on the screen.
- *
- * @deprecated use {@link #setVisible(boolean)} instead
- */
- public void hide()
- {
- if (isVisible())
- {
- if (peer != null)
- peer.setVisible(false);
- this.visible = false;
- invalidate();
- ComponentEvent ce =
- new ComponentEvent(this,ComponentEvent.COMPONENT_HIDDEN);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- }
-
- /**
- * Returns this component's foreground color. If not set, this is inherited
- * from the parent.
- *
- * @return this component's foreground color, or null
- * @see #setForeground(Color)
- */
- public Color getForeground()
- {
- if (foreground != null)
- return foreground;
- return parent == null ? SystemColor.windowText : parent.getForeground();
- }
-
- /**
- * Sets this component's foreground color to the specified color. This is a
- * bound property.
- *
- * @param c the new foreground color
- * @see #getForeground()
- */
- public void setForeground(Color c)
- {
- firePropertyChange("foreground", foreground, c);
- if (peer != null)
- peer.setForeground(c);
- foreground = c;
- }
-
- /**
- * Tests if the foreground was explicitly set, or just inherited from the
- * parent.
- *
- * @return true if the foreground has been set
- * @since 1.4
- */
- public boolean isForegroundSet()
- {
- return foreground != null;
- }
-
- /**
- * Returns this component's background color. If not set, this is inherited
- * from the parent.
- *
- * @return the background color of the component, or null
- * @see #setBackground(Color)
- */
- public Color getBackground()
- {
- if (background != null)
- return background;
- return parent == null ? SystemColor.window : parent.getBackground();
- }
-
- /**
- * Sets this component's background color to the specified color. The parts
- * of the component affected by the background color may by system dependent.
- * This is a bound property.
- *
- * @param c the new background color
- * @see #getBackground()
- */
- public void setBackground(Color c)
- {
- // If c is null, inherit from closest ancestor whose bg is set.
- if (c == null && parent != null)
- c = parent.getBackground();
- firePropertyChange("background", background, c);
- if (peer != null && c != null)
- peer.setBackground(c);
- background = c;
- }
-
- /**
- * Tests if the background was explicitly set, or just inherited from the
- * parent.
- *
- * @return true if the background has been set
- * @since 1.4
- */
- public boolean isBackgroundSet()
- {
- return background != null;
- }
-
- /**
- * Returns the font in use for this component. If not set, this is inherited
- * from the parent.
- *
- * @return the font for this component
- * @see #setFont(Font)
- */
- public Font getFont()
- {
- if (font != null)
- return font;
-
- if (parent != null)
- return parent.getFont ();
- else
- return new Font ("Dialog", Font.PLAIN, 12);
- }
-
- /**
- * Sets the font for this component to the specified font. This is a bound
- * property.
- *
- * @param newFont the new font for this component
- *
- * @see #getFont()
- */
- public void setFont(Font newFont)
- {
- if (font == newFont)
- return;
-
- Font oldFont = font;
- font = newFont;
- if (peer != null)
- peer.setFont(font);
- firePropertyChange("font", oldFont, newFont);
- invalidate();
- }
-
- /**
- * Tests if the font was explicitly set, or just inherited from the parent.
- *
- * @return true if the font has been set
- * @since 1.4
- */
- public boolean isFontSet()
- {
- return font != null;
- }
-
- /**
- * Returns the locale for this component. If this component does not
- * have a locale, the locale of the parent component is returned.
- *
- * @return the locale for this component
- * @throws IllegalComponentStateException if it has no locale or parent
- * @see #setLocale(Locale)
- * @since 1.1
- */
- public Locale getLocale()
- {
- if (locale != null)
- return locale;
- if (parent == null)
- throw new IllegalComponentStateException
- ("Component has no parent: can't determine Locale");
- return parent.getLocale();
- }
-
- /**
- * Sets the locale for this component to the specified locale. This is a
- * bound property.
- *
- * @param newLocale the new locale for this component
- */
- public void setLocale(Locale newLocale)
- {
- if (locale == newLocale)
- return;
-
- Locale oldLocale = locale;
- locale = newLocale;
- firePropertyChange("locale", oldLocale, newLocale);
- // New writing/layout direction or more/less room for localized labels.
- invalidate();
- }
-
- /**
- * Returns the color model of the device this componet is displayed on.
- *
- * @return this object's color model
- * @see Toolkit#getColorModel()
- */
- public ColorModel getColorModel()
- {
- GraphicsConfiguration config = getGraphicsConfiguration();
- return config != null ? config.getColorModel()
- : getToolkit().getColorModel();
- }
-
- /**
- * Returns the location of this component's top left corner relative to
- * its parent component. This may be outdated, so for synchronous behavior,
- * you should use a component listner.
- *
- * @return the location of this component
- * @see #setLocation(int, int)
- * @see #getLocationOnScreen()
- * @since 1.1
- */
- public Point getLocation()
- {
- return location ();
- }
-
- /**
- * Returns the location of this component's top left corner in screen
- * coordinates.
- *
- * @return the location of this component in screen coordinates
- * @throws IllegalComponentStateException if the component is not showing
- */
- public Point getLocationOnScreen()
- {
- if (! isShowing())
- throw new IllegalComponentStateException("component not showing");
- // We know peer != null here.
- return peer.getLocationOnScreen();
- }
-
- /**
- * Returns the location of this component's top left corner relative to
- * its parent component.
- *
- * @return the location of this component
- * @deprecated use {@link #getLocation()} instead
- */
- public Point location()
- {
- return new Point (x, y);
- }
-
- /**
- * Moves this component to the specified location, relative to the parent's
- * coordinates. The coordinates are the new upper left corner of this
- * component.
- *
- * @param x the new X coordinate of this component
- * @param y the new Y coordinate of this component
- * @see #getLocation()
- * @see #setBounds(int, int, int, int)
- */
- public void setLocation(int x, int y)
- {
- move (x, y);
- }
-
- /**
- * Moves this component to the specified location, relative to the parent's
- * coordinates. The coordinates are the new upper left corner of this
- * component.
- *
- * @param x the new X coordinate of this component
- * @param y the new Y coordinate of this component
- * @deprecated use {@link #setLocation(int, int)} instead
- */
- public void move(int x, int y)
- {
- setBounds(x, y, this.width, this.height);
- }
-
- /**
- * Moves this component to the specified location, relative to the parent's
- * coordinates. The coordinates are the new upper left corner of this
- * component.
- *
- * @param p new coordinates for this component
- * @throws NullPointerException if p is null
- * @see #getLocation()
- * @see #setBounds(int, int, int, int)
- * @since 1.1
- */
- public void setLocation(Point p)
- {
- setLocation(p.x, p.y);
- }
-
- /**
- * Returns the size of this object.
- *
- * @return the size of this object
- * @see #setSize(int, int)
- * @since 1.1
- */
- public Dimension getSize()
- {
- return size ();
- }
-
- /**
- * Returns the size of this object.
- *
- * @return the size of this object
- * @deprecated use {@link #getSize()} instead
- */
- public Dimension size()
- {
- return new Dimension (width, height);
- }
-
- /**
- * Sets the size of this component to the specified width and height.
- *
- * @param width the new width of this component
- * @param height the new height of this component
- * @see #getSize()
- * @see #setBounds(int, int, int, int)
- */
- public void setSize(int width, int height)
- {
- resize (width, height);
- }
-
- /**
- * Sets the size of this component to the specified value.
- *
- * @param width the new width of the component
- * @param height the new height of the component
- * @deprecated use {@link #setSize(int, int)} instead
- */
- public void resize(int width, int height)
- {
- setBounds(this.x, this.y, width, height);
- }
-
- /**
- * Sets the size of this component to the specified value.
- *
- * @param d the new size of this component
- * @throws NullPointerException if d is null
- * @see #setSize(int, int)
- * @see #setBounds(int, int, int, int)
- * @since 1.1
- */
- public void setSize(Dimension d)
- {
- resize (d);
- }
-
- /**
- * Sets the size of this component to the specified value.
- *
- * @param d the new size of this component
- * @throws NullPointerException if d is null
- * @deprecated use {@link #setSize(Dimension)} instead
- */
- public void resize(Dimension d)
- {
- resize (d.width, d.height);
- }
-
- /**
- * Returns a bounding rectangle for this component. Note that the
- * returned rectange is relative to this component's parent, not to
- * the screen.
- *
- * @return the bounding rectangle for this component
- * @see #setBounds(int, int, int, int)
- * @see #getLocation()
- * @see #getSize()
- */
- public Rectangle getBounds()
- {
- return bounds ();
- }
-
- /**
- * Returns a bounding rectangle for this component. Note that the
- * returned rectange is relative to this component's parent, not to
- * the screen.
- *
- * @return the bounding rectangle for this component
- * @deprecated use {@link #getBounds()} instead
- */
- public Rectangle bounds()
- {
- return new Rectangle (x, y, width, height);
- }
-
- /**
- * Sets the bounding rectangle for this component to the specified values.
- * Note that these coordinates are relative to the parent, not to the screen.
- *
- * @param x the X coordinate of the upper left corner of the rectangle
- * @param y the Y coordinate of the upper left corner of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @see #getBounds()
- * @see #setLocation(int, int)
- * @see #setLocation(Point)
- * @see #setSize(int, int)
- * @see #setSize(Dimension)
- * @since 1.1
- */
- public void setBounds(int x, int y, int w, int h)
- {
- reshape (x, y, w, h);
- }
-
- /**
- * Sets the bounding rectangle for this component to the specified values.
- * Note that these coordinates are relative to the parent, not to the screen.
- *
- * @param x the X coordinate of the upper left corner of the rectangle
- * @param y the Y coordinate of the upper left corner of the rectangle
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- * @deprecated use {@link #setBounds(int, int, int, int)} instead
- */
- public void reshape(int x, int y, int width, int height)
- {
- int oldx = this.x;
- int oldy = this.y;
- int oldwidth = this.width;
- int oldheight = this.height;
-
- if (this.x == x && this.y == y
- && this.width == width && this.height == height)
- return;
- invalidate ();
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- if (peer != null)
- peer.setBounds (x, y, width, height);
-
- // Erase old bounds and repaint new bounds for lightweights.
- if (isLightweight() && isShowing ())
- {
- boolean shouldRepaintParent = false;
- boolean shouldRepaintSelf = false;
-
- if (parent != null)
- {
- Rectangle parentBounds = parent.getBounds();
- Rectangle oldBounds = new Rectangle(parent.getX() + oldx,
- parent.getY() + oldy,
- oldwidth, oldheight);
- Rectangle newBounds = new Rectangle(parent.getX() + x,
- parent.getY() + y,
- width, height);
- shouldRepaintParent = parentBounds.intersects(oldBounds);
- shouldRepaintSelf = parentBounds.intersects(newBounds);
- }
-
- if (shouldRepaintParent && parent != null)
- parent.repaint(oldx, oldy, oldwidth, oldheight);
- if (shouldRepaintSelf)
- repaint();
- }
-
- // Only post event if this component is visible and has changed size.
- if (isShowing ()
- && (oldx != x || oldy != y))
- {
- ComponentEvent ce = new ComponentEvent(this,
- ComponentEvent.COMPONENT_MOVED);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- if (isShowing ()
- && (oldwidth != width || oldheight != height))
- {
- ComponentEvent ce = new ComponentEvent(this,
- ComponentEvent.COMPONENT_RESIZED);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- }
-
- /**
- * Sets the bounding rectangle for this component to the specified
- * rectangle. Note that these coordinates are relative to the parent, not
- * to the screen.
- *
- * @param r the new bounding rectangle
- * @throws NullPointerException if r is null
- * @see #getBounds()
- * @see #setLocation(Point)
- * @see #setSize(Dimension)
- * @since 1.1
- */
- public void setBounds(Rectangle r)
- {
- setBounds (r.x, r.y, r.width, r.height);
- }
-
- /**
- * Gets the x coordinate of the upper left corner. This is more efficient
- * than getBounds().x or getLocation().x.
- *
- * @return the current x coordinate
- * @since 1.2
- */
- public int getX()
- {
- return x;
- }
-
- /**
- * Gets the y coordinate of the upper left corner. This is more efficient
- * than getBounds().y or getLocation().y.
- *
- * @return the current y coordinate
- * @since 1.2
- */
- public int getY()
- {
- return y;
- }
-
- /**
- * Gets the width of the component. This is more efficient than
- * getBounds().width or getSize().width.
- *
- * @return the current width
- * @since 1.2
- */
- public int getWidth()
- {
- return width;
- }
-
- /**
- * Gets the height of the component. This is more efficient than
- * getBounds().height or getSize().height.
- *
- * @return the current width
- * @since 1.2
- */
- public int getHeight()
- {
- return height;
- }
-
- /**
- * Returns the bounds of this component. This allows reuse of an existing
- * rectangle, if r is non-null.
- *
- * @param r the rectangle to use, or null
- * @return the bounds
- */
- public Rectangle getBounds(Rectangle r)
- {
- if (r == null)
- r = new Rectangle();
- r.x = x;
- r.y = y;
- r.width = width;
- r.height = height;
- return r;
- }
-
- /**
- * Returns the size of this component. This allows reuse of an existing
- * dimension, if d is non-null.
- *
- * @param d the dimension to use, or null
- * @return the size
- */
- public Dimension getSize(Dimension d)
- {
- if (d == null)
- d = new Dimension();
- d.width = width;
- d.height = height;
- return d;
- }
-
- /**
- * Returns the location of this component. This allows reuse of an existing
- * point, if p is non-null.
- *
- * @param p the point to use, or null
- * @return the location
- */
- public Point getLocation(Point p)
- {
- if (p == null)
- p = new Point();
- p.x = x;
- p.y = y;
- return p;
- }
-
- /**
- * Tests if this component is opaque. All "heavyweight" (natively-drawn)
- * components are opaque. A component is opaque if it draws all pixels in
- * the bounds; a lightweight component is partially transparent if it lets
- * pixels underneath show through. Subclasses that guarantee that all pixels
- * will be drawn should override this.
- *
- * @return true if this is opaque
- * @see #isLightweight()
- * @since 1.2
- */
- public boolean isOpaque()
- {
- return ! isLightweight();
- }
-
- /**
- * Return whether the component is lightweight. That means the component has
- * no native peer, but is displayable. This applies to subclasses of
- * Component not in this package, such as javax.swing.
- *
- * @return true if the component has a lightweight peer
- * @see #isDisplayable()
- * @since 1.2
- */
- public boolean isLightweight()
- {
- return peer instanceof LightweightPeer;
- }
-
- /**
- * Returns the component's preferred size.
- *
- * @return the component's preferred size
- * @see #getMinimumSize()
- * @see LayoutManager
- */
- public Dimension getPreferredSize()
- {
- return preferredSize();
- }
-
- /**
- * Returns the component's preferred size.
- *
- * @return the component's preferred size
- * @deprecated use {@link #getPreferredSize()} instead
- */
- public Dimension preferredSize()
- {
- if (prefSize == null)
- if (peer == null)
- return new Dimension(width, height);
- else
- prefSize = peer.getPreferredSize();
- return prefSize;
- }
-
- /**
- * Returns the component's minimum size.
- *
- * @return the component's minimum size
- * @see #getPreferredSize()
- * @see LayoutManager
- */
- public Dimension getMinimumSize()
- {
- return minimumSize();
- }
-
- /**
- * Returns the component's minimum size.
- *
- * @return the component's minimum size
- * @deprecated use {@link #getMinimumSize()} instead
- */
- public Dimension minimumSize()
- {
- if (minSize == null)
- minSize = (peer != null ? peer.getMinimumSize()
- : new Dimension(width, height));
- return minSize;
- }
-
- /**
- * Returns the component's maximum size.
- *
- * @return the component's maximum size
- * @see #getMinimumSize()
- * @see #getPreferredSize()
- * @see LayoutManager
- */
- public Dimension getMaximumSize()
- {
- return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
- }
-
- /**
- * Returns the preferred horizontal alignment of this component. The value
- * returned will be between {@link #LEFT_ALIGNMENT} and
- * {@link #RIGHT_ALIGNMENT}, inclusive.
- *
- * @return the preferred horizontal alignment of this component
- */
- public float getAlignmentX()
- {
- return CENTER_ALIGNMENT;
- }
-
- /**
- * Returns the preferred vertical alignment of this component. The value
- * returned will be between {@link #TOP_ALIGNMENT} and
- * {@link #BOTTOM_ALIGNMENT}, inclusive.
- *
- * @return the preferred vertical alignment of this component
- */
- public float getAlignmentY()
- {
- return CENTER_ALIGNMENT;
- }
-
- /**
- * Calls the layout manager to re-layout the component. This is called
- * during validation of a container in most cases.
- *
- * @see #validate()
- * @see LayoutManager
- */
- public void doLayout()
- {
- layout ();
- }
-
- /**
- * Calls the layout manager to re-layout the component. This is called
- * during validation of a container in most cases.
- *
- * @deprecated use {@link #doLayout()} instead
- */
- public void layout()
- {
- // Nothing to do unless we're a container.
- }
-
- /**
- * Called to ensure that the layout for this component is valid. This is
- * usually called on containers.
- *
- * @see #invalidate()
- * @see #doLayout()
- * @see LayoutManager
- * @see Container#validate()
- */
- public void validate()
- {
- valid = true;
- }
-
- /**
- * Invalidates this component and all of its parent components. This will
- * cause them to have their layout redone. This is called frequently, so
- * make it fast.
- */
- public void invalidate()
- {
- valid = false;
- prefSize = null;
- minSize = null;
- if (parent != null && parent.valid)
- parent.invalidate();
- }
-
- /**
- * Returns a graphics object for this component. Returns null
- * if this component is not currently displayed on the screen.
- *
- * @return a graphics object for this component
- * @see #paint(Graphics)
- */
- public Graphics getGraphics()
- {
- if (peer != null)
- {
- Graphics gfx = peer.getGraphics();
- if (gfx != null)
- return gfx;
- // create graphics for lightweight:
- Container parent = getParent();
- if (parent != null)
- {
- gfx = parent.getGraphics();
- Rectangle bounds = getBounds();
- gfx.setClip(bounds);
- gfx.translate(bounds.x, bounds.y);
- return gfx;
- }
- }
- return null;
- }
-
- /**
- * Returns the font metrics for the specified font in this component.
- *
- * @param font the font to retrieve metrics for
- * @return the font metrics for the specified font
- * @throws NullPointerException if font is null
- * @see #getFont()
- * @see Toolkit#getFontMetrics(Font)
- */
- public FontMetrics getFontMetrics(Font font)
- {
- return peer == null ? getToolkit().getFontMetrics(font)
- : peer.getFontMetrics(font);
- }
-
- /**
- * Sets the cursor for this component to the specified cursor. The cursor
- * is displayed when the point is contained by the component, and the
- * component is visible, displayable, and enabled. This is inherited by
- * subcomponents unless they set their own cursor.
- *
- * @param cursor the new cursor for this component
- * @see #isEnabled()
- * @see #isShowing()
- * @see #getCursor()
- * @see #contains(int, int)
- * @see Toolkit#createCustomCursor(Image, Point, String)
- */
- public void setCursor(Cursor cursor)
- {
- this.cursor = cursor;
- if (peer != null)
- peer.setCursor(cursor);
- }
-
- /**
- * Returns the cursor for this component. If not set, this is inherited
- * from the parent, or from Cursor.getDefaultCursor().
- *
- * @return the cursor for this component
- */
- public Cursor getCursor()
- {
- if (cursor != null)
- return cursor;
- return parent != null ? parent.getCursor() : Cursor.getDefaultCursor();
- }
-
- /**
- * Tests if the cursor was explicitly set, or just inherited from the parent.
- *
- * @return true if the cursor has been set
- * @since 1.4
- */
- public boolean isCursorSet()
- {
- return cursor != null;
- }
-
- /**
- * Paints this component on the screen. The clipping region in the graphics
- * context will indicate the region that requires painting. This is called
- * whenever the component first shows, or needs to be repaired because
- * something was temporarily drawn on top. It is not necessary for
- * subclasses to call super.paint(g)
. Components with no area
- * are not painted.
- *
- * @param g the graphics context for this paint job
- * @see #update(Graphics)
- */
- public void paint(Graphics g)
- {
- // Paint the heavyweight peer
- if (!isLightweight() && peer != null)
- peer.paint(g);
- }
-
- /**
- * Updates this component. This is called in response to
- * repaint
. This method fills the component with the
- * background color, then sets the foreground color of the specified
- * graphics context to the foreground color of this component and calls
- * the paint()
method. The coordinates of the graphics are
- * relative to this component. Subclasses should call either
- * super.update(g)
or paint(g)
.
- *
- * @param g the graphics context for this update
- *
- * @see #paint(Graphics)
- * @see #repaint()
- */
- public void update(Graphics g)
- {
- if (!isLightweight())
- {
- Rectangle clip = g.getClipBounds();
- if (clip == null)
- g.clearRect(0, 0, width, height);
- else
- g.clearRect(clip.x, clip.y, clip.width, clip.height);
- }
-
- paint(g);
- }
-
- /**
- * Paints this entire component, including any sub-components.
- *
- * @param g the graphics context for this paint job
- *
- * @see #paint(Graphics)
- */
- public void paintAll(Graphics g)
- {
- if (! visible)
- return;
- paint(g);
- }
-
- /**
- * Repaint this entire component. The update()
method
- * on this component will be called as soon as possible.
- *
- * @see #update(Graphics)
- * @see #repaint(long, int, int, int, int)
- */
- public void repaint()
- {
- repaint(0, 0, 0, width, height);
- }
-
- /**
- * Repaint this entire component. The update()
method on this
- * component will be called in approximate the specified number of
- * milliseconds.
- *
- * @param tm milliseconds before this component should be repainted
- * @see #paint(Graphics)
- * @see #repaint(long, int, int, int, int)
- */
- public void repaint(long tm)
- {
- repaint(tm, 0, 0, width, height);
- }
-
- /**
- * Repaints the specified rectangular region within this component. The
- * update
method on this component will be called as soon as
- * possible. The coordinates are relative to this component.
- *
- * @param x the X coordinate of the upper left of the region to repaint
- * @param y the Y coordinate of the upper left of the region to repaint
- * @param w the width of the region to repaint
- * @param h the height of the region to repaint
- * @see #update(Graphics)
- * @see #repaint(long, int, int, int, int)
- */
- public void repaint(int x, int y, int w, int h)
- {
- repaint(0, x, y, w, h);
- }
-
- /**
- * Repaints the specified rectangular region within this component. The
- * update
method on this component will be called in
- * approximately the specified number of milliseconds. The coordinates
- * are relative to this component.
- *
- * @param tm milliseconds before this component should be repainted
- * @param x the X coordinate of the upper left of the region to repaint
- * @param y the Y coordinate of the upper left of the region to repaint
- * @param width the width of the region to repaint
- * @param height the height of the region to repaint
- * @see #update(Graphics)
- */
- public void repaint(long tm, int x, int y, int width, int height)
- {
- // Handle lightweight repainting by forwarding to native parent
- if (isLightweight() && parent != null)
- {
- if (parent != null)
- parent.repaint(tm, x + getX(), y + getY(), width, height);
- }
- else if (peer != null)
- peer.repaint(tm, x, y, width, height);
- }
-
- /**
- * Prints this component. This method is provided so that printing can be
- * done in a different manner from painting. However, the implementation
- * in this class simply calls the paint()
method.
- *
- * @param g the graphics context of the print device
- *
- * @see #paint(Graphics)
- */
- public void print(Graphics g)
- {
- paint(g);
- }
-
- /**
- * Prints this component, including all sub-components. This method is
- * provided so that printing can be done in a different manner from
- * painting. However, the implementation in this class simply calls the
- * paintAll()
method.
- *
- * @param g the graphics context of the print device
- *
- * @see #paintAll(Graphics)
- */
- public void printAll(Graphics g)
- {
- paintAll(g);
- }
-
- /**
- * Called when an image has changed so that this component is repainted.
- * This incrementally draws an image as more bits are available, when
- * possible. Incremental drawing is enabled if the system property
- * awt.image.incrementalDraw
is not present or is true, in which
- * case the redraw rate is set to 100ms or the value of the system property
- * awt.image.redrawrate
.
- *
- * ImageObserver
- * @param x the X coordinate
- * @param y the Y coordinate
- * @param w the width
- * @param h the height
- * @return false if the image is completely loaded, loading has been
- * aborted, or an error has occurred. true if more updates are
- * required.
- * @see ImageObserver
- * @see Graphics#drawImage(Image, int, int, Color, ImageObserver)
- * @see Graphics#drawImage(Image, int, int, ImageObserver)
- * @see Graphics#drawImage(Image, int, int, int, int, Color, ImageObserver)
- * @see Graphics#drawImage(Image, int, int, int, int, ImageObserver)
- * @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
- */
- public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
- {
- if ((flags & (FRAMEBITS | ALLBITS)) != 0)
- repaint ();
- else if ((flags & SOMEBITS) != 0)
- {
- if (incrementalDraw)
- {
- if (redrawRate != null)
- {
- long tm = redrawRate.longValue();
- if (tm < 0)
- tm = 0;
- repaint (tm);
- }
- else
- repaint (100);
- }
- }
- return (flags & (ALLBITS | ABORT | ERROR)) == 0;
- }
-
- /**
- * Creates an image from the specified producer.
- *
- * @param producer the image procedure to create the image from
- * @return the resulting image
- */
- public Image createImage(ImageProducer producer)
- {
- // Sun allows producer to be null.
- if (peer != null)
- return peer.createImage(producer);
- else
- return getToolkit().createImage(producer);
- }
-
- /**
- * Creates an image with the specified width and height for use in
- * double buffering. Headless environments do not support images.
- *
- * @param width the width of the image
- * @param height the height of the image
- * @return the requested image, or null if it is not supported
- */
- public Image createImage (int width, int height)
- {
- Image returnValue = null;
- if (!GraphicsEnvironment.isHeadless ())
- {
- if (isLightweight () && parent != null)
- returnValue = parent.createImage (width, height);
- else if (peer != null)
- returnValue = peer.createImage (width, height);
- }
- return returnValue;
- }
-
- /**
- * Creates an image with the specified width and height for use in
- * double buffering. Headless environments do not support images.
- *
- * @param width the width of the image
- * @param height the height of the image
- * @return the requested image, or null if it is not supported
- * @since 1.4
- */
- public VolatileImage createVolatileImage(int width, int height)
- {
- if (GraphicsEnvironment.isHeadless())
- return null;
- GraphicsConfiguration config = getGraphicsConfiguration();
- return config == null ? null
- : config.createCompatibleVolatileImage(width, height);
- }
-
- /**
- * Creates an image with the specified width and height for use in
- * double buffering. Headless environments do not support images. The image
- * will support the specified capabilities.
- *
- * @param width the width of the image
- * @param height the height of the image
- * @param caps the requested capabilities
- * @return the requested image, or null if it is not supported
- * @throws AWTException if a buffer with the capabilities cannot be created
- * @since 1.4
- */
- public VolatileImage createVolatileImage(int width, int height,
- ImageCapabilities caps)
- throws AWTException
- {
- if (GraphicsEnvironment.isHeadless())
- return null;
- GraphicsConfiguration config = getGraphicsConfiguration();
- return config == null ? null
- : config.createCompatibleVolatileImage(width, height, caps);
- }
-
- /**
- * Prepares the specified image for rendering on this component.
- *
- * @param image the image to prepare for rendering
- * @param observer the observer to notify of image preparation status
- * @return true if the image is already fully prepared
- * @throws NullPointerException if image is null
- */
- public boolean prepareImage(Image image, ImageObserver observer)
- {
- return prepareImage(image, image.getWidth(observer),
- image.getHeight(observer), observer);
- }
-
- /**
- * Prepares the specified image for rendering on this component at the
- * specified scaled width and height
- *
- * @param image the image to prepare for rendering
- * @param width the scaled width of the image
- * @param height the scaled height of the image
- * @param observer the observer to notify of image preparation status
- * @return true if the image is already fully prepared
- */
- public boolean prepareImage(Image image, int width, int height,
- ImageObserver observer)
- {
- if (peer != null)
- return peer.prepareImage(image, width, height, observer);
- else
- return getToolkit().prepareImage(image, width, height, observer);
- }
-
- /**
- * Returns the status of the loading of the specified image. The value
- * returned will be those flags defined in ImageObserver
.
- *
- * @param image the image to check on
- * @param observer the observer to notify of image loading progress
- * @return the image observer flags indicating the status of the load
- * @see #prepareImage(Image, int, int, ImageObserver)
- * @see Toolkit#checkImage(Image, int, int, ImageObserver)
- * @throws NullPointerException if image is null
- */
- public int checkImage(Image image, ImageObserver observer)
- {
- return checkImage(image, -1, -1, observer);
- }
-
- /**
- * Returns the status of the loading of the specified image. The value
- * returned will be those flags defined in ImageObserver
.
- *
- * @param image the image to check on
- * @param width the scaled image width
- * @param height the scaled image height
- * @param observer the observer to notify of image loading progress
- * @return the image observer flags indicating the status of the load
- * @see #prepareImage(Image, int, int, ImageObserver)
- * @see Toolkit#checkImage(Image, int, int, ImageObserver)
- */
- public int checkImage(Image image, int width, int height,
- ImageObserver observer)
- {
- if (peer != null)
- return peer.checkImage(image, width, height, observer);
- return getToolkit().checkImage(image, width, height, observer);
- }
-
- /**
- * Sets whether paint messages delivered by the operating system should be
- * ignored. This does not affect messages from AWT, except for those
- * triggered by OS messages. Setting this to true can allow faster
- * performance in full-screen mode or page-flipping.
- *
- * @param ignoreRepaint the new setting for ignoring repaint events
- * @see #getIgnoreRepaint()
- * @see BufferStrategy
- * @see GraphicsDevice#setFullScreenWindow(Window)
- * @since 1.4
- */
- public void setIgnoreRepaint(boolean ignoreRepaint)
- {
- this.ignoreRepaint = ignoreRepaint;
- }
-
- /**
- * Test whether paint events from the operating system are ignored.
- *
- * @return the status of ignoring paint events
- * @see #setIgnoreRepaint(boolean)
- * @since 1.4
- */
- public boolean getIgnoreRepaint()
- {
- return ignoreRepaint;
- }
-
- /**
- * Tests whether or not the specified point is contained within this
- * component. Coordinates are relative to this component.
- *
- * @param x the X coordinate of the point to test
- * @param y the Y coordinate of the point to test
- * @return true if the point is within this component
- * @see #getComponentAt(int, int)
- */
- public boolean contains(int x, int y)
- {
- return inside (x, y);
- }
-
- /**
- * Tests whether or not the specified point is contained within this
- * component. Coordinates are relative to this component.
- *
- * @param x the X coordinate of the point to test
- * @param y the Y coordinate of the point to test
- * @return true if the point is within this component
- * @deprecated use {@link #contains(int, int)} instead
- */
- public boolean inside(int x, int y)
- {
- return x >= 0 && y >= 0 && x < width && y < height;
- }
-
- /**
- * Tests whether or not the specified point is contained within this
- * component. Coordinates are relative to this component.
- *
- * @param p the point to test
- * @return true if the point is within this component
- * @throws NullPointerException if p is null
- * @see #getComponentAt(Point)
- * @since 1.1
- */
- public boolean contains(Point p)
- {
- return contains (p.x, p.y);
- }
-
- /**
- * Returns the component occupying the position (x,y). This will either
- * be this component, an immediate child component, or null
- * if neither of the first two occupies the specified location.
- *
- * @param x the X coordinate to search for components at
- * @param y the Y coordinate to search for components at
- * @return the component at the specified location, or null
- * @see #contains(int, int)
- */
- public Component getComponentAt(int x, int y)
- {
- return locate (x, y);
- }
-
- /**
- * Returns the component occupying the position (x,y). This will either
- * be this component, an immediate child component, or null
- * if neither of the first two occupies the specified location.
- *
- * @param x the X coordinate to search for components at
- * @param y the Y coordinate to search for components at
- * @return the component at the specified location, or null
- * @deprecated use {@link #getComponentAt(int, int)} instead
- */
- public Component locate(int x, int y)
- {
- return contains (x, y) ? this : null;
- }
-
- /**
- * Returns the component occupying the position (x,y). This will either
- * be this component, an immediate child component, or null
- * if neither of the first two occupies the specified location.
- *
- * @param p the point to search for components at
- * @return the component at the specified location, or null
- * @throws NullPointerException if p is null
- * @see #contains(Point)
- * @since 1.1
- */
- public Component getComponentAt(Point p)
- {
- return getComponentAt (p.x, p.y);
- }
-
- /**
- * AWT 1.0 event delivery.
- *
- * Deliver an AWT 1.0 event to this Component. This method simply
- * calls {@link #postEvent}.
- *
- * @param e the event to deliver
- * @deprecated use {@link #dispatchEvent (AWTEvent)} instead
- */
- public void deliverEvent (Event e)
- {
- postEvent (e);
- }
-
- /**
- * Forwards AWT events to processEvent() if:
- *
- *
- * @param e the event to dispatch
- */
- public final void dispatchEvent(AWTEvent e)
- {
- // Some subclasses in the AWT package need to override this behavior,
- // hence the use of dispatchEventImpl().
- dispatchEventImpl(e);
- if (peer != null && ! e.consumed)
- peer.handleEvent(e);
- }
-
- /**
- * AWT 1.0 event handler.
- *
- * This method simply calls handleEvent and returns the result.
- *
- * @param e the event to handle
- * @return true if the event was handled, false otherwise
- * @deprecated use {@link #dispatchEvent(AWTEvent)} instead
- */
- public boolean postEvent (Event e)
- {
- boolean handled = handleEvent (e);
-
- if (!handled && getParent() != null)
- // FIXME: need to translate event coordinates to parent's
- // coordinate space.
- handled = getParent ().postEvent (e);
-
- return handled;
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see ComponentEvent
- * @see #removeComponentListener(ComponentListener)
- * @see #getComponentListeners()
- * @since 1.1
- */
- public synchronized void addComponentListener(ComponentListener listener)
- {
- componentListener = AWTEventMulticaster.add(componentListener, listener);
- if (componentListener != null)
- enableEvents(AWTEvent.COMPONENT_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see ComponentEvent
- * @see #addComponentListener(ComponentListener)
- * @see #getComponentListeners()
- * @since 1.1
- */
- public synchronized void removeComponentListener(ComponentListener listener)
- {
- componentListener = AWTEventMulticaster.remove(componentListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addComponentListener(ComponentListener)
- * @see #removeComponentListener(ComponentListener)
- * @since 1.4
- */
- public synchronized ComponentListener[] getComponentListeners()
- {
- return (ComponentListener[])
- AWTEventMulticaster.getListeners(componentListener,
- ComponentListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see FocusEvent
- * @see #removeFocusListener(FocusListener)
- * @see #getFocusListeners()
- * @since 1.1
- */
- public synchronized void addFocusListener(FocusListener listener)
- {
- focusListener = AWTEventMulticaster.add(focusListener, listener);
- if (focusListener != null)
- enableEvents(AWTEvent.FOCUS_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see FocusEvent
- * @see #addFocusListener(FocusListener)
- * @see #getFocusListeners()
- * @since 1.1
- */
- public synchronized void removeFocusListener(FocusListener listener)
- {
- focusListener = AWTEventMulticaster.remove(focusListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addFocusListener(FocusListener)
- * @see #removeFocusListener(FocusListener)
- * @since 1.4
- */
- public synchronized FocusListener[] getFocusListeners()
- {
- return (FocusListener[])
- AWTEventMulticaster.getListeners(focusListener, FocusListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see HierarchyEvent
- * @see #removeHierarchyListener(HierarchyListener)
- * @see #getHierarchyListeners()
- * @since 1.3
- */
- public synchronized void addHierarchyListener(HierarchyListener listener)
- {
- hierarchyListener = AWTEventMulticaster.add(hierarchyListener, listener);
- if (hierarchyListener != null)
- enableEvents(AWTEvent.HIERARCHY_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see HierarchyEvent
- * @see #addHierarchyListener(HierarchyListener)
- * @see #getHierarchyListeners()
- * @since 1.3
- */
- public synchronized void removeHierarchyListener(HierarchyListener listener)
- {
- hierarchyListener = AWTEventMulticaster.remove(hierarchyListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addHierarchyListener(HierarchyListener)
- * @see #removeHierarchyListener(HierarchyListener)
- * @since 1.4
- */
- public synchronized HierarchyListener[] getHierarchyListeners()
- {
- return (HierarchyListener[])
- AWTEventMulticaster.getListeners(hierarchyListener,
- HierarchyListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see HierarchyEvent
- * @see #removeHierarchyBoundsListener(HierarchyBoundsListener)
- * @see #getHierarchyBoundsListeners()
- * @since 1.3
- */
- public synchronized void
- addHierarchyBoundsListener(HierarchyBoundsListener listener)
- {
- hierarchyBoundsListener =
- AWTEventMulticaster.add(hierarchyBoundsListener, listener);
- if (hierarchyBoundsListener != null)
- enableEvents(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see HierarchyEvent
- * @see #addHierarchyBoundsListener(HierarchyBoundsListener)
- * @see #getHierarchyBoundsListeners()
- * @since 1.3
- */
- public synchronized void
- removeHierarchyBoundsListener(HierarchyBoundsListener listener)
- {
- hierarchyBoundsListener =
- AWTEventMulticaster.remove(hierarchyBoundsListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addHierarchyBoundsListener(HierarchyBoundsListener)
- * @see #removeHierarchyBoundsListener(HierarchyBoundsListener)
- * @since 1.4
- */
- public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners()
- {
- return (HierarchyBoundsListener[])
- AWTEventMulticaster.getListeners(hierarchyBoundsListener,
- HierarchyBoundsListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see KeyEvent
- * @see #removeKeyListener(KeyListener)
- * @see #getKeyListeners()
- * @since 1.1
- */
- public synchronized void addKeyListener(KeyListener listener)
- {
- keyListener = AWTEventMulticaster.add(keyListener, listener);
- if (keyListener != null)
- enableEvents(AWTEvent.KEY_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see KeyEvent
- * @see #addKeyListener(KeyListener)
- * @see #getKeyListeners()
- * @since 1.1
- */
- public synchronized void removeKeyListener(KeyListener listener)
- {
- keyListener = AWTEventMulticaster.remove(keyListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addKeyListener(KeyListener)
- * @see #removeKeyListener(KeyListener)
- * @since 1.4
- */
- public synchronized KeyListener[] getKeyListeners()
- {
- return (KeyListener[])
- AWTEventMulticaster.getListeners(keyListener, KeyListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see MouseEvent
- * @see #removeMouseListener(MouseListener)
- * @see #getMouseListeners()
- * @since 1.1
- */
- public synchronized void addMouseListener(MouseListener listener)
- {
- mouseListener = AWTEventMulticaster.add(mouseListener, listener);
- if (mouseListener != null)
- enableEvents(AWTEvent.MOUSE_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see MouseEvent
- * @see #addMouseListener(MouseListener)
- * @see #getMouseListeners()
- * @since 1.1
- */
- public synchronized void removeMouseListener(MouseListener listener)
- {
- mouseListener = AWTEventMulticaster.remove(mouseListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addMouseListener(MouseListener)
- * @see #removeMouseListener(MouseListener)
- * @since 1.4
- */
- public synchronized MouseListener[] getMouseListeners()
- {
- return (MouseListener[])
- AWTEventMulticaster.getListeners(mouseListener, MouseListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see MouseEvent
- * @see #removeMouseMotionListener(MouseMotionListener)
- * @see #getMouseMotionListeners()
- * @since 1.1
- */
- public synchronized void addMouseMotionListener(MouseMotionListener listener)
- {
- mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener);
- if (mouseMotionListener != null)
- enableEvents(AWTEvent.MOUSE_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see MouseEvent
- * @see #addMouseMotionListener(MouseMotionListener)
- * @see #getMouseMotionListeners()
- * @since 1.1
- */
- public synchronized void removeMouseMotionListener(MouseMotionListener listener)
- {
- mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addMouseMotionListener(MouseMotionListener)
- * @see #removeMouseMotionListener(MouseMotionListener)
- * @since 1.4
- */
- public synchronized MouseMotionListener[] getMouseMotionListeners()
- {
- return (MouseMotionListener[])
- AWTEventMulticaster.getListeners(mouseMotionListener,
- MouseMotionListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see MouseEvent
- * @see MouseWheelEvent
- * @see #removeMouseWheelListener(MouseWheelListener)
- * @see #getMouseWheelListeners()
- * @since 1.4
- */
- public synchronized void addMouseWheelListener(MouseWheelListener listener)
- {
- mouseWheelListener = AWTEventMulticaster.add(mouseWheelListener, listener);
- if (mouseWheelListener != null)
- enableEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see MouseEvent
- * @see MouseWheelEvent
- * @see #addMouseWheelListener(MouseWheelListener)
- * @see #getMouseWheelListeners()
- * @since 1.4
- */
- public synchronized void removeMouseWheelListener(MouseWheelListener listener)
- {
- mouseWheelListener = AWTEventMulticaster.remove(mouseWheelListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addMouseWheelListener(MouseWheelListener)
- * @see #removeMouseWheelListener(MouseWheelListener)
- * @since 1.4
- */
- public synchronized MouseWheelListener[] getMouseWheelListeners()
- {
- return (MouseWheelListener[])
- AWTEventMulticaster.getListeners(mouseWheelListener,
- MouseWheelListener.class);
- }
-
- /**
- * Adds the specified listener to this component. This is harmless if the
- * listener is null, but if the listener has already been registered, it
- * will now be registered twice.
- *
- * @param listener the new listener to add
- * @see InputMethodEvent
- * @see #removeInputMethodListener(InputMethodListener)
- * @see #getInputMethodListeners()
- * @see #getInputMethodRequests()
- * @since 1.2
- */
- public synchronized void addInputMethodListener(InputMethodListener listener)
- {
- inputMethodListener = AWTEventMulticaster.add(inputMethodListener, listener);
- if (inputMethodListener != null)
- enableEvents(AWTEvent.INPUT_METHOD_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the component. This is harmless if
- * the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see InputMethodEvent
- * @see #addInputMethodListener(InputMethodListener)
- * @see #getInputMethodRequests()
- * @since 1.2
- */
- public synchronized void removeInputMethodListener(InputMethodListener listener)
- {
- inputMethodListener = AWTEventMulticaster.remove(inputMethodListener, listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addInputMethodListener(InputMethodListener)
- * @see #removeInputMethodListener(InputMethodListener)
- * @since 1.4
- */
- public synchronized InputMethodListener[] getInputMethodListeners()
- {
- return (InputMethodListener[])
- AWTEventMulticaster.getListeners(inputMethodListener,
- InputMethodListener.class);
- }
-
- /**
- * Returns all registered EventListers of the given listenerType.
- *
- * @param listenerType the class of listeners to filter
- * @return an array of registered listeners
- * @see #getComponentListeners()
- * @see #getFocusListeners()
- * @see #getHierarchyListeners()
- * @see #getHierarchyBoundsListeners()
- * @see #getKeyListeners()
- * @see #getMouseListeners()
- * @see #getMouseMotionListeners()
- * @see #getMouseWheelListeners()
- * @see #getInputMethodListeners()
- * @see #getPropertyChangeListeners()
- * @since 1.3
- */
- public EventListener[] getListeners(Class listenerType)
- {
- if (listenerType == ComponentListener.class)
- return getComponentListeners();
- if (listenerType == FocusListener.class)
- return getFocusListeners();
- if (listenerType == HierarchyListener.class)
- return getHierarchyListeners();
- if (listenerType == HierarchyBoundsListener.class)
- return getHierarchyBoundsListeners();
- if (listenerType == KeyListener.class)
- return getKeyListeners();
- if (listenerType == MouseListener.class)
- return getMouseListeners();
- if (listenerType == MouseMotionListener.class)
- return getMouseMotionListeners();
- if (listenerType == MouseWheelListener.class)
- return getMouseWheelListeners();
- if (listenerType == InputMethodListener.class)
- return getInputMethodListeners();
- if (listenerType == PropertyChangeListener.class)
- return getPropertyChangeListeners();
- return (EventListener[]) Array.newInstance(listenerType, 0);
- }
-
- /**
- * Returns the input method request handler, for subclasses which support
- * on-the-spot text input. By default, input methods are handled by AWT,
- * and this returns null.
- *
- * @return the input method handler, null by default
- * @since 1.2
- */
- public InputMethodRequests getInputMethodRequests()
- {
- return null;
- }
-
- /**
- * Gets the input context of this component, which is inherited from the
- * parent unless this is overridden.
- *
- * @return the text input context
- * @since 1.2
- */
- public InputContext getInputContext()
- {
- return parent == null ? null : parent.getInputContext();
- }
-
- /**
- * Enables the specified events. The events to enable are specified
- * by OR-ing together the desired masks from enableEvents()
AWTEvent
.
- *
- * AWTEvent
.
- *
- * @param eventsToDisable the desired events to disable
- * @see #enableEvents(long)
- * @since 1.1
- */
- protected final void disableEvents(long eventsToDisable)
- {
- eventMask &= ~eventsToDisable;
- // forward new event mask to peer?
- }
-
- /**
- * This is called by the EventQueue if two events with the same event id
- * and owner component are queued. Returns a new combined event, or null if
- * no combining is done. The coelesced events are currently mouse moves
- * (intermediate ones are discarded) and paint events (a merged paint is
- * created in place of the two events).
- *
- * @param existingEvent the event on the queue
- * @param newEvent the new event that might be entered on the queue
- * @return null if both events are kept, or the replacement coelesced event
- */
- protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)
- {
- switch (existingEvent.id)
- {
- case MouseEvent.MOUSE_MOVED:
- case MouseEvent.MOUSE_DRAGGED:
- // Just drop the old (intermediate) event and return the new one.
- return newEvent;
- case PaintEvent.PAINT:
- case PaintEvent.UPDATE:
- return coalescePaintEvents((PaintEvent) existingEvent,
- (PaintEvent) newEvent);
- default:
- return null;
- }
- }
-
- /**
- * Processes the specified event. In this class, this method simply
- * calls one of the more specific event handlers.
- *
- * @param e the event to process
- * @throws NullPointerException if e is null
- * @see #processComponentEvent(ComponentEvent)
- * @see #processFocusEvent(FocusEvent)
- * @see #processKeyEvent(KeyEvent)
- * @see #processMouseEvent(MouseEvent)
- * @see #processMouseMotionEvent(MouseEvent)
- * @see #processInputMethodEvent(InputMethodEvent)
- * @see #processHierarchyEvent(HierarchyEvent)
- * @see #processMouseWheelEvent(MouseWheelEvent)
- * @since 1.1
- */
- protected void processEvent(AWTEvent e)
- {
- /* Note: the order of these if statements are
- important. Subclasses must be checked first. Eg. MouseEvent
- must be checked before ComponentEvent, since a MouseEvent
- object is also an instance of a ComponentEvent. */
-
- if (e instanceof FocusEvent)
- processFocusEvent((FocusEvent) e);
- else if (e instanceof MouseWheelEvent)
- processMouseWheelEvent((MouseWheelEvent) e);
- else if (e instanceof MouseEvent)
- {
- if (e.id == MouseEvent.MOUSE_MOVED
- || e.id == MouseEvent.MOUSE_DRAGGED)
- processMouseMotionEvent((MouseEvent) e);
- else
- processMouseEvent((MouseEvent) e);
- }
- else if (e instanceof KeyEvent)
- processKeyEvent((KeyEvent) e);
- else if (e instanceof InputMethodEvent)
- processInputMethodEvent((InputMethodEvent) e);
- else if (e instanceof ComponentEvent)
- processComponentEvent((ComponentEvent) e);
- else if (e instanceof HierarchyEvent)
- {
- if (e.id == HierarchyEvent.HIERARCHY_CHANGED)
- processHierarchyEvent((HierarchyEvent) e);
- else
- processHierarchyBoundsEvent((HierarchyEvent) e);
- }
- }
-
- /**
- * Called when a component event is dispatched and component events are
- * enabled. This method passes the event along to any listeners
- * that are attached.
- *
- * @param e the ComponentEvent
to process
- * @throws NullPointerException if e is null
- * @see ComponentListener
- * @see #addComponentListener(ComponentListener)
- * @see #enableEvents(long)
- * @since 1.1
- */
- protected void processComponentEvent(ComponentEvent e)
- {
- if (componentListener == null)
- return;
- switch (e.id)
- {
- case ComponentEvent.COMPONENT_HIDDEN:
- componentListener.componentHidden(e);
- break;
- case ComponentEvent.COMPONENT_MOVED:
- componentListener.componentMoved(e);
- break;
- case ComponentEvent.COMPONENT_RESIZED:
- componentListener.componentResized(e);
- break;
- case ComponentEvent.COMPONENT_SHOWN:
- componentListener.componentShown(e);
- break;
- }
- }
-
- /**
- * Called when a focus event is dispatched and component events are
- * enabled. This method passes the event along to any listeners
- * that are attached.
- *
- * @param e the FocusEvent
to process
- * @throws NullPointerException if e is null
- * @see FocusListener
- * @see #addFocusListener(FocusListener)
- * @see #enableEvents(long)
- * @since 1.1
- */
- protected void processFocusEvent(FocusEvent e)
- {
- if (focusListener == null)
- return;
-
- switch (e.id)
- {
- case FocusEvent.FOCUS_GAINED:
- focusListener.focusGained(e);
- break;
- case FocusEvent.FOCUS_LOST:
- focusListener.focusLost(e);
- break;
- }
- }
-
- /**
- * Called when a key event is dispatched and component events are
- * enabled. This method passes the event along to any listeners
- * that are attached.
- *
- * @param e the KeyEvent
to process
- * @throws NullPointerException if e is null
- * @see KeyListener
- * @see #addKeyListener(KeyListener)
- * @see #enableEvents(long)
- * @since 1.1
- */
- protected void processKeyEvent(KeyEvent e)
- {
- if (keyListener == null)
- return;
- switch (e.id)
- {
- case KeyEvent.KEY_PRESSED:
- keyListener.keyPressed(e);
- break;
- case KeyEvent.KEY_RELEASED:
- keyListener.keyReleased(e);
- break;
- case KeyEvent.KEY_TYPED:
- keyListener.keyTyped(e);
- break;
- }
- }
-
- /**
- * Called when a regular mouse event is dispatched and component events are
- * enabled. This method passes the event along to any listeners
- * that are attached.
- *
- * @param e the MouseEvent
to process
- * @throws NullPointerException if e is null
- * @see MouseListener
- * @see #addMouseListener(MouseListener)
- * @see #enableEvents(long)
- * @since 1.1
- */
- protected void processMouseEvent(MouseEvent e)
- {
- if (mouseListener == null)
- return;
- switch (e.id)
- {
- case MouseEvent.MOUSE_CLICKED:
- mouseListener.mouseClicked(e);
- break;
- case MouseEvent.MOUSE_ENTERED:
- mouseListener.mouseEntered(e);
- break;
- case MouseEvent.MOUSE_EXITED:
- mouseListener.mouseExited(e);
- break;
- case MouseEvent.MOUSE_PRESSED:
- mouseListener.mousePressed(e);
- break;
- case MouseEvent.MOUSE_RELEASED:
- mouseListener.mouseReleased(e);
- break;
- }
- e.consume();
- }
-
- /**
- * Called when a mouse motion event is dispatched and component events are
- * enabled. This method passes the event along to any listeners
- * that are attached.
- *
- * @param e the MouseMotionEvent
to process
- * @throws NullPointerException if e is null
- * @see MouseMotionListener
- * @see #addMouseMotionListener(MouseMotionListener)
- * @see #enableEvents(long)
- * @since 1.1
- */
- protected void processMouseMotionEvent(MouseEvent e)
- {
- if (mouseMotionListener == null)
- return;
- switch (e.id)
- {
- case MouseEvent.MOUSE_DRAGGED:
- mouseMotionListener.mouseDragged(e);
- break;
- case MouseEvent.MOUSE_MOVED:
- mouseMotionListener.mouseMoved(e);
- break;
- }
- e.consume();
- }
-
- /**
- * Called when a mouse wheel event is dispatched and component events are
- * enabled. This method passes the event along to any listeners that are
- * attached.
- *
- * @param e the MouseWheelEvent
to process
- * @throws NullPointerException if e is null
- * @see MouseWheelListener
- * @see #addMouseWheelListener(MouseWheelListener)
- * @see #enableEvents(long)
- * @since 1.4
- */
- protected void processMouseWheelEvent(MouseWheelEvent e)
- {
- if (mouseWheelListener != null
- && e.id == MouseEvent.MOUSE_WHEEL)
- {
- mouseWheelListener.mouseWheelMoved(e);
- e.consume();
- }
- }
-
- /**
- * Called when an input method event is dispatched and component events are
- * enabled. This method passes the event along to any listeners that are
- * attached.
- *
- * @param e the InputMethodEvent
to process
- * @throws NullPointerException if e is null
- * @see InputMethodListener
- * @see #addInputMethodListener(InputMethodListener)
- * @see #enableEvents(long)
- * @since 1.2
- */
- protected void processInputMethodEvent(InputMethodEvent e)
- {
- if (inputMethodListener == null)
- return;
- switch (e.id)
- {
- case InputMethodEvent.CARET_POSITION_CHANGED:
- inputMethodListener.caretPositionChanged(e);
- break;
- case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
- inputMethodListener.inputMethodTextChanged(e);
- break;
- }
- }
-
- /**
- * Called when a hierarchy change event is dispatched and component events
- * are enabled. This method passes the event along to any listeners that are
- * attached.
- *
- * @param e the HierarchyEvent
to process
- * @throws NullPointerException if e is null
- * @see HierarchyListener
- * @see #addHierarchyListener(HierarchyListener)
- * @see #enableEvents(long)
- * @since 1.3
- */
- protected void processHierarchyEvent(HierarchyEvent e)
- {
- if (hierarchyListener == null)
- return;
- if (e.id == HierarchyEvent.HIERARCHY_CHANGED)
- hierarchyListener.hierarchyChanged(e);
- }
-
- /**
- * Called when a hierarchy bounds event is dispatched and component events
- * are enabled. This method passes the event along to any listeners that are
- * attached.
- *
- * @param e the HierarchyEvent
to process
- * @throws NullPointerException if e is null
- * @see HierarchyBoundsListener
- * @see #addHierarchyBoundsListener(HierarchyBoundsListener)
- * @see #enableEvents(long)
- * @since 1.3
- */
- protected void processHierarchyBoundsEvent(HierarchyEvent e)
- {
- if (hierarchyBoundsListener == null)
- return;
- switch (e.id)
- {
- case HierarchyEvent.ANCESTOR_MOVED:
- hierarchyBoundsListener.ancestorMoved(e);
- break;
- case HierarchyEvent.ANCESTOR_RESIZED:
- hierarchyBoundsListener.ancestorResized(e);
- break;
- }
- }
-
- /**
- * AWT 1.0 event handler.
- *
- * This method calls one of the event-specific handler methods. For
- * example for key events, either {@link #keyDown(Event,int)}
- * or {@link #keyUp(Event,int)} is called. A derived
- * component can override one of these event-specific methods if it
- * only needs to handle certain event types. Otherwise it can
- * override handleEvent itself and handle any event.
- *
- * @param evt the event to handle
- * @return true if the event was handled, false otherwise
- * @deprecated use {@link #processEvent(AWTEvent)} instead
- */
- public boolean handleEvent (Event evt)
- {
- switch (evt.id)
- {
- // Handle key events.
- case Event.KEY_ACTION:
- case Event.KEY_PRESS:
- return keyDown (evt, evt.key);
- case Event.KEY_ACTION_RELEASE:
- case Event.KEY_RELEASE:
- return keyUp (evt, evt.key);
-
- // Handle mouse events.
- case Event.MOUSE_DOWN:
- return mouseDown (evt, evt.x, evt.y);
- case Event.MOUSE_UP:
- return mouseUp (evt, evt.x, evt.y);
- case Event.MOUSE_MOVE:
- return mouseMove (evt, evt.x, evt.y);
- case Event.MOUSE_DRAG:
- return mouseDrag (evt, evt.x, evt.y);
- case Event.MOUSE_ENTER:
- return mouseEnter (evt, evt.x, evt.y);
- case Event.MOUSE_EXIT:
- return mouseExit (evt, evt.x, evt.y);
-
- // Handle focus events.
- case Event.GOT_FOCUS:
- return gotFocus (evt, evt.arg);
- case Event.LOST_FOCUS:
- return lostFocus (evt, evt.arg);
-
- // Handle action event.
- case Event.ACTION_EVENT:
- return action (evt, evt.arg);
- }
- // Unknown event.
- return false;
- }
-
- /**
- * AWT 1.0 MOUSE_DOWN event handler. This method is meant to be
- * overridden by components providing their own MOUSE_DOWN handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param x the x coordinate, ignored
- * @param y the y coordinate, ignored
- * @return false
- * @deprecated use {@link #processMouseEvent(MouseEvent)} instead
- */
- public boolean mouseDown(Event evt, int x, int y)
- {
- return false;
- }
-
- /**
- * AWT 1.0 MOUSE_DRAG event handler. This method is meant to be
- * overridden by components providing their own MOUSE_DRAG handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param x the x coordinate, ignored
- * @param y the y coordinate, ignored
- * @return false
- * @deprecated use {@link #processMouseMotionEvent(MouseEvent)} instead
- */
- public boolean mouseDrag(Event evt, int x, int y)
- {
- return false;
- }
-
- /**
- * AWT 1.0 MOUSE_UP event handler. This method is meant to be
- * overridden by components providing their own MOUSE_UP handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param x the x coordinate, ignored
- * @param y the y coordinate, ignored
- * @return false
- * @deprecated use {@link #processMouseEvent(MouseEvent)} instead
- */
- public boolean mouseUp(Event evt, int x, int y)
- {
- return false;
- }
-
- /**
- * AWT 1.0 MOUSE_MOVE event handler. This method is meant to be
- * overridden by components providing their own MOUSE_MOVE handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param x the x coordinate, ignored
- * @param y the y coordinate, ignored
- * @return false
- * @deprecated use {@link #processMouseMotionEvent(MouseEvent)} instead
- */
- public boolean mouseMove(Event evt, int x, int y)
- {
- return false;
- }
-
- /**
- * AWT 1.0 MOUSE_ENTER event handler. This method is meant to be
- * overridden by components providing their own MOUSE_ENTER handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param x the x coordinate, ignored
- * @param y the y coordinate, ignored
- * @return false
- * @deprecated use {@link #processMouseEvent(MouseEvent)} instead
- */
- public boolean mouseEnter(Event evt, int x, int y)
- {
- return false;
- }
-
- /**
- * AWT 1.0 MOUSE_EXIT event handler. This method is meant to be
- * overridden by components providing their own MOUSE_EXIT handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param x the x coordinate, ignored
- * @param y the y coordinate, ignored
- * @return false
- * @deprecated use {@link #processMouseEvent(MouseEvent)} instead
- */
- public boolean mouseExit(Event evt, int x, int y)
- {
- return false;
- }
-
- /**
- * AWT 1.0 KEY_PRESS and KEY_ACTION event handler. This method is
- * meant to be overridden by components providing their own key
- * press handler. The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param key the key pressed, ignored
- * @return false
- * @deprecated use {@link #processKeyEvent(KeyEvent)} instead
- */
- public boolean keyDown(Event evt, int key)
- {
- return false;
- }
-
- /**
- * AWT 1.0 KEY_RELEASE and KEY_ACTION_RELEASE event handler. This
- * method is meant to be overridden by components providing their
- * own key release handler. The default implementation simply
- * returns false.
- *
- * @param evt the event to handle
- * @param key the key pressed, ignored
- * @return false
- * @deprecated use {@link #processKeyEvent(KeyEvent)} instead
- */
- public boolean keyUp(Event evt, int key)
- {
- return false;
- }
-
- /**
- * AWT 1.0 ACTION_EVENT event handler. This method is meant to be
- * overridden by components providing their own action event
- * handler. The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param what the object acted on, ignored
- * @return false
- * @deprecated in classes which support actions, use
- * processActionEvent(ActionEvent)
instead
- */
- public boolean action(Event evt, Object what)
- {
- return false;
- }
-
- /**
- * Called to inform this component it has been added to a container.
- * A native peer - if any - is created at this time. This method is
- * called automatically by the AWT system and should not be called by
- * user level code.
- *
- * @see #isDisplayable()
- * @see #removeNotify()
- */
- public void addNotify()
- {
- if (peer == null)
- peer = getToolkit().createComponent(this);
- /* Now that all the children has gotten their peers, we should
- have the event mask needed for this component and its
- lightweight subcomponents. */
- peer.setEventMask(eventMask);
- /* We do not invalidate here, but rather leave that job up to
- the peer. For efficiency, the peer can choose not to
- invalidate if it is happy with the current dimensions,
- etc. */
- }
-
- /**
- * Called to inform this component is has been removed from its
- * container. Its native peer - if any - is destroyed at this time.
- * This method is called automatically by the AWT system and should
- * not be called by user level code.
- *
- * @see #isDisplayable()
- * @see #addNotify()
- */
- public void removeNotify()
- {
- // We null our peer field before disposing of it, such that if we're
- // not the event dispatch thread and the dispatch thread is awoken by
- // the dispose call, there will be no race checking the peer's null
- // status.
-
- ComponentPeer tmp = peer;
- peer = null;
- if (tmp != null)
- tmp.dispose();
- }
-
- /**
- * AWT 1.0 GOT_FOCUS event handler. This method is meant to be
- * overridden by components providing their own GOT_FOCUS handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param what the Object focused, ignored
- * @return false
- * @deprecated use {@link #processFocusEvent(FocusEvent)} instead
- */
- public boolean gotFocus(Event evt, Object what)
- {
- return false;
- }
-
- /**
- * AWT 1.0 LOST_FOCUS event handler. This method is meant to be
- * overridden by components providing their own LOST_FOCUS handler.
- * The default implementation simply returns false.
- *
- * @param evt the event to handle
- * @param what the Object focused, ignored
- * @return false
- * @deprecated use {@link #processFocusEvent(FocusEvent)} instead
- */
- public boolean lostFocus(Event evt, Object what)
- {
- return false;
- }
-
- /**
- * Tests whether or not this component is in the group that can be
- * traversed using the keyboard traversal mechanism (such as the TAB key).
- *
- * @return true if the component is traversed via the TAB key
- * @see #setFocusable(boolean)
- * @since 1.1
- * @deprecated use {@link #isFocusable()} instead
- */
- public boolean isFocusTraversable()
- {
- return enabled && visible && (peer == null || isLightweight() || peer.isFocusTraversable());
- }
-
- /**
- * Tests if this component can receive focus.
- *
- * @return true if this component can receive focus
- * @since 1.4
- */
- public boolean isFocusable()
- {
- return focusable;
- }
-
- /**
- * Specify whether this component can receive focus. This method also
- * sets the {@link #isFocusTraversableOverridden} field to 1, which
- * appears to be the undocumented way {@link
- * DefaultFocusTraversalPolicy#accept(Component)} determines whether to
- * respect the {@link #isFocusable()} method of the component.
- *
- * @param focusable the new focusable status
- * @since 1.4
- */
- public void setFocusable(boolean focusable)
- {
- firePropertyChange("focusable", this.focusable, focusable);
- this.focusable = focusable;
- this.isFocusTraversableOverridden = 1;
- }
-
- /**
- * Sets the focus traversal keys for one of the three focus
- * traversal directions supported by Components:
- * {@link #KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS},
- * {@link #KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}, or
- * {@link #KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}. Normally, the
- * default values should match the operating system's native
- * choices. To disable a given traversal, use
- * Collections.EMPTY_SET
. The event dispatcher will
- * consume PRESSED, RELEASED, and TYPED events for the specified
- * key, although focus can only transfer on PRESSED or RELEASED.
- *
- *
- *
- *
- * If keystrokes is null, this component's focus traversal key set
- * is inherited from one of its ancestors. If none of its ancestors
- * has its own set of focus traversal keys, the focus traversal keys
- * are set to the defaults retrieved from the current
- * KeyboardFocusManager. If not null, the set must contain only
- * AWTKeyStrokes that are not already focus keys and are not
- * KEY_TYPED events.
- *
- * @param id one of FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS, or
- * UP_CYCLE_TRAVERSAL_KEYS
- * @param keystrokes a set of keys, or null
- * @throws IllegalArgumentException if id or keystrokes is invalid
- * @see #getFocusTraversalKeys(int)
- * @see KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
- * @see KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
- * @see KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
- * @since 1.4
- */
- public void setFocusTraversalKeys(int id, Set keystrokes)
- {
- if (keystrokes == null)
- {
- Container parent = getParent ();
-
- while (parent != null)
- {
- if (parent.areFocusTraversalKeysSet (id))
- {
- keystrokes = parent.getFocusTraversalKeys (id);
- break;
- }
- parent = parent.getParent ();
- }
-
- if (keystrokes == null)
- keystrokes = KeyboardFocusManager.getCurrentKeyboardFocusManager ().
- getDefaultFocusTraversalKeys (id);
- }
-
- Set sa;
- Set sb;
- String name;
- switch (id)
- {
- case KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS:
- sa = getFocusTraversalKeys
- (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
- sb = getFocusTraversalKeys
- (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS);
- name = "forwardFocusTraversalKeys";
- break;
- case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS:
- sa = getFocusTraversalKeys
- (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- sb = getFocusTraversalKeys
- (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS);
- name = "backwardFocusTraversalKeys";
- break;
- case KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS:
- sa = getFocusTraversalKeys
- (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- sb = getFocusTraversalKeys
- (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
- name = "upCycleFocusTraversalKeys";
- break;
- default:
- throw new IllegalArgumentException ();
- }
-
- int i = keystrokes.size ();
- Iterator iter = keystrokes.iterator ();
-
- while (--i >= 0)
- {
- Object o = iter.next ();
- if (!(o instanceof AWTKeyStroke)
- || sa.contains (o) || sb.contains (o)
- || ((AWTKeyStroke) o).keyCode == KeyEvent.VK_UNDEFINED)
- throw new IllegalArgumentException ();
- }
-
- if (focusTraversalKeys == null)
- focusTraversalKeys = new Set[3];
-
- keystrokes = Collections.unmodifiableSet (new HashSet (keystrokes));
- firePropertyChange (name, focusTraversalKeys[id], keystrokes);
-
- focusTraversalKeys[id] = keystrokes;
- }
-
- /**
- * Returns the set of keys for a given focus traversal action, as
- * defined in Identifier Meaning Default
- *
- * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS
- * Normal forward traversal
- * TAB on KEY_PRESSED, Ctrl-TAB on KEY_PRESSED
- * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS
- * Normal backward traversal
- * Shift-TAB on KEY_PRESSED, Ctrl-Shift-TAB on KEY_PRESSED
- * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
- * Go up a traversal cycle None setFocusTraversalKeys
. If not set, this
- * is inherited from the parent component, which may have gotten it
- * from the KeyboardFocusManager.
- *
- * @param id one of FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS,
- * or UP_CYCLE_TRAVERSAL_KEYS
- *
- * @return set of traversal keys
- *
- * @throws IllegalArgumentException if id is invalid
- *
- * @see #setFocusTraversalKeys (int, Set)
- * @see KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
- * @see KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
- * @see KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
- *
- * @since 1.4
- */
- public Set getFocusTraversalKeys (int id)
- {
- if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS)
- throw new IllegalArgumentException();
-
- Set s = null;
-
- if (focusTraversalKeys != null)
- s = focusTraversalKeys[id];
-
- if (s == null && parent != null)
- s = parent.getFocusTraversalKeys (id);
-
- return s == null ? (KeyboardFocusManager.getCurrentKeyboardFocusManager()
- .getDefaultFocusTraversalKeys(id)) : s;
- }
-
- /**
- * Tests whether the focus traversal keys for a given action are explicitly
- * set or inherited.
- *
- * @param id one of FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS,
- * or UP_CYCLE_TRAVERSAL_KEYS
- * @return true if that set is explicitly specified
- * @throws IllegalArgumentException if id is invalid
- * @see #getFocusTraversalKeys (int)
- * @see KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
- * @see KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
- * @see KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
- * @since 1.4
- */
- public boolean areFocusTraversalKeysSet (int id)
- {
- if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS)
- throw new IllegalArgumentException ();
-
- return focusTraversalKeys != null && focusTraversalKeys[id] != null;
- }
-
- /**
- * Enable or disable focus traversal keys on this Component. If
- * they are, then the keyboard focus manager consumes and acts on
- * key press and release events that trigger focus traversal, and
- * discards the corresponding key typed events. If focus traversal
- * keys are disabled, then all key events that would otherwise
- * trigger focus traversal are sent to this Component.
- *
- * @param focusTraversalKeysEnabled the new value of the flag
- * @see #getFocusTraversalKeysEnabled ()
- * @see #setFocusTraversalKeys (int, Set)
- * @see #getFocusTraversalKeys (int)
- * @since 1.4
- */
- public void setFocusTraversalKeysEnabled (boolean focusTraversalKeysEnabled)
- {
- firePropertyChange ("focusTraversalKeysEnabled",
- this.focusTraversalKeysEnabled,
- focusTraversalKeysEnabled);
- this.focusTraversalKeysEnabled = focusTraversalKeysEnabled;
- }
-
- /**
- * Check whether or not focus traversal keys are enabled on this
- * Component. If they are, then the keyboard focus manager consumes
- * and acts on key press and release events that trigger focus
- * traversal, and discards the corresponding key typed events. If
- * focus traversal keys are disabled, then all key events that would
- * otherwise trigger focus traversal are sent to this Component.
- *
- * @return true if focus traversal keys are enabled
- * @see #setFocusTraversalKeysEnabled (boolean)
- * @see #setFocusTraversalKeys (int, Set)
- * @see #getFocusTraversalKeys (int)
- * @since 1.4
- */
- public boolean getFocusTraversalKeysEnabled ()
- {
- return focusTraversalKeysEnabled;
- }
-
- /**
- * Request that this Component be given the keyboard input focus and
- * that its top-level ancestor become the focused Window.
- *
- * For the request to be granted, the Component must be focusable,
- * displayable and showing and the top-level Window to which it
- * belongs must be focusable. If the request is initially denied on
- * the basis that the top-level Window is not focusable, the request
- * will be remembered and granted when the Window does become
- * focused.
- *
- * Never assume that this Component is the focus owner until it
- * receives a FOCUS_GAINED event.
- *
- * The behaviour of this method is platform-dependent.
- * {@link #requestFocusInWindow()} should be used instead.
- *
- * @see #requestFocusInWindow ()
- * @see FocusEvent
- * @see #addFocusListener (FocusListener)
- * @see #isFocusable ()
- * @see #isDisplayable ()
- * @see KeyboardFocusManager#clearGlobalFocusOwner ()
- */
- public void requestFocus ()
- {
- if (isDisplayable ()
- && isShowing ()
- && isFocusable ())
- {
- synchronized (getTreeLock ())
- {
- // Find this Component's top-level ancestor.
- Container parent = getParent ();
-
- while (parent != null
- && !(parent instanceof Window))
- parent = parent.getParent ();
-
- Window toplevel = (Window) parent;
- if (toplevel.isFocusableWindow ())
- {
- if (peer != null && !isLightweight())
- // This call will cause a FOCUS_GAINED event to be
- // posted to the system event queue if the native
- // windowing system grants the focus request.
- peer.requestFocus ();
- else
- {
- // Either our peer hasn't been created yet or we're a
- // lightweight component. In either case we want to
- // post a FOCUS_GAINED event.
- 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, this));
- eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false,
- currentFocusOwner));
- }
- else
- eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false));
- }
- }
- }
- else
- pendingFocusRequest = new FocusEvent(this, FocusEvent.FOCUS_GAINED);
- }
- }
- }
-
- /**
- * Request that this Component be given the keyboard input focus and
- * that its top-level ancestor become the focused Window.
- *
- * For the request to be granted, the Component must be focusable,
- * displayable and showing and the top-level Window to which it
- * belongs must be focusable. If the request is initially denied on
- * the basis that the top-level Window is not focusable, the request
- * will be remembered and granted when the Window does become
- * focused.
- *
- * Never assume that this Component is the focus owner until it
- * receives a FOCUS_GAINED event.
- *
- * The behaviour of this method is platform-dependent.
- * {@link #requestFocusInWindow()} should be used instead.
- *
- * If the return value is false, the request is guaranteed to fail.
- * If the return value is true, the request will succeed unless it
- * is vetoed or something in the native windowing system intervenes,
- * preventing this Component's top-level ancestor from becoming
- * focused. This method is meant to be called by derived
- * lightweight Components that want to avoid unnecessary repainting
- * when they know a given focus transfer need only be temporary.
- *
- * @param temporary true if the focus request is temporary
- * @return true if the request has a chance of success
- * @see #requestFocusInWindow ()
- * @see FocusEvent
- * @see #addFocusListener (FocusListener)
- * @see #isFocusable ()
- * @see #isDisplayable ()
- * @see KeyboardFocusManager#clearGlobalFocusOwner ()
- * @since 1.4
- */
- protected boolean requestFocus (boolean temporary)
- {
- if (isDisplayable ()
- && isShowing ()
- && isFocusable ())
- {
- synchronized (getTreeLock ())
- {
- // Find this Component's top-level ancestor.
- Container parent = getParent ();
-
- while (parent != null
- && !(parent instanceof Window))
- parent = parent.getParent ();
-
- Window toplevel = (Window) parent;
- if (toplevel.isFocusableWindow ())
- {
- if (peer != null && !isLightweight())
- // This call will cause a FOCUS_GAINED event to be
- // posted to the system event queue if the native
- // windowing system grants the focus request.
- peer.requestFocus ();
- else
- {
- // Either our peer hasn't been created yet or we're a
- // lightweight component. In either case we want to
- // post a FOCUS_GAINED event.
- 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,
- temporary, this));
- eq.postEvent (new FocusEvent(this,
- FocusEvent.FOCUS_GAINED,
- temporary,
- currentFocusOwner));
- }
- else
- eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
- }
- }
- }
- else
- // FIXME: need to add a focus listener to our top-level
- // ancestor, so that we can post this event when it becomes
- // the focused window.
- pendingFocusRequest = new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary);
- }
- }
- // Always return true.
- return true;
- }
-
- /**
- * Request that this component be given the keyboard input focus, if
- * its top-level ancestor is the currently focused Window. A
- * FOCUS_GAINED
event will be fired if and only if this
- * request is successful. To be successful, the component must be
- * displayable, showing, and focusable, and its ancestor top-level
- * Window must be focused.
- *
- * If the return value is false, the request is guaranteed to fail.
- * If the return value is true, the request will succeed unless it
- * is vetoed or something in the native windowing system intervenes,
- * preventing this Component's top-level ancestor from becoming
- * focused.
- *
- * @return true if the request has a chance of success
- * @see #requestFocus ()
- * @see FocusEvent
- * @see #addFocusListener (FocusListener)
- * @see #isFocusable ()
- * @see #isDisplayable ()
- * @see KeyboardFocusManager#clearGlobalFocusOwner ()
- * @since 1.4
- */
- public boolean requestFocusInWindow ()
- {
- return requestFocusInWindow (false);
- }
-
- /**
- * Request that this component be given the keyboard input focus, if
- * its top-level ancestor is the currently focused Window. A
- * FOCUS_GAINED
event will be fired if and only if this
- * request is successful. To be successful, the component must be
- * displayable, showing, and focusable, and its ancestor top-level
- * Window must be focused.
- *
- * If the return value is false, the request is guaranteed to fail.
- * If the return value is true, the request will succeed unless it
- * is vetoed or something in the native windowing system intervenes,
- * preventing this Component's top-level ancestor from becoming
- * focused. This method is meant to be called by derived
- * lightweight Components that want to avoid unnecessary repainting
- * when they know a given focus transfer need only be temporary.
- *
- * @param temporary true if the focus request is temporary
- * @return true if the request has a chance of success
- * @see #requestFocus ()
- * @see FocusEvent
- * @see #addFocusListener (FocusListener)
- * @see #isFocusable ()
- * @see #isDisplayable ()
- * @see KeyboardFocusManager#clearGlobalFocusOwner ()
- * @since 1.4
- */
- protected boolean requestFocusInWindow (boolean temporary)
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- Window focusedWindow = manager.getFocusedWindow ();
-
- if (isDisplayable ()
- && isShowing ()
- && isFocusable ())
- {
- if (focusedWindow != null)
- {
- synchronized (getTreeLock ())
- {
- Container parent = getParent ();
-
- while (parent != null
- && !(parent instanceof Window))
- parent = parent.getParent ();
-
- Window toplevel = (Window) parent;
-
- // Check if top-level ancestor is currently focused window.
- if (focusedWindow == toplevel)
- {
- if (peer != null
- && !isLightweight()
- && !(this instanceof Window))
- // This call will cause a FOCUS_GAINED event to be
- // posted to the system event queue if the native
- // windowing system grants the focus request.
- peer.requestFocus ();
- else
- {
- // Either our peer hasn't been created yet or we're a
- // lightweight component. In either case we want to
- // post a FOCUS_GAINED event.
- EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
- synchronized (eq)
- {
- Component currentFocusOwner = manager.getGlobalPermanentFocusOwner ();
- if (currentFocusOwner != null)
- {
- eq.postEvent (new FocusEvent(currentFocusOwner, FocusEvent.FOCUS_LOST,
- temporary, this));
- eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary,
- currentFocusOwner));
- }
- else
- eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, temporary));
- }
- }
- }
- else
- return false;
- }
- }
-
- return true;
- }
- return false;
- }
-
- /**
- * Transfers focus to the next component in the focus traversal
- * order, as though this were the current focus owner.
- *
- * @see #requestFocus()
- * @since 1.1
- */
- public void transferFocus ()
- {
- nextFocus ();
- }
-
- /**
- * Returns the root container that owns the focus cycle where this
- * component resides. A focus cycle root is in two cycles, one as
- * the ancestor, and one as the focusable element; this call always
- * returns the ancestor.
- *
- * @return the ancestor container that owns the focus cycle
- * @since 1.4
- */
- public Container getFocusCycleRootAncestor ()
- {
- if (this instanceof Window
- && ((Container) this).isFocusCycleRoot ())
- return (Container) this;
-
- Container parent = getParent ();
-
- while (parent != null
- && !parent.isFocusCycleRoot ())
- parent = parent.getParent ();
-
- return parent;
- }
-
- /**
- * Tests if the container is the ancestor of the focus cycle that
- * this component belongs to.
- *
- * @param c the container to test
- * @return true if c is the focus cycle root
- * @since 1.4
- */
- public boolean isFocusCycleRoot (Container c)
- {
- return c == getFocusCycleRootAncestor ();
- }
-
- /**
- * AWT 1.0 focus event processor. Transfers focus to the next
- * component in the focus traversal order, as though this were the
- * current focus owner.
- *
- * @deprecated use {@link #transferFocus ()} instead
- */
- public void nextFocus ()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- manager.focusNextComponent (this);
- }
-
- /**
- * Transfers focus to the previous component in the focus traversal
- * order, as though this were the current focus owner.
- *
- * @see #requestFocus ()
- * @since 1.4
- */
- public void transferFocusBackward ()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- manager.focusPreviousComponent (this);
- }
-
- /**
- * Transfers focus to the focus cycle root of this component.
- * However, if this is a Window, the default focus owner in the
- * window in the current focus cycle is focused instead.
- *
- * @see #requestFocus()
- * @see #isFocusCycleRoot(Container)
- * @since 1.4
- */
- public void transferFocusUpCycle ()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- manager.upFocusCycle (this);
- }
-
- /**
- * Tests if this component is the focus owner. Use {@link
- * #isFocusOwner ()} instead.
- *
- * @return true if this component owns focus
- * @since 1.2
- */
- public boolean hasFocus ()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- Component focusOwner = manager.getFocusOwner ();
-
- return this == focusOwner;
- }
-
- /**
- * Tests if this component is the focus owner.
- *
- * @return true if this component owns focus
- * @since 1.4
- */
- public boolean isFocusOwner()
- {
- return hasFocus ();
- }
-
- /**
- * Adds the specified popup menu to this component.
- *
- * @param popup the popup menu to be added
- *
- * @see #remove(MenuComponent)
- *
- * @since 1.1
- */
- public synchronized void add(PopupMenu popup)
- {
- if (popups == null)
- popups = new Vector();
- popups.add(popup);
-
- if (popup.parent != null)
- popup.parent.remove(popup);
- popup.parent = this;
- if (peer != null)
- popup.addNotify();
- }
-
- /**
- * Removes the specified popup menu from this component.
- *
- * @param popup the popup menu to remove
- * @see #add(PopupMenu)
- * @since 1.1
- */
- public synchronized void remove(MenuComponent popup)
- {
- if (popups != null)
- popups.remove(popup);
- }
-
- /**
- * Returns a debugging string representing this component. The string may
- * be empty but not null.
- *
- * @return a string representing this component
- */
- protected String paramString()
- {
- StringBuffer param = new StringBuffer();
- String name = getName();
- if (name != null)
- param.append(name).append(",");
- param.append(x).append(",").append(y).append(",").append(width)
- .append("x").append(height);
- if (! isValid())
- param.append(",invalid");
- if (! isVisible())
- param.append(",invisible");
- if (! isEnabled())
- param.append(",disabled");
- if (! isOpaque())
- param.append(",translucent");
- if (isDoubleBuffered())
- param.append(",doublebuffered");
- return param.toString();
- }
-
- /**
- * Returns a string representation of this component. This is implemented
- * as getClass().getName() + '[' + paramString() + ']'
.
- *
- * @return a string representation of this component
- */
- public String toString()
- {
- return getClass().getName() + '[' + paramString() + ']';
- }
-
- /**
- * Prints a listing of this component to System.out
.
- *
- * @see #list(PrintStream)
- */
- public void list()
- {
- list(System.out, 0);
- }
-
- /**
- * Prints a listing of this component to the specified print stream.
- *
- * @param out the PrintStream
to print to
- */
- public void list(PrintStream out)
- {
- list(out, 0);
- }
-
- /**
- * Prints a listing of this component to the specified print stream,
- * starting at the specified indentation point.
- *
- * @param out the PrintStream
to print to
- * @param indent the indentation point
- */
- public void list(PrintStream out, int indent)
- {
- for (int i = 0; i < indent; ++i)
- out.print(' ');
- out.println(toString());
- }
-
- /**
- * Prints a listing of this component to the specified print writer.
- *
- * @param out the PrintWrinter
to print to
- * @since 1.1
- */
- public void list(PrintWriter out)
- {
- list(out, 0);
- }
-
- /**
- * Prints a listing of this component to the specified print writer,
- * starting at the specified indentation point.
- *
- * @param out the PrintWriter
to print to
- * @param indent the indentation point
- * @since 1.1
- */
- public void list(PrintWriter out, int indent)
- {
- for (int i = 0; i < indent; ++i)
- out.print(' ');
- out.println(toString());
- }
-
- /**
- * Adds the specified property listener to this component. This is harmless
- * if the listener is null, but if the listener has already been registered,
- * it will now be registered twice. The property listener ignores inherited
- * properties. Recognized properties include:
- *
- *
- *
- * @param listener the new listener to add
- * @see #removePropertyChangeListener(PropertyChangeListener)
- * @see #getPropertyChangeListeners()
- * @see #addPropertyChangeListener(String, PropertyChangeListener)
- * @since 1.1
- */
- public void addPropertyChangeListener(PropertyChangeListener listener)
- {
- if (changeSupport == null)
- changeSupport = new PropertyChangeSupport(this);
- changeSupport.addPropertyChangeListener(listener);
- }
-
- /**
- * Removes the specified property listener from the component. This is
- * harmless if the listener was not previously registered.
- *
- * @param listener the listener to remove
- * @see #addPropertyChangeListener(PropertyChangeListener)
- * @see #getPropertyChangeListeners()
- * @see #removePropertyChangeListener(String, PropertyChangeListener)
- * @since 1.1
- */
- public void removePropertyChangeListener(PropertyChangeListener listener)
- {
- if (changeSupport != null)
- changeSupport.removePropertyChangeListener(listener);
- }
-
- /**
- * Returns an array of all specified listeners registered on this component.
- *
- * @return an array of listeners
- * @see #addPropertyChangeListener(PropertyChangeListener)
- * @see #removePropertyChangeListener(PropertyChangeListener)
- * @see #getPropertyChangeListeners(String)
- * @since 1.4
- */
- public PropertyChangeListener[] getPropertyChangeListeners()
- {
- return changeSupport == null ? new PropertyChangeListener[0]
- : changeSupport.getPropertyChangeListeners();
- }
-
- /**
- * Adds the specified property listener to this component. This is harmless
- * if the listener is null, but if the listener has already been registered,
- * it will now be registered twice. The property listener ignores inherited
- * properties. The listener is keyed to a single property. Recognized
- * properties include:"font"
)"background"
)"foreground"
)"focusable"
)"focusTraversalKeysEnabled"
)"forwardFocusTraversalKeys"
)"backwardFocusTraversalKeys"
)"upCycleFocusTraversalKeys"
)
- *
- *
- *
- * @param propertyName the property name to filter on
- * @param listener the new listener to add
- * @see #removePropertyChangeListener(String, PropertyChangeListener)
- * @see #getPropertyChangeListeners(String)
- * @see #addPropertyChangeListener(PropertyChangeListener)
- * @since 1.1
- */
- public void addPropertyChangeListener(String propertyName,
- PropertyChangeListener listener)
- {
- if (changeSupport == null)
- changeSupport = new PropertyChangeSupport(this);
- changeSupport.addPropertyChangeListener(propertyName, listener);
- }
-
- /**
- * Removes the specified property listener on a particular property from
- * the component. This is harmless if the listener was not previously
- * registered.
- *
- * @param propertyName the property name to filter on
- * @param listener the listener to remove
- * @see #addPropertyChangeListener(String, PropertyChangeListener)
- * @see #getPropertyChangeListeners(String)
- * @see #removePropertyChangeListener(PropertyChangeListener)
- * @since 1.1
- */
- public void removePropertyChangeListener(String propertyName,
- PropertyChangeListener listener)
- {
- if (changeSupport != null)
- changeSupport.removePropertyChangeListener(propertyName, listener);
- }
-
- /**
- * Returns an array of all specified listeners on the named property that
- * are registered on this component.
- *
- * @return an array of listeners
- * @see #addPropertyChangeListener(String, PropertyChangeListener)
- * @see #removePropertyChangeListener(String, PropertyChangeListener)
- * @see #getPropertyChangeListeners()
- * @since 1.4
- */
- public PropertyChangeListener[] getPropertyChangeListeners(String property)
- {
- return changeSupport == null ? new PropertyChangeListener[0]
- : changeSupport.getPropertyChangeListeners(property);
- }
-
- /**
- * Report a change in a bound property to any registered property listeners.
- *
- * @param propertyName the property that changed
- * @param oldValue the old property value
- * @param newValue the new property value
- */
- protected void firePropertyChange(String propertyName, Object oldValue,
- Object newValue)
- {
- if (changeSupport != null)
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
- }
-
- /**
- * Report a change in a bound property to any registered property listeners.
- *
- * @param propertyName the property that changed
- * @param oldValue the old property value
- * @param newValue the new property value
- */
- protected void firePropertyChange(String propertyName, boolean oldValue,
- boolean newValue)
- {
- if (changeSupport != null)
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
- }
-
- /**
- * Report a change in a bound property to any registered property listeners.
- *
- * @param propertyName the property that changed
- * @param oldValue the old property value
- * @param newValue the new property value
- */
- protected void firePropertyChange(String propertyName, int oldValue,
- int newValue)
- {
- if (changeSupport != null)
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
- }
-
- /**
- * Sets the text layout orientation of this component. New components default
- * to UNKNOWN (which behaves like LEFT_TO_RIGHT). This method affects only
- * the current component, while
- * {@link #applyComponentOrientation(ComponentOrientation)} affects the
- * entire hierarchy.
- *
- * @param o the new orientation
- * @throws NullPointerException if o is null
- * @see #getComponentOrientation()
- */
- public void setComponentOrientation(ComponentOrientation o)
- {
- if (o == null)
- throw new NullPointerException();
- ComponentOrientation oldOrientation = orientation;
- orientation = o;
- firePropertyChange("componentOrientation", oldOrientation, o);
- }
-
- /**
- * Determines the text layout orientation used by this component.
- *
- * @return the component orientation
- * @see #setComponentOrientation(ComponentOrientation)
- */
- public ComponentOrientation getComponentOrientation()
- {
- return orientation;
- }
-
- /**
- * Sets the text layout orientation of this component. New components default
- * to UNKNOWN (which behaves like LEFT_TO_RIGHT). This method affects the
- * entire hierarchy, while
- * {@link #setComponentOrientation(ComponentOrientation)} affects only the
- * current component.
- *
- * @param o the new orientation
- * @throws NullPointerException if o is null
- * @see #getComponentOrientation()
- * @since 1.4
- */
- public void applyComponentOrientation(ComponentOrientation o)
- {
- setComponentOrientation(o);
- }
-
- /**
- * Returns the accessibility framework context of this class. Component is
- * not accessible, so the default implementation returns null. Subclasses
- * must override this behavior, and return an appropriate subclass of
- * {@link AccessibleAWTComponent}.
- *
- * @return the accessibility context
- */
- public AccessibleContext getAccessibleContext()
- {
- return null;
- }
-
-
- // Helper methods; some are package visible for use by subclasses.
-
- /**
- * Subclasses should override this to return unique component names like
- * "menuitem0".
- *
- * @return the generated name for this component
- */
- String generateName()
- {
- // Component is abstract.
- return null;
- }
-
- /**
- * Sets the peer for this component.
- *
- * @param peer the new peer
- */
- final void setPeer(ComponentPeer peer)
- {
- this.peer = peer;
- }
-
- /**
- * Implementation method that allows classes such as Canvas and Window to
- * override the graphics configuration without violating the published API.
- *
- * @return the graphics configuration
- */
- GraphicsConfiguration getGraphicsConfigurationImpl()
- {
- if (peer != null)
- {
- GraphicsConfiguration config = peer.getGraphicsConfiguration();
- if (config != null)
- return config;
- }
-
- if (parent != null)
- return parent.getGraphicsConfiguration();
-
- return null;
- }
-
- /**
- * Translate an AWT 1.1 event ({@link AWTEvent}) into an AWT 1.0
- * event ({@link Event}).
- *
- * @param e an AWT 1.1 event to translate
- *
- * @return an AWT 1.0 event representing e
- */
- static Event translateEvent (AWTEvent e)
- {
- Component target = (Component) e.getSource ();
- Event translated = null;
-
- if (e instanceof InputEvent)
- {
- InputEvent ie = (InputEvent) e;
- long when = ie.getWhen ();
-
- int oldID = 0;
- int id = e.getID ();
-
- int oldMods = 0;
- int mods = ie.getModifiersEx ();
-
- if ((mods & InputEvent.BUTTON2_DOWN_MASK) != 0)
- oldMods |= Event.META_MASK;
- else if ((mods & InputEvent.BUTTON3_DOWN_MASK) != 0)
- oldMods |= Event.ALT_MASK;
-
- if ((mods & InputEvent.SHIFT_DOWN_MASK) != 0)
- oldMods |= Event.SHIFT_MASK;
-
- if ((mods & InputEvent.CTRL_DOWN_MASK) != 0)
- oldMods |= Event.CTRL_MASK;
-
- if ((mods & InputEvent.META_DOWN_MASK) != 0)
- oldMods |= Event.META_MASK;
-
- if ((mods & InputEvent.ALT_DOWN_MASK) != 0)
- oldMods |= Event.ALT_MASK;
-
- if (e instanceof MouseEvent)
- {
- if (id == MouseEvent.MOUSE_PRESSED)
- oldID = Event.MOUSE_DOWN;
- else if (id == MouseEvent.MOUSE_RELEASED)
- oldID = Event.MOUSE_UP;
- else if (id == MouseEvent.MOUSE_MOVED)
- oldID = Event.MOUSE_MOVE;
- else if (id == MouseEvent.MOUSE_DRAGGED)
- oldID = Event.MOUSE_DRAG;
- else if (id == MouseEvent.MOUSE_ENTERED)
- oldID = Event.MOUSE_ENTER;
- else if (id == MouseEvent.MOUSE_EXITED)
- oldID = Event.MOUSE_EXIT;
- else
- // No analogous AWT 1.0 mouse event.
- return null;
-
- MouseEvent me = (MouseEvent) e;
-
- translated = new Event (target, when, oldID,
- me.getX (), me.getY (), 0, oldMods);
- }
- else if (e instanceof KeyEvent)
- {
- if (id == KeyEvent.KEY_PRESSED)
- oldID = Event.KEY_PRESS;
- else if (e.getID () == KeyEvent.KEY_RELEASED)
- oldID = Event.KEY_RELEASE;
- else
- // No analogous AWT 1.0 key event.
- return null;
-
- int oldKey = 0;
- int newKey = ((KeyEvent) e).getKeyCode ();
- switch (newKey)
- {
- case KeyEvent.VK_BACK_SPACE:
- oldKey = Event.BACK_SPACE;
- break;
- case KeyEvent.VK_CAPS_LOCK:
- oldKey = Event.CAPS_LOCK;
- break;
- case KeyEvent.VK_DELETE:
- oldKey = Event.DELETE;
- break;
- case KeyEvent.VK_DOWN:
- case KeyEvent.VK_KP_DOWN:
- oldKey = Event.DOWN;
- break;
- case KeyEvent.VK_END:
- oldKey = Event.END;
- break;
- case KeyEvent.VK_ENTER:
- oldKey = Event.ENTER;
- break;
- case KeyEvent.VK_ESCAPE:
- oldKey = Event.ESCAPE;
- break;
- case KeyEvent.VK_F1:
- oldKey = Event.F1;
- break;
- case KeyEvent.VK_F10:
- oldKey = Event.F10;
- break;
- case KeyEvent.VK_F11:
- oldKey = Event.F11;
- break;
- case KeyEvent.VK_F12:
- oldKey = Event.F12;
- break;
- case KeyEvent.VK_F2:
- oldKey = Event.F2;
- break;
- case KeyEvent.VK_F3:
- oldKey = Event.F3;
- break;
- case KeyEvent.VK_F4:
- oldKey = Event.F4;
- break;
- case KeyEvent.VK_F5:
- oldKey = Event.F5;
- break;
- case KeyEvent.VK_F6:
- oldKey = Event.F6;
- break;
- case KeyEvent.VK_F7:
- oldKey = Event.F7;
- break;
- case KeyEvent.VK_F8:
- oldKey = Event.F8;
- break;
- case KeyEvent.VK_F9:
- oldKey = Event.F9;
- break;
- case KeyEvent.VK_HOME:
- oldKey = Event.HOME;
- break;
- case KeyEvent.VK_INSERT:
- oldKey = Event.INSERT;
- break;
- case KeyEvent.VK_LEFT:
- case KeyEvent.VK_KP_LEFT:
- oldKey = Event.LEFT;
- break;
- case KeyEvent.VK_NUM_LOCK:
- oldKey = Event.NUM_LOCK;
- break;
- case KeyEvent.VK_PAUSE:
- oldKey = Event.PAUSE;
- break;
- case KeyEvent.VK_PAGE_DOWN:
- oldKey = Event.PGDN;
- break;
- case KeyEvent.VK_PAGE_UP:
- oldKey = Event.PGUP;
- break;
- case KeyEvent.VK_PRINTSCREEN:
- oldKey = Event.PRINT_SCREEN;
- break;
- case KeyEvent.VK_RIGHT:
- case KeyEvent.VK_KP_RIGHT:
- oldKey = Event.RIGHT;
- break;
- case KeyEvent.VK_SCROLL_LOCK:
- oldKey = Event.SCROLL_LOCK;
- break;
- case KeyEvent.VK_TAB:
- oldKey = Event.TAB;
- break;
- case KeyEvent.VK_UP:
- case KeyEvent.VK_KP_UP:
- oldKey = Event.UP;
- break;
- default:
- oldKey = newKey;
- }
-
- translated = new Event (target, when, oldID,
- 0, 0, oldKey, oldMods);
- }
- }
- else if (e instanceof ActionEvent)
- translated = new Event (target, Event.ACTION_EVENT,
- ((ActionEvent) e).getActionCommand ());
-
- return translated;
- }
-
- /**
- * Implementation of dispatchEvent. Allows trusted package classes
- * to dispatch additional events first. This implementation first
- * translates "font"
)"background"
)"foreground"
)"focusable"
)"focusTraversalKeysEnabled"
)"forwardFocusTraversalKeys"
)"backwardFocusTraversalKeys"
)"upCycleFocusTraversalKeys"
)e
to an AWT 1.0 event and sends the
- * result to {@link #postEvent}. If the AWT 1.0 event is not
- * handled, and events of type e
are enabled for this
- * component, e is passed on to {@link #processEvent}.
- *
- * @param e the event to dispatch
- */
-
- void dispatchEventImpl (AWTEvent e)
- {
- Event oldEvent = translateEvent (e);
-
- if (oldEvent != null)
- postEvent (oldEvent);
-
- if (eventTypeEnabled (e.id))
- {
- // the trick we use to communicate between dispatch and redispatch
- // is to have KeyboardFocusManager.redispatch synchronize on the
- // object itself. we then do not redispatch to KeyboardFocusManager
- // if we are already holding the lock.
- if (! Thread.holdsLock(e))
- {
- switch (e.id)
- {
- case WindowEvent.WINDOW_GAINED_FOCUS:
- case WindowEvent.WINDOW_LOST_FOCUS:
- case KeyEvent.KEY_PRESSED:
- case KeyEvent.KEY_RELEASED:
- case KeyEvent.KEY_TYPED:
- case FocusEvent.FOCUS_GAINED:
- case FocusEvent.FOCUS_LOST:
- if (KeyboardFocusManager
- .getCurrentKeyboardFocusManager()
- .dispatchEvent(e))
- return;
- }
- }
- processEvent (e);
- }
- }
-
- /**
- * Tells whether or not an event type is enabled.
- */
- boolean eventTypeEnabled (int type)
- {
- if (type > AWTEvent.RESERVED_ID_MAX)
- return true;
-
- switch (type)
- {
- case ComponentEvent.COMPONENT_HIDDEN:
- case ComponentEvent.COMPONENT_MOVED:
- case ComponentEvent.COMPONENT_RESIZED:
- case ComponentEvent.COMPONENT_SHOWN:
- return (componentListener != null
- || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0);
-
- case KeyEvent.KEY_PRESSED:
- case KeyEvent.KEY_RELEASED:
- case KeyEvent.KEY_TYPED:
- return (keyListener != null
- || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0);
-
- case MouseEvent.MOUSE_CLICKED:
- case MouseEvent.MOUSE_ENTERED:
- case MouseEvent.MOUSE_EXITED:
- case MouseEvent.MOUSE_PRESSED:
- case MouseEvent.MOUSE_RELEASED:
- case MouseEvent.MOUSE_MOVED:
- case MouseEvent.MOUSE_DRAGGED:
- return (mouseListener != null
- || mouseMotionListener != null
- || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0);
-
- case FocusEvent.FOCUS_GAINED:
- case FocusEvent.FOCUS_LOST:
- return (focusListener != null
- || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0);
-
- case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
- case InputMethodEvent.CARET_POSITION_CHANGED:
- return (inputMethodListener != null
- || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0);
-
- case PaintEvent.PAINT:
- case PaintEvent.UPDATE:
- return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0;
-
- default:
- return false;
- }
- }
-
- /**
- * Coalesce paint events. Current heuristic is: Merge if the union of
- * areas is less than twice that of the sum of the areas. The X server
- * tend to create a lot of paint events that are adjacent but not
- * overlapping.
- *
- *
- * +------+
- * | +-----+ ...will be merged
- * | | |
- * | | |
- * +------+ |
- * +-----+
- *
- * +---------------+--+
- * | | | ...will not be merged
- * +---------------+ |
- * | |
- * | |
- * | |
- * | |
- * | |
- * +--+
- *
- *
- * @param queuedEvent the first paint event
- * @param newEvent the second paint event
- * @return the combined paint event, or null
- */
- private PaintEvent coalescePaintEvents(PaintEvent queuedEvent,
- PaintEvent newEvent)
- {
- Rectangle r1 = queuedEvent.getUpdateRect();
- Rectangle r2 = newEvent.getUpdateRect();
- Rectangle union = r1.union(r2);
-
- int r1a = r1.width * r1.height;
- int r2a = r2.width * r2.height;
- int ua = union.width * union.height;
-
- if (ua > (r1a+r2a)*2)
- return null;
- /* The 2 factor should maybe be reconsidered. Perhaps 3/2
- would be better? */
-
- newEvent.setUpdateRect(union);
- return newEvent;
- }
-
- /**
- * This method is used to implement transferFocus(). CHILD is the child
- * making the request. This is overridden by Container; when called for an
- * ordinary component there is no child and so we always return null.
- *
- * FIXME: is this still needed, in light of focus traversal policies?
- *
- * @param child the component making the request
- * @return the next component to focus on
- */
- Component findNextFocusComponent(Component child)
- {
- return null;
- }
-
- /**
- * Deserializes this component. This regenerates all serializable listeners
- * which were registered originally.
- *
- * @param s the stream to read from
- * @throws ClassNotFoundException if deserialization fails
- * @throws IOException if the stream fails
- */
- private void readObject(ObjectInputStream s)
- throws ClassNotFoundException, IOException
- {
- s.defaultReadObject();
- String key = (String) s.readObject();
- while (key != null)
- {
- Object listener = s.readObject();
- if ("componentL".equals(key))
- addComponentListener((ComponentListener) listener);
- else if ("focusL".equals(key))
- addFocusListener((FocusListener) listener);
- else if ("keyL".equals(key))
- addKeyListener((KeyListener) listener);
- else if ("mouseL".equals(key))
- addMouseListener((MouseListener) listener);
- else if ("mouseMotionL".equals(key))
- addMouseMotionListener((MouseMotionListener) listener);
- else if ("inputMethodL".equals(key))
- addInputMethodListener((InputMethodListener) listener);
- else if ("hierarchyL".equals(key))
- addHierarchyListener((HierarchyListener) listener);
- else if ("hierarchyBoundsL".equals(key))
- addHierarchyBoundsListener((HierarchyBoundsListener) listener);
- else if ("mouseWheelL".equals(key))
- addMouseWheelListener((MouseWheelListener) listener);
- key = (String) s.readObject();
- }
- }
-
- /**
- * Serializes this component. This ignores all listeners which do not
- * implement Serializable, but includes those that do.
- *
- * @param s the stream to write to
- * @throws IOException if the stream fails
- */
- private void writeObject(ObjectOutputStream s) throws IOException
- {
- s.defaultWriteObject();
- AWTEventMulticaster.save(s, "componentL", componentListener);
- AWTEventMulticaster.save(s, "focusL", focusListener);
- AWTEventMulticaster.save(s, "keyL", keyListener);
- AWTEventMulticaster.save(s, "mouseL", mouseListener);
- AWTEventMulticaster.save(s, "mouseMotionL", mouseMotionListener);
- AWTEventMulticaster.save(s, "inputMethodL", inputMethodListener);
- AWTEventMulticaster.save(s, "hierarchyL", hierarchyListener);
- AWTEventMulticaster.save(s, "hierarchyBoundsL", hierarchyBoundsListener);
- AWTEventMulticaster.save(s, "mouseWheelL", mouseWheelListener);
- s.writeObject(null);
- }
-
-
- // Nested classes.
-
- /**
- * This class provides accessibility support for subclasses of container.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4
- */
- protected abstract class AccessibleAWTComponent extends AccessibleContext
- implements Serializable, AccessibleComponent
- {
- /**
- * Compatible with JDK 1.3+.
- */
- private static final long serialVersionUID = 642321655757800191L;
-
- /**
- * Converts show/hide events to PropertyChange events, and is registered
- * as a component listener on this component.
- *
- * @serial the component handler
- */
- protected ComponentListener accessibleAWTComponentHandler
- = new AccessibleAWTComponentHandler();
-
- /**
- * Converts focus events to PropertyChange events, and is registered
- * as a focus listener on this component.
- *
- * @serial the focus handler
- */
- protected FocusListener accessibleAWTFocusHandler
- = new AccessibleAWTFocusHandler();
-
- /**
- * The default constructor.
- */
- protected AccessibleAWTComponent()
- {
- Component.this.addComponentListener(accessibleAWTComponentHandler);
- Component.this.addFocusListener(accessibleAWTFocusHandler);
- }
-
- /**
- * Adds a global property change listener to the accessible component.
- *
- * @param l the listener to add
- * @see #ACCESSIBLE_NAME_PROPERTY
- * @see #ACCESSIBLE_DESCRIPTION_PROPERTY
- * @see #ACCESSIBLE_STATE_PROPERTY
- * @see #ACCESSIBLE_VALUE_PROPERTY
- * @see #ACCESSIBLE_SELECTION_PROPERTY
- * @see #ACCESSIBLE_TEXT_PROPERTY
- * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY
- */
- public void addPropertyChangeListener(PropertyChangeListener l)
- {
- Component.this.addPropertyChangeListener(l);
- super.addPropertyChangeListener(l);
- }
-
- /**
- * Removes a global property change listener from this accessible
- * component.
- *
- * @param l the listener to remove
- */
- public void removePropertyChangeListener(PropertyChangeListener l)
- {
- Component.this.removePropertyChangeListener(l);
- super.removePropertyChangeListener(l);
- }
-
- /**
- * Returns the accessible name of this component. It is almost always
- * wrong to return getName(), since it is not localized. In fact, for
- * things like buttons, this should be the text of the button, not the
- * name of the object. The tooltip text might also be appropriate.
- *
- * @return the name
- * @see #setAccessibleName(String)
- */
- public String getAccessibleName()
- {
- return accessibleName == null ? getName() : accessibleName;
- }
-
- /**
- * Returns a brief description of this accessible context. This should
- * be localized.
- *
- * @return a description of this component
- * @see #setAccessibleDescription(String)
- */
- public String getAccessibleDescription()
- {
- return accessibleDescription;
- }
-
- /**
- * Returns the role of this component.
- *
- * @return the accessible role
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.AWT_COMPONENT;
- }
-
- /**
- * Returns a state set describing this component's state.
- *
- * @return a new state set
- * @see AccessibleState
- */
- public AccessibleStateSet getAccessibleStateSet()
- {
- AccessibleStateSet s = new AccessibleStateSet();
- if (Component.this.isEnabled())
- s.add(AccessibleState.ENABLED);
- if (isFocusable())
- s.add(AccessibleState.FOCUSABLE);
- if (isFocusOwner())
- s.add(AccessibleState.FOCUSED);
- if (isOpaque())
- s.add(AccessibleState.OPAQUE);
- if (Component.this.isShowing())
- s.add(AccessibleState.SHOWING);
- if (Component.this.isVisible())
- s.add(AccessibleState.VISIBLE);
- return s;
- }
-
- /**
- * Returns the parent of this component, if it is accessible.
- *
- * @return the accessible parent
- */
- public Accessible getAccessibleParent()
- {
- if (accessibleParent == null)
- {
- Container parent = getParent();
- accessibleParent = parent instanceof Accessible
- ? (Accessible) parent : null;
- }
- return accessibleParent;
- }
-
- /**
- * Returns the index of this component in its accessible parent.
- *
- * @return the index, or -1 if the parent is not accessible
- * @see #getAccessibleParent()
- */
- public int getAccessibleIndexInParent()
- {
- if (getAccessibleParent() == null)
- return -1;
- AccessibleContext context
- = ((Component) accessibleParent).getAccessibleContext();
- if (context == null)
- return -1;
- for (int i = context.getAccessibleChildrenCount(); --i >= 0; )
- if (context.getAccessibleChild(i) == Component.this)
- return i;
- return -1;
- }
-
- /**
- * Returns the number of children of this component which implement
- * Accessible. Subclasses must override this if they can have children.
- *
- * @return the number of accessible children, default 0
- */
- public int getAccessibleChildrenCount()
- {
- return 0;
- }
-
- /**
- * Returns the ith accessible child. Subclasses must override this if
- * they can have children.
- *
- * @return the ith accessible child, or null
- * @see #getAccessibleChildrenCount()
- */
- public Accessible getAccessibleChild(int i)
- {
- return null;
- }
-
- /**
- * Returns the locale of this component.
- *
- * @return the locale
- * @throws IllegalComponentStateException if the locale is unknown
- */
- public Locale getLocale()
- {
- return Component.this.getLocale();
- }
-
- /**
- * Returns this, since it is an accessible component.
- *
- * @return the accessible component
- */
- public AccessibleComponent getAccessibleComponent()
- {
- return this;
- }
-
- /**
- * Gets the background color.
- *
- * @return the background color
- * @see #setBackground(Color)
- */
- public Color getBackground()
- {
- return Component.this.getBackground();
- }
-
- /**
- * Sets the background color.
- *
- * @param c the background color
- * @see #getBackground()
- * @see #isOpaque()
- */
- public void setBackground(Color c)
- {
- Component.this.setBackground(c);
- }
-
- /**
- * Gets the foreground color.
- *
- * @return the foreground color
- * @see #setForeground(Color)
- */
- public Color getForeground()
- {
- return Component.this.getForeground();
- }
-
- /**
- * Sets the foreground color.
- *
- * @param c the foreground color
- * @see #getForeground()
- */
- public void setForeground(Color c)
- {
- Component.this.setForeground(c);
- }
-
- /**
- * Gets the cursor.
- *
- * @return the cursor
- * @see #setCursor(Cursor)
- */
- public Cursor getCursor()
- {
- return Component.this.getCursor();
- }
-
- /**
- * Sets the cursor.
- *
- * @param cursor the cursor
- * @see #getCursor()
- */
- public void setCursor(Cursor cursor)
- {
- Component.this.setCursor(cursor);
- }
-
- /**
- * Gets the font.
- *
- * @return the font
- * @see #setFont(Font)
- */
- public Font getFont()
- {
- return Component.this.getFont();
- }
-
- /**
- * Sets the font.
- *
- * @param f the font
- * @see #getFont()
- */
- public void setFont(Font f)
- {
- Component.this.setFont(f);
- }
-
- /**
- * Gets the font metrics for a font.
- *
- * @param f the font to look up
- * @return its metrics
- * @throws NullPointerException if f is null
- * @see #getFont()
- */
- public FontMetrics getFontMetrics(Font f)
- {
- return Component.this.getFontMetrics(f);
- }
-
- /**
- * Tests if the component is enabled.
- *
- * @return true if the component is enabled
- * @see #setEnabled(boolean)
- * @see #getAccessibleStateSet()
- * @see AccessibleState#ENABLED
- */
- public boolean isEnabled()
- {
- return Component.this.isEnabled();
- }
-
- /**
- * Set whether the component is enabled.
- *
- * @param b the new enabled status
- * @see #isEnabled()
- */
- public void setEnabled(boolean b)
- {
- Component.this.setEnabled(b);
- }
-
- /**
- * Test whether the component is visible (not necesarily showing).
- *
- * @return true if it is visible
- * @see #setVisible(boolean)
- * @see #getAccessibleStateSet()
- * @see AccessibleState#VISIBLE
- */
- public boolean isVisible()
- {
- return Component.this.isVisible();
- }
-
- /**
- * Sets the visibility of this component.
- *
- * @param b the desired visibility
- * @see #isVisible()
- */
- public void setVisible(boolean b)
- {
- Component.this.setVisible(b);
- }
-
- /**
- * Tests if the component is showing.
- *
- * @return true if this is showing
- */
- public boolean isShowing()
- {
- return Component.this.isShowing();
- }
-
- /**
- * Tests if the point is contained in this component.
- *
- * @param p the point to check
- * @return true if it is contained
- * @throws NullPointerException if p is null
- */
- public boolean contains(Point p)
- {
- return Component.this.contains(p.x, p.y);
- }
-
- /**
- * Returns the location of this object on the screen, or null if it is
- * not showing.
- *
- * @return the location relative to screen coordinates, if showing
- * @see #getBounds()
- * @see #getLocation()
- */
- public Point getLocationOnScreen()
- {
- return Component.this.isShowing() ? Component.this.getLocationOnScreen()
- : null;
- }
-
- /**
- * Returns the location of this object relative to its parent's coordinate
- * system, or null if it is not showing.
- *
- * @return the location
- * @see #getBounds()
- * @see #getLocationOnScreen()
- */
- public Point getLocation()
- {
- return Component.this.isShowing() ? Component.this.getLocation() : null;
- }
-
- /**
- * Sets the location of this relative to its parent's coordinate system.
- *
- * @param p the location
- * @throws NullPointerException if p is null
- * @see #getLocation()
- */
- public void setLocation(Point p)
- {
- Component.this.setLocation(p.x, p.y);
- }
-
- /**
- * Gets the bounds of this component, or null if it is not on screen.
- *
- * @return the bounds
- * @see #contains(Point)
- * @see #setBounds(Rectangle)
- */
- public Rectangle getBounds()
- {
- return Component.this.isShowing() ? Component.this.getBounds() : null;
- }
-
- /**
- * Sets the bounds of this component.
- *
- * @param r the bounds
- * @throws NullPointerException if r is null
- * @see #getBounds()
- */
- public void setBounds(Rectangle r)
- {
- Component.this.setBounds(r.x, r.y, r.width, r.height);
- }
-
- /**
- * Gets the size of this component, or null if it is not showing.
- *
- * @return the size
- * @see #setSize(Dimension)
- */
- public Dimension getSize()
- {
- return Component.this.isShowing() ? Component.this.getSize() : null;
- }
-
- /**
- * Sets the size of this component.
- *
- * @param d the size
- * @throws NullPointerException if d is null
- * @see #getSize()
- */
- public void setSize(Dimension d)
- {
- Component.this.setSize(d.width, d.height);
- }
-
- /**
- * Returns the Accessible child at a point relative to the coordinate
- * system of this component, if one exists, or null. Since components
- * have no children, subclasses must override this to get anything besides
- * null.
- *
- * @param p the point to check
- * @return the accessible child at that point
- * @throws NullPointerException if p is null
- */
- public Accessible getAccessibleAt(Point p)
- {
- return null;
- }
-
- /**
- * Tests whether this component can accept focus.
- *
- * @return true if this is focus traversable
- * @see #getAccessibleStateSet ()
- * @see AccessibleState#FOCUSABLE
- * @see AccessibleState#FOCUSED
- */
- public boolean isFocusTraversable ()
- {
- return Component.this.isFocusTraversable ();
- }
-
- /**
- * Requests focus for this component.
- *
- * @see #isFocusTraversable ()
- */
- public void requestFocus ()
- {
- Component.this.requestFocus ();
- }
-
- /**
- * Adds a focus listener.
- *
- * @param l the listener to add
- */
- public void addFocusListener(FocusListener l)
- {
- Component.this.addFocusListener(l);
- }
-
- /**
- * Removes a focus listener.
- *
- * @param l the listener to remove
- */
- public void removeFocusListener(FocusListener l)
- {
- Component.this.removeFocusListener(l);
- }
-
- /**
- * Converts component changes into property changes.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4
- */
- protected class AccessibleAWTComponentHandler implements ComponentListener
- {
- /**
- * Default constructor.
- */
- protected AccessibleAWTComponentHandler()
- {
- }
-
- /**
- * Convert a component hidden to a property change.
- *
- * @param e the event to convert
- */
- public void componentHidden(ComponentEvent e)
- {
- AccessibleAWTComponent.this.firePropertyChange
- (ACCESSIBLE_STATE_PROPERTY, AccessibleState.VISIBLE, null);
- }
-
- /**
- * Convert a component shown to a property change.
- *
- * @param e the event to convert
- */
- public void componentShown(ComponentEvent e)
- {
- AccessibleAWTComponent.this.firePropertyChange
- (ACCESSIBLE_STATE_PROPERTY, null, AccessibleState.VISIBLE);
- }
-
- /**
- * Moving a component does not affect properties.
- *
- * @param e ignored
- */
- public void componentMoved(ComponentEvent e)
- {
- }
-
- /**
- * Resizing a component does not affect properties.
- *
- * @param e ignored
- */
- public void componentResized(ComponentEvent e)
- {
- }
- } // class AccessibleAWTComponentHandler
-
- /**
- * Converts focus changes into property changes.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4
- */
- protected class AccessibleAWTFocusHandler implements FocusListener
- {
- /**
- * Default constructor.
- */
- protected AccessibleAWTFocusHandler()
- {
- }
-
- /**
- * Convert a focus gained to a property change.
- *
- * @param e the event to convert
- */
- public void focusGained(FocusEvent e)
- {
- AccessibleAWTComponent.this.firePropertyChange
- (ACCESSIBLE_STATE_PROPERTY, null, AccessibleState.FOCUSED);
- }
-
- /**
- * Convert a focus lost to a property change.
- *
- * @param e the event to convert
- */
- public void focusLost(FocusEvent e)
- {
- AccessibleAWTComponent.this.firePropertyChange
- (ACCESSIBLE_STATE_PROPERTY, AccessibleState.FOCUSED, null);
- }
- } // class AccessibleAWTComponentHandler
- } // class AccessibleAWTComponent
-
- /**
- * This class provides support for blitting offscreen surfaces to a
- * component.
- *
- * @see BufferStrategy
- *
- * @since 1.4
- */
- protected class BltBufferStrategy extends BufferStrategy
- {
- /**
- * The capabilities of the image buffer.
- */
- protected BufferCapabilities caps;
-
- /**
- * The back buffers used in this strategy.
- */
- protected VolatileImage[] backBuffers;
-
- /**
- * Whether or not the image buffer resources are allocated and
- * ready to be drawn into.
- */
- protected boolean validatedContents;
-
- /**
- * The width of the back buffers.
- */
- protected int width;
-
- /**
- * The height of the back buffers.
- */
- protected int height;
-
- /**
- * The front buffer.
- */
- private VolatileImage frontBuffer;
-
- /**
- * Creates a blitting buffer strategy.
- *
- * @param numBuffers the number of buffers, including the front
- * buffer
- * @param caps the capabilities of this strategy
- */
- protected BltBufferStrategy(int numBuffers, BufferCapabilities caps)
- {
- this.caps = caps;
- createBackBuffers(numBuffers - 1);
- width = getWidth();
- height = getHeight();
- }
-
- /**
- * Initializes the backBuffers field with an array of numBuffers
- * VolatileImages.
- *
- * @param numBuffers the number of backbuffers to create
- */
- protected void createBackBuffers(int numBuffers)
- {
- GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
-
- backBuffers = new VolatileImage[numBuffers];
-
- for (int i = 0; i < numBuffers; i++)
- backBuffers[i] = c.createCompatibleVolatileImage(width, height);
- }
-
- /**
- * Retrieves the capabilities of this buffer strategy.
- *
- * @return the capabilities of this buffer strategy
- */
- public BufferCapabilities getCapabilities()
- {
- return caps;
- }
-
- /**
- * Retrieves a graphics object that can be used to draw into this
- * strategy's image buffer.
- *
- * @return a graphics object
- */
- public Graphics getDrawGraphics()
- {
- // Return the backmost buffer's graphics.
- return backBuffers[0].getGraphics();
- }
-
- /**
- * Bring the contents of the back buffer to the front buffer.
- */
- public void show()
- {
- GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
-
- // draw the front buffer.
- getGraphics().drawImage(backBuffers[backBuffers.length - 1],
- width, height, null);
-
- BufferCapabilities.FlipContents f = getCapabilities().getFlipContents();
-
- // blit the back buffers.
- for (int i = backBuffers.length - 1; i > 0 ; i--)
- backBuffers[i] = backBuffers[i - 1];
-
- // create new backmost buffer.
- if (f == BufferCapabilities.FlipContents.UNDEFINED)
- backBuffers[0] = c.createCompatibleVolatileImage(width, height);
-
- // create new backmost buffer and clear it to the background
- // color.
- if (f == BufferCapabilities.FlipContents.BACKGROUND)
- {
- backBuffers[0] = c.createCompatibleVolatileImage(width, height);
- backBuffers[0].getGraphics().clearRect(0, 0, width, height);
- }
-
- // FIXME: set the backmost buffer to the prior contents of the
- // front buffer. How do we retrieve the contents of the front
- // buffer?
- //
- // if (f == BufferCapabilities.FlipContents.PRIOR)
-
- // set the backmost buffer to a copy of the new front buffer.
- if (f == BufferCapabilities.FlipContents.COPIED)
- backBuffers[0] = backBuffers[backBuffers.length - 1];
- }
-
- /**
- * Re-create the image buffer resources if they've been lost.
- */
- protected void revalidate()
- {
- GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
-
- for (int i = 0; i < backBuffers.length; i++)
- {
- int result = backBuffers[i].validate(c);
- if (result == VolatileImage.IMAGE_INCOMPATIBLE)
- backBuffers[i] = c.createCompatibleVolatileImage(width, height);
- }
- validatedContents = true;
- }
-
- /**
- * Returns whether or not the image buffer resources have been
- * lost.
- *
- * @return true if the resources have been lost, false otherwise
- */
- public boolean contentsLost()
- {
- for (int i = 0; i < backBuffers.length; i++)
- {
- if (backBuffers[i].contentsLost())
- {
- validatedContents = false;
- return true;
- }
- }
- // we know that the buffer resources are valid now because we
- // just checked them
- validatedContents = true;
- return false;
- }
-
- /**
- * Returns whether or not the image buffer resources have been
- * restored.
- *
- * @return true if the resources have been restored, false
- * otherwise
- */
- public boolean contentsRestored()
- {
- GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
-
- boolean imageRestored = false;
-
- for (int i = 0; i < backBuffers.length; i++)
- {
- int result = backBuffers[i].validate(c);
- if (result == VolatileImage.IMAGE_RESTORED)
- imageRestored = true;
- else if (result == VolatileImage.IMAGE_INCOMPATIBLE)
- return false;
- }
- // we know that the buffer resources are valid now because we
- // just checked them
- validatedContents = true;
- return imageRestored;
- }
- }
-
- /**
- * This class provides support for flipping component buffers. It
- * can only be used on Canvases and Windows.
- *
- * @since 1.4
- */
- protected class FlipBufferStrategy extends BufferStrategy
- {
- /**
- * The number of buffers.
- */
- protected int numBuffers;
-
- /**
- * The capabilities of this buffering strategy.
- */
- protected BufferCapabilities caps;
-
- /**
- * An Image reference to the drawing buffer.
- */
- protected Image drawBuffer;
-
- /**
- * A VolatileImage reference to the drawing buffer.
- */
- protected VolatileImage drawVBuffer;
-
- /**
- * Whether or not the image buffer resources are allocated and
- * ready to be drawn into.
- */
- protected boolean validatedContents;
-
- /**
- * The width of the back buffer.
- */
- private int width;
-
- /**
- * The height of the back buffer.
- */
- private int height;
-
- /**
- * Creates a flipping buffer strategy. The only supported
- * strategy for FlipBufferStrategy itself is a double-buffer page
- * flipping strategy. It forms the basis for more complex derived
- * strategies.
- *
- * @param numBuffers the number of buffers
- * @param caps the capabilities of this buffering strategy
- *
- * @throws AWTException if the requested
- * number-of-buffers/capabilities combination is not supported
- */
- protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
- throws AWTException
- {
- this.caps = caps;
- width = getWidth();
- height = getHeight();
-
- if (numBuffers > 1)
- createBuffers(numBuffers, caps);
- else
- {
- drawVBuffer = peer.createVolatileImage(width, height);
- drawBuffer = drawVBuffer;
- }
- }
-
- /**
- * Creates a multi-buffer flipping strategy. The number of
- * buffers must be greater than one and the buffer capabilities
- * must specify page flipping.
- *
- * @param numBuffers the number of flipping buffers; must be
- * greater than one
- * @param caps the buffering capabilities; caps.isPageFlipping()
- * must return true
- *
- * @throws IllegalArgumentException if numBuffers is not greater
- * than one or if the page flipping capability is not requested
- *
- * @throws AWTException if the requested flipping strategy is not
- * supported
- */
- protected void createBuffers(int numBuffers, BufferCapabilities caps)
- throws AWTException
- {
- if (numBuffers <= 1)
- throw new IllegalArgumentException("FlipBufferStrategy.createBuffers:"
- + " numBuffers must be greater than"
- + " one.");
-
- if (!caps.isPageFlipping())
- throw new IllegalArgumentException("FlipBufferStrategy.createBuffers:"
- + " flipping must be a specified"
- + " capability.");
-
- peer.createBuffers(numBuffers, caps);
- }
-
- /**
- * Return a direct reference to the back buffer image.
- *
- * @return a direct reference to the back buffer image.
- */
- protected Image getBackBuffer()
- {
- return peer.getBackBuffer();
- }
-
- /**
- * Perform a flip operation to transfer the contents of the back
- * buffer to the front buffer.
- */
- protected void flip(BufferCapabilities.FlipContents flipAction)
- {
- peer.flip(flipAction);
- }
-
- /**
- * Release the back buffer's resources.
- */
- protected void destroyBuffers()
- {
- peer.destroyBuffers();
- }
-
- /**
- * Retrieves the capabilities of this buffer strategy.
- *
- * @return the capabilities of this buffer strategy
- */
- public BufferCapabilities getCapabilities()
- {
- return caps;
- }
-
- /**
- * Retrieves a graphics object that can be used to draw into this
- * strategy's image buffer.
- *
- * @return a graphics object
- */
- public Graphics getDrawGraphics()
- {
- return drawVBuffer.getGraphics();
- }
-
- /**
- * Re-create the image buffer resources if they've been lost.
- */
- protected void revalidate()
- {
- GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
-
- if (drawVBuffer.validate(c) == VolatileImage.IMAGE_INCOMPATIBLE)
- drawVBuffer = peer.createVolatileImage(width, height);
- validatedContents = true;
- }
-
- /**
- * Returns whether or not the image buffer resources have been
- * lost.
- *
- * @return true if the resources have been lost, false otherwise
- */
- public boolean contentsLost()
- {
- if (drawVBuffer.contentsLost())
- {
- validatedContents = false;
- return true;
- }
- // we know that the buffer resources are valid now because we
- // just checked them
- validatedContents = true;
- return false;
- }
-
- /**
- * Returns whether or not the image buffer resources have been
- * restored.
- *
- * @return true if the resources have been restored, false
- * otherwise
- */
- public boolean contentsRestored()
- {
- GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
-
- int result = drawVBuffer.validate(c);
-
- boolean imageRestored = false;
-
- if (result == VolatileImage.IMAGE_RESTORED)
- imageRestored = true;
- else if (result == VolatileImage.IMAGE_INCOMPATIBLE)
- return false;
-
- // we know that the buffer resources are valid now because we
- // just checked them
- validatedContents = true;
- return imageRestored;
- }
-
- /**
- * Bring the contents of the back buffer to the front buffer.
- */
- public void show()
- {
- flip(caps.getFlipContents());
- }
- }
-}
diff --git a/libjava/java/awt/ComponentOrientation.java b/libjava/java/awt/ComponentOrientation.java
deleted file mode 100644
index 69b14c7553f..00000000000
--- a/libjava/java/awt/ComponentOrientation.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/* ComponentOrientation.java -- describes a component's orientation
- Copyright (C) 2000, 2001, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * This class is used to differentiate different orientations for text layout.
- * It controls whether text flows left-to-right or right-to-left, and whether
- * lines are horizontal or vertical, as in this table:
- *
- * LT RT TL TR
- * A B C C B A A D G G D A
- * D E F F E D B E H H E B
- * G H I I H G C F I I F C
- *
- * LT languages are most common (left-to-right lines, top-to-bottom).
- * This includes Western European languages, and optionally includes Japanese,
- * Chinese, and Korean. RT languages (right-to-left lines,
- * top-to-bottom) are mainly middle eastern, such as Hebrew and Arabic.
- * TR languages flow top-to-bottom in a line, right-to-left, and are
- * the basis of Japanese, Chinese, and Korean. Finally, TL languages
- * flow top-to-bottom in a line, left-to-right, as in Mongolian.
- *
- *
- *
- *
- * @param bdl the bundle to use
- * @return the orientation
- * @throws NullPointerException if bdl is null
- * @deprecated use {@link #getOrientation(Locale)} instead
- */
- public static ComponentOrientation getOrientation(ResourceBundle bdl)
- {
- ComponentOrientation r;
- try
- {
- r = (ComponentOrientation) bdl.getObject("Orientation");
- if (r != null)
- return r;
- }
- catch (MissingResourceException ignored)
- {
- }
- catch (ClassCastException ignored)
- {
- }
- try
- {
- r = getOrientation(bdl.getLocale());
- if (r != null)
- return r;
- }
- catch (Exception ignored)
- {
- }
- return getOrientation(Locale.getDefault());
- }
-} // class ComponentOrientation
diff --git a/libjava/java/awt/Composite.java b/libjava/java/awt/Composite.java
deleted file mode 100644
index ca3abe4d1ee..00000000000
--- a/libjava/java/awt/Composite.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Composite.java -- graphics formed from composite layers
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.ColorModel;
-
-/**
- * This interface is for graphics which are formed as composites of others.
- * It combines {@link Graphics2D} shapes according to defined rules to form
- * the new image. Implementations of this interface must be immutable, because
- * they are not cloned when a Graphics2D container is cloned.
- *
- * readDisplayPixels
, to prevent leaking
- * restricted information graphically.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see AlphaComposite
- * @see CompositeContext
- * @see Graphics2D#setComposite(Composite)
- * @since 1.2
- * @status updated to 1.4
- */
-public interface Composite
-{
- /**
- * Create a context state for performing the compositing operation. Several
- * contexts may exist for this object, in a multi-threaded environment.
- *
- * @param srcColorModel the color model of the source
- * @param dstColorModel the color model of the destination
- * @param hints hints for choosing between rendering alternatives
- */
- CompositeContext createContext(ColorModel srcColorModel,
- ColorModel dstColorModel,
- RenderingHints hints);
-} // interface Composite
diff --git a/libjava/java/awt/CompositeContext.java b/libjava/java/awt/CompositeContext.java
deleted file mode 100644
index 018a27071dd..00000000000
--- a/libjava/java/awt/CompositeContext.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Composite.java -- the context for compositing graphics layers
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.Raster;
-import java.awt.image.WritableRaster;
-
-/**
- * This interface provides an optimized environment for compositing graphics.
- * Several such contexts may exist for a given Composite
object.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Composite
- * @since 1.2
- * @status updated to 1.4
- */
-public interface CompositeContext
-{
- /**
- * Release resources allocated for the compositing.
- */
- void dispose();
-
- /**
- * Compose the two source images into the composite image. The destination
- * can be the same as one of the two inputs, and the destination must be
- * compatible with the ColorModel chosen in {@link Composite#createContext}.
- *
- * @param src the lower image source in compositing
- * @param dstIn the upper image source in compositing
- * @param dstOut the destination for the composite
- * @see Composite
- */
- void compose(Raster src, Raster dstIn, WritableRaster dstOut);
-} // interface CompositeContext
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
deleted file mode 100644
index e68adf492be..00000000000
--- a/libjava/java/awt/Container.java
+++ /dev/null
@@ -1,2023 +0,0 @@
-/* Container.java -- parent container class in AWT
- Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ContainerEvent;
-import java.awt.event.ContainerListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.awt.peer.ContainerPeer;
-import java.awt.peer.LightweightPeer;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.EventListener;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.accessibility.Accessible;
-import javax.swing.SwingUtilities;
-
-/**
- * A generic window toolkit object that acts as a container for other objects.
- * Components are tracked in a list, and new elements are at the end of the
- * list or bottom of the stacking order.
- *
- * @author original author unknown
- * @author Eric Blake (ebb9@email.byu.edu)
- *
- * @since 1.0
- *
- * @status still missing 1.4 support
- */
-public class Container extends Component
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 4613797578919906343L;
-
- /* Serialized fields from the serialization spec. */
- int ncomponents;
- Component[] component;
- LayoutManager layoutMgr;
-
- LightweightDispatcher dispatcher;
-
- Dimension maxSize;
-
- /**
- * @since 1.4
- */
- boolean focusCycleRoot;
-
- int containerSerializedDataVersion;
-
- /* Anything else is non-serializable, and should be declared "transient". */
- transient ContainerListener containerListener;
- transient PropertyChangeSupport changeSupport;
-
- /** The focus traversal policy that determines how focus is
- transferred between this Container and its children. */
- private FocusTraversalPolicy focusTraversalPolicy;
-
- /**
- * The focus traversal keys, if not inherited from the parent or default
- * keyboard manager. These sets will contain only AWTKeyStrokes that
- * represent press and release events to use as focus control.
- *
- * @see #getFocusTraversalKeys(int)
- * @see #setFocusTraversalKeys(int, Set)
- * @since 1.4
- */
- transient Set[] focusTraversalKeys;
-
- /**
- * Default constructor for subclasses.
- */
- public Container()
- {
- }
-
- /**
- * Returns the number of components in this container.
- *
- * @return The number of components in this container.
- */
- public int getComponentCount()
- {
- return countComponents ();
- }
-
- /**
- * Returns the number of components in this container.
- *
- * @return The number of components in this container.
- *
- * @deprecated use {@link #getComponentCount()} instead
- */
- public int countComponents()
- {
- return ncomponents;
- }
-
- /**
- * Returns the component at the specified index.
- *
- * @param n The index of the component to retrieve.
- *
- * @return The requested component.
- *
- * @throws ArrayIndexOutOfBoundsException If the specified index is invalid
- */
- public Component getComponent(int n)
- {
- synchronized (getTreeLock ())
- {
- if (n < 0 || n >= ncomponents)
- throw new ArrayIndexOutOfBoundsException("no such component");
-
- return component[n];
- }
- }
-
- /**
- * Returns an array of the components in this container.
- *
- * @return The components in this container.
- */
- public Component[] getComponents()
- {
- synchronized (getTreeLock ())
- {
- Component[] result = new Component[ncomponents];
-
- if (ncomponents > 0)
- System.arraycopy(component, 0, result, 0, ncomponents);
-
- return result;
- }
- }
-
- /**
- * Swaps the components at position i and j, in the container.
- */
-
- protected void swapComponents (int i, int j)
- {
- synchronized (getTreeLock ())
- {
- if (i < 0
- || i >= component.length
- || j < 0
- || j >= component.length)
- throw new ArrayIndexOutOfBoundsException ();
- Component tmp = component[i];
- component[i] = component[j];
- component[j] = tmp;
- }
- }
-
- /**
- * Returns the insets for this container, which is the space used for
- * borders, the margin, etc.
- *
- * @return The insets for this container.
- */
- public Insets getInsets()
- {
- return insets ();
- }
-
- /**
- * Returns the insets for this container, which is the space used for
- * borders, the margin, etc.
- *
- * @return The insets for this container.
- * @deprecated use {@link #getInsets()} instead
- */
- public Insets insets()
- {
- if (peer == null)
- return new Insets (0, 0, 0, 0);
-
- return ((ContainerPeer) peer).getInsets ();
- }
-
- /**
- * Adds the specified component to this container at the end of the
- * component list.
- *
- * @param comp The component to add to the container.
- *
- * @return The same component that was added.
- */
- public Component add(Component comp)
- {
- addImpl(comp, null, -1);
- return comp;
- }
-
- /**
- * Adds the specified component to the container at the end of the
- * component list. This method should not be used. Instead, use
- * add(Component, Object)
.
- *
- * @param name The name of the component to be added.
- * @param comp The component to be added.
- *
- * @return The same component that was added.
- *
- * @see #add(Component,Object)
- */
- public Component add(String name, Component comp)
- {
- addImpl(comp, name, -1);
- return comp;
- }
-
- /**
- * Adds the specified component to this container at the specified index
- * in the component list.
- *
- * @param comp The component to be added.
- * @param index The index in the component list to insert this child
- * at, or -1 to add at the end of the list.
- *
- * @return The same component that was added.
- *
- * @throws ArrayIndexOutOfBounds If the specified index is invalid.
- */
- public Component add(Component comp, int index)
- {
- addImpl(comp, null, index);
- return comp;
- }
-
- /**
- * Adds the specified component to this container at the end of the
- * component list. The layout manager will use the specified constraints
- * when laying out this component.
- *
- * @param comp The component to be added to this container.
- * @param constraints The layout constraints for this component.
- */
- public void add(Component comp, Object constraints)
- {
- addImpl(comp, constraints, -1);
- }
-
- /**
- * Adds the specified component to this container at the specified index
- * in the component list. The layout manager will use the specified
- * constraints when layout out this component.
- *
- * @param comp The component to be added.
- * @param constraints The layout constraints for this component.
- * @param index The index in the component list to insert this child
- * at, or -1 to add at the end of the list.
- *
- * @throws ArrayIndexOutOfBounds If the specified index is invalid.
- */
- public void add(Component comp, Object constraints, int index)
- {
- addImpl(comp, constraints, index);
- }
-
- /**
- * This method is called by all the add()
methods to perform
- * the actual adding of the component. Subclasses who wish to perform
- * their own processing when a component is added should override this
- * method. Any subclass doing this must call the superclass version of
- * this method in order to ensure proper functioning of the container.
- *
- * @param comp The component to be added.
- * @param constraints The layout constraints for this component, or
- * null
if there are no constraints.
- * @param index The index in the component list to insert this child
- * at, or -1 to add at the end of the list.
- *
- * @throws ArrayIndexOutOfBounds If the specified index is invalid.
- */
- protected void addImpl(Component comp, Object constraints, int index)
- {
- synchronized (getTreeLock ())
- {
- if (index > ncomponents
- || (index < 0 && index != -1)
- || comp instanceof Window
- || (comp instanceof Container
- && ((Container) comp).isAncestorOf(this)))
- throw new IllegalArgumentException();
-
- // Reparent component, and make sure component is instantiated if
- // we are.
- if (comp.parent != null)
- comp.parent.remove(comp);
- comp.parent = this;
- if (peer != null)
- {
- if (comp.isLightweight ())
- {
- enableEvents (comp.eventMask);
- if (!isLightweight ())
- enableEvents (AWTEvent.PAINT_EVENT_MASK);
- }
- }
-
- invalidate();
-
- if (component == null)
- component = new Component[4]; // FIXME, better initial size?
-
- // This isn't the most efficient implementation. We could do less
- // copying when growing the array. It probably doesn't matter.
- if (ncomponents >= component.length)
- {
- int nl = component.length * 2;
- Component[] c = new Component[nl];
- System.arraycopy(component, 0, c, 0, ncomponents);
- component = c;
- }
-
- if (index == -1)
- component[ncomponents++] = comp;
- else
- {
- System.arraycopy(component, index, component, index + 1,
- ncomponents - index);
- component[index] = comp;
- ++ncomponents;
- }
-
- // Notify the layout manager.
- if (layoutMgr != null)
- {
- if (layoutMgr instanceof LayoutManager2)
- {
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- lm2.addLayoutComponent(comp, constraints);
- }
- else if (constraints instanceof String)
- layoutMgr.addLayoutComponent((String) constraints, comp);
- else
- layoutMgr.addLayoutComponent(null, comp);
- }
-
- if (isShowing ())
- {
- // Post event to notify of adding the component.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_ADDED,
- comp);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- }
- }
-
- /**
- * Removes the component at the specified index from this container.
- *
- * @param index The index of the component to remove.
- */
- public void remove(int index)
- {
- synchronized (getTreeLock ())
- {
- Component r = component[index];
-
- r.removeNotify();
-
- System.arraycopy(component, index + 1, component, index,
- ncomponents - index - 1);
- component[--ncomponents] = null;
-
- invalidate();
-
- if (layoutMgr != null)
- layoutMgr.removeLayoutComponent(r);
-
- r.parent = null;
-
- if (isShowing ())
- {
- // Post event to notify of removing the component.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_REMOVED,
- r);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- }
- }
-
- /**
- * Removes the specified component from this container.
- *
- * @return component The component to remove from this container.
- */
- public void remove(Component comp)
- {
- synchronized (getTreeLock ())
- {
- for (int i = 0; i < ncomponents; ++i)
- {
- if (component[i] == comp)
- {
- remove(i);
- break;
- }
- }
- }
- }
-
- /**
- * Removes all components from this container.
- */
- public void removeAll()
- {
- synchronized (getTreeLock ())
- {
- while (ncomponents > 0)
- remove(0);
- }
- }
-
- /**
- * Returns the current layout manager for this container.
- *
- * @return The layout manager for this container.
- */
- public LayoutManager getLayout()
- {
- return layoutMgr;
- }
-
- /**
- * Sets the layout manager for this container to the specified layout
- * manager.
- *
- * @param mgr The new layout manager for this container.
- */
- public void setLayout(LayoutManager mgr)
- {
- layoutMgr = mgr;
- invalidate();
- }
-
- /**
- * Layout the components in this container.
- */
- public void doLayout()
- {
- layout ();
- }
-
- /**
- * Layout the components in this container.
- *
- * @deprecated use {@link #doLayout()} instead
- */
- public void layout()
- {
- if (layoutMgr != null)
- layoutMgr.layoutContainer (this);
- }
-
- /**
- * Invalidates this container to indicate that it (and all parent
- * containers) need to be laid out.
- */
- public void invalidate()
- {
- super.invalidate();
- }
-
- /**
- * Re-lays out the components in this container.
- */
- public void validate()
- {
- synchronized (getTreeLock ())
- {
- if (! isValid() && peer != null)
- {
- validateTree();
- }
- }
- }
-
- /**
- * Recursively invalidates the container tree.
- */
- void invalidateTree()
- {
- for (int i = 0; i < ncomponents; i++)
- {
- Component comp = component[i];
- comp.invalidate();
- if (comp instanceof Container)
- ((Container) comp).invalidateTree();
- }
- }
-
- /**
- * Recursively validates the container tree, recomputing any invalid
- * layouts.
- */
- protected void validateTree()
- {
- if (valid)
- return;
-
- ContainerPeer cPeer = null;
- if (peer != null && ! (peer instanceof LightweightPeer))
- {
- cPeer = (ContainerPeer) peer;
- cPeer.beginValidate();
- }
-
- for (int i = 0; i < ncomponents; ++i)
- {
- Component comp = component[i];
-
- if (comp.getPeer () == null)
- comp.addNotify();
- }
-
- doLayout ();
- for (int i = 0; i < ncomponents; ++i)
- {
- Component comp = component[i];
-
- if (! comp.isValid())
- {
- if (comp instanceof Container)
- {
- ((Container) comp).validateTree();
- }
- else
- {
- component[i].validate();
- }
- }
- }
-
- /* children will call invalidate() when they are layed out. It
- is therefore important that valid is not set to true
- until after the children have been layed out. */
- valid = true;
-
- if (cPeer != null)
- cPeer.endValidate();
- }
-
- public void setFont(Font f)
- {
- super.setFont(f);
- // FIXME: Although it might make more sense to invalidate only
- // those children whose font == null, Sun invalidates all children.
- // So we'll do the same.
- invalidateTree();
- }
-
- /**
- * Returns the preferred size of this container.
- *
- * @return The preferred size of this container.
- */
- public Dimension getPreferredSize()
- {
- return preferredSize ();
- }
-
- /**
- * Returns the preferred size of this container.
- *
- * @return The preferred size of this container.
- *
- * @deprecated use {@link #getPreferredSize()} instead
- */
- public Dimension preferredSize()
- {
- if (layoutMgr != null)
- return layoutMgr.preferredLayoutSize (this);
- else
- return super.preferredSize ();
- }
-
- /**
- * Returns the minimum size of this container.
- *
- * @return The minimum size of this container.
- */
- public Dimension getMinimumSize()
- {
- return minimumSize ();
- }
-
- /**
- * Returns the minimum size of this container.
- *
- * @return The minimum size of this container.
- *
- * @deprecated use {@link #getMinimumSize()} instead
- */
- public Dimension minimumSize()
- {
- if (layoutMgr != null)
- return layoutMgr.minimumLayoutSize (this);
- else
- return super.minimumSize ();
- }
-
- /**
- * Returns the maximum size of this container.
- *
- * @return The maximum size of this container.
- */
- public Dimension getMaximumSize()
- {
- if (layoutMgr != null && layoutMgr instanceof LayoutManager2)
- {
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- return lm2.maximumLayoutSize(this);
- }
- else
- return super.getMaximumSize();
- }
-
- /**
- * Returns the preferred alignment along the X axis. This is a value
- * between 0 and 1 where 0 represents alignment flush left and
- * 1 means alignment flush right, and 0.5 means centered.
- *
- * @return The preferred alignment along the X axis.
- */
- public float getAlignmentX()
- {
- if (layoutMgr instanceof LayoutManager2)
- {
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- return lm2.getLayoutAlignmentX(this);
- }
- else
- return super.getAlignmentX();
- }
-
- /**
- * Returns the preferred alignment along the Y axis. This is a value
- * between 0 and 1 where 0 represents alignment flush top and
- * 1 means alignment flush bottom, and 0.5 means centered.
- *
- * @return The preferred alignment along the Y axis.
- */
- public float getAlignmentY()
- {
- if (layoutMgr instanceof LayoutManager2)
- {
- LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
- return lm2.getLayoutAlignmentY(this);
- }
- else
- return super.getAlignmentY();
- }
-
- /**
- * Paints this container. The implementation of this method in this
- * class forwards to any lightweight components in this container. If
- * this method is subclassed, this method should still be invoked as
- * a superclass method so that lightweight components are properly
- * drawn.
- *
- * @param g The graphics context for this paint job.
- */
- public void paint(Graphics g)
- {
- if (!isShowing())
- return;
- // Paint self first.
- super.paint(g);
- // Visit heavyweights as well, in case they were
- // erased when we cleared the background for this container.
- visitChildren(g, GfxPaintVisitor.INSTANCE, false);
- }
-
- /**
- * Updates this container. The implementation of this method in this
- * class forwards to any lightweight components in this container. If
- * this method is subclassed, this method should still be invoked as
- * a superclass method so that lightweight components are properly
- * drawn.
- *
- * @param g The graphics context for this update.
- */
- public void update(Graphics g)
- {
- super.update(g);
- }
-
- /**
- * Prints this container. The implementation of this method in this
- * class forwards to any lightweight components in this container. If
- * this method is subclassed, this method should still be invoked as
- * a superclass method so that lightweight components are properly
- * drawn.
- *
- * @param g The graphics context for this print job.
- */
- public void print(Graphics g)
- {
- super.print(g);
- visitChildren(g, GfxPrintVisitor.INSTANCE, true);
- }
-
- /**
- * Paints all of the components in this container.
- *
- * @param g The graphics context for this paint job.
- */
- public void paintComponents(Graphics g)
- {
- super.paint(g);
- visitChildren(g, GfxPaintAllVisitor.INSTANCE, true);
- }
-
- /**
- * Prints all of the components in this container.
- *
- * @param g The graphics context for this print job.
- */
- public void printComponents(Graphics g)
- {
- super.paint(g);
- visitChildren(g, GfxPrintAllVisitor.INSTANCE, true);
- }
-
- /**
- * Adds the specified container listener to this object's list of
- * container listeners.
- *
- * @param listener The listener to add.
- */
- public synchronized void addContainerListener(ContainerListener listener)
- {
- containerListener = AWTEventMulticaster.add(containerListener, listener);
- }
-
- /**
- * Removes the specified container listener from this object's list of
- * container listeners.
- *
- * @param listener The listener to remove.
- */
- public synchronized void removeContainerListener(ContainerListener listener)
- {
- containerListener = AWTEventMulticaster.remove(containerListener, listener);
- }
-
- /**
- * @since 1.4
- */
- public synchronized ContainerListener[] getContainerListeners()
- {
- return (ContainerListener[])
- AWTEventMulticaster.getListeners(containerListener,
- ContainerListener.class);
- }
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this Container. FooListeners are registered using the addFooListener
- * method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements @see java.util.EventListener.
- *
- * @since 1.3
- */
- public EventListener[] getListeners(Class listenerType)
- {
- if (listenerType == ContainerListener.class)
- return getContainerListeners();
- return super.getListeners(listenerType);
- }
-
- /**
- * Processes the specified event. This method calls
- * processContainerEvent()
if this method is a
- * ContainerEvent
, otherwise it calls the superclass
- * method.
- *
- * @param e The event to be processed.
- */
- protected void processEvent(AWTEvent e)
- {
- if (e instanceof ContainerEvent)
- processContainerEvent((ContainerEvent) e);
- else
- super.processEvent(e);
- }
-
- /**
- * Called when a container event occurs if container events are enabled.
- * This method calls any registered listeners.
- *
- * @param e The event that occurred.
- */
- protected void processContainerEvent(ContainerEvent e)
- {
- if (containerListener == null)
- return;
- switch (e.id)
- {
- case ContainerEvent.COMPONENT_ADDED:
- containerListener.componentAdded(e);
- break;
-
- case ContainerEvent.COMPONENT_REMOVED:
- containerListener.componentRemoved(e);
- break;
- }
- }
-
- /**
- * AWT 1.0 event processor.
- *
- * @param e The event that occurred.
- *
- * @deprecated use {@link #dispatchEvent(AWTEvent)} instead
- */
- public void deliverEvent(Event e)
- {
- if (!handleEvent (e))
- {
- synchronized (getTreeLock ())
- {
- Component parent = getParent ();
-
- if (parent != null)
- parent.deliverEvent (e);
- }
- }
- }
-
- /**
- * Returns the component located at the specified point. This is done
- * by checking whether or not a child component claims to contain this
- * point. The first child component that does is returned. If no
- * child component claims the point, the container itself is returned,
- * unless the point does not exist within this container, in which
- * case null
is returned.
- *
- * @param x The X coordinate of the point.
- * @param y The Y coordinate of the point.
- *
- * @return The component containing the specified point, or
- * null
if there is no such point.
- */
- public Component getComponentAt(int x, int y)
- {
- return locate (x, y);
- }
-
- /**
- * Returns the component located at the specified point. This is done
- * by checking whether or not a child component claims to contain this
- * point. The first child component that does is returned. If no
- * child component claims the point, the container itself is returned,
- * unless the point does not exist within this container, in which
- * case null
is returned.
- *
- * @param x The x position of the point to return the component at.
- * @param y The y position of the point to return the component at.
- *
- * @return The component containing the specified point, or null
- * if there is no such point.
- *
- * @deprecated use {@link #getComponentAt(int, int)} instead
- */
- public Component locate(int x, int y)
- {
- synchronized (getTreeLock ())
- {
- if (!contains (x, y))
- return null;
- for (int i = 0; i < ncomponents; ++i)
- {
- // Ignore invisible children...
- if (!component[i].isVisible ())
- continue;
-
- int x2 = x - component[i].x;
- int y2 = y - component[i].y;
- if (component[i].contains (x2, y2))
- return component[i];
- }
- return this;
- }
- }
-
- /**
- * Returns the component located at the specified point. This is done
- * by checking whether or not a child component claims to contain this
- * point. The first child component that does is returned. If no
- * child component claims the point, the container itself is returned,
- * unless the point does not exist within this container, in which
- * case null
is returned.
- *
- * @param p The point to return the component at.
- * @return The component containing the specified point, or null
- * if there is no such point.
- */
- public Component getComponentAt(Point p)
- {
- return getComponentAt (p.x, p.y);
- }
-
- public Component findComponentAt(int x, int y)
- {
- synchronized (getTreeLock ())
- {
- if (! contains(x, y))
- return null;
-
- for (int i = 0; i < ncomponents; ++i)
- {
- // Ignore invisible children...
- if (!component[i].isVisible())
- continue;
-
- int x2 = x - component[i].x;
- int y2 = y - component[i].y;
- // We don't do the contains() check right away because
- // findComponentAt would redundantly do it first thing.
- if (component[i] instanceof Container)
- {
- Container k = (Container) component[i];
- Component r = k.findComponentAt(x2, y2);
- if (r != null)
- return r;
- }
- else if (component[i].contains(x2, y2))
- return component[i];
- }
-
- return this;
- }
- }
-
- public Component findComponentAt(Point p)
- {
- return findComponentAt(p.x, p.y);
- }
-
- /**
- * Called when this container is added to another container to inform it
- * to create its peer. Peers for any child components will also be
- * created.
- */
- public void addNotify()
- {
- super.addNotify();
- addNotifyContainerChildren();
- }
-
- /**
- * Called when this container is removed from its parent container to
- * inform it to destroy its peer. This causes the peers of all child
- * component to be destroyed as well.
- */
- public void removeNotify()
- {
- synchronized (getTreeLock ())
- {
- for (int i = 0; i < ncomponents; ++i)
- component[i].removeNotify();
- super.removeNotify();
- }
- }
-
- /**
- * Tests whether or not the specified component is contained within
- * this components subtree.
- *
- * @param comp The component to test.
- *
- * @return true
if this container is an ancestor of the
- * specified component, false
otherwise.
- */
- public boolean isAncestorOf(Component comp)
- {
- synchronized (getTreeLock ())
- {
- while (true)
- {
- if (comp == null)
- return false;
- if (comp == this)
- return true;
- comp = comp.getParent();
- }
- }
- }
-
- /**
- * Returns a string representing the state of this container for
- * debugging purposes.
- *
- * @return A string representing the state of this container.
- */
- protected String paramString()
- {
- if (layoutMgr == null)
- return super.paramString();
-
- StringBuffer sb = new StringBuffer();
- sb.append(super.paramString());
- sb.append(",layout=");
- sb.append(layoutMgr.getClass().getName());
- return sb.toString();
- }
-
- /**
- * Writes a listing of this container to the specified stream starting
- * at the specified indentation point.
- *
- * @param out The PrintStream
to write to.
- * @param indent The indentation point.
- */
- public void list(PrintStream out, int indent)
- {
- synchronized (getTreeLock ())
- {
- super.list(out, indent);
- for (int i = 0; i < ncomponents; ++i)
- component[i].list(out, indent + 2);
- }
- }
-
- /**
- * Writes a listing of this container to the specified stream starting
- * at the specified indentation point.
- *
- * @param out The PrintWriter
to write to.
- * @param indent The indentation point.
- */
- public void list(PrintWriter out, int indent)
- {
- synchronized (getTreeLock ())
- {
- super.list(out, indent);
- for (int i = 0; i < ncomponents; ++i)
- component[i].list(out, indent + 2);
- }
- }
-
- /**
- * Sets the focus traversal keys for a given traversal operation for this
- * Container.
- *
- * @exception IllegalArgumentException If id is not one of
- * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
- * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
- * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
- * or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS,
- * or if keystrokes contains null, or if any Object in keystrokes is not an
- * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, or if any
- * keystroke already maps to another focus traversal operation for this
- * Container.
- *
- * @since 1.4
- */
- public void setFocusTraversalKeys(int id, Set keystrokes)
- {
- if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
- throw new IllegalArgumentException ();
-
- if (keystrokes == null)
- {
- Container parent = getParent ();
-
- while (parent != null)
- {
- if (parent.areFocusTraversalKeysSet (id))
- {
- keystrokes = parent.getFocusTraversalKeys (id);
- break;
- }
- parent = parent.getParent ();
- }
-
- if (keystrokes == null)
- keystrokes = KeyboardFocusManager.getCurrentKeyboardFocusManager ().
- getDefaultFocusTraversalKeys (id);
- }
-
- Set sa;
- Set sb;
- Set sc;
- String name;
- switch (id)
- {
- case KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS:
- sa = getFocusTraversalKeys
- (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
- sb = getFocusTraversalKeys
- (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS);
- sc = getFocusTraversalKeys
- (KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS);
- name = "forwardFocusTraversalKeys";
- break;
- case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS:
- sa = getFocusTraversalKeys
- (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- sb = getFocusTraversalKeys
- (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS);
- sc = getFocusTraversalKeys
- (KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS);
- name = "backwardFocusTraversalKeys";
- break;
- case KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS:
- sa = getFocusTraversalKeys
- (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- sb = getFocusTraversalKeys
- (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
- sc = getFocusTraversalKeys
- (KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS);
- name = "upCycleFocusTraversalKeys";
- break;
- case KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS:
- sa = getFocusTraversalKeys
- (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- sb = getFocusTraversalKeys
- (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
- sc = getFocusTraversalKeys
- (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS);
- name = "downCycleFocusTraversalKeys";
- break;
- default:
- throw new IllegalArgumentException ();
- }
-
- int i = keystrokes.size ();
- Iterator iter = keystrokes.iterator ();
-
- while (--i >= 0)
- {
- Object o = iter.next ();
- if (!(o instanceof AWTKeyStroke)
- || sa.contains (o) || sb.contains (o) || sc.contains (o)
- || ((AWTKeyStroke) o).keyCode == KeyEvent.VK_UNDEFINED)
- throw new IllegalArgumentException ();
- }
-
- if (focusTraversalKeys == null)
- focusTraversalKeys = new Set[3];
-
- keystrokes = Collections.unmodifiableSet (new HashSet (keystrokes));
- firePropertyChange (name, focusTraversalKeys[id], keystrokes);
-
- focusTraversalKeys[id] = keystrokes;
- }
-
- /**
- * Returns the Set of focus traversal keys for a given traversal operation for
- * this Container.
- *
- * @exception IllegalArgumentException If id is not one of
- * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
- * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
- * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
- * or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS.
- *
- * @since 1.4
- */
- public Set getFocusTraversalKeys (int id)
- {
- if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
- throw new IllegalArgumentException ();
-
- Set s = null;
-
- if (focusTraversalKeys != null)
- s = focusTraversalKeys[id];
-
- if (s == null && parent != null)
- s = parent.getFocusTraversalKeys (id);
-
- return s == null ? (KeyboardFocusManager.getCurrentKeyboardFocusManager()
- .getDefaultFocusTraversalKeys(id)) : s;
- }
-
- /**
- * Returns whether the Set of focus traversal keys for the given focus
- * traversal operation has been explicitly defined for this Container.
- * If this method returns false, this Container is inheriting the Set from
- * an ancestor, or from the current KeyboardFocusManager.
- *
- * @exception IllegalArgumentException If id is not one of
- * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
- * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
- * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
- * or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS.
- *
- * @since 1.4
- */
- public boolean areFocusTraversalKeysSet (int id)
- {
- if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
- throw new IllegalArgumentException ();
-
- return focusTraversalKeys != null && focusTraversalKeys[id] != null;
- }
-
- /**
- * Check whether the given Container is the focus cycle root of this
- * Container's focus traversal cycle. If this Container is a focus
- * cycle root itself, then it will be in two different focus cycles
- * -- it's own, and that of its ancestor focus cycle root's. In
- * that case, if c
is either of those containers, this
- * method will return true.
- *
- * @param c the candidate Container
- *
- * @return true if c is the focus cycle root of the focus traversal
- * cycle to which this Container belongs, false otherwise
- *
- * @since 1.4
- */
- public boolean isFocusCycleRoot (Container c)
- {
- if (this == c
- && isFocusCycleRoot ())
- return true;
-
- Container ancestor = getFocusCycleRootAncestor ();
-
- if (c == ancestor)
- return true;
-
- return false;
- }
-
- /**
- * If this Container is a focus cycle root, set the focus traversal
- * policy that determines the focus traversal order for its
- * children. If non-null, this policy will be inherited by all
- * inferior focus cycle roots. If policy
is null, this
- * Container will inherit its policy from the closest ancestor focus
- * cycle root that's had its policy set.
- *
- * @param policy the new focus traversal policy for this Container or null
- *
- * @since 1.4
- */
- public void setFocusTraversalPolicy (FocusTraversalPolicy policy)
- {
- focusTraversalPolicy = policy;
- }
-
- /**
- * Return the focus traversal policy that determines the focus
- * traversal order for this Container's children. This method
- * returns null if this Container is not a focus cycle root. If the
- * focus traversal policy has not been set explicitly, then this
- * method will return an ancestor focus cycle root's policy instead.
- *
- * @return this Container's focus traversal policy or null
- *
- * @since 1.4
- */
- public FocusTraversalPolicy getFocusTraversalPolicy ()
- {
- if (!isFocusCycleRoot ())
- return null;
-
- if (focusTraversalPolicy == null)
- {
- Container ancestor = getFocusCycleRootAncestor ();
-
- if (ancestor != this)
- return ancestor.getFocusTraversalPolicy ();
- else
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- return manager.getDefaultFocusTraversalPolicy ();
- }
- }
- else
- return focusTraversalPolicy;
- }
-
- /**
- * Check whether this Container's focus traversal policy has been
- * explicitly set. If it has not, then this Container will inherit
- * its focus traversal policy from one of its ancestor focus cycle
- * roots.
- *
- * @return true if focus traversal policy is set, false otherwise
- */
- public boolean isFocusTraversalPolicySet ()
- {
- return focusTraversalPolicy == null;
- }
-
- /**
- * Set whether or not this Container is the root of a focus
- * traversal cycle. This Container's focus traversal policy
- * determines the order of focus traversal. Some policies prevent
- * the focus from being transferred between two traversal cycles
- * until an up or down traversal operation is performed. In that
- * case, normal traversal (not up or down) is limited to this
- * Container and all of this Container's descendents that are not
- * descendents of inferior focus cycle roots. In the default case
- * however, ContainerOrderFocusTraversalPolicy is in effect, and it
- * supports implicit down-cycle traversal operations.
- *
- * @return true if this is a focus cycle root, false otherwise
- *
- * @since 1.4
- */
- public void setFocusCycleRoot (boolean focusCycleRoot)
- {
- this.focusCycleRoot = focusCycleRoot;
- }
-
- /**
- * Check whether this Container is a focus cycle root.
- *
- * @return true if this is a focus cycle root, false otherwise
- *
- * @since 1.4
- */
- public boolean isFocusCycleRoot ()
- {
- return focusCycleRoot;
- }
-
- /**
- * Transfer focus down one focus traversal cycle. If this Container
- * is a focus cycle root, then its default component becomes the
- * focus owner, and this Container becomes the current focus cycle
- * root. No traversal will occur if this Container is not a focus
- * cycle root.
- *
- * @since 1.4
- */
- public void transferFocusDownCycle ()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- manager.downFocusCycle (this);
- }
-
- /**
- * Sets the ComponentOrientation property of this container and all components
- * contained within it.
- *
- * @exception NullPointerException If orientation is null
- *
- * @since 1.4
- */
- public void applyComponentOrientation (ComponentOrientation orientation)
- {
- if (orientation == null)
- throw new NullPointerException ();
- }
-
- public void addPropertyChangeListener (PropertyChangeListener listener)
- {
- if (listener == null)
- return;
-
- if (changeSupport == null)
- changeSupport = new PropertyChangeSupport (this);
-
- changeSupport.addPropertyChangeListener (listener);
- }
-
- public void addPropertyChangeListener (String name,
- PropertyChangeListener listener)
- {
- if (listener == null)
- return;
-
- if (changeSupport == null)
- changeSupport = new PropertyChangeSupport (this);
-
- changeSupport.addPropertyChangeListener (name, listener);
- }
-
- // Hidden helper methods.
-
- /**
- * Perform a graphics operation on the children of this container.
- * For each applicable child, the visitChild() method will be called
- * to perform the graphics operation.
- *
- * @param gfx The graphics object that will be used to derive new
- * graphics objects for the children.
- *
- * @param visitor Object encapsulating the graphics operation that
- * should be performed.
- *
- * @param lightweightOnly If true, only lightweight components will
- * be visited.
- */
- private void visitChildren(Graphics gfx, GfxVisitor visitor,
- boolean lightweightOnly)
- {
- synchronized (getTreeLock ())
- {
- for (int i = ncomponents - 1; i >= 0; --i)
- {
- Component comp = component[i];
- // If we're visiting heavyweights as well,
- // don't recurse into Containers here. This avoids
- // painting the same nested child multiple times.
- boolean applicable = comp.isVisible()
- && (comp.isLightweight()
- || !lightweightOnly && ! (comp instanceof Container));
-
- if (applicable)
- visitChild(gfx, visitor, comp);
- }
- }
- }
-
- /**
- * Perform a graphics operation on a child. A translated and clipped
- * graphics object will be created, and the visit() method of the
- * visitor will be called to perform the operation.
- *
- * @param gfx The graphics object that will be used to derive new
- * graphics objects for the child.
- *
- * @param visitor Object encapsulating the graphics operation that
- * should be performed.
- *
- * @param comp The child component that should be visited.
- */
- private void visitChild(Graphics gfx, GfxVisitor visitor,
- Component comp)
- {
- Rectangle bounds = comp.getBounds();
- Rectangle oldClip = gfx.getClipBounds();
- if (oldClip == null)
- oldClip = bounds;
-
- Rectangle clip = oldClip.intersection(bounds);
-
- if (clip.isEmpty()) return;
-
- boolean clipped = false;
- boolean translated = false;
- try
- {
- gfx.setClip(clip.x, clip.y, clip.width, clip.height);
- clipped = true;
- gfx.translate(bounds.x, bounds.y);
- translated = true;
- visitor.visit(comp, gfx);
- }
- finally
- {
- if (translated)
- gfx.translate (-bounds.x, -bounds.y);
- if (clipped)
- gfx.setClip (oldClip.x, oldClip.y, oldClip.width, oldClip.height);
- }
- }
-
- void dispatchEventImpl(AWTEvent e)
- {
- // Give lightweight dispatcher a chance to handle it.
- if (eventTypeEnabled (e.id)
- && dispatcher != null
- && dispatcher.handleEvent (e))
- return;
-
- if ((e.id <= ContainerEvent.CONTAINER_LAST
- && e.id >= ContainerEvent.CONTAINER_FIRST)
- && (containerListener != null
- || (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
- }
-
- // This is used to implement Component.transferFocus.
- Component findNextFocusComponent(Component child)
- {
- synchronized (getTreeLock ())
- {
- int start, end;
- if (child != null)
- {
- for (start = 0; start < ncomponents; ++start)
- {
- if (component[start] == child)
- break;
- }
- end = start;
- // This special case lets us be sure to terminate.
- if (end == 0)
- end = ncomponents;
- ++start;
- }
- else
- {
- start = 0;
- end = ncomponents;
- }
-
- for (int j = start; j != end; ++j)
- {
- if (j >= ncomponents)
- {
- // The JCL says that we should wrap here. However, that
- // seems wrong. To me it seems that focus order should be
- // global within in given window. So instead if we reach
- // the end we try to look in our parent, if we have one.
- if (parent != null)
- return parent.findNextFocusComponent(this);
- j -= ncomponents;
- }
- if (component[j] instanceof Container)
- {
- Component c = component[j];
- c = c.findNextFocusComponent(null);
- if (c != null)
- return c;
- }
- else if (component[j].isFocusTraversable())
- return component[j];
- }
-
- return null;
- }
- }
-
- private void addNotifyContainerChildren()
- {
- synchronized (getTreeLock ())
- {
- for (int i = ncomponents; --i >= 0; )
- {
- component[i].addNotify();
- if (component[i].isLightweight ())
- {
-
- // If we're not lightweight, and we just got a lightweight
- // child, we need a lightweight dispatcher to feed it events.
- if (! this.isLightweight())
- {
- if (dispatcher == null)
- dispatcher = new LightweightDispatcher (this);
- }
-
-
- enableEvents(component[i].eventMask);
- if (peer != null && !isLightweight ())
- enableEvents (AWTEvent.PAINT_EVENT_MASK);
- }
- }
- }
- }
-
- /**
- * Deserialize this Container:
- *
- *
- *
- * @param s the stream to read from
- * @throws ClassNotFoundException if deserialization fails
- * @throws IOException if the stream fails
- */
- private void readObject (ObjectInputStream s)
- throws ClassNotFoundException, IOException
- {
- s.defaultReadObject ();
- String key = (String) s.readObject ();
- while (key != null)
- {
- Object object = s.readObject ();
- if ("containerL".equals (key))
- addContainerListener((ContainerListener) object);
- // FIXME: under what key is the focus traversal policy stored?
- else if ("focusTraversalPolicy".equals (key))
- setFocusTraversalPolicy ((FocusTraversalPolicy) object);
-
- key = (String) s.readObject();
- }
- }
-
- /**
- * Serialize this Container:
- *
- *
- *
- * @param s the stream to write to
- * @throws IOException if the stream fails
- */
- private void writeObject (ObjectOutputStream s) throws IOException
- {
- s.defaultWriteObject ();
- AWTEventMulticaster.save (s, "containerL", containerListener);
- if (focusTraversalPolicy instanceof Serializable)
- s.writeObject (focusTraversalPolicy);
- else
- s.writeObject (null);
- }
-
- // Nested classes.
-
- /* The following classes are used in concert with the
- visitChildren() method to implement all the graphics operations
- that requires traversal of the containment hierarchy. */
-
- abstract static class GfxVisitor
- {
- public abstract void visit(Component c, Graphics gfx);
- }
-
- static class GfxPaintVisitor extends GfxVisitor
- {
- public static final GfxVisitor INSTANCE = new GfxPaintVisitor();
-
- public void visit(Component c, Graphics gfx)
- {
- c.paint(gfx);
- }
- }
-
- static class GfxPrintVisitor extends GfxVisitor
- {
- public static final GfxVisitor INSTANCE = new GfxPrintVisitor();
-
- public void visit(Component c, Graphics gfx)
- {
- c.print(gfx);
- }
- }
-
- static class GfxPaintAllVisitor extends GfxVisitor
- {
- public static final GfxVisitor INSTANCE = new GfxPaintAllVisitor();
-
- public void visit(Component c, Graphics gfx)
- {
- c.paintAll(gfx);
- }
- }
-
- static class GfxPrintAllVisitor extends GfxVisitor
- {
- public static final GfxVisitor INSTANCE = new GfxPrintAllVisitor();
-
- public void visit(Component c, Graphics gfx)
- {
- c.printAll(gfx);
- }
- }
-
- /**
- * This class provides accessibility support for subclasses of container.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- *
- * @since 1.3
- */
- protected class AccessibleAWTContainer extends AccessibleAWTComponent
- {
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = 5081320404842566097L;
-
- /**
- * The handler to fire PropertyChange when children are added or removed.
- *
- * @serial the handler for property changes
- */
- protected ContainerListener accessibleContainerHandler
- = new AccessibleContainerHandler();
-
- /**
- * The default constructor.
- */
- protected AccessibleAWTContainer()
- {
- Container.this.addContainerListener(accessibleContainerHandler);
- }
-
- /**
- * Return the number of accessible children of the containing accessible
- * object (at most the total number of its children).
- *
- * @return the number of accessible children
- */
- public int getAccessibleChildrenCount()
- {
- synchronized (getTreeLock ())
- {
- int count = 0;
- int i = component == null ? 0 : component.length;
- while (--i >= 0)
- if (component[i] instanceof Accessible)
- count++;
- return count;
- }
- }
-
- /**
- * Return the nth accessible child of the containing accessible object.
- *
- * @param i the child to grab, zero-based
- * @return the accessible child, or null
- */
- public Accessible getAccessibleChild(int i)
- {
- synchronized (getTreeLock ())
- {
- if (component == null)
- return null;
- int index = -1;
- while (i >= 0 && ++index < component.length)
- if (component[index] instanceof Accessible)
- i--;
- if (i < 0)
- return (Accessible) component[index];
- return null;
- }
- }
-
- /**
- * Return the accessible child located at point (in the parent's
- * coordinates), if one exists.
- *
- * @param p the point to look at
- *
- * @return an accessible object at that point, or null
- *
- * @throws NullPointerException if p is null
- */
- public Accessible getAccessibleAt(Point p)
- {
- Component c = getComponentAt(p.x, p.y);
- return c != Container.this && c instanceof Accessible ? (Accessible) c
- : null;
- }
-
- /**
- * This class fires a PropertyChange
listener, if registered,
- * when children are added or removed from the enclosing accessible object.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- *
- * @since 1.3
- */
- protected class AccessibleContainerHandler implements ContainerListener
- {
- /**
- * Default constructor.
- */
- protected AccessibleContainerHandler()
- {
- }
-
- /**
- * Fired when a component is added; forwards to the PropertyChange
- * listener.
- *
- * @param e the container event for adding
- */
- public void componentAdded(ContainerEvent e)
- {
- AccessibleAWTContainer.this.firePropertyChange
- (ACCESSIBLE_CHILD_PROPERTY, null, e.getChild());
- }
-
- /**
- * Fired when a component is removed; forwards to the PropertyChange
- * listener.
- *
- * @param e the container event for removing
- */
- public void componentRemoved(ContainerEvent e)
- {
- AccessibleAWTContainer.this.firePropertyChange
- (ACCESSIBLE_CHILD_PROPERTY, e.getChild(), null);
- }
- } // class AccessibleContainerHandler
- } // class AccessibleAWTContainer
-} // class Container
-
-/**
- * There is a helper class implied from stack traces called
- * LightweightDispatcher, but since it is not part of the public API,
- * rather than mimic it exactly we write something which does "roughly
- * the same thing".
- */
-
-class LightweightDispatcher implements Serializable
-{
- private static final long serialVersionUID = 5184291520170872969L;
- private Container nativeContainer;
- private Cursor nativeCursor;
- private long eventMask;
-
- private transient Component mouseEventTarget;
- private transient Component pressedComponent;
- private transient Component lastComponentEntered;
- private transient int pressCount;
-
- LightweightDispatcher(Container c)
- {
- nativeContainer = c;
- }
-
- void acquireComponentForMouseEvent(MouseEvent me)
- {
- int x = me.getX ();
- int y = me.getY ();
-
- // Find the candidate which should receive this event.
- Component parent = nativeContainer;
- Component candidate = null;
- Point p = me.getPoint();
- while (candidate == null && parent != null)
- {
- candidate =
- SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
- if (candidate == null || (candidate.eventMask & me.getID()) == 0)
- {
- candidate = null;
- p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent);
- parent = parent.parent;
- }
- }
-
- // If the only candidate we found was the native container itself,
- // don't dispatch any event at all. We only care about the lightweight
- // children here.
- if (candidate == nativeContainer)
- candidate = null;
-
- // If our candidate is new, inform the old target we're leaving.
- if (lastComponentEntered != null
- && lastComponentEntered.isShowing()
- && lastComponentEntered != candidate)
- {
- // Old candidate could have been removed from
- // the nativeContainer so we check first.
- if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer))
- {
- Point tp =
- SwingUtilities.convertPoint(nativeContainer,
- x, y, lastComponentEntered);
- MouseEvent exited = new MouseEvent (lastComponentEntered,
- MouseEvent.MOUSE_EXITED,
- me.getWhen (),
- me.getModifiersEx (),
- tp.x, tp.y,
- me.getClickCount (),
- me.isPopupTrigger (),
- me.getButton ());
- lastComponentEntered.dispatchEvent (exited);
- }
- lastComponentEntered = null;
- }
- // If we have a candidate, maybe enter it.
- if (candidate != null)
- {
- mouseEventTarget = candidate;
- if (candidate.isLightweight()
- && candidate.isShowing()
- && candidate != nativeContainer
- && candidate != lastComponentEntered)
- {
- lastComponentEntered = mouseEventTarget;
- Point cp = SwingUtilities.convertPoint(nativeContainer,
- x, y, lastComponentEntered);
- MouseEvent entered = new MouseEvent (lastComponentEntered,
- MouseEvent.MOUSE_ENTERED,
- me.getWhen (),
- me.getModifiersEx (),
- cp.x, cp.y,
- me.getClickCount (),
- me.isPopupTrigger (),
- me.getButton ());
- lastComponentEntered.dispatchEvent (entered);
- }
- }
-
- if (me.getID() == MouseEvent.MOUSE_RELEASED
- || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0
- || me.getID() == MouseEvent.MOUSE_DRAGGED)
- // If any of the following events occur while a button is held down,
- // they should be dispatched to the same component to which the
- // original MOUSE_PRESSED event was dispatched:
- // - MOUSE_RELEASED
- // - MOUSE_PRESSED: another button pressed while the first is held down
- // - MOUSE_DRAGGED
- if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer))
- mouseEventTarget = pressedComponent;
- else if (me.getID() == MouseEvent.MOUSE_CLICKED)
- {
- // Don't dispatch CLICKED events whose target is not the same as the
- // target for the original PRESSED event.
- if (candidate != pressedComponent)
- mouseEventTarget = null;
- else if (pressCount == 0)
- pressedComponent = null;
- }
- }
-
- boolean handleEvent(AWTEvent e)
- {
- if (e instanceof MouseEvent)
- {
- MouseEvent me = (MouseEvent) e;
-
- acquireComponentForMouseEvent(me);
-
- // Avoid dispatching ENTERED and EXITED events twice.
- if (mouseEventTarget != null
- && mouseEventTarget.isShowing()
- && e.getID() != MouseEvent.MOUSE_ENTERED
- && e.getID() != MouseEvent.MOUSE_EXITED)
- {
- MouseEvent newEvt =
- SwingUtilities.convertMouseEvent(nativeContainer, me,
- mouseEventTarget);
- mouseEventTarget.dispatchEvent(newEvt);
-
- switch (e.getID())
- {
- case MouseEvent.MOUSE_PRESSED:
- if (pressCount++ == 0)
- pressedComponent = mouseEventTarget;
- break;
-
- case MouseEvent.MOUSE_RELEASED:
- // Clear our memory of the original PRESSED event, only if
- // we're not expecting a CLICKED event after this. If
- // there is a CLICKED event after this, it will do clean up.
- if (--pressCount == 0
- && mouseEventTarget != pressedComponent)
- pressedComponent = null;
- break;
- }
- if (newEvt.isConsumed())
- e.consume();
- }
- }
-
- return e.isConsumed();
- }
-
-} // class LightweightDispatcher
diff --git a/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java b/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
deleted file mode 100644
index 152482c887b..00000000000
--- a/libjava/java/awt/ContainerOrderFocusTraversalPolicy.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/* ContainerOrderFocusTraversalPolicy.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-
-/**
- * ContainerOrderFocusTraversalPolicy defines a focus traversal order
- * based on the order in which Components were packed in a Container.
- * This policy performs a pre-order traversal of the Component
- * hierarchy starting from a given focus cycle root. Portions of the
- * hierarchy that are not visible and displayable are skipped.
- *
- * By default, this policy transfers focus down-cycle implicitly.
- * That is, if a forward traversal is requested on a focus cycle root
- * and the focus cycle root has focusable children, the focus will
- * automatically be transfered down to the lower focus cycle.
- *
- * The default implementation of accept accepts only Components that
- * are visible, displayable, enabled and focusable. Derived classes
- * can override these acceptance criteria by overriding accept.
- *
- * @author Michael Koch
- * @author Thomas Fitzsimmons (fitzsim@redhat.com)
- * @since 1.4
- */
-public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
- implements Serializable
-{
- /**
- * Compatible to JDK 1.4+
- */
- static final long serialVersionUID = 486933713763926351L;
-
- /**
- * True if implicit down cycling is enabled.
- */
- private boolean implicitDownCycleTraversal = true;
-
- /**
- * Creates the ContainerOrderFocusTraversalPolicy
object.
- */
- public ContainerOrderFocusTraversalPolicy ()
- {
- // Nothing to do here
- }
-
- /**
- * Returns the Component that should receive the focus after current.
- * root must be a focus cycle root of current.
- *
- * @param root a focus cycle root of current
- * @param current a (possibly indirect) child of root, or root itself
- *
- * @return the next Component in the focus traversal order for root,
- * or null if no acceptable Component exists.
- *
- * @exception IllegalArgumentException If root is not a focus cycle
- * root of current, or if either root or current is null.
- */
- public Component getComponentAfter (Container root, Component current)
- {
- if (root == null)
- throw new IllegalArgumentException ("focus cycle root is null");
- if (current == null)
- throw new IllegalArgumentException ("current component is null");
-
- if (!root.isFocusCycleRoot ())
- throw new IllegalArgumentException ("root is not a focus cycle root");
-
- Container ancestor = current.getFocusCycleRootAncestor ();
- Container prevAncestor = ancestor;
- while (ancestor != root)
- {
- ancestor = current.getFocusCycleRootAncestor ();
- if (ancestor == prevAncestor)
- {
- // We've reached the top focus cycle root ancestor. Check
- // if it is root.
- if (ancestor != root)
- throw new IllegalArgumentException ("the given container is not"
- + " a focus cycle root of the"
- + " current component");
- else
- break;
- }
- prevAncestor = ancestor;
- }
-
- // FIXME: is this the right thing to do here? It moves the context
- // for traversal up one focus traversal cycle. We'll need a test
- // for this.
- if ((Component) root == current)
- root = current.getFocusCycleRootAncestor ();
-
- // Check if we've reached the top of the component hierarchy. If
- // so then we want to loop around to the first component in the
- // focus traversal cycle.
- if (current instanceof Window)
- return getFirstComponent ((Container) current);
-
- Container parent = current.getParent ();
-
- synchronized (parent.getTreeLock ())
- {
- Component[] components = parent.getComponents ();
- int componentIndex = 0;
- int numComponents = parent.getComponentCount ();
-
- // Find component's index.
- for (int i = 0; i < numComponents; i++)
- {
- if (components[i] == current)
- componentIndex = i;
- }
-
- // Search forward for the next acceptable component.
- for (int i = componentIndex + 1; i < numComponents; i++)
- {
- if (accept (components[i]))
- return components[i];
-
- if (components[i] instanceof Container)
- {
- Component result = getFirstComponent ((Container) components[i]);
-
- if (result != null
- && implicitDownCycleTraversal)
- return result;
- }
- }
-
- // No focusable components after current in its Container. So go
- // to the next Component after current's Container (parent).
- Component result = getComponentAfter (root, parent);
-
- return result;
- }
- }
-
- /**
- * Returns the Component that should receive the focus before
- * current
. root
must be a focus cycle
- * root of current.
- *
- * @param root a focus cycle root of current
- * @param current a (possibly indirect) child of root, or root itself
- *
- * @return the previous Component in the focus traversal order for
- * root, or null if no acceptable Component exists.
- *
- * @exception IllegalArgumentException If root is not a focus cycle
- * root of current, or if either root or current is null.
- */
- public Component getComponentBefore (Container root, Component current)
- {
- if (root == null)
- throw new IllegalArgumentException ("focus cycle root is null");
- if (current == null)
- throw new IllegalArgumentException ("current component is null");
-
- if (!root.isFocusCycleRoot ())
- throw new IllegalArgumentException ("root is not a focus cycle root");
-
- Container ancestor = current.getFocusCycleRootAncestor ();
- Container prevAncestor = ancestor;
- while (ancestor != root)
- {
- ancestor = current.getFocusCycleRootAncestor ();
- if (ancestor == prevAncestor)
- {
- // We've reached the top focus cycle root ancestor. Check
- // if it is root.
- if (ancestor != root)
- throw new IllegalArgumentException ("the given container is not"
- + " a focus cycle root of the"
- + " current component");
- else
- break;
- }
- prevAncestor = ancestor;
- }
-
- // FIXME: is this the right thing to do here? It moves the context
- // for traversal up one focus traversal cycle. We'll need a test
- // for this.
- if ((Component) root == current)
- root = current.getFocusCycleRootAncestor ();
-
- // Check if we've reached the top of the component hierarchy. If
- // so then we want to loop around to the last component in the
- // focus traversal cycle.
- if (current instanceof Window)
- return getLastComponent ((Container) current);
-
- Container parent = current.getParent ();
-
- synchronized (parent.getTreeLock ())
- {
- Component[] components = parent.getComponents ();
- int componentIndex = 0;
- int numComponents = parent.getComponentCount ();
-
- // Find component's index.
- for (int i = 0; i < numComponents; i++)
- {
- if (components[i] == current)
- componentIndex = i;
- }
-
- // Search backward for the next acceptable component.
- for (int i = componentIndex - 1; i >= 0; i--)
- {
- if (accept (components[i]))
- return components[i];
-
- if (components[i] instanceof Container)
- {
- Component result = getLastComponent ((Container) components[i]);
-
- if (result != null)
- return result;
- }
- }
-
- // No focusable components before current in its Container. So go
- // to the previous Component before current's Container (parent).
- Component result = getComponentBefore (root, parent);
-
- return result;
- }
- }
-
- /**
- * Returns the first Component of root that should receive the focus.
- *
- * @param root a focus cycle root
- *
- * @return the first Component in the focus traversal order for
- * root, or null if no acceptable Component exists.
- *
- * @exception IllegalArgumentException If root is null.
- */
- public Component getFirstComponent(Container root)
- {
- if (root == null)
- throw new IllegalArgumentException ();
-
- if (!root.isVisible ()
- || !root.isDisplayable ())
- return null;
-
- if (accept (root))
- return root;
-
- Component[] componentArray = root.getComponents ();
-
- for (int i = 0; i < componentArray.length; i++)
- {
- Component component = componentArray [i];
-
- if (accept (component))
- return component;
-
- if (component instanceof Container)
- {
- Component result = getFirstComponent ((Container) component);
-
- if (result != null)
- return result;
- }
- }
-
- return null;
- }
-
- /**
- * Returns the last Component of root that should receive the focus.
- *
- * @param root a focus cycle root
- *
- * @return the last Component in the focus traversal order for
- * root, or null if no acceptable Component exists.
- *
- * @exception IllegalArgumentException If root is null.
- */
- public Component getLastComponent (Container root)
- {
- if (root == null)
- throw new IllegalArgumentException ();
-
- if (!root.isVisible ()
- || !root.isDisplayable ())
- return null;
-
- if (accept (root))
- return root;
-
- Component[] componentArray = root.getComponents ();
-
- for (int i = componentArray.length - 1; i >= 0; i--)
- {
- Component component = componentArray [i];
-
- if (accept (component))
- return component;
-
- if (component instanceof Container)
- {
- Component result = getLastComponent ((Container) component);
-
- if (result != null)
- return result;
- }
- }
-
- return null;
- }
-
- /**
- * Returns the default Component of root that should receive the focus.
- *
- * @param root a focus cycle root
- *
- * @return the default Component in the focus traversal order for
- * root, or null if no acceptable Component exists.
- *
- * @exception IllegalArgumentException If root is null.
- */
- public Component getDefaultComponent (Container root)
- {
- return getFirstComponent (root);
- }
-
- /**
- * Set whether or not implicit down cycling is enabled. If it is,
- * then initiating a forward focus traversal operation onto a focus
- * cycle root, the focus will be implicitly transferred into the
- * root container's focus cycle.
- *
- * @param value the setting for implicit down cycling
- */
- public void setImplicitDownCycleTraversal (boolean value)
- {
- implicitDownCycleTraversal = value;
- }
-
- /**
- * Check whether or not implicit down cycling is enabled. If it is,
- * then initiating a forward focus traversal operation onto a focus
- * cycle root, the focus will be implicitly transferred into the
- * root container's focus cycle.
- *
- * @return true if the focus will be transferred down-cycle
- * implicitly
- */
- public boolean getImplicitDownCycleTraversal ()
- {
- return implicitDownCycleTraversal;
- }
-
- /**
- * Check whether the given Component is an acceptable target for the
- * keyboard input focus.
- *
- * @param current the Component to check
- *
- * @return true if current is acceptable, false otherwise
- */
- protected boolean accept (Component current)
- {
- return (current.visible
- && current.isDisplayable ()
- && current.enabled
- && current.focusable);
- }
-}
diff --git a/libjava/java/awt/Cursor.java b/libjava/java/awt/Cursor.java
deleted file mode 100644
index 48a63f06f4f..00000000000
--- a/libjava/java/awt/Cursor.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This class represents various predefined cursor types.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Cursor implements java.io.Serializable
-{
- static final long serialVersionUID = 8028237497568985504L;
-
- /**
- * Constant for the system default cursor type
- */
- public static final int DEFAULT_CURSOR = 0;
-
- /**
- * Constant for a cross-hair cursor.
- */
- public static final int CROSSHAIR_CURSOR = 1;
-
- /**
- * Constant for a cursor over a text field.
- */
- public static final int TEXT_CURSOR = 2;
-
- /**
- * Constant for a cursor to display while waiting for an action to complete.
- */
- public static final int WAIT_CURSOR = 3;
-
- /**
- * Cursor used over SW corner of window decorations.
- */
- public static final int SW_RESIZE_CURSOR = 4;
-
- /**
- * Cursor used over SE corner of window decorations.
- */
- public static final int SE_RESIZE_CURSOR = 5;
-
- /**
- * Cursor used over NW corner of window decorations.
- */
- public static final int NW_RESIZE_CURSOR = 6;
-
- /**
- * Cursor used over NE corner of window decorations.
- */
- public static final int NE_RESIZE_CURSOR = 7;
-
- /**
- * Cursor used over N edge of window decorations.
- */
- public static final int N_RESIZE_CURSOR = 8;
-
- /**
- * Cursor used over S edge of window decorations.
- */
- public static final int S_RESIZE_CURSOR = 9;
-
- /**
- * Cursor used over W edge of window decorations.
- */
- public static final int W_RESIZE_CURSOR = 10;
-
- /**
- * Cursor used over E edge of window decorations.
- */
- public static final int E_RESIZE_CURSOR = 11;
-
- /**
- * Constant for a hand cursor.
- */
- public static final int HAND_CURSOR = 12;
-
- /**
- * Constant for a cursor used during window move operations.
- */
- public static final int MOVE_CURSOR = 13;
-
- public static final int CUSTOM_CURSOR = 0xFFFFFFFF;
-
- private static final int PREDEFINED_COUNT = 14;
-
- protected static Cursor[] predefined = new Cursor[PREDEFINED_COUNT];
- protected String name;
-
- /**
- * @serial The numeric id of this cursor.
- */
- int type;
-
- /**
- * Initializes a new instance of Cursor
with the specified
- * type.
- *
- * @param type The cursor type.
- *
- * @exception IllegalArgumentException If the specified cursor type is invalid
- */
- public Cursor(int type)
- {
- if (type < 0 || type >= PREDEFINED_COUNT)
- throw new IllegalArgumentException ("invalid cursor " + type);
-
- this.type = type;
- // FIXME: lookup and set name?
- }
-
- /** This constructor is used internally only.
- * Application code should call Toolkit.createCustomCursor().
- */
- protected Cursor(String name)
- {
- this.name = name;
- this.type = CUSTOM_CURSOR;
- }
-
- /**
- * Returns an instance of Cursor
for one of the specified
- * predetermined types.
- *
- * @param type The type contant from this class.
- *
- * @return The requested predefined cursor.
- *
- * @exception IllegalArgumentException If the constant is not one of the
- * predefined cursor type constants from this class.
- */
- public static Cursor getPredefinedCursor(int type)
- {
- if (type < 0 || type >= PREDEFINED_COUNT)
- throw new IllegalArgumentException ("invalid cursor " + type);
- if (predefined[type] == null)
- predefined[type] = new Cursor(type);
- return predefined[type];
- }
-
- /**
- * Retrieves the system specific custom Cursor named Cursor names are,
- * for example: "Invalid.16x16".
- *
- * @exception AWTException
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
- public static Cursor getSystemCustomCursor(String name)
- throws AWTException
- {
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-
- // FIXME
- return null;
- }
-
- /**
- * Returns an instance of the system default cursor type.
- *
- * @return The system default cursor.
- */
- public static Cursor getDefaultCursor()
- {
- return getPredefinedCursor(DEFAULT_CURSOR);
- }
-
- /**
- * Returns the numeric type identifier for this cursor.
- *
- * @return The cursor id.
- */
- public int getType()
- {
- return type;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String toString()
- {
- return (this.getClass() + "[" + getName() + "]");
- }
-}
diff --git a/libjava/java/awt/DefaultFocusTraversalPolicy.java b/libjava/java/awt/DefaultFocusTraversalPolicy.java
deleted file mode 100644
index 46b56d3fc29..00000000000
--- a/libjava/java/awt/DefaultFocusTraversalPolicy.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* DefaultFocusTraversalPolicy.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * DefaultFocusTraversalPolicy is the default focus traversal policy
- * used by Containers.
- *
- * This policy sharpens ContainerOrderFocusTraversalPolicy's
- * acceptance criteria, to reject those Components that have
- * unfocusable peers. Despite this extra strictness, this policy will
- * always accept a Component that has explicitly been set focusable by
- * any means.
- *
- * This AWT implementation assumes that the peers of the following
- * Components are not focusable: Canvas, Panel, Label, ScrollPane,
- * Scrollbar, Window, and any lightweight Component.
- *
- * A Component's focusability is independent of the focusability of
- * its peer.
- *
- * @author Thomas Fitzsimmons (fitzsim@redhat.com)
- * @since 1.4
- */
-public class DefaultFocusTraversalPolicy
- extends ContainerOrderFocusTraversalPolicy
-{
- /**
- * Construct a default focus traversal policy.
- */
- public DefaultFocusTraversalPolicy ()
- {
- }
-
- /**
- * Check whether a given Component would be acceptable as a focus
- * owner. The Component must be displayable, visible and enabled to
- * be acceptable. If the Component's focus traversability has been
- * overridden, by overriding Component.isFocusTraversable or
- * Component.isFocusable, or by calling Component.setFocusable, then
- * the Component will be accepted if it is focusable. If the
- * Component uses the default focus traversable behaviour, then
- * comp
will always be rejected if it is a Canvas,
- * Panel, Label, ScrollPane, Scrollbar, Window or lightweight
- * Component.
- *
- * @param comp the Component to check
- *
- * @return true if the Component is an acceptable target for
- * keyboard input focus, false otherwise
- */
- protected boolean accept (Component comp)
- {
- if (comp.visible
- && comp.isDisplayable ()
- && comp.enabled)
- {
- if (comp.isFocusTraversableOverridden != 0
- && (comp.isFocusTraversable () || comp.isFocusable()))
- return true;
-
- if (!(comp instanceof Canvas
- || comp instanceof Panel
- || comp instanceof Label
- || comp instanceof ScrollPane
- || comp instanceof Scrollbar
- || comp instanceof Window
- || comp.isLightweight ()))
- return true;
- }
- return false;
- }
-}
diff --git a/libjava/java/awt/DefaultKeyboardFocusManager.java b/libjava/java/awt/DefaultKeyboardFocusManager.java
deleted file mode 100644
index 8362a97481b..00000000000
--- a/libjava/java/awt/DefaultKeyboardFocusManager.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/* DefaultKeyboardFocusManager.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.FocusEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowEvent;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-// FIXME: finish documentation
-public class DefaultKeyboardFocusManager extends KeyboardFocusManager
-{
- /**
- * This class models a request to delay the dispatch of events that
- * arrive after a certain time, until a certain component becomes
- * the focus owner.
- */
- private class EventDelayRequest implements Comparable
- {
- /** A {@link java.util.List} of {@link java.awt.event.KeyEvent}s
- that are being delayed, pending this request's {@link
- Component} receiving the keyboard focus. */
- private LinkedList enqueuedKeyEvents = new LinkedList ();
-
- /** An event timestamp. All events that arrive after this time
- should be queued in the {@link #enqueuedKeyEvents} {@link
- java.util.List}. */
- public long timestamp;
- /** When this {@link Component} becomes focused, all events
- between this EventDelayRequest and the next one in will be
- dispatched from {@link #enqueuedKeyEvents}. */
- public Component focusedComp;
-
- /**
- * Construct a new EventDelayRequest.
- *
- * @param timestamp events that arrive after this time will be
- * delayed
- * @param focusedComp the Component that needs to receive focus
- * before events are dispatched
- */
- public EventDelayRequest (long timestamp, Component focusedComp)
- {
- this.timestamp = timestamp;
- this.focusedComp = focusedComp;
- }
-
- public int compareTo (Object o)
- {
- if (!(o instanceof EventDelayRequest))
- throw new ClassCastException ();
-
- EventDelayRequest request = (EventDelayRequest) o;
-
- if (request.timestamp < timestamp)
- return -1;
- else if (request.timestamp == timestamp)
- return 0;
- else
- return 1;
- }
-
- public boolean equals (Object o)
- {
- if (!(o instanceof EventDelayRequest) || o == null)
- return false;
-
- EventDelayRequest request = (EventDelayRequest) o;
-
- return (request.timestamp == timestamp
- && request.focusedComp == focusedComp);
- }
-
- public void enqueueEvent (KeyEvent e)
- {
- KeyEvent last = (KeyEvent) enqueuedKeyEvents.getLast ();
- if (last != null && e.getWhen () < last.getWhen ())
- throw new RuntimeException ("KeyEvents enqueued out-of-order");
-
- if (e.getWhen () <= timestamp)
- throw new RuntimeException ("KeyEvents enqueued before starting timestamp");
-
- enqueuedKeyEvents.add (e);
- }
-
- public void dispatchEvents ()
- {
- int size = enqueuedKeyEvents.size ();
- for (int i = 0; i < size; i++)
- {
- KeyEvent e = (KeyEvent) enqueuedKeyEvents.remove (0);
- dispatchKeyEvent (e);
- }
- }
-
- public void discardEvents ()
- {
- enqueuedKeyEvents.clear ();
- }
- }
-
- /** The {@link java.util.SortedSet} of current {@link
- #EventDelayRequest}s. */
- private SortedSet delayRequests = new TreeSet ();
-
- public DefaultKeyboardFocusManager ()
- {
- }
-
- public boolean dispatchEvent (AWTEvent e)
- {
- if (e instanceof WindowEvent)
- {
- Window target = (Window) e.getSource ();
-
- if (e.id == WindowEvent.WINDOW_ACTIVATED)
- setGlobalActiveWindow (target);
- else if (e.id == WindowEvent.WINDOW_GAINED_FOCUS)
- setGlobalFocusedWindow (target);
- else if (e.id != WindowEvent.WINDOW_LOST_FOCUS
- && e.id != WindowEvent.WINDOW_DEACTIVATED)
- return false;
-
- redispatchEvent(target, e);
- return true;
- }
- else if (e instanceof FocusEvent)
- {
- Component target = (Component) e.getSource ();
-
- if (e.id == FocusEvent.FOCUS_GAINED)
- {
- if (! (target instanceof Window))
- {
- if (((FocusEvent) e).isTemporary ())
- setGlobalFocusOwner (target);
- else
- setGlobalPermanentFocusOwner (target);
- }
-
- // Keep track of this window's focus owner.
-
- // Find the target Component's top-level ancestor.
- Container parent = target.getParent ();
-
- while (parent != null
- && !(parent instanceof Window))
- parent = parent.getParent ();
-
- Window toplevel = parent == null ?
- (Window) target : (Window) parent;
-
- Component focusOwner = getFocusOwner ();
- if (focusOwner != null
- && ! (focusOwner instanceof Window))
- toplevel.setFocusOwner (focusOwner);
- }
- else if (e.id == FocusEvent.FOCUS_LOST)
- {
- if (((FocusEvent) e).isTemporary ())
- setGlobalFocusOwner (null);
- else
- setGlobalPermanentFocusOwner (null);
- }
-
- redispatchEvent(target, e);
-
- return true;
- }
- else if (e instanceof KeyEvent)
- {
- // Loop through all registered KeyEventDispatchers, giving
- // each a chance to handle this event.
- Iterator i = getKeyEventDispatchers().iterator();
-
- while (i.hasNext ())
- {
- KeyEventDispatcher dispatcher = (KeyEventDispatcher) i.next ();
- if (dispatcher.dispatchKeyEvent ((KeyEvent) e))
- return true;
- }
-
- // processKeyEvent checks if this event represents a focus
- // traversal key stroke.
- Component focusOwner = getGlobalPermanentFocusOwner ();
-
- if (focusOwner != null)
- processKeyEvent (focusOwner, (KeyEvent) e);
-
- if (e.isConsumed ())
- return true;
-
- if (enqueueKeyEvent ((KeyEvent) e))
- // This event was enqueued for dispatch at a later time.
- return true;
- else
- // This event wasn't handled by any of the registered
- // KeyEventDispatchers, and wasn't enqueued for dispatch
- // later, so send it to the default dispatcher.
- return dispatchKeyEvent ((KeyEvent) e);
- }
-
- return false;
- }
-
- private boolean enqueueKeyEvent (KeyEvent e)
- {
- Iterator i = delayRequests.iterator ();
- boolean oneEnqueued = false;
- while (i.hasNext ())
- {
- EventDelayRequest request = (EventDelayRequest) i.next ();
- if (e.getWhen () > request.timestamp)
- {
- request.enqueueEvent (e);
- oneEnqueued = true;
- }
- }
- return oneEnqueued;
- }
-
- public boolean dispatchKeyEvent (KeyEvent e)
- {
- Component focusOwner = getGlobalPermanentFocusOwner ();
-
- if (focusOwner != null)
- redispatchEvent(focusOwner, e);
-
- // Loop through all registered KeyEventPostProcessors, giving
- // each a chance to process this event.
- Iterator i = getKeyEventPostProcessors().iterator();
-
- while (i.hasNext ())
- {
- KeyEventPostProcessor processor = (KeyEventPostProcessor) i.next ();
- if (processor.postProcessKeyEvent ((KeyEvent) e))
- return true;
- }
-
- // The event hasn't been consumed yet. Check if it is an
- // MenuShortcut.
- if (postProcessKeyEvent (e))
- return true;
-
- // Always return true.
- return true;
- }
-
- public boolean postProcessKeyEvent (KeyEvent e)
- {
- // Check if this event represents a menu shortcut.
-
- // MenuShortcuts are activated by Ctrl- KeyEvents, only on KEY_PRESSED.
- int modifiers = e.getModifiersEx ();
- if (e.getID() == KeyEvent.KEY_PRESSED
- && (modifiers & KeyEvent.CTRL_DOWN_MASK) != 0)
- {
- Window focusedWindow = getGlobalFocusedWindow ();
- if (focusedWindow instanceof Frame)
- {
- MenuBar menubar = ((Frame) focusedWindow).getMenuBar ();
-
- if (menubar != null)
- {
- // If there's a menubar, loop through all menu items,
- // checking whether each one has a shortcut, and if
- // so, whether this key event should activate it.
- int numMenus = menubar.getMenuCount ();
-
- for (int i = 0; i < numMenus; i++)
- {
- Menu menu = menubar.getMenu (i);
- int numItems = menu.getItemCount ();
-
- for (int j = 0; j < numItems; j++)
- {
- MenuItem item = menu.getItem (j);
- MenuShortcut shortcut = item.getShortcut ();
-
- if (item.isEnabled() && shortcut != null)
- {
- // Dispatch a new ActionEvent if:
- //
- // a) this is a Shift- KeyEvent, and the
- // shortcut requires the Shift modifier
- //
- // or, b) this is not a Shift- KeyEvent, and the
- // shortcut does not require the Shift
- // modifier.
- if (shortcut.getKey () == e.getKeyCode ()
- && ((shortcut.usesShiftModifier ()
- && (modifiers & KeyEvent.SHIFT_DOWN_MASK) != 0)
- || (! shortcut.usesShiftModifier ()
- && (modifiers & KeyEvent.SHIFT_DOWN_MASK) == 0)))
- {
- item.dispatchEvent (new ActionEvent (item,
- ActionEvent.ACTION_PERFORMED,
- item.getActionCommand (),
- modifiers));
- // The event was dispatched.
- return true;
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- public void processKeyEvent (Component comp, KeyEvent e)
- {
- AWTKeyStroke eventKeystroke = AWTKeyStroke.getAWTKeyStrokeForEvent (e);
- // For every focus traversal keystroke, we need to also consume
- // the other two key event types for the same key (e.g. if
- // KEY_PRESSED TAB is a focus traversal keystroke, we also need to
- // consume KEY_RELEASED and KEY_TYPED TAB key events).
- AWTKeyStroke oppositeKeystroke = AWTKeyStroke.getAWTKeyStroke (e.getKeyCode (),
- e.getModifiersEx (),
- !(e.id == KeyEvent.KEY_RELEASED));
-
- Set forwardKeystrokes = comp.getFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- Set backwardKeystrokes = comp.getFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
- Set upKeystrokes = comp.getFocusTraversalKeys (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS);
- Set downKeystrokes = null;
- if (comp instanceof Container)
- downKeystrokes = comp.getFocusTraversalKeys (KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS);
-
- if (forwardKeystrokes.contains (eventKeystroke))
- {
- focusNextComponent (comp);
- e.consume ();
- }
- else if (backwardKeystrokes.contains (eventKeystroke))
- {
- focusPreviousComponent (comp);
- e.consume ();
- }
- else if (upKeystrokes.contains (eventKeystroke))
- {
- upFocusCycle (comp);
- e.consume ();
- }
- else if (comp instanceof Container
- && downKeystrokes.contains (eventKeystroke))
- {
- downFocusCycle ((Container) comp);
- e.consume ();
- }
- else if (forwardKeystrokes.contains (oppositeKeystroke)
- || backwardKeystrokes.contains (oppositeKeystroke)
- || upKeystrokes.contains (oppositeKeystroke)
- || (comp instanceof Container &&
- downKeystrokes.contains (oppositeKeystroke)))
- e.consume ();
- }
-
- protected void enqueueKeyEvents (long after, Component untilFocused)
- {
- delayRequests.add (new EventDelayRequest (after, untilFocused));
- }
-
- protected void dequeueKeyEvents (long after, Component untilFocused)
- {
- // FIXME: need synchronization on delayRequests and enqueuedKeyEvents.
-
- // Remove the KeyEvent with the oldest timestamp, which should be
- // the first element in the SortedSet.
- if (after < 0)
- {
- int size = delayRequests.size ();
- if (size > 0)
- delayRequests.remove (delayRequests.first ());
- }
- else
- {
- EventDelayRequest template = new EventDelayRequest (after, untilFocused);
- if (delayRequests.contains (template))
- {
- EventDelayRequest actual = (EventDelayRequest) delayRequests.tailSet (template).first ();
- delayRequests.remove (actual);
- actual.dispatchEvents ();
- }
- }
- }
-
- protected void discardKeyEvents (Component comp)
- {
- // FIXME: need synchronization on delayRequests and enqueuedKeyEvents.
-
- Iterator i = delayRequests.iterator ();
-
- while (i.hasNext ())
- {
- EventDelayRequest request = (EventDelayRequest) i.next ();
-
- if (request.focusedComp == comp
- || (comp instanceof Container
- && ((Container) comp).isAncestorOf (request.focusedComp)))
- request.discardEvents ();
- }
- }
-
- public void focusPreviousComponent (Component comp)
- {
- Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp;
- Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();
- FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
-
- Component previous = policy.getComponentBefore (focusCycleRoot, focusComp);
- if (previous != null)
- previous.requestFocusInWindow ();
- }
-
- public void focusNextComponent (Component comp)
- {
- Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp;
- Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();
- FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
-
- Component next = policy.getComponentAfter (focusCycleRoot, focusComp);
- if (next != null)
- next.requestFocusInWindow ();
- }
-
- public void upFocusCycle (Component comp)
- {
- Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp;
- Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();
-
- if (focusCycleRoot instanceof Window)
- {
- FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
- Component defaultComponent = policy.getDefaultComponent (focusCycleRoot);
- if (defaultComponent != null)
- defaultComponent.requestFocusInWindow ();
- }
- else
- {
- Container parentFocusCycleRoot = focusCycleRoot.getFocusCycleRootAncestor ();
-
- focusCycleRoot.requestFocusInWindow ();
- setGlobalCurrentFocusCycleRoot (parentFocusCycleRoot);
- }
- }
-
- public void downFocusCycle (Container cont)
- {
- if (cont == null)
- return;
-
- if (cont.isFocusCycleRoot (cont))
- {
- FocusTraversalPolicy policy = cont.getFocusTraversalPolicy ();
- Component defaultComponent = policy.getDefaultComponent (cont);
- if (defaultComponent != null)
- defaultComponent.requestFocusInWindow ();
- setGlobalCurrentFocusCycleRoot (cont);
- }
- }
-} // class DefaultKeyboardFocusManager
diff --git a/libjava/java/awt/Dialog.java b/libjava/java/awt/Dialog.java
deleted file mode 100644
index d3eb975a86d..00000000000
--- a/libjava/java/awt/Dialog.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/* Dialog.java -- An AWT dialog box
- Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.peer.DialogPeer;
-
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-
-/**
- * A dialog box widget class.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@redhat.com)
- */
-public class Dialog extends Window
-{
-
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = 5920926903803293709L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial Indicates whether or not this dialog box is modal.
- */
-private boolean modal;
-
-/**
- * @serial Indicates whether or not this dialog box is resizable.
- */
-private boolean resizable = true;
-
-/**
- * @serial The title string for this dialog box, which can be
- * null
.
- */
-private String title;
-
-/**
- * This field indicates whether the dialog is undecorated or not.
- */
-private boolean undecorated = false;
-
-/**
- * Indicates that we are blocked for modality in show
- */
-private boolean blocked = false;
-
-/**
- * Secondary EventQueue to handle AWT events while
- * we are blocked for modality in show
- */
-private EventQueue eq2 = null;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of Dialog
with the specified
- * parent, that is resizable and not modal, and which has no title.
- *
- * @param parent The parent frame of this dialog box.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is always
- * thrown when GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent)
-{
- this(parent, "", false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Dialog
with the specified
- * parent and modality, that is resizable and which has no title.
- *
- * @param parent The parent frame of this dialog box.
- * @param modal true
if this dialog box is modal,
- * false
otherwise.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is always
- * thrown when GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent, boolean modal)
-{
- this(parent, "", modal);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Dialog
with the specified
- * parent, that is resizable and not modal, and which has the specified
- * title.
- *
- * @param parent The parent frame of this dialog box.
- * @param title The title string for this dialog box.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is always
- * thrown when GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent, String title)
-{
- this(parent, title, false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Dialog
with the specified,
- * parent, title, and modality, that is resizable.
- *
- * @param parent The parent frame of this dialog box.
- * @param title The title string for this dialog box.
- * @param modal true
if this dialog box is modal,
- * false
otherwise.
- *
- * @exception IllegalArgumentException If owner is null or
- * GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent, String title, boolean modal)
-{
- this (parent, title, modal, parent.getGraphicsConfiguration ());
-}
-
-/**
- * Initializes a new instance of Dialog
with the specified,
- * parent, title, modality and GraphicsConfiguration
,
- * that is resizable.
- *
- * @param parent The parent frame of this dialog box.
- * @param title The title string for this dialog box.
- * @param modal true
if this dialog box is modal,
- * false
otherwise.
- * @param gc The GraphicsConfiguration
object to use.
- *
- * @exception IllegalArgumentException If owner is null, the
- * GraphicsConfiguration is not a screen device or
- * GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.4
- */
-public
-Dialog (Frame parent, String title, boolean modal, GraphicsConfiguration gc)
-{
- super (parent, gc);
-
- // A null title is equivalent to an empty title
- this.title = (title != null) ? title : "";
- this.modal = modal;
- visible = false;
-
- setLayout(new BorderLayout());
-}
-
-/**
- * Initializes a new instance of Dialog
with the specified,
- * parent, that is resizable.
- *
- * @exception IllegalArgumentException If parent is null. This exception is
- * always thrown when GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.2
- */
-public
-Dialog (Dialog owner)
-{
- this (owner, "", false, owner.getGraphicsConfiguration ());
-}
-
-/**
- * Initializes a new instance of Dialog
with the specified,
- * parent and title, that is resizable.
- *
- * @exception IllegalArgumentException If parent is null. This exception is
- * always thrown when GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.2
- */
-public
-Dialog (Dialog owner, String title)
-{
- this (owner, title, false, owner.getGraphicsConfiguration ());
-}
-
-/**
- * Initializes a new instance of Dialog
with the specified,
- * parent, title and modality, that is resizable.
- *
- * @exception IllegalArgumentException If parent is null. This exception is
- * always thrown when GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.2
- */
-public
-Dialog (Dialog owner, String title, boolean modal)
-{
- this (owner, title, modal, owner.getGraphicsConfiguration ());
-}
-
-/**
- * Initializes a new instance of Dialog
with the specified,
- * parent, title, modality and GraphicsConfiguration
,
- * that is resizable.
- *
- * @exception IllegalArgumentException If parent is null, the
- * GraphicsConfiguration is not a screen device or
- * GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.4
- */
-public
-Dialog (Dialog parent, String title, boolean modal, GraphicsConfiguration gc)
-{
- super (parent, parent.getGraphicsConfiguration ());
-
- // A null title is equivalent to an empty title
- this.title = (title != null) ? title : "";
- this.modal = modal;
- visible = false;
-
- setLayout (new BorderLayout ());
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * Returns the title of this dialog box.
- *
- * @return The title of this dialog box.
- */
-public String
-getTitle()
-{
- return(title);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the title of this dialog box to the specified string.
- *
- * @param title The new title.
- */
-public synchronized void
-setTitle(String title)
-{
- // A null title is equivalent to an empty title
- this.title = (title != null) ? title : "";
-
- if (peer != null)
- {
- DialogPeer d = (DialogPeer) peer;
- d.setTitle (title);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this dialog box is modal.
- *
- * @return true
if this dialog box is modal,
- * false
otherwise.
- */
-public boolean
-isModal()
-{
- return(modal);
-}
-
-/*************************************************************************/
-
-/**
- * Changes the modality of this dialog box. This can only be done before
- * the peer is created.
- *
- * @param modal true
to make this dialog box modal,
- * false
to make it non-modal.
- */
-public void
-setModal(boolean modal)
-{
- this.modal = modal;
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this dialog box is resizable.
- *
- * @return true
if this dialog is resizable, false
,
- * otherwise.
- */
-public boolean
-isResizable()
-{
- return(resizable);
-}
-
-/*************************************************************************/
-
-/**
- * Changes the resizability of this dialog box.
- *
- * @param resizable true
to make this dialog resizable,
- * false
to make it non-resizable.
- */
-public synchronized void
-setResizable(boolean resizable)
-{
- this.resizable = resizable;
- if (peer != null)
- {
- DialogPeer d = (DialogPeer) peer;
- d.setResizable (resizable);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Creates this object's native peer.
- */
-public synchronized void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createDialog (this);
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Makes this dialog visible and brings it to the front.
- * If the dialog is modal and is not already visible, this call will not
- * return until the dialog is hidden by someone calling hide or dispose.
- * If this is the event dispatching thread we must ensure that another event
- * thread runs while the one which invoked this method is blocked.
- */
-public synchronized void
-show()
-{
- super.show();
-
- if (isModal())
- {
- // If already shown (and blocked) just return
- if (blocked)
- return;
-
- /* If show is called in the dispatch thread for a modal dialog it will
- block so we must run another thread so the events keep being
- dispatched.*/
- if (EventQueue.isDispatchThread ())
- {
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
- eq2 = new EventQueue ();
- eq.push (eq2);
- }
-
- try
- {
- blocked = true;
- wait ();
- blocked = false;
- }
- catch (InterruptedException e)
- {
- blocked = false;
- }
-
- if (eq2 != null)
- {
- eq2.pop ();
- eq2 = null;
- }
- }
-}
-
-/*************************************************************************/
-
-/**
- * Hides the Dialog and then
- * causes show() to return if it is currently blocked.
- */
-
-public synchronized void
-hide ()
-{
- if (blocked)
- {
- notifyAll ();
- }
-
- super.hide();
-}
-
-/*************************************************************************/
-
-/**
- * Disposes the Dialog and then causes show() to return
- * if it is currently blocked.
- */
-
-public synchronized void
-dispose ()
-{
- if (blocked)
- {
- notifyAll ();
- }
-
- super.dispose();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this component.
- *
- * @return A debugging string for this component.
- */
-protected String
-paramString()
-{
- return ("title+" + title + ",modal=" + modal +
- ",resizable=" + resizable + "," + super.paramString());
-}
-
- /**
- * Returns whether this frame is undecorated or not.
- *
- * @since 1.4
- */
- public boolean isUndecorated ()
- {
- return undecorated;
- }
-
- /**
- * Disables or enables decorations for this frame. This method can only be
- * called while the frame is not displayable.
- *
- * @exception IllegalComponentStateException If this frame is displayable.
- *
- * @since 1.4
- */
- public void setUndecorated (boolean undecorated)
- {
- if (isDisplayable ())
- throw new IllegalComponentStateException ();
-
- this.undecorated = undecorated;
- }
-
- protected class AccessibleAWTDialog extends AccessibleAWTWindow
- {
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.DIALOG;
- }
-
- public AccessibleStateSet getAccessibleState()
- {
- AccessibleStateSet states = super.getAccessibleStateSet();
- if (isResizable())
- states.add(AccessibleState.RESIZABLE);
- if (isModal())
- states.add(AccessibleState.MODAL);
- return states;
- }
- }
-
- /**
- * Gets the AccessibleContext associated with this Dialog
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTDialog();
- return accessibleContext;
- }
-
-} // class Dialog
-
diff --git a/libjava/java/awt/Dimension.java b/libjava/java/awt/Dimension.java
deleted file mode 100644
index 4c1a07bf920..00000000000
--- a/libjava/java/awt/Dimension.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/* Dimension.java -- represents a 2-dimensional span
- Copyright (C) 1999, 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.Dimension2D;
-import java.io.Serializable;
-
-/**
- * This class holds a width and height value pair. This is used in plenty
- * of windowing classes, but also has geometric meaning.
- *
- * ((width + height) * (width + height + 1) / 2) + width
.
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- // Reverse engineering this was fun!
- return (width + height) * (width + height + 1) / 2 + width;
- }
-
- /**
- * Returns a string representation of this object. The format is:
- * getClass().getName() + "[width=" + width + ",height=" + height
- * + ']'
.
- *
- * @return a string representation of this object
- */
- public String toString()
- {
- return getClass().getName()
- + "[width=" + width + ",height=" + height + ']';
- }
-} // class Dimension
diff --git a/libjava/java/awt/DisplayMode.java b/libjava/java/awt/DisplayMode.java
deleted file mode 100644
index d41d4a87f57..00000000000
--- a/libjava/java/awt/DisplayMode.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/* DisplayMode.java -- a description of display mode configurations
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This encapsulates information about the display mode for a graphics
- * device configuration. They are device dependent, and may not always be
- * available.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see GraphicsDevice
- * @since 1.4
- * @status updated to 1.4
- */
-public final class DisplayMode
-{
- /**
- * Value of the bit depth if multiple depths are supported.
- *
- * @see #getBitDepth()
- */
- public static final int BIT_DEPTH_MULTI = -1;
-
- /**
- * Value of an unknown refresh rate.
- *
- * @see #getRefreshRate()
- */
- public static final int REFRESH_RATE_UNKNOWN = 0;
-
- /** The width. */
- private final int width;
-
- /** The height. */
- private final int height;
-
- /** The bit depth. */
- private final int bitDepth;
-
- /** The refresh rate. */
- private final int refreshRate;
-
- /**
- * Create a mode with the given parameters.
- *
- * @param width the width
- * @param height the height
- * @param bitDepth the bitDepth
- * @param refreshRate the refreshRate
- * @see #BIT_DEPTH_MULTI
- * @see #REFRESH_RATE_UNKNOWN
- */
- public DisplayMode(int width, int height, int bitDepth, int refreshRate)
- {
- this.width = width;
- this.height = height;
- this.bitDepth = bitDepth;
- this.refreshRate = refreshRate;
- }
-
- /**
- * Returns the height, in pixels.
- *
- * @return the height
- */
- public int getHeight()
- {
- return height;
- }
-
- /**
- * Returns the width, in pixels.
- *
- * @return the width
- */
- public int getWidth()
- {
- return width;
- }
-
- /**
- * Returns the bit depth, in bits per pixel. This may be BIT_DEPTH_MULTI.
- *
- * @return the bit depth
- * @see #BIT_DEPTH_MULTI
- */
- public int getBitDepth()
- {
- return bitDepth;
- }
-
- /**
- * Returns the refresh rate, in hertz. This may be REFRESH_RATE_UNKNOWN.
- *
- * @return the refresh rate
- * @see #REFRESH_RATE_UNKNOWN
- */
- public int getRefreshRate()
- {
- return refreshRate;
- }
-
- /**
- * Test for equality. This returns true for two modes with identical
- * parameters.
- *
- * @param dm The display mode to compare to
- *
- * @return true if it is equal
- */
- public boolean equals (DisplayMode dm)
- {
- return (width == dm.width
- && height == dm.height
- && bitDepth == dm.bitDepth
- && refreshRate == dm.refreshRate);
- }
-
- /**
- * Returns a hash code for the display mode.
- *
- * @return the hash code
- */
- public int hashCode()
- {
- return width + height + bitDepth + refreshRate;
- }
-} // class DisplayMode
diff --git a/libjava/java/awt/Event.java b/libjava/java/awt/Event.java
deleted file mode 100644
index 648139cc850..00000000000
--- a/libjava/java/awt/Event.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * Written using on-line Java Platform 1.2 API Specification, as well
- * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
- * Status: Believed complete and correct.
- */
-
-public class Event implements java.io.Serializable
-{
- static final long serialVersionUID = 5488922509400504703L;
-
- public static final int SHIFT_MASK = 1;
- public static final int CTRL_MASK = 2;
- public static final int META_MASK = 4;
- public static final int ALT_MASK = 8;
-
- public static final int ACTION_EVENT = 1001;
- public static final int BACK_SPACE = 8;
- public static final int CAPS_LOCK = 1022;
- public static final int DELETE = 127;
- public static final int DOWN = 1005;
- public static final int END = 1001;
- public static final int ENTER = 10;
- public static final int ESCAPE = 27;
- public static final int F1 = 1008;
- public static final int F10 = 1017;
- public static final int F11 = 1018;
- public static final int F12 = 1019;
- public static final int F2 = 1009;
- public static final int F3 = 1010;
- public static final int F4 = 1011;
- public static final int F5 = 1012;
- public static final int F6 = 1013;
- public static final int F7 = 1014;
- public static final int F8 = 1015;
- public static final int F9 = 1016;
- public static final int GOT_FOCUS = 1004;
- public static final int HOME = 1000;
- public static final int INSERT = 1025;
- public static final int KEY_ACTION = 403;
- public static final int KEY_ACTION_RELEASE = 404;
- public static final int KEY_PRESS = 401;
- public static final int KEY_RELEASE = 402;
- public static final int LEFT = 1006;
- public static final int LIST_DESELECT = 702;
- public static final int LIST_SELECT = 701;
- public static final int LOAD_FILE = 1002;
- public static final int LOST_FOCUS = 1005;
- public static final int MOUSE_DOWN = 501;
- public static final int MOUSE_DRAG = 506;
- public static final int MOUSE_ENTER = 504;
- public static final int MOUSE_EXIT = 505;
- public static final int MOUSE_MOVE = 503;
- public static final int MOUSE_UP = 502;
- public static final int NUM_LOCK = 1023;
- public static final int PAUSE = 1024;
- public static final int PGDN = 1003;
- public static final int PGUP = 1002;
- public static final int PRINT_SCREEN = 1020;
- public static final int RIGHT = 1007;
- public static final int SAVE_FILE = 1003;
- public static final int SCROLL_ABSOLUTE = 605;
- public static final int SCROLL_BEGIN = 606;
- public static final int SCROLL_END = 607;
- public static final int SCROLL_LINE_DOWN = 602;
- public static final int SCROLL_LINE_UP = 601;
- public static final int SCROLL_LOCK = 1021;
- public static final int SCROLL_PAGE_DOWN = 604;
- public static final int SCROLL_PAGE_UP = 603;
- public static final int TAB = 9;
- public static final int UP = 1004;
- public static final int WINDOW_DEICONIFY = 204;
- public static final int WINDOW_DESTROY = 201;
- public static final int WINDOW_EXPOSE = 202;
- public static final int WINDOW_ICONIFY = 203;
- public static final int WINDOW_MOVED = 205;
-
- public Object arg;
- public int clickCount;
- boolean consumed; // Required by serialization spec.
- public Event evt;
- public int id;
- public int key;
- public int modifiers;
- public Object target;
- public long when;
- public int x;
- public int y;
-
- public Event (Object target, int id, Object arg)
- {
- this.id = id;
- this.target = target;
- this.arg = arg;
- }
-
- public Event (Object target, long when, int id, int x, int y, int key,
- int modifiers)
- {
- this.target = target;
- this.when = when;
- this.id = id;
- this.x = x;
- this.y = y;
- this.key = key;
- this.modifiers = modifiers;
- }
-
- public Event (Object target, long when, int id, int x, int y, int key,
- int modifiers, Object arg)
- {
- this (target, when, id, x, y, key, modifiers);
- this.arg = arg;
- }
-
- public boolean controlDown ()
- {
- return ((modifiers & CTRL_MASK) == 0 ? false : true);
- }
-
- public boolean metaDown ()
- {
- return ((modifiers & META_MASK) == 0 ? false : true);
- }
-
- protected String paramString ()
- {
- return "id=" + id + ",x=" + x + ",y=" + y
- + ",target=" + target + ",arg=" + arg;
- }
-
- public boolean shiftDown()
- {
- return ((modifiers & SHIFT_MASK) == 0 ? false : true);
- }
-
- public String toString()
- {
- return getClass().getName() + "[" + paramString() + "]";
- }
-
- public void translate (int x, int y)
- {
- this.x += x;
- this.y += y;
- }
-}
diff --git a/libjava/java/awt/EventDispatchThread.java b/libjava/java/awt/EventDispatchThread.java
deleted file mode 100644
index a64cdae8567..00000000000
--- a/libjava/java/awt/EventDispatchThread.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* EventDispatchThread.java -
- Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt;
-
-/**
- * @author Bryce McKinlay
- * @status believed complete, but untested.
- */
-class EventDispatchThread extends Thread
-{
- private static int dispatchThreadNum;
-
- private EventQueue queue;
-
- EventDispatchThread(EventQueue queue)
- {
- super();
- setName("AWT-EventQueue-" + ++dispatchThreadNum);
- this.queue = queue;
- setPriority(NORM_PRIORITY + 1);
- }
-
- public void run()
- {
- while (true)
- {
- try
- {
- AWTEvent evt = queue.getNextEvent();
-
- KeyboardFocusManager manager;
- manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- // Try to dispatch this event to the current keyboard focus
- // manager. It will dispatch all FocusEvents, all
- // WindowEvents related to focus, and all KeyEvents,
- // returning true. Otherwise, it returns false and we
- // dispatch the event normally.
- if (!manager.dispatchEvent (evt))
- queue.dispatchEvent(evt);
- }
- catch (ThreadDeath death)
- {
- // If someone wants to kill us, let them.
- return;
- }
- catch (InterruptedException ie)
- {
- // We are interrupted when we should finish executing
- return;
- }
- catch (Throwable x)
- {
- System.err.println("Exception during event dispatch:");
- x.printStackTrace(System.err);
- }
- }
- }
-}
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java
deleted file mode 100644
index f5b67f3a999..00000000000
--- a/libjava/java/awt/EventQueue.java
+++ /dev/null
@@ -1,551 +0,0 @@
-/* EventQueue.java --
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import gnu.java.awt.ClasspathToolkit;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.InvocationEvent;
-import java.awt.event.WindowEvent;
-import java.lang.reflect.InvocationTargetException;
-import java.util.EmptyStackException;
-
-/* Written using on-line Java 2 Platform Standard Edition v1.3 API
- * Specification, as well as "The Java Class Libraries", 2nd edition
- * (Addison-Wesley, 1998).
- * Status: Believed complete, but untested.
- */
-
-/**
- * This class manages a queue of AWTEvent
objects that
- * are posted to it. The AWT system uses only one event queue for all
- * events.
- *
- * @author Bryce McKinlay
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class EventQueue
-{
- private static final int INITIAL_QUEUE_DEPTH = 8;
- private AWTEvent[] queue = new AWTEvent[INITIAL_QUEUE_DEPTH];
-
- private int next_in = 0; // Index where next event will be added to queue
- private int next_out = 0; // Index of next event to be removed from queue
-
- private EventQueue next;
- private EventQueue prev;
- private AWTEvent currentEvent;
- private long lastWhen = System.currentTimeMillis();
-
- private EventDispatchThread dispatchThread = new EventDispatchThread(this);
- private boolean shutdown = false;
-
- private long lastNativeQueueAccess = 0;
- private long humanLatencyThreshold = 100;
-
- synchronized void setShutdown (boolean b)
- {
- shutdown = b;
- }
-
- synchronized boolean isShutdown ()
- {
- if (shutdown)
- return true;
-
- // This is the exact self-shutdown condition specified in J2SE:
- // http://java.sun.com/j2se/1.4.2/docs/api/java/awt/doc-files/AWTThreadIssues.html
-
- if (peekEvent() == null
- && ((ClasspathToolkit) Toolkit.getDefaultToolkit()).nativeQueueEmpty())
- {
- Frame[] frames = Frame.getFrames();
- for (int i = 0; i < frames.length; ++i)
- if (frames[i].isDisplayable())
- return false;
- return true;
- }
- return false;
- }
-
- /**
- * Initializes a new instance of EventQueue
.
- */
- public EventQueue()
- {
- }
-
- /**
- * Returns the next event in the queue. This method will block until
- * an event is available or until the thread is interrupted.
- *
- * @return The next event in the queue.
- *
- * @exception InterruptedException If this thread is interrupted while
- * waiting for an event to be posted to the queue.
- */
- public synchronized AWTEvent getNextEvent()
- throws InterruptedException
- {
- if (next != null)
- return next.getNextEvent();
-
- ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit());
- long curr = System.currentTimeMillis();
-
- if (! tk.nativeQueueEmpty() &&
- (curr - lastNativeQueueAccess > humanLatencyThreshold))
- {
- tk.iterateNativeQueue(this, false);
- lastNativeQueueAccess = curr;
- }
-
- while (next_in == next_out)
- {
- // Only the EventDispatchThread associated with the top of the stack is
- // allowed to get events from the native source; everyone else just
- // waits on the head of the queue.
-
- if (isDispatchThread())
- {
- // We are not allowed to return null from this method, yet it
- // is possible that we actually have run out of native events
- // in the enclosing while() loop, and none of the native events
- // happened to cause AWT events. We therefore ought to check
- // the isShutdown() condition here, before risking a "native
- // wait". If we check it before entering this function we may
- // wait forever for events after the shutdown condition has
- // arisen.
-
- if (isShutdown())
- throw new InterruptedException();
-
- tk.iterateNativeQueue(this, true);
- lastNativeQueueAccess = System.currentTimeMillis();
- }
- else
- {
- try
- {
- wait();
- }
- catch (InterruptedException ie)
- {
- }
- }
- }
-
- AWTEvent res = queue[next_out];
-
- if (++next_out == queue.length)
- next_out = 0;
- return res;
- }
-
- /**
- * Returns the next event in the queue without removing it from the queue.
- * This method will block until an event is available or until the thread
- * is interrupted.
- *
- * @return The next event in the queue.
- * @specnote Does not block. Returns null if there are no events on the
- * queue.
- */
- public synchronized AWTEvent peekEvent()
- {
- if (next != null)
- return next.peekEvent();
-
- if (next_in != next_out)
- return queue[next_out];
- else
- return null;
- }
-
- /**
- * Returns the next event in the queue that has the specified id
- * without removing it from the queue.
- * This method will block until an event is available or until the thread
- * is interrupted.
- *
- * @param id The event id to return.
- *
- * @return The next event in the queue.
- *
- * @specnote Does not block. Returns null if there are no matching events
- * on the queue.
- */
- public synchronized AWTEvent peekEvent(int id)
- {
- if (next != null)
- return next.peekEvent(id);
-
- int i = next_out;
- while (i != next_in)
- {
- AWTEvent qevt = queue[i];
- if (qevt.id == id)
- return qevt;
- }
- return null;
- }
-
- /**
- * Posts a new event to the queue.
- *
- * @param evt The event to post to the queue.
- *
- * @exception NullPointerException If event is null.
- */
- public synchronized void postEvent(AWTEvent evt)
- {
- if (evt == null)
- throw new NullPointerException();
-
- if (next != null)
- {
- next.postEvent(evt);
- return;
- }
-
- /* Check for any events already on the queue with the same source
- and ID. */
- int i = next_out;
- while (i != next_in)
- {
- AWTEvent qevt = queue[i];
- Object src;
- if (qevt.id == evt.id
- && (src = qevt.getSource()) == evt.getSource()
- && src instanceof Component)
- {
- /* If there are, call coalesceEvents on the source component
- to see if they can be combined. */
- Component srccmp = (Component) src;
- AWTEvent coalesced_evt = srccmp.coalesceEvents(qevt, evt);
- if (coalesced_evt != null)
- {
- /* Yes. Replace the existing event with the combined event. */
- queue[i] = coalesced_evt;
- return;
- }
- break;
- }
- if (++i == queue.length)
- i = 0;
- }
-
- queue[next_in] = evt;
- if (++next_in == queue.length)
- next_in = 0;
-
- if (next_in == next_out)
- {
- /* Queue is full. Extend it. */
- AWTEvent[] oldQueue = queue;
- queue = new AWTEvent[queue.length * 2];
-
- int len = oldQueue.length - next_out;
- System.arraycopy(oldQueue, next_out, queue, 0, len);
- if (next_out != 0)
- System.arraycopy(oldQueue, 0, queue, len, next_out);
-
- next_out = 0;
- next_in = oldQueue.length;
- }
-
- if (dispatchThread == null || !dispatchThread.isAlive())
- {
- dispatchThread = new EventDispatchThread(this);
- dispatchThread.start();
- }
-
- // Window events might represent the closing of a window, which
- // might cause the end of the dispatch thread's life, so we'll wake
- // it up here to give it a chance to check for shutdown.
-
- if (!isDispatchThread()
- || (evt.getID() == WindowEvent.WINDOW_CLOSED)
- || (evt.getID() == WindowEvent.WINDOW_CLOSING))
- ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
-
- notify();
- }
-
- /**
- * Causes runnable to have its run method called in the dispatch thread of the
- * EventQueue. This will happen after all pending events are processed. The
- * call blocks until this has happened. This method will throw an Error if
- * called from the event dispatcher thread.
- *
- * @exception InterruptedException If another thread has interrupted
- * this thread.
- * @exception InvocationTargetException If an exception is thrown when running
- * runnable.
- *
- * @since 1.2
- */
- public static void invokeAndWait(Runnable runnable)
- throws InterruptedException, InvocationTargetException
- {
- if (isDispatchThread ())
- throw new Error("Can't call invokeAndWait from event dispatch thread");
-
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
- Thread current = Thread.currentThread();
-
- InvocationEvent ie =
- new InvocationEvent(eq, runnable, current, true);
-
- synchronized (current)
- {
- eq.postEvent(ie);
- current.wait();
- }
-
- Exception exception;
-
- if ((exception = ie.getException()) != null)
- throw new InvocationTargetException(exception);
- }
-
- /**
- * This arranges for runnable to have its run method called in the
- * dispatch thread of the EventQueue. This will happen after all
- * pending events are processed.
- *
- * @since 1.2
- */
- public static void invokeLater(Runnable runnable)
- {
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
-
- InvocationEvent ie =
- new InvocationEvent(eq, runnable, null, false);
-
- eq.postEvent(ie);
- }
-
- /**
- * Return true if the current thread is the current AWT event dispatch
- * thread.
- */
- public static boolean isDispatchThread()
- {
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
-
- /* Find last EventQueue in chain */
- while (eq.next != null)
- eq = eq.next;
-
- return (Thread.currentThread() == eq.dispatchThread);
- }
-
- /**
- * Return the event currently being dispatched by the event
- * dispatch thread. If the current thread is not the event
- * dispatch thread, this method returns null.
- *
- * @since 1.4
- */
- public static AWTEvent getCurrentEvent()
- {
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
- Thread ct = Thread.currentThread();
-
- /* Find out if this thread is the dispatch thread for any of the
- EventQueues in the chain */
- while (ct != eq.dispatchThread)
- {
- // Try next EventQueue, if any
- if (eq.next == null)
- return null; // Not an event dispatch thread
- eq = eq.next;
- }
-
- return eq.currentEvent;
- }
-
- /**
- * Allows a custom EventQueue implementation to replace this one.
- * All pending events are transferred to the new queue. Calls to postEvent,
- * getNextEvent, and peekEvent and others are forwarded to the pushed queue
- * until it is removed with a pop().
- *
- * @exception NullPointerException if newEventQueue is null.
- */
- public synchronized void push(EventQueue newEventQueue)
- {
- if (newEventQueue == null)
- throw new NullPointerException ();
-
- /* Make sure we are at the top of the stack because callers can
- only get a reference to the one at the bottom using
- Toolkit.getDefaultToolkit().getSystemEventQueue() */
- if (next != null)
- {
- next.push (newEventQueue);
- return;
- }
-
- /* Make sure we have a live dispatch thread to drive the queue */
- if (dispatchThread == null)
- dispatchThread = new EventDispatchThread(this);
-
- int i = next_out;
- while (i != next_in)
- {
- newEventQueue.postEvent(queue[i]);
- next_out = i;
- if (++i == queue.length)
- i = 0;
- }
-
- next = newEventQueue;
- newEventQueue.prev = this;
- }
-
- /** Transfer any pending events from this queue back to the parent queue that
- * was previously push()ed. Event dispatch from this queue is suspended.
- *
- * @exception EmptyStackException If no previous push was made on this
- * EventQueue.
- */
- protected void pop() throws EmptyStackException
- {
- if (prev == null)
- throw new EmptyStackException();
-
- /* The order is important here, we must get the prev lock first,
- or deadlock could occur as callers usually get here following
- prev's next pointer, and thus obtain prev's lock before trying
- to get this lock. */
- synchronized (prev)
- {
- prev.next = next;
- if (next != null)
- next.prev = prev;
-
- synchronized (this)
- {
- int i = next_out;
- while (i != next_in)
- {
- prev.postEvent(queue[i]);
- next_out = i;
- if (++i == queue.length)
- i = 0;
- }
- // Empty the queue so it can be reused
- next_in = 0;
- next_out = 0;
-
- ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();
- setShutdown(true);
- dispatchThread = null;
- this.notifyAll();
- }
- }
- }
-
- /**
- * Dispatches an event. The manner in which the event is dispatched depends
- * upon the type of the event and the type of the event's source object.
- *
- * @exception NullPointerException If event is null.
- */
- protected void dispatchEvent(AWTEvent evt)
- {
- currentEvent = evt;
-
- if (evt instanceof InputEvent)
- lastWhen = ((InputEvent) evt).getWhen();
- else if (evt instanceof ActionEvent)
- lastWhen = ((ActionEvent) evt).getWhen();
- else if (evt instanceof InvocationEvent)
- lastWhen = ((InvocationEvent) evt).getWhen();
-
- if (evt instanceof ActiveEvent)
- {
- ActiveEvent active_evt = (ActiveEvent) evt;
- active_evt.dispatch();
- }
- else
- {
- Object source = evt.getSource();
-
- if (source instanceof Component)
- {
- Component srccmp = (Component) source;
- srccmp.dispatchEvent(evt);
- }
- else if (source instanceof MenuComponent)
- {
- MenuComponent srccmp = (MenuComponent) source;
- srccmp.dispatchEvent(evt);
- }
- }
- }
-
- /**
- * Returns the timestamp of the most recent event that had a timestamp, or
- * the initialization time of the event queue if no events have been fired.
- * At present, only InputEvent
s, ActionEvent
s,
- * InputMethodEvent
s, and InvocationEvent
s have
- * timestamps, but this may be added to other events in future versions.
- * If this is called by the event dispatching thread, it can be any
- * (sequential) value, but to other threads, the safest bet is to return
- * System.currentTimeMillis().
- *
- * @return the most recent timestamp
- * @see InputEvent#getWhen()
- * @see ActionEvent#getWhen()
- * @see InvocationEvent#getWhen()
- * @see InputMethodEvent#getWhen()
- * @since 1.4
- */
- public static long getMostRecentEventTime()
- {
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
- if (Thread.currentThread() != eq.dispatchThread)
- return System.currentTimeMillis();
- return eq.lastWhen;
- }
-}
diff --git a/libjava/java/awt/FileDialog.java b/libjava/java/awt/FileDialog.java
deleted file mode 100644
index 7f2723e7e9a..00000000000
--- a/libjava/java/awt/FileDialog.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/* FileDialog.java -- A filename selection dialog box
- Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.peer.FileDialogPeer;
-import java.io.FilenameFilter;
-import java.io.Serializable;
-
-/**
- * This class implements a file selection dialog box widget.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@redhat.com)
- */
-public class FileDialog extends Dialog implements Serializable
-{
-
-/*
- * Static Variables
- */
-
-/**
- * Indicates that the purpose of the dialog is for opening a file.
- */
-public static final int LOAD = 0;
-
-/**
- * Indicates that the purpose of the dialog is for saving a file.
- */
-public static final int SAVE = 1;
-
-// Serialization constant
-private static final long serialVersionUID = 5035145889651310422L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The directory for this file dialog.
- */
-private String dir;
-
-/**
- * @serial The filename for this file dialog
- */
-private String file;
-
-/**
- * @serial The filter for selecting filenames to display
- */
-private FilenameFilter filter;
-
-/**
- * @serial The mode of this dialog, either LOAD
or
- * SAVE
.
- */
-private int mode;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of FileDialog
with the
- * specified parent. This dialog will have no title and will be for
- * loading a file.
- *
- * @param parent The parent frame for this dialog.
- */
-public
-FileDialog(Frame parent)
-{
- this(parent, "", LOAD);
-}
-
-/*************************************************************************/
-
-/**
- * Initialized a new instance of FileDialog
with the
- * specified parent and title. This dialog will be for opening a file.
- *
- * @param parent The parent frame for this dialog.
- * @param title The title for this dialog.
- */
-public
-FileDialog(Frame parent, String title)
-{
- this(parent, title, LOAD);
-}
-
-/*************************************************************************/
-
-/**
- * Initialized a new instance of FileDialog
with the
- * specified parent, title, and mode.
- *
- * @param parent The parent frame for this dialog.
- * @param title The title for this dialog.
- * @param mode The mode of the dialog, either LOAD
or
- * SAVE
.
- *
- * @exception IllegalArgumentException If an illegal file dialog mode
- * is supplied.
- */
-public
-FileDialog(Frame parent, String title, int mode)
-{
- super(parent, title, true);
-
- if ((mode != LOAD) && (mode != SAVE))
- throw new IllegalArgumentException (
- "Mode argument must be either LOAD or SAVE");
-
- setMode (mode);
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the mode of this dialog, either LOAD
or
- * SAVE
.
- *
- * @return The mode of this dialog.
- */
-public int
-getMode()
-{
- return(mode);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the mode of this dialog to either LOAD
or
- * SAVE
. This method is only effective before the native
- * peer is created.
- *
- * @param mode The new mode of this file dialog.
- *
- * @exception IllegalArgumentException If an illegal file dialog mode
- * is supplied.
- */
-public void
-setMode(int mode)
-{
- if ((mode != LOAD) && (mode != SAVE))
- throw new IllegalArgumentException("Bad mode: " + mode);
-
- this.mode = mode;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the directory for this file dialog.
- *
- * @return The directory for this file dialog.
- */
-public String
-getDirectory()
-{
- return(dir);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the directory for this file dialog.
- *
- * @param dir The new directory for this file dialog.
- */
-public synchronized void
-setDirectory(String dir)
-{
- this.dir = dir;
- if (peer != null)
- {
- FileDialogPeer f = (FileDialogPeer) peer;
- f.setDirectory (dir);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns the file that is selected in this dialog.
- *
- * @return The file that is selected in this dialog.
- */
-public String
-getFile()
-{
- return(file);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the selected file for this dialog.
- *
- * @param file The selected file for this dialog.
- */
-public synchronized void
-setFile(String file)
-{
- this.file = file;
- if (peer != null)
- {
- FileDialogPeer f = (FileDialogPeer) peer;
- f.setFile (file);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns the filename filter being used by this dialog.
- *
- * @return The filename filter being used by this dialog.
- */
-public FilenameFilter
-getFilenameFilter()
-{
- return(filter);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the filename filter used by this dialog.
- *
- * @param filter The new filename filter for this file dialog box.
- */
-public synchronized void
-setFilenameFilter(FilenameFilter filter)
-{
- this.filter = filter;
- if (peer != null)
- {
- FileDialogPeer f = (FileDialogPeer) peer;
- f.setFilenameFilter (filter);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Creates the native peer for this file dialog box.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createFileDialog (this);
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
-protected String
-paramString()
-{
- return ("dir=" + dir + ",file=" + file +
- ",mode=" + mode + "," + super.paramString());
-}
-
-} // class FileDialog
-
diff --git a/libjava/java/awt/FlowLayout.java b/libjava/java/awt/FlowLayout.java
deleted file mode 100644
index 4674990ac52..00000000000
--- a/libjava/java/awt/FlowLayout.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/* FlowLayout.java -- Grid-based layout engine
- Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-
-/** This class implements a flow-based layout. Components are laid
- * out in order from left to right. When a component cannot be placed
- * without horizontal clipping, a new row is started. This class
- * supports horizontal and vertical gaps. These are used for spacing
- * between components.
- *
- * @author Tom Tromey (tromey@redhat.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class FlowLayout implements LayoutManager, Serializable
-{
- /** Constant that specifies left alignment. */
- public static final int LEFT = 0;
- /** Constant that specifies center alignment. */
- public static final int CENTER = 1;
- /** Constant that specifies right alignment. */
- public static final int RIGHT = 2;
-
- /** Constant that specifies alignment to leading edge of container's
- * orientation. */
- public static final int LEADING = 3;
- /** Constant that specifies alignment to trailing edge of container's
- * orientation. */
- public static final int TRAILING = 4;
-
- // Serialization constant
- private static final long serialVersionUID = -7262534875583282631L;
-
- /**
- * Add a new component to the layout. This particular implementation
- * does nothing.
- *
- * @param name the name
- * @param comp the component
- */
- public void addLayoutComponent (String name, Component comp)
- {
- // Nothing.
- }
-
- /**
- * Returns the current justification value for this object.
- *
- * @return The current justification value for this object.
- */
- public int getAlignment ()
- {
- return align;
- }
-
- /**
- * Returns the horizontal gap between components.
- *
- * @return The horizontal gap between components.
- */
- public int getHgap ()
- {
- return hgap;
- }
-
- /**
- * Returns the vertical gap between lines of components.
- *
- * @return The vertical gap between lines of components.
- */
- public int getVgap ()
- {
- return vgap;
- }
-
- /**
- * Initializes a new instance of FlowLayout
with a center
- * justification and a default horizontal and vertical gap of 5.
- */
- public FlowLayout ()
- {
- this (CENTER, 5, 5);
- }
-
- /**
- * Initializes a new instance of FlowLayout
with the specified
- * justification and a default horizontal and vertical gap of 5.
- *
- * @param align The justification setting, which should be one of the
- * contants in this class.
- */
- public FlowLayout (int align)
- {
- this (align, 5, 5);
- }
-
- /**
- * Initializes a new instance of FlowLayout
with the specified
- * justification and gap values
- * @param align Alignment
- * @param hgap The horizontal gap
- * @param vgap The vertical gap
- * @exception IllegalArgumentException If either gap is negative
- */
- public FlowLayout (int align, int hgap, int vgap)
- {
- // Use methods to set fields so that we can have all the checking
- // in one place.
- setVgap (vgap);
- setHgap (hgap);
- setAlignment (align);
- }
-
- /** Lay out the container's components based on current settings.
- * @param parent The parent container
- */
- public void layoutContainer (Container parent)
- {
- synchronized (parent.getTreeLock ())
- {
- int num = parent.getComponentCount ();
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- Dimension d = parent.getSize ();
- Insets ins = parent.getInsets ();
-
- ComponentOrientation orient = parent.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- int y = ins.top + vgap;
- int i = 0;
- while (i < num)
- {
- // Find the components which go in the current row.
- int new_w = ins.left + hgap + ins.right;
- int new_h = 0;
- int j;
- boolean found_one = false;
- for (j = i; j < num; ++j)
- {
- // Skip invisible items.
- if (! comps[j].visible)
- continue;
-
- Dimension c = comps[j].getPreferredSize ();
-
- int next_w = new_w + hgap + c.width;
- if (next_w <= d.width || ! found_one)
- {
- new_w = next_w;
- new_h = Math.max (new_h, c.height);
- found_one = true;
- }
- else
- {
- // Must start a new row, and we already found an item
- break;
- }
- }
-
- // Set the location of each component for this row.
- int x;
-
- int myalign = align;
- if (align == LEADING)
- myalign = left_to_right ? LEFT : RIGHT;
- else if (align == TRAILING)
- myalign = left_to_right ? RIGHT : LEFT;
-
- if (myalign == LEFT)
- x = ins.left + hgap;
- else if (myalign == CENTER)
- x = ins.left + (d.width - new_w) / 2 + hgap;
- else
- x = ins.left + (d.width - new_w) + hgap;
-
- for (int k = i; k < j; ++k)
- {
- if (comps[k].visible)
- {
- Dimension c = comps[k].getPreferredSize ();
- comps[k].setBounds (x, y + (new_h - c.height) / 2,
- c.width, c.height);
- x += c.width + hgap;
- }
- }
-
- // Advance to next row.
- i = j;
- y += new_h + vgap;
- }
- }
- }
-
- /**
- * Returns the minimum layout size for the specified container using
- * this layout.
- * @param cont The parent container
- * @return The minimum layout size.
- */
- public Dimension minimumLayoutSize (Container cont)
- {
- return getSize (cont, true);
- }
-
- /**
- * Returns the preferred layout size for the specified container using
- * this layout.
- * @param cont The parent container
- * @return The preferred layout size.
- */
- public Dimension preferredLayoutSize (Container cont)
- {
- return getSize (cont, false);
- }
-
- /** Remove the indicated component from this layout manager.
- * This particular implementation does nothing.
- * @param comp The component to remove
- */
- public void removeLayoutComponent (Component comp)
- {
- // Nothing.
- }
-
- /**
- * Sets the justification value for this object to the specified value.
- *
- * @param align The new justification value for this object, which must
- * be one of the constants in this class.
- */
- public void setAlignment (int align)
- {
- if (align != LEFT && align != RIGHT && align != CENTER
- && align != LEADING && align != TRAILING)
- throw new IllegalArgumentException ("invalid alignment: " + align);
- this.align = align;
- }
-
- /**
- * Sets the horizontal gap between components to the specified value.
- *
- * @param hgap The new horizontal gap between components.
- */
- public void setHgap (int hgap)
- {
- if (hgap < 0)
- throw new IllegalArgumentException ("horizontal gap must be nonnegative");
- this.hgap = hgap;
- }
-
- /**
- * Sets the vertical gap between lines of components to the specified value.
- *
- * @param vgap The new vertical gap.
- */
- public void setVgap (int vgap)
- {
- if (vgap < 0)
- throw new IllegalArgumentException ("vertical gap must be nonnegative");
- this.vgap = vgap;
- }
-
- /** Return String description of this object.
- * @return A string representation of this object.
- */
- public String toString ()
- {
- return ("[" + getClass ().getName () + ",hgap=" + hgap + ",vgap=" + vgap
- + ",align=" + align + "]");
- }
-
- // This method is used to compute the various sizes.
- private Dimension getSize (Container parent, boolean is_min)
- {
- synchronized (parent.getTreeLock ())
- {
- int w, h, num = parent.getComponentCount ();
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- w = 0;
- h = 0;
- for (int i = 0; i < num; ++i)
- {
- if (! comps[i].visible)
- continue;
-
- // FIXME: can we just directly read the fields in Component?
- // Or will that not work with subclassing?
- Dimension d;
-
- if (is_min)
- d = comps[i].getMinimumSize ();
- else
- d = comps[i].getPreferredSize ();
-
- w += d.width;
- h = Math.max (d.height, h);
- }
-
- Insets ins = parent.getInsets ();
-
- w += (num + 1) * hgap + ins.left + ins.right;
- h += 2 * vgap + ins.top + ins.bottom;
-
- return new Dimension (w, h);
- }
- }
-
- /**
- * @serial The justification alignment of the lines of components, which
- * will be one of the constants defined in this class.
- */
- private int align;
-
- /**
- * @serial The horizontal gap between components.
- */
- private int hgap;
-
- /**
- * @serial The vertical gap between lines of components.
- */
- private int vgap;
-}
diff --git a/libjava/java/awt/FocusTraversalPolicy.java b/libjava/java/awt/FocusTraversalPolicy.java
deleted file mode 100644
index a7f1558dde9..00000000000
--- a/libjava/java/awt/FocusTraversalPolicy.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/* FocusTraversalPolicy.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * @since 1.4
- */
-public abstract class FocusTraversalPolicy
-{
- /**
- * Creates a FocusTraversalPolicy
object.
- */
- public FocusTraversalPolicy()
- {
- // Do nothing in here.
- }
-
- /**
- * Returns the Component that should receive the focus after a Component.
- *
- * @exception IllegalArgumentException If root or current is null,
- * or if root is not a focus cycle root of current.
- */
- public abstract Component getComponentAfter(Container root,
- Component current);
-
- /**
- * Returns the Component that should receive the focus before a Component.
- *
- * @exception IllegalArgumentException If root or current is null,
- * or if root is not a focus cycle root of current.
- */
- public abstract Component getComponentBefore(Container root,
- Component current);
-
- /**
- * Returns the first Component in the traversal cycle.
- *
- * @exception IllegalArgumentException If root is null.
- */
- public abstract Component getFirstComponent(Container root);
-
- /**
- * Returns the last Component in the traversal cycle.
- *
- * @exception IllegalArgumentException If root is null.
- */
- public abstract Component getLastComponent(Container root);
-
- /**
- * Returns the default Component to focus.
- *
- * @exception IllegalArgumentException If root is null.
- */
- public abstract Component getDefaultComponent(Container root);
-
- /**
- * Returns the Component that should receive the focus when a Window is made
- * visible for the first time.
- *
- * @exception IllegalArgumentException If window is null.
- */
- public Component getInitialComponent(Window window)
- {
- return getDefaultComponent(window);
- }
-} // class FocusTraversalPolicy
diff --git a/libjava/java/awt/Font.java b/libjava/java/awt/Font.java
deleted file mode 100644
index f6833484474..00000000000
--- a/libjava/java/awt/Font.java
+++ /dev/null
@@ -1,1335 +0,0 @@
-/* Font.java -- Font object
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import gnu.java.awt.ClasspathToolkit;
-import gnu.java.awt.peer.ClasspathFontPeer;
-
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphVector;
-import java.awt.font.LineMetrics;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-import java.awt.peer.FontPeer;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.text.AttributedCharacterIterator;
-import java.text.CharacterIterator;
-import java.text.StringCharacterIterator;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * This class represents a windowing system font.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Graydon Hoare (graydon@redhat.com)
- */
-public class Font implements Serializable
-{
-
-/*
- * Static Variables
- */
-
-/**
- * Constant indicating a "plain" font.
- */
-public static final int PLAIN = 0;
-
-/**
- * Constant indicating a "bold" font.
- */
-public static final int BOLD = 1;
-
-/**
- * Constant indicating an "italic" font.
- */
-public static final int ITALIC = 2;
-
-/**
- * Constant indicating the baseline mode characteristic of Roman.
- */
-public static final int ROMAN_BASELINE = 0;
-
-/**
- * Constant indicating the baseline mode characteristic of Chinese.
- */
-public static final int CENTER_BASELINE = 1;
-
-/**
- * Constant indicating the baseline mode characteristic of Devanigri.
- */
-public static final int HANGING_BASELINE = 2;
-
-
- /**
- * Indicates to createFont
that the supplied font data
- * is in TrueType format.
- *
- * layoutGlyphVector
, indicating that the
- * orientation of a text run is from left to right.
- *
- * @since 1.4
- */
- public static final int LAYOUT_LEFT_TO_RIGHT = 0;
-
-
- /**
- * A flag for layoutGlyphVector
, indicating that the
- * orientation of a text run is from right to left.
- *
- * @since 1.4
- */
- public static final int LAYOUT_RIGHT_TO_LEFT = 1;
-
-
- /**
- * A flag for layoutGlyphVector
, indicating that the
- * text does not contain valid characters before the
- * start
position. If this flag is set,
- * layoutGlyphVector
does not examine the text before
- * start
, even if this would be necessary to select the
- * correct glyphs (e.g., for Arabic text).
- *
- * @since 1.4
- */
- public static final int LAYOUT_NO_START_CONTEXT = 2;
-
-
- /**
- * A flag for layoutGlyphVector
, indicating that the
- * text does not contain valid characters after the
- * limit
position. If this flag is set,
- * layoutGlyphVector
does not examine the text after
- * limit
, even if this would be necessary to select the
- * correct glyphs (e.g., for Arabic text).
- *
- * @since 1.4
- */
- public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
-
- /**
- * The logical name of this font.
- *
- * @since 1.0
- */
- protected String name;
-
- /**
- * The size of this font in pixels.
- *
- * @since 1.0
- */
- protected int size;
-
- /**
- * The style of this font -- PLAIN, BOLD, ITALIC or BOLD+ITALIC.
- *
- * @since 1.0
- */
- protected int style;
-
-// Serialization constant
-private static final long serialVersionUID = -4206021311591459213L;
-
-
- // The ClasspathToolkit-provided peer which implements this font
- private ClasspathFontPeer peer;
-
-/*************************************************************************/
-
-/*
- * Static Methods
- */
-
-/**
- * Creates a Font
object from the specified string, which
- * is in one of the following formats:
- *
- *
- * null
- * permitted, interpreted as 'Dialog-PLAIN-12').
- *
- * @return A font.
- */
- public static Font decode (String fontspec)
-{
- if (fontspec == null)
- fontspec = "Dialog-PLAIN-12";
- String name = null;
- int style = PLAIN;
- int size = 12;
-
- StringTokenizer st = new StringTokenizer(fontspec, "- ");
- while (st.hasMoreTokens())
- {
- String token = st.nextToken();
- if (name == null)
- {
- name = token;
- continue;
- }
-
- if (token.toUpperCase().equals("BOLD"))
- {
- style = BOLD;
- continue;
- }
- if (token.toUpperCase().equals("ITALIC"))
- {
- style = ITALIC;
- continue;
- }
- if (token.toUpperCase().equals("BOLDITALIC"))
- {
- style = BOLD | ITALIC;
- continue;
- }
-
- int tokenval = 0;
- try
- {
- tokenval = Integer.parseInt(token);
- }
- catch(NumberFormatException e)
- {
- // Ignored.
- }
-
- if (tokenval != 0)
- size = tokenval;
- }
-
- HashMap attrs = new HashMap();
- ClasspathFontPeer.copyStyleToAttrs (style, attrs);
- ClasspathFontPeer.copySizeToAttrs (size, attrs);
-
- return getFontFromToolkit (name, attrs);
-}
-
- /* These methods delegate to the toolkit. */
-
- protected static ClasspathToolkit tk ()
- {
- return (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
- }
-
- /* Every factory method in Font should eventually call this. */
- protected static Font getFontFromToolkit (String name, Map attribs)
- {
- return tk ().getFont (name, attribs);
- }
-
- /* Every Font constructor should eventually call this. */
- protected static ClasspathFontPeer getPeerFromToolkit (String name, Map attrs)
- {
- return tk ().getClasspathFontPeer (name, attrs);
- }
-
-
-/*************************************************************************/
-
-/**
- * Returns a Font
object from the passed property name.
- *
- * @param propname The name of the system property.
- * @param defval Value to use if the property is not found.
- *
- * @return The requested font, or default
if the property
- * not exist or is malformed.
- */
- public static Font getFont (String propname, Font defval)
-{
- String propval = System.getProperty(propname);
- if (propval != null)
- return decode (propval);
- return defval;
-}
-
-/*************************************************************************/
-
-/**
- * Returns a Font
object from the passed property name.
- *
- * @param propname The name of the system property.
- *
- * @return The requested font, or null
if the property
- * not exist or is malformed.
- */
- public static Font getFont (String propname)
-{
- return getFont (propname, (Font)null);
-}
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of Font
with the specified
- * attributes.
- *
- * @param name The name of the font.
- * @param style The font style.
- * @param size The font point size.
- */
-
- public Font (String name, int style, int size)
- {
- HashMap attrs = new HashMap();
- ClasspathFontPeer.copyStyleToAttrs (style, attrs);
- ClasspathFontPeer.copySizeToAttrs (size, attrs);
- this.peer = getPeerFromToolkit (name, attrs);
- }
-
- public Font (Map attrs)
- {
- this(null, attrs);
- }
-
- /* This extra constructor is here to permit ClasspathToolkit and to build
- a font with a "logical name" as well as attrs. */
- public Font (String name, Map attrs)
- {
- // If attrs is null, setting it to an empty HashMap will give this
- // Font default attributes.
- if (attrs == null)
- attrs = new HashMap();
- this.peer = getPeerFromToolkit (name, attrs);
- }
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the logical name of the font. A logical name is the name the
- * font was constructed with. It may be the name of a logical font (one
- * of 6 required names in all java environments) or it may be a face
- * name.
- *
- * @return The logical name of the font.
- *
- * @see getFamily()
- * @see getFontName()
- */
- public String getName ()
-{
- return peer.getName (this);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the style of the font.
- *
- * @return The font style.
- */
- public int getSize ()
-{
- return (int) peer.getSize (this);
-}
-
- public float getSize2D ()
-{
- return peer.getSize (this);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this is a plain font. This will be true if
- * and only if neither the bold nor the italics style is set.
- *
- * @return true
if this is a plain font, false
- * otherwise.
- */
- public boolean isPlain ()
-{
- return peer.isPlain (this);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this font is bold.
- *
- * @return true
if this font is bold, false
- * otherwise.
- */
- public boolean isBold ()
-{
- return peer.isBold (this);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this font is italic.
- *
- * @return true
if this font is italic, false
- * otherwise.
- */
- public boolean isItalic ()
-{
- return peer.isItalic (this);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the family name of this font. A family name describes a design
- * or "brand name" (such as Helvetica or Palatino). It is less specific
- * than a font face name (such as Helvetica Bold).
- *
- * @return A string containing the font family name.
- *
- * @since 1.2
- *
- * @see getName()
- * @see getFontName()
- * @see GraphicsEnvironment.getAvailableFontFamilyNames()
- */
- public String getFamily ()
-{
- return peer.getFamily (this);
-}
-
-/**
- * Returns integer code representing the sum of style flags of this font, a
- * combination of either {@link PLAIN}, {@link BOLD}, or {@link ITALIC}.
- *
- * @return code representing the style of this font.
- *
- * @see isPlain()
- * @see isBold()
- * @see isItalic()
- */
- public int getStyle ()
-{
- return peer.getStyle (this);
-}
-
-/**
- * Checks if specified character maps to a glyph in this font.
- *
- * @param c The character to check.
- *
- * @return Whether the character has a corresponding glyph in this font.
- *
- * @since 1.2
- */
- public boolean canDisplay (char c)
-{
- return peer.canDisplay (this, c);
-}
-
-/**
- * Checks how much of a given string can be mapped to glyphs in
- * this font.
- *
- * @param s The string to check.
- *
- * @return The index of the first character in s
which cannot
- * be converted to a glyph by this font, or -1
if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- */
- public int canDisplayUpTo (String s)
-{
- return peer.canDisplayUpTo (this, new StringCharacterIterator (s),
- 0, s.length () - 1);
-}
-
-/**
- * Checks how much of a given sequence of text can be mapped to glyphs in
- * this font.
- *
- * @param text Array containing the text to check.
- * @param start Position of first character to check in text
.
- * @param limit Position of last character to check in text
.
- *
- * @return The index of the first character in the indicated range which
- * cannot be converted to a glyph by this font, or -1
if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- *
- * @throws IndexOutOfBoundsException if the range [start, limit] is
- * invalid in text
.
- */
- public int canDisplayUpTo (char[] text, int start, int limit)
-{
- return peer.canDisplayUpTo
- (this, new StringCharacterIterator (new String (text)), start, limit);
-}
-
-/**
- * Checks how much of a given sequence of text can be mapped to glyphs in
- * this font.
- *
- * @param i Iterator over the text to check.
- * @param start Position of first character to check in i
.
- * @param limit Position of last character to check in i
.
- *
- * @return The index of the first character in the indicated range which
- * cannot be converted to a glyph by this font, or -1
if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- *
- * @throws IndexOutOfBoundsException if the range [start, limit] is
- * invalid in i
.
- */
- public int canDisplayUpTo (CharacterIterator i, int start, int limit)
-{
- return peer.canDisplayUpTo (this, i, start, limit);
-}
-
-/**
- * Creates a new font with point size 1 and {@link PLAIN} style,
- * reading font data from the provided input stream. The resulting font
- * can have further fonts derived from it using its
- * deriveFont
method.
- *
- * @param fontFormat Integer code indicating the format the font data is
- * in.Currently this can only be {@link TRUETYPE_FONT}.
- * @param is {@link InputStream} from which font data will be read. This
- * stream is not closed after font data is extracted.
- *
- * @return A new {@link Font} of the format indicated.
- *
- * @throws IllegalArgumentException if fontType
is not
- * recognized.
- * @throws FontFormatException if data in InputStream is not of format
- * indicated.
- * @throws IOException if insufficient data is present on InputStream.
- *
- * @since 1.3
- */
- public static Font createFont (int fontFormat, InputStream is)
- throws FontFormatException, IOException
-{
- return tk().createFont (fontFormat, is);
-}
-
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param str The string to convert to Glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see layoutGlyphVector()
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, String str)
-{
- return peer.createGlyphVector (this, ctx, new StringCharacterIterator (str));
-}
-
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param i Iterator over the text to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see layoutGlyphVector()
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i)
-{
- return peer.createGlyphVector (this, ctx, i);
-}
-
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param chars Array of characters to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see layoutGlyphVector()
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars)
-{
- return peer.createGlyphVector
- (this, ctx, new StringCharacterIterator (new String (chars)));
-}
-
-/**
- * Extracts a sequence of glyphs from a font, returning a new {@link
- * GlyphVector} with a mapped glyph for each input glyph code.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param glyphCodes Array of characters to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see layoutGlyphVector()
- *
- * @specnote This method is documented to perform character-to-glyph
- * conversions, in the Sun documentation, but its second parameter name is
- * "glyphCodes" and it is not clear to me why it would exist if its
- * purpose was to transport character codes inside integers. I assume it
- * is mis-documented in the Sun documentation.
- */
-
- public GlyphVector createGlyphVector (FontRenderContext ctx, int[] glyphCodes)
-{
- return peer.createGlyphVector (this, ctx, glyphCodes);
-}
-
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new size and style.
- *
- * @param style The style of the newly created font.
- * @param size The size of the newly created font.
- *
- * @return A clone of the current font, with the specified size and style.
- *
- * @since 1.2
- */
- public Font deriveFont (int style, float size)
-{
- return peer.deriveFont (this, style, size);
-}
-
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new size.
- *
- * @param size The size of the newly created font.
- *
- * @return A clone of the current font, with the specified size.
- *
- * @since 1.2
- */
- public Font deriveFont (float size)
-{
- return peer.deriveFont (this, size);
-}
-
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new style.
- *
- * @param style The style of the newly created font.
- *
- * @return A clone of the current font, with the specified style.
- *
- * @since 1.2
- */
- public Font deriveFont (int style)
-{
- return peer.deriveFont (this, style);
-}
-
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new style and subjected to a new affine transformation.
- *
- * @param style The style of the newly created font.
- * @param a The transformation to apply.
- *
- * @return A clone of the current font, with the specified style and
- * transform.
- *
- * @throws IllegalArgumentException If transformation is
- * null
.
- *
- * @since 1.2
- */
- public Font deriveFont (int style, AffineTransform a)
-{
- if (a == null)
- throw new IllegalArgumentException ("Affine transformation is null");
-
- return peer.deriveFont (this, style, a);
-}
-
-/**
- * Produces a new {@link Font} based on the current font, subjected
- * to a new affine transformation.
- *
- * @param a The transformation to apply.
- *
- * @return A clone of the current font, with the specified transform.
- *
- * @throws IllegalArgumentException If transformation is
- * null
.
- *
- * @since 1.2
- */
- public Font deriveFont (AffineTransform a)
-{
- if (a == null)
- throw new IllegalArgumentException ("Affine transformation is null");
-
- return peer.deriveFont (this, a);
-}
-
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new set of attributes.
- *
- * @param attributes Attributes of the newly created font.
- *
- * @return A clone of the current font, with the specified attributes.
- *
- * @since 1.2
- */
- public Font deriveFont (Map attributes)
-{
- return peer.deriveFont (this, attributes);
-}
-
-/**
- * Returns a map of chracter attributes which this font currently has set.
- *
- * @return A map of chracter attributes which this font currently has set.
- *
- * @see getAvailableAttributes()
- * @see java.text.AttributedCharacterIterator.Attribute
- * @see java.awt.font.TextAttribute
- */
- public Map getAttributes ()
-{
- return peer.getAttributes (this);
-}
-
-/**
- * Returns an array of chracter attribute keys which this font understands.
- *
- * @return An array of chracter attribute keys which this font understands.
- *
- * @see getAttributes()
- * @see java.text.AttributedCharacterIterator.Attribute
- * @see java.awt.font.TextAttribute
- */
- public AttributedCharacterIterator.Attribute[] getAvailableAttributes()
-{
- return peer.getAvailableAttributes (this);
-}
-
-/**
- * Returns a baseline code (one of {@link ROMAN_BASELINE}, {@link
- * CENTER_BASELINE} or {@link HANGING_BASELINE}) indicating which baseline
- * this font will measure baseline offsets for, when presenting glyph
- * metrics for a given character.
- *
- * Baseline offsets describe the position of a glyph relative to an
- * invisible line drawn under, through the center of, or over a line of
- * rendered text, respectively. Different scripts use different baseline
- * modes, so clients should not assume all baseline offsets in a glyph
- * vector are from a common baseline.
- *
- * @param c The character code to select a baseline mode for.
- *
- * @return The baseline mode which would be used in a glyph associated
- * with the provided character.
- *
- * @since 1.2
- *
- * @see LineMetrics.getBaselineOffsets()
- */
- public byte getBaselineFor (char c)
-{
- return peer.getBaselineFor (this, c);
-}
-
-/**
- * Returns the family name of this font. A family name describes a
- * typographic style (such as Helvetica or Palatino). It is more specific
- * than a logical font name (such as Sans Serif) but less specific than a
- * font face name (such as Helvetica Bold).
- *
- * @param lc The locale in which to describe the name of the font family.
- *
- * @return A string containing the font family name, localized for the
- * provided locale.
- *
- * @since 1.2
- *
- * @see getName()
- * @see getFontName()
- * @see GraphicsEnvironment.getAvailableFontFamilyNames()
- * @see Locale
- */
- public String getFamily (Locale lc)
-{
- return peer.getFamily (this, lc);
-}
-
-/**
- * Returns a font appropriate for the given attribute set.
- *
- * @param attributes The attributes required for the new font.
- *
- * @return A new Font with the given attributes.
- *
- * @since 1.2
- *
- * @see TextAttribure
- */
- public static Font getFont (Map attributes)
-{
- return getFontFromToolkit (null, attributes);
-}
-
-/**
- * Returns the font face name of the font. A font face name describes a
- * specific variant of a font family (such as Helvetica Bold). It is more
- * specific than both a font family name (such as Helvetica) and a logical
- * font name (such as Sans Serif).
- *
- * @return The font face name of the font.
- *
- * @since 1.2
- *
- * @see getName()
- * @see getFamily()
- */
- public String getFontName ()
-{
- return peer.getFontName (this);
-}
-
-/**
- * Returns the font face name of the font. A font face name describes a
- * specific variant of a font family (such as Helvetica Bold). It is more
- * specific than both a font family name (such as Helvetica).
- *
- * @param lc The locale in which to describe the name of the font face.
- *
- * @return A string containing the font face name, localized for the
- * provided locale.
- *
- * @since 1.2
- *
- * @see getName()
- * @see getFamily()
- */
- public String getFontName (Locale lc)
-{
- return peer.getFontName (this, lc);
-}
-
-/**
- * Returns the italic angle of this font, a measurement of its slant when
- * style is {@link ITALIC}. The precise meaning is the inverse slope of a
- * caret line which "best measures" the font's italic posture.
- *
- * @return The italic angle.
- *
- * @see TextAttribute.POSTURE
- */
- public float getItalicAngle ()
-{
- return peer.getItalicAngle (this);
-}
-
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param text The string to calculate metrics from.
- * @param begin Index of first character in text
to measure.
- * @param limit Index of last character in text
to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in text
.
- */
- public LineMetrics getLineMetrics(String text, int begin,
- int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, new StringCharacterIterator (text),
- begin, limit, rc);
-}
-
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param chars The string to calculate metrics from.
- * @param begin Index of first character in text
to measure.
- * @param limit Index of last character in text
to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in chars
.
- */
- public LineMetrics getLineMetrics(char[] chars, int begin,
- int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, new StringCharacterIterator (new String(chars)),
- begin, limit, rc);
-}
-
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param ci The string to calculate metrics from.
- * @param begin Index of first character in text
to measure.
- * @param limit Index of last character in text
to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in ci
.
- */
- public LineMetrics getLineMetrics (CharacterIterator ci, int begin,
- int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, ci, begin, limit, rc);
-}
-
-/**
- * Returns the maximal bounding box of all the bounding boxes in this
- * font, when the font's bounding boxes are evaluated in a given {@link
- * FontRenderContext}
- *
- * @param rc Context in which to evaluate bounding boxes.
- *
- * @return The maximal bounding box.
- */
- public Rectangle2D getMaxCharBounds (FontRenderContext rc)
-{
- return peer.getMaxCharBounds (this, rc);
-}
-
-/**
- * Returns the glyph code this font uses to represent missing glyphs. This
- * code will be present in glyph vectors when the font was unable to
- * locate a glyph to represent a particular character code.
- *
- * @return The missing glyph code.
- *
- * @since 1.2
- */
- public int getMissingGlyphCode ()
-{
- return peer.getMissingGlyphCode (this);
-}
-
-/**
- * Returns the overall number of glyphs in this font. This number is one
- * more than the greatest glyph code used in any glyph vectors this font
- * produces. In other words, glyph codes are taken from the range
- * [ 0, getNumGlyphs() - 1 ]
.
- *
- * @return The number of glyphs in this font.
- *
- * @since 1.2
- */
- public int getNumGlyphs ()
-{
- return peer.getMissingGlyphCode (this);
-}
-
-/**
- * Returns the PostScript Name of this font.
- *
- * @return The PostScript Name of this font.
- *
- * @since 1.2
- *
- * @see getName()
- * @see getFamily()
- * @see getFontName()
- */
- public String getPSName ()
-{
- return peer.getPostScriptName (this);
-}
-
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param str The string to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @see createGlyphVector()
- */
- public Rectangle2D getStringBounds (String str, FontRenderContext frc)
-{
- return getStringBounds (str, 0, str.length () - 1, frc);
-}
-
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param str The string to measure.
- * @param begin Index of the first character in str
to measure.
- * @param limit Index of the last character in str
to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in str
.
- *
- * @since 1.2
- *
- * @see createGlyphVector()
- */
- public Rectangle2D getStringBounds (String str, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, new StringCharacterIterator(str), begin, limit, frc);
-}
-
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param ci The text to measure.
- * @param begin Index of the first character in ci
to measure.
- * @param limit Index of the last character in ci
to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in ci
.
- *
- * @since 1.2
- *
- * @see createGlyphVector()
- */
- public Rectangle2D getStringBounds (CharacterIterator ci, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, ci, begin, limit, frc);
-}
-
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param chars The text to measure.
- * @param begin Index of the first character in ci
to measure.
- * @param limit Index of the last character in ci
to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in chars
.
- *
- * @since 1.2
- *
- * @see createGlyphVector()
- */
- public Rectangle2D getStringBounds (char[] chars, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, new StringCharacterIterator (new String (chars)),
- begin, limit, frc);
-}
-
-/**
- * Returns a copy of the affine transformation this font is currently
- * subject to, if any.
- *
- * @return The current transformation.
- */
- public AffineTransform getTransform ()
-{
- return peer.getTransform (this);
-}
-
-/**
- * Indicates whether this font's line metrics are uniform. A font may be
- * composed of several "subfonts", each covering a different code range,
- * and each with their own line metrics. A font with no subfonts, or
- * subfonts with identical line metrics, is said to have "uniform" line
- * metrics.
- *
- * @return Whether this font has uniform line metrics.
- *
- * @see LineMetrics
- * @see getLineMetrics()
- */
- public boolean hasUniformLineMetrics ()
-{
- return peer.hasUniformLineMetrics (this);
-}
-
-/**
- * Indicates whether this font is subject to a non-identity affine
- * transformation.
- *
- * @return true
iff the font has a non-identity affine
- * transformation applied to it.
- */
- public boolean isTransformed ()
-{
- return peer.isTransformed (this);
-}
-
-/**
- * Produces a glyph vector representing a full layout fo the specified
- * text in this font. Full layouts may include complex shaping and
- * reordering operations, for scripts such as Arabic or Hindi.
- *
- * Bidirectional (bidi) layout is not performed in this method; text
- * should have its bidi direction specified with one of the flags {@link
- * LAYOUT_LEFT_TO_RIGHT} or {@link LAYOUT_RIGHT_TO_LEFT}.
- *
- * Some types of layout (notably Arabic glyph shaping) may examine context
- * characters beyond the bounds of the indicated range, in order to select
- * an appropriate shape. The flags {@link LAYOUT_NO_START_CONTEXT} and
- * {@link LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra
- * context areas from being examined, for instance if they contain invalid
- * characters.
- *
- * @param frc Context in which to perform the layout.
- * @param chars Text to perform layout on.
- * @param start Index of first character to perform layout on.
- * @param limit Index of last character to perform layout on.
- * @param flags Combination of flags controlling layout.
- *
- * @return A new {@link GlyphVector} representing the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in chars
.
- */
- public GlyphVector layoutGlyphVector (FontRenderContext frc,
- char[] chars, int start,
- int limit, int flags)
-{
- return peer.layoutGlyphVector (this, frc, chars, start, limit, flags);
-}
-
-
-/**
- * Returns a native peer object for this font.
- *
- * @return A native peer object for this font.
- *
- * @deprecated
- */
- public FontPeer getPeer ()
-{
- return peer;
-}
-
-
-/**
- * Returns a hash value for this font.
- *
- * @return A hash for this font.
- */
- public int hashCode()
-{
- return this.toString().hashCode();
-}
-
-
-/**
- * Tests whether or not the specified object is equal to this font. This
- * will be true if and only if:
- *
- *
- *
- * @return null
.
- * Font
.
- * true
if the specified object is equal to this
- * object, false
otherwise.
- */
-public boolean
-equals(Object obj)
-{
- if (obj == null)
- return(false);
-
- if (!(obj instanceof Font))
- return(false);
-
- Font f = (Font)obj;
-
- return (f.getName ().equals (this.getName ()) &&
- f.getFamily ().equals (this.getFamily ()) &&
- f.getFontName ().equals (this.getFontName ()) &&
- f.getTransform ().equals (this.getTransform ()) &&
- f.getSize() == this.getSize() &&
- f.getStyle() == this.getStyle());
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this font.
- *
- * @return A string representation of this font.
- */
-public String
-toString()
-{
- String styleString = "";
-
- switch (getStyle ())
- {
- case 0:
- styleString = "plain";
- break;
- case 1:
- styleString = "bold";
- break;
- case 2:
- styleString = "italic";
- break;
- default:
- styleString = "unknown";
- }
-
- return getClass ().getName ()
- + "[family=" + getFamily ()
- + ",name=" + getFontName ()
- + ",style=" + styleString
- + ",size=" + getSize () + "]";
-}
-
-
- /**
- * Determines the line metrics for a run of text.
- *
- * @param str the text run to be measured.
- *
- * @param frc the font rendering parameters that are used for the
- * measurement. The exact placement and size of text slightly
- * depends on device-specific characteristics, for instance
- * the device resolution or anti-aliasing. For this reason,
- * the returned measurement will only be accurate if the
- * passed FontRenderContext
correctly reflects
- * the relevant parameters. Hence, frc
should be
- * obtained from the same Graphics2D
that will
- * be used for drawing, and any rendering hints should be set
- * to the desired values before obtaining frc
.
- *
- * @see java.awt.Graphics2D#getFontRenderContext()
- */
- public LineMetrics getLineMetrics(String str, FontRenderContext frc)
- {
- return getLineMetrics (str, 0, str.length () - 1, frc);
- }
-
-} // class Font
-
diff --git a/libjava/java/awt/FontFormatException.java b/libjava/java/awt/FontFormatException.java
deleted file mode 100644
index 6ec8757fb5b..00000000000
--- a/libjava/java/awt/FontFormatException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* FontFormatException.java -- the specified font is bad
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * Thrown when a specified font is bad.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Font
- * @since 1.3
- * @status updated to 1.4
- */
-public class FontFormatException extends Exception
-{
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = -4481290147811361272L;
-
- /**
- * Create a new instance with the specified detailed error message.
- *
- * @param message the detailed error message
- */
- public FontFormatException(String message)
- {
- super(message);
- }
-} // class FontFormatException
diff --git a/libjava/java/awt/FontMetrics.java b/libjava/java/awt/FontMetrics.java
deleted file mode 100644
index e702a625766..00000000000
--- a/libjava/java/awt/FontMetrics.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/* FontMetrics.java -- Information about about a fonts display characteristics
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.font.FontRenderContext;
-import java.awt.font.LineMetrics;
-import java.awt.geom.Rectangle2D;
-import java.text.CharacterIterator;
-
-// FIXME: I leave many methods basically unimplemented. This
-// should be reviewed.
-
-/**
- * This class returns information about the display characteristics of
- * a font. It is abstract, and concrete subclasses should implement at
- * least the following methods:
- *
- *
- *
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public abstract class FontMetrics implements java.io.Serializable
-{
- // Serialization constant.
- private static final long serialVersionUID = 1681126225205050147L;
-
- /**
- * This is the font for which metrics will be returned.
- */
- protected Font font;
-
- /**
- * Initializes a new instance of FontMetrics
for the
- * specified font.
- *
- * @param font The font to return metric information for.
- */
- protected FontMetrics(Font font)
- {
- this.font = font;
- }
-
- /**
- * Returns the font that this object is creating metric information fo.
- *
- * @return The font for this object.
- */
- public Font getFont()
- {
- return font;
- }
-
- /**
- * Returns the leading, or spacing between lines, for this font.
- *
- * @return The font leading.
- */
- public int getLeading()
- {
- return 0;
- }
-
- /**
- * Returns the ascent of the font, which is the distance from the base
- * to the top of the majority of characters in the set. Some characters
- * can exceed this value however.
- *
- * @return The font ascent.
- */
- public int getAscent()
- {
- return 1;
- }
-
- /**
- * Returns the descent of the font, which is the distance from the base
- * to the bottom of the majority of characters in the set. Some characters
- * can exceed this value however.
- *
- * @return The font descent.
- */
- public int getDescent()
- {
- return 1;
- }
-
- /**
- * Returns the height of a line in this font. This will be the sum
- * of the leading, the ascent, and the descent.
- *
- * @return The height of the font.
- */
- public int getHeight()
- {
- return getAscent() + getDescent() + getLeading();
- }
-
- /**
- * Returns the maximum ascent value. This is the maximum distance any
- * character in the font rised above the baseline.
- *
- * @return The maximum ascent for this font.
- */
- public int getMaxAscent()
- {
- return getAscent();
- }
-
- /**
- * Returns the maximum descent value. This is the maximum distance any
- * character in the font extends below the baseline.
- *
- * @return The maximum descent for this font.
- */
- public int getMaxDescent()
- {
- return getMaxDecent();
- }
-
- /**
- * Returns the maximum descent value. This is the maximum distance any
- * character in the font extends below the baseline.
- *
- * @return The maximum descent for this font.
- *
- * @deprecated This method is deprecated in favor of
- * getMaxDescent()
.
- */
- public int getMaxDecent()
- {
- return getDescent();
- }
-
- /**
- * Returns the width of the widest character in the font.
- *
- * @return The width of the widest character in the font.
- */
- public int getMaxAdvance()
- {
- return -1;
- }
-
- /**
- * Returns the width of the specified character.
- *
- * @param ch The character to return the width of.
- *
- * @return The width of the specified character.
- */
- public int charWidth(int ch)
- {
- return charWidth((char) ch);
- }
-
- /**
- * Returns the width of the specified character.
- *
- * @param ch The character to return the width of.
- *
- * @return The width of the specified character.
- */
- public int charWidth(char ch)
- {
- return 1;
- }
-
- /**
- * Returns the total width of the specified string
- *
- * @param str The string to return the width of.
- *
- * @return The width of the string.
- */
- public int stringWidth(String str)
- {
- char[] buf = new char[str.length()];
- str.getChars(0, str.length(), buf, 0);
-
- return charsWidth(buf, 0, buf.length);
- }
-
- /**
- * Returns the total width of the specified character array.
- *
- * @param buf The character array containing the data.
- * @param offset The offset into the array to start calculating from.
- * @param len The total number of bytes to process.
- *
- * @return The width of the requested characters.
- */
- public int charsWidth(char[] buf, int offset, int len)
- {
- int total_width = 0;
- for (int i = offset; i < len; i++)
- total_width += charWidth(buf[i]);
- return total_width;
- }
-
- /**
- * Returns the total width of the specified byte array.
- *
- * @param buf The byte array containing the data.
- * @param offset The offset into the array to start calculating from.
- * @param len The total number of bytes to process.
- *
- * @return The width of the requested characters.
- */
- public int bytesWidth(byte[] buf, int offset, int len)
- {
- int total_width = 0;
- for (int i = offset; i < len; i++)
- total_width = charWidth((char) buf[i]);
-
- return total_width;
- }
-
- /**
- * Returns the widths of the first 256 characters in the font.
- *
- * @return The widths of the first 256 characters in the font.
- */
- public int[] getWidths()
- {
- int[] result = new int[256];
- for (char i = 0; i < 256; i++)
- result[i] = charWidth(i);
- return result;
- }
-
- /**
- * Returns a string representation of this object.
- *
- * @return A string representation of this object.
- */
- public String toString()
- {
- return (this.getClass() + "[font=" + font + ",ascent=" + getAscent()
- + ",descent=" + getDescent() + ",height=" + getHeight() + "]");
- }
-
- // Generic FontRenderContext used when getLineMetrics is called with a
- // plain Graphics object.
- private static final FontRenderContext gRC = new FontRenderContext(null,
- false,
- false);
-
- /**
- * Returns a {@link LineMetrics} object constructed with the
- * specified text and the {@link FontRenderContext} of the Graphics
- * object when it is an instance of Graphics2D or a generic
- * FontRenderContext with a null transform, not anti-aliased and not
- * using fractional metrics.
- *
- * @param text The string to calculate metrics from.
- * @param g The Graphics object that will be used.
- *
- * @return A new {@link LineMetrics} object.
- */
- public LineMetrics getLineMetrics(String text, Graphics g)
- {
- return getLineMetrics(text, 0, text.length(), g);
- }
-
- /**
- * Returns a {@link LineMetrics} object constructed with the
- * specified text and the {@link FontRenderContext} of the Graphics
- * object when it is an instance of Graphics2D or a generic
- * FontRenderContext with a null transform, not anti-aliased and not
- * using fractional metrics.
- *
- * @param text The string to calculate metrics from.
- * @param begin Index of first character in text
to measure.
- * @param limit Index of last character in text
to measure.
- * @param g The Graphics object that will be used.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in text
.
- */
- public LineMetrics getLineMetrics(String text, int begin, int limit,
- Graphics g)
- {
- FontRenderContext rc;
- if (g instanceof Graphics2D)
- rc = ((Graphics2D) g).getFontRenderContext();
- else
- rc = gRC;
- return font.getLineMetrics(text, begin, limit, rc);
- }
-
- /**
- * Returns a {@link LineMetrics} object constructed with the
- * specified text and the {@link FontRenderContext} of the Graphics
- * object when it is an instance of Graphics2D or a generic
- * FontRenderContext with a null transform, not anti-aliased and not
- * using fractional metrics.
- *
- * @param chars The string to calculate metrics from.
- * @param begin Index of first character in text
to measure.
- * @param limit Index of last character in text
to measure.
- * @param g The Graphics object that will be used.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in text
.
- */
- public LineMetrics getLineMetrics(char[] chars, int begin, int limit,
- Graphics g)
- {
- FontRenderContext rc;
- if (g instanceof Graphics2D)
- rc = ((Graphics2D) g).getFontRenderContext();
- else
- rc = gRC;
- return font.getLineMetrics(chars, begin, limit, rc);
- }
-
- /**
- * Returns a {@link LineMetrics} object constructed with the
- * specified text and the {@link FontRenderContext} of the Graphics
- * object when it is an instance of Graphics2D or a generic
- * FontRenderContext with a null transform, not anti-aliased and not
- * using fractional metrics.
- *
- * @param ci An iterator over the string to calculate metrics from.
- * @param begin Index of first character in text
to measure.
- * @param limit Index of last character in text
to measure.
- * @param g The Graphics object that will be used.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in text
.
- */
- public LineMetrics getLineMetrics(CharacterIterator ci, int begin,
- int limit, Graphics g)
- {
- FontRenderContext rc;
- if (g instanceof Graphics2D)
- rc = ((Graphics2D) g).getFontRenderContext();
- else
- rc = gRC;
- return font.getLineMetrics(ci, begin, limit, rc);
- }
-
- public Rectangle2D getStringBounds(String str, Graphics context)
- {
- return font.getStringBounds(str, getFontRenderContext(context));
- }
-
- public Rectangle2D getStringBounds(String str, int beginIndex, int limit,
- Graphics context)
- {
- return font.getStringBounds(str, beginIndex, limit,
- getFontRenderContext(context));
- }
-
- public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit,
- Graphics context)
- {
- return font.getStringBounds(chars, beginIndex, limit,
- getFontRenderContext(context));
- }
-
- public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex,
- int limit, Graphics context)
- {
- return font.getStringBounds(ci, beginIndex, limit,
- getFontRenderContext(context));
- }
-
- private FontRenderContext getFontRenderContext(Graphics context)
- {
- if (context instanceof Graphics2D)
- return ((Graphics2D) context).getFontRenderContext();
-
- return gRC;
- }
-}
diff --git a/libjava/java/awt/Frame.java b/libjava/java/awt/Frame.java
deleted file mode 100644
index 16c66136037..00000000000
--- a/libjava/java/awt/Frame.java
+++ /dev/null
@@ -1,649 +0,0 @@
-/* Frame.java -- AWT toplevel window
- Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.peer.FramePeer;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Vector;
-
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-
-/**
- * This class is a top-level window with a title bar and window
- * decorations.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Frame extends Window implements MenuContainer
-{
-/**
- * Constant for the default cursor.
- * @deprecated Replaced by Cursor.DEFAULT_CURSOR
instead.
- */
-public static final int DEFAULT_CURSOR = Cursor.DEFAULT_CURSOR;
-
-/**
- * Constant for a cross-hair cursor.
- * @deprecated Use Cursor.CROSSHAIR_CURSOR
instead.
- */
-public static final int CROSSHAIR_CURSOR = Cursor.CROSSHAIR_CURSOR;
-
-/**
- * Constant for a cursor over a text field.
- * @deprecated Use Cursor.TEXT_CURSOR
instead.
- */
-public static final int TEXT_CURSOR = Cursor.TEXT_CURSOR;
-
-/**
- * Constant for a cursor to display while waiting for an action to complete.
- * @deprecated Use Cursor.WAIT_CURSOR
.
- */
-public static final int WAIT_CURSOR = Cursor.WAIT_CURSOR;
-
-/**
- * Cursor used over SW corner of window decorations.
- * @deprecated Use Cursor.SW_RESIZE_CURSOR
instead.
- */
-public static final int SW_RESIZE_CURSOR = Cursor.SW_RESIZE_CURSOR;
-
-/**
- * Cursor used over SE corner of window decorations.
- * @deprecated Use Cursor.SE_RESIZE_CURSOR
instead.
- */
-public static final int SE_RESIZE_CURSOR = Cursor.SE_RESIZE_CURSOR;
-
-/**
- * Cursor used over NW corner of window decorations.
- * @deprecated Use Cursor.NW_RESIZE_CURSOR
instead.
- */
-public static final int NW_RESIZE_CURSOR = Cursor.NW_RESIZE_CURSOR;
-
-/**
- * Cursor used over NE corner of window decorations.
- * @deprecated Use Cursor.NE_RESIZE_CURSOR
instead.
- */
-public static final int NE_RESIZE_CURSOR = Cursor.NE_RESIZE_CURSOR;
-
-/**
- * Cursor used over N edge of window decorations.
- * @deprecated Use Cursor.N_RESIZE_CURSOR
instead.
- */
-public static final int N_RESIZE_CURSOR = Cursor.N_RESIZE_CURSOR;
-
-/**
- * Cursor used over S edge of window decorations.
- * @deprecated Use Cursor.S_RESIZE_CURSOR
instead.
- */
-public static final int S_RESIZE_CURSOR = Cursor.S_RESIZE_CURSOR;
-
-/**
- * Cursor used over E edge of window decorations.
- * @deprecated Use Cursor.E_RESIZE_CURSOR
instead.
- */
-public static final int E_RESIZE_CURSOR = Cursor.E_RESIZE_CURSOR;
-
-/**
- * Cursor used over W edge of window decorations.
- * @deprecated Use Cursor.W_RESIZE_CURSOR
instead.
- */
-public static final int W_RESIZE_CURSOR = Cursor.W_RESIZE_CURSOR;
-
-/**
- * Constant for a hand cursor.
- * @deprecated Use Cursor.HAND_CURSOR
instead.
- */
-public static final int HAND_CURSOR = Cursor.HAND_CURSOR;
-
-/**
- * Constant for a cursor used during window move operations.
- * @deprecated Use Cursor.MOVE_CURSOR
instead.
- */
-public static final int MOVE_CURSOR = Cursor.MOVE_CURSOR;
-
-public static final int ICONIFIED = 1;
-public static final int MAXIMIZED_BOTH = 6;
-public static final int MAXIMIZED_HORIZ = 2;
-public static final int MAXIMIZED_VERT = 4;
-public static final int NORMAL = 0;
-
-// Serialization version constant
-private static final long serialVersionUID = 2673458971256075116L;
-
-/**
- * @serial The version of the class data being serialized
- * // FIXME: what is this value?
- */
-private int frameSerializedDataVersion;
-
-/**
- * @serial Image used as the icon when this frame is minimized.
- */
-private Image icon;
-
-/**
- * @serial Constant used by the JDK Motif peer set. Not used in
- * this implementation.
- */
-private boolean mbManagement;
-
-/**
- * @serial The menu bar for this frame.
- */
-//private MenuBar menuBar = new MenuBar();
-private MenuBar menuBar;
-
-/**
- * @serial A list of other top-level windows owned by this window.
- */
-Vector ownedWindows = new Vector();
-
-/**
- * @serial Indicates whether or not this frame is resizable.
- */
-private boolean resizable = true;
-
-/**
- * @serial The state of this frame.
- * // FIXME: What are the values here?
- * This is package-private to avoid an accessor method.
- */
-int state;
-
-/**
- * @serial The title of the frame.
- */
-private String title = "";
-
- /**
- * Maximized bounds for this frame.
- */
- private Rectangle maximizedBounds;
-
- /**
- * This field indicates whether the frame is undecorated or not.
- */
- private boolean undecorated = false;
-
- /*
- * The number used to generate the name returned by getName.
- */
- private static transient long next_frame_number;
-
-/**
- * Initializes a new instance of Frame
that is not visible
- * and has no title.
- */
-public
-Frame()
-{
- this("");
- noteFrame(this);
-}
-
-/**
- * Initializes a new instance of Frame
that is not visible
- * and has the specified title.
- *
- * @param title The title of this frame.
- */
-public
-Frame(String title)
-{
- super();
- this.title = title;
- // Top-level frames are initially invisible.
- visible = false;
- noteFrame(this);
-}
-
-public
-Frame(GraphicsConfiguration gc)
-{
- super(gc);
- visible = false;
- noteFrame(this);
-}
-
-public
-Frame(String title, GraphicsConfiguration gc)
-{
- super(gc);
- setTitle(title);
- visible = false;
- noteFrame(this);
-}
-
-/**
- * Returns this frame's title string.
- *
- * @return This frame's title string.
- */
-public String
-getTitle()
-{
- return(title);
-}
-
-/*
- * Sets this frame's title to the specified value.
- *
- * @param title The new frame title.
- */
-public synchronized void
-setTitle(String title)
-{
- this.title = title;
- if (peer != null)
- ((FramePeer) peer).setTitle(title);
-}
-
-/**
- * Returns this frame's icon.
- *
- * @return This frame's icon, or null
if this frame does not
- * have an icon.
- */
-public Image
-getIconImage()
-{
- return(icon);
-}
-
-/**
- * Sets this frame's icon to the specified value.
- *
- * @icon The new icon for this frame.
- */
-public synchronized void
-setIconImage(Image icon)
-{
- this.icon = icon;
- if (peer != null)
- ((FramePeer) peer).setIconImage(icon);
-}
-
-/**
- * Returns this frame's menu bar.
- *
- * @return This frame's menu bar, or null
if this frame
- * does not have a menu bar.
- */
-public MenuBar
-getMenuBar()
-{
- return(menuBar);
-}
-
-/**
- * Sets this frame's menu bar.
- *
- * @param menuBar The new menu bar for this frame.
- */
-public synchronized void
-setMenuBar(MenuBar menuBar)
-{
- if (peer != null)
- {
- if (this.menuBar != null)
- this.menuBar.removeNotify();
- if (menuBar != null)
- menuBar.addNotify();
- invalidateTree ();
- ((FramePeer) peer).setMenuBar(menuBar);
- }
- this.menuBar = menuBar;
-}
-
-/**
- * Tests whether or not this frame is resizable. This will be
- * true
by default.
- *
- * @return true
if this frame is resizable, false
- * otherwise.
- */
-public boolean
-isResizable()
-{
- return(resizable);
-}
-
-/**
- * Sets the resizability of this frame to the specified value.
- *
- * @param resizable true
to make the frame resizable,
- * false
to make it non-resizable.
- */
-public synchronized void
-setResizable(boolean resizable)
-{
- this.resizable = resizable;
- if (peer != null)
- ((FramePeer) peer).setResizable(resizable);
-}
-
-/**
- * Returns the cursor type of the cursor for this window. This will
- * be one of the constants in this class.
- *
- * @return The cursor type for this frame.
- *
- * @deprecated Use Component.getCursor()
instead.
- */
-public int
-getCursorType()
-{
- return(getCursor().getType());
-}
-
-/**
- * Sets the cursor for this window to the specified type. The specified
- * type should be one of the constants in this class.
- *
- * @param type The cursor type.
- *
- * @deprecated Use Component.setCursor(Cursor)
instead.
- */
-public void
-setCursor(int type)
-{
- setCursor(new Cursor(type));
-}
-
-/**
- * Removes the specified component from this frame's menu.
- *
- * @param menu The menu component to remove.
- */
-public void
-remove(MenuComponent menu)
-{
- menuBar.remove(menu);
-}
-
-/**
- * Notifies this frame that it should create its native peer.
- */
-private static void fireDummyEvent()
-{
- EventQueue.invokeLater(new Runnable()
- {
- public void run()
- {
- // Do nothing here.
- }
- });
-}
-
-public void
-addNotify()
-{
- if (menuBar != null)
- menuBar.addNotify();
- if (peer == null)
- peer = getToolkit ().createFrame (this);
-
- // We now know there's a Frame (us) with a live peer, so we can start the
- // fundamental queue and dispatch thread, by inserting a dummy event.
- if (parent != null && parent.isDisplayable())
- fireDummyEvent();
-
- super.addNotify();
-}
-
-public void removeNotify()
-{
- if (menuBar != null)
- menuBar.removeNotify();
- super.removeNotify();
-
- // By now we've been disconnected from the peer, and the peer set to
- // null. This is formally the same as saying "we just became
- // un-displayable", so we wake up the event queue with a dummy event to
- // see if it's time to shut down.
- fireDummyEvent();
-}
-
- /**
- * Returns a debugging string describing this window.
- *
- * @return A debugging string describing this window.
- */
- protected String paramString ()
- {
- String title = getTitle ();
-
- String resizable = "";
- if (isResizable ())
- resizable = ",resizable";
-
- String state = "";
- switch (getState ())
- {
- case NORMAL:
- state = ",normal";
- break;
- case ICONIFIED:
- state = ",iconified";
- break;
- case MAXIMIZED_BOTH:
- state = ",maximized-both";
- break;
- case MAXIMIZED_HORIZ:
- state = ",maximized-horiz";
- break;
- case MAXIMIZED_VERT:
- state = ",maximized-vert";
- break;
- }
-
- return super.paramString () + ",title=" + title + resizable + state;
- }
-
-private static ArrayList weakFrames = new ArrayList();
-
-private static void noteFrame(Frame f)
-{
- weakFrames.add(new WeakReference(f));
-}
-
-public static Frame[] getFrames()
-{
- int n = 0;
- synchronized (weakFrames)
- {
- Iterator i = weakFrames.iterator();
- while (i.hasNext())
- {
- WeakReference wr = (WeakReference) i.next();
- if (wr.get() != null)
- ++n;
- }
- if (n == 0)
- return new Frame[0];
- else
- {
- Frame[] frames = new Frame[n];
- n = 0;
- i = weakFrames.iterator();
- while (i.hasNext())
- {
- WeakReference wr = (WeakReference) i.next();
- if (wr.get() != null)
- frames[n++] = (Frame) wr.get();
- }
- return frames;
- }
- }
-}
-
- public void setState (int state)
- {
- int current_state = getExtendedState ();
-
- if (state == NORMAL
- && (current_state & ICONIFIED) != 0)
- setExtendedState (current_state | ICONIFIED);
-
- if (state == ICONIFIED
- && (current_state & ~ICONIFIED) == 0)
- setExtendedState (current_state & ~ICONIFIED);
- }
-
- public int getState ()
- {
- /* FIXME: State might have changed in the peer... Must check. */
-
- return (state & ICONIFIED) != 0 ? ICONIFIED : NORMAL;
- }
-
- /**
- * @since 1.4
- */
- public void setExtendedState (int state)
- {
- this.state = state;
- }
-
- /**
- * @since 1.4
- */
- public int getExtendedState ()
- {
- return state;
- }
-
- /**
- * @since 1.4
- */
- public void setMaximizedBounds (Rectangle maximizedBounds)
- {
- this.maximizedBounds = maximizedBounds;
- }
-
- /**
- * Returns the maximized bounds of this frame.
- *
- * @return the maximized rectangle, may be null.
- *
- * @since 1.4
- */
- public Rectangle getMaximizedBounds ()
- {
- return maximizedBounds;
- }
-
- /**
- * Returns whether this frame is undecorated or not.
- *
- * @since 1.4
- */
- public boolean isUndecorated ()
- {
- return undecorated;
- }
-
- /**
- * Disables or enables decorations for this frame. This method can only be
- * called while the frame is not displayable.
- *
- * @exception IllegalComponentStateException If this frame is displayable.
- *
- * @since 1.4
- */
- public void setUndecorated (boolean undecorated)
- {
- if (!isDisplayable ())
- throw new IllegalComponentStateException ();
-
- this.undecorated = undecorated;
- }
-
- /**
- * Generate a unique name for this frame.
- *
- * @return A unique name for this frame.
- */
- String generateName ()
- {
- return "frame" + getUniqueLong ();
- }
-
- private static synchronized long getUniqueLong ()
- {
- return next_frame_number++;
- }
-
- protected class AccessibleAWTFrame extends AccessibleAWTWindow
- {
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.FRAME;
- }
-
- public AccessibleStateSet getAccessibleState()
- {
- AccessibleStateSet states = super.getAccessibleStateSet();
- if (isResizable())
- states.add(AccessibleState.RESIZABLE);
- if ((state & ICONIFIED) != 0)
- states.add(AccessibleState.ICONIFIED);
- return states;
- }
- }
-
- /**
- * Gets the AccessibleContext associated with this Frame
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTFrame();
- return accessibleContext;
- }
-
-}
diff --git a/libjava/java/awt/GradientPaint.java b/libjava/java/awt/GradientPaint.java
deleted file mode 100644
index f730f5ebbd1..00000000000
--- a/libjava/java/awt/GradientPaint.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/* GradientPaint.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.ColorModel;
-
-/**
- * STUB CLASS ONLY
- */
-public class GradientPaint implements Paint
-{
- private final float x1;
- private final float y1;
- private final Color c1;
- private final float x2;
- private final float y2;
- private final Color c2;
- private final boolean cyclic;
-
- public GradientPaint(float x1, float y1, Color c1,
- float x2, float y2, Color c2)
- {
- this(x1, y1, c1, x2, y2, c2, false);
- }
-
- public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2)
- {
- this((float) p1.getX(), (float) p1.getY(), c1,
- (float) p2.getX(), (float) p2.getY(), c2, false);
- }
-
- public GradientPaint(float x1, float y1, Color c1,
- float x2, float y2, Color c2, boolean cyclic)
- {
- if (c1 == null || c2 == null)
- throw new NullPointerException();
- this.x1 = x1;
- this.y1 = y1;
- this.c1 = c1;
- this.x2 = x2;
- this.y2 = y2;
- this.c2 = c2;
- this.cyclic = cyclic;
- }
-
- public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2,
- boolean cyclic)
- {
- this((float) p1.getX(), (float) p1.getY(), c1,
- (float) p2.getX(), (float) p2.getY(), c2, cyclic);
- }
-
- public Point2D getPoint1()
- {
- return new Point2D.Float(x1, y1);
- }
-
- public Color getColor1()
- {
- return c1;
- }
-
- public Point2D getPoint2()
- {
- return new Point2D.Float(x2, y2);
- }
-
- public Color getColor2()
- {
- return c2;
- }
-
- public boolean isCyclic()
- {
- return cyclic;
- }
-
- public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
- Rectangle2D userBounds,
- AffineTransform xform,
- RenderingHints hints)
- {
- throw new Error("not implemented");
- }
-
- public int getTransparency()
- {
- throw new Error("not implemented");
- }
-} // class GradientPaint
diff --git a/libjava/java/awt/Graphics.java b/libjava/java/awt/Graphics.java
deleted file mode 100644
index ff26190e5f0..00000000000
--- a/libjava/java/awt/Graphics.java
+++ /dev/null
@@ -1,767 +0,0 @@
-/* Graphics.java -- Abstract Java drawing class
- Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.ImageObserver;
-import java.text.AttributedCharacterIterator;
-
-/**
- * This is the abstract superclass of classes for drawing to graphics
- * devices such as the screen or printers.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public abstract class Graphics
-{
-
-/*
- * Instance Variables
- */
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Default constructor for subclasses.
- */
-protected
-Graphics()
-{
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns a copy of this Graphics
object.
- *
- * @return A copy of this object.
- */
-public abstract Graphics
-create();
-
-/*************************************************************************/
-
-/**
- * Returns a copy of this Graphics
object. The origin point
- * will be translated to the point (x, y) and the cliping rectangle set
- * to the intersection of the clipping rectangle in this object and the
- * rectangle specified by the parameters to this method.
- *
- * @param x The new X coordinate of the clipping region rect.
- * @param y The new Y coordinate of the clipping region rect.
- * @param width The width of the clipping region intersect rectangle.
- * @param height The height of the clipping region intersect rectangle.
- *
- * @return A copy of this object, modified as specified.
- */
-public Graphics
-create(int x, int y, int width, int height)
-{
- Graphics g = create();
-
- g.translate(x, y);
- // FIXME: I'm not sure if this will work. Are the old clip rect bounds
- // translated above?
- g.clipRect(0, 0, width, height);
-
- return(g);
-}
-
-/*************************************************************************/
-
-/**
- * Translates this context so that its new origin point is the point
- * (x, y).
- *
- * @param x The new X coordinate of the origin.
- * @param y The new Y coordinate of the origin.
- */
-public abstract void
-translate(int x, int y);
-
-/*************************************************************************/
-
-/**
- * Returns the current color for this object.
- *
- * @return The color for this object.
- */
-public abstract Color
-getColor();
-
-/*************************************************************************/
-
-/**
- * Sets the current color for this object.
- *
- * @param color The new color.
- */
-public abstract void
-setColor(Color color);
-
-/*************************************************************************/
-
-/**
- * Sets this context into "paint" mode, where the target pixels are
- * completely overwritten when drawn on.
- */
-public abstract void
-setPaintMode();
-
-/*************************************************************************/
-
-/**
- * Sets this context info "XOR" mode, where the targe pixles are
- * XOR-ed when drawn on.
- *
- * @param color The color to XOR against.
- */
-public abstract void
-setXORMode(Color color);
-
-/*************************************************************************/
-
-/**
- * Returns the current font for this graphics context.
- *
- * @return The current font.
- */
-public abstract Font
-getFont();
-
-/*************************************************************************/
-
-/**
- * Sets the font for this graphics context to the specified value.
- *
- * @param font The new font.
- */
-public abstract void
-setFont(Font font);
-
-/*************************************************************************/
-
-/**
- * Returns the font metrics for the current font.
- *
- * @return The font metrics for the current font.
- */
-public FontMetrics
-getFontMetrics()
-{
- return(getFontMetrics(getFont()));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the font metrics for the specified font.
- *
- * @param font The font to return metrics for.
- *
- * @return The requested font metrics.
- */
-public abstract FontMetrics
-getFontMetrics(Font font);
-
-/*************************************************************************/
-
-/**
- * Returns the bounding rectangle of the clipping region for this
- * graphics context.
- *
- * @return The bounding rectangle for the clipping region.
- */
-public abstract Rectangle
-getClipBounds();
-
-/*************************************************************************/
-
-/**
- * Returns the bounding rectangle of the clipping region for this
- * graphics context.
- *
- * @return The bounding rectangle for the clipping region.
- *
- * @deprecated This method is deprecated in favor of
- * getClipBounds()
.
- */
-public Rectangle
-getClipRect()
-{
- return(getClipBounds());
-}
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the intersection of the current clipping
- * region and the rectangle determined by the specified parameters.
- *
- * @param x The X coordinate of the upper left corner of the intersect rect.
- * @param y The Y coordinate of the upper left corner of the intersect rect.
- * @param width The width of the intersect rect.
- * @param height The height of the intersect rect.
- */
-public abstract void
-clipRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the rectangle determined by the specified
- * parameters.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-setClip(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Returns the current clipping region as a Shape
object.
- *
- * @return The clipping region as a Shape
.
- */
-public abstract Shape
-getClip();
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the specified Shape
.
- *
- * @param clip The new clipping region.
- */
-public abstract void
-setClip(Shape clip);
-
-/*************************************************************************/
-
-/**
- * Copies the specified rectangle to the specified offset location.
- *
- * @param x The X coordinate of the upper left corner of the copy rect.
- * @param y The Y coordinate of the upper left corner of the copy rect.
- * @param width The width of the copy rect.
- * @param height The height of the copy rect.
- * @param dx The offset from the X value to start drawing.
- * @param dy The offset from the Y value to start drawing.
- */
-public abstract void
-copyArea(int x, int y, int width, int height, int dx, int dy);
-
-/*************************************************************************/
-
-/**
- * Draws a line between the two specified points.
- *
- * @param x1 The X coordinate of the first point.
- * @param y1 The Y coordinate of the first point.
- * @param x2 The X coordinate of the second point.
- * @param y2 The Y coordinate of the second point.
- */
-public abstract void
-drawLine(int x1, int y1, int x2, int y2);
-
-/*************************************************************************/
-
-/**
- * Fills the area bounded by the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- */
-public abstract void
-fillRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws the outline of the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the draw rect.
- * @param y The Y coordinate of the upper left corner of the draw rect.
- * @param width The width of the draw rect.
- * @param height The height of the draw rect.
- */
-public void
-drawRect(int x, int y, int width, int height)
-{
- int x1 = x;
- int y1 = y;
- int x2 = x + width;
- int y2 = y + height;
- drawLine(x1, y1, x2, y1);
- drawLine(x2, y1, x2, y2);
- drawLine(x2, y2, x1, y2);
- drawLine(x1, y2, x1, y1);
-}
-
-/*************************************************************************/
-
-/**
- * Clears the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the clear rect.
- * @param y The Y coordinate of the upper left corner of the clear rect.
- * @param width The width of the clear rect.
- * @param height The height of the clear rect.
- */
-public abstract void
-clearRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws the outline of the specified rectangle with rounded cornders.
- *
- * @param x The X coordinate of the upper left corner of the draw rect.
- * @param y The Y coordinate of the upper left corner of the draw rect.
- * @param width The width of the draw rect.
- * @param height The height of the draw rect.
- * @param arcWidth The width of the corner arcs.
- * @param arcHeight The height of the corner arcs.
- */
-public abstract void
-drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
-
-/*************************************************************************/
-
-/**
- * Fills the specified rectangle with rounded cornders.
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- * @param arcWidth The width of the corner arcs.
- * @param arcHeight The height of the corner arcs.
- */
-public abstract void
-fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
-
-/*************************************************************************/
-
-public void
-draw3DRect(int x, int y, int width, int height, boolean raised)
-{
- Color color = getColor();
- Color tl = color.brighter();
- Color br = color.darker();
-
- if (!raised)
- {
- Color tmp = tl;
- tl = br;
- br = tmp;
- }
-
- int x1 = x;
- int y1 = y;
- int x2 = x + width;
- int y2 = y + height;
-
- setColor(tl);
- drawLine(x1, y1, x2, y1);
- drawLine(x1, y2, x1, y1);
- setColor(br);
- drawLine(x2, y1, x2, y2);
- drawLine(x2, y2, x1, y2);
- setColor(color);
-}
-
-/**
- * Fills the specified rectangle with a 3D effect
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- * @param raised true
if the rectangle appears raised,
- * false
if it should appear etched.
- */
-public void
-fill3DRect(int x, int y, int width, int height, boolean raised)
-{
- fillRect(x, y, width, height);
- draw3DRect(x, y, width-1, height-1, raised);
-}
-
-/*************************************************************************/
-
-/**
- * Draws an oval that just fits within the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-drawOval(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Fills an oval that just fits within the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-fillOval(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws an arc using the specified bounding rectangle and the specified
- * angle parameter. The arc is centered at the center of the rectangle.
- * The arc starts at the arcAngle position and extend for arcAngle
- * degrees. The degree origin is at the 3 o'clock position.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- * @param arcStart The beginning angle of the arc.
- * @param arcAngle The extent of the arc.
- */
-public abstract void
-drawArc(int x, int y, int width, int height, int arcStart, int arcAngle);
-
-/*************************************************************************/
-
-/**
- * Fills the arc define by the specified bounding rectangle and the specified
- * angle parameter. The arc is centered at the center of the rectangle.
- * The arc starts at the arcAngle position and extend for arcAngle
- * degrees. The degree origin is at the 3 o'clock position.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- * @param arcStart The beginning angle of the arc.
- * @param arcAngle The extent of the arc.
- */
-public abstract void
-fillArc(int x, int y, int width, int height, int arcStart, int arcAngle);
-
-/*************************************************************************/
-
-/**
- * Draws a series of interconnected lines determined by the arrays
- * of corresponding x and y coordinates.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-drawPolyline(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Draws a series of interconnected lines determined by the arrays
- * of corresponding x and y coordinates. The figure is closed if necessary
- * by connecting the first and last points.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-drawPolygon(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Draws the specified polygon.
- *
- * @param polygon The polygon to draw.
- */
-public void
-drawPolygon(Polygon polygon)
-{
- drawPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
-}
-
-/*************************************************************************/
-
-/**
- * Fills the polygon determined by the arrays
- * of corresponding x and y coordinates.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-fillPolygon(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Fills the specified polygon
- *
- * @param polygon The polygon to fill.
- */
-public void
-fillPolygon(Polygon polygon)
-{
- fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
-}
-
-/*************************************************************************/
-
-/**
- * Draws the specified string starting at the specified point.
- *
- * @param string The string to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- */
-public abstract void
-drawString(String string, int x, int y);
-
-public abstract void drawString (AttributedCharacterIterator ci, int x, int y);
-
-/*************************************************************************/
-
-/**
- * Draws the specified characters starting at the specified point.
- *
- * @param data The array of characters to draw.
- * @param offset The offset into the array to start drawing characters from.
- * @param length The number of characters to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- */
-public void
-drawChars(char data[], int offset, int length, int x, int y)
-{
- drawString(new String(data, offset, length), x, y);
-}
-
-public void
-drawBytes(byte[] data, int offset, int length, int x, int y)
-{
- String str = new String(data, offset, length);
- drawString(str, x, y);
-}
-
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. If the image
- * is not completely loaded, false
is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return true
if all the image data is available,
- * false
otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. The image
- * is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, false
is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param width The width of the rectangle to draw in.
- * @param height The height of the rectangle to draw in.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return true
if all the image data is available,
- * false
otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, int width, int height,
- ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. If the image
- * is not completely loaded, false
is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param bgcolor The background color to use for the image.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return true
if all the image data is available,
- * false
otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, Color bgcolor, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. The image
- * is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, false
is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param width The width of the rectangle to draw in.
- * @param height The height of the rectangle to draw in.
- * @param bgcolor The background color to use for the image.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return true
if all the image data is available,
- * false
otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, int width, int height, Color bgcolor,
- ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * FIXME: Write Javadocs for this when you understand it.
- */
-public abstract boolean
-drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
- int sx2, int sy2, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * FIXME: Write Javadocs for this when you understand it.
- */
-public abstract boolean
-drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
- int sx2, int sy2, Color bgcolor, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * Free any resources held by this graphics context immediately instead
- * of waiting for the object to be garbage collected and finalized.
- */
-public abstract void
-dispose();
-
-/*************************************************************************/
-
-/**
- * Frees the resources held by this graphics context when it is
- * garbage collected.
- */
-public void
-finalize()
-{
- dispose();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this object.
- *
- * @return A string representation of this object.
- */
-public String
-toString()
-{
- return getClass ().getName () + "[font=" + getFont () + ",color=" + getColor () + "]";
-}
-
-public boolean
-hitClip(int x, int y, int width, int height)
-{
- throw new UnsupportedOperationException("not implemented yet");
-}
-
-public Rectangle
-getClipBounds(Rectangle r)
-{
- Rectangle clipBounds = getClipBounds();
-
- if (r == null)
- return clipBounds;
-
- r.x = clipBounds.x;
- r.y = clipBounds.y;
- r.width = clipBounds.width;
- r.height = clipBounds.height;
- return r;
-}
-
-} // class Graphics
-
diff --git a/libjava/java/awt/Graphics2D.java b/libjava/java/awt/Graphics2D.java
deleted file mode 100644
index 3faa9dc0c66..00000000000
--- a/libjava/java/awt/Graphics2D.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.font.FontRenderContext;
-import java.awt.font.GlyphVector;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-import java.awt.image.ImageObserver;
-import java.awt.image.RenderedImage;
-import java.awt.image.renderable.RenderableImage;
-import java.text.AttributedCharacterIterator;
-import java.util.Map;
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public abstract class Graphics2D extends Graphics
-{
-
- protected Graphics2D()
- {
- }
-
- public void draw3DRect(int x, int y, int width, int height,
- boolean raised)
- {
- super.draw3DRect(x, y, width, height, raised);
- }
-
- public void fill3DRect(int x, int y, int width, int height,
- boolean raised)
- {
- super.fill3DRect(x, y, width, height, raised);
- }
-
- public abstract void draw(Shape shape);
-
- public abstract boolean drawImage(Image image, AffineTransform xform,
- ImageObserver obs);
-
- public abstract void drawImage(BufferedImage image,
- BufferedImageOp op,
- int x,
- int y);
-
- public abstract void drawRenderedImage(RenderedImage image,
- AffineTransform xform);
-
- public abstract void drawRenderableImage(RenderableImage image,
- AffineTransform xform);
-
- public abstract void drawString(String text, int x, int y);
-
- public abstract void drawString(String text, float x, float y);
-
- public abstract void drawString(AttributedCharacterIterator iterator,
- int x, int y);
-
- public abstract void drawString(AttributedCharacterIterator iterator,
- float x, float y);
-
- // public abstract void drawGlyphVector(GlyphVector g, float x, float y);
-
- public abstract void fill(Shape shape);
-
- public abstract boolean hit(Rectangle rect, Shape text,
- boolean onStroke);
-
- public abstract GraphicsConfiguration getDeviceConfiguration();
-
- public abstract void setComposite(Composite comp);
-
- public abstract void setPaint(Paint paint);
-
- public abstract void setStroke(Stroke stroke);
-
- public abstract void setRenderingHint(RenderingHints.Key hintKey,
- Object hintValue);
-
- public abstract Object getRenderingHint(RenderingHints.Key hintKey);
-
- public abstract void setRenderingHints(Map hints);
-
- public abstract void addRenderingHints(Map hints);
-
- public abstract RenderingHints getRenderingHints();
-
- public abstract void translate(int x, int y);
-
- public abstract void translate(double tx, double ty);
-
- public abstract void rotate(double theta);
-
- public abstract void rotate(double theta, double x, double y);
-
- public abstract void scale(double scaleX, double scaleY);
-
- public abstract void shear(double shearX, double shearY);
-
- public abstract void transform(AffineTransform Tx);
-
- public abstract void setTransform(AffineTransform Tx);
-
- public abstract AffineTransform getTransform();
-
- public abstract Paint getPaint();
-
- public abstract Composite getComposite();
-
- public abstract void setBackground(Color color);
-
- public abstract Color getBackground();
-
- public abstract Stroke getStroke();
-
- public abstract void clip(Shape s);
-
- public abstract FontRenderContext getFontRenderContext ();
-
- public abstract void drawGlyphVector (GlyphVector g, float x, float y);
-}
diff --git a/libjava/java/awt/GraphicsConfigTemplate.java b/libjava/java/awt/GraphicsConfigTemplate.java
deleted file mode 100644
index e46888378fe..00000000000
--- a/libjava/java/awt/GraphicsConfigTemplate.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/* GraphicsConfigTemplate.java -- a template for selecting configurations
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-
-/**
- * This allows filtering an array of GraphicsConfigurations for the best
- * one based on various requirements. The resulting configuration has had
- * all non-default attributes set as required to meet or exceed the request.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see GraphicsConfiguration
- * @see GraphicsDevice
- * @since 1.2
- * @status updated to 1.4
- */
-public abstract class GraphicsConfigTemplate implements Serializable
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -8061369279557787079L;
-
- /** States that a feature is required to select a configuration. */
- public static final int REQUIRED = 1;
-
- /**
- * States that a feature is preferred, but not required, to select a
- * configuration. In the case of multiple valid configurations, the tie
- * breaks in favor of the one with the feature.
- */
- public static final int PREFERRED = 2;
-
- /**
- * States that a feature is not necessary in the configuration. In the case
- * of multiple valid configurations, the tie breaks in favor of the one
- * without the feature, to reduce overhead.
- */
- public static final int UNNECESSARY = 3;
-
- /**
- * The default constructor.
- */
- public GraphicsConfigTemplate()
- {
- }
-
- /**
- * Returns the "best" match among the array of possible configurations, given
- * the criteria of this template.
- *
- * @param array the array to choose from
- * @return the best match
- * @throws NullPointerException if array is null
- */
- public abstract GraphicsConfiguration getBestConfiguration
- (GraphicsConfiguration[] array);
-
- /**
- * Returns true if the given configuration supports all the features required
- * by this template.
- *
- * @param config the configuration to test
- * @return true if it is a match
- * @throws NullPointerException if config is null
- */
- public abstract boolean isGraphicsConfigSupported
- (GraphicsConfiguration config);
-} // class GraphicsConfigTemplate
diff --git a/libjava/java/awt/GraphicsConfiguration.java b/libjava/java/awt/GraphicsConfiguration.java
deleted file mode 100644
index 6dc27793d43..00000000000
--- a/libjava/java/awt/GraphicsConfiguration.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/* GraphicsConfiguration.java -- describes characteristics of graphics
- Copyright (C) 2000, 2001, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.awt.image.ColorModel;
-import java.awt.image.VolatileImage;
-
-/**
- * This class describes the configuration of various graphics devices, such
- * as a monitor or printer. Different configurations may exist for the same
- * device, according to the different native modes supported.
- *
- * isFullScreenSupported()
returns true, full screen mode is
- * considered to be exclusive, which implies:
- *
Component.enableInputMethods(false)
to make a component
- * a non-client of the input method framework.
- * If isFullScreenSupported()
returns false, full-screen
- * exclusive mode is simulated by resizing the window to the size of the
- * screen and positioning it at (0,0). This is also what this method does.
- * If a device supports real fullscreen mode then it should override this
- * method as well as #isFullScreenSupported and #getFullScreenWindow.
- *
- * @param w the window to toggle
- * @see #isFullScreenSupported()
- * @see getFullScreenWindow()
- * @see setDisplayMode(DisplayMode)
- * @see Component#enableInputMethods(boolean)
- * @since 1.4
- */
- public synchronized void setFullScreenWindow(Window w)
- {
- // Restore the previous window to normal mode and release the reference.
- if (full_screen != null)
- {
- full_screen.setBounds(fullScreenOldBounds);
- }
-
- full_screen = null;
-
- // If w != null, make it full-screen.
- if (w != null)
- {
- fullScreenOldBounds = w.getBounds();
- full_screen = w;
- DisplayMode dMode = getDisplayMode();
- full_screen.setBounds(0, 0, dMode.getWidth(), dMode.getHeight());
- full_screen.requestFocus();
- full_screen.setLocationRelativeTo(null);
- }
- }
-
- /**
- * Returns the current full-screen window of the device, or null if no
- * window is full-screen.
- *
- * @return the full-screen window
- * @see #setFullScreenWindow(Window)
- * @since 1.4
- */
- public Window getFullScreenWindow()
- {
- return full_screen;
- }
-
- /**
- * Returns whether this device supports low-level display changes. This may
- * depend on whether full-screen exclusive mode is available.
- *
- * XXX The default implementation returns false for now.
- *
- * @return true if display changes are supported
- * @see #setDisplayMode(DisplayMode)
- * @since 1.4
- */
- public boolean isDisplayChangeSupported()
- {
- return false;
- }
-
- /**
- * Sets the display mode. This may be dependent on the availability of
- * full-screen exclusive mode.
- *
- * @param mode the new mode
- * @throws IllegalArgumentException if the new mode is not in getDisplayModes
- * @throws UnsupportedOperationException if ! isDisplayChangeSupported()
- * @see #getDisplayMode()
- * @see #getDisplayModes()
- * @see #isDisplayChangeSupported()
- * @since 1.4
- */
- public void setDisplayMode(DisplayMode mode)
- {
- DisplayMode[] array = getDisplayModes();
- if (! isDisplayChangeSupported())
- throw new UnsupportedOperationException();
- int i = array == null ? 0 : array.length;
- while (--i >= 0)
- if (array[i].equals(mode))
- break;
- if (i < 0)
- throw new IllegalArgumentException();
- this.mode = mode;
- }
-
- /**
- * Returns the current display mode of this device, or null if unknown.
- *
- * @return the current display mode
- * @see #setDisplayMode(DisplayMode)
- * @see #getDisplayModes()
- * @since 1.4
- */
- public DisplayMode getDisplayMode()
- {
- return mode;
- }
-
- /**
- * Return an array of all available display modes. This implementation
- * returns a 0-length array, so subclasses must override this.
- *
- * @return the array of available modes
- * @since 1.4
- */
- public DisplayMode[] getDisplayModes()
- {
- return new DisplayMode[0];
- }
-
- /**
- * Return the number of bytes available in accelerated memory on this
- * device. The device may support creation or caching on a first-come,
- * first-served basis, depending on the operating system and driver.
- * Memory may be a finite resource, and because of multi-threading, you
- * are not guaranteed that the result of this method ensures your image
- * will successfully be put in accelerated memory. A negative result means
- * the memory is unlimited. The default implementation assumes no special
- * memory is available, and returns 0.
- *
- * @return the size of accelerated memory available
- * @see VolatileImage#flush()
- * @see ImageCapabilities#isAccelerated()
- */
- public int getAvailableAcceleratedMemory()
- {
- return 0;
- }
-} // class GraphicsDevice
diff --git a/libjava/java/awt/GraphicsEnvironment.java b/libjava/java/awt/GraphicsEnvironment.java
deleted file mode 100644
index a82e7a357de..00000000000
--- a/libjava/java/awt/GraphicsEnvironment.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/* GraphicsEnvironment.java -- information about the graphics environment
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import gnu.java.awt.ClasspathToolkit;
-import gnu.classpath.SystemProperties;
-import java.awt.image.BufferedImage;
-import java.util.Locale;
-
-/**
- * This descibes the collection of GraphicsDevice and Font objects available
- * on a given platform. The resources might be local or remote, and specify
- * the valid configurations for displaying graphics.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see GraphicsDevice
- * @see GraphicsConfiguration
- * @since 1.4
- * @status updated to 1.4
- */
-public abstract class GraphicsEnvironment
-{
- private static GraphicsEnvironment localGraphicsEnvironment;
-
- /**
- * The environment must be obtained from a factory or query method, hence
- * this constructor is protected.
- */
- protected GraphicsEnvironment()
- {
- }
-
- /**
- * Returns the local graphics environment. If the java.awt.graphicsenv
- * system property is set, it instantiates the specified class,
- * otherwise it assume that the awt toolkit is a ClasspathToolkit
- * and delegates to it to create the instance.
- *
- * @return the local environment
- */
- public static GraphicsEnvironment getLocalGraphicsEnvironment()
- {
- if (localGraphicsEnvironment != null)
- return localGraphicsEnvironment;
-
- String graphicsenv = SystemProperties.getProperty("java.awt.graphicsenv",
- null);
- if (graphicsenv != null)
- {
- try
- {
- // We intentionally use the bootstrap class loader.
- localGraphicsEnvironment = (GraphicsEnvironment)
- Class.forName(graphicsenv).newInstance();
- return localGraphicsEnvironment;
- }
- catch (Exception x)
- {
- throw (InternalError)
- new InternalError("Unable to instantiate java.awt.graphicsenv")
- .initCause(x);
- }
- }
- else
- {
- ClasspathToolkit tk;
- tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit());
- localGraphicsEnvironment = tk.getLocalGraphicsEnvironment();
- return localGraphicsEnvironment;
- }
- }
-
- /**
- * Check if the local environment is headless, meaning that it does not
- * support a display, keyboard, or mouse. Many methods in the Abstract
- * Windows Toolkit (java.awt) throw a {@link HeadlessException} if this
- * returns true.
- *
- * This method returns true if the java.awt.headless property is set
- * to "true".
- *
- * @return true if the environment is headless, meaning that graphics are
- * unsupported
- * @since 1.4
- */
- public static boolean isHeadless()
- {
- String headless = SystemProperties.getProperty("java.awt.headless", null);
- return "true".equalsIgnoreCase(headless);
- }
-
- /**
- * Check if the given environment is headless, meaning that it does not
- * support a display, keyboard, or mouse. Many methods in the Abstract
- * Windows Toolkit (java.awt) throw a {@link HeadlessException} if this
- * returns true. This default implementation returns isHeadless(), so
- * subclasses need only override it if they differ.
- *
- * @return true if the environment is headless, meaning that graphics are
- * unsupported
- * @since 1.4
- */
- public boolean isHeadlessInstance()
- {
- return isHeadless();
- }
-
- /**
- * Get an array of all the GraphicsDevice objects.
- *
- * @return the available graphics devices, may be 0 length
- * @throws HeadlessException if the environment is headless
- */
- public abstract GraphicsDevice[] getScreenDevices();
-
- /**
- * Get the default screen GraphicsDevice object.
- *
- * @return the default screen device
- * @throws HeadlessException if the environment is headless
- */
- public abstract GraphicsDevice getDefaultScreenDevice();
-
- /**
- * Return a Graphics2D object which will render into the specified image.
- *
- * @param image the image to render into
- * @return the object that renders into the image
- */
- public abstract Graphics2D createGraphics(BufferedImage image);
-
- /**
- * Returns an array of the one-point size fonts available in this
- * environment. From there, the user can select the font and derive the
- * correct one of proper size and attributes, using deriveFont
.
- * Only one master version of each font appears in this array; if a font
- * can be derived from another, it must be created in that way.
- *
- * @return the array of available fonts
- * @see #getAvailableFontFamilyNames()
- * @see Font#deriveFont(int, float)
- * @since 1.2
- */
- public abstract Font[] getAllFonts();
-
- /**
- * Returns an array of the font family names available in this environment.
- * This allows flexibility in choosing the style of font, while still letting
- * the Font class decide its best match.
- *
- * @return the array of available font families
- * @see #getAllFonts()
- * @see Font#getFamily()
- * @since 1.2
- */
- public abstract String[] getAvailableFontFamilyNames();
-
- /**
- * Returns an array of the font family names available in this environment,
- * localized to the current Locale if l is non-null. This allows
- * flexibility in choosing the style of font, while still letting the Font
- * class decide its best match.
- *
- * @param l the locale to use
- * @return the array of available font families, localized
- * @see #getAllFonts()
- * @see Font#getFamily()
- * @since 1.2
- */
- public abstract String[] getAvailableFontFamilyNames(Locale l);
-
- /**
- * Returns the point where a window should be centered. You should probably
- * also check that the window fits within the screen bounds. The default
- * simply returns the center of the maximum window bounds; subclasses should
- * override this if native objects (like scrollbars) make that off-centered.
- *
- * @return the centering point
- * @throws HeadlessException if the environment is headless
- * @see #getMaximumWindowBounds()
- * @since 1.4
- */
- public Point getCenterPoint()
- {
- Rectangle r = getMaximumWindowBounds();
- return new Point(r.x + r.width / 2, r.y + r.height / 2);
- }
-
- /**
- * Returns the maximum bounds for a centered window object. The default
- * implementation simply returns the bounds of the default configuration
- * of the default screen; subclasses should override this to if native
- * objects (like scrollbars) reduce what is truly available. Also,
- * subclasses should override this if the window should be centered across
- * a multi-screen display.
- *
- * @return the maximum window bounds
- * @throws HeadlessException if the environment is headless
- * @see #getCenterPoint()
- * @see GraphicsConfiguration#getBounds()
- * @see Toolkit#getScreenInsets(GraphicsConfiguration)
- * @since 1.4
- */
- public Rectangle getMaximumWindowBounds()
- {
- return getDefaultScreenDevice().getDefaultConfiguration().getBounds();
- }
-} // class GraphicsEnvironment
diff --git a/libjava/java/awt/GridBagConstraints.java b/libjava/java/awt/GridBagConstraints.java
deleted file mode 100644
index 8d8b4fae534..00000000000
--- a/libjava/java/awt/GridBagConstraints.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/* GridBagConstraints.java -- Constraints for GridBag layout manager
- Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-
-/**
- * This specifies the constraints for a component managed by the
- * GridBagLayout layout manager.
- */
-public class GridBagConstraints implements Cloneable, Serializable
-{
- static final long serialVersionUID = -1000070633030801713L;
-
- /** Fill in both directions. */
- public static final int BOTH = 1;
- /** Don't fill. */
- public static final int NONE = 0;
- /** Fill horizontally. */
- public static final int HORIZONTAL = 2;
- /** Fill vertically. */
- public static final int VERTICAL = 3;
-
- /** Position in the center. */
- public static final int CENTER = 10;
- /** Position to the east. */
- public static final int EAST = 13;
- /** Position to the north. */
- public static final int NORTH = 11;
- /** Position to the northeast. */
- public static final int NORTHEAST = 12;
- /** Position to the northwest. */
- public static final int NORTHWEST = 18;
- /** Position to the south. */
- public static final int SOUTH = 15;
- /** Position to the southeast. */
- public static final int SOUTHEAST = 14;
- /** Position to the southwest. */
- public static final int SOUTHWEST = 16;
- /** Position to the west. */
- public static final int WEST = 17;
-
- /** Occupy all remaining cells except last cell. */
- public static final int RELATIVE = -1;
- /** Occupy all remaining cells. */
- public static final int REMAINDER = 0;
-
- /**
- * Position to where the first text line would end. Equals to NORTHEAST for
- * horizontal left-to-right orientations.
- */
- public static final int FIRST_LINE_END = 24;
-
- /**
- * Position to where the first text line would start. Equals to NORTHWEST for
- * horizontal left-to-right orientations.
- */
- public static final int FIRST_LINE_START = 23;
-
- /**
- * Position to where the last text line would end. Equals to SOUTHEAST for
- * horizontal left-to-right orientations.
- */
- public static final int LAST_LINE_END = 26;
-
- /**
- * Position to where the last text line would start. Equals to SOUTHWEST for
- * horizontal left-to-right orientations.
- */
- public static final int LAST_LINE_START = 25;
-
- /**
- * Position to where a text line would end. Equals to EAST for
- * left-to-right orientations.
- */
- public static final int LINE_END = 22;
-
- /**
- * Position to where a text line would start. Equals to WEST for
- * left-to-right orientations.
- */
- public static final int LINE_START = 21;
-
- /**
- * Position to where a page ends. Equals SOUTH for horizontal orientations.
- */
- public static final int PAGE_END = 20;
-
- /**
- * Position to where a page starts. Equals NORTH for horizontal orientations.
- */
- public static final int PAGE_START = 19;
-
- public int anchor;
- public int fill;
- public int gridheight;
- public int gridwidth;
- public int gridx;
- public int gridy;
- public Insets insets;
- public int ipadx;
- public int ipady;
- public double weightx;
- public double weighty;
-
- /** Create a copy of this object. */
- public Object clone ()
- {
- try
- {
- GridBagConstraints g = (GridBagConstraints) super.clone ();
- g.insets = (Insets) insets.clone ();
- return g;
- }
- catch (CloneNotSupportedException _)
- {
- // Can't happen.
- return null;
- }
- }
-
- /** Create a new GridBagConstraints object with the default
- * parameters. */
- public GridBagConstraints ()
- {
- this.anchor = CENTER;
- this.fill = NONE;
- this.gridx = RELATIVE;
- this.gridy = RELATIVE;
- this.gridwidth = 1;
- this.gridheight = 1;
- this.ipadx = 0;
- this.ipady = 0;
- this.insets = new Insets (0, 0, 0, 0);
- this.weightx = 0;
- this.weighty = 0;
- }
-
- /** Create a new GridBagConstraints object with the indicated
- * parameters. */
- public GridBagConstraints (int gridx, int gridy,
- int gridwidth, int gridheight,
- double weightx, double weighty,
- int anchor, int fill,
- Insets insets, int ipadx, int ipady)
- {
- this.anchor = anchor;
- this.fill = fill;
- this.gridx = gridx;
- this.gridy = gridy;
- this.gridwidth = gridwidth;
- this.gridheight = gridheight;
- this.ipadx = ipadx;
- this.ipady = ipady;
- this.insets = insets;
- this.weightx = weightx;
- this.weighty = weighty;
- }
-}
diff --git a/libjava/java/awt/GridBagLayout.java b/libjava/java/awt/GridBagLayout.java
deleted file mode 100644
index efa429dc327..00000000000
--- a/libjava/java/awt/GridBagLayout.java
+++ /dev/null
@@ -1,1067 +0,0 @@
-/* GridBagLayout - Layout manager for components according to GridBagConstraints
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Hashtable;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- * @author Jeroen Frijters (jeroen@frijters.net)
- */
-public class GridBagLayout
- implements Serializable, LayoutManager2
-{
- private static final long serialVersionUID = 8838754796412211005L;
-
- protected static final int MINSIZE = 1;
- protected static final int PREFERREDSIZE = 2;
- protected static final int MAXGRIDSIZE = 512;
-
- // comptable remembers the original contraints given to us.
- // internalcomptable is used to keep track of modified constraint values
- // that we calculate, particularly when we are given RELATIVE and
- // REMAINDER constraints.
- // Constraints kept in comptable are never modified, and constraints
- // kept in internalcomptable can be modified internally only.
- protected Hashtable comptable;
- private Hashtable internalcomptable;
- protected GridBagLayoutInfo layoutInfo;
- protected GridBagConstraints defaultConstraints;
-
- public double[] columnWeights;
- public int[] columnWidths;
- public double[] rowWeights;
- public int[] rowHeights;
-
- public GridBagLayout ()
- {
- this.comptable = new Hashtable();
- this.internalcomptable = new Hashtable();
- this.defaultConstraints= new GridBagConstraints();
- }
-
- /**
- * Helper method to calc the sum of a range of elements in an int array.
- */
- private int sumIntArray (int[] array, int upto)
- {
- int result = 0;
-
- for (int i = 0; i < upto; i++)
- result += array [i];
-
- return result;
- }
-
- /**
- * Helper method to calc the sum of all elements in an int array.
- */
- private int sumIntArray (int[] array)
- {
- return sumIntArray(array, array.length);
- }
-
- /**
- * Helper method to calc the sum of all elements in an double array.
- */
- private double sumDoubleArray (double[] array)
- {
- double result = 0;
-
- for (int i = 0; i < array.length; i++)
- result += array [i];
-
- return result;
- }
-
- public void addLayoutComponent (String name, Component component)
- {
- // do nothing here.
- }
-
- public void removeLayoutComponent (Component component)
- {
- // do nothing here
- }
-
- public void addLayoutComponent (Component component, Object constraints)
- {
- if (constraints == null)
- return;
-
- if (!(constraints instanceof GridBagConstraints))
- throw new IllegalArgumentException();
-
- setConstraints (component, (GridBagConstraints) constraints);
- }
-
- public Dimension preferredLayoutSize (Container parent)
- {
- if (parent == null)
- return new Dimension (0, 0);
-
- GridBagLayoutInfo li = getLayoutInfo (parent, PREFERREDSIZE);
- return getMinSize (parent, li);
- }
-
- public Dimension minimumLayoutSize (Container parent)
- {
- if (parent == null)
- return new Dimension (0, 0);
-
- GridBagLayoutInfo li = getLayoutInfo (parent, MINSIZE);
- return getMinSize (parent, li);
- }
-
- public Dimension maximumLayoutSize (Container target)
- {
- return new Dimension (Integer.MAX_VALUE, Integer.MAX_VALUE);
- }
-
- public void layoutContainer (Container parent)
- {
- arrangeGrid (parent);
- }
-
- public float getLayoutAlignmentX (Container target)
- {
- return Component.CENTER_ALIGNMENT;
- }
-
- public float getLayoutAlignmentY (Container target)
- {
- return Component.CENTER_ALIGNMENT;
- }
-
- public void invalidateLayout (Container target)
- {
- this.layoutInfo = null;
- }
-
- public void setConstraints (Component component,
- GridBagConstraints constraints)
- {
- GridBagConstraints clone = (GridBagConstraints) constraints.clone();
-
- if (clone.gridx < 0)
- clone.gridx = GridBagConstraints.RELATIVE;
-
- if (clone.gridy < 0)
- clone.gridy = GridBagConstraints.RELATIVE;
-
- if (clone.gridwidth == 0)
- clone.gridwidth = GridBagConstraints.REMAINDER;
- else if (clone.gridwidth < 0
- && clone.gridwidth != GridBagConstraints.REMAINDER
- && clone.gridwidth != GridBagConstraints.RELATIVE)
- clone.gridwidth = 1;
-
- if (clone.gridheight == 0)
- clone.gridheight = GridBagConstraints.REMAINDER;
- else if (clone.gridheight < 0
- && clone.gridheight != GridBagConstraints.REMAINDER
- && clone.gridheight != GridBagConstraints.RELATIVE)
- clone.gridheight = 1;
-
- comptable.put (component, clone);
- }
-
- public GridBagConstraints getConstraints (Component component)
- {
- return (GridBagConstraints) (lookupConstraints (component).clone());
- }
-
- protected GridBagConstraints lookupConstraints (Component component)
- {
- GridBagConstraints result = (GridBagConstraints) comptable.get (component);
-
- if (result == null)
- {
- setConstraints (component, defaultConstraints);
- result = (GridBagConstraints) comptable.get (component);
- }
-
- return result;
- }
-
- private GridBagConstraints lookupInternalConstraints (Component component)
- {
- GridBagConstraints result =
- (GridBagConstraints) internalcomptable.get (component);
-
- if (result == null)
- {
- result = (GridBagConstraints) lookupConstraints(component).clone();
- internalcomptable.put (component, result);
- }
-
- return result;
- }
-
- /**
- * @since 1.1
- */
- public Point getLayoutOrigin ()
- {
- if (layoutInfo == null)
- return new Point (0, 0);
-
- return new Point (layoutInfo.pos_x, layoutInfo.pos_y);
- }
-
- /**
- * @since 1.1
- */
- public int[][] getLayoutDimensions ()
- {
- int[][] result = new int [2][];
- if (layoutInfo == null)
- {
- result[0] = new int[0];
- result[1] = new int[0];
-
- return result;
- }
-
- result [0] = new int [layoutInfo.cols];
- System.arraycopy (layoutInfo.colWidths, 0, result [0], 0, layoutInfo.cols);
- result [1] = new int [layoutInfo.rows];
- System.arraycopy (layoutInfo.rowHeights, 0, result [1], 0, layoutInfo.rows);
- return result;
- }
-
- public double[][] getLayoutWeights ()
- {
- double[][] result = new double [2][];
- if (layoutInfo == null)
- {
- result[0] = new double[0];
- result[1] = new double[0];
-
- return result;
- }
-
- result [0] = new double [layoutInfo.cols];
- System.arraycopy (layoutInfo.colWeights, 0, result [0], 0, layoutInfo.cols);
- result [1] = new double [layoutInfo.rows];
- System.arraycopy (layoutInfo.rowWeights, 0, result [1], 0, layoutInfo.rows);
- return result;
- }
-
- /**
- * @since 1.1
- */
- public Point location (int x, int y)
- {
- if (layoutInfo == null)
- return new Point (0, 0);
-
- int col;
- int row;
- int pixel_x = layoutInfo.pos_x;
- int pixel_y = layoutInfo.pos_y;
-
- for (col = 0; col < layoutInfo.cols; col++)
- {
- int w = layoutInfo.colWidths [col];
- if (x < pixel_x + w)
- break;
-
- pixel_x += w;
- }
-
- for (row = 0; row < layoutInfo.rows; row++)
- {
- int h = layoutInfo.rowHeights [row];
- if (y < pixel_y + h)
- break;
-
- pixel_y += h;
- }
-
- return new Point (col, row);
- }
-
- /**
- * Obsolete.
- */
- protected void AdjustForGravity (GridBagConstraints gbc, Rectangle rect)
- {
- // FIXME
- throw new Error ("Not implemented");
- }
-
- /**
- * Obsolete.
- */
- protected void ArrangeGrid (Container parent)
- {
- Component[] components = parent.getComponents();
-
- if (components.length == 0)
- return;
-
- GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE);
- if (info.cols == 0 && info.rows == 0)
- return;
- layoutInfo = info;
-
- // DEBUG
- //dumpLayoutInfo (layoutInfo);
-
- for(int i = 0; i < components.length; i++)
- {
- Component component = components [i];
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints =
- lookupInternalConstraints(component);
-
- int cellx = sumIntArray(layoutInfo.colWidths, constraints.gridx);
- int celly = sumIntArray(layoutInfo.rowHeights, constraints.gridy);
- int cellw = sumIntArray(layoutInfo.colWidths,
- constraints.gridx + constraints.gridwidth) - cellx;
- int cellh = sumIntArray(layoutInfo.rowHeights,
- constraints.gridy + constraints.gridheight) - celly;
-
- Insets insets = constraints.insets;
- if (insets != null)
- {
- cellx += insets.left;
- celly += insets.top;
- cellw -= insets.left + insets.right;
- cellh -= insets.top + insets.bottom;
- }
-
- Dimension dim = component.getPreferredSize();
-
- // Note: Documentation says that padding is added on both sides, but
- // visual inspection shows that the Sun implementation only adds it
- // once, so we do the same.
- dim.width += constraints.ipadx;
- dim.height += constraints.ipady;
-
- switch(constraints.fill)
- {
- case GridBagConstraints.HORIZONTAL:
- dim.width = cellw;
- break;
- case GridBagConstraints.VERTICAL:
- dim.height = cellh;
- break;
- case GridBagConstraints.BOTH:
- dim.width = cellw;
- dim.height = cellh;
- break;
- }
-
- int x;
- int y;
-
- switch(constraints.anchor)
- {
- case GridBagConstraints.NORTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly;
- break;
- case GridBagConstraints.SOUTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + cellh - dim.height;
- break;
- case GridBagConstraints.WEST:
- x = cellx;
- y = celly + (cellh - dim.height) / 2;
- break;
- case GridBagConstraints.EAST:
- x = cellx + cellw - dim.width;
- y = celly + (cellh - dim.height) / 2;
- break;
- case GridBagConstraints.NORTHEAST:
- x = cellx + cellw - dim.width;
- y = celly;
- break;
- case GridBagConstraints.NORTHWEST:
- x = cellx;
- y = celly;
- break;
- case GridBagConstraints.SOUTHEAST:
- x = cellx + cellw - dim.width;
- y = celly + cellh - dim.height;
- break;
- case GridBagConstraints.SOUTHWEST:
- x = cellx;
- y = celly + cellh - dim.height;
- break;
- default:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + (cellh - dim.height) / 2;
- break;
- }
-
- component.setBounds(layoutInfo.pos_x + x, layoutInfo.pos_y + y, dim.width, dim.height);
- }
-
- // DEBUG
- //dumpLayoutInfo (layoutInfo);
- }
-
- /**
- * Obsolete.
- */
- protected GridBagLayoutInfo GetLayoutInfo (Container parent, int sizeflag)
- {
- if (sizeflag != MINSIZE && sizeflag != PREFERREDSIZE)
- throw new IllegalArgumentException();
-
- Dimension parentDim = parent.getSize ();
- Insets parentInsets = parent.getInsets ();
- parentDim.width -= parentInsets.left + parentInsets.right;
- parentDim.height -= parentInsets.top + parentInsets.bottom;
-
- int current_y = 0;
- int max_x = 0;
- int max_y = 0;
-
- // Guaranteed to contain the last component added to the given row
- // or column, whose gridwidth/height is not REMAINDER.
- HashMap lastInRow = new HashMap();
- HashMap lastInCol = new HashMap();
-
- Component[] components = parent.getComponents();
-
- // Components sorted by gridwidths/heights,
- // smallest to largest, with REMAINDER and RELATIVE at the end.
- // These are useful when determining sizes and weights.
- ArrayList sortedByWidth = new ArrayList(components.length);
- ArrayList sortedByHeight = new ArrayList(components.length);
-
- // STEP 1: first we figure out how many rows/columns
- for (int i = 0; i < components.length; i++)
- {
- Component component = components [i];
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- // When looking up the constraint for the first time, check the
- // original unmodified constraint. After the first time, always
- // refer to the internal modified constraint.
- GridBagConstraints originalConstraints = lookupConstraints (component);
- GridBagConstraints constraints = (GridBagConstraints) originalConstraints.clone();
- internalcomptable.put(component, constraints);
-
- // Cases:
- //
- // 1. gridy == RELATIVE, gridx == RELATIVE
- //
- // use y as the row number; check for the next
- // available slot at row y
- //
- // 2. only gridx == RELATIVE
- //
- // check for the next available slot at row gridy
- //
- // 3. only gridy == RELATIVE
- //
- // check for the next available slot at column gridx
- //
- // 4. neither gridx or gridy == RELATIVE
- //
- // nothing to check; just add it
-
-
- // cases 1 and 2
- if(constraints.gridx == GridBagConstraints.RELATIVE)
- {
- if (constraints.gridy == GridBagConstraints.RELATIVE)
- constraints.gridy = current_y;
-
- int x;
-
- // Check the component that occupies the right-most spot in this
- // row. We want to add this component after it.
- // If this row is empty, add to the 0 position.
- if (!lastInRow.containsKey(new Integer(constraints.gridy)))
- x = 0;
- else
- {
- Component lastComponent = (Component) lastInRow.get(new Integer(constraints.gridy));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
- x = lastConstraints.gridx + Math.max(1, lastConstraints.gridwidth);
- }
-
- // Determine if this component will fit in the slot vertically.
- // If not, bump it over to where it does fit.
- for (int y = constraints.gridy + 1; y < constraints.gridy + Math.max(1, constraints.gridheight); y++)
- {
- if (lastInRow.containsKey(new Integer(y)))
- {
- Component lastComponent = (Component) lastInRow.get(new Integer(y));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
- x = Math.max (x,
- lastConstraints.gridx + Math.max(1, lastConstraints.gridwidth));
- }
- }
-
- constraints.gridx = x;
- }
- // case 3
- else if(constraints.gridy == GridBagConstraints.RELATIVE)
- {
- int y;
- // Check the component that occupies the bottom-most spot in
- // this column. We want to add this component below it.
- // If this column is empty, add to the 0 position.
- if (!lastInCol.containsKey(new Integer(constraints.gridx)))
- y = 0;
- else
- {
- Component lastComponent = (Component)lastInCol.get(new Integer(constraints.gridx));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
- y = lastConstraints.gridy + Math.max(1, lastConstraints.gridheight);
- }
-
- // Determine if this component will fit in the slot horizontally.
- // If not, bump it down to where it does fit.
- for (int x = constraints.gridx + 1; x < constraints.gridx + Math.max(1, constraints.gridwidth); x++)
- {
- if (lastInCol.containsKey(new Integer(x)))
- {
- Component lastComponent = (Component) lastInCol.get(new Integer(x));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
- y = Math.max (y,
- lastConstraints.gridy + Math.max(1, lastConstraints.gridheight));
- }
- }
-
- constraints.gridy = y;
- }
- // case 4: do nothing
-
- max_x = Math.max(max_x,
- constraints.gridx + Math.max(1, constraints.gridwidth));
- max_y = Math.max(max_y,
- constraints.gridy + Math.max(1, constraints.gridheight));
-
- sortBySpan(component, constraints.gridwidth, sortedByWidth, true);
- sortBySpan(component, constraints.gridheight, sortedByHeight, false);
-
- // Update our reference points for RELATIVE gridx and gridy.
- if(constraints.gridwidth == GridBagConstraints.REMAINDER)
- {
- current_y = constraints.gridy + Math.max(1, constraints.gridheight);
- }
- else if (constraints.gridwidth != GridBagConstraints.REMAINDER)
- {
- for (int y = constraints.gridy; y < constraints.gridy + Math.max(1, constraints.gridheight); y++)
- {
- if(lastInRow.containsKey(new Integer(y)))
- {
- Component lastComponent = (Component) lastInRow.get(new Integer(y));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
- if (constraints.gridx > lastConstraints.gridx)
- {
- lastInRow.put(new Integer(y), component);
- }
- }
- else
- {
- lastInRow.put(new Integer(y), component);
- }
- }
-
- for (int x = constraints.gridx; x < constraints.gridx + Math.max(1, constraints.gridwidth); x++)
- {
- if(lastInCol.containsKey(new Integer(x)))
- {
- Component lastComponent = (Component) lastInCol.get(new Integer(x));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
- if (constraints.gridy > lastConstraints.gridy)
- {
- lastInCol.put(new Integer(x), component);
- }
- }
- else
- {
- lastInCol.put(new Integer(x), component);
- }
- }
- }
- } // end of STEP 1
-
- GridBagLayoutInfo info = new GridBagLayoutInfo(max_x, max_y);
-
- // Check if column widths and row heights are overridden.
-
- for (int x = 0; x < max_x; x++)
- {
- if(columnWidths != null && columnWidths.length > x)
- info.colWidths[x] = columnWidths[x];
- if(columnWeights != null && columnWeights.length > x)
- info.colWeights[x] = columnWeights[x];
- }
-
- for (int y = 0; y < max_y; y++)
- {
- if(rowHeights != null && rowHeights.length > y)
- info.rowHeights[y] = rowHeights[y];
- if(rowWeights != null && rowWeights.length > y)
- info.rowWeights[y] = rowWeights[y];
- }
-
- // STEP 2: Fix up any cells with width/height as REMAINDER/RELATIVE.
- for (int i = 0; i < components.length; i++)
- {
- Component component = components [i];
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints = lookupInternalConstraints (component);
-
- if(constraints.gridwidth == GridBagConstraints.REMAINDER || constraints.gridwidth == GridBagConstraints.RELATIVE)
- {
- if(constraints.gridwidth == GridBagConstraints.REMAINDER)
- {
- for (int y = constraints.gridy; y < constraints.gridy + Math.max(1, constraints.gridheight); y++)
- {
- if (lastInRow.containsKey(new Integer(y)))
- {
- Component lastComponent = (Component) lastInRow.get(new Integer(y));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
-
- if (lastConstraints.gridwidth == GridBagConstraints.RELATIVE)
- {
- constraints.gridx = max_x - 1;
- break;
- }
- else
- {
- constraints.gridx = Math.max (constraints.gridx,
- lastConstraints.gridx + Math.max (1, lastConstraints.gridwidth));
- }
- }
- }
- constraints.gridwidth = max_x - constraints.gridx;
- }
- else if (constraints.gridwidth == GridBagConstraints.RELATIVE)
- {
- constraints.gridwidth = max_x - constraints.gridx - 1;
- }
-
- // Re-sort
- sortedByWidth.remove(sortedByWidth.indexOf(component));
- sortBySpan(component, constraints.gridwidth, sortedByWidth, true);
- }
-
- if(constraints.gridheight == GridBagConstraints.REMAINDER || constraints.gridheight == GridBagConstraints.RELATIVE)
- {
- if(constraints.gridheight == GridBagConstraints.REMAINDER)
- {
- for (int x = constraints.gridx; x < constraints.gridx + Math.max(1, constraints.gridwidth); x++)
- {
- if (lastInCol.containsKey(new Integer(x)))
- {
- Component lastComponent = (Component) lastInRow.get(new Integer(x));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
-
- if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
- {
- constraints.gridy = max_y - 1;
- break;
- }
- else
- {
- constraints.gridy = Math.max (constraints.gridy,
- lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
- }
- }
- }
- constraints.gridheight = max_y - constraints.gridy;
- }
- else if (constraints.gridheight == GridBagConstraints.RELATIVE)
- {
- constraints.gridheight = max_y - constraints.gridy - 1;
- }
-
- // Re-sort
- sortedByHeight.remove(sortedByHeight.indexOf(component));
- sortBySpan(component, constraints.gridheight, sortedByHeight, false);
- }
- } // end of STEP 2
-
- // STEP 3: Determine sizes and weights for columns.
- for (int i = 0; i < sortedByWidth.size(); i++)
- {
- Component component = (Component) sortedByWidth.get(i);
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints = lookupInternalConstraints (component);
-
- int width = (sizeflag == PREFERREDSIZE) ?
- component.getPreferredSize().width :
- component.getMinimumSize().width;
-
- if(constraints.insets != null)
- width += constraints.insets.left + constraints.insets.right;
-
- width += constraints.ipadx;
-
- distributeSizeAndWeight(width,
- constraints.weightx,
- constraints.gridx,
- constraints.gridwidth,
- info.colWidths,
- info.colWeights);
- } // end of STEP 3
-
- // STEP 4: Determine sizes and weights for rows.
- for (int i = 0; i < sortedByHeight.size(); i++)
- {
- Component component = (Component) sortedByHeight.get(i);
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints = lookupInternalConstraints (component);
-
- int height = (sizeflag == PREFERREDSIZE) ?
- component.getPreferredSize().height :
- component.getMinimumSize().height;
-
- if(constraints.insets != null)
- height += constraints.insets.top + constraints.insets.bottom;
-
- height += constraints.ipady;
-
- distributeSizeAndWeight(height,
- constraints.weighty,
- constraints.gridy,
- constraints.gridheight,
- info.rowHeights,
- info.rowWeights);
- } // end of STEP 4
-
- // Adjust cell sizes iff parent size not zero.
- if (parentDim.width > 0 && parentDim.height > 0)
- {
- calcCellSizes (info.colWidths, info.colWeights, parentDim.width);
- calcCellSizes (info.rowHeights, info.rowWeights, parentDim.height);
- }
-
- int totalWidth = sumIntArray(info.colWidths);
- int totalHeight = sumIntArray(info.rowHeights);
-
- // Make sure pos_x and pos_y are never negative.
- if (totalWidth >= parentDim.width)
- info.pos_x = parentInsets.left;
- else
- info.pos_x = parentInsets.left + (parentDim.width - totalWidth) / 2;
-
- if (totalHeight >= parentDim.height)
- info.pos_y = parentInsets.top;
- else
- info.pos_y = parentInsets.top + (parentDim.height - totalHeight) / 2;
-
- // DEBUG
- //dumpLayoutInfo (info);
-
- return info;
- }
-
- /**
- * Obsolete.
- */
- protected Dimension GetMinSize (Container parent, GridBagLayoutInfo info)
- {
- if (parent == null || info == null)
- return new Dimension (0, 0);
-
- Insets insets = parent.getInsets();
- int width = sumIntArray (info.colWidths) + insets.left + insets.right;
- int height = sumIntArray (info.rowHeights) + insets.top + insets.bottom;
- return new Dimension (width, height);
- }
-
- /**
- * @since 1.4
- */
- protected Dimension getMinSize (Container parent, GridBagLayoutInfo info)
- {
- return GetMinSize (parent, info);
- }
-
- /**
- * Helper method used by GetLayoutInfo to keep components sorted, either
- * by gridwidth or gridheight.
- *
- * @param component Component to add to the sorted list.
- * @param span Either the component's gridwidth or gridheight.
- * @param list ArrayList
of components, sorted by
- * their span.
- * @param sortByWidth Flag indicating sorting index. If true, sort by
- * width. Otherwise, sort by height.
- * FIXME: Use a better sorting algorithm.
- */
- private void sortBySpan (Component component, int span, ArrayList list, boolean sortByWidth)
- {
- if (span == GridBagConstraints.REMAINDER
- || span == GridBagConstraints.RELATIVE)
- {
- // Put all RELATIVE and REMAINDER components at the end.
- list.add(component);
- }
- else
- {
- int i = 0;
- if (list.size() > 0)
- {
- GridBagConstraints gbc = lookupInternalConstraints((Component) list.get(i));
- int otherspan = sortByWidth ?
- gbc.gridwidth :
- gbc.gridheight;
- while (otherspan != GridBagConstraints.REMAINDER
- && otherspan != GridBagConstraints.RELATIVE
- && span >= otherspan)
- {
- i++;
- if (i < list.size())
- {
- gbc = lookupInternalConstraints((Component) list.get(i));
- otherspan = sortByWidth ?
- gbc.gridwidth :
- gbc.gridheight;
- }
- else
- break;
- }
- }
- list.add(i, component);
- }
- }
-
- /**
- * Helper method used by GetLayoutInfo to distribute a component's size
- * and weight.
- *
- * @param size Preferred size of component, with inset and padding
- * already added.
- * @param weight Weight of component.
- * @param start Starting position of component. Either
- * constraints.gridx or gridy.
- * @param span Span of component. either contraints.gridwidth or
- * gridheight.
- * @param sizes Sizes of rows or columns.
- * @param weights Weights of rows or columns.
- */
- private void distributeSizeAndWeight (int size, double weight,
- int start, int span,
- int[] sizes, double[] weights)
- {
- if (span == 1)
- {
- sizes[start] = Math.max(sizes[start], size);
- weights[start] = Math.max(weights[start], weight);
- }
- else
- {
- int numOccupied = span;
- int lastOccupied = -1;
-
- for(int i = start; i < start + span; i++)
- {
- if (sizes[i] == 0.0)
- numOccupied--;
- else
- {
- size -= sizes[i];
- lastOccupied = i;
- }
- }
-
- // A component needs to occupy at least one row.
- if(numOccupied == 0)
- sizes[start + span - 1] = size;
- else if (size > 0)
- sizes[lastOccupied] += size;
-
- calcCellWeights(weight, weights, start, span);
- }
- }
-
- /**
- * Helper method used by GetLayoutInfo to calculate weight distribution.
- * @param weight Weight of component.
- * @param weights Weights of rows/columns.
- * @param start Starting position of component in grid (gridx/gridy).
- * @param span Span of component (gridwidth/gridheight).
- */
- private void calcCellWeights (double weight, double[] weights, int start, int span)
- {
- double totalWeight = 0.0;
- for(int k = start; k < start + span; k++)
- totalWeight += weights[k];
-
- if(weight > totalWeight)
- {
- if (totalWeight == 0.0)
- {
- weights[start + span - 1] += weight;
- }
- else
- {
- double diff = weight - totalWeight ;
- double remaining = diff;
-
- for(int k = start; k < start + span; k++)
- {
- double extraWeight = diff * weights[k] / totalWeight;
- weights[k] += extraWeight;
- remaining -= extraWeight;
- }
-
- if (remaining > 0.0 && weights[start + span - 1] != 0.0)
- {
- weights[start + span - 1] += remaining;
- }
- }
- }
- }
-
- /**
- * Helper method used by GetLayoutInfo to distribute extra space
- * based on weight distribution.
- *
- * @param sizes Sizes of rows/columns.
- * @param weights Weights of rows/columns.
- * @param range Dimension of container.
- */
- private void calcCellSizes (int[] sizes, double[] weights, int range)
- {
- int totalSize = sumIntArray (sizes);
- double totalWeight = sumDoubleArray (weights);
-
- int diff = range - totalSize;
-
- if (diff == 0)
- return;
-
- for (int i = 0; i < sizes.length; i++)
- {
- int newsize = (int) (sizes[i] + (((double) diff) * weights [i] / totalWeight ));
-
- if (newsize > 0)
- sizes[i] = newsize;
- }
- }
-
- private void dumpLayoutInfo (GridBagLayoutInfo info)
- {
- System.out.println ("GridBagLayoutInfo:");
- System.out.println ("cols: " + info.cols + ", rows: " + info.rows);
- System.out.print ("colWidths: ");
- dumpArray(info.colWidths);
- System.out.print ("rowHeights: ");
- dumpArray(info.rowHeights);
- System.out.print ("colWeights: ");
- dumpArray(info.colWeights);
- System.out.print ("rowWeights: ");
- dumpArray(info.rowWeights);
- }
-
- private void dumpArray(int[] array)
- {
- String sep = "";
- for(int i = 0; i < array.length; i++)
- {
- System.out.print(sep);
- System.out.print(array[i]);
- sep = ", ";
- }
- System.out.println();
- }
-
- private void dumpArray(double[] array)
- {
- String sep = "";
- for(int i = 0; i < array.length; i++)
- {
- System.out.print(sep);
- System.out.print(array[i]);
- sep = ", ";
- }
- System.out.println();
- }
-
- /**
- * @since 1.4
- */
- protected void arrangeGrid (Container parent)
- {
- ArrangeGrid (parent);
- }
-
- /**
- * @since 1.4
- */
- protected GridBagLayoutInfo getLayoutInfo (Container parent, int sizeflag)
- {
- return GetLayoutInfo (parent, sizeflag);
- }
-
- /**
- * @since 1.4
- */
- protected void adjustForGravity (GridBagConstraints gbc, Rectangle rect)
- {
- AdjustForGravity (gbc, rect);
- }
-}
diff --git a/libjava/java/awt/GridBagLayoutInfo.java b/libjava/java/awt/GridBagLayoutInfo.java
deleted file mode 100644
index 43ba09d72c1..00000000000
--- a/libjava/java/awt/GridBagLayoutInfo.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* GridBagLayoutInfo -
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- */
-class GridBagLayoutInfo implements Serializable
-{
- private static final long serialVersionUID = -4899416460737170217L;
-
- int pos_x;
- int pos_y;
- int cols;
- int rows;
- int colWidths[];
- int rowHeights[];
- double colWeights[];
- double rowWeights[];
-
- GridBagLayoutInfo (int cols, int rows)
- {
- this.pos_x = 0;
- this.pos_y = 0;
- this.cols = cols;
- this.rows = rows;
- this.colWidths = new int [cols];
- this.rowHeights = new int [rows];
- this.colWeights = new double [cols];
- this.rowWeights = new double [rows];
- }
-}
diff --git a/libjava/java/awt/GridLayout.java b/libjava/java/awt/GridLayout.java
deleted file mode 100644
index 80d96414249..00000000000
--- a/libjava/java/awt/GridLayout.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/* GridLayout.java -- Grid-based layout engine
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-
-/** This class implements a grid-based layout scheme. Components are
- * all given the same size and are laid out from left to right and top
- * to bottom. A GridLayout is configured with a number of rows and a
- * number of columns. If both are specified, then the number of
- * columns is ignored and is derived from the number of rows and the
- * total number of components. If either is zero then that dimension
- * is computed based on the actual size of the container. An
- * exception is thrown if an attempt is made to set both the number of
- * rows and the number of columns to 0. This class also supports
- * horizontal and vertical gaps; these are used as spacing between
- * cells.
- *
- * @author Tom Tromey (tromey@redhat.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class GridLayout implements LayoutManager, Serializable
-{
- static final long serialVersionUID = -7411804673224730901L;
-
- /** Add a new component to the layout. This particular implementation
- * does nothing.
- * @param name The name of the component to add.
- * @param comp The component to add.
- */
- public void addLayoutComponent (String name, Component comp)
- {
- // Nothing.
- }
-
- /** Return the number of columns in this layout. */
- public int getColumns ()
- {
- return cols;
- }
-
- /** Return the horizontal gap. */
- public int getHgap ()
- {
- return hgap;
- }
-
- /** Return the number of rows in this layout. */
- public int getRows ()
- {
- return rows;
- }
-
- /** Return the vertical gap. */
- public int getVgap ()
- {
- return vgap;
- }
-
- /** Create a new GridLayout
with one row and any number
- * of columns. Both gaps are set to 0.
- */
- public GridLayout ()
- {
- this (1, 0, 0, 0);
- }
-
- /** Create a new GridLayout
with the specified number
- * of rows and columns. Both gaps are set to 0. Note that the row
- * and column settings cannot both be zero. If both the row and
- * column values are non-zero, the rows value takes precedence.
- * @param rows Number of rows
- * @param cols Number of columns
- * @exception IllegalArgumentException If rows and columns are both
- * 0, or if either are negative
- */
- public GridLayout (int rows, int cols)
- {
- this (rows, cols, 0, 0);
- }
-
- /** Create a new GridLayout with the specified number of rows and
- * columns and the specified gaps.
- * Note that the row and column settings cannot both be
- * zero. If both the row and column values are non-zero, the rows value
- * takes precedence.
- * @param rows Number of rows
- * @param cols Number of columns
- * @param hgap The horizontal gap
- * @param vgap The vertical gap
- * @exception IllegalArgumentException If rows and columns are both
- * 0, if either are negative, or if either gap is negative
- */
- public GridLayout (int rows, int cols, int hgap, int vgap)
- {
- if (rows < 0)
- throw new IllegalArgumentException ("number of rows cannot be negative");
- if (cols < 0)
- throw new IllegalArgumentException ("number of columns cannot be negative");
- if (rows == 0 && cols == 0)
- throw new IllegalArgumentException ("both rows and columns cannot be 0");
- if (hgap < 0)
- throw new IllegalArgumentException ("horizontal gap must be nonnegative");
- if (vgap < 0)
- throw new IllegalArgumentException ("vertical gap must be nonnegative");
- this.rows = rows;
- this.cols = cols;
- this.hgap = hgap;
- this.vgap = vgap;
- }
-
- /** Lay out the container's components based on current settings.
- * The free space in the container is divided evenly into the specified
- * number of rows and columns in this object.
- * @param parent The container to lay out
- */
- public void layoutContainer (Container parent)
- {
- synchronized (parent.getTreeLock ())
- {
- int num = parent.ncomponents;
-
- // There's no point, and handling this would mean adding special
- // cases.
- if (num == 0)
- return;
-
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- int real_rows = rows;
- int real_cols = cols;
- if (real_rows == 0)
- real_rows = (num + real_cols - 1) / real_cols;
- else
- real_cols = (num + real_rows - 1) / real_rows;
-
- // We might have less than a single row. In this case we expand
- // to fill.
- if (num < real_cols)
- real_cols = num;
-
- Dimension d = parent.getSize ();
- Insets ins = parent.getInsets ();
-
- // Compute width and height of each cell in the grid.
- int tw = d.width - ins.left - ins.right;
- tw = (tw - (real_cols - 1) * hgap) / real_cols;
- int th = d.height - ins.top - ins.bottom;
- th = (th - (real_rows - 1) * vgap) / real_rows;
-
- // If the cells are too small, still try to do something.
- if (tw < 0)
- tw = 1;
- if (th < 0)
- th = 1;
-
- int x = ins.left;
- int y = ins.top;
- int i = 0;
- int recount = 0;
-
- while (i < num)
- {
- comps[i].setBounds (x, y, tw, th);
-
- ++i;
- ++recount;
- if (recount == real_cols)
- {
- recount = 0;
- y += vgap + th;
- x = ins.left;
- }
- else
- x += hgap + tw;
- }
- }
- }
-
- /** Get the minimum layout size of the container.
- * @param cont The parent container
- */
- public Dimension minimumLayoutSize (Container cont)
- {
- return getSize (cont, true);
- }
-
- /** Get the preferred layout size of the container.
- * @param cont The parent container
- */
- public Dimension preferredLayoutSize (Container cont)
- {
- return getSize (cont, false);
- }
-
- /** Remove the indicated component from this layout manager.
- * This particular implementation does nothing.
- * @param comp The component to remove
- */
- public void removeLayoutComponent (Component comp)
- {
- // Nothing.
- }
-
- /** Set the number of columns.
- * @param newCols
- * @exception IllegalArgumentException If the number of columns is
- * negative, or if the number of columns is zero and the number
- * of rows is already 0.
- */
- public void setColumns (int newCols)
- {
- if (newCols < 0)
- throw new IllegalArgumentException ("number of columns cannot be negative");
- if (newCols == 0 && rows == 0)
- throw new IllegalArgumentException ("number of rows is already 0");
- this.cols = newCols;
- }
-
- /** Set the horizontal gap
- * @param hgap The horizontal gap
- * @exception IllegalArgumentException If the hgap value is less than zero.
- */
- public void setHgap (int hgap)
- {
- if (hgap < 0)
- throw new IllegalArgumentException ("horizontal gap must be nonnegative");
- this.hgap = hgap;
- }
-
- /** Set the number of rows
- * @param newRows
- * @exception IllegalArgumentException If the number of rows is
- * negative, or if the number of rows is zero and the number
- * of columns is already 0.
- */
- public void setRows (int newRows)
- {
- if (newRows < 0)
- throw new IllegalArgumentException ("number of rows cannot be negative");
- if (newRows == 0 && cols == 0)
- throw new IllegalArgumentException ("number of columns is already 0");
- this.rows = newRows;
- }
-
- /** Set the vertical gap.
- * @param vgap The vertical gap
- * @exception IllegalArgumentException If the vgap value is less than zero.
- */
- public void setVgap (int vgap)
- {
- if (vgap < 0)
- throw new IllegalArgumentException ("vertical gap must be nonnegative");
- this.vgap = vgap;
- }
-
- /** Return String description of this object. */
- public String toString ()
- {
- return ("[" + getClass ().getName ()
- + ",hgap=" + hgap + ",vgap=" + vgap
- + ",rows=" + rows + ",cols=" + cols
- + "]");
- }
-
- // This method is used to compute the various sizes.
- private Dimension getSize (Container parent, boolean is_min)
- {
- synchronized (parent.getTreeLock ())
- {
- int w = 0, h = 0, num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- for (int i = 0; i < num; ++i)
- {
- Dimension d;
-
- if (is_min)
- d = comps[i].getMinimumSize ();
- else
- d = comps[i].getPreferredSize ();
-
- w = Math.max (d.width, w);
- h = Math.max (d.height, h);
- }
-
- int real_rows = rows;
- int real_cols = cols;
- if (real_rows == 0)
- real_rows = (num + real_cols - 1) / real_cols;
- else
- real_cols = (num + real_rows - 1) / real_rows;
-
- Insets ins = parent.getInsets ();
- // We subtract out an extra gap here because the gaps are only
- // between cells.
- w = ins.left + ins.right + real_cols * (w + hgap) - hgap;
- h = ins.top + ins.bottom + real_rows * (h + vgap) - vgap;
- return new Dimension (w, h);
- }
- }
-
- /**
- * @serial The number of columns in the grid.
- */
- private int cols;
-
- /**
- * @serial The number of rows in the grid.
- */
- private int rows;
-
- /**
- * @serial The horizontal gap between columns
- */
- private int hgap;
-
- /**
- * @serial The vertical gap between rows
- */
- private int vgap;
-}
diff --git a/libjava/java/awt/HeadlessException.java b/libjava/java/awt/HeadlessException.java
deleted file mode 100644
index b180b1d86f7..00000000000
--- a/libjava/java/awt/HeadlessException.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* HeadlessException.java -- operation not possible in headless environment
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This exception is thrown when code dependent on a keyboard, mouse, or
- * display is executed in a headless environment.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.4
- * @status updated to 1.4
- */
-public class HeadlessException extends UnsupportedOperationException
-{
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = 167183644944358563L;
-
- /**
- * Create a new instance with no detailed error message.
- */
- public HeadlessException()
- {
- }
-
- /**
- * Create a new instance with the specified detailed error message.
- *
- * @param message the detailed error message
- */
- public HeadlessException(String message)
- {
- super(message);
- }
-} // class HeadlessException
diff --git a/libjava/java/awt/IllegalComponentStateException.java b/libjava/java/awt/IllegalComponentStateException.java
deleted file mode 100644
index 4a47f1da95d..00000000000
--- a/libjava/java/awt/IllegalComponentStateException.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* IllegalComponentStateException.java -- bad component state
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This exception is thrown when the requested operation failed because
- * a component was not in the proper state.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @status updated to 1.4
- */
-public class IllegalComponentStateException extends IllegalStateException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -1889339587208144238L;
-
- /**
- * Create a new instance with no detailed error message.
- */
- public IllegalComponentStateException()
- {
- }
-
- /**
- * Create a new instance with the specified detailed error message.
- *
- * @param message the detailed error message
- */
- public IllegalComponentStateException(String message)
- {
- super(message);
- }
-} // class IllegalComponentStateException
diff --git a/libjava/java/awt/Image.java b/libjava/java/awt/Image.java
deleted file mode 100644
index 32e30674cd7..00000000000
--- a/libjava/java/awt/Image.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Image.java -- superclass for images
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.FilteredImageSource;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.image.ReplicateScaleFilter;
-
-/**
- * This is the abstract superclass of all image objects in Java.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.0
- * @status updated to 1.4
- */
-public abstract class Image
-{
- /**
- * This variable is returned whenever a property that is not defined
- * is requested.
- */
- // For debug purposes, this might as well be a unique string.
- public static final Object UndefinedProperty
- = new String("undefined property");
-
- /**
- * Constant indicating that the default scaling algorithm should be used.
- *
- * @since 1.1
- */
- public static final int SCALE_DEFAULT = 1;
-
- /**
- * Constant indicating that a fast scaling algorithm should be used.
- *
- * @since 1.1
- */
- public static final int SCALE_FAST = 2;
-
- /**
- * Constant indicating that a smooth scaling algorithm should be used.
- *
- * @since 1.1
- */
- public static final int SCALE_SMOOTH = 4;
-
- /**
- * Constant indicating that the ReplicateScaleFilter
class
- * algorithm should be used for scaling.
- *
- * @see ReplicateScaleFilter
- * @since 1.1
- */
- public static final int SCALE_REPLICATE = 8;
-
- /**
- * Constant indicating that the area averaging scaling algorithm should be
- * used.
- *
- * @see AreaAveragingScaleFilter
- * @since 1.1
- */
- public static final int SCALE_AREA_AVERAGING = 16;
-
- /**
- * A default constructor for subclasses.
- */
- public Image()
- {
- }
-
- /**
- * Returns the width of the image, or -1 if it is unknown. If the
- * image width is unknown, the observer object will be notified when
- * the value is known.
- *
- * @param observer the image observer for this object
- * @return the width in pixels
- * @see #getHeight(ImageObserver)
- */
- public abstract int getWidth(ImageObserver observer);
-
- /**
- * Returns the height of the image, or -1 if it is unknown. If the
- * image height is unknown, the observer object will be notified when
- * the value is known.
- *
- * @param observer the image observer for this object
- * @return the height in pixels
- * @see #getWidth(ImageObserver)
- */
- public abstract int getHeight(ImageObserver observer);
-
- /**
- * Returns the image producer object for this object. The producer is the
- * object which generates pixels for this image.
- *
- * @return the image producer for this object
- */
- public abstract ImageProducer getSource();
-
- /**
- * Returns a graphics context object for drawing an off-screen object.
- * This method is only valid for off-screen objects.
- *
- * @return a graphics context object for an off-screen object
- * @see Graphics#createImage(int, int)
- */
- public abstract Graphics getGraphics();
-
- /**
- * This method requests a named property for an object. The value of the
- * property is returned. The value UndefinedProperty
is
- * returned if there is no property with the specified name. The value
- * null
is returned if the properties for the object are
- * not yet known. In this case, the specified image observer is notified
- * when the properties are known.
- *
- * @param name the requested property name
- * @param observer the image observer for this object
- * @return the named property, if available
- * @see #UndefinedProperty
- */
- public abstract Object getProperty(String name, ImageObserver observer);
-
- /**
- * Scales the image to the requested dimension. A new Image with asynchronous
- * loading will be produced according to the hints of the algorithm
- * requested. If either the width or height is non-positive, it is adjusted
- * to preserve the original aspect ratio.
- *
- * @param width the width of the scaled image
- * @param height the height of the scaled image
- * @param flags a value indicating the algorithm to use
- * @return the scaled Image
object
- * @see #SCALE_DEFAULT
- * @see #SCALE_FAST
- * @see #SCALE_SMOOTH
- * @see #SCALE_REPLICATE
- * @see #SCALE_AREA_AVERAGING
- * @since 1.1
- */
- public Image getScaledInstance(int width, int height, int flags)
- {
- switch (flags)
- {
- case SCALE_DEFAULT:
- case SCALE_FAST:
- case SCALE_REPLICATE:
- ImageProducer producer =
- new FilteredImageSource(this.getSource(),
- new ReplicateScaleFilter(width, height));
- return Toolkit.getDefaultToolkit().createImage(producer);
- case SCALE_SMOOTH:
- case SCALE_AREA_AVERAGING:
- default:
- throw new Error("not implemented");
- }
- }
-
- /**
- * Flushes (that is, destroys) any resources used for this image. This
- * includes the actual image data.
- */
- public abstract void flush();
-} // class Image
diff --git a/libjava/java/awt/ImageCapabilities.java b/libjava/java/awt/ImageCapabilities.java
deleted file mode 100644
index 2fe71d1e23b..00000000000
--- a/libjava/java/awt/ImageCapabilities.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ImageCapabilities.java -- the capabilities of an image buffer
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This class represents the capabilities of an image buffer. An
- * image buffer may be backed by accelerated graphics resources.
- * Those resources may or may not be volatile. This class is used to
- * describe these image buffer characteristics.
- */
-public class ImageCapabilities implements Cloneable
-{
- /**
- * Whether or not this the image buffer uses accelerated graphics
- * resources.
- */
- private final boolean accelerated;
-
- /**
- * Create a new image capability descriptor.
- *
- * @param accelerated true if the image buffer uses accelerated
- * graphics resources
- */
- public ImageCapabilities(boolean accelerated)
- {
- this.accelerated = accelerated;
- }
-
- /**
- * Returns whether or not the image buffer uses accelerated graphics
- * resources.
- *
- * @return true if the image buffer uses accelerated graphics
- * resources; false otherwise
- */
- public boolean isAccelerated()
- {
- return accelerated;
- }
-
- /**
- * Returns whether or not the image buffer's resources are volatile,
- * meaning that they can be reclaimed by the graphics system at any
- * time.
- *
- * @return true if the image buffer's resources are volatile; false
- * otherwise
- */
- public boolean isTrueVolatile()
- {
- return true;
- }
-
- /**
- * Clone this image capability descriptor.
- *
- * @return a clone of this image capability descriptor
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e);
- }
- }
-}
diff --git a/libjava/java/awt/Insets.java b/libjava/java/awt/Insets.java
deleted file mode 100644
index 7238a34e22a..00000000000
--- a/libjava/java/awt/Insets.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Insets.java -- information about a container border
- Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.io.Serializable;
-
-/**
- * This class represents the "margin" or space around a container.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @status
- */
-public class Insets implements Cloneable, Serializable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -2272572637695466749L;
-
- /**
- * The gap from the top.
- *
- * @serial the top inset
- */
- public int top;
-
- /**
- * The gap from the left.
- *
- * @serial the left inset
- */
- public int left;
-
- /**
- * The gap from the bottom.
- *
- * @serial the bottom inset
- */
- public int bottom;
-
- /**
- * The gap from the right.
- *
- * @serial the right inset
- */
- public int right;
-
- /**
- * Initializes a new instance of Inset
with the specified
- * inset values.
- *
- * @param top the top inset
- * @param left the left inset
- * @param bottom the bottom inset
- * @param right the right inset
- */
- public Insets(int top, int left, int bottom, int right)
- {
- this.top = top;
- this.left = left;
- this.bottom = bottom;
- this.right = right;
- }
-
- /**
- * Tests whether this object is equal to the specified object. The other
- * object must be an instance of Insets with identical field values.
- *
- * @param obj the object to test against
- * @return true if the specified object is equal to this one
- */
- public boolean equals(Object obj)
- {
- if (! (obj instanceof Insets))
- return false;
- Insets i = (Insets) obj;
- return top == i.top && bottom == i.bottom
- && left == i.left && right == i.right;
- }
-
- /**
- * Returns a hashcode for this instance. The formula is unspecified, but
- * appears to be XXX what is it?
.
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- // This can't be right...
- return top + bottom + left + right;
- }
-
- /**
- * Returns a string representation of this object, which will be non-null.
- * The format is unspecified, but appears to be XXX what is it?
.
- *
- * @return a string representation of this object
- */
- public String toString()
- {
- return getClass().getName() + "(top=" + top + ",bottom=" + bottom +
- ",left=" + left + ",right=" + right + ')';
- }
-
- /**
- * Returns a copy of this object.
- *
- * @return a copy of this object
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-} // class Insets
diff --git a/libjava/java/awt/ItemSelectable.java b/libjava/java/awt/ItemSelectable.java
deleted file mode 100644
index f155f723efe..00000000000
--- a/libjava/java/awt/ItemSelectable.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* ItemSelectable.java -- items that can be selected
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ItemListener;
-
-/**
- * This interface is for objects that can have one or more items selected.
- * For example, radio buttons.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.0
- * @status updated to 1.4
- */
-public interface ItemSelectable
-{
- /**
- * Returns the list of objects that are selected in this component.
- *
- * @return the list of selected objects, or null
- */
- Object[] getSelectedObjects();
-
- /**
- * Adds an item listener to this object. It will receive selection events
- * for this object by the user (but not programatically). If listener is
- * null, it is ignored.
- *
- * @param listener the item listener to add
- */
- void addItemListener(ItemListener listener);
-
- /**
- * Removes an item listener from this object.
- *
- * @param listener the item listener to remove
- */
- void removeItemListener(ItemListener listener);
-} // interface ItemSelectable
diff --git a/libjava/java/awt/JobAttributes.java b/libjava/java/awt/JobAttributes.java
deleted file mode 100644
index 2acb3a01ed3..00000000000
--- a/libjava/java/awt/JobAttributes.java
+++ /dev/null
@@ -1,500 +0,0 @@
-/* JobAttributes.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * Needs documentation...
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4, lacks documentation
- */
-public final class JobAttributes implements Cloneable
-{
- public static final class DefaultSelectionType extends AttributeValue
- {
- private static final String[] NAMES = { "all", "range", "selection" };
- public static final DefaultSelectionType ALL
- = new DefaultSelectionType(0);
- public static final DefaultSelectionType RANGE
- = new DefaultSelectionType(1);
- public static final DefaultSelectionType SELECTION
- = new DefaultSelectionType(2);
- private DefaultSelectionType(int value)
- {
- super(value, NAMES);
- }
- } // class DefaultSelectionType
-
- public static final class DestinationType extends AttributeValue
- {
- private static final String[] NAMES = { "file", "printer" };
- public static final DestinationType FILE = new DestinationType(0);
- public static final DestinationType PRINTER = new DestinationType(1);
- private DestinationType(int value)
- {
- super(value, NAMES);
- }
- } // class DestinationType
-
- public static final class DialogType extends AttributeValue
- {
- private static final String[] NAMES = { "common", "native", "none" };
- public static final DialogType COMMON = new DialogType(0);
- public static final DialogType NATIVE = new DialogType(1);
- public static final DialogType NONE = new DialogType(2);
- private DialogType(int value)
- {
- super(value, NAMES);
- }
- } // class DialogType
-
- public static final class MultipleDocumentHandlingType
- extends AttributeValue
- {
- private static final String[] NAMES = {
- "separate-documents-collated-copies",
- "separate-documents-uncollated-copies"
- };
- public static final MultipleDocumentHandlingType
- SEPARATE_DOCUMENTS_COLLATED_COPIES
- = new MultipleDocumentHandlingType(0);
- public static final MultipleDocumentHandlingType
- SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
- = new MultipleDocumentHandlingType(1);
- private MultipleDocumentHandlingType(int value)
- {
- super(value, NAMES);
- }
- } // class MultipleDocumentHandlingType
-
- public static final class SidesType extends AttributeValue
- {
- private static final String[] NAMES
- = { "one-sided", "two-sided-long-edge", "two-sided-short-edge" };
- public static final SidesType ONE_SIDED = new SidesType(0);
- public static final SidesType TWO_SIDED_LONG_EDGE = new SidesType(1);
- public static final SidesType TWO_SIDED_SHORT_EDGE = new SidesType(2);
- private SidesType(int value)
- {
- super(value, NAMES);
- }
- } // class SidesType
-
- private int copies;
- private DefaultSelectionType selection;
- private DestinationType destination;
- private DialogType dialog;
- private String filename;
- private int maxPage;
- private int minPage;
- private MultipleDocumentHandlingType multiple;
- private int[][] pageRanges; // null for default value
- private int fromPage; // 0 for default value
- private int toPage; // 0 for default value
- private String printer;
- private SidesType sides;
-
- public JobAttributes()
- {
- copies = 1;
- selection = DefaultSelectionType.ALL;
- destination = DestinationType.PRINTER;
- dialog = DialogType.NATIVE;
- maxPage = Integer.MAX_VALUE;
- minPage = 1;
- multiple
- = MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES;
- sides = SidesType.ONE_SIDED;
- }
-
- public JobAttributes(JobAttributes attr)
- {
- set(attr);
- }
-
- public JobAttributes(int copies, DefaultSelectionType selection,
- DestinationType destination, DialogType dialog,
- String filename, int max, int min,
- MultipleDocumentHandlingType multiple,
- int[][] pageRanges, String printer, SidesType sides)
- {
- if (copies <= 0 || selection == null || destination == null
- || dialog == null || max < min || min <= 0 || multiple == null
- || sides == null)
- throw new IllegalArgumentException();
- this.copies = copies;
- this.selection = selection;
- this.destination = destination;
- this.dialog = dialog;
- this.filename = filename;
- maxPage = max;
- minPage = min;
- this.multiple = multiple;
- setPageRanges(pageRanges);
- this.printer = printer;
- this.sides = sides;
- }
-
- public Object clone()
- {
- return new JobAttributes(this);
- }
-
- public void set(JobAttributes attr)
- {
- copies = attr.copies;
- selection = attr.selection;
- destination = attr.destination;
- dialog = attr.dialog;
- filename = attr.filename;
- maxPage = attr.maxPage;
- minPage = attr.minPage;
- multiple = attr.multiple;
- pageRanges = (int[][]) attr.pageRanges.clone();
- printer = attr.printer;
- sides = attr.sides;
- fromPage = attr.fromPage;
- toPage = attr.toPage;
- }
-
- public int getCopies()
- {
- return copies;
- }
-
- public void setCopies(int copies)
- {
- if (copies <= 0)
- throw new IllegalArgumentException();
- this.copies = copies;
- }
-
- public void setCopiesToDefault()
- {
- copies = 1;
- }
-
- public DefaultSelectionType getDefaultSelection()
- {
- return selection;
- }
-
- public void setDefaultSelection(DefaultSelectionType selection)
- {
- if (selection == null)
- throw new IllegalArgumentException();
- this.selection = selection;
- }
-
- public DestinationType getDestination()
- {
- return destination;
- }
-
- public void setDestination(DestinationType destination)
- {
- if (destination == null)
- throw new IllegalArgumentException();
- this.destination = destination;
- }
-
- public DialogType getDialog()
- {
- return dialog;
- }
-
- public void setDialog(DialogType dialog)
- {
- if (dialog == null)
- throw new IllegalArgumentException();
- this.dialog = dialog;
- }
-
- public String getFileName()
- {
- return filename;
- }
-
- public void setFileName(String filename)
- {
- this.filename = filename;
- }
-
- public int getFromPage()
- {
- return fromPage != 0 ? fromPage
- : pageRanges != null ? pageRanges[0][0]
- : toPage != 0 ? toPage : minPage;
- }
-
- public void setFromPage(int fromPage)
- {
- if (fromPage < minPage || (fromPage > toPage && toPage != 0)
- || fromPage > maxPage)
- throw new IllegalArgumentException();
- if (pageRanges == null)
- this.fromPage = fromPage;
- }
-
- public int getMaxPage()
- {
- return maxPage;
- }
-
- public void setMaxPage(int maxPage)
- {
- if (maxPage < minPage)
- throw new IllegalArgumentException();
- this.maxPage = maxPage;
- if (maxPage < fromPage)
- fromPage = maxPage;
- if (maxPage < toPage)
- toPage = maxPage;
- if (pageRanges != null)
- {
- int i = pageRanges.length - 1;
- while (i >= 0 && maxPage < pageRanges[i][1])
- i--;
- if (maxPage >= pageRanges[++i][0])
- pageRanges[i++][1] = maxPage;
- if (i == 0)
- pageRanges = null;
- else if (i < pageRanges.length)
- {
- int[][] tmp = new int[i][];
- System.arraycopy(pageRanges, 0, tmp, 0, i);
- pageRanges = tmp;
- }
- }
- }
-
- public int getMinPage()
- {
- return minPage;
- }
-
- public void setMinPage(int minPage)
- {
- if (minPage <= 0 || minPage > maxPage)
- throw new IllegalArgumentException();
- this.minPage = minPage;
- if (minPage > toPage)
- toPage = minPage;
- if (minPage > fromPage)
- fromPage = minPage;
- if (pageRanges != null)
- {
- int size = pageRanges.length;
- int i = 0;
- while (i < size && minPage > pageRanges[i][0])
- i++;
- if (minPage <= pageRanges[i - 1][1])
- pageRanges[--i][0] = minPage;
- if (i == size)
- pageRanges = null;
- else if (i > 0)
- {
- int[][] tmp = new int[size - i][];
- System.arraycopy(pageRanges, i, tmp, 0, size - i);
- pageRanges = tmp;
- }
- }
- }
-
- public MultipleDocumentHandlingType getMultipleDocumentHandling()
- {
- return multiple;
- }
-
- public void setMultipleDocumentHandling
- (MultipleDocumentHandlingType multiple)
- {
- if (multiple == null)
- throw new IllegalArgumentException();
- this.multiple = multiple;
- }
-
- public void setMultipleDocumentHandlingToDefault()
- {
- multiple
- = MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES;
- }
-
- public int[][] getPageRanges()
- {
- if (pageRanges == null)
- return new int[][] { { getFromPage(), getToPage() } };
- // Perform a deep clone, so user code cannot affect original arrays.
- int i = pageRanges.length;
- int[][] result = new int[i][];
- while (--i >= 0)
- result[i] = (int[]) pageRanges[i].clone();
- return result;
- }
-
- public void setPageRanges(int[][] pageRanges)
- {
- int size = pageRanges == null ? 0 : pageRanges.length;
- if (size == 0)
- throw new IllegalArgumentException();
- while (--size >= 0)
- {
- int[] range = pageRanges[size];
- if (range == null || range.length != 2
- || range[0] < minPage || range[1] < range[0] || range[1] > maxPage
- || (size != 0 && range[0] <= pageRanges[size - 1][1]))
- throw new IllegalArgumentException();
- }
- size = pageRanges.length;
- if (fromPage > 0 && pageRanges[0][0] > fromPage)
- fromPage = pageRanges[0][0];
- if (toPage > 0 && pageRanges[size - 1][1] < toPage)
- toPage = pageRanges[size - 1][1];
- this.pageRanges = new int[size][];
- while (--size >= 0)
- this.pageRanges[size] = (int[]) pageRanges[size].clone();
- }
-
- public String getPrinter()
- {
- return printer;
- }
-
- public void setPrinter(String printer)
- {
- this.printer = printer;
- }
-
- public SidesType getSides()
- {
- return sides;
- }
-
- public void setSides(SidesType sides)
- {
- if (sides == null)
- throw new IllegalArgumentException();
- this.sides = sides;
- }
-
- public void setSidesToDefault()
- {
- sides = SidesType.ONE_SIDED;
- }
-
- public int getToPage()
- {
- return toPage != 0 ? toPage
- : pageRanges != null ? pageRanges[pageRanges.length - 1][1]
- : fromPage != 0 ? fromPage : maxPage;
- }
-
- public void setToPage(int toPage)
- {
- if (toPage < minPage || (fromPage > toPage && fromPage != 0)
- || toPage > maxPage)
- throw new IllegalArgumentException();
- if (pageRanges == null)
- this.toPage = toPage;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- return true;
- if (! (o instanceof JobAttributes))
- return false;
- JobAttributes ja = (JobAttributes) o;
- if (copies != ja.copies || selection != ja.selection
- || destination != ja.destination || dialog != ja.dialog
- || ! filename.equals(ja.filename) || maxPage != ja.maxPage
- || minPage != ja.minPage || multiple != ja.multiple
- || fromPage != ja.fromPage || toPage != ja.toPage
- || ! printer.equals(ja.printer) || sides != ja.sides
- || (pageRanges == null) != (ja.pageRanges == null))
- return false;
- if (pageRanges != ja.pageRanges)
- for (int i = pageRanges.length; --i >= 0; )
- if (pageRanges[i][0] != ja.pageRanges[i][0]
- || pageRanges[i][1] != ja.pageRanges[i][1])
- return false;
- return true;
- }
-
- public int hashCode()
- {
- int hash = (selection.value << 6) ^ (destination.value << 5)
- ^ (dialog.value << 3) ^ (multiple.value << 2) ^ sides.value
- ^ (filename == null ? 0 : filename.hashCode())
- ^ (printer == null ? 0 : printer.hashCode());
- // The effect of the above fields on the hashcode match the JDK. However,
- // I am unable to reverse engineer the effect of the fields listed below,
- // so I am using my own implementation. Note that this still satisfies
- // the general contract of hashcode, it just doesn't match the JDK.
- hash ^= (copies << 27) ^ (maxPage << 22) ^ (minPage << 17);
- if (pageRanges == null)
- hash ^= (getFromPage() << 13) ^ (getToPage() << 8);
- else
- for (int i = pageRanges.length; --i >= 0; )
- hash ^= (pageRanges[i][0] << 13) ^ (pageRanges[i][1] << 8);
- return hash;
- }
-
- public String toString()
- {
- StringBuffer s = new StringBuffer("copies=").append(copies)
- .append(",defaultSelection=").append(selection).append(",destination=")
- .append(destination).append(",dialog=").append(dialog)
- .append(",fileName=").append(filename).append(",fromPage=")
- .append(getFromPage()).append(",maxPage=").append(maxPage)
- .append(",minPage=").append(minPage)
- .append(",multiple-document-handling=").append(multiple)
- .append(",page-ranges=[");
- if (pageRanges == null)
- s.append(minPage).append(':').append(minPage).append(']');
- else
- for (int i = 0; i < pageRanges.length; i++)
- s.append(pageRanges[i][0]).append(':').append(pageRanges[i][1])
- .append(',');
- s.setLength(s.length() - 1);
- return s.append("],printer=").append(printer).append(",sides=")
- .append(sides).append(",toPage=").append(getToPage()).toString();
- }
-} // class JobAttributes
diff --git a/libjava/java/awt/KeyEventDispatcher.java b/libjava/java/awt/KeyEventDispatcher.java
deleted file mode 100644
index 30997278e1b..00000000000
--- a/libjava/java/awt/KeyEventDispatcher.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* KeyEventDispatcher.java -- dispatches key events
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.KeyEvent;
-
-/**
- * An instance of this interface coordinates with a KeyboardFocusManager to
- * target and dispatch all key events. This allows retargeting, consuming,
- * changing, or otherwise manipulating the key event before sending it on to
- * a target.
- *
- * redispatchEvent
- * to avoid infinite recursion.
- *
- * redispatchEvent
- * to avoid infinite recursion.
- *
- * KeyboardFocusManager
handles the focusing of
- * windows for receiving keyboard events. The manager handles
- * the dispatch of all FocusEvent
s and
- * KeyEvent
s, along with WindowEvent
s
- * relating to the focused window. Users can use the manager
- * to ascertain the current focus owner and fire events.
- *
- *
- * The focus owner is the Component
that receives
- * key events. The focus owner is either the currently focused
- * window or a component within this window.
- *
- *
- * The underlying native windowing system may denote the active
- * window or its children with special decorations (e.g. a highlighted
- * title bar). The active window is always either a Frame
- * or Dialog
, and is either the currently focused
- * window or its owner.
- *
- *
- * Applets may be partitioned into different applet contexts, according
- * to their code base. In this case, each context has its own
- * KeyboardFocusManager
, as opposed to the global
- * manager maintained by applets which share the same context.
- * Each context is insulated from the others, and they don't interact.
- * The resulting behaviour, as with context division, depends on the browser
- * supporting the applets. Regardless, there can only ever be
- * one focused window, one active window and one focus owner
- * per ClassLoader
.
- *
- *
- * To support this separation of focus managers, the manager instances
- * and the internal state information is grouped by the
- * ThreadGroup
to which it pertains. With respect to
- * applets, each code base has its own ThreadGroup
, so the
- * isolation of each context is enforced within the manager.
- *
- *
- * By default, the manager defines TAB and Ctrl+TAB as the
- * forward focus traversal keys and Shift+TAB and Ctrl+Shift+TAB
- * as the backward focus traversal keys. No up or down cycle
- * traversal keys are defined by default. Traversal takes effect
- * on the firing of a relevant KEY_PRESSED
event.
- * However, all other key events related to the use of the
- * defined focus traversal key sequence are consumed and not
- * dispatched.
- *
- *
- * These default traversal keys come into effect on all windows
- * for which no alternative set of keys is defined. This also
- * applies recursively to any child components of such a window,
- * which define no traversal keys of their own.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Thomas Fitzsimmons (fitzsim@redhat.com)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.4
- */
-public abstract class KeyboardFocusManager
- implements KeyEventDispatcher, KeyEventPostProcessor
-{
- /** Identifies {@link AWTKeyStroke}s that move the focus forward in
- the focus cycle. */
- public static final int FORWARD_TRAVERSAL_KEYS = 0;
-
- /** Identifies {@link AWTKeyStroke}s that move the focus backward in
- the focus cycle. */
- public static final int BACKWARD_TRAVERSAL_KEYS = 1;
-
- /** Identifies {@link AWTKeyStroke}s that move the focus up to the
- parent focus cycle root. */
- public static final int UP_CYCLE_TRAVERSAL_KEYS = 2;
-
- /** Identifies {@link AWTKeyStroke}s that move the focus down to the
- child focus cycle root. */
- public static final int DOWN_CYCLE_TRAVERSAL_KEYS = 3;
-
- /** The set of {@link AWTKeyStroke}s that cause focus to be moved to
- the next focusable Component in the focus cycle. */
- private static final Set DEFAULT_FORWARD_KEYS;
-
- /** The set of {@link AWTKeyStroke}s that cause focus to be moved to
- the previous focusable Component in the focus cycle. */
- private static final Set DEFAULT_BACKWARD_KEYS;
-
- /** Populate the DEFAULT_FORWARD_KEYS and DEFAULT_BACKWARD_KEYS
- {@link java.util.Set}s. */
- static
- {
- Set s = new HashSet();
- s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0));
- s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
- KeyEvent.CTRL_DOWN_MASK));
- DEFAULT_FORWARD_KEYS = Collections.unmodifiableSet(s);
- s = new HashSet();
- s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
- KeyEvent.SHIFT_DOWN_MASK));
- s.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
- KeyEvent.SHIFT_DOWN_MASK
- | KeyEvent.CTRL_DOWN_MASK));
- DEFAULT_BACKWARD_KEYS = Collections.unmodifiableSet(s);
- }
-
- /** The global object {@link java.util.Map}s. */
-
- /** For security reasons, {@link java.applet.Applet}s in different
- codebases must be insulated from one another. Since {@link
- KeyboardFocusManager}s have the ability to return {@link
- Component}s from a given {@link java.applet.Applet}, each
- codebase must have an independent {@link KeyboardFocusManager}.
- Since each codebase has its own {@link ThreadGroup} in which its
- {@link Applet}s run, it makes sense to partition {@link
- KeyboardFocusManager}s according to {@link
- java.lang.ThreadGroup}. Thus, currentKeyboardFocusManagers is a
- {@link java.util.Map} keyed on {@link java.lang.ThreadGroup}. */
- private static Map currentKeyboardFocusManagers = new HashMap ();
-
- /** {@link java.applet.Applet}s in one codebase must not be allowed
- to access {@link Component}s in {@link java.applet.Applet}s in
- other codebases. To enforce this restriction, we key the
- following {@link java.util.Map}s on {@link java.lang.ThreadGroup}s (which
- are per-codebase). For example, if {@link
- java.lang.ThreadGroup} A calls {@link #setGlobalFocusOwner},
- passing {@link Component} C, currentFocusOwners[A] is assigned
- C, and all other currentFocusOwners values are nullified. Then
- if {@link java.lang.ThreadGroup} A subsequently calls {@link
- #getGlobalFocusOwner}, it will return currentFocusOwners[A],
- that is, {@link Component} C. If another {@link
- java.lang.ThreadGroup} K calls {@link #getGlobalFocusOwner}, it
- will return currentFocusOwners[K], that is, null.
-
- Since this is a static field, we ensure that there is only one
- focused {@link Component} per class loader. */
- private static Map currentFocusOwners = new HashMap ();
-
- /** A {@link java.util.Map} keyed on {@link java.lang.ThreadGroup}s
- that stores the {@link Component} that owns the permanent
- keyboard focus. @see currentFocusOwners */
- private static Map currentPermanentFocusOwners = new HashMap ();
-
- /** A {@link java.util.Map} keyed on {@link java.lang.ThreadGroup}s
- that stores the focused {@link Window}. @see
- currentFocusOwners */
- private static Map currentFocusedWindows = new HashMap ();
-
- /** A {@link java.util.Map} keyed on {@link java.lang.ThreadGroup}s
- that stores the active {@link Window}. @see
- currentFocusOwners */
- private static Map currentActiveWindows = new HashMap ();
-
- /** A {@link java.util.Map} keyed on {@link java.lang.ThreadGroup}s
- that stores the focus cycle root {@link Container}. @see
- currentFocusOwners */
- private static Map currentFocusCycleRoots = new HashMap ();
-
- /** The default {@link FocusTraveralPolicy} that focus-managing
- {@link Container}s will use to define their initial focus
- traversal policy. */
- private FocusTraversalPolicy defaultPolicy;
-
- /** An array that stores the {@link #FORWARD_TRAVERSAL_KEYS}, {@link
- #BACKWARD_TRAVERSAL_KEYS}, {@link #UP_CYCLE_TRAVERSAL_KEYS} and
- {@link #DOWN_CYCLE_TRAVERSAL_KEYS} {@link AWTKeyStroke}s {@link
- java.util.Set}s. */
- private Set[] defaultFocusKeys = new Set[]
- {
- DEFAULT_FORWARD_KEYS, DEFAULT_BACKWARD_KEYS,
- Collections.EMPTY_SET, Collections.EMPTY_SET
- };
-
- /**
- * A utility class to support the handling of events relating to property changes.
- */
- private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport (this);
-
- /**
- * A utility class to support the handling of events relating to vetoable changes.
- */
- private final VetoableChangeSupport vetoableChangeSupport = new VetoableChangeSupport (this);
-
- /** A list of {@link KeyEventDispatcher}s that process {@link
- KeyEvent}s before they are processed the default keyboard focus
- manager. */
- private final ArrayList keyEventDispatchers = new ArrayList();
-
- /** A list of {@link KeyEventPostProcessor}s that process unconsumed
- {@link KeyEvent}s. */
- private final ArrayList keyEventPostProcessors = new ArrayList();
-
- /**
- * Construct a KeyboardFocusManager.
- */
- public KeyboardFocusManager ()
- {
- }
-
- /**
- * Retrieve the keyboard focus manager associated with the {@link
- * java.lang.ThreadGroup} to which the calling thread belongs.
- *
- * @return the keyboard focus manager associated with the current
- * thread group
- */
- public static KeyboardFocusManager getCurrentKeyboardFocusManager ()
- {
- ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup ();
-
- if (currentKeyboardFocusManagers.get (currentGroup) == null)
- setCurrentKeyboardFocusManager (null);
-
- return (KeyboardFocusManager) currentKeyboardFocusManagers.get (currentGroup);
- }
-
- /**
- * Set the keyboard focus manager associated with the {@link
- * java.lang.ThreadGroup} to which the calling thread belongs.
- *
- * @param m the keyboard focus manager for the current thread group
- */
- public static void setCurrentKeyboardFocusManager (KeyboardFocusManager m)
- {
- SecurityManager sm = System.getSecurityManager ();
- if (sm != null)
- sm.checkPermission (new AWTPermission ("replaceKeyboardFocusManager"));
-
- ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup ();
- KeyboardFocusManager manager;
-
- if (m == null)
- manager = new DefaultKeyboardFocusManager ();
- else
- manager = m;
-
- currentKeyboardFocusManagers.put (currentGroup, manager);
- }
-
- /**
- * Retrieve the {@link Component} that has the keyboard focus, or
- * null if the focus owner was not set by a thread in the current
- * {@link java.lang.ThreadGroup}.
- *
- * @return the keyboard focus owner or null
- */
- public Component getFocusOwner ()
- {
- Component owner = (Component) getObject (currentFocusOwners);
- if (owner == null)
- owner = (Component) getObject (currentPermanentFocusOwners);
- return owner;
- }
-
- /**
- * Retrieve the {@link Component} that has the keyboard focus,
- * regardless of whether or not it was set by a thread in the
- * current {@link java.lang.ThreadGroup}. If there is no temporary
- * focus owner in effect then this method will return the same value
- * as {@link #getGlobalPermanentFocusOwner}.
- *
- * @return the keyboard focus owner
- * @throws SecurityException if this is not the keyboard focus
- * manager associated with the current {@link java.lang.ThreadGroup}
- */
- protected Component getGlobalFocusOwner ()
- {
- // Check if there is a temporary focus owner.
- Component focusOwner = (Component) getGlobalObject (currentFocusOwners);
-
- return (focusOwner == null) ? getGlobalPermanentFocusOwner () : focusOwner;
- }
-
- /**
- * Set the {@link Component} that will be returned by {@link
- * #getFocusOwner} (when it is called from the current {@link
- * java.lang.ThreadGroup}) and {@link #getGlobalFocusOwner}. This
- * method does not actually transfer the keyboard focus.
- *
- * @param owner the Component to return from getFocusOwner and
- * getGlobalFocusOwner
- *
- * @see Component.requestFocus ()
- * @see Component.requestFocusInWindow ()
- */
- protected void setGlobalFocusOwner (Component owner)
- {
- if (owner == null || owner.focusable)
- setGlobalObject (currentFocusOwners, owner, "focusOwner");
- }
-
- /**
- * Clear the global focus owner and deliver a FOCUS_LOST event to
- * the previously-focused {@link Component}. Until another {@link
- * Component} becomes the keyboard focus owner, key events will be
- * discarded by top-level windows.
- */
- public void clearGlobalFocusOwner ()
- {
- synchronized (currentFocusOwners)
- {
- Component focusOwner = getGlobalFocusOwner ();
- Component permanentFocusOwner = getGlobalPermanentFocusOwner ();
-
- setGlobalFocusOwner (null);
- setGlobalPermanentFocusOwner (null);
-
- // Inform the old focus owner that it has lost permanent
- // focus.
- if (focusOwner != null)
- {
- // We can't cache the event queue, because of
- // bootstrapping issues. We need to set the default
- // KeyboardFocusManager in EventQueue before the event
- // queue is started.
- EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
- if (focusOwner != permanentFocusOwner)
- q.postEvent (new FocusEvent (focusOwner, FocusEvent.FOCUS_LOST, true));
- else
- q.postEvent (new FocusEvent (focusOwner, FocusEvent.FOCUS_LOST, false));
- }
-
- if (focusOwner != permanentFocusOwner)
- {
- EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
- q.postEvent (new FocusEvent (permanentFocusOwner, FocusEvent.FOCUS_LOST, false));
- }
- }
- }
-
- /**
- * Retrieve the {@link Component} that has the permanent keyboard
- * focus, or null if the focus owner was not set by a thread in the
- * current {@link java.lang.ThreadGroup}.
- *
- * @return the keyboard focus owner or null
- */
- public Component getPermanentFocusOwner ()
- {
- return (Component) getObject (currentPermanentFocusOwners);
- }
-
- /**
- * Retrieve the {@link Component} that has the permanent keyboard
- * focus, regardless of whether or not it was set by a thread in the
- * current {@link java.lang.ThreadGroup}.
- *
- * @return the keyboard focus owner
- * @throws SecurityException if this is not the keyboard focus
- * manager associated with the current {@link java.lang.ThreadGroup}
- */
- protected Component getGlobalPermanentFocusOwner ()
- {
- return (Component) getGlobalObject (currentPermanentFocusOwners);
- }
-
- /**
- * Set the {@link Component} that will be returned by {@link
- * #getPermanentFocusOwner} (when it is called from the current
- * {@link java.lang.ThreadGroup}) and {@link
- * #getGlobalPermanentFocusOwner}. This method does not actually
- * transfer the keyboard focus.
- *
- * @param focusOwner the Component to return from
- * getPermanentFocusOwner and getGlobalPermanentFocusOwner
- *
- * @see Component.requestFocus ()
- * @see Component.requestFocusInWindow ()
- */
- protected void setGlobalPermanentFocusOwner (Component focusOwner)
- {
- if (focusOwner == null || focusOwner.focusable)
- setGlobalObject (currentPermanentFocusOwners, focusOwner,
- "permanentFocusOwner");
- }
-
- /**
- * Retrieve the {@link Window} that is or contains the keyboard
- * focus owner, or null if the focused window was not set by a
- * thread in the current {@link java.lang.ThreadGroup}.
- *
- * @return the focused window or null
- */
- public Window getFocusedWindow ()
- {
- return (Window) getObject (currentFocusedWindows);
- }
-
- /**
- * Retrieve the {@link Window} that is or contains the focus owner,
- * regardless of whether or not the {@link Window} was set focused
- * by a thread in the current {@link java.lang.ThreadGroup}.
- *
- * @return the focused window
- * @throws SecurityException if this is not the keyboard focus
- * manager associated with the current {@link java.lang.ThreadGroup}
- */
- protected Window getGlobalFocusedWindow ()
- {
- return (Window) getGlobalObject (currentFocusedWindows);
- }
-
- /**
- * Set the {@link Window} that will be returned by {@link
- * #getFocusedWindow} (when it is called from the current {@link
- * java.lang.ThreadGroup}) and {@link #getGlobalFocusedWindow}.
- * This method does not actually cause window
to become
- * the focused {@link Window}.
- *
- * @param window the Window to return from getFocusedWindow and
- * getGlobalFocusedWindow
- */
- protected void setGlobalFocusedWindow (Window window)
- {
- if (window == null || window.focusable)
- setGlobalObject (currentFocusedWindows, window, "focusedWindow");
- }
-
- /**
- * Retrieve the active {@link Window}, or null if the active window
- * was not set by a thread in the current {@link
- * java.lang.ThreadGroup}.
- *
- * @return the active window or null
- */
- public Window getActiveWindow()
- {
- return (Window) getObject (currentActiveWindows);
- }
-
- /**
- * Retrieve the active {@link Window}, regardless of whether or not
- * the {@link Window} was made active by a thread in the current
- * {@link java.lang.ThreadGroup}.
- *
- * @return the active window
- * @throws SecurityException if this is not the keyboard focus
- * manager associated with the current {@link java.lang.ThreadGroup}
- */
- protected Window getGlobalActiveWindow()
- {
- return (Window) getGlobalObject (currentActiveWindows);
- }
-
- /**
- * Set the {@link Window} that will be returned by {@link
- * #getActiveWindow} (when it is called from the current {@link
- * java.lang.ThreadGroup}) and {@link #getGlobalActiveWindow}. This
- * method does not actually cause window
to be made
- * active.
- *
- * @param window the Window to return from getActiveWindow and
- * getGlobalActiveWindow
- */
- protected void setGlobalActiveWindow(Window window)
- {
- setGlobalObject (currentActiveWindows, window, "activeWindow");
- }
-
- /**
- * Retrieve the default {@link FocusTraversalPolicy}.
- * Focus-managing {@link Container}s use the returned object to
- * define their initial focus traversal policy.
- *
- * @return a non-null default FocusTraversalPolicy object
- */
- public FocusTraversalPolicy getDefaultFocusTraversalPolicy ()
- {
- if (defaultPolicy == null)
- defaultPolicy = new DefaultFocusTraversalPolicy ();
- return defaultPolicy;
- }
-
- /**
- * Set the {@link FocusTraversalPolicy} returned by {@link
- * #getDefaultFocusTraversalPolicy}. Focus-managing {@link
- * Container}s created after this call will use policy as their
- * initial focus traversal policy. Existing {@link Container}s'
- * focus traversal policies will not be affected by calls to this
- * method.
- *
- * @param policy the FocusTraversalPolicy that will be returned by
- * subsequent calls to getDefaultFocusTraversalPolicy
- * @throws IllegalArgumentException if policy is null
- */
- public void setDefaultFocusTraversalPolicy (FocusTraversalPolicy policy)
- {
- if (policy == null)
- throw new IllegalArgumentException ();
- firePropertyChange ("defaultFocusTraversalPolicy", defaultPolicy, policy);
- defaultPolicy = policy;
- }
-
- /**
- * Set the default {@link java.util.Set} of focus traversal keys for
- * one of the focus traversal directions.
- *
- * @param id focus traversal direction identifier
- * @param keystrokes set of AWTKeyStrokes
- *
- * @see #FORWARD_TRAVERSAL_KEYS
- * @see #BACKWARD_TRAVERSAL_KEYS
- * @see #UP_CYCLE_TRAVERSAL_KEYS
- * @see #DOWN_CYCLE_TRAVERSAL_KEYS
- */
- public void setDefaultFocusTraversalKeys (int id, Set keystrokes)
- {
- if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS &&
- id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)
- throw new IllegalArgumentException ();
-
- if (keystrokes == null)
- throw new IllegalArgumentException ();
-
- Set sa;
- Set sb;
- Set sc;
- String type;
- switch (id)
- {
- case FORWARD_TRAVERSAL_KEYS:
- sa = defaultFocusKeys[BACKWARD_TRAVERSAL_KEYS];
- sb = defaultFocusKeys[UP_CYCLE_TRAVERSAL_KEYS];
- sc = defaultFocusKeys[DOWN_CYCLE_TRAVERSAL_KEYS];
- type = "forwardDefaultFocusTraversalKeys";
- break;
- case BACKWARD_TRAVERSAL_KEYS:
- sa = defaultFocusKeys[FORWARD_TRAVERSAL_KEYS];
- sb = defaultFocusKeys[UP_CYCLE_TRAVERSAL_KEYS];
- sc = defaultFocusKeys[DOWN_CYCLE_TRAVERSAL_KEYS];
- type = "backwardDefaultFocusTraversalKeys";
- break;
- case UP_CYCLE_TRAVERSAL_KEYS:
- sa = defaultFocusKeys[FORWARD_TRAVERSAL_KEYS];
- sb = defaultFocusKeys[BACKWARD_TRAVERSAL_KEYS];
- sc = defaultFocusKeys[DOWN_CYCLE_TRAVERSAL_KEYS];
- type = "upCycleDefaultFocusTraversalKeys";
- break;
- case DOWN_CYCLE_TRAVERSAL_KEYS:
- sa = defaultFocusKeys[FORWARD_TRAVERSAL_KEYS];
- sb = defaultFocusKeys[BACKWARD_TRAVERSAL_KEYS];
- sc = defaultFocusKeys[UP_CYCLE_TRAVERSAL_KEYS];
- type = "downCycleDefaultFocusTraversalKeys";
- break;
- default:
- throw new IllegalArgumentException ();
- }
- int i = keystrokes.size ();
- Iterator iter = keystrokes.iterator ();
- while (--i >= 0)
- {
- Object o = iter.next ();
- if (!(o instanceof AWTKeyStroke)
- || sa.contains (o) || sb.contains (o) || sc.contains (o)
- || ((AWTKeyStroke) o).keyCode == KeyEvent.VK_UNDEFINED)
- throw new IllegalArgumentException ();
- }
- keystrokes = Collections.unmodifiableSet (new HashSet (keystrokes));
- firePropertyChange (type, defaultFocusKeys[id], keystrokes);
- defaultFocusKeys[id] = keystrokes;
- }
-
- /**
- * Retrieve the default {@link java.util.Set} of focus traversal
- * keys for one of the focus traversal directions.
- *
- * @param id focus traversal direction identifier
- *
- * @return the default set of AWTKeyStrokes
- *
- * @see #FORWARD_TRAVERSAL_KEYS
- * @see #BACKWARD_TRAVERSAL_KEYS
- * @see #UP_CYCLE_TRAVERSAL_KEYS
- * @see #DOWN_CYCLE_TRAVERSAL_KEYS
- */
- public Set getDefaultFocusTraversalKeys (int id)
- {
- if (id < FORWARD_TRAVERSAL_KEYS || id > DOWN_CYCLE_TRAVERSAL_KEYS)
- throw new IllegalArgumentException ();
- return defaultFocusKeys[id];
- }
-
- /**
- * Retrieve the current focus cycle root, or null if the focus owner
- * was not set by a thread in the current {@link
- * java.lang.ThreadGroup}.
- *
- * @return the current focus cycle root or null
- */
- public Container getCurrentFocusCycleRoot ()
- {
- return (Container) getObject (currentFocusCycleRoots);
- }
-
- /**
- * Retrieve the current focus cycle root, regardless of whether or
- * not it was made set by a thread in the current {@link
- * java.lang.ThreadGroup}.
- *
- * @return the current focus cycle root
- * @throws SecurityException if this is not the keyboard focus
- * manager associated with the current {@link java.lang.ThreadGroup}
- */
- protected Container getGlobalCurrentFocusCycleRoot ()
- {
- return (Container) getGlobalObject (currentFocusCycleRoots);
- }
-
- /**
- * Set the {@link Container} that will be returned by {@link
- * #getCurrentFocusCycleRoot} (when it is called from the current
- * {@link java.lang.ThreadGroup}) and {@link
- * #getGlobalCurrentFocusCycleRoot}. This method does not actually
- * make cycleRoot
the current focus cycle root.
- *
- * @param cycleRoot the focus cycle root to return from
- * getCurrentFocusCycleRoot and getGlobalCurrentFocusCycleRoot
- */
- public void setGlobalCurrentFocusCycleRoot (Container cycleRoot)
- {
- setGlobalObject (currentFocusCycleRoots, cycleRoot, "currentFocusCycleRoot");
- }
-
- /**
- * Registers the supplied property change listener for receiving
- * events caused by the following property changes:
- *
- *
- *
- *
- * If the supplied listener is null, nothing occurs.
- *
- * @param l the new listener to register.
- * @see KeyboardFocusManager#addPropertyChangeListener(String, java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(PropertyChangeListener l)
- {
- if (l != null)
- propertyChangeSupport.addPropertyChangeListener(l);
- }
-
- /**
- * Removes the supplied property change listener from the list
- * of registered listeners. If the supplied listener is null,
- * nothing occurs.
- *
- * @param l the listener to remove.
- */
- public void removePropertyChangeListener(PropertyChangeListener l)
- {
- if (l != null)
- propertyChangeSupport.removePropertyChangeListener(l);
- }
-
- /**
- * Returns the currently registered property change listeners
- * in array form. The returned array is empty if no listeners are
- * currently registered.
- *
- * @return an array of registered property change listeners.
- */
- public PropertyChangeListener[] getPropertyChangeListeners()
- {
- return propertyChangeSupport.getPropertyChangeListeners();
- }
-
- /**
- * Registers a property change listener for receiving events relating
- * to a change to a specified property. The supplied property name can be
- * either user-defined or one from the following list of properties
- * relevant to this class:
- *
- *
- *
- *
- * Nothing occurs if a null listener is supplied. null is regarded as a valid property name.
- *
- * @param name the name of the property to handle change events for.
- * @param l the listener to register for changes to the specified property.
- * @see KeyboardFocusManager#addPropertyChangeListener(java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(String name, PropertyChangeListener l)
- {
- if (l != null)
- propertyChangeSupport.addPropertyChangeListener(name, l);
- }
-
- /**
- * Removes the supplied property change listener registered for the
- * specified property from the list of registered listeners. If the
- * supplied listener is null, nothing occurs.
- *
- * @param name the name of the property the listener is
- * monitoring changes to.
- * @param l the listener to remove.
- */
- public void removePropertyChangeListener(String name,
- PropertyChangeListener l)
- {
- if (l != null)
- propertyChangeSupport.removePropertyChangeListener(name, l);
- }
-
- /**
- * Returns the currently registered property change listeners
- * in array form, which listen for changes to the supplied property.
- * The returned array is empty, if no listeners are currently registered
- * for events pertaining to the supplied property.
- *
- * @param name The property the returned listeners monitor for changes.
- * @return an array of registered property change listeners which
- * listen for changes to the supplied property.
- */
- public PropertyChangeListener[] getPropertyChangeListeners(String name)
- {
- return propertyChangeSupport.getPropertyChangeListeners(name);
- }
-
- /**
- * Fires a property change event as a response to a change to
- * to the specified property. The event is only fired if a
- * change has actually occurred (i.e. o and n are different).
- *
- * @param name The name of the property to which a change occurred.
- * @param o The old value of the property.
- * @param n The new value of the property.
- */
- protected void firePropertyChange(String name, Object o, Object n)
- {
- propertyChangeSupport.firePropertyChange(name, o, n);
- }
-
- /**
- * Registers a vetoable property change listener for receiving events
- * relating to the following properties:
- *
- *
- *
- *
- * Nothing occurs if a null listener is supplied.
- *
- * @param l the listener to register.
- * @see KeyboardFocusManager#addVetoableChangeListener(String, java.beans.VetoableChangeListener)
- */
- public void addVetoableChangeListener(VetoableChangeListener l)
- {
- if (l != null)
- vetoableChangeSupport.addVetoableChangeListener(l);
- }
-
- /**
- * Removes the supplied vetoable property change listener from
- * the list of registered listeners. If the supplied listener
- * is null, nothing occurs.
- *
- * @param l the listener to remove.
- */
- public void removeVetoableChangeListener(VetoableChangeListener l)
- {
- if (l != null)
- vetoableChangeSupport.removeVetoableChangeListener(l);
- }
-
- /**
- * Returns the currently registered vetoable property change listeners
- * in array form. The returned array is empty if no listeners are
- * currently registered.
- *
- * @return an array of registered vetoable property change listeners.
- * @since 1.4
- */
- public VetoableChangeListener[] getVetoableChangeListeners()
- {
- return vetoableChangeSupport.getVetoableChangeListeners();
- }
-
- /**
- * Registers a vetoable property change listener for receiving events relating
- * to a vetoable change to a specified property. The supplied property name can be
- * either user-defined or one from the following list of properties
- * relevant to this class:
- *
- *
- *
- *
- * Nothing occurs if a null listener is supplied. null is regarded as a valid property name.
- *
- * @param name the name of the property to handle change events for.
- * @param l the listener to register for changes to the specified property.
- * @see KeyboardFocusManager#addVetoableChangeListener(java.beans.VetoableChangeListener)
- */
- public void addVetoableChangeListener(String name, VetoableChangeListener l)
- {
- if (l != null)
- vetoableChangeSupport.addVetoableChangeListener(name, l);
- }
-
- /**
- * Removes the supplied vetoable property change listener registered
- * for the specified property from the list of registered listeners.
- * If the supplied listener is null, nothing occurs.
- *
- * @param name the name of the vetoable property the listener is
- * monitoring changes to.
- * @param l the listener to remove.
- */
- public void removeVetoableChangeListener(String name,
- VetoableChangeListener l)
- {
- if (l != null)
- vetoableChangeSupport.removeVetoableChangeListener(name, l);
- }
-
- /**
- * Returns the currently registered vetoable property change listeners
- * in array form, which listen for changes to the supplied property.
- * The returned array is empty, if no listeners are currently registered
- * for events pertaining to the supplied property.
- *
- * @param name The property the returned listeners monitor for changes.
- * @return an array of registered property change listeners which
- * listen for changes to the supplied property.
- * @since 1.4
- */
- public VetoableChangeListener[] getVetoableChangeListeners(String name)
- {
- return vetoableChangeSupport.getVetoableChangeListeners(name);
- }
-
- /**
- * Fires a property change event as a response to a vetoable change to
- * to the specified property. The event is only fired if a
- * change has actually occurred (i.e. o and n are different).
- * In the event that the property change is vetoed, the following
- * occurs:
- *
- *
- *
- *
- * @param name The name of the property to which a change occurred.
- * @param o The old value of the property.
- * @param n The new value of the property.
- * @throws PropertyVetoException if one of the listeners vetos
- * the change by throwing this exception.
- */
- protected void fireVetoableChange(String name, Object o, Object n)
- throws PropertyVetoException
- {
- vetoableChangeSupport.fireVetoableChange(name, o, n);
- }
-
- /**
- * Adds a key event dispatcher to the list of registered dispatchers.
- * When a key event is fired, each dispatcher's PropertyVetoException
to
- * the proposed change.
- * PropertyVetoException
- * in response to the reversion.
- * dispatchKeyEvent
- * method is called in the order that they were added, prior to the manager
- * dispatching the event itself. Notifications halt when one of the
- * dispatchers returns true.
- *
- *
- * The same dispatcher can exist multiple times within the list
- * of registered dispatchers, and there is no limit on the length
- * of this list. A null dispatcher is simply ignored.
- *
- * @param dispatcher The dispatcher to register.
- */
- public void addKeyEventDispatcher(KeyEventDispatcher dispatcher)
- {
- if (dispatcher != null)
- keyEventDispatchers.add(dispatcher);
- }
-
- /**
- * Removes the specified key event dispatcher from the list of
- * registered dispatchers. The manager always dispatches events,
- * regardless of its existence within the list. The manager
- * can be added and removed from the list, as with any other
- * dispatcher, but this does not affect its ability to dispatch
- * key events. Non-existent and null dispatchers are simply ignored
- * by this method.
- *
- * @param dispatcher The dispatcher to remove.
- */
- public void removeKeyEventDispatcher(KeyEventDispatcher dispatcher)
- {
- keyEventDispatchers.remove(dispatcher);
- }
-
- /**
- * Returns the currently registered key event dispatchers in List
- * form. At present, this only includes dispatchers explicitly registered
- * via the addKeyEventDispatcher()
method, but this behaviour
- * is subject to change and should not be depended on. The manager itself
- * may be a member of the list, but only if explicitly registered. If no
- * dispatchers have been registered, the list will be empty.
- *
- * @return A list of explicitly registered key event dispatchers.
- * @see KeyboardFocusManager#addKeyEventDispatcher(java.awt.KeyEventDispatcher)
- */
- protected List getKeyEventDispatchers ()
- {
- return (List) keyEventDispatchers.clone ();
- }
-
- /**
- * Adds a key event post processor to the list of registered post processors.
- * Post processors work in the same way as key event dispatchers, except
- * that they are invoked after the manager has dispatched the key event,
- * and not prior to this. Each post processor's postProcessKeyEvent
- * method is called to see if any post processing needs to be performed. THe
- * processors are called in the order in which they were added to the list,
- * and notifications continue until one returns true. As with key event
- * dispatchers, the manager is implicitly called following this process,
- * regardless of whether or not it is present within the list.
- *
- *
- * The same post processor can exist multiple times within the list
- * of registered post processors, and there is no limit on the length
- * of this list. A null post processor is simply ignored.
- *
- * @param postProcessor the post processor to register.
- * @see KeyboardFocusManager#addKeyEventDispatcher(java.awt.KeyEventDispatcher)
- */
- public void addKeyEventPostProcessor (KeyEventPostProcessor postProcessor)
- {
- if (postProcessor != null)
- keyEventPostProcessors.add (postProcessor);
- }
-
- /**
- * Removes the specified key event post processor from the list of
- * registered post processors. The manager always post processes events,
- * regardless of its existence within the list. The manager
- * can be added and removed from the list, as with any other
- * post processor, but this does not affect its ability to post process
- * key events. Non-existent and null post processors are simply ignored
- * by this method.
- *
- * @param postProcessor the post processor to remove.
- */
- public void removeKeyEventPostProcessor (KeyEventPostProcessor postProcessor)
- {
- keyEventPostProcessors.remove (postProcessor);
- }
-
- /**
- * Returns the currently registered key event post processors in List
- * form. At present, this only includes post processors explicitly registered
- * via the addKeyEventPostProcessor()
method, but this behaviour
- * is subject to change and should not be depended on. The manager itself
- * may be a member of the list, but only if explicitly registered. If no
- * post processors have been registered, the list will be empty.
- *
- * @return A list of explicitly registered key event post processors.
- * @see KeyboardFocusManager#addKeyEventPostProcessor(java.awt.KeyEventPostProcessor)
- */
- protected List getKeyEventPostProcessors ()
- {
- return (List) keyEventPostProcessors.clone ();
- }
-
- /**
- * The AWT event dispatcher uses this method to request that the manager
- * handle a particular event. If the manager fails or refuses to
- * dispatch the supplied event (this method returns false), the
- * AWT event dispatcher will try to dispatch the event itself.
- *
- *
- * The manager is expected to handle all FocusEvent
s
- * and KeyEvent
s, and WindowEvent
s
- * relating to the focus. Dispatch is done with regard to the
- * the focus owner and the currently focused and active windows.
- * In handling the event, the source of the event may be overridden.
- *
- *
- * The actual dispatching is performed by calling
- * redispatchEvent()
. This avoids the infinite recursion
- * of dispatch requests which may occur if this method is called on
- * the target component.
- *
- * @param e the event to dispatch.
- * @return true if the event was dispatched.
- * @see KeyboardFocusManager#redispatchEvent(java.awt.Component, java.awt.AWTEvent)
- * @see KeyEvent
- * @see FocusEvent
- * @see WindowEvent
- */
- public abstract boolean dispatchEvent (AWTEvent e);
-
- /**
- * Handles redispatching of an event so that recursion of
- * dispatch requests does not occur. Event dispatch methods
- * within this manager (dispatchEvent()
) and
- * the key event dispatchers should use this method to handle
- * dispatching rather than the dispatch method of the target
- * component.
- *
- *
- *
- * This method is not intended for general consumption, and is
- * only for the use of the aforementioned classes.
- *
- *
- * @param target the target component to which the event is
- * dispatched.
- * @param e the event to dispatch.
- */
- public final void redispatchEvent (Component target, AWTEvent e)
- {
- synchronized (e)
- {
- e.setSource (target);
- target.dispatchEvent (e);
- }
- }
-
- /**
- * Attempts to dispatch key events for which no key event dispatcher
- * has so far succeeded. This method is usually called by
- * dispatchEvent()
following the sending of the key
- * event to any registered key event dispatchers. If the key
- * event reaches this stage, none of the dispatchers returned
- * true. This is, of course, always the case if there are no
- * registered dispatchers.
- *
- *
- * If this method also fails to handle the key event, then
- * false is returned to the caller. In the case of
- * dispatchEvent()
, the calling method may try
- * to handle the event itself or simply forward on the
- * false result to its caller. When the event is dispatched
- * by this method, a true result is propogated through the
- * calling methods.
- *
- * @param e the key event to dispatch.
- * @return true if the event was dispatched successfully.
- */
- public abstract boolean dispatchKeyEvent (KeyEvent e);
-
- /**
- * Handles the post processing of key events. By default,
- * this method will map unhandled key events to appropriate
- * MenuShortcut
s. The event is consumed
- * in the process and the shortcut is activated. This
- * method is usually called by dispatchKeyEvent
.
- *
- * @param e the key event to post process.
- * @return true by default, as the event was handled.
- */
- public abstract boolean postProcessKeyEvent (KeyEvent e);
-
- /**
- * Handles focus traversal operations for key events which
- * represent focus traversal keys in relation to the supplied
- * component. The supplied component is assumed to have the
- * focus, whether it does so or not, and the operation is
- * carried out as appropriate, with this in mind.
- *
- * @param focused the component on which to perform focus traversal,
- * on the assumption that this component has the focus.
- * @param e the possible focus traversal key event.
- */
- public abstract void processKeyEvent (Component focused, KeyEvent e);
-
- /**
- * Delays all key events following the specified timestamp until the
- * supplied component has focus. The AWT calls this method when it is
- * determined that a focus change may occur within the native windowing
- * system. Any key events which occur following the time specified by
- * after are delayed until a FOCUS_GAINED
event is received
- * for the untilFocused component. The manager is responsible for ensuring
- * this takes place.
- *
- * @param after the timestamp beyond which all key events are delayed until
- * the supplied component gains focus.
- * @param untilFocused the component to wait on gaining focus.
- */
- protected abstract void enqueueKeyEvents (long after, Component untilFocused);
-
- /**
- * Removes the key event block specified by the supplied timestamp and component.
- * All delayed key events are released for normal dispatching following its
- * removal and subsequent key events that would have been blocked are now
- * immediately dispatched. If the specified timestamp is below 0, then
- * the request with the oldest timestamp is removed.
- *
- * @param after the timestamp of the key event block to be removed, or a
- * value smaller than 0 if the oldest is to be removed.
- * @param untilFocused the component of the key event block to be removed.
- */
- protected abstract void dequeueKeyEvents (long after, Component untilFocused);
-
- /**
- * Discards all key event blocks relating to focus requirements for
- * the supplied component, regardless of timestamp.
- *
- * @param comp the component of the key event block(s) to be removed.
- */
- protected abstract void discardKeyEvents (Component comp);
-
- /**
- * Moves the current focus to the next component following
- * comp, based on the current focus traversal policy. By
- * default, only visible, displayable, accepted components
- * can receive focus. Canvas
es, Panel
s,
- * Label
s, ScrollPane
s, Scrollbar
s,
- * Window
s and lightweight components are judged
- * to be unacceptable by default. See the
- * DefaultFocusTraversalPolicy
for more details.
- *
- * @param comp the component prior to the one which will
- * become the focus, following execution of this method.
- * @see DefaultFocusTraversalPolicy
- */
- public abstract void focusNextComponent(Component comp);
-
- /**
- * Moves the current focus to the previous component, prior to
- * comp, based on the current focus traversal policy. By
- * default, only visible, displayable, accepted components
- * can receive focus. Canvas
es, Panel
s,
- * Label
s, ScrollPane
s, Scrollbar
s,
- * Window
s and lightweight components are judged
- * to be unacceptable by default. See the
- * DefaultFocusTraversalPolicy
for more details.
- *
- * @param comp the component following the one which will
- * become the focus, following execution of this method.
- * @see DefaultFocusTraversalPolicy
- */
- public abstract void focusPreviousComponent(Component comp);
-
- /**
- * Moves the current focus upwards by one focus cycle.
- * Both the current focus owner and current focus cycle root
- * become the focus cycle root of the supplied component.
- * However, in the case of a Window
, the default
- * focus component becomes the focus owner and the focus cycle
- * root is not changed.
- *
- * @param comp the component used as part of the focus traversal.
- */
- public abstract void upFocusCycle(Component comp);
-
- /**
- * Moves the current focus downwards by one focus cycle.
- * If the supplied container is a focus cycle root, then this
- * becomes the current focus cycle root and the focus goes
- * to the default component of the specified container.
- * Nothing happens for non-focus cycle root containers.
- *
- * @param cont the container used as part of the focus traversal.
- */
- public abstract void downFocusCycle(Container cont);
-
- /**
- * Moves the current focus to the next component, based on the
- * current focus traversal policy. By default, only visible,
- * displayable, accepted component can receive focus.
- * Canvas
es, Panel
s,
- * Label
s, ScrollPane
s, Scrollbar
s,
- * Window
s and lightweight components are judged
- * to be unacceptable by default. See the
- * DefaultFocusTraversalPolicy
for more details.
- *
- * @see DefaultFocusTraversalPolicy
- */
- public final void focusNextComponent()
- {
- focusNextComponent (null);
- }
-
- /**
- * Moves the current focus to the previous component, based on the
- * current focus traversal policy. By default, only visible,
- * displayable, accepted component can receive focus.
- * Canvas
es, Panel
s,
- * Label
s, ScrollPane
s, Scrollbar
s,
- * Window
s and lightweight components are judged
- * to be unacceptable by default. See the
- * DefaultFocusTraversalPolicy
for more details.
- *
- * @see DefaultFocusTraversalPolicy
- */
- public final void focusPreviousComponent()
- {
- focusPreviousComponent (null);
- }
-
- /**
- * Moves the current focus upwards by one focus cycle,
- * so that the new focus owner is the focus cycle root
- * of the current owner. The current focus cycle root then
- * becomes the focus cycle root of the new focus owner.
- * However, in the case of the focus cycle root of the
- * current focus owner being a Window
, the default
- * component of this window becomes the focus owner and the
- * focus cycle root is not changed.
- */
- public final void upFocusCycle()
- {
- upFocusCycle (null);
- }
-
- /**
- * Moves the current focus downwards by one focus cycle,
- * iff the current focus cycle root is a Container
.
- * Usually, the new focus owner is set to the default component
- * of the container and the current focus cycle root is set
- * to the current focus owner. Nothing occurs if the current
- * focus cycle root is not a container.
- */
- public final void downFocusCycle()
- {
- Component focusOwner = getGlobalFocusOwner ();
- if (focusOwner instanceof Container
- && ((Container) focusOwner).isFocusCycleRoot ())
- downFocusCycle ((Container) focusOwner);
- }
-
- /**
- * Retrieve an object from one of the global object {@link
- * java.util.Map}s, if the object was set by the a thread in the
- * current {@link java.lang.ThreadGroup}. Otherwise, return null.
- *
- * @param globalMap one of the global object Maps
- *
- * @return a global object set by the current ThreadGroup, or null
- *
- * @see getFocusOwner
- * @see getPermanentFocusOwner
- * @see getFocusedWindow
- * @see getActiveWindow
- * @see getCurrentFocusCycleRoot
- */
- private Object getObject (Map globalMap)
- {
- ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup ();
- return globalMap.get (currentGroup);
- }
-
- /**
- * Retrieve an object from one of the global object {@link
- * java.util.Map}s, regardless of whether or not the object was set
- * by a thread in the current {@link java.lang.ThreadGroup}.
- *
- * @param globalMap one of the global object Maps
- *
- * @return a global object set by the current ThreadGroup, or null
- *
- * @throws SecurityException if this is not the keyboard focus
- * manager associated with the current {@link java.lang.ThreadGroup}
- *
- * @see getGlobalFocusOwner
- * @see getGlobalPermanentFocusOwner
- * @see getGlobalFocusedWindow
- * @see getGlobalActiveWindow
- * @see getGlobalCurrentFocusCycleRoot
- */
- private Object getGlobalObject (Map globalMap)
- {
- ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup ();
- KeyboardFocusManager managerForCallingThread
- = (KeyboardFocusManager) currentKeyboardFocusManagers.get (currentGroup);
-
- if (this != managerForCallingThread)
- throw new SecurityException ("Attempted to retrieve an object from a "
- + "keyboard focus manager that isn't "
- + "associated with the current thread group.");
-
- synchronized (globalMap)
- {
- Collection globalObjects = globalMap.values ();
- Iterator i = globalObjects.iterator ();
- Component globalObject;
-
- while (i.hasNext ())
- {
- globalObject = (Component) i.next ();
- if (globalObject != null)
- return globalObject;
- }
- }
-
- // No Object was found.
- return null;
- }
-
- /**
- * Set an object in one of the global object {@link java.util.Map}s,
- * that will be returned by subsequent calls to getGlobalObject on
- * the same {@link java.util.Map}.
- *
- * @param globalMap one of the global object Maps
- * @param newObject the object to set
- * @param property the property that will change
- *
- * @see setGlobalFocusOwner
- * @see setGlobalPermanentFocusOwner
- * @see setGlobalFocusedWindow
- * @see setGlobalActiveWindow
- * @see setGlobalCurrentFocusCycleRoot
- */
- private void setGlobalObject (Map globalMap,
- Object newObject,
- String property)
- {
- synchronized (globalMap)
- {
- // Save old object.
- Object oldObject = getGlobalObject (globalMap);
-
- // Nullify old object.
- Collection threadGroups = globalMap.keySet ();
- Iterator i = threadGroups.iterator ();
- while (i.hasNext ())
- {
- ThreadGroup oldThreadGroup = (ThreadGroup) i.next ();
- if (globalMap.get (oldThreadGroup) != null)
- {
- globalMap.put (oldThreadGroup, null);
- // There should only be one object set at a time, so
- // we can short circuit.
- break;
- }
- }
-
- ThreadGroup currentGroup = Thread.currentThread ().getThreadGroup ();
- firePropertyChange (property, oldObject, newObject);
- try
- {
- fireVetoableChange (property, oldObject, newObject);
- // Set new object.
- globalMap.put (currentGroup, newObject);
- }
- catch (PropertyVetoException e)
- {
- }
- }
- }
-}
diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java
deleted file mode 100644
index 8867fa12e35..00000000000
--- a/libjava/java/awt/Label.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/* Label.java -- Java label widget
- Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.peer.LabelPeer;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * This component is used for displaying simple text strings that cannot
- * be edited by the user.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-public class Label extends Component implements Accessible
-{
-
-/*
- * Static Variables
- */
-
-/**
- * Alignment constant aligning the text to the left of its window.
- */
-public static final int LEFT = 0;
-
-/**
- * Alignment constant aligning the text in the center of its window.
- */
-public static final int CENTER = 1;
-
-/**
- * Alignment constant aligning the text to the right of its window.
- */
-public static final int RIGHT = 2;
-
-// Serialization version constant:
-private static final long serialVersionUID = 3094126758329070636L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial Indicates the alignment of the text within this label's window.
- * This is one of the constants in this class. The default value is
- * LEFT
.
- */
-private int alignment;
-
-/**
- * @serial The text displayed in the label
- */
-private String text;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of Label
with no text.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-Label()
-{
- this("", LEFT);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Label
with the specified
- * text that is aligned to the left.
- *
- * @param text The text of the label.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-Label(String text)
-{
- this(text, LEFT);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Label
with the specified
- * text and alignment.
- *
- * @param text The text of the label.
- * @param alignment The desired alignment for the text in this label,
- * which must be one of LEFT
, CENTER
, or
- * RIGHT
.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-Label(String text, int alignment)
-{
- setAlignment (alignment);
- setText (text);
-
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * Returns the constant indicating the alignment of the text in this
- * label. The value returned will be one of the alignment constants
- * from this class.
- *
- * @return The alignment of the text in the label.
- */
-public int
-getAlignment()
-{
- return(alignment);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the text alignment of this label to the specified value.
- *
- * @param alignment The desired alignment for the text in this label,
- * which must be one of LEFT
, CENTER
, or
- * RIGHT
.
- */
-public synchronized void
-setAlignment(int alignment)
-{
- if (alignment != CENTER && alignment != LEFT && alignment != RIGHT)
- throw new IllegalArgumentException ("invalid alignment: " + alignment);
- this.alignment = alignment;
- if (peer != null)
- {
- LabelPeer lp = (LabelPeer) peer;
- lp.setAlignment (alignment);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns the text displayed in this label.
- *
- * @return The text for this label.
- */
-public String
-getText()
-{
- return(text);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the text in this label to the specified value.
- *
- * @param text The new text for this label.
- */
-public synchronized void
-setText(String text)
-{
- this.text = text;
-
- if (peer != null)
- {
- LabelPeer lp = (LabelPeer) peer;
- lp.setText (text);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Notifies this label that it has been added to a container, causing
- * the peer to be created. This method is called internally by the AWT
- * system.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createLabel (this);
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a parameter string useful for debugging.
- *
- * @return A debugging string.
- */
-protected String
-paramString()
-{
- return ("text=" + getText() + ",alignment=" +
- getAlignment() + "," + super.paramString());
-}
-
-/**
- * This class provides accessibility support for the label.
- */
-protected class AccessibleAWTLabel
- extends AccessibleAWTComponent
-{
- /**
- * For compatability with Sun's JDK 1.4.2 rev. 5
- */
- private static final long serialVersionUID = -3568967560160480438L;
-
- /**
- * Constructor for the accessible label.
- */
- public AccessibleAWTLabel()
- {
- }
-
- /**
- * Returns the accessible name for the label. This is
- * the text used in the label.
- *
- * @return a String
containing the accessible
- * name for this label.
- */
- public String getAccessibleName()
- {
- return getText();
- }
-
- /**
- * Returns the accessible role for the label.
- *
- * @return an instance of AccessibleRole
, describing
- * the role of the label.
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.LABEL;
- }
-
-}
-
-/**
- * Gets the AccessibleContext associated with this Label
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
-public AccessibleContext getAccessibleContext()
-{
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTLabel();
- return accessibleContext;
-}
-
-} // class Label
-
diff --git a/libjava/java/awt/LayoutManager.java b/libjava/java/awt/LayoutManager.java
deleted file mode 100644
index 62ff8087e76..00000000000
--- a/libjava/java/awt/LayoutManager.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* LayoutManager.java -- lay out elements in a Container
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This interface is for laying out containers in a particular sequence.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see Container
- * @since 1.0
- * @status updated to 1.4
- */
-public interface LayoutManager
-{
- /**
- * Adds the specified component to the layout group.
- *
- * @param name the name of the component to add
- * @param component the component to add
- */
- void addLayoutComponent(String name, Component component);
-
- /**
- * Removes the specified component from the layout group.
- *
- * @param component the component to remove
- */
- void removeLayoutComponent(Component component);
-
- /**
- * Calculates the preferred size for this container, taking into account
- * the components it contains.
- *
- * @param parent the parent container to lay out
- * @return the preferred dimensions of this container
- * @see #minimumLayoutSize(Container)
- */
- Dimension preferredLayoutSize(Container parent);
-
- /**
- * Calculates the minimum size for this container, taking into account
- * the components it contains.
- *
- * @param parent the parent container to lay out
- * @return the minimum dimensions of this container
- * @see #preferredLayoutSize(Container)
- */
- Dimension minimumLayoutSize(Container parent);
-
- /**
- * Lays out the components in the given container.
- *
- * @param parent the container to lay out
- */
- void layoutContainer(Container parent);
-} // interface LayoutManager
diff --git a/libjava/java/awt/LayoutManager2.java b/libjava/java/awt/LayoutManager2.java
deleted file mode 100644
index 45fc5430f29..00000000000
--- a/libjava/java/awt/LayoutManager2.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* LayoutManager2.java -- enhanced layout manager
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * Layout manager for laying out containers based on contraints. The
- * constraints control how the layout will proceed.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see LayoutManager
- * @see Container
- * @since 1.0
- * @status updated to 1.4
- */
-public interface LayoutManager2 extends LayoutManager
-{
- /**
- * Adds the specified component to the layout, with the specified
- * constraints object.
- *
- * @param component the component to add
- * @param constraints the constraints to satisfy
- */
- void addLayoutComponent(Component component, Object constraints);
-
- /**
- * Determines the maximum size of the specified target container.
- *
- * @param target the container to lay out
- * @return the maximum size of the container
- * @see Component#getMaximumSize()
- */
- Dimension maximumLayoutSize(Container target);
-
- /**
- * Returns the preferred X axis alignment for the specified target
- * container. This value will range from 0 to 1 where 0 is alignment
- * closest to the origin, 0.5 is centered, and 1 is aligned furthest
- * from the origin.
- *
- * @param target the target container
- * @return the x-axis alignment preference
- */
- float getLayoutAlignmentX(Container target);
-
- /**
- * Returns the preferred Y axis alignment for the specified target
- * container. This value will range from 0 to 1 where 0 is alignment
- * closest to the origin, 0.5 is centered, and 1 is aligned furthest
- * from the origin.
- *
- * @param target the target container
- * @return the y-axis alignment preference
- */
- float getLayoutAlignmentY(Container target);
-
- /**
- * Forces the layout manager to purge any cached information about the
- * layout of the target container. This will force it to be recalculated.
- *
- * @param target the target container
- */
- void invalidateLayout(Container target);
-} // interface LayoutManager2
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
deleted file mode 100644
index 5fcc79bfcef..00000000000
--- a/libjava/java/awt/List.java
+++ /dev/null
@@ -1,1263 +0,0 @@
-/* List.java -- A listbox widget
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.peer.ListPeer;
-import java.util.EventListener;
-import java.util.Vector;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleSelection;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-
-/**
- * Class that implements a listbox widget
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class List extends Component
- implements ItemSelectable, Accessible
-{
-
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = -3304312411574666869L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-// FIXME: Need read/writeObject
-
-/**
- * @serial The items in the list.
- */
-private Vector items = new Vector();
-
-/**
- * @serial Indicates whether or not multiple items can be selected
- * simultaneously.
- */
-private boolean multipleMode;
-
-/**
- * @serial The number of rows in the list. This is set on creation
- * only and cannot be modified.
- */
-private int rows;
-
-/**
- * @serial An array of the item indices that are selected.
- */
-private int[] selected;
-
-/**
- * @serial An index value used by makeVisible()
and
- * getVisibleIndex
.
- */
-private int visibleIndex;
-
-// The list of ItemListeners for this object.
-private ItemListener item_listeners;
-
-// The list of ActionListeners for this object.
-private ActionListener action_listeners;
-
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of List
with no visible lines
- * and multi-select disabled.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-List()
-{
- this(4, false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of List
with the specified
- * number of visible lines and multi-select disabled.
- *
- * @param rows The number of visible rows in the list.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-List(int rows)
-{
- this(rows, false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of List
with the specified
- * number of lines and the specified multi-select setting.
- *
- * @param rows The number of visible rows in the list.
- * @param multipleMode true
if multiple lines can be selected
- * simultaneously, false
otherwise.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-List(int rows, boolean multipleMode)
-{
- this.rows = rows;
- this.multipleMode = multipleMode;
-
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * Returns the number of items in this list.
- *
- * @return The number of items in this list.
- */
-public int
-getItemCount()
-{
- return countItems ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns the number of items in this list.
- *
- * @return The number of items in this list.
- *
- * @deprecated This method is deprecated in favor of
- * getItemCount()
- */
-public int
-countItems()
-{
- return items.size ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns the complete list of items.
- *
- * @return The complete list of items in the list.
- */
-public synchronized String[]
-getItems()
-{
- String[] l_items = new String[getItemCount()];
-
- items.copyInto(l_items);
- return(l_items);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the item at the specified index.
- *
- * @param index The index of the item to retrieve.
- *
- * @exception IndexOutOfBoundsException If the index value is not valid.
- */
-public String
-getItem(int index)
-{
- return((String)items.elementAt(index));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the number of visible rows in the list.
- *
- * @return The number of visible rows in the list.
- */
-public int
-getRows()
-{
- return(rows);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not multi-select mode is enabled.
- *
- * @return true
if multi-select mode is enabled,
- * false
otherwise.
- */
-public boolean
-isMultipleMode()
-{
- return allowsMultipleSelections ();
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not multi-select mode is enabled.
- *
- * @return true
if multi-select mode is enabled,
- * false
otherwise.
- *
- * @deprecated This method is deprecated in favor of
- * isMultipleMode()
.
- */
-public boolean
-allowsMultipleSelections()
-{
- return multipleMode;
-}
-
-/*************************************************************************/
-
-/**
- * This method enables or disables multiple selection mode for this
- * list.
- *
- * @param multipleMode true
to enable multiple mode,
- * false
otherwise.
- */
-public void
-setMultipleMode(boolean multipleMode)
-{
- setMultipleSelections (multipleMode);
-}
-
-/*************************************************************************/
-
-/**
- * This method enables or disables multiple selection mode for this
- * list.
- *
- * @param multipleMode true
to enable multiple mode,
- * false
otherwise.
- *
- * @deprecated
- */
-public void
-setMultipleSelections(boolean multipleMode)
-{
- this.multipleMode = multipleMode;
-
- ListPeer peer = (ListPeer) getPeer ();
- if (peer != null)
- peer.setMultipleMode (multipleMode);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size of this component.
- *
- * @return The minimum size of this component.
- */
-public Dimension
-getMinimumSize()
-{
- return getMinimumSize (getRows ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size of this component.
- *
- * @return The minimum size of this component.
- *
- * @deprecated This method is deprecated in favor of
- * getMinimumSize
.
- */
-public Dimension
-minimumSize()
-{
- return minimumSize (getRows ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size of this component assuming it had the specified
- * number of rows.
- *
- * @param rows The number of rows to size for.
- *
- * @return The minimum size of this component.
- */
-public Dimension
-getMinimumSize(int rows)
-{
- return minimumSize (rows);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size of this component assuming it had the specified
- * number of rows.
- *
- * @param rows The number of rows to size for.
- *
- * @return The minimum size of this component.
- *
- * @deprecated This method is deprecated in favor of
- * getMinimumSize(int)
>
- */
-public Dimension
-minimumSize(int rows)
-{
- ListPeer peer = (ListPeer) getPeer ();
- if (peer != null)
- return peer.minimumSize (rows);
- else
- return new Dimension (0, 0);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size of this component.
- *
- * @return The preferred size of this component.
- */
-public Dimension
-getPreferredSize()
-{
- return getPreferredSize (getRows ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size of this component.
- *
- * @return The preferred size of this component.
- *
- * @deprecated This method is deprecated in favor of
- * getPreferredSize
.
- */
-public Dimension
-preferredSize()
-{
- return preferredSize (getRows ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size of this component assuming it had the specified
- * number of rows.
- *
- * @param rows The number of rows to size for.
- *
- * @return The preferred size of this component.
- */
-public Dimension
-getPreferredSize(int rows)
-{
- return preferredSize (rows);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size of this component assuming it had the specified
- * number of rows.
- *
- * @param rows The number of rows to size for.
- *
- * @return The preferred size of this component.
- *
- * @deprecated This method is deprecated in favor of
- * getPreferredSize(int)
>
- */
-public Dimension
-preferredSize(int rows)
-{
- ListPeer peer = (ListPeer) getPeer ();
- if (peer != null)
- return peer.preferredSize (rows);
- else
- return new Dimension (0, 0);
-}
-
-/*************************************************************************/
-
-/**
- * This method adds the specified item to the end of the list.
- *
- * @param item The item to add to the list.
- */
-public void
-add(String item)
-{
- add (item, -1);
-}
-
-/*************************************************************************/
-
-/**
- * This method adds the specified item to the end of the list.
- *
- * @param item The item to add to the list.
- *
- * @deprecated Use add() instead.
- */
-public void
-addItem(String item)
-{
- addItem (item, -1);
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified item to the specified location in the list.
- * If the desired index is -1 or greater than the number of rows
- * in the list, then the item is added to the end.
- *
- * @param item The item to add to the list.
- * @param index The location in the list to add the item, or -1 to add
- * to the end.
- */
-public void
-add(String item, int index)
-{
- addItem (item, index);
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified item to the specified location in the list.
- * If the desired index is -1 or greater than the number of rows
- * in the list, then the item is added to the end.
- *
- * @param item The item to add to the list.
- * @param index The location in the list to add the item, or -1 to add
- * to the end.
- *
- * @deprecated Use add() instead.
- */
-public void
-addItem(String item, int index)
-{
- if ((index == -1) || (index >= items.size ()))
- items.addElement (item);
- else
- items.insertElementAt (item, index);
-
- ListPeer peer = (ListPeer) getPeer ();
- if (peer != null)
- peer.add (item, index);
-}
-
-/*************************************************************************/
-
-/**
- * Deletes the item at the specified index.
- *
- * @param index The index of the item to delete.
- *
- * @exception IllegalArgumentException If the index is not valid
- *
- * @deprecated
- */
-public void
-delItem(int index) throws IllegalArgumentException
-{
- items.removeElementAt (index);
-
- ListPeer peer = (ListPeer) getPeer ();
- if (peer != null)
- peer.delItems (index, index);
-}
-
-/*************************************************************************/
-
-/**
- * Deletes the item at the specified index.
- *
- * @param index The index of the item to delete.
- *
- * @exception IllegalArgumentException If the index is not valid
- */
-public void
-remove(int index) throws IllegalArgumentException
-{
- delItem (index);
-}
-
-/*************************************************************************/
-
-/**
- * Deletes all items in the specified index range.
- *
- * @param start The beginning index of the range to delete.
- * @param end The ending index of the range to delete.
- *
- * @exception IllegalArgumentException If the indexes are not valid
- *
- * @deprecated This method is deprecated for some unknown reason.
- */
-public synchronized void
-delItems(int start, int end) throws IllegalArgumentException
-{
- if ((start < 0) || (start >= items.size()))
- throw new IllegalArgumentException("Bad list start index value: " + start);
-
- if ((start < 0) || (start >= items.size()))
- throw new IllegalArgumentException("Bad list start index value: " + start);
-
- if (start > end)
- throw new IllegalArgumentException("Start is greater than end!");
-
- // We must run the loop in reverse direction.
- for (int i = end; i >= start; --i)
- items.removeElementAt (i);
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.delItems (start, end);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Deletes the first occurrence of the specified item from the list.
- *
- * @param item The item to delete.
- *
- * @exception IllegalArgumentException If the specified item does not exist.
- */
-public synchronized void
-remove(String item) throws IllegalArgumentException
-{
- int index = items.indexOf(item);
- if (index == -1)
- throw new IllegalArgumentException("List element to delete not found");
-
- remove(index);
-}
-
-/*************************************************************************/
-
-/**
- * Deletes all of the items from the list.
- */
-public synchronized void
-removeAll()
-{
- clear ();
-}
-
-/*************************************************************************/
-
-/**
- * Deletes all of the items from the list.
- *
- * @deprecated This method is deprecated in favor of removeAll()
.
- */
-public void
-clear()
-{
- items.clear();
-
- ListPeer peer = (ListPeer) getPeer ();
- if (peer != null)
- peer.removeAll ();
-}
-
-/*************************************************************************/
-
-/**
- * Replaces the item at the specified index with the specified item.
- *
- * @param item The new item value.
- * @param index The index of the item to replace.
- *
- * @exception IllegalArgumentException If the index is not valid.
- */
-public synchronized void
-replaceItem(String item, int index) throws IllegalArgumentException
-{
- if ((index < 0) || (index >= items.size()))
- throw new IllegalArgumentException("Bad list index: " + index);
-
- items.insertElementAt(item, index + 1);
- items.removeElementAt (index);
-
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
-
- /* We add first and then remove so that the selected
- item remains the same */
- l.add (item, index + 1);
- l.delItems (index, index);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns the index of the currently selected item. -1 will be returned
- * if there are no selected rows or if there are multiple selected rows.
- *
- * @return The index of the selected row.
- */
-public synchronized int
-getSelectedIndex()
-{
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- selected = l.getSelectedIndexes ();
- }
-
- if (selected == null || selected.length != 1)
- return -1;
- return selected[0];
-}
-
-/*************************************************************************/
-
-/**
- * Returns an array containing the indexes of the rows that are
- * currently selected.
- *
- * @return A list of indexes of selected rows.
- */
-public synchronized int[]
-getSelectedIndexes()
-{
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- selected = l.getSelectedIndexes ();
- }
- return selected;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the item that is currently selected, or null
if there
- * is no item selected. FIXME: What happens if multiple items selected?
- *
- * @return The selected item, or null
if there is no
- * selected item.
- */
-public synchronized String
-getSelectedItem()
-{
- int index = getSelectedIndex();
- if (index == -1)
- return(null);
-
- return((String)items.elementAt(index));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the list of items that are currently selected in this list.
- *
- * @return The list of currently selected items.
- */
-public synchronized String[]
-getSelectedItems()
-{
- int[] indexes = getSelectedIndexes();
- if (indexes == null)
- return(new String[0]);
-
- String[] retvals = new String[indexes.length];
- if (retvals.length > 0)
- for (int i = 0 ; i < retvals.length; i++)
- retvals[i] = (String)items.elementAt(indexes[i]);
-
- return(retvals);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the list of items that are currently selected in this list as
- * an array of type Object[]
instead of String[]
.
- *
- * @return The list of currently selected items.
- */
-public synchronized Object[]
-getSelectedObjects()
-{
- int[] indexes = getSelectedIndexes();
- if (indexes == null)
- return(new Object[0]);
-
- Object[] retvals = new Object[indexes.length];
- if (retvals.length > 0)
- for (int i = 0 ; i < retvals.length; i++)
- retvals[i] = items.elementAt(indexes[i]);
-
- return(retvals);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not the specified index is selected.
- *
- * @param index The index to test.
- *
- * @return true
if the index is selected, false
- * otherwise.
- */
-public boolean
-isIndexSelected(int index)
-{
- return isSelected (index);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not the specified index is selected.
- *
- * @param index The index to test.
- *
- * @return true
if the index is selected, false
- * otherwise.
- *
- * @deprecated This method is deprecated in favor of
- * isIndexSelected(int)
.
- */
-public boolean
-isSelected(int index)
-{
- int[] indexes = getSelectedIndexes ();
-
- for (int i = 0; i < indexes.length; i++)
- if (indexes[i] == index)
- return true;
-
- return false;
-}
-
-/*************************************************************************/
-
-/**
- * This method ensures that the item at the specified index is visible.
- *
- * @exception IllegalArgumentException If the specified index is out of
- * range.
- */
-public synchronized void
-makeVisible(int index) throws IllegalArgumentException
-{
- if ((index < 0) || (index >= items.size()))
- throw new IllegalArgumentException("Bad list index: " + index);
-
- visibleIndex = index;
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.makeVisible (index);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns the index of the last item that was made visible via the
- * makeVisible()
method.
- *
- * @return The index of the last item made visible via the
- * makeVisible()
method.
- */
-public int
-getVisibleIndex()
-{
- return(visibleIndex);
-}
-
-/*************************************************************************/
-
-/**
- * Makes the item at the specified index selected.
- *
- * @param index The index of the item to select.
- */
-public synchronized void
-select(int index)
-{
- ListPeer lp = (ListPeer)getPeer();
- if (lp != null)
- lp.select(index);
-}
-
-/*************************************************************************/
-
-/**
- * Makes the item at the specified index not selected.
- *
- * @param index The index of the item to unselect.
- */
-public synchronized void
-deselect(int index)
-{
- ListPeer lp = (ListPeer)getPeer();
- if (lp != null)
- lp.deselect(index);
-}
-
-/*************************************************************************/
-
-/**
- * Notifies this object to create its native peer.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createList (this);
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Notifies this object to destroy its native peer.
- */
-public void
-removeNotify()
-{
- super.removeNotify();
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified ActionListener
to the list of
- * registered listeners for this object.
- *
- * @param listener The listener to add.
- */
-public synchronized void
-addActionListener(ActionListener listener)
-{
- action_listeners = AWTEventMulticaster.add(action_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified ActionListener
from the list of
- * registers listeners for this object.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeActionListener(ActionListener listener)
-{
- action_listeners = AWTEventMulticaster.remove(action_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified ItemListener
to the list of
- * registered listeners for this object.
- *
- * @param listener The listener to add.
- */
-public synchronized void
-addItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.add(item_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified ItemListener
from the list of
- * registers listeners for this object.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeItemListener(ItemListener listener)
-{
- item_listeners = AWTEventMulticaster.remove(item_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified event for this object. If the event is an
- * instance of ActionEvent
then the
- * processActionEvent()
method is called. Similarly, if the
- * even is an instance of ItemEvent
then the
- * processItemEvent()
method is called. Otherwise the
- * superclass method is called to process this event.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof ActionEvent)
- processActionEvent((ActionEvent)event);
- else if (event instanceof ItemEvent)
- processItemEvent((ItemEvent)event);
- else
- super.processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * This method processes the specified event by dispatching it to any
- * registered listeners. Note that this method will only get called if
- * action events are enabled. This will happen automatically if any
- * listeners are added, or it can be done "manually" by calling
- * the enableEvents()
method.
- *
- * @param event The event to process.
- */
-protected void
-processActionEvent(ActionEvent event)
-{
- if (action_listeners != null)
- action_listeners.actionPerformed(event);
-}
-
-/*************************************************************************/
-
-/**
- * This method processes the specified event by dispatching it to any
- * registered listeners. Note that this method will only get called if
- * item events are enabled. This will happen automatically if any
- * listeners are added, or it can be done "manually" by calling
- * the enableEvents()
method.
- *
- * @param event The event to process.
- */
-protected void
-processItemEvent(ItemEvent event)
-{
- if (item_listeners != null)
- item_listeners.itemStateChanged(event);
-}
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= ItemEvent.ITEM_LAST
- && e.id >= ItemEvent.ITEM_FIRST
- && (item_listeners != null
- || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
- processEvent(e);
- else if (e.id <= ActionEvent.ACTION_LAST
- && e.id >= ActionEvent.ACTION_FIRST
- && (action_listeners != null
- || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
-protected String
-paramString()
-{
- return "multiple=" + multipleMode + ",rows=" + rows + super.paramString();
-}
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this List
. FooListeners are registered using the
- * addFooListener method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements java.util.EventListener.
- */
- public EventListener[] getListeners (Class listenerType)
- {
- if (listenerType == ActionListener.class)
- return AWTEventMulticaster.getListeners (action_listeners, listenerType);
-
- if (listenerType == ItemListener.class)
- return AWTEventMulticaster.getListeners (item_listeners, listenerType);
-
- return super.getListeners (listenerType);
- }
-
- /**
- * Returns all action listeners registered to this object.
- */
- public ActionListener[] getActionListeners ()
- {
- return (ActionListener[]) getListeners (ActionListener.class);
- }
-
- /**
- * Returns all action listeners registered to this object.
- */
- public ItemListener[] getItemListeners ()
- {
- return (ItemListener[]) getListeners (ItemListener.class);
- }
-
- // Accessibility internal class
- protected class AccessibleAWTList extends AccessibleAWTComponent
- implements AccessibleSelection, ItemListener, ActionListener
- {
- protected class AccessibleAWTListChild extends AccessibleAWTComponent
- implements Accessible
- {
- private int index;
- private List parent;
-
- public AccessibleAWTListChild(List parent, int indexInParent)
- {
- this.parent = parent;
- index = indexInParent;
- if (parent == null)
- index = -1;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.Accessible#getAccessibleContext()
- */
- public AccessibleContext getAccessibleContext()
- {
- return this;
- }
-
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.LIST_ITEM;
- }
-
- public AccessibleStateSet getAccessibleStateSet()
- {
- AccessibleStateSet states = super.getAccessibleStateSet();
- if (parent.isIndexSelected(index))
- states.add(AccessibleState.SELECTED);
- return states;
- }
-
- public int getAccessibleIndexInParent()
- {
- return index;
- }
-
- }
-
- public AccessibleAWTList()
- {
- addItemListener(this);
- addActionListener(this);
- }
-
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.LIST;
- }
-
- public AccessibleStateSet getAccessibleStateSet()
- {
- AccessibleStateSet states = super.getAccessibleStateSet();
- states.add(AccessibleState.SELECTABLE);
- if (isMultipleMode())
- states.add(AccessibleState.MULTISELECTABLE);
- return states;
- }
-
- public int getAccessibleChildrenCount()
- {
- return getItemCount();
- }
-
- public Accessible getAccessibleChild(int i)
- {
- if (i >= getItemCount())
- return null;
- return new AccessibleAWTListChild(List.this, i);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#getAccessibleSelectionCount()
- */
- public int getAccessibleSelectionCount()
- {
- return getSelectedIndexes().length;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#getAccessibleSelection()
- */
- public AccessibleSelection getAccessibleSelection()
- {
- return this;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#getAccessibleSelection(int)
- */
- public Accessible getAccessibleSelection(int i)
- {
- int[] items = getSelectedIndexes();
- if (i >= items.length)
- return null;
- return new AccessibleAWTListChild(List.this, items[i]);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#isAccessibleChildSelected(int)
- */
- public boolean isAccessibleChildSelected(int i)
- {
- return isIndexSelected(i);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#addAccessibleSelection(int)
- */
- public void addAccessibleSelection(int i)
- {
- select(i);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#removeAccessibleSelection(int)
- */
- public void removeAccessibleSelection(int i)
- {
- deselect(i);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#clearAccessibleSelection()
- */
- public void clearAccessibleSelection()
- {
- for (int i = 0; i < getItemCount(); i++)
- deselect(i);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleSelection#selectAllAccessibleSelection()
- */
- public void selectAllAccessibleSelection()
- {
- if (isMultipleMode())
- for (int i = 0; i < getItemCount(); i++)
- select(i);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- */
- public void itemStateChanged(ItemEvent event)
- {
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent event)
- {
- }
-
- }
-
- /**
- * Gets the AccessibleContext associated with this List
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTList();
- return accessibleContext;
- }
-} // class List
diff --git a/libjava/java/awt/MediaTracker.java b/libjava/java/awt/MediaTracker.java
deleted file mode 100644
index 45ed7b48b42..00000000000
--- a/libjava/java/awt/MediaTracker.java
+++ /dev/null
@@ -1,663 +0,0 @@
-/* MediaTracker.java -- Class used for keeping track of images
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.ImageObserver;
-import java.util.ArrayList;
-
-/**
- * This class is used for keeping track of the status of various media
- * objects.
- *
- * Media objects are tracked by assigning them an ID. It is possible
- * to assign the same ID to mutliple objects, effectivly grouping them
- * together. In this case the status flags ({@link #statusID}) and error flag
- * (@link #isErrorID} and {@link #getErrorId}) are ORed together. This
- * means that you cannot say exactly which media object has which status,
- * at most you can say that there are certain media objects with
- * some certain status.
- *
- * At the moment only images are supported by this class.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Bryce McKinlay
- */
-public class MediaTracker implements java.io.Serializable
-{
- /** Indicates that the media is still loading. */
- public static final int LOADING = 1 << 0;
-
- /** Indicates that the loading operation has been aborted. */
- public static final int ABORTED = 1 << 1;
-
- /** Indicates that an error has occured during loading of the media. */
- public static final int ERRORED = 1 << 2;
-
- /** Indicates that the media has been successfully and completely loaded. */
- public static final int COMPLETE = 1 << 3;
-
- /** The component on which the media is eventually been drawn. */
- Component target;
-
- /** The head of the linked list of tracked media objects. */
- MediaEntry head;
-
- /** Our serialVersionUID for serialization. */
- static final long serialVersionUID = -483174189758638095L;
-
- /**
- * This represents a media object that is tracked by a MediaTracker.
- * It also implements a simple linked list.
- */
- // FIXME: The serialized form documentation says MediaEntry is a
- // serializable field, but the serialized form of MediaEntry itself
- // doesn't appear to be documented.
- class MediaEntry implements ImageObserver
- {
- /** The ID of the media object. */
- int id;
-
- /** The media object. (only images are supported ATM). */
- Image image;
-
- /** The link to the next entry in the list. */
- MediaEntry next;
-
- /** The tracking status. */
- int status;
-
- /** The width of the image. */
- int width;
-
- /** The height of the image. */
- int height;
-
- /**
- * Receives notification from an {@link java.awt.image.ImageProducer}
- * that more data of the image is available.
- *
- * @param img the image that is updated
- * @param flags flags from the ImageProducer that indicate the status
- * of the loading process
- * @param x the X coordinate of the upper left corner of the image
- * @param y the Y coordinate of the upper left corner of the image
- * @param width the width of the image
- * @param height the height of the image
- *
- * @return true
if more data is needed, false
- * otherwise
- *
- * @see {@link java.awt.image.ImageObserver}
- */
- public boolean imageUpdate(Image img, int flags, int x, int y,
- int width, int height)
- {
- if ((flags & ABORT) != 0)
- status = ABORTED;
- else if ((flags & ERROR) != 0)
- status = ERRORED;
- else if ((flags & ALLBITS) != 0)
- status = COMPLETE;
- else
- status = 0;
-
- synchronized (MediaTracker.this)
- {
- MediaTracker.this.notifyAll();
- }
-
- // If status is not COMPLETE then we need more updates.
- return ((status & (COMPLETE | ERRORED | ABORTED)) == 0);
- }
- }
-
- /**
- * Constructs a new MediaTracker for the component c
. The
- * component should be the component that uses the media (i.e. draws it).
- *
- * @param c the Component that wants to use the media
- */
- public MediaTracker(Component c)
- {
- target = c;
- }
-
- /**
- * Adds an image to the tracker with the specified ID
.
- *
- * @param image the image to be added
- * @param id the ID of the tracker list to which the image is added
- */
- public void addImage(Image image, int id)
- {
- MediaEntry e = new MediaEntry();
- e.id = id;
- e.image = image;
- synchronized(this)
- {
- e.next = head;
- head = e;
- }
- }
-
- /**
- * Adds an image to the tracker with the specified ID
.
- * The image is expected to be rendered with the specified width and
- * height.
- *
- * @param image the image to be added
- * @param id the ID of the tracker list to which the image is added
- * @param width the width of the image
- * @param height the height of the image
- */
- public void addImage(Image image, int id, int width, int height)
- {
- MediaEntry e = new MediaEntry();
- e.id = id;
- e.image = image;
- e.width = width;
- e.height = height;
- synchronized(this)
- {
- e.next = head;
- head = e;
- }
- }
-
- /**
- * Checks if all media objects have finished loading, i.e. are
- * {@link #COMPLETE}, {@link #ABORTED} or {@link #ERRORED}.
- *
- * If the media objects are not already loading, a call to this
- * method does not start loading. This is equivalent to
- * a call to checkAll(false)
.
- *
- * @return if all media objects have finished loading either by beeing
- * complete, have been aborted or errored.
- */
- public boolean checkAll()
- {
- return checkAll(false);
- }
-
- /**
- * Checks if all media objects have finished loading, i.e. are
- * {@link #COMPLETE}, {@link #ABORTED} or {@link #ERRORED}.
- *
- * If the media objects are not already loading, and load
- * is true
then a call to this
- * method starts loading the media objects.
- *
- * @param load if true
this method starts loading objects
- * that are not already loading
- *
- * @return if all media objects have finished loading either by beeing
- * complete, have been aborted or errored.
- */
- public boolean checkAll(boolean load)
- {
- MediaEntry e = head;
- boolean result = true;
-
- while (e != null)
- {
- if ((e.status & (COMPLETE | ERRORED | ABORTED)) == 0)
- {
- if (load && ((e.status & LOADING) == 0))
- {
- e.status = LOADING;
- result = false;
- boolean complete = target.prepareImage(e.image, e);
- if (complete)
- {
- e.status = COMPLETE;
- result = true;
- }
- }
- else
- result = false;
- }
- e = e.next;
- }
- return result;
- }
-
- /**
- * Checks if any of the registered media objects has encountered an error
- * during loading.
- *
- * @return true
if at least one media object has encountered
- * an error during loading, false
otherwise
- *
- */
- public boolean isErrorAny()
- {
- MediaEntry e = head;
- while (e != null)
- {
- if ((e.status & ERRORED) != 0)
- return true;
- e = e.next;
- }
- return false;
- }
-
- /**
- * Returns all media objects that have encountered errors during loading.
- *
- * @return an array of all media objects that have encountered errors
- * or null
if there were no errors at all
- */
- public Object[] getErrorsAny()
- {
- MediaEntry e = head;
- ArrayList result = null;
- while (e != null)
- {
- if ((e.status & ERRORED) != 0)
- {
- if (result == null)
- result = new ArrayList();
- result.add(e.image);
- }
- e = e.next;
- }
- if (result == null)
- return null;
- else
- return result.toArray();
- }
-
- /**
- * Waits for all media objects to finish loading, either by completing
- * successfully or by aborting or encountering an error.
- *
- * @throws InterruptedException if another thread interrupted the
- * current thread while waiting
- */
- public void waitForAll() throws InterruptedException
- {
- synchronized (this)
- {
- while (checkAll(true) == false)
- wait();
- }
- }
-
- /**
- * Waits for all media objects to finish loading, either by completing
- * successfully or by aborting or encountering an error.
- *
- * This method waits at most ms
milliseconds. If the
- * media objects have not completed loading within this timeframe, this
- * method returns false
, otherwise true
.
- *
- * @param ms timeframe in milliseconds to wait for the media objects to
- * finish
- *
- * @return true
if all media objects have successfully loaded
- * within the timeframe, false
otherwise
- *
- * @throws InterruptedException if another thread interrupted the
- * current thread while waiting
- */
- public boolean waitForAll(long ms) throws InterruptedException
- {
- long start = System.currentTimeMillis();
- boolean result = checkAll(true);
- synchronized (this)
- {
- while (result == false)
- {
- wait(ms);
- result = checkAll(true);
- if ((System.currentTimeMillis() - start) > ms)
- break;
- }
- }
-
- return result;
- }
-
- /**
- * Returns the status flags of all registered media objects ORed together.
- * If load
is true
then media objects that
- * are not already loading will be started to load.
- *
- * @param load if set to true
then media objects that are
- * not already loading are started
- *
- * @return the status flags of all tracked media objects ORed together
- */
- public int statusAll(boolean load)
- {
- int result = 0;
- MediaEntry e = head;
- while (e != null)
- {
- if (load && e.status == 0)
- {
- boolean complete = target.prepareImage(e.image, e);
- if (complete)
- e.status = COMPLETE;
- else
- e.status = LOADING;
- }
- result |= e.status;
- e = e.next;
- }
- return result;
- }
-
- /**
- * Checks if the media objects with ID
have completed loading.
- *
- * @param id the ID of the media objects to check
- *
- * @return true
if all media objects with ID
- * have successfully finished
- */
- public boolean checkID(int id)
- {
- return checkID(id, false);
- }
-
- /**
- * Checks if the media objects with ID
have completed loading.
- * If load
is true
then media objects that
- * are not already loading will be started to load.
- *
- * @param id the ID of the media objects to check
- * @param load if set to true
then media objects that are
- * not already loading are started
- *
- * @return true
if all media objects with ID
- * have successfully finished
- */
- public boolean checkID(int id, boolean load)
- {
- MediaEntry e = head;
- boolean result = true;
-
- while (e != null)
- {
- if (e.id == id && ((e.status & (COMPLETE | ABORTED | ERRORED)) == 0))
- {
- if (load && ((e.status & LOADING) == 0))
- {
- e.status = LOADING;
- result = false;
- boolean complete = target.prepareImage(e.image, e);
- if (complete)
- {
- e.status = COMPLETE;
- result = true;
- }
- }
- else
- result = false;
- }
- e = e.next;
- }
- return result;
- }
-
- /**
- * Returns true
if any of the media objects with ID
- * have encountered errors during loading, false otherwise.
- *
- * @param id the ID of the media objects to check
- *
- * @return true
if any of the media objects with ID
- * have encountered errors during loading, false otherwise
- */
- public boolean isErrorID(int id)
- {
- MediaEntry e = head;
- while (e != null)
- {
- if (e.id == id && ((e.status & ERRORED) != 0))
- return true;
- e = e.next;
- }
- return false;
- }
-
- /**
- * Returns all media objects with the specified ID that have encountered
- * an error.
- *
- * @param id the ID of the media objects to check
- *
- * @return an array of all media objects with the specified ID that
- * have encountered an error
- */
- public Object[] getErrorsID(int id)
- {
- MediaEntry e = head;
- ArrayList result = null;
- while (e != null)
- {
- if (e.id == id && ((e.status & ERRORED) != 0))
- {
- if (result == null)
- result = new ArrayList();
- result.add(e.image);
- }
- e = e.next;
- }
- if (result == null)
- return null;
- else
- return result.toArray();
- }
-
- /**
- * Waits for all media objects with the specified ID to finish loading,
- * either by completing successfully or by aborting or encountering an error.
- *
- * @param id the ID of the media objects to wait for
- *
- * @throws InterruptedException if another thread interrupted the
- * current thread while waiting
- */
- public void waitForID(int id) throws InterruptedException
- {
- MediaEntry e = head;
- synchronized (this)
- {
- while (checkID (id, true) == false)
- wait();
- }
- }
-
- /**
- * Waits for all media objects with the specified ID to finish loading,
- * either by completing successfully or by aborting or encountering an error.
- *
- * This method waits at most ms
milliseconds. If the
- * media objects have not completed loading within this timeframe, this
- * method returns false
, otherwise true
.
- *
- * @param id the ID of the media objects to wait for
- * @param ms timeframe in milliseconds to wait for the media objects to
- * finish
- *
- * @return true
if all media objects have successfully loaded
- * within the timeframe, false
otherwise
- *
- * @throws InterruptedException if another thread interrupted the
- * current thread while waiting
- */
- public boolean waitForID(int id, long ms) throws InterruptedException
- {
- MediaEntry e = head;
- long start = System.currentTimeMillis();
- boolean result = checkID(id, true);
-
- synchronized (this)
- {
- while (result == false)
- {
- wait(ms);
- result = checkID(id, true);
- if ((System.currentTimeMillis() - start) > ms)
- break;
- }
- }
-
- return result;
- }
-
- /**
- * Returns the status flags of the media objects with the specified ID
- * ORed together.
- *
- * If load
is true
then media objects that
- * are not already loading will be started to load.
- *
- * @param load if set to true
then media objects that are
- * not already loading are started
- *
- * @return the status flags of all tracked media objects ORed together
- */
- public int statusID(int id, boolean load)
- {
- int result = 0;
- MediaEntry e = head;
- while (e != null)
- {
- if (e.id == id)
- {
- if (load && e.status == 0)
- {
- boolean complete = target.prepareImage(e.image, e);
- if (complete)
- e.status = COMPLETE;
- else
- e.status = LOADING;
- }
- result |= e.status;
- }
- e = e.next;
- }
- return result;
- }
-
- /**
- * Removes an image from this MediaTracker.
- *
- * @param image the image to be removed
- */
- public void removeImage(Image image)
- {
- synchronized (this)
- {
- MediaEntry e = head;
- MediaEntry prev = null;
- while (e != null)
- {
- if (e.image == image)
- {
- if (prev == null)
- head = e.next;
- else
- prev.next = e.next;
- }
- prev = e;
- e = e.next;
- }
- }
- }
-
- /**
- * Removes an image with the specified ID from this MediaTracker.
- *
- * @param image the image to be removed
- */
- public void removeImage(Image image, int id)
- {
- synchronized (this)
- {
- MediaEntry e = head;
- MediaEntry prev = null;
- while (e != null)
- {
- if (e.id == id && e.image == image)
- {
- if (prev == null)
- head = e.next;
- else
- prev.next = e.next;
- }
- else
- prev = e;
- e = e.next;
- }
- }
- }
-
- /**
- * Removes an image with the specified ID and scale from this MediaTracker.
- *
- * @param image the image to be removed
- */
- public void removeImage(Image image, int id, int width, int height)
- {
- synchronized (this)
- {
- MediaEntry e = head;
- MediaEntry prev = null;
- while (e != null)
- {
- if (e.id == id && e.image == image
- && e.width == width && e.height == height)
- {
- if (prev == null)
- head = e.next;
- else
- prev.next = e.next;
- }
- else
- prev = e;
- e = e.next;
- }
- }
- }
-}
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
deleted file mode 100644
index 56ceccfc542..00000000000
--- a/libjava/java/awt/Menu.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/* Menu.java -- A Java AWT Menu
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.peer.MenuPeer;
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * This class represents a pull down or tear off menu in Java's AWT.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Menu extends MenuItem implements MenuContainer, Serializable
-{
-
-/*
- * Static Variables
- */
-
-// Serialization Constant
-private static final long serialVersionUID = -8809584163345499784L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The actual items in the menu
- */
-private Vector items = new Vector();
-
-/**
- * @serial Flag indicating whether or not this menu is a tear off
- */
-private boolean tearOff;
-
-/**
- * @serial Indicates whether or not this is a help menu.
- */
-private boolean isHelpMenu;
-
- /*
- * @serial Unused in this implementation, but present in Sun's
- * serialization spec. Value obtained via reflection.
- */
- private int menuSerializedDataVersion = 1;
-
-static final transient String separatorLabel = "-";
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of Menu
with no label and that
- * is not a tearoff;
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-Menu()
-{
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Menu
that is not a tearoff and
- * that has the specified label.
- *
- * @param label The menu label.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-Menu(String label)
-{
- this(label, false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of Menu
with the specified
- * label and tearoff status.
- *
- * @param label The label for this menu
- * @param isTearOff true
if this menu is a tear off menu,
- * false
otherwise.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-Menu(String label, boolean isTearOff)
-{
- super(label);
-
- tearOff = isTearOff;
-
- if (label.equals("Help"))
- isHelpMenu = true;
-
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Tests whether or not this menu is a tearoff.
- *
- * @return true
if this menu is a tearoff, false
- * otherwise.
- */
-public boolean
-isTearOff()
-{
- return(tearOff);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the number of items in this menu.
- *
- * @return The number of items in this menu.
- */
-public int
-getItemCount()
-{
- return countItems ();
-}
-
-/**
- * Returns the number of items in this menu.
- *
- * @return The number of items in this menu.
- *
- * @deprecated As of JDK 1.1, replaced by getItemCount().
- */
-public int countItems ()
-{
- return items.size ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns the item at the specified index.
- *
- * @return The item at the specified index.
- *
- * @exception ArrayIndexOutOfBoundsException If the index value is not valid.
- */
-public MenuItem
-getItem(int index)
-{
- return((MenuItem)items.elementAt(index));
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified item to this menu. If it was previously part of
- * another menu, it is first removed from that menu.
- *
- * @param item The new item to add.
- *
- * @return The item that was added.
- */
-public MenuItem
-add(MenuItem item)
-{
- items.addElement(item);
- if (item.parent != null)
- {
- item.parent.remove(item);
- }
- item.parent = this;
-
- if (peer != null)
- {
- MenuPeer mp = (MenuPeer) peer;
- mp.addItem(item);
- }
-
- return item;
-}
-
-/*************************************************************************/
-
-/**
- * Add an item with the specified label to this menu.
- *
- * @param label The label of the menu item to add.
- */
-public void
-add(String label)
-{
- add(new MenuItem(label));
-}
-
-/*************************************************************************/
-
-/**
- * Inserts the specified menu item into this menu at the specified index.
- *
- * @param item The menu item to add.
- * @param index The index of the menu item.
- *
- * @exception IllegalArgumentException If the index is less than zero.
- * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
- */
-public void
-insert(MenuItem item, int index)
-{
- if (index < 0)
- throw new IllegalArgumentException("Index is less than zero");
-
- MenuPeer peer = (MenuPeer) getPeer();
- if (peer == null)
- return;
-
- int count = getItemCount ();
-
- if (index >= count)
- peer.addItem (item);
- else
- {
- for (int i = count - 1; i >= index; i--)
- peer.delItem (i);
-
- peer.addItem (item);
-
- for (int i = index; i < count; i++)
- peer.addItem ((MenuItem) items.elementAt (i));
- }
-
- items.insertElementAt(item, index);
-}
-
-/*************************************************************************/
-
-/**
- * Inserts an item with the specified label into this menu at the specified index.
- *
- * @param label The label of the item to add.
- * @param index The index of the menu item.
- *
- * @exception IllegalArgumentException If the index is less than zero.
- * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
- */
-public void
-insert(String label, int index)
-{
- insert(new MenuItem(label), index);
-}
-
-/*************************************************************************/
-
-/**
- * Adds a separator bar at the current menu location.
- */
-public void
-addSeparator()
-{
- add(new MenuItem(separatorLabel));
-}
-
-/*************************************************************************/
-
-/**
- * Inserts a separator bar at the specified index value.
- *
- * @param index The index at which to insert a separator bar.
- *
- * @exception IllegalArgumentException If the index is less than zero.
- * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
- */
-public void
-insertSeparator(int index)
-{
- insert(new MenuItem(separatorLabel), index);
-}
-
-/*************************************************************************/
-
-/**
- * Deletes the item at the specified index from this menu.
- *
- * @param index The index of the item to remove.
- *
- * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
- */
-public synchronized void
-remove(int index)
-{
- items.removeElementAt(index);
-
- MenuPeer mp = (MenuPeer)getPeer();
- if (mp != null)
- mp.delItem(index);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specifed item from the menu. If the specified component
- * does not exist, this method does nothing.
- *
- * @param item The component to remove.
- */
-public void
-remove(MenuComponent item)
-{
- int index = items.indexOf(item);
- if (index == -1)
- return;
-
- remove(index);
-}
-
-/*************************************************************************/
-
-/**
- * Removes all the elements from this menu.
- */
-public synchronized void
-removeAll()
-{
- int count = getItemCount();
- for(int i = 0; i < count; i++)
- {
- // We must always remove item 0.
- remove(0);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Creates the native peer for this object.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit().createMenu(this);
- Enumeration e = items.elements();
- while (e.hasMoreElements())
- {
- MenuItem mi = (MenuItem)e.nextElement();
- mi.addNotify();
- }
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Destroys the native peer for this object.
- */
-public void
-removeNotify()
-{
- Enumeration e = items.elements();
- while (e.hasMoreElements())
- {
- MenuItem mi = (MenuItem) e.nextElement();
- mi.removeNotify();
- }
- super.removeNotify();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this menu.
- *
- * @return A debugging string for this menu.
- */
-public String
-paramString()
-{
- return (",tearOff=" + tearOff + ",isHelpMenu=" + isHelpMenu
- + super.paramString());
-}
-
- /**
- * Basic Accessibility class for Menu. Details get provided in derived
- * classes.
- */
- protected class AccessibleAWTMenu extends AccessibleAWTMenuItem
- {
- protected AccessibleAWTMenu()
- {
- }
-
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.MENU;
- }
- }
-
- /**
- * Gets the AccessibleContext associated with this Menu
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTMenu();
- return accessibleContext;
- }
-
-} // class Menu
diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java
deleted file mode 100644
index 4089fe189e0..00000000000
--- a/libjava/java/awt/MenuBar.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/* MenuBar.java -- An AWT menu bar class
- Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.peer.MenuBarPeer;
-import java.awt.peer.MenuComponentPeer;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * This class implements a menu bar in the AWT system.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@redhat.com)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-public class MenuBar extends MenuComponent
- implements MenuContainer, Serializable, Accessible
-{
-
-/*
- * Static Variables
- */
-
-// Serialization Constant
-private static final long serialVersionUID = -4930327919388951260L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The menu used for providing help information
- */
-private Menu helpMenu;
-
-/**
- * @serial The menus contained in this menu bar.
- */
-private Vector menus = new Vector();
-
- /**
- * The accessible context for this component.
- *
- * @see #getAccessibleContext()
- * @serial ignored.
- */
- private transient AccessibleContext accessibleContext;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of MenuBar
.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-MenuBar()
-{
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the help menu for this menu bar. This may be null
.
- *
- * @return The help menu for this menu bar.
- */
-public Menu
-getHelpMenu()
-{
- return(helpMenu);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the help menu for this menu bar.
- *
- * @param menu The new help menu for this menu bar.
- */
-public synchronized void
-setHelpMenu(Menu menu)
-{
- if (helpMenu != null)
- {
- helpMenu.removeNotify ();
- helpMenu.parent = null;
- }
- helpMenu = menu;
-
- if (menu.parent != null)
- menu.parent.remove (menu);
- menu.parent = this;
-
- MenuBarPeer peer = (MenuBarPeer) getPeer ();
- if (peer != null)
- {
- menu.addNotify();
- peer.addHelpMenu (menu);
- }
-}
-
-/*************************************************************************/
-
-/** Add a menu to this MenuBar. If the menu has already has a
- * parent, it is first removed from its old parent before being
- * added.
- *
- * @param menu The menu to add.
- *
- * @return The menu that was added.
- */
-public synchronized Menu
-add(Menu menu)
-{
- if (menu.parent != null)
- menu.parent.remove (menu);
-
- menu.parent = this;
- menus.addElement(menu);
-
- if (peer != null)
- {
- menu.addNotify();
- }
-
- return(menu);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the menu at the specified index.
- *
- * @param index The index of the menu to remove from the menu bar.
- */
-public synchronized void
-remove(int index)
-{
- Menu m = (Menu) menus.get (index);
- menus.remove (index);
- m.removeNotify ();
- m.parent = null;
-
- if (peer != null)
- {
- MenuBarPeer mp = (MenuBarPeer) peer;
- mp.delMenu (index);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified menu from the menu bar.
- *
- * @param menu The menu to remove from the menu bar.
- */
-public void
-remove(MenuComponent menu)
-{
- int index = menus.indexOf(menu);
- if (index == -1)
- return;
-
- remove(index);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the number of elements in this menu bar.
- *
- * @return The number of elements in the menu bar.
- */
-public int
-getMenuCount()
-{
- return countMenus ();
-}
-
-/*************************************************************************/
-
-/**
- * Returns the number of elements in this menu bar.
- *
- * @return The number of elements in the menu bar.
- *
- * @deprecated This method is deprecated in favor of getMenuCount()
.
- */
-public int
-countMenus()
-{
- return menus.size () + (getHelpMenu () == null ? 0 : 1);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the menu at the specified index.
- *
- * @param index the index of the menu
- *
- * @return The requested menu.
- *
- * @exception ArrayIndexOutOfBoundsException If the index is not valid.
- */
-public Menu
-getMenu(int index)
-{
- return((Menu)menus.elementAt(index));
-}
-
-/*************************************************************************/
-
-/**
- * Creates this object's native peer.
- */
-public void
-addNotify()
-{
- if (getPeer() == null)
- setPeer((MenuComponentPeer)getToolkit().createMenuBar(this));
- Enumeration e = menus.elements();
- while (e.hasMoreElements())
- {
- Menu mi = (Menu)e.nextElement();
- mi.addNotify();
- }
- if (helpMenu != null)
- {
- helpMenu.addNotify();
- ((MenuBarPeer) peer).addHelpMenu(helpMenu);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Destroys this object's native peer.
- */
-public void
-removeNotify()
-{
- Enumeration e = menus.elements();
- while (e.hasMoreElements())
- {
- Menu mi = (Menu) e.nextElement();
- mi.removeNotify();
- }
- super.removeNotify();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a list of all shortcuts for the menus in this menu bar.
- *
- * @return A list of all shortcuts for the menus in this menu bar.
- */
-public synchronized Enumeration
-shortcuts()
-{
- Vector shortcuts = new Vector();
- Enumeration e = menus.elements();
-
- while (e.hasMoreElements())
- {
- Menu menu = (Menu)e.nextElement();
- if (menu.getShortcut() != null)
- shortcuts.addElement(menu.getShortcut());
- }
-
- return(shortcuts.elements());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the menu item for the specified shortcut, or null
- * if no such item exists.
- *
- * @param shortcut The shortcut to return the menu item for.
- *
- * @return The menu item for the specified shortcut.
- */
-public MenuItem
-getShortcutMenuItem(MenuShortcut shortcut)
-{
- Enumeration e = menus.elements();
-
- while (e.hasMoreElements())
- {
- Menu menu = (Menu)e.nextElement();
- MenuShortcut s = menu.getShortcut();
- if ((s != null) && (s.equals(shortcut)))
- return(menu);
- }
-
- return(null);
-}
-
-/*************************************************************************/
-
-/**
- * Deletes the specified menu shortcut.
- *
- * @param shortcut The shortcut to delete.
- */
-public void
-deleteShortcut(MenuShortcut shortcut)
-{
- MenuItem it;
- // This is a slow implementation, but it probably doesn't matter.
- while ((it = getShortcutMenuItem (shortcut)) != null)
- it.deleteShortcut ();
-}
-
-/**
- * Gets the AccessibleContext associated with this MenuBar
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
-public AccessibleContext getAccessibleContext()
-{
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTMenuBar();
- return accessibleContext;
-}
-
-/**
- * This class provides accessibility support for AWT menu bars.
- *
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-protected class AccessibleAWTMenuBar
- extends AccessibleAWTMenuComponent
-{
-
- /**
- * Compatible with JDK 1.4.2 revision 5
- */
- private static final long serialVersionUID = -8577604491830083815L;
-
- /**
- * This is the default constructor, which simply calls the default
- * constructor of the superclass.
- */
- protected AccessibleAWTMenuBar()
- {
- super();
- }
-
- /**
- * Returns the accessible role relating to the menu bar.
- *
- * @return AccessibleRole.MENU_BAR
.
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.MENU_BAR;
- }
-
-} // class AccessibleAWTMenuBar
-
-} // class MenuBar
diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java
deleted file mode 100644
index ec6980e10ca..00000000000
--- a/libjava/java/awt/MenuComponent.java
+++ /dev/null
@@ -1,1324 +0,0 @@
-/* MenuComponent.java -- Superclass of all AWT menu components
- Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.peer.MenuComponentPeer;
-import java.io.Serializable;
-import java.util.Locale;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleComponent;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleSelection;
-import javax.accessibility.AccessibleStateSet;
-
-/**
- * This is the superclass of all menu AWT widgets.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-public abstract class MenuComponent implements Serializable
-{
-
-/*
- * Static Variables
- */
-
-// Serialization Constant
-private static final long serialVersionUID = -4536902356223894379L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * The font for this component.
- *
- * @see #getFont()
- * @see #setFont(java.awt.Font)
- * @serial the component's font.
- */
- private Font font;
-
- /**
- * The name of the component.
- *
- * @see #getName()
- * @see #setName(String)
- * @serial the component's name.
- */
- private String name;
-
- /**
- * The parent of this component.
- *
- * @see #getParent()
- * @see #setParent(java.awt.MenuContainer)
- * @serial ignored.
- */
- transient MenuContainer parent;
-
- /**
- * The native peer for this component.
- *
- * @see #getPeer()
- * @see #setPeer(java.awt.peer.MenuComponentPeer)
- * @serial ignored.
- */
- transient MenuComponentPeer peer;
-
- /**
- * The synchronization locking object for this component.
- *
- * @serial ignored.
- */
- private transient Object tree_lock = this;
-
- /**
- * The toolkit for this object.
- *
- * @see #getToolkit()
- * @serial ignored.
- */
- private static transient Toolkit toolkit = Toolkit.getDefaultToolkit();
-
- /**
- * The accessible context for this component.
- *
- * @see #getAccessibleContext()
- * @serial the accessibility information for this component.
- */
- AccessibleContext accessibleContext;
-
- /**
- * Was the name of the component set? This value defaults
- * to false and becomes true after a call to setName()
.
- * Please note that this does not guarantee that name will then
- * be non-null, as this may be the value passed to setName()
.
- *
- * @see #setName(String)
- * @serial true if the name value has been explicitly set by calling
- * setName()
.
- */
- private boolean nameExplicitlySet;
-
- /**
- * Does this component handle new events? Events will be handled
- * by this component if this is true. Otherwise, they will be forwarded
- * up the component hierarchy. This implementation does not use this
- * variable; it is merely provided for serialization compatability.
- *
- * @see #dispatchEvent(AWTEvent)
- * @serial true if events are to be processed locally. Unused.
- */
- private boolean newEventsOnly;
-
- /**
- * The focus listener chain handler which deals with focus events for
- * the accessible context of this component.
- *
- * @see AccessibleAWTMenuComponent#addFocusListener(java.awt.event.FocusListener)
- * @serial ignored.
- * This is package-private to avoid an accessor method.
- */
- transient FocusListener focusListener;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Default constructor for subclasses.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-MenuComponent()
-{
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the font in use for this component.
- *
- * @return The font for this component.
- */
-public Font
-getFont()
-{
- if (font != null)
- return font;
-
- if (parent != null)
- return parent.getFont ();
-
- return null;
-}
-
-/*************************************************************************/
-
-/**
- * Sets the font for this component to the specified font.
- *
- * @param font The new font for this component.
- */
-public void
-setFont(Font font)
-{
- this.font = font;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the name of this component.
- *
- * @return The name of this component.
- */
-public String
-getName()
-{
- return(name);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the name of this component to the specified name.
- *
- * @param name The new name of this component.
- */
-public void
-setName(String name)
-{
- this.name = name;
- nameExplicitlySet = true;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the parent of this component.
- *
- * @return The parent of this component.
- */
-public MenuContainer
-getParent()
-{
- return(parent);
-}
-
-/*************************************************************************/
-
-// Sets the parent of this component.
-final void
-setParent(MenuContainer parent)
-{
- this.parent = parent;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the native windowing system peer for this component.
- *
- * @return The peer for this component.
- *
- * @deprecated
- */
-public MenuComponentPeer
-getPeer()
-{
- return(peer);
-}
-
-/*************************************************************************/
-
-// Sets the peer for this component.
-final void
-setPeer(MenuComponentPeer peer)
-{
- this.peer = peer;
-}
-
-/*************************************************************************/
-
-/**
- * Destroys this component's native peer
- */
-public void
-removeNotify()
-{
- if (peer != null)
- peer.dispose();
- peer = null;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the toolkit in use for this component.
- *
- * @return The toolkit for this component.
- */
-final Toolkit
-getToolkit()
-{
- return(toolkit);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the object used for synchronization locks on this component
- * when performing tree and layout functions.
- *
- * @return The synchronization lock for this component.
- */
-protected final Object
-getTreeLock()
-{
- return(tree_lock);
-}
-
-/*************************************************************************/
-
-// The sync lock object for this component.
-final void
-setTreeLock(Object tree_lock)
-{
- this.tree_lock = tree_lock;
-}
-
-/*************************************************************************/
-
-/**
- * AWT 1.0 event dispatcher.
- *
- * @deprecated Deprecated in favor of dispatchEvent()
.
- * @return true if the event was dispatched, false otherwise.
- */
-public boolean
-postEvent(Event event)
-{
- // This is overridden by subclasses that support events.
- return false;
-}
-/*************************************************************************/
-
-/**
- * Sends this event to this component or a subcomponent for processing.
- *
- * @param event The event to dispatch
- */
-public final void dispatchEvent(AWTEvent event)
-{
- // See comment in Component.dispatchEvent().
- dispatchEventImpl(event);
-}
-
-
-/**
- * Implementation of dispatchEvent. Allows trusted package classes
- * to dispatch additional events first. This implementation first
- * translates event
to an AWT 1.0 event and sends the
- * result to {@link #postEvent}. The event is then
- * passed on to {@link #processEvent} for local processing.
- *
- * @param event the event to dispatch.
- */
-void dispatchEventImpl(AWTEvent event)
-{
- Event oldStyleEvent;
-
- // This is overridden by subclasses that support events.
- /* Convert AWT 1.1 event to AWT 1.0 event */
- oldStyleEvent = Component.translateEvent(event);
- if (oldStyleEvent != null)
- {
- postEvent(oldStyleEvent);
- }
- /* Do local processing */
- processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified event. In this class, this method simply
- * calls one of the more specific event handlers.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- /*
- Pass a focus event to the focus listener for
- the accessibility context.
- */
- if (event instanceof FocusEvent)
- {
- if (focusListener != null)
- {
- switch (event.id)
- {
- case FocusEvent.FOCUS_GAINED:
- focusListener.focusGained((FocusEvent) event);
- break;
- case FocusEvent.FOCUS_LOST:
- focusListener.focusLost((FocusEvent) event);
- break;
- }
- }
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this component.
- *
- * @return A string representation of this component
- */
-public String
-toString()
-{
- return this.getClass().getName() + "[" + paramString() + "]";
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this component
- */
-protected String
-paramString()
-{
- return "name=" + getName();
-}
-
-/**
- * Gets the AccessibleContext associated with this MenuComponent
.
- * As an abstract class, we return null. Concrete subclasses should return
- * their implementation of the accessibility context.
- *
- * @return null.
- */
-
-public AccessibleContext getAccessibleContext()
-{
- return null;
-}
-
-/**
- * This class provides a base for the accessibility support of menu
- * components.
- *
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-protected abstract class AccessibleAWTMenuComponent
- extends AccessibleContext
- implements Serializable, AccessibleComponent, AccessibleSelection
-{
-
- /**
- * Compatible with JDK 1.4.2 revision 5
- */
- private static final long serialVersionUID = -4269533416223798698L;
-
- /**
- * This is the default constructor. It should be called by
- * concrete subclasses to ensure necessary groundwork is completed.
- */
- protected AccessibleAWTMenuComponent()
- {
- }
-
- /**
- * Replaces or supplements the component's selection with the
- * Accessible
child at the supplied index. If
- * the component supports multiple selection, the child is
- * added to the current selection. Otherwise, the current
- * selection becomes the specified child. If the child is
- * already selected, nothing happens.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- *
- * @param index the index of the specified child within a
- * zero-based list of the component's children.
- */
- public void addAccessibleSelection(int index)
- {
- /* Subclasses with children should implement this */
- }
-
- /**
- * Registers the specified focus listener to receive
- * focus events from this component.
- *
- * @param listener the new focus listener.
- */
- public void addFocusListener(FocusListener listener)
- {
- /*
- * Chain the new focus listener to the existing chain
- * of focus listeners. Each new focus listener is
- * coupled via multicasting to the existing chain.
- */
- focusListener = AWTEventMulticaster.add(focusListener, listener);
- }
-
- /**
- * Clears the component's current selection. Following
- * the calling of this method, no children of the component
- * will be selected.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- */
- public void clearAccessibleSelection()
- {
- }
-
- /**
- * Returns true if the specified point lies within the
- * component. The supplied co-ordinates are assumed to
- * be relative to the co-ordinate system of the component
- * itself. Thus, the point (0,0) is the upper left corner
- * of this component.
- *
- *
- * Please note that this method depends on a correctly implemented
- * version of the getBounds()
method. Subclasses
- * must provide the bounding rectangle via getBounds()
- * in order for this method to work.
- *
- * @param point the point to check against this component.
- * @return true if the point is within this component.
- * @see #getBounds()
- */
- public boolean contains(Point point)
- {
- /*
- We can simply return the result of a
- test for containment in the bounding rectangle
- */
- return getBounds().contains(point);
- }
-
- /**
- * Returns the Accessible
child of this component present
- * at the specified point. The supplied co-ordinates are
- * assumed to be relative to the co-ordinate system of this
- * component (the parent of any returned accessible). Thus,
- * the point (0,0) is the upper left corner of this menu
- * component.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- *
- * @param point the point at which the returned accessible
- * is located.
- * @return null.
- */
- public Accessible getAccessibleAt(Point point)
- {
- return null;
- }
-
- /**
- * Returns the Accessible
child at the supplied
- * index within the list of children of this component.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- *
- * @param index the index of the Accessible
child
- * to retrieve.
- * @return null.
- */
- public Accessible getAccessibleChild(int index)
- {
- return null;
- }
-
- /**
- * Returns the number of children of this component which
- * implement the Accessible
interface. If
- * all children of this component are accessible, then
- * the returned value will be the same as the number of
- * children.
- *
- *
- *
- * @return 0.
- */
- public int getAccessibleChildrenCount()
- {
- return 0;
- }
-
- /**
- * Retrieves the AccessibleComponent
associated
- * with this accessible context and its component. As the
- * context itself implements AccessibleComponent
,
- * this is the return value.
- *
- * @return the context itself.
- */
- public AccessibleComponent getAccessibleComponent()
- {
- return this;
- }
-
- /**
- * Returns the accessible name for this menu component. This
- * is the name given to the component, which may be null if
- * not set using setName()
.
- *
- *
- * The name is not the most appropriate description of this
- * object. Subclasses should preferably provide a more
- * accurate description. For example, a File menu could
- * have the description `Lists commands related to the
- * file system'.
- *
- * @return a description of the component. Currently,
- * this is just the contents of the name property.
- * @see MenuComponent#setName(String)
- */
- public String getAccessibleDescription()
- {
- return MenuComponent.this.getName();
- }
-
- /**
- * Retrieves the index of this component within its parent.
- * If no parent exists, -1 is returned.
- *
- * @return -1 as the parent, a MenuContainer
- * is not Accessible
.
- */
- public int getAccessibleIndexInParent()
- {
- return -1;
- }
-
- /**
- * Returns the accessible name of this component. This
- * is the name given to the component, which may be null if
- * not set using setName()
.
- *
- *
- * The name property is not the most suitable string to return
- * for this method. The string should be localized, and
- * relevant to the operation of the component. For example,
- * it could be the text of a menu item. However, this can
- * not be used at this level of abstraction, so it is the
- * responsibility of subclasses to provide a more appropriate
- * name.
- *
- * @return a localized name for this component. Currently, this
- * is just the contents of the name property.
- * @see MenuComponent#setName(String)
- */
- public String getAccessibleName()
- {
- return MenuComponent.this.getName();
- }
-
- /**
- * Returns the Accessible
parent of this component.
- * As the parent of a MenuComponent
is a
- * MenuContainer
, which doesn't implement
- * Accessible
, this method returns null.
- *
- * @return null.
- */
- public Accessible getAccessibleParent()
- {
- return null;
- }
-
- /**
- * Returns the accessible role of this component.
- *
- *
- * The abstract implementation of this method returns
- * AccessibleRole.AWT_COMPONENT
,
- * as the abstract component has no specific role. This
- * method should be overridden by concrete subclasses, so
- * as to return an appropriate role for the component.
- *
- * @return AccessibleRole.AWT_COMPONENT
.
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.AWT_COMPONENT;
- }
-
- /**
- * Retrieves the AccessibleSelection
associated
- * with this accessible context and its component. As the
- * context itself implements AccessibleSelection
,
- * this is the return value.
- *
- * @return the context itself.
- */
- public AccessibleSelection getAccessibleSelection()
- {
- return this;
- }
-
- /**
- * Retrieves the Accessible
selected child
- * at the specified index. If there are no selected children
- * or the index is outside the range of selected children,
- * null is returned. Please note that the index refers
- * to the index of the child in the list of selected
- * children, and not the index of the child in
- * the list of all Accessible
children.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- *
- * @param index the index of the selected Accessible
- * child.
- */
- public Accessible getAccessibleSelection(int index)
- {
- return null;
- }
-
- /**
- * Returns a count of the number of Accessible
- * children of this component which are currently selected.
- * If there are no children currently selected, 0 is returned.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- *
- * @return 0.
- */
- public int getAccessibleSelectionCount()
- {
- return 0;
- }
-
- /**
- * Retrieves the current state of this component
- * in an accessible form. For example, a given component
- * may be visible, selected, disabled, etc.
- *
- *
- * As this class tells us virtually nothing about the component,
- * except for its name and font, no state information can be
- * provided. This implementation thus returns an empty
- * state set, and it is left to concrete subclasses to provide
- * a more acceptable and relevant state set. Changes to these
- * properties also need to be handled using
- * PropertyChangeListener
s.
- *
- * @return an empty AccessibleStateSet
.
- */
- public AccessibleStateSet getAccessibleStateSet()
- {
- return new AccessibleStateSet();
- }
-
- /**
- * Returns the background color of the component, or null
- * if this property is unsupported.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply returns the
- * default system background color used for rendering menus.
- * Concrete subclasses which handle the drawing of an onscreen
- * menu component should override this method and provide
- * the appropriate information.
- *
- * @return the default system background color for menus.
- * @see #setBackground(java.awt.Color)
- */
- public Color getBackground()
- {
- return SystemColor.menu;
- }
-
- /**
- * Returns a Rectangle
which represents the
- * bounds of this component. The returned rectangle has the
- * height and width of the component's bounds, and is positioned
- * at a location relative to this component's parent, the
- * MenuContainer
. null is returned if bounds
- * are not supported by the component.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply returns null.
- * Concrete subclasses which handle the drawing of an onscreen
- * menu component should override this method and provide
- * the appropriate information.
- *
- * @return null.
- * @see #setBounds(java.awt.Rectangle)
- */
- public Rectangle getBounds()
- {
- return null;
- }
-
- /**
- * Returns the Cursor
displayed when the pointer
- * is positioned over this component. Alternatively, null
- * is returned if the component doesn't support the cursor
- * property.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply returns the default
- * system cursor. Concrete subclasses which handle the drawing
- * of an onscreen menu component may override this method and provide
- * the appropriate information.
- *
- * @return the default system cursor.
- * @see #setCursor(java.awt.Cursor)
- */
- public Cursor getCursor()
- {
- return Cursor.getDefaultCursor();
- }
-
- /**
- * Returns the Font
used for text created by this component.
- *
- * @return the current font.
- * @see #setFont(java.awt.Font)
- */
- public Font getFont()
- {
- return MenuComponent.this.getFont();
- }
-
- /**
- * Retrieves information on the rendering and metrics of the supplied
- * font. If font metrics are not supported by this component, null
- * is returned.
- *
- *
- * The abstract implementation of this method simply uses the toolkit
- * to obtain the FontMetrics
. Concrete subclasses may
- * find it more efficient to invoke their peer class directly, if one
- * is available.
- *
- * @param font the font about which to retrieve rendering and metric
- * information.
- * @return the metrics of the given font, as provided by the system
- * toolkit.
- * @throws NullPointerException if the supplied font was null.
- */
- public FontMetrics getFontMetrics(Font font)
- {
- return MenuComponent.this.getToolkit().getFontMetrics(font);
- }
-
- /**
- * Returns the foreground color of the component, or null
- * if this property is unsupported.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply returns the
- * default system text color used for rendering menus.
- * Concrete subclasses which handle the drawing of an onscreen
- * menu component should override this method and provide
- * the appropriate information.
- *
- * @return the default system text color for menus.
- * @see #setForeground(java.awt.Color)
- */
- public Color getForeground()
- {
- return SystemColor.menuText;
- }
-
- /**
- * Returns the locale currently in use by this component.
- *
- *
- * This abstract class has no property relating to the
- * locale used by the component, so this method simply
- * returns the default locale for the current instance
- * of the Java Virtual Machine (JVM). Concrete subclasses
- * which maintain such a property should override this method
- * and provide the locale information more accurately.
- *
- * @return the default locale for this JVM instance.
- */
- public Locale getLocale()
- {
- return Locale.getDefault();
- }
-
- /**
- * Returns the location of the component, with co-ordinates
- * relative to the parent component and using the co-ordinate
- * space of the screen. Thus, the point (0,0) is the upper
- * left corner of the parent component.
- *
- *
- * Please note that this method depends on a correctly implemented
- * version of the getBounds()
method. Subclasses
- * must provide the bounding rectangle via getBounds()
- * in order for this method to work.
- *
- * @return the location of the component, relative to its parent.
- * @see #setLocation(java.awt.Point)
- */
- public Point getLocation()
- {
- /* Simply return the location of the bounding rectangle */
- return getBounds().getLocation();
- }
-
- /**
- * Returns the location of the component, with co-ordinates
- * relative to the screen. Thus, the point (0,0) is the upper
- * left corner of the screen. null is returned if the component
- * is either not on screen or if this property is unsupported.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply returns null.
- * Concrete subclasses which handle the drawing of an onscreen
- * menu component should override this method and provide
- * the appropriate information.
- *
- * @return the location of the component, relative to the screen.
- */
- public Point getLocationOnScreen()
- {
- return null;
- }
-
- /**
- * Returns the size of the component.
- *
- *
- * Please note that this method depends on a correctly implemented
- * version of the getBounds()
method. Subclasses
- * must provide the bounding rectangle via getBounds()
- * in order for this method to work.
- *
- * @return the size of the component.
- * @see #setSize(java.awt.Dimension)
- */
- public Dimension getSize()
- {
- /* Simply return the size of the bounding rectangle */
- return getBounds().getSize();
- }
-
- /**
- * Returns true if the accessible child specified by the supplied index
- * is currently selected.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- *
- * @param index the index of the accessible child to check for selection.
- * @return false.
- */
- public boolean isAccessibleChildSelected(int index)
- {
- return false;
- }
-
- /**
- * Returns true if this component is currently enabled.
- *
- *
- * As this abstract component has no properties related to
- * its enabled or disabled state, the implementation of this
- * method is left to subclasses.
- *
- * @return false.
- * @see #setEnabled(boolean)
- */
- public boolean isEnabled()
- {
- return false;
- }
-
- /**
- * Returns true if this component is included in the traversal
- * of the current focus from one component to the other.
- *
- *
- * As this abstract component has no properties related to
- * its ability to accept the focus, the implementation of this
- * method is left to subclasses.
- *
- * @return false.
- */
- public boolean isFocusTraversable()
- {
- return false;
- }
-
- /**
- * Returns true if the component is being shown on screen.
- * A component is determined to be shown if it is visible,
- * and each parent component is also visible. Please note
- * that, even when a component is showing, it may still be
- * obscured by other components in front. This method only
- * determines if the component is being drawn on the screen.
- *
- *
- * As this abstract component and its parent have no properties
- * relating to visibility, the implementation of this method is
- * left to subclasses.
- *
- * @return false.
- * @see #isVisible()
- */
- public boolean isShowing()
- {
- return false;
- }
-
- /**
- * Returns true if the component is visible. A component may
- * be visible but not drawn on the screen if one of its parent
- * components is not visible. To determine if the component is
- * actually drawn on screen, isShowing()
should be
- * used.
- *
- *
- * As this abstract component has no properties relating to its
- * visibility, the implementation of this method is left to subclasses.
- *
- * @return false.
- * @see #isShowing()
- * @see #setVisible(boolean)
- */
- public boolean isVisible()
- {
- return false;
- }
-
- /**
- * Removes the accessible child specified by the supplied index from
- * the list of currently selected children. If the child specified
- * is not selected, nothing happens.
- *
- *
- * As the existence of children can not be determined from
- * this abstract class, the implementation of this method
- * is left to subclasses.
- *
- * @param index the index of the Accessible
child.
- */
- public void removeAccessibleSelection(int index)
- {
- /* Subclasses with children should implement this */
- }
-
- /**
- * Removes the specified focus listener from the list of registered
- * focus listeners for this component.
- *
- * @param listener the listener to remove.
- */
- public void removeFocusListener(FocusListener listener)
- {
- /* Remove the focus listener from the chain */
- focusListener = AWTEventMulticaster.remove(focusListener, listener);
- }
-
- /**
- * Requests that this component gains focus. This depends on the
- * component being focus traversable.
- *
- *
- * As this abstract component has no properties relating to its
- * focus traversability, or access to a peer with request focusing
- * abilities, the implementation of this method is left to subclasses.
- */
- public void requestFocus()
- {
- /* Ignored */
- }
-
- /**
- * Selects all Accessible
children of this component which
- * it is possible to select. The component needs to support multiple
- * selections.
- *
- *
- * This abstract component provides a simplistic implementation of this
- * method, which ignores the ability of the component to support multiple
- * selections and simply uses addAccessibleSelection
to
- * add each Accessible
child to the selection. The last
- * Accessible
component is thus selected for components
- * which don't support multiple selections. Concrete implementations should
- * override this with a more appopriate and efficient implementation, which
- * properly takes into account the ability of the component to support multiple
- * selections.
- */
- public void selectAllAccessibleSelection()
- {
- /* Simply call addAccessibleSelection() on all accessible children */
- for (int a = 0; a < getAccessibleChildrenCount(); ++a)
- {
- addAccessibleSelection(a);
- }
- }
-
- /**
- * Sets the background color of the component to that specified.
- * Unspecified behaviour occurs when null is given as the new
- * background color.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply ignores the supplied
- * color and continues to use the default system color.
- * Concrete subclasses which handle the drawing of an onscreen
- * menu component should override this method and provide
- * the appropriate information.
- *
- * @param color the new color to use for the background.
- * @see getBackground()
- */
- public void setBackground(Color color)
- {
- /* Ignored */
- }
-
- /**
- * Sets the height and width of the component, and its position
- * relative to this component's parent, to the values specified
- * by the supplied rectangle. Unspecified behaviour occurs when
- * null is given as the new bounds.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply ignores the new
- * rectangle and continues to return null from getBounds()
.
- * Concrete subclasses which handle the drawing of an onscreen
- * menu component should override this method and provide
- * the appropriate information.
- *
- * @param rectangle a rectangle which specifies the new bounds of
- * the component.
- * @see #getBounds()
- */
- public void setBounds(Rectangle rectangle)
- {
- /* Ignored */
- }
-
- /**
- * Sets the Cursor
used when the pointer is positioned over the
- * component. Unspecified behaviour occurs when null is given as the new
- * cursor.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply ignores the new cursor
- * and continues to return the default system cursor. Concrete
- * subclasses which handle the drawing of an onscreen menu component
- * may override this method and provide the appropriate information.
- *
- * @param cursor the new cursor to use.
- * @see #getCursor()
- */
- public void setCursor(Cursor cursor)
- {
- /* Ignored */
- }
-
- /**
- * Sets the enabled/disabled state of this component.
- *
- *
- * As this abstract component has no properties related to
- * its enabled or disabled state, the implementation of this
- * method is left to subclasses.
- *
- * @param enabled true if the component should be enabled,
- * false otherwise.
- * @see #getEnabled()
- */
- public void setEnabled(boolean enabled)
- {
- /* Ignored */
- }
-
- /**
- * Sets the Font
used for text created by this component.
- * Unspecified behaviour occurs when null is given as the new
- * font.
- *
- * @param font the new font to use for text.
- * @see #getFont()
- */
- public void setFont(Font font)
- {
- /* Call the method of the enclosing component */
- MenuComponent.this.setFont(font);
- }
-
- /**
- * Sets the foreground color of the component to that specified.
- * Unspecified behaviour occurs when null is given as the new
- * background color.
- *
- *
- * This abstract class knows nothing about how the component
- * is drawn on screen, so this method simply ignores the supplied
- * color and continues to return the default system text color used
- * for rendering menus.
- * Concrete subclasses which handle the drawing of an onscreen
- * menu component should override this method and provide
- * the appropriate information.
- *
- * @param color the new foreground color.
- * @see #getForeground()
- */
- public void setForeground(Color color)
- {
- /* Ignored */
- }
-
- /**
- * Sets the location of the component, with co-ordinates
- * relative to the parent component and using the co-ordinate
- * space of the screen. Thus, the point (0,0) is the upper
- * left corner of the parent component.
- *
- *
- * Please note that this method depends on a correctly implemented
- * version of the getBounds()
method. Subclasses
- * must provide the bounding rectangle via getBounds()
- * in order for this method to work.
- *
- * @param point the location of the component, relative to its parent.
- * @see #getLocation()
- */
- public void setLocation(Point point)
- {
- getBounds().setLocation(point);
- }
-
- /**
- * Sets the size of the component.
- *
- *
- * Please note that this method depends on a correctly implemented
- * version of the getBounds()
method. Subclasses
- * must provide the bounding rectangle via getBounds()
- * in order for this method to work.
- *
- * @param size the new size of the component.
- * @see #getSize()
- */
- public void setSize(Dimension size)
- {
- getBounds().setSize(size);
- }
-
- /**
- * Sets the visibility state of the component. A component may
- * be visible but not drawn on the screen if one of its parent
- * components is not visible. To determine if the component is
- * actually drawn on screen, isShowing()
should be
- * used.
- *
- *
- * As this abstract component has no properties relating to its
- * visibility, the implementation of this method is left to subclasses.
- *
- * @param visibility the new visibility of the component -- true if
- * the component is visible, false if not.
- * @see #isShowing()
- * @see #isVisible()
- */
- public void setVisible(boolean visibility)
- {
- /* Ignored */
- }
-
-} /* class AccessibleAWTMenuComponent */
-
-
-} // class MenuComponent
diff --git a/libjava/java/awt/MenuContainer.java b/libjava/java/awt/MenuContainer.java
deleted file mode 100644
index c76ec96c20b..00000000000
--- a/libjava/java/awt/MenuContainer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* MenuContainer.java -- container for menu items
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This interface is a container for menu components.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.0
- * @status updated to 1.4
- */
-public interface MenuContainer
-{
- /**
- * Returns the font in use by this container.
- *
- * @return the menu font
- */
- Font getFont();
-
- /**
- * Removes the specified menu component from the menu.
- *
- * @param component the menu component to remove
- */
- void remove(MenuComponent component);
-
- /**
- * Posts an event to the listeners.
- *
- * @param event the event to dispatch
- * @deprecated use {@link MenuComponent#dispatchEvent(AWTEvent)} instead
- */
- boolean postEvent(Event event);
-} // interface MenuContainer
diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java
deleted file mode 100644
index cea2475cda2..00000000000
--- a/libjava/java/awt/MenuItem.java
+++ /dev/null
@@ -1,603 +0,0 @@
-/* MenuItem.java -- An item in a menu
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.peer.MenuItemPeer;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.util.EventListener;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleAction;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleValue;
-
-/**
- * This class represents an item in a menu.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class MenuItem extends MenuComponent
- implements Serializable, Accessible
-{
-
-/*
- * Static Variables
- */
-
-// Serialization Constant
-private static final long serialVersionUID = -21757335363267194L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The name of the action command generated by this item.
- * This is package-private to avoid an accessor method.
- */
-String actionCommand;
-
-/**
- * @serial Indicates whether or not this menu item is enabled.
- * This is package-private to avoid an accessor method.
- */
-boolean enabled = true;
-
-/**
- * @serial The mask of events that are enabled for this menu item.
- */
-long eventMask;
-
-/**
- * @serial This menu item's label
- * This is package-private to avoid an accessor method.
- */
-String label;
-
-/**
- * @serial The shortcut for this menu item, if any
- */
-private MenuShortcut shortcut;
-
-// The list of action listeners for this menu item.
-private transient ActionListener action_listeners;
-
- protected class AccessibleAWTMenuItem
- extends MenuComponent.AccessibleAWTMenuComponent
- implements AccessibleAction, AccessibleValue
- {
- /** Constructor */
- public AccessibleAWTMenuItem()
- {
- super();
- }
-
-
-
- public String getAccessibleName()
- {
- return label;
- }
-
- public AccessibleAction getAccessibleAction()
- {
- return this;
- }
-
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.MENU_ITEM;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
- */
- public int getAccessibleActionCount()
- {
- return 1;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
- */
- public String getAccessibleActionDescription(int i)
- {
- if (i == 0)
- return label;
- else
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
- */
- public boolean doAccessibleAction(int i)
- {
- if (i != 0)
- return false;
- processActionEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
- return true;
- }
-
- public AccessibleValue getAccessibleValue()
- {
- return this;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
- */
- public Number getCurrentAccessibleValue()
- {
- return (enabled) ? new Integer(1) : new Integer(0);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
- */
- public boolean setCurrentAccessibleValue(Number number)
- {
- if (number.intValue() == 0)
- {
- setEnabled(false);
- return false;
- }
-
- setEnabled(true);
- return true;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
- */
- public Number getMinimumAccessibleValue()
- {
- return new Integer(0);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
- */
- public Number getMaximumAccessibleValue()
- {
- return new Integer(0);
- }
-
- }
-
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of MenuItem
with no label
- * and no shortcut.
- */
-public
-MenuItem()
-{
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of MenuItem
with the specified
- * label and no shortcut.
- *
- * @param label The label for this menu item.
- */
-public
-MenuItem(String label)
-{
- this.label = label;
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of MenuItem
with the specified
- * label and shortcut.
- *
- * @param label The label for this menu item.
- * @param shortcut The shortcut for this menu item.
- */
-public
-MenuItem(String label, MenuShortcut shortcut)
-{
- this.label = label;
- this.shortcut = shortcut;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the label for this menu item, which may be null
.
- *
- * @return The label for this menu item.
- */
-public String
-getLabel()
-{
- return(label);
-}
-
-/*************************************************************************/
-
-/**
- * This method sets the label for this menu to the specified value.
- *
- * @param label The new label for this menu item.
- */
-public synchronized void
-setLabel(String label)
-{
- this.label = label;
- if (peer != null)
- {
- MenuItemPeer mp = (MenuItemPeer) peer;
- mp.setLabel (label);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this menu item is enabled.
- *
- * @return true
if this menu item is enabled, false
- * otherwise.
- */
-public boolean
-isEnabled()
-{
- return(enabled);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the enabled status of this menu item.
- *
- * @param enabled true
to enable this menu item,
- * false
otherwise.
- */
-public synchronized void
-setEnabled(boolean enabled)
-{
- enable (enabled);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the enabled status of this menu item.
- *
- * @param enabled true
to enable this menu item,
- * false
otherwise.
- *
- * @deprecated This method is deprecated in favor of setEnabled()
.
- */
-public void
-enable(boolean enabled)
-{
- if (enabled)
- enable ();
- else
- disable ();
-}
-
-/*************************************************************************/
-
-/**
- * Enables this menu item.
- *
- * @deprecated This method is deprecated in favor of setEnabled()
.
- */
-public void
-enable()
-{
- if (enabled)
- return;
-
- this.enabled = true;
- if (peer != null)
- ((MenuItemPeer) peer).setEnabled (true);
-}
-
-/*************************************************************************/
-
-/**
- * Disables this menu item.
- *
- * @deprecated This method is deprecated in favor of setEnabled()
.
- */
-public void
-disable()
-{
- if (!enabled)
- return;
-
- this.enabled = false;
- if (peer != null)
- ((MenuItemPeer) peer).setEnabled (false);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the shortcut for this menu item, which may be null
.
- *
- * @return The shortcut for this menu item.
- */
-public MenuShortcut
-getShortcut()
-{
- return(shortcut);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the shortcut for this menu item to the specified value. This
- * must be done before the native peer is created.
- *
- * @param shortcut The new shortcut for this menu item.
- */
-public void
-setShortcut(MenuShortcut shortcut)
-{
- this.shortcut = shortcut;
-}
-
-/*************************************************************************/
-
-/**
- * Deletes the shortcut for this menu item if one exists. This must be
- * done before the native peer is created.
- */
-public void
-deleteShortcut()
-{
- shortcut = null;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the name of the action command in the action events
- * generated by this menu item.
- *
- * @return The action command name
- */
-public String
-getActionCommand()
-{
- if (actionCommand == null)
- return label;
- else
- return actionCommand;
-}
-
-/*************************************************************************/
-
-/**
- * Sets the name of the action command in the action events generated by
- * this menu item.
- *
- * @param actionCommand The new action command name.
- */
-public void
-setActionCommand(String actionCommand)
-{
- this.actionCommand = actionCommand;
-}
-
-/*************************************************************************/
-
-/**
- * Enables the specified events. This is done automatically when a
- * listener is added and does not normally need to be done by
- * application code.
- *
- * @param events The events to enable, which should be the bit masks
- * from AWTEvent
.
- */
-protected final void
-enableEvents(long events)
-{
- eventMask |= events;
- // TODO: see comment in Component.enableEvents().
-}
-
-/*************************************************************************/
-
-/**
- * Disables the specified events.
- *
- * @param events The events to enable, which should be the bit masks
- * from AWTEvent
.
- */
-protected final void
-disableEvents(long events)
-{
- eventMask &= ~events;
-}
-
-/*************************************************************************/
-
-/**
- * Creates the native peer for this object.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createMenuItem (this);
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified listener to the list of registered action listeners
- * for this component.
- *
- * @param listener The listener to add.
- */
-public synchronized void
-addActionListener(ActionListener listener)
-{
- action_listeners = AWTEventMulticaster.add(action_listeners, listener);
-
- enableEvents(AWTEvent.ACTION_EVENT_MASK);
-}
-
-public synchronized void
-removeActionListener(ActionListener l)
-{
- action_listeners = AWTEventMulticaster.remove(action_listeners, l);
-}
-
- public synchronized ActionListener[] getActionListeners()
- {
- return (ActionListener[])
- AWTEventMulticaster.getListeners(action_listeners,
- ActionListener.class);
- }
-
-/** Returns all registered EventListers of the given listenerType.
- * listenerType must be a subclass of EventListener, or a
- * ClassClassException is thrown.
- * @since 1.3
- */
- public EventListener[] getListeners(Class listenerType)
- {
- if (listenerType == ActionListener.class)
- return getActionListeners();
- return (EventListener[]) Array.newInstance(listenerType, 0);
- }
-
-/*************************************************************************/
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= ActionEvent.ACTION_LAST
- && e.id >= ActionEvent.ACTION_FIRST
- && (action_listeners != null
- || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
- processEvent(e);
-
- // Send the event to the parent menu if it has not yet been
- // consumed.
- if (!e.isConsumed ())
- ((Menu) getParent ()).processEvent (e);
-}
-
-/**
- * Processes the specified event by calling processActionEvent()
- * if it is an instance of ActionEvent
.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof ActionEvent)
- processActionEvent((ActionEvent)event);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified event by dispatching it to any registered listeners.
- *
- * @param event The event to process.
- */
-protected void
-processActionEvent(ActionEvent event)
-{
- if (action_listeners != null)
- {
- event.setSource(this);
- action_listeners.actionPerformed(event);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
-public String
-paramString()
-{
- return ("label=" + label + ",enabled=" + enabled +
- ",actionCommand=" + actionCommand + "," + super.paramString());
-}
-
-/**
- * Gets the AccessibleContext associated with this MenuItem
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
-public AccessibleContext getAccessibleContext()
-{
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTMenuItem();
- return accessibleContext;
-}
-
-} // class MenuItem
diff --git a/libjava/java/awt/MenuShortcut.java b/libjava/java/awt/MenuShortcut.java
deleted file mode 100644
index adfd1d3187a..00000000000
--- a/libjava/java/awt/MenuShortcut.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/* MenuShortcut.java -- A class for menu accelerators
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This class implements a keyboard accelerator for a menu item.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class MenuShortcut implements java.io.Serializable
-{
-
-/*
- * Static Variables
- */
-
-// Serialization Constant
-private static final long serialVersionUID = 143448358473180225L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The virtual keycode for the shortcut.
- */
-private int key;
-
-/**
- * @serial true
if the shift key was used with this shortcut,
- * or false
otherwise.
- */
-private boolean usesShift;
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of MenuShortcut
with the
- * specified virtual key value.
- *
- * @param key The virtual keycode for the shortcut.
- */
-public
-MenuShortcut(int key)
-{
- this(key, false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of MenuShortcut
with the
- * specified virtual key value and shift setting.
- *
- * @param key The virtual keycode for the shortcut.
- * @param usesShift true
if the shift key was pressed,
- * false
otherwise.
- */
-public
-MenuShortcut(int key, boolean usesShift)
-{
- this.key = key;
- this.usesShift = usesShift;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the virtual keycode for this shortcut.
- *
- * @return The virtual keycode for this shortcut.
- */
-public int
-getKey()
-{
- return(key);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the shift setting for this shortcut.
- *
- * @return true
if the shift key was pressed, false
- * otherwise.
- */
-public boolean
-usesShiftModifier()
-{
- return(usesShift);
-}
-
-/*************************************************************************/
-
-/**
- * Tests this object for equality against the specified object. The two
- * objects will be considered equal if and only if the specified object
- * is an instance of MenuShortcut
and has the same key value
- * and shift setting as this object.
- *
- * @param obj The object to test for equality against.
- *
- * @return true
if the two objects are equal, false
- * otherwise.
- */
-public boolean
-equals(MenuShortcut obj)
-{
- if (obj == null)
- return(false);
-
- if (obj.key != this.key)
- return(false);
-
- if (obj.usesShift != this.usesShift)
- return(false);
-
- return(true);
-}
-
-public boolean
-equals(Object obj)
-{
- if (obj instanceof MenuShortcut)
- {
- MenuShortcut ms = (MenuShortcut) obj;
- return (ms.key == key && ms.usesShift == usesShift);
- }
- return false;
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this shortcut.
- *
- * @return A string representation of this shortcut.
- */
-public String
-toString()
-{
- return(getClass().getName() + "[" + paramString () + "]");
-}
-
-public int
-hashCode()
-{
- // Arbitrary.
- return key + (usesShift ? 23 : 57);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
-protected String
-paramString()
-{
- return "key=" + key + ",usesShift=" + usesShift;
-}
-
-} // class MenuShortcut
diff --git a/libjava/java/awt/PageAttributes.java b/libjava/java/awt/PageAttributes.java
deleted file mode 100644
index 38fb696e339..00000000000
--- a/libjava/java/awt/PageAttributes.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/* PageAttributes.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.util.Locale;
-
-/**
- * Missing Documentation
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4, but missing documentation
- */
-public final class PageAttributes implements Cloneable
-{
- public static final class ColorType extends AttributeValue
- {
- private static final String[] NAMES = { "color", "monochrome" };
- public static final ColorType COLOR = new ColorType(0);
- public static final ColorType MONOCHROME = new ColorType(1);
- private ColorType(int value)
- {
- super(value, NAMES);
- }
- } // class ColorType
- public static final class MediaType extends AttributeValue
- {
- private static final String[] NAMES
- = { "iso-4a0", "iso-2a0", "iso-a0", "iso-a1", "iso-a2", "iso-a3",
- "iso-a4", "iso-a5", "iso-a6", "iso-a7", "iso-a8", "iso-a9",
- "iso-a10", "iso-b0", "iso-b1", "iso-b2", "iso-b3", "iso-b4",
- "iso-b5", "iso-b6", "iso-b7", "iso-b8", "iso-b9", "iso-b10",
- "jis-b0", "jis-b1", "jis-b2", "jis-b3", "jis-b4", "jis-b5",
- "jis-b6", "jis-b7", "jis-b8", "jis-b9", "jis-b10", "iso-c0",
- "iso-c1", "iso-c2", "iso-c3", "iso-c4", "iso-c5", "iso-c6",
- "iso-c7", "iso-c8", "iso-c9", "iso-c10", "iso-designated-long",
- "executive", "folio", "invoice", "ledger", "na-letter", "na-legal",
- "quarto", "a", "b", "c", "d", "e", "na-10x15-envelope",
- "na-10x14-envelope", "na-10x13-envelope", "na-9x12-envelope",
- "na-9x11-envelope", "na-7x9-envelope", "na-6x9-envelope",
- "na-number-9-envelope", "na-number-10-envelope",
- "na-number-11-envelope", "na-number-12-envelope",
- "na-number-14-envelope", "invite-envelope", "italy-envelope",
- "monarch-envelope", "personal-envelope" };
- public static final MediaType ISO_4A0 = new MediaType(0);
- public static final MediaType ISO_2A0 = new MediaType(1);
- public static final MediaType ISO_A0 = new MediaType(2);
- public static final MediaType ISO_A1 = new MediaType(3);
- public static final MediaType ISO_A2 = new MediaType(4);
- public static final MediaType ISO_A3 = new MediaType(5);
- public static final MediaType ISO_A4 = new MediaType(6);
- public static final MediaType ISO_A5 = new MediaType(7);
- public static final MediaType ISO_A6 = new MediaType(8);
- public static final MediaType ISO_A7 = new MediaType(9);
- public static final MediaType ISO_A8 = new MediaType(10);
- public static final MediaType ISO_A9 = new MediaType(11);
- public static final MediaType ISO_A10 = new MediaType(12);
- public static final MediaType ISO_B0 = new MediaType(13);
- public static final MediaType ISO_B1 = new MediaType(14);
- public static final MediaType ISO_B2 = new MediaType(15);
- public static final MediaType ISO_B3 = new MediaType(16);
- public static final MediaType ISO_B4 = new MediaType(17);
- public static final MediaType ISO_B5 = new MediaType(18);
- public static final MediaType ISO_B6 = new MediaType(19);
- public static final MediaType ISO_B7 = new MediaType(20);
- public static final MediaType ISO_B8 = new MediaType(21);
- public static final MediaType ISO_B9 = new MediaType(22);
- public static final MediaType ISO_B10 = new MediaType(23);
- public static final MediaType JIS_B0 = new MediaType(24);
- public static final MediaType JIS_B1 = new MediaType(25);
- public static final MediaType JIS_B2 = new MediaType(26);
- public static final MediaType JIS_B3 = new MediaType(27);
- public static final MediaType JIS_B4 = new MediaType(28);
- public static final MediaType JIS_B5 = new MediaType(29);
- public static final MediaType JIS_B6 = new MediaType(30);
- public static final MediaType JIS_B7 = new MediaType(31);
- public static final MediaType JIS_B8 = new MediaType(32);
- public static final MediaType JIS_B9 = new MediaType(33);
- public static final MediaType JIS_B10 = new MediaType(34);
- public static final MediaType ISO_C0 = new MediaType(35);
- public static final MediaType ISO_C1 = new MediaType(36);
- public static final MediaType ISO_C2 = new MediaType(37);
- public static final MediaType ISO_C3 = new MediaType(38);
- public static final MediaType ISO_C4 = new MediaType(39);
- public static final MediaType ISO_C5 = new MediaType(40);
- public static final MediaType ISO_C6 = new MediaType(41);
- public static final MediaType ISO_C7 = new MediaType(42);
- public static final MediaType ISO_C8 = new MediaType(43);
- public static final MediaType ISO_C9 = new MediaType(44);
- public static final MediaType ISO_C10 = new MediaType(45);
- public static final MediaType ISO_DESIGNATED_LONG = new MediaType(46);
- public static final MediaType EXECUTIVE = new MediaType(47);
- public static final MediaType FOLIO = new MediaType(48);
- public static final MediaType INVOICE = new MediaType(49);
- public static final MediaType LEDGER = new MediaType(50);
- public static final MediaType NA_LETTER = new MediaType(51);
- public static final MediaType NA_LEGAL = new MediaType(52);
- public static final MediaType QUARTO = new MediaType(53);
- public static final MediaType A = new MediaType(54);
- public static final MediaType B = new MediaType(55);
- public static final MediaType C = new MediaType(56);
- public static final MediaType D = new MediaType(57);
- public static final MediaType E = new MediaType(58);
- public static final MediaType NA_10X15_ENVELOPE = new MediaType(59);
- public static final MediaType NA_10X14_ENVELOPE = new MediaType(60);
- public static final MediaType NA_10X13_ENVELOPE = new MediaType(61);
- public static final MediaType NA_9X12_ENVELOPE = new MediaType(62);
- public static final MediaType NA_9X11_ENVELOPE = new MediaType(63);
- public static final MediaType NA_7X9_ENVELOPE = new MediaType(64);
- public static final MediaType NA_6X9_ENVELOPE = new MediaType(65);
- public static final MediaType NA_NUMBER_9_ENVELOPE = new MediaType(66);
- public static final MediaType NA_NUMBER_10_ENVELOPE = new MediaType(67);
- public static final MediaType NA_NUMBER_11_ENVELOPE = new MediaType(68);
- public static final MediaType NA_NUMBER_12_ENVELOPE = new MediaType(69);
- public static final MediaType NA_NUMBER_14_ENVELOPE = new MediaType(70);
- public static final MediaType INVITE_ENVELOPE = new MediaType(71);
- public static final MediaType ITALY_ENVELOPE = new MediaType(72);
- public static final MediaType MONARCH_ENVELOPE = new MediaType(73);
- public static final MediaType PERSONAL_ENVELOPE = new MediaType(74);
- public static final MediaType A0 = ISO_A0;
- public static final MediaType A1 = ISO_A1;
- public static final MediaType A2 = ISO_A2;
- public static final MediaType A3 = ISO_A3;
- public static final MediaType A4 = ISO_A4;
- public static final MediaType A5 = ISO_A5;
- public static final MediaType A6 = ISO_A6;
- public static final MediaType A7 = ISO_A7;
- public static final MediaType A8 = ISO_A8;
- public static final MediaType A9 = ISO_A9;
- public static final MediaType A10 = ISO_A10;
- public static final MediaType B0 = ISO_B0;
- public static final MediaType B1 = ISO_B1;
- public static final MediaType B2 = ISO_B2;
- public static final MediaType B3 = ISO_B3;
- public static final MediaType B4 = ISO_B4;
- public static final MediaType ISO_B4_ENVELOPE = ISO_B4;
- public static final MediaType B5 = ISO_B5;
- public static final MediaType ISO_B5_ENVELOPE = ISO_B4;
- public static final MediaType B6 = ISO_B6;
- public static final MediaType B7 = ISO_B7;
- public static final MediaType B8 = ISO_B8;
- public static final MediaType B9 = ISO_B9;
- public static final MediaType B10 = ISO_B10;
- public static final MediaType C0 = ISO_B0;
- public static final MediaType ISO_C0_ENVELOPE = ISO_C0;
- public static final MediaType C1 = ISO_C1;
- public static final MediaType ISO_C1_ENVELOPE = ISO_C1;
- public static final MediaType C2 = ISO_C2;
- public static final MediaType ISO_C2_ENVELOPE = ISO_C2;
- public static final MediaType C3 = ISO_C3;
- public static final MediaType ISO_C3_ENVELOPE = ISO_C3;
- public static final MediaType C4 = ISO_C4;
- public static final MediaType ISO_C4_ENVELOPE = ISO_C4;
- public static final MediaType C5 = ISO_C5;
- public static final MediaType ISO_C5_ENVELOPE = ISO_C5;
- public static final MediaType C6 = ISO_C6;
- public static final MediaType ISO_C6_ENVELOPE = ISO_C6;
- public static final MediaType C7 = ISO_C7;
- public static final MediaType ISO_C7_ENVELOPE = ISO_C7;
- public static final MediaType C8 = ISO_C8;
- public static final MediaType ISO_C8_ENVELOPE = ISO_C8;
- public static final MediaType C9 = ISO_C9;
- public static final MediaType ISO_C9_ENVELOPE = ISO_C9;
- public static final MediaType C10 = ISO_C10;
- public static final MediaType ISO_C10_ENVELOPE = ISO_C10;
- public static final MediaType ISO_DESIGNATED_LONG_ENVELOPE
- = ISO_DESIGNATED_LONG;
- public static final MediaType STATEMENT = INVOICE;
- public static final MediaType TABLOID = LEDGER;
- public static final MediaType LETTER = NA_LETTER;
- public static final MediaType NOTE = NA_LETTER;
- public static final MediaType LEGAL = NA_LEGAL;
- public static final MediaType ENV_10X15 = NA_10X15_ENVELOPE;
- public static final MediaType ENV_10X14 = NA_10X14_ENVELOPE;
- public static final MediaType ENV_10X13 = NA_10X13_ENVELOPE;
- public static final MediaType ENV_9X12 = NA_9X12_ENVELOPE;
- public static final MediaType ENV_9X11 = NA_9X11_ENVELOPE;
- public static final MediaType ENV_7X9 = NA_7X9_ENVELOPE;
- public static final MediaType ENV_6X9 = NA_6X9_ENVELOPE;
- public static final MediaType ENV_9 = NA_NUMBER_9_ENVELOPE;
- public static final MediaType ENV_10 = NA_NUMBER_10_ENVELOPE;
- public static final MediaType ENV_11 = NA_NUMBER_11_ENVELOPE;
- public static final MediaType ENV_12 = NA_NUMBER_12_ENVELOPE;
- public static final MediaType ENV_14 = NA_NUMBER_14_ENVELOPE;
- public static final MediaType ENV_INVITE = INVITE_ENVELOPE;
- public static final MediaType ENV_ITALY = ITALY_ENVELOPE;
- public static final MediaType ENV_MONARCH = MONARCH_ENVELOPE;
- public static final MediaType ENV_PERSONAL = PERSONAL_ENVELOPE;
- public static final MediaType INVITE = INVITE_ENVELOPE;
- public static final MediaType ITALY = ITALY_ENVELOPE;
- public static final MediaType MONARCH = MONARCH_ENVELOPE;
- public static final MediaType PERSONAL = PERSONAL_ENVELOPE;
- private MediaType(int value)
- {
- super(value, NAMES);
- }
- } // class MediaType
- public static final class OrientationRequestedType extends AttributeValue
- {
- private static final String[] NAMES = { "portrait", "landscape" };
- public static final OrientationRequestedType PORTRAIT
- = new OrientationRequestedType(0);
- public static final OrientationRequestedType LANDSCAPE
- = new OrientationRequestedType(1);
- private OrientationRequestedType(int value)
- {
- super(value, NAMES);
- }
- } // class OrientationRequestedType
- public static final class OriginType extends AttributeValue
- {
- private static final String[] NAMES = { "physical", "printable" };
- public static final OriginType PHYSICAL = new OriginType(0);
- public static final OriginType PRINTABLE = new OriginType(1);
- private OriginType(int value)
- {
- super(value, NAMES);
- }
- } // class OriginType
- public static final class PrintQualityType extends AttributeValue
- {
- private static final String[] NAMES = { "high", "normal", "draft" };
- public static final PrintQualityType HIGH = new PrintQualityType(0);
- public static final PrintQualityType NORMAL = new PrintQualityType(1);
- public static final PrintQualityType DRAFT = new PrintQualityType(2);
- private PrintQualityType(int value)
- {
- super(value, NAMES);
- }
- } // class PrintQualityType
-
-
- private ColorType color;
- private MediaType media;
- private OrientationRequestedType orientation;
- private OriginType origin;
- private PrintQualityType quality;
- private int resolutionX;
- private int resolutionY;
- private int resolutionScale;
- public PageAttributes()
- {
- color = ColorType.MONOCHROME;
- setMediaToDefault();
- orientation = OrientationRequestedType.PORTRAIT;
- origin = OriginType.PHYSICAL;
- quality = PrintQualityType.NORMAL;
- setPrinterResolutionToDefault();
- }
-
- public PageAttributes(PageAttributes attr)
- {
- set(attr);
- }
-
- public PageAttributes(ColorType color, MediaType media,
- OrientationRequestedType orientation,
- OriginType origin, PrintQualityType quality,
- int[] resolution)
- {
- if (color == null || media == null || orientation == null
- || origin == null || quality == null)
- throw new IllegalArgumentException();
- setPrinterResolution(resolution);
- this.color = color;
- this.media = media;
- this.orientation = orientation;
- this.origin = origin;
- this.quality = quality;
- }
-
- public Object clone()
- {
- return new PageAttributes(this);
- }
-
- public void set(PageAttributes attr)
- {
- color = attr.color;
- media = attr.media;
- orientation = attr.orientation;
- origin = attr.origin;
- quality = attr.quality;
- resolutionX = attr.resolutionX;
- resolutionY = attr.resolutionY;
- resolutionScale = attr.resolutionScale;
- }
-
- public ColorType getColor()
- {
- return color;
- }
-
- public void setColor(ColorType color)
- {
- if (color == null)
- throw new IllegalArgumentException();
- this.color = color;
- }
-
- public MediaType getMedia()
- {
- return media;
- }
-
- public void setMedia(MediaType media)
- {
- if (media == null)
- throw new IllegalArgumentException();
- this.media = media;
- }
-
- public void setMediaToDefault()
- {
- String country = Locale.getDefault().getCountry();
- media = ("US".equals(country) || "CA".equals(country)) ? MediaType.LETTER
- : MediaType.A4;
- }
-
- public OrientationRequestedType getOrientationRequested()
- {
- return orientation;
- }
-
- public void setOrientationRequested(OrientationRequestedType orientation)
- {
- if (orientation == null)
- throw new IllegalArgumentException();
- this.orientation = orientation;
- }
-
- public void setOrientationRequested(int orientation)
- {
- if (orientation == 3)
- this.orientation = OrientationRequestedType.PORTRAIT;
- else if (orientation == 4)
- this.orientation = OrientationRequestedType.LANDSCAPE;
- else
- throw new IllegalArgumentException();
- }
-
- public void setOrientationRequestedToDefault()
- {
- orientation = OrientationRequestedType.PORTRAIT;
- }
-
- public OriginType getOrigin()
- {
- return origin;
- }
-
- public void setOrigin(OriginType origin)
- {
- if (origin == null)
- throw new IllegalArgumentException();
- this.origin = origin;
- }
-
- public PrintQualityType getPrintQuality()
- {
- return quality;
- }
-
- public void setPrintQuality(PrintQualityType quality)
- {
- if (quality == null)
- throw new IllegalArgumentException();
- this.quality = quality;
- }
-
- public void setPrintQuality(int quality)
- {
- if (quality == 3)
- this.quality = PrintQualityType.DRAFT;
- else if (quality == 4)
- this.quality = PrintQualityType.NORMAL;
- else if (quality == 5)
- this.quality = PrintQualityType.HIGH;
- else
- throw new IllegalArgumentException();
- }
-
- public void setPrintQualityToDefault()
- {
- quality = PrintQualityType.NORMAL;
- }
-
- public int[] getPrinterResolution()
- {
- return new int[] { resolutionX, resolutionY, resolutionScale };
- }
-
- public void setPrinterResolution(int[] resolution)
- {
- if (resolution == null || resolution.length != 3 || resolution[0] <= 0
- || resolution[1] <= 0 || resolution[2] < 3 || resolution[2] > 4)
- throw new IllegalArgumentException();
- resolutionX = resolution[0];
- resolutionY = resolution[1];
- resolutionScale = resolution[2];
- }
-
- public void setPrinterResolution(int resolution)
- {
- if (resolution <= 0)
- throw new IllegalArgumentException();
- resolutionX = resolution;
- resolutionY = resolution;
- resolutionScale = 3;
- }
-
- public void setPrinterResolutionToDefault()
- {
- resolutionX = 72;
- resolutionY = 72;
- resolutionScale = 3;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- return true;
- if (! (o instanceof PageAttributes))
- return false;
- PageAttributes pa = (PageAttributes) o;
- return color == pa.color && media == pa.media
- && orientation == pa.orientation && origin == pa.origin
- && quality == pa.quality && resolutionX == pa.resolutionX
- && resolutionY == pa.resolutionY
- && resolutionScale == pa.resolutionScale;
- }
- public int hashCode()
- {
- return (color.value << 31) ^ (media.value << 24)
- ^ (orientation.value << 23) ^ (origin.value << 22)
- ^ (quality.value << 20) ^ (resolutionScale << 19)
- ^ (resolutionY << 10) ^ resolutionX;
- }
- public String toString()
- {
- return "color=" + color + ",media=" + media + ",orientation-requested="
- + orientation + ",origin=" + origin + ",print-quality=" + quality
- + ",printer-resolution=[" + resolutionX + ',' + resolutionY + ','
- + resolutionScale + ']';
- }
-} // class PageAttributes
diff --git a/libjava/java/awt/Paint.java b/libjava/java/awt/Paint.java
deleted file mode 100644
index 0f099cc0b80..00000000000
--- a/libjava/java/awt/Paint.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Paint.java -- generate colors for Graphics2D operations
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.ColorModel;
-
-/**
- * Defines how color patterns are generated for Graphics2D operations. This
- * is used to perform the draw
and fill
methods
- * of the graphics object. Instances must be immutable, because the graphics
- * object does not clone them.
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @see PaintContext
- * @see Color
- * @see GradientPaint
- * @see TexturePaint
- * @see Graphics2D#setPaint(Paint)
- * @since 1.1
- * @status updated to 1.4
- */
-public interface Paint extends Transparency
-{
- /**
- * Create the context necessary for performing the color pattern generation.
- * The color model is a hint, and may be null for Classpath implementations;
- * however some legacy code may throw a NullPointerException when passed a
- * null. Leaving the color model null provides the most efficiency and leeway
- * in the generation of the color pattern.
- *
- * @param cm the color model, used as a hint
- * @param deviceBounds the device space bounding box of the painted area
- * @param userBounds the user space bounding box of the painted area
- * @param xform the transformation from user space to device space
- * @param hints any hints for choosing between rendering alternatives
- * @return the context for performing the paint
- */
- PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
- Rectangle2D userBounds, AffineTransform xform,
- RenderingHints hints);
-} // interface Paint
diff --git a/libjava/java/awt/PaintContext.java b/libjava/java/awt/PaintContext.java
deleted file mode 100644
index 3d5fdcdf0e4..00000000000
--- a/libjava/java/awt/PaintContext.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* PaintContext.java -- the environment for performing a paint operation
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.image.ColorModel;
-import java.awt.image.Raster;
-
-/**
- * @author Warren Levy (warrenl@cygnus.com)
- * @see Paint
- * @since 1.1
- * @status updated to 1.4
- */
-public interface PaintContext
-{
- /**
- * Release the resources allocated for the paint.
- */
- void dispose();
-
- /**
- * Return the color model of this context. It may be different from the
- * hint specified during createContext, as not all contexts can generate
- * color patterns in an arbitrary model.
- *
- * @return the context color model
- */
- ColorModel getColorModel();
-
- /**
- * Return a raster containing the colors for the graphics operation.
- *
- * @param x the x-coordinate, in device space
- * @param y the y-coordinate, in device space
- * @param w the width, in device space
- * @param h the height, in device space
- * @return a raster for the given area and color
- */
- Raster getRaster(int x, int y, int w, int h);
-} // interface PaintContext
diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java
deleted file mode 100644
index cc17eef2285..00000000000
--- a/libjava/java/awt/Panel.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Panel.java -- Simple container object
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * A panel is a simple container class. It's default layout is the
- * FlowLayout
manager.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see FlowLayout
- * @since 1.0
- * @status updated to 1.4
- */
-public class Panel extends Container implements Accessible
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -2728009084054400034L;
-
- /** The cached accessible context. */
- private transient AccessibleContext context;
-
- /** Flag set when the first system-requested paint event is
- dispatched. */
- private transient boolean initialSystemUpdateDone;
-
- /** Flag set when the first application-requested paint event is
- consumed. */
- private transient boolean initialUpdateConsumed;
-
- /*
- * The number used to generate the name returned by getName.
- */
- private static transient long next_panel_number;
-
- /**
- * Initializes a new instance of Panel
that has a default
- * layout manager of FlowLayout
.
- */
- public Panel()
- {
- this(new FlowLayout());
- }
-
- /**
- * Initializes a new instance of Panel
with the specified
- * layout manager.
- *
- * @param layoutManager the layout manager for this object
- * @since 1.1
- */
- public Panel(LayoutManager layoutManager)
- {
- setLayout(layoutManager);
- }
-
- /**
- * Notifies this object to create its native peer.
- *
- * @see #isDisplayable()
- * @see #removeNotify()
- */
- public void addNotify()
- {
- if (peer == null)
- peer = getToolkit().createPanel(this);
- super.addNotify();
- }
-
- /**
- * Gets the AccessibleContext associated with this panel, creating one if
- * necessary. This always returns an instance of {@link AccessibleAWTPanel}.
- *
- * @return the accessibility context of this panel
- * @since 1.3
- */
- public AccessibleContext getAccessibleContext()
- {
- if (context == null)
- context = new AccessibleAWTPanel();
- return context;
- }
-
- /**
- * This class provides accessibility support for Panels, and is the
- * runtime type returned by {@link #getAccessibleContext()}.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- */
- protected class AccessibleAWTPanel extends AccessibleAWTContainer
- {
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = -6409552226660031050L;
-
- /**
- * The default constructor.
- */
- protected AccessibleAWTPanel()
- {
- }
-
- /**
- * Get the role of this accessible object, a panel.
- *
- * @return the role of the object
- * @see AccessibleRole#PANEL
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.PANEL;
- }
- }
-
- /**
- * Generate a unique name for this panel.
- *
- * @return A unique name for this panel.
- */
- String generateName ()
- {
- return "panel" + getUniqueLong ();
- }
-
- private static synchronized long getUniqueLong ()
- {
- return next_panel_number++;
- }
-}
diff --git a/libjava/java/awt/Point.java b/libjava/java/awt/Point.java
deleted file mode 100644
index 492749b8dc3..00000000000
--- a/libjava/java/awt/Point.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/* Point.java -- represents a point in 2-D space
- Copyright (C) 1999, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.Point2D;
-import java.io.Serializable;
-
-/**
- * This class represents a point on the screen using cartesian coordinates.
- * Remember that in screen coordinates, increasing x values go from left to
- * right, and increasing y values go from top to bottom.
- *
- * Point
representing the
- * coordiates (0,0).
- *
- * @since 1.1
- */
- public Point()
- {
- }
-
- /**
- * Initializes a new instance of Point
with coordinates
- * identical to the coordinates of the specified points.
- *
- * @param p the point to copy the coordinates from
- * @throws NullPointerException if p is null
- */
- public Point(Point p)
- {
- x = p.x;
- y = p.y;
- }
-
- /**
- * Initializes a new instance of Point
with the specified
- * coordinates.
- *
- * @param x the X coordinate
- * @param y the Y coordinate
- */
- public Point(int x, int y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Get the x coordinate.
- *
- * @return the value of x, as a double
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Get the y coordinate.
- *
- * @return the value of y, as a double
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Returns the location of this point. A pretty useless method, as this
- * is already a point.
- *
- * @return a copy of this point
- * @see #setLocation(Point)
- * @since 1.1
- */
- public Point getLocation()
- {
- return new Point(x, y);
- }
-
- /**
- * Sets this object's coordinates to match those of the specified point.
- *
- * @param p the point to copy the coordinates from
- * @throws NullPointerException if p is null
- * @since 1.1
- */
- public void setLocation(Point p)
- {
- x = p.x;
- y = p.y;
- }
-
- /**
- * Sets this object's coordinates to the specified values. This method
- * is identical to the move()
method.
- *
- * @param x the new X coordinate
- * @param y the new Y coordinate
- */
- public void setLocation(int x, int y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Sets this object's coordinates to the specified values. This method
- * performs normal casting from double to int, so you may lose precision.
- *
- * @param x the new X coordinate
- * @param y the new Y coordinate
- */
- public void setLocation(double x, double y)
- {
- this.x = (int) x;
- this.y = (int) y;
- }
-
- /**
- * Sets this object's coordinates to the specified values. This method
- * is identical to the setLocation(int, int)
method.
- *
- * @param x the new X coordinate
- * @param y the new Y coordinate
- */
- public void move(int x, int y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Changes the coordinates of this point such that the specified
- * dx
parameter is added to the existing X coordinate and
- * dy
is added to the existing Y coordinate.
- *
- * @param dx the amount to add to the X coordinate
- * @param dy the amount to add to the Y coordinate
- */
- public void translate(int dx, int dy)
- {
- x += dx;
- y += dy;
- }
-
- /**
- * Tests whether or not this object is equal to the specified object.
- * This will be true if and only if the specified object is an instance
- * of Point2D and has the same X and Y coordinates.
- *
- * @param obj the object to test against for equality
- * @return true if the specified object is equal
- */
- public boolean equals(Object obj)
- {
- if (! (obj instanceof Point2D))
- return false;
- Point2D p = (Point2D) obj;
- return x == p.getX() && y == p.getY();
- }
-
- /**
- * Returns a string representation of this object. The format is:
- * getClass().getName() + "[x=" + x + ",y=" + y + ']'
.
- *
- * @return a string representation of this object
- */
- public String toString()
- {
- return getClass().getName() + "[x=" + x + ",y=" + y + ']';
- }
-} // class Point
diff --git a/libjava/java/awt/Polygon.java b/libjava/java/awt/Polygon.java
deleted file mode 100644
index a72522cb089..00000000000
--- a/libjava/java/awt/Polygon.java
+++ /dev/null
@@ -1,613 +0,0 @@
-/* Polygon.java -- class representing a polygon
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Line2D;
-import java.awt.geom.PathIterator;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.io.Serializable;
-
-/**
- * This class represents a polygon, a closed, two-dimensional region in a
- * coordinate space. The region is bounded by an arbitrary number of line
- * segments, between (x,y) coordinate vertices. The polygon has even-odd
- * winding, meaning that a point is inside the shape if it crosses the
- * boundary an odd number of times on the way to infinity.
- *
- * contains
.
- *
- * @see #getBounds()
- * @since 1.4
- */
- public void invalidate()
- {
- bounds = null;
- }
-
- /**
- * Translates the polygon by adding the specified values to all X and Y
- * coordinates. This updates the bounding box, if it has been calculated.
- *
- * @param dx the amount to add to all X coordinates
- * @param dy the amount to add to all Y coordinates
- * @since 1.1
- */
- public void translate(int dx, int dy)
- {
- int i = npoints;
- while (--i >= 0)
- {
- xpoints[i] += dx;
- ypoints[i] += dy;
- }
- if (bounds != null)
- {
- bounds.x += dx;
- bounds.y += dy;
- }
- }
-
- /**
- * Adds the specified endpoint to the polygon. This updates the bounding
- * box, if it has been created.
- *
- * @param x the X coordinate of the point to add
- * @param y the Y coordiante of the point to add
- */
- public void addPoint(int x, int y)
- {
- if (npoints + 1 > xpoints.length)
- {
- int[] newx = new int[npoints + 1];
- System.arraycopy(xpoints, 0, newx, 0, npoints);
- xpoints = newx;
- }
- if (npoints + 1 > ypoints.length)
- {
- int[] newy = new int[npoints + 1];
- System.arraycopy(ypoints, 0, newy, 0, npoints);
- ypoints = newy;
- }
- xpoints[npoints] = x;
- ypoints[npoints] = y;
- npoints++;
- if (bounds != null)
- {
- if (npoints == 1)
- {
- bounds.x = x;
- bounds.y = y;
- }
- else
- {
- if (x < bounds.x)
- {
- bounds.width += bounds.x - x;
- bounds.x = x;
- }
- else if (x > bounds.x + bounds.width)
- bounds.width = x - bounds.x;
- if (y < bounds.y)
- {
- bounds.height += bounds.y - y;
- bounds.y = y;
- }
- else if (y > bounds.y + bounds.height)
- bounds.height = y - bounds.y;
- }
- }
- }
-
- /**
- * Returns the bounding box of this polygon. This is the smallest
- * rectangle with sides parallel to the X axis that will contain this
- * polygon.
- *
- * @return the bounding box for this polygon
- * @see #getBounds2D()
- * @since 1.1
- */
- public Rectangle getBounds()
- {
- return getBoundingBox();
- }
-
- /**
- * Returns the bounding box of this polygon. This is the smallest
- * rectangle with sides parallel to the X axis that will contain this
- * polygon.
- *
- * @return the bounding box for this polygon
- * @see #getBounds2D()
- * @deprecated use {@link #getBounds()} instead
- */
- public Rectangle getBoundingBox()
- {
- if (bounds == null)
- {
- if (npoints == 0)
- return bounds = new Rectangle();
- int i = npoints - 1;
- int minx = xpoints[i];
- int maxx = minx;
- int miny = ypoints[i];
- int maxy = miny;
- while (--i >= 0)
- {
- int x = xpoints[i];
- int y = ypoints[i];
- if (x < minx)
- minx = x;
- else if (x > maxx)
- maxx = x;
- if (y < miny)
- miny = y;
- else if (y > maxy)
- maxy = y;
- }
- bounds = new Rectangle(minx, miny, maxx - minx, maxy - miny);
- }
- return bounds;
- }
-
- /**
- * Tests whether or not the specified point is inside this polygon.
- *
- * @param p the point to test
- * @return true if the point is inside this polygon
- * @throws NullPointerException if p is null
- * @see #contains(double, double)
- */
- public boolean contains(Point p)
- {
- return contains(p.getX(), p.getY());
- }
-
- /**
- * Tests whether or not the specified point is inside this polygon.
- *
- * @param x the X coordinate of the point to test
- * @param y the Y coordinate of the point to test
- * @return true if the point is inside this polygon
- * @see #contains(double, double)
- * @since 1.1
- */
- public boolean contains(int x, int y)
- {
- return contains((double) x, (double) y);
- }
-
- /**
- * Tests whether or not the specified point is inside this polygon.
- *
- * @param x the X coordinate of the point to test
- * @param y the Y coordinate of the point to test
- * @return true if the point is inside this polygon
- * @see #contains(double, double)
- * @deprecated use {@link #contains(int, int)} instead
- */
- public boolean inside(int x, int y)
- {
- return contains((double) x, (double) y);
- }
-
- /**
- * Returns a high-precision bounding box of this polygon. This is the
- * smallest rectangle with sides parallel to the X axis that will contain
- * this polygon.
- *
- * @return the bounding box for this polygon
- * @see #getBounds()
- * @since 1.2
- */
- public Rectangle2D getBounds2D()
- {
- // For polygons, the integer version is exact!
- return getBounds();
- }
-
- /**
- * Tests whether or not the specified point is inside this polygon.
- *
- * @param x the X coordinate of the point to test
- * @param y the Y coordinate of the point to test
- * @return true if the point is inside this polygon
- * @since 1.2
- */
- public boolean contains(double x, double y)
- {
- return ((evaluateCrossings(x, y, false, BIG_VALUE) & 1) != 0);
- }
-
- /**
- * Tests whether or not the specified point is inside this polygon.
- *
- * @param p the point to test
- * @return true if the point is inside this polygon
- * @throws NullPointerException if p is null
- * @see #contains(double, double)
- * @since 1.2
- */
- public boolean contains(Point2D p)
- {
- return contains(p.getX(), p.getY());
- }
-
- /**
- * Test if a high-precision rectangle intersects the shape. This is true
- * if any point in the rectangle is in the shape. This implementation is
- * precise.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle, treated as point if negative
- * @param h the height of the rectangle, treated as point if negative
- * @return true if the rectangle intersects this shape
- * @since 1.2
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- /* Does any edge intersect? */
- if (evaluateCrossings(x, y, false, w) != 0 /* top */
- || evaluateCrossings(x, y + h, false, w) != 0 /* bottom */
- || evaluateCrossings(x + w, y, true, h) != 0 /* right */
- || evaluateCrossings(x, y, true, h) != 0) /* left */
- return true;
-
- /* No intersections, is any point inside? */
- if ((evaluateCrossings(x, y, false, BIG_VALUE) & 1) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Test if a high-precision rectangle intersects the shape. This is true
- * if any point in the rectangle is in the shape. This implementation is
- * precise.
- *
- * @param r the rectangle
- * @return true if the rectangle intersects this shape
- * @throws NullPointerException if r is null
- * @see #intersects(double, double, double, double)
- * @since 1.2
- */
- public boolean intersects(Rectangle2D r)
- {
- return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Test if a high-precision rectangle lies completely in the shape. This is
- * true if all points in the rectangle are in the shape. This implementation
- * is precise.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle, treated as point if negative
- * @param h the height of the rectangle, treated as point if negative
- * @return true if the rectangle is contained in this shape
- * @since 1.2
- */
- public boolean contains(double x, double y, double w, double h)
- {
- if (! getBounds2D().intersects(x, y, w, h))
- return false;
-
- /* Does any edge intersect? */
- if (evaluateCrossings(x, y, false, w) != 0 /* top */
- || evaluateCrossings(x, y + h, false, w) != 0 /* bottom */
- || evaluateCrossings(x + w, y, true, h) != 0 /* right */
- || evaluateCrossings(x, y, true, h) != 0) /* left */
- return false;
-
- /* No intersections, is any point inside? */
- if ((evaluateCrossings(x, y, false, BIG_VALUE) & 1) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Test if a high-precision rectangle lies completely in the shape. This is
- * true if all points in the rectangle are in the shape. This implementation
- * is precise.
- *
- * @param r the rectangle
- * @return true if the rectangle is contained in this shape
- * @throws NullPointerException if r is null
- * @see #contains(double, double, double, double)
- * @since 1.2
- */
- public boolean contains(Rectangle2D r)
- {
- return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Return an iterator along the shape boundary. If the optional transform
- * is provided, the iterator is transformed accordingly. Each call returns
- * a new object, independent from others in use. This class is not
- * threadsafe to begin with, so the path iterator is not either.
- *
- * @param transform an optional transform to apply to the iterator
- * @return a new iterator over the boundary
- * @since 1.2
- */
- public PathIterator getPathIterator(final AffineTransform transform)
- {
- return new PathIterator()
- {
- /** The current vertex of iteration. */
- private int vertex;
-
- public int getWindingRule()
- {
- return WIND_EVEN_ODD;
- }
-
- public boolean isDone()
- {
- return vertex > npoints;
- }
-
- public void next()
- {
- vertex++;
- }
-
- public int currentSegment(float[] coords)
- {
- if (vertex >= npoints)
- return SEG_CLOSE;
- coords[0] = xpoints[vertex];
- coords[1] = ypoints[vertex];
- if (transform != null)
- transform.transform(coords, 0, coords, 0, 1);
- return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
- }
-
- public int currentSegment(double[] coords)
- {
- if (vertex >= npoints)
- return SEG_CLOSE;
- coords[0] = xpoints[vertex];
- coords[1] = ypoints[vertex];
- if (transform != null)
- transform.transform(coords, 0, coords, 0, 1);
- return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
- }
- };
- }
-
- /**
- * Return an iterator along the flattened version of the shape boundary.
- * Since polygons are already flat, the flatness parameter is ignored, and
- * the resulting iterator only has SEG_MOVETO, SEG_LINETO and SEG_CLOSE
- * points. If the optional transform is provided, the iterator is
- * transformed accordingly. Each call returns a new object, independent
- * from others in use. This class is not threadsafe to begin with, so the
- * path iterator is not either.
- *
- * @param transform an optional transform to apply to the iterator
- * @param flatness the maximum distance for deviation from the real boundary
- * @return a new iterator over the boundary
- * @since 1.2
- */
- public PathIterator getPathIterator(AffineTransform transform,
- double flatness)
- {
- return getPathIterator(transform);
- }
-
- /**
- * Helper for contains, intersects, calculates the number of intersections
- * between the polygon and a line extending from the point (x, y) along
- * the positive X, or Y axis, within a given interval.
- *
- * @return the winding number.
- * @see #condensed
- * @see #contains(double, double)
- */
- private int evaluateCrossings(double x, double y, boolean useYaxis,
- double distance)
- {
- double x0;
- double x1;
- double y0;
- double y1;
- double epsilon = 0.0;
- int crossings = 0;
- int[] xp;
- int[] yp;
-
- if (useYaxis)
- {
- xp = ypoints;
- yp = xpoints;
- double swap;
- swap = y;
- y = x;
- x = swap;
- }
- else
- {
- xp = xpoints;
- yp = ypoints;
- }
-
- /* Get a value which is small but not insignificant relative the path. */
- epsilon = 1E-7;
-
- x0 = xp[0] - x;
- y0 = yp[0] - y;
- for (int i = 1; i < npoints; i++)
- {
- x1 = xp[i] - x;
- y1 = yp[i] - y;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (y0 * y1 < 0)
- if (Line2D.linesIntersect(x0, y0, x1, y1, epsilon, 0.0, distance, 0.0))
- ++crossings;
-
- x0 = xp[i] - x;
- y0 = yp[i] - y;
- }
-
- // end segment
- x1 = xp[0] - x;
- y1 = yp[0] - y;
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (y0 * y1 < 0)
- if (Line2D.linesIntersect(x0, y0, x1, y1, epsilon, 0.0, distance, 0.0))
- ++crossings;
-
- return crossings;
- }
-} // class Polygon
-
diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java
deleted file mode 100644
index 90d48d903b9..00000000000
--- a/libjava/java/awt/PopupMenu.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/* PopupMenu.java -- An AWT popup menu
- Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.peer.PopupMenuPeer;
-
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * This class implement an AWT popup menu widget
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class PopupMenu extends Menu
-{
-
-/*
- * Static Variables
- */
-
-// Serialization Constant
-private static final long serialVersionUID = -4620452533522760060L;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of PopupMenu
.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
-public
-PopupMenu()
-{
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of PopupMenu
with the specified
- * label.
- *
- * @param label The label for this popup menu.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
-public
-PopupMenu(String label)
-{
- super(label);
-
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Creates this object's native peer.
- */
-public void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createPopupMenu (this);
- super.addNotify ();
-}
-
-/*************************************************************************/
-
-/**
- * Displays this popup menu at the specified coordinates relative to
- * the specified component.
- *
- * @param component The component to which the display coordinates are relative.
- * @param x The X coordinate of the menu.
- * @param y The Y coordinate of the menu.
- */
-public void
-show(Component component, int x, int y)
-{
- if (getPeer() == null)
- this.addNotify();
- PopupMenuPeer pmp = (PopupMenuPeer)getPeer();
- if (pmp != null)
- {
- /* XXX
- Event e = new Event (component, Event.ACTION_EVENT, component);
- e.x = x;
- e.y = y;*/
- pmp.show (component, x, y);
- }
-}
-
- protected class AccessibleAWTPopupMenu extends AccessibleAWTMenu
- {
- protected AccessibleAWTPopupMenu()
- {
- }
-
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.POPUP_MENU;
- }
-
- }
-
- /**
- * Gets the AccessibleContext associated with this PopupMenu
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTPopupMenu();
- return accessibleContext;
- }
-
-} // class PopupMenu
-
diff --git a/libjava/java/awt/PrintGraphics.java b/libjava/java/awt/PrintGraphics.java
deleted file mode 100644
index e7f857797d3..00000000000
--- a/libjava/java/awt/PrintGraphics.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* PrintGraphics.java -- a print graphics context
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This interface allows the originating print job to be obtained.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.0
- * @status updated to 1.4
- */
-public interface PrintGraphics
-{
- /**
- * Returns the PrintJob
that this object is being
- * managed by.
- *
- * @return the print job for this object
- */
- PrintJob getPrintJob();
-} // interface PrintGraphics
diff --git a/libjava/java/awt/PrintJob.java b/libjava/java/awt/PrintJob.java
deleted file mode 100644
index 09b85acceac..00000000000
--- a/libjava/java/awt/PrintJob.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* PrintJob.java -- A print job class
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-/**
- * This abstract class represents a print job.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see Toolkit#getPrintJob(Frame, String, Properties)
- * @since 1.0
- * @status updated to 1.4
- */
-public abstract class PrintJob
-{
- /**
- * Create a new PrintJob.
- */
- public PrintJob()
- {
- }
-
- /**
- * Returns a graphics context suitable for rendering the next page. The
- * return must also implement {@link PrintGraphics}.
- *
- * @return a graphics context for printing the next page
- */
- public abstract Graphics getGraphics();
-
- /**
- * Returns the dimension of the page in pixels. The resolution will be
- * chosen to be similar to the on screen image.
- *
- * @return the page dimensions
- */
- public abstract Dimension getPageDimension();
-
- /**
- * Returns the resolution of the page in pixels per inch. Note that this is
- * not necessarily the printer's resolution.
- *
- * @return the resolution of the page in pixels per inch
- */
- public abstract int getPageResolution();
-
- /**
- * Tests whether or not the last page will be printed first.
- *
- * @return true if the last page prints first
- */
- public abstract boolean lastPageFirst();
-
- /**
- * Informs the print job that printing is complete or should be aborted.
- */
- public abstract void end();
-
- /**
- * This method explicitly ends the print job in the event the job
- * becomes un-referenced without the application having done so.
- */
- public void finalize()
- {
- end();
- }
-} // class PrintJob
diff --git a/libjava/java/awt/Rectangle.java b/libjava/java/awt/Rectangle.java
deleted file mode 100644
index 0f21d495cd8..00000000000
--- a/libjava/java/awt/Rectangle.java
+++ /dev/null
@@ -1,749 +0,0 @@
-/* Rectangle.java -- represents a graphics rectangle
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.Rectangle2D;
-import java.io.Serializable;
-
-/**
- * This class represents a rectangle and all the interesting things you
- * might want to do with it. Note that the coordinate system uses
- * the origin (0,0) as the top left of the screen, with the x and y
- * values increasing as they move to the right and down respectively.
- *
- * contains
or intersects
is
- * undefined unless the rectangle has positive width and height.
- *
- * Rectangle
with a top
- * left corner at (0,0) and a width and height of 0.
- */
- public Rectangle()
- {
- }
-
- /**
- * Initializes a new instance of Rectangle
from the
- * coordinates of the specified rectangle.
- *
- * @param r the rectangle to copy from
- * @throws NullPointerException if r is null
- * @since 1.1
- */
- public Rectangle(Rectangle r)
- {
- x = r.x;
- y = r.y;
- width = r.width;
- height = r.height;
- }
-
- /**
- * Initializes a new instance of Rectangle
from the specified
- * inputs.
- *
- * @param x the X coordinate of the top left corner
- * @param y the Y coordinate of the top left corner
- * @param width the width of the rectangle
- * @param height the height of the rectangle
- */
- public Rectangle(int x, int y, int width, int height)
- {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
-
- /**
- * Initializes a new instance of Rectangle
with the specified
- * width and height. The upper left corner of the rectangle will be at
- * the origin (0,0).
- *
- * @param width the width of the rectangle
- * @param height the height of the rectange
- */
- public Rectangle(int width, int height)
- {
- this.width = width;
- this.height = height;
- }
-
- /**
- * Initializes a new instance of Rectangle
with a top-left
- * corner represented by the specified point and the width and height
- * represented by the specified dimension.
- *
- * @param p the upper left corner of the rectangle
- * @param d the width and height of the rectangle
- * @throws NullPointerException if p or d is null
- */
- public Rectangle(Point p, Dimension d)
- {
- x = p.x;
- y = p.y;
- width = d.width;
- height = d.height;
- }
-
- /**
- * Initializes a new instance of Rectangle
with a top left
- * corner at the specified point and a width and height of zero.
- *
- * @param p the upper left corner of the rectangle
- */
- public Rectangle(Point p)
- {
- x = p.x;
- y = p.y;
- }
-
- /**
- * Initializes a new instance of Rectangle
with an
- * upper left corner at the origin (0,0) and a width and height represented
- * by the specified dimension.
- *
- * @param d the width and height of the rectangle
- */
- public Rectangle(Dimension d)
- {
- width = d.width;
- height = d.height;
- }
-
- /**
- * Get the X coordinate of the upper-left corner.
- *
- * @return the value of x, as a double
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Get the Y coordinate of the upper-left corner.
- *
- * @return the value of y, as a double
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Get the width of the rectangle.
- *
- * @return the value of width, as a double
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Get the height of the rectangle.
- *
- * @return the value of height, as a double
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Returns the bounds of this rectangle. A pretty useless method, as this
- * is already a rectangle; it is included to mimic the
- * getBounds
method in Component.
- *
- * @return a copy of this rectangle
- * @see #setBounds(Rectangle)
- * @since 1.1
- */
- public Rectangle getBounds()
- {
- return new Rectangle(this);
- }
-
- /**
- * Returns the high-precision bounds of this rectangle. A pretty useless
- * method, as this is already a rectangle.
- *
- * @return a copy of this rectangle
- * @see #setBounds(Rectangle)
- * @since 1.2
- */
- public Rectangle2D getBounds2D()
- {
- return new Rectangle(x, y, width, height);
- }
-
- /**
- * Updates this rectangle to match the dimensions of the specified
- * rectangle.
- *
- * @param r the rectangle to update from
- * @throws NullPointerException if r is null
- * @see #setBounds(int, int, int, int)
- * @since 1.1
- */
- public void setBounds(Rectangle r)
- {
- setBounds (r.x, r.y, r.width, r.height);
- }
-
- /**
- * Updates this rectangle to have the specified dimensions.
- *
- * @param x the new X coordinate of the upper left hand corner
- * @param y the new Y coordinate of the upper left hand corner
- * @param width the new width of this rectangle
- * @param height the new height of this rectangle
- * @since 1.1
- */
- public void setBounds(int x, int y, int width, int height)
- {
- reshape (x, y, width, height);
- }
-
- /**
- * Updates this rectangle to have the specified dimensions, as rounded to
- * integers.
- *
- * @param x the new X coordinate of the upper left hand corner
- * @param y the new Y coordinate of the upper left hand corner
- * @param width the new width of this rectangle
- * @param height the new height of this rectangle
- * @since 1.2
- */
- public void setRect(double x, double y, double width, double height)
- {
- this.x = (int) x;
- this.y = (int) y;
- this.width = (int) width;
- this.height = (int) height;
- }
-
- /**
- * Updates this rectangle to have the specified dimensions.
- *
- * @param x the new X coordinate of the upper left hand corner
- * @param y the new Y coordinate of the upper left hand corner
- * @param width the new width of this rectangle
- * @param height the new height of this rectangle
- * @deprecated use {@link #setBounds(int, int, int, int)} instead
- */
- public void reshape(int x, int y, int width, int height)
- {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
-
- /**
- * Returns the location of this rectangle, which is the coordinates of
- * its upper left corner.
- *
- * @return the point where this rectangle is located
- * @see #setLocation(Point)
- * @since 1.1
- */
- public Point getLocation()
- {
- return new Point(x,y);
- }
-
- /**
- * Moves the location of this rectangle by setting its upper left
- * corner to the specified point.
- *
- * @param p the point to move the rectangle to
- * @throws NullPointerException if p is null
- * @see #getLocation()
- * @since 1.1
- */
- public void setLocation(Point p)
- {
- setLocation (p.x, p.y);
- }
-
- /**
- * Moves the location of this rectangle by setting its upper left
- * corner to the specified coordinates.
- *
- * @param x the new X coordinate for this rectangle
- * @param y the new Y coordinate for this rectangle
- * @since 1.1
- */
- public void setLocation(int x, int y)
- {
- move (x, y);
- }
-
- /**
- * Moves the location of this rectangle by setting its upper left
- * corner to the specified coordinates.
- *
- * @param x the new X coordinate for this rectangle
- * @param y the new Y coordinate for this rectangle
- * @deprecated use {@link #setLocation(int, int)} instead
- */
- public void move(int x, int y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Translate the location of this rectangle by the given amounts.
- *
- * @param dx the x distance to move by
- * @param dy the y distance to move by
- * @see #setLocation(int, int)
- */
- public void translate(int dx, int dy)
- {
- x += dx;
- y += dy;
- }
-
- /**
- * Returns the size of this rectangle.
- *
- * @return the size of this rectangle
- * @see #setSize(Dimension)
- * @since 1.1
- */
- public Dimension getSize()
- {
- return new Dimension(width, height);
- }
-
- /**
- * Sets the size of this rectangle based on the specified dimensions.
- *
- * @param d the new dimensions of the rectangle
- * @throws NullPointerException if d is null
- * @see #getSize()
- * @since 1.1
- */
- public void setSize(Dimension d)
- {
- setSize (d.width, d.height);
- }
-
- /**
- * Sets the size of this rectangle based on the specified dimensions.
- *
- * @param width the new width of the rectangle
- * @param height the new height of the rectangle
- * @since 1.1
- */
- public void setSize(int width, int height)
- {
- resize (width, height);
- }
-
- /**
- * Sets the size of this rectangle based on the specified dimensions.
- *
- * @param width the new width of the rectangle
- * @param height the new height of the rectangle
- * @deprecated use {@link #setSize(int, int)} instead
- */
- public void resize(int width, int height)
- {
- this.width = width;
- this.height = height;
- }
-
- /**
- * Tests whether or not the specified point is inside this rectangle.
- * According to the contract of Shape, a point on the border is in only if
- * it has an adjacent point inside the rectangle in either the increasing
- * x or y direction.
- *
- * @param p the point to test
- * @return true if the point is inside the rectangle
- * @throws NullPointerException if p is null
- * @see #contains(int, int)
- * @since 1.1
- */
- public boolean contains(Point p)
- {
- return contains (p.x, p.y);
- }
-
- /**
- * Tests whether or not the specified point is inside this rectangle.
- * According to the contract of Shape, a point on the border is in only if
- * it has an adjacent point inside the rectangle in either the increasing
- * x or y direction.
- *
- * @param x the X coordinate of the point to test
- * @param y the Y coordinate of the point to test
- * @return true if the point is inside the rectangle
- * @since 1.1
- */
- public boolean contains(int x, int y)
- {
- return inside (x, y);
- }
-
- /**
- * Checks whether all points in the given rectangle are contained in this
- * rectangle.
- *
- * @param r the rectangle to check
- * @return true if r is contained in this rectangle
- * @throws NullPointerException if r is null
- * @see #contains(int, int, int, int)
- * @since 1.1
- */
- public boolean contains(Rectangle r)
- {
- return contains (r.x, r.y, r.width, r.height);
- }
-
- /**
- * Checks whether all points in the given rectangle are contained in this
- * rectangle.
- *
- * @param x the x coordinate of the rectangle to check
- * @param y the y coordinate of the rectangle to check
- * @param w the width of the rectangle to check
- * @param h the height of the rectangle to check
- * @return true if the parameters are contained in this rectangle
- * @since 1.1
- */
- public boolean contains(int x, int y, int w, int h)
- {
- return width > 0 && height > 0 && w > 0 && h > 0
- && x >= this.x && x + w <= this.x + this.width
- && y >= this.y && y + h <= this.y + this.height;
- }
-
- /**
- * Tests whether or not the specified point is inside this rectangle.
- *
- * @param x the X coordinate of the point to test
- * @param y the Y coordinate of the point to test
- * @return true if the point is inside the rectangle
- * @deprecated use {@link #contains(int, int)} instead
- */
- public boolean inside(int x, int y)
- {
- return width > 0 && height > 0
- && x >= this.x && x < this.x + width
- && y >= this.y && y < this.y + height;
- }
-
- /**
- * Tests whether or not the specified rectangle intersects this rectangle.
- * This means the two rectangles share at least one internal point.
- *
- * @param r the rectangle to test against
- * @return true if the specified rectangle intersects this one
- * @throws NullPointerException if r is null
- * @since 1.2
- */
- public boolean intersects(Rectangle r)
- {
- return r.width > 0 && r.height > 0 && width > 0 && height > 0
- && r.x < x + width && r.x + r.width > x
- && r.y < y + height && r.y + r.height > y;
- }
-
- /**
- * Determines the rectangle which is formed by the intersection of this
- * rectangle with the specified rectangle. If the two do not intersect,
- * an empty rectangle will be returned (meaning the width and/or height
- * will be non-positive).
- *
- * @param r the rectange to calculate the intersection with
- * @return a new rectangle bounding the intersection
- * @throws NullPointerException if r is null
- */
- public Rectangle intersection(Rectangle r)
- {
- Rectangle res = new Rectangle();
- intersect(this, r, res);
- return res;
- }
-
- /**
- * Returns the smallest rectangle that contains both this rectangle
- * and the specified rectangle.
- *
- * @param r the rectangle to compute the union with
- * @return the smallest rectangle containing both rectangles
- * @throws NullPointerException if r is null
- */
- public Rectangle union(Rectangle r)
- {
- Rectangle res = new Rectangle();
- union(this, r, res);
- return res;
- }
-
- /**
- * Modifies this rectangle so that it represents the smallest rectangle
- * that contains both the existing rectangle and the specified point.
- * However, if the point falls on one of the two borders which are not
- * inside the rectangle, a subsequent call to contains
may
- * return false.
- *
- * @param x the X coordinate of the point to add to this rectangle
- * @param y the Y coordinate of the point to add to this rectangle
- */
- public void add(int x, int y)
- {
- add((double) x, (double) y);
- }
-
- /**
- * Modifies this rectangle so that it represents the smallest rectangle
- * that contains both the existing rectangle and the specified point.
- * However, if the point falls on one of the two borders which are not
- * inside the rectangle, a subsequent call to contains
may
- * return false.
- *
- * @param p the point to add to this rectangle
- * @throws NullPointerException if p is null
- */
- public void add(Point p)
- {
- add((double) p.x, (double) p.y);
- }
-
- /**
- * Modifies this rectangle so that it represents the smallest rectangle
- * that contains both the existing rectangle and the specified rectangle.
- *
- * @param r the rectangle to add to this rectangle
- * @throws NullPointerException if r is null
- * @see #union(Rectangle)
- */
- public void add(Rectangle r)
- {
- union(this, r, this);
- }
-
- /**
- * Expands the rectangle by the specified amount. The horizontal
- * and vertical expansion values are applied both to the X,Y coordinate
- * of this rectangle, and its width and height. Thus the width and
- * height will increase by 2h and 2v accordingly.
- *
- * @param h the horizontal expansion value
- * @param v the vertical expansion value
- */
- public void grow(int h, int v)
- {
- x -= h;
- y -= v;
- width += h + h;
- height += v + v;
- }
-
- /**
- * Tests whether or not this rectangle is empty. An empty rectangle
- * has a non-positive width or height.
- *
- * @return true if the rectangle is empty
- */
- public boolean isEmpty()
- {
- return width <= 0 || height <= 0;
- }
-
- /**
- * Determine where the point lies with respect to this rectangle. The
- * result will be the binary OR of the appropriate bit masks.
- *
- * @param x the x coordinate to check
- * @param y the y coordinate to check
- * @return the binary OR of the result
- * @see #OUT_LEFT
- * @see #OUT_TOP
- * @see #OUT_RIGHT
- * @see #OUT_BOTTOM
- * @since 1.2
- */
- public int outcode(double x, double y)
- {
- int result = 0;
- if (width <= 0)
- result |= OUT_LEFT | OUT_RIGHT;
- else if (x < this.x)
- result |= OUT_LEFT;
- else if (x > this.x + width)
- result |= OUT_RIGHT;
- if (height <= 0)
- result |= OUT_BOTTOM | OUT_TOP;
- else if (y < this.y) // Remember that +y heads top-to-bottom.
- result |= OUT_TOP;
- else if (y > this.y + height)
- result |= OUT_BOTTOM;
- return result;
- }
-
- /**
- * Determines the rectangle which is formed by the intersection of this
- * rectangle with the specified rectangle. If the two do not intersect,
- * an empty rectangle will be returned (meaning the width and/or height
- * will be non-positive).
- *
- * @param r the rectange to calculate the intersection with
- * @return a new rectangle bounding the intersection
- * @throws NullPointerException if r is null
- * @since 1.2
- */
- public Rectangle2D createIntersection(Rectangle2D r)
- {
- // Favor runtime type of other rectangle.
- Rectangle2D res = r.getBounds2D();
- intersect(this, r, res);
- return res;
- }
-
- /**
- * Returns the smallest rectangle that contains both this rectangle
- * and the specified rectangle.
- *
- * @param r the rectangle to compute the union with
- * @return the smallest rectangle containing both rectangles
- * @throws NullPointerException if r is null
- * @since 1.2
- */
- public Rectangle2D createUnion(Rectangle2D r)
- {
- // Favor runtime type of other rectangle.
- Rectangle2D res = r.getBounds2D();
- union(this, r, res);
- return res;
- }
-
- /**
- * Tests this rectangle for equality against the specified object. This
- * will be true if an only if the specified object is an instance of
- * Rectangle2D with the same coordinates and dimensions.
- *
- * @param obj the object to test against for equality
- * @return true if the specified object is equal to this one
- */
- public boolean equals(Object obj)
- {
- if (! (obj instanceof Rectangle2D))
- return false;
- Rectangle2D r = (Rectangle2D) obj;
- return r.getX() == x && r.getY() == y
- && r.getWidth() == width && r.getHeight() == height;
- }
-
- /**
- * Returns a string representation of this rectangle. This is in the form
- * getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width
- * + ",height=" + height + ']'
.
- *
- * @return a string representation of this rectangle
- */
- public String toString()
- {
- return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width
- + ",height=" + height + ']';
- }
-} // class Rectangle
diff --git a/libjava/java/awt/RenderingHints.java b/libjava/java/awt/RenderingHints.java
deleted file mode 100644
index 61e69f6b4bb..00000000000
--- a/libjava/java/awt/RenderingHints.java
+++ /dev/null
@@ -1,793 +0,0 @@
-/* RenderingHints.java --
- Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A collection of (key, value) items that provide 'hints' for the
- * {@link java.awt.Graphics2D} rendering pipeline. Because these
- * items are hints only, they may be ignored by a particular
- * {@link java.awt.Graphics2D} implementation.
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @author Eric Blake (ebb9@email.byu.edu)
- */
-public class RenderingHints implements Map, Cloneable
-{
- /**
- * The base class used to represent keys.
- */
- public abstract static class Key
- {
- private final int key;
-
- /**
- * Creates a new key.
- *
- * @param privateKey the private key.
- */
- protected Key(int privateKey)
- {
- key = privateKey;
- }
-
- /**
- * Returns true
if the specified value is compatible with
- * this key, and false
otherwise.
- *
- * @param value the value (null
permitted).
- *
- * @return A boolean.
- */
- public abstract boolean isCompatibleValue(Object value);
-
- /**
- * Returns the private key for this instance.
- *
- * @return The private key.
- */
- protected final int intKey()
- {
- return key;
- }
-
- /**
- * Returns a hash code for the key.
- *
- * @return A hash code.
- */
- public final int hashCode()
- {
- return System.identityHashCode(this);
- }
-
- /**
- * Checks this key for equality with an arbitrary object.
- *
- * @param other the object (null
permitted)
- *
- * @return A boolean.
- */
- public final boolean equals(Object other)
- {
- return this == other;
- }
- } // class Key
-
- private static final class KeyImpl extends Key
- {
- final String description;
- final Object v1;
- final Object v2;
- final Object v3;
-
- KeyImpl(int privateKey, String description,
- Object v1, Object v2, Object v3)
- {
- super(privateKey);
- this.description = description;
- this.v1 = v1;
- this.v2 = v2;
- this.v3 = v3;
- }
-
- /**
- * Returns true
if the specified value is compatible with
- * this key, and false
otherwise.
- *
- * @param value the value (null
permitted).
- *
- * @return A boolean.
- */
- public boolean isCompatibleValue(Object value)
- {
- return value == v1 || value == v2 || value == v3;
- }
-
- /**
- * Returns a string representation of the key.
- *
- * @return A string.
- */
- public String toString()
- {
- return description;
- }
- } // class KeyImpl
-
- private HashMap hintMap = new HashMap();
-
- /**
- * A key for the 'antialiasing' hint. Permitted values are:
- *
- *
- */
- public static final Key KEY_ANTIALIASING;
-
- /**
- * This value is for use with the {@link #KEY_ANTIALIASING} key.
- */
- public static final Object VALUE_ANTIALIAS_ON
- = "Antialiased rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_ANTIALIASING} key.
- */
- public static final Object VALUE_ANTIALIAS_OFF
- = "Nonantialiased rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_ANTIALIASING} key.
- */
- public static final Object VALUE_ANTIALIAS_DEFAULT
- = "Default antialiasing rendering mode";
-
- /**
- * A key for the 'rendering' hint. Permitted values are:
- *
- *
- * {@link #VALUE_ANTIALIAS_OFF}
- * Render without antialiasing (better speed).
- *
- *
- * {@link #VALUE_ANTIALIAS_ON}
- * Render with antialiasing (better quality).
- *
- *
- * {@link #VALUE_ANTIALIAS_DEFAULT}
- * Use the default value for antialiasing.
- *
- *
- */
- public static final Key KEY_RENDERING;
-
- /**
- * This value is for use with the {@link #KEY_RENDERING} key.
- */
- public static final Object VALUE_RENDER_SPEED
- = "Fastest rendering methods";
-
- /**
- * This value is for use with the {@link #KEY_RENDERING} key.
- */
- public static final Object VALUE_RENDER_QUALITY
- = "Highest quality rendering methods";
-
- /**
- * This value is for use with the {@link #KEY_RENDERING} key.
- */
- public static final Object VALUE_RENDER_DEFAULT
- = "Default rendering methods";
-
- /**
- * A key for the 'dithering' hint. Permitted values are:
- *
- *
- * {@link #VALUE_RENDER_SPEED}
- * Prefer speed over quality when rendering.
- *
- *
- * {@link #VALUE_RENDER_QUALITY}
- * Prefer quality over speed when rendering.
- *
- *
- * {@link #VALUE_RENDER_DEFAULT}
- * Use the default value for quality vs. speed when rendering.
- *
- *
- */
- public static final Key KEY_DITHERING;
-
- /**
- * This value is for use with the {@link #KEY_DITHERING} key.
- */
- public static final Object VALUE_DITHER_DISABLE
- = "Nondithered rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_DITHERING} key.
- */
- public static final Object VALUE_DITHER_ENABLE
- = "Dithered rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_DITHERING} key.
- */
- public static final Object VALUE_DITHER_DEFAULT
- = "Default dithering mode";
-
- /**
- * A key for the 'text antialiasing' hint. Permitted values are:
- *
- *
- * {@link #VALUE_DITHER_DISABLE}
- * Disable dithering.
- *
- *
- * {@link #VALUE_DITHER_ENABLE}
- * Enable dithering.
- *
- *
- * {@link #VALUE_DITHER_DEFAULT}
- * Use the default value for dithering.
- *
- *
- */
- public static final Key KEY_TEXT_ANTIALIASING;
-
- /**
- * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
- */
- public static final Object VALUE_TEXT_ANTIALIAS_ON
- = "Antialiased text mode";
-
- /**
- * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
- */
- public static final Object VALUE_TEXT_ANTIALIAS_OFF
- = "Nonantialiased text mode";
-
- /**
- * This value is for use with the {@link #KEY_TEXT_ANTIALIASING} key.
- */
- public static final Object VALUE_TEXT_ANTIALIAS_DEFAULT
- = "Default antialiasing text mode";
-
- /**
- * A key for the 'fractional metrics' hint. Permitted values are:
- *
- *
- * {@link #VALUE_TEXT_ANTIALIAS_ON}
- * Render text with antialiasing (better quality usually).
- *
- *
- * {@link #VALUE_TEXT_ANTIALIAS_OFF}
- * Render test without antialiasing (better speed).
- *
- *
- * {@link #VALUE_TEXT_ANTIALIAS_DEFAULT}
- * Use the default value for text antialiasing.
- *
- *
- */
- public static final Key KEY_FRACTIONALMETRICS;
-
- /**
- * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
- */
- public static final Object VALUE_FRACTIONALMETRICS_OFF
- = "Integer text metrics mode";
-
- /**
- * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
- */
- public static final Object VALUE_FRACTIONALMETRICS_ON
- = "Fractional text metrics mode";
-
- /**
- * This value is for use with the {@link #KEY_FRACTIONALMETRICS} key.
- */
- public static final Object VALUE_FRACTIONALMETRICS_DEFAULT
- = "Default fractional text metrics mode";
-
- /**
- * A key for the 'interpolation' hint. Permitted values are:
- *
- *
- * {@link #VALUE_FRACTIONALMETRICS_OFF}
- * Render text with fractional metrics off.
- *
- *
- * {@link #VALUE_FRACTIONALMETRICS_ON}
- * Render text with fractional metrics on.
- *
- *
- * {@link #VALUE_FRACTIONALMETRICS_DEFAULT}
- * Use the default value for fractional metrics.
- *
- *
- */
- public static final Key KEY_INTERPOLATION;
-
- /**
- * This value is for use with the {@link #KEY_INTERPOLATION} key.
- */
- public static final Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR
- = "Nearest Neighbor image interpolation mode";
-
- /**
- * This value is for use with the {@link #KEY_INTERPOLATION} key.
- */
- public static final Object VALUE_INTERPOLATION_BILINEAR
- = "Bilinear image interpolation mode";
-
- /**
- * This value is for use with the {@link #KEY_INTERPOLATION} key.
- */
- public static final Object VALUE_INTERPOLATION_BICUBIC
- = "Bicubic image interpolation mode";
-
- /**
- * A key for the 'alpha interpolation' hint. Permitted values are:
- *
- *
- * {@link #VALUE_INTERPOLATION_NEAREST_NEIGHBOR}
- * Use nearest neighbour interpolation.
- *
- *
- * {@link #VALUE_INTERPOLATION_BILINEAR}
- * Use bilinear interpolation.
- *
- *
- * {@link #VALUE_INTERPOLATION_BICUBIC}
- * Use bicubic interpolation.
- *
- *
- */
- public static final Key KEY_ALPHA_INTERPOLATION;
-
- /**
- * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
- */
- public static final Object VALUE_ALPHA_INTERPOLATION_SPEED
- = "Fastest alpha blending methods";
-
- /**
- * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
- */
- public static final Object VALUE_ALPHA_INTERPOLATION_QUALITY
- = "Highest quality alpha blending methods";
-
- /**
- * This value is for use with the {@link #KEY_ALPHA_INTERPOLATION} key.
- */
- public static final Object VALUE_ALPHA_INTERPOLATION_DEFAULT
- = "Default alpha blending methods";
-
- /**
- * A key for the 'color rendering' hint. Permitted values are:
- *
- *
- * {@link #VALUE_ALPHA_INTERPOLATION_SPEED}
- * Prefer speed over quality.
- *
- *
- * {@link #VALUE_ALPHA_INTERPOLATION_QUALITY}
- * Prefer quality over speed.
- *
- *
- * {@link #VALUE_ALPHA_INTERPOLATION_DEFAULT}
- * Use the default setting.
- *
- *
- */
- public static final Key KEY_COLOR_RENDERING;
-
- /**
- * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
- */
- public static final Object VALUE_COLOR_RENDER_SPEED
- = "Fastest color rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
- */
- public static final Object VALUE_COLOR_RENDER_QUALITY
- = "Highest quality color rendering mode";
-
- /**
- * This value is for use with the {@link #KEY_COLOR_RENDERING} key.
- */
- public static final Object VALUE_COLOR_RENDER_DEFAULT
- = "Default color rendering mode";
-
- /**
- * A key for the 'stroke control' hint. Permitted values are:
- *
- *
- * {@link #VALUE_COLOR_RENDER_SPEED}
- * Prefer speed over quality.
- *
- *
- * {@link #VALUE_COLOR_RENDER_QUALITY}
- * Prefer quality over speed.
- *
- *
- * {@link #VALUE_COLOR_RENDER_DEFAULT}
- * Use the default setting.
- *
- *
- */
- public static final Key KEY_STROKE_CONTROL;
-
- /**
- * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
- */
- public static final Object VALUE_STROKE_DEFAULT
- = "Default stroke normalization";
-
- /**
- * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
- */
- public static final Object VALUE_STROKE_NORMALIZE
- = "Normalize strokes for consistent rendering";
-
- /**
- * This value is for use with the {@link #KEY_STROKE_CONTROL} key.
- */
- public static final Object VALUE_STROKE_PURE
- = "Pure stroke conversion for accurate paths";
-
- static
- {
- KEY_ANTIALIASING = new KeyImpl(1, "Global antialiasing enable key",
- VALUE_ANTIALIAS_ON,
- VALUE_ANTIALIAS_OFF,
- VALUE_ANTIALIAS_DEFAULT);
- KEY_RENDERING = new KeyImpl(2, "Global rendering quality key",
- VALUE_RENDER_SPEED,
- VALUE_RENDER_QUALITY,
- VALUE_RENDER_DEFAULT);
- KEY_DITHERING = new KeyImpl(3, "Dithering quality key",
- VALUE_DITHER_DISABLE,
- VALUE_DITHER_ENABLE,
- VALUE_DITHER_DEFAULT);
- KEY_TEXT_ANTIALIASING
- = new KeyImpl(4, "Text-specific antialiasing enable key",
- VALUE_TEXT_ANTIALIAS_ON,
- VALUE_TEXT_ANTIALIAS_OFF,
- VALUE_TEXT_ANTIALIAS_DEFAULT);
- KEY_FRACTIONALMETRICS = new KeyImpl(5, "Fractional metrics enable key",
- VALUE_FRACTIONALMETRICS_OFF,
- VALUE_FRACTIONALMETRICS_ON,
- VALUE_FRACTIONALMETRICS_DEFAULT);
- KEY_INTERPOLATION = new KeyImpl(6, "Image interpolation method key",
- VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
- VALUE_INTERPOLATION_BILINEAR,
- VALUE_INTERPOLATION_BICUBIC);
- KEY_ALPHA_INTERPOLATION
- = new KeyImpl(7, "Alpha blending interpolation method key",
- VALUE_ALPHA_INTERPOLATION_SPEED,
- VALUE_ALPHA_INTERPOLATION_QUALITY,
- VALUE_ALPHA_INTERPOLATION_DEFAULT);
- KEY_COLOR_RENDERING = new KeyImpl(8, "Color rendering quality key",
- VALUE_COLOR_RENDER_SPEED,
- VALUE_COLOR_RENDER_QUALITY,
- VALUE_COLOR_RENDER_DEFAULT);
- KEY_STROKE_CONTROL = new KeyImpl(9, "Stroke normalization control key",
- VALUE_STROKE_DEFAULT,
- VALUE_STROKE_NORMALIZE,
- VALUE_STROKE_PURE);
- }
-
- /**
- * Creates a new collection of hints containing all the (key, value) pairs
- * in the specified map.
- *
- * @param init a map containing a collection of hints (
- *
- * {@link #VALUE_STROKE_DEFAULT}
- * Use the default setting.
- *
- *
- * {@link #VALUE_STROKE_NORMALIZE}
- * XXX
- *
- *
- * {@link #VALUE_STROKE_PURE}
- * XXX
- * null
- * permitted).
- */
- public RenderingHints(Map init)
- {
- if (init != null)
- putAll(init);
- }
-
- /**
- * Creates a new collection containing a single (key, value) pair.
- *
- * @param key the key.
- * @param value the value.
- */
- public RenderingHints(Key key, Object value)
- {
- put(key, value);
- }
-
- /**
- * Returns the number of hints in the collection.
- *
- * @return The number of hints.
- */
- public int size()
- {
- return hintMap.size();
- }
-
- /**
- * Returns true
if there are no hints in the collection,
- * and false
otherwise.
- *
- * @return A boolean.
- */
- public boolean isEmpty()
- {
- return hintMap.isEmpty();
- }
-
- /**
- * Returns true
if the collection of hints contains the
- * specified key, and false
otherwise.
- *
- * @param key the key.
- *
- * @return A boolean.
- */
- public boolean containsKey(Object key)
- {
- if (key == null)
- throw new NullPointerException();
- return hintMap.containsKey((Key) key);
- }
-
- /**
- * Returns true
if the collection of hints contains the
- * specified value, and false
otherwise.
- *
- * @param value the value.
- *
- * @return A boolean.
- */
- public boolean containsValue(Object value)
- {
- return hintMap.containsValue(value);
- }
-
- /**
- * Returns the value associated with the specified key.
- *
- * @param key the key.
- *
- * @return The value.
- */
- public Object get(Object key)
- {
- return hintMap.get((Key) key);
- }
-
- /**
- * Adds a (key, value) pair to the collection of hints (if the
- * collection already contains the specified key, then the
- * value is updated).
- *
- * @param key the key.
- * @param value the value.
- *
- * @return the previous value of the key or null
if the key
- * didn't have a value yet.
- */
- public Object put(Object key, Object value)
- {
- if (key == null || value == null)
- throw new NullPointerException();
- if (! ((Key) key).isCompatibleValue(value))
- throw new IllegalArgumentException();
- return hintMap.put(key, value);
- }
-
- /**
- * Adds all the hints from a collection to this collection.
- *
- * @param hints the hint collection.
- */
- public void add(RenderingHints hints)
- {
- hintMap.putAll(hints);
- }
-
- /**
- * Clears all the hints from this collection.
- */
- public void clear()
- {
- hintMap.clear();
- }
-
- /**
- * Removes a hint from the collection.
- *
- * @param key the key.
- *
- * @return The value that was associated with the key, or null
if
- * the key was not part of the collection
- *
- * @throws ClassCastException if the key is not a subclass of
- * {@link RenderingHints.Key}.
- */
- public Object remove(Object key)
- {
- // don't remove the (Key) cast, it is necessary to throw the exception
- // required by the spec
- return hintMap.remove((Key) key);
- }
-
- /**
- * Adds a collection of (key, value) pairs to the collection.
- *
- * @param m a map containing (key, value) items.
- *
- * @throws ClassCastException if the map contains a key that is not
- * a subclass of {@link RenderingHints.Key}.
- * @throws IllegalArgumentException if the map contains a value that is
- * not compatible with its key.
- */
- public void putAll(Map m)
- {
- // preprocess map to generate appropriate exceptions
- Iterator iterator = m.keySet().iterator();
- while (iterator.hasNext())
- {
- Key key = (Key) iterator.next();
- if (!key.isCompatibleValue(m.get(key)))
- throw new IllegalArgumentException();
- }
- // map is OK, update
- hintMap.putAll(m);
- }
-
- /**
- * Returns a set containing the keys from this collection.
- *
- * @return A set of keys.
- */
- public Set keySet()
- {
- return hintMap.keySet();
- }
-
- /**
- * Returns a collection of the values from this hint collection. The
- * collection is backed by the RenderingHints
instance,
- * so updates to one will affect the other.
- *
- * @return A collection of values.
- */
- public Collection values()
- {
- return hintMap.values();
- }
-
- /**
- * Returns a set of entries from the collection.
- *
- * @return A set of entries.
- */
- public Set entrySet()
- {
- return Collections.unmodifiableSet(hintMap.entrySet());
- }
-
- /**
- * Checks this collection for equality with an arbitrary object.
- *
- * @param o the object (null
permitted)
- *
- * @return A boolean.
- */
- public boolean equals(Object o)
- {
- return hintMap.equals(o);
- }
-
- /**
- * Returns a hash code for the collection of hints.
- *
- * @return A hash code.
- */
- public int hashCode()
- {
- return hintMap.hashCode();
- }
-
- /**
- * Creates a clone of this instance.
- *
- * @return A clone.
- */
- public Object clone()
- {
- try
- {
- RenderingHints copy = (RenderingHints) super.clone();
- copy.hintMap = (HashMap) hintMap.clone();
- return copy;
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * Returns a string representation of this instance.
- *
- * @return A string.
- */
- public String toString()
- {
- return hintMap.toString();
- }
-} // class RenderingHints
diff --git a/libjava/java/awt/Robot.java b/libjava/java/awt/Robot.java
deleted file mode 100644
index 72daa9b94fb..00000000000
--- a/libjava/java/awt/Robot.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/* Robot.java -- a native input event generator
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import gnu.java.awt.ClasspathToolkit;
-
-import java.lang.reflect.InvocationTargetException;
-import java.awt.event.InputEvent;
-import java.awt.image.BufferedImage;
-import java.awt.peer.RobotPeer;
-
-/**
- * The Robot class is used to simulate user interaction with graphical
- * programs. It can generate native windowing system input events and
- * retrieve image data from the current screen. Robot is used to test
- * the AWT and Swing library implementations; it can also be used to
- * create self-running demo programs.
- *
- * Since Robot generates native windowing system events, rather than
- * simply inserting {@link AWTEvents} on the AWT event queue, its use
- * is not restricted to Java programs. It can be used to
- * programatically drive any graphical application.
- *
- * This implementation requires an X server that supports the XTest
- * extension.
- *
- * @author Thomas Fitzsimmons (fitzsim@redhat.com)
- *
- * @since 1.3
- */
-public class Robot
-{
- private boolean waitForIdle;
- private int autoDelay;
- private RobotPeer peer;
-
- /**
- * Construct a Robot object that operates on the default screen.
- *
- * @exception AWTException if GraphicsEnvironment.isHeadless()
- * returns true or if the X server does not support the XTest
- * extension
- * @exception SecurityException if createRobot permission is not
- * granted
- */
- public Robot () throws AWTException
- {
- if (GraphicsEnvironment.isHeadless ())
- throw new AWTException ("Robot: headless graphics environment");
-
- SecurityManager sm = System.getSecurityManager ();
- if (sm != null)
- sm.checkPermission (new AWTPermission ("createRobot"));
-
- ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit ();
-
- // createRobot will throw AWTException if XTest is not supported.
- peer = tk.createRobot (GraphicsEnvironment.getLocalGraphicsEnvironment ()
- .getDefaultScreenDevice ());
- }
-
- /**
- * Construct a Robot object that operates on the specified screen.
- *
- * @exception AWTException if GraphicsEnvironment.isHeadless()
- * returns true or if the X server does not support the XTest
- * extension
- * @exception IllegalArgumentException if screen is not a screen
- * GraphicsDevice
- * @exception SecurityException if createRobot permission is not
- * granted
- */
- public Robot (GraphicsDevice screen) throws AWTException
- {
- if (GraphicsEnvironment.isHeadless ())
- throw new AWTException ("Robot: headless graphics environment");
-
- if (screen.getType () != GraphicsDevice.TYPE_RASTER_SCREEN)
- throw new IllegalArgumentException ("Robot: graphics"
- + " device is not a screen");
-
- SecurityManager sm = System.getSecurityManager ();
- if (sm != null)
- sm.checkPermission (new AWTPermission ("createRobot"));
-
- ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit ();
-
- // createRobot will throw AWTException if XTest is not supported.
- peer = tk.createRobot (screen);
- }
-
- /**
- * Move the mouse pointer to absolute coordinates (x, y).
- *
- * @param x the destination x coordinate
- * @param y the destination y coordinate
- */
- public void mouseMove(int x, int y)
- {
- peer.mouseMove (x, y);
-
- if (waitForIdle)
- waitForIdle ();
-
- if (autoDelay > 0)
- delay (autoDelay);
- }
-
- /**
- * Press one or more mouse buttons.
- *
- * @param buttons the buttons to press; a bitmask of one or more of
- * these {@link InputEvent} fields:
- *
- *
- *
- *
- * @exception IllegalArgumentException if the button mask is invalid
- */
- public void mousePress (int buttons)
- {
- if ((buttons & InputEvent.BUTTON1_MASK) == 0
- && (buttons & InputEvent.BUTTON2_MASK) == 0
- && (buttons & InputEvent.BUTTON3_MASK) == 0)
- throw new IllegalArgumentException ("Robot: mousePress:"
- + " invalid button mask");
-
- peer.mousePress (buttons);
-
- if (waitForIdle)
- waitForIdle ();
-
- if (autoDelay > 0)
- delay (autoDelay);
- }
-
- /**
- * Release one or more mouse buttons.
- *
- * @param buttons the buttons to release; a bitmask of one or more
- * of these {@link InputEvent} fields:
- *
- *
- *
- *
- * @exception IllegalArgumentException if the button mask is invalid
- */
- public void mouseRelease(int buttons)
- {
- if ((buttons & InputEvent.BUTTON1_MASK) == 0
- && (buttons & InputEvent.BUTTON2_MASK) == 0
- && (buttons & InputEvent.BUTTON3_MASK) == 0)
- throw new IllegalArgumentException ("Robot: mouseRelease:"
- + " invalid button mask");
-
- peer.mouseRelease (buttons);
-
- if (waitForIdle)
- waitForIdle ();
-
- if (autoDelay > 0)
- delay (autoDelay);
- }
-
- /**
- * Rotate the mouse scroll wheel.
- *
- * @param wheelAmt number of steps to rotate mouse wheel. negative
- * to rotate wheel up (away from the user), positive to rotate wheel
- * down (toward the user).
- *
- * @since 1.4
- */
- public void mouseWheel (int wheelAmt)
- {
- peer.mouseWheel (wheelAmt);
-
- if (waitForIdle)
- waitForIdle ();
-
- if (autoDelay > 0)
- delay (autoDelay);
- }
-
- /**
- * Press a key.
- *
- * @param keycode key to press, a {@link KeyEvent} VK_ constant
- *
- * @exception IllegalArgumentException if keycode is not a valid key
- */
- public void keyPress (int keycode)
- {
- peer.keyPress (keycode);
-
- if (waitForIdle)
- waitForIdle ();
-
- if (autoDelay > 0)
- delay (autoDelay);
- }
-
- /**
- * Release a key.
- *
- * @param keycode key to release, a {@link KeyEvent} VK_ constant
- *
- * @exception IllegalArgumentException if keycode is not a valid key
- */
- public void keyRelease (int keycode)
- {
- peer.keyRelease (keycode);
-
- if (waitForIdle)
- waitForIdle ();
-
- if (autoDelay > 0)
- delay (autoDelay);
- }
-
- /**
- * Return the color of the pixel at the given screen coordinates.
- *
- * @param x the x coordinate of the pixel
- * @param y the y coordinate of the pixel
- *
- * @return the Color of the pixel at screen coodinates (x, y)
- */
- public Color getPixelColor (int x, int y)
- {
- return new Color (peer.getRGBPixel (x, y));
- }
-
- /**
- * Create an image containing pixels read from the screen. The
- * image does not include the mouse pointer.
- *
- * @param screenRect the rectangle of pixels to capture, in screen
- * coordinates
- *
- * @return a BufferedImage containing the requested pixels
- *
- * @exception IllegalArgumentException if requested width and height
- * are not both greater than zero
- * @exception SecurityException if readDisplayPixels permission is
- * not granted
- */
- public BufferedImage createScreenCapture (Rectangle screenRect)
- {
- if (screenRect.width <= 0)
- throw new IllegalArgumentException ("Robot: capture width is <= 0");
-
- if (screenRect.height <= 0)
- throw new IllegalArgumentException ("Robot: capture height is <= 0");
-
- SecurityManager sm = System.getSecurityManager ();
- if (sm != null)
- sm.checkPermission (new AWTPermission ("readDisplayPixels"));
-
- int[] pixels = peer.getRGBPixels (screenRect);
-
- BufferedImage bufferedImage =
- new BufferedImage (screenRect.width, screenRect.height,
- BufferedImage.TYPE_INT_ARGB);
-
- bufferedImage.setRGB (0, 0, screenRect.width, screenRect.height,
- pixels, 0, screenRect.width);
-
- return bufferedImage;
- }
-
- /**
- * Check if this Robot automatically calls {@link waitForIdle} after
- * generating an event.
- *
- * @return true if waitForIdle is automatically called
- */
- public boolean isAutoWaitForIdle ()
- {
- return waitForIdle;
- }
-
- /**
- * Set whether or not this Robot automatically calls {@link
- * waitForIdle} after generating an event.
- *
- * @param isOn true if waitForIdle should be called automatically
- */
- public void setAutoWaitForIdle (boolean isOn)
- {
- waitForIdle = isOn;
- }
-
- /**
- * Retrieve the length of time this Robot sleeps after generating an
- * event.
- *
- * @return the length of time in milliseconds
- */
- public int getAutoDelay ()
- {
- return autoDelay;
- }
-
- /**
- * Set the length of time this Robot sleeps after generating an
- * event.
- *
- * @param ms the length of time in milliseconds
- *
- * @exception IllegalArgumentException if ms is not between 0 and
- * 60,000 milliseconds inclusive
- */
- public void setAutoDelay (int ms)
- {
- if (ms <= 0 || ms >= 60000)
- throw new IllegalArgumentException ("Robot: delay length out-of-bounds");
-
- autoDelay = ms;
- }
-
- /**
- * Sleep for a specified length of time.
- *
- * @param ms the length of time in milliseconds
- *
- * @exception IllegalArgumentException if ms is not between 0 and
- * 60,000 milliseconds inclusive
- */
- public void delay (int ms)
- {
- if (ms < 0 || ms > 60000)
- throw new IllegalArgumentException ("Robot: delay length out-of-bounds");
-
- try
- {
- Thread.sleep (ms);
- }
- catch (InterruptedException e)
- {
- System.err.println ("Robot: delay interrupted");
- }
- }
-
- /**
- * Wait until all events currently on the event queue have been
- * dispatched.
- */
- public void waitForIdle ()
- {
- if (EventQueue.isDispatchThread ())
- throw new IllegalThreadStateException ("Robot: waitForIdle called from "
- + "the event dispatch thread");
-
- try
- {
- EventQueue.invokeAndWait (new Runnable () { public void run () { } });
- }
- catch (InterruptedException e)
- {
- System.err.println ("Robot: waitForIdle interrupted");
- }
- catch (InvocationTargetException e)
- {
- System.err.println ("Robot: waitForIdle cannot invoke target");
- }
- }
-
- /**
- * Return a string representation of this Robot.
- *
- * @return a string representation
- */
- public String toString ()
- {
- return getClass ().getName ()
- + "[ autoDelay = " + autoDelay + ", autoWaitForIdle = "
- + waitForIdle + " ]";
- }
-}
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
deleted file mode 100644
index b3ecc59fcd5..00000000000
--- a/libjava/java/awt/ScrollPane.java
+++ /dev/null
@@ -1,615 +0,0 @@
-/* ScrollPane.java -- Scrolling window
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.MouseEvent;
-import java.awt.peer.ComponentPeer;
-import java.awt.peer.ScrollPanePeer;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-
-/**
- * This widget provides a scrollable region that allows a single
- * subcomponent to be viewed through a smaller window.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class ScrollPane extends Container implements Accessible
-{
-
-/*
- * Static Variables
- */
-
-/**
- * Constant indicating that scrollbars are created as needed in this
- * windows.
- */
-public static final int SCROLLBARS_AS_NEEDED = 0;
-
-/**
- * Constant indicating that scrollbars are always displayed in this
- * window.
- */
-public static final int SCROLLBARS_ALWAYS = 1;
-
-/**
- * Constant indicating that scrollbars are never displayed in this window.
- */
-public static final int SCROLLBARS_NEVER = 2;
-
-// Serialization constant
-private static final long serialVersionUID = 7956609840827222915L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The horizontal scrollbar for this window. The methods
- * setMinimum()
, setMaximum
, and
- * setVisibleAmount
must not be called on this scrollbar.
- */
-private ScrollPaneAdjustable hAdjustable;
-
-/**
- * @serial The vertical scrollbar for this window. The methods
- * setMinimum()
, setMaximum
, and
- * setVisibleAmount
must not be called on this scrollbar.
- */
-private ScrollPaneAdjustable vAdjustable;
-
-/**
- * @serial Indicates when scrollbars are displayed in this window, will
- * be one of the constants from this class.
- */
-private int scrollbarDisplayPolicy;
-
-// Current scroll position
-private Point scrollPosition = new Point(0, 0);
-
-private boolean wheelScrollingEnabled;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of ScrollPane
with a default
- * scrollbar policy of SCROLLBARS_AS_NEEDED
.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-ScrollPane()
-{
- this(SCROLLBARS_AS_NEEDED);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of ScrollPane
with the
- * specified scrollbar policy.
- *
- * @param scrollbarDisplayPolicy When to display scrollbars, which must
- * be one of the constants defined in this class.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
-public
-ScrollPane(int scrollbarDisplayPolicy)
-{
- if (GraphicsEnvironment.isHeadless ())
- throw new HeadlessException ();
-
- this.scrollbarDisplayPolicy = scrollbarDisplayPolicy;
-
- if (scrollbarDisplayPolicy != SCROLLBARS_ALWAYS
- && scrollbarDisplayPolicy != SCROLLBARS_AS_NEEDED
- && scrollbarDisplayPolicy != SCROLLBARS_NEVER)
- throw new IllegalArgumentException("Bad scrollbarDisplayPolicy: " +
- scrollbarDisplayPolicy);
-
- if (scrollbarDisplayPolicy != SCROLLBARS_NEVER)
- {
- hAdjustable = new ScrollPaneAdjustable (this, Scrollbar.HORIZONTAL);
- vAdjustable = new ScrollPaneAdjustable (this, Scrollbar.VERTICAL);
- }
-
- wheelScrollingEnabled = true;
-
- // Default size.
- setSize(100,100);
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * Returns the current scrollbar display policy.
- *
- * @return The current scrollbar display policy.
- */
-public int
-getScrollbarDisplayPolicy()
-{
- return(scrollbarDisplayPolicy);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the horizontal scrollbar for this object. If the scrollbar
- * display policy is set to SCROLLBARS_NEVER
then this
- * will be null
.
- *
- * @return The horizontal scrollbar for this window.
- */
-public Adjustable
-getHAdjustable()
-{
- return(hAdjustable);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the vertical scrollbar for this object. If the scrollbar
- * display policy is set to SCROLLBARS_NEVER
then this
- * will be null
.
- *
- * @return The horizontal scrollbar for this window.
- */
-public Adjustable
-getVAdjustable()
-{
- return(vAdjustable);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the current viewport size. The viewport is the region of
- * this object's window where the child is actually displayed.
- *
- * @return The viewport size.
- */
-public Dimension getViewportSize ()
-{
- Dimension viewsize = getSize ();
- Insets insets = getInsets ();
-
- viewsize.width -= (insets.left + insets.right);
- viewsize.height -= (insets.top + insets.bottom);
-
- Component[] list = getComponents();
- if ((list == null) || (list.length <= 0))
- return viewsize;
-
- Dimension dim = list[0].getPreferredSize();
-
- if (dim.width <= 0 && dim.height <= 0)
- return viewsize;
-
- int vScrollbarWidth = getVScrollbarWidth ();
- int hScrollbarHeight = getHScrollbarHeight ();
-
- if (scrollbarDisplayPolicy == SCROLLBARS_ALWAYS)
- {
- viewsize.width -= vScrollbarWidth;
- viewsize.height -= hScrollbarHeight;
- return viewsize;
- }
-
- if (scrollbarDisplayPolicy == SCROLLBARS_NEVER)
- return viewsize;
-
- // The scroll policy is SCROLLBARS_AS_NEEDED, so we need to see if
- // either scrollbar is needed.
-
- // Assume we don't need either scrollbar.
- boolean mayNeedVertical = false;
- boolean mayNeedHorizontal = false;
-
- boolean needVertical = false;
- boolean needHorizontal = false;
-
- // Check if we need vertical scrollbars. If we do, then we need to
- // subtract the width of the vertical scrollbar from the viewport's
- // width.
- if (dim.height > viewsize.height)
- needVertical = true;
- else if (dim.height > (viewsize.height - hScrollbarHeight))
- // This is tricky. In this case the child is tall enough that its
- // bottom edge would be covered by a horizontal scrollbar, if one
- // were present. This means that if there's a horizontal
- // scrollbar then we need a vertical scrollbar.
- mayNeedVertical = true;
-
- if (dim.width > viewsize.width)
- needHorizontal = true;
- else if (dim.width > (viewsize.width - vScrollbarWidth))
- mayNeedHorizontal = true;
-
- if (needVertical && mayNeedHorizontal)
- needHorizontal = true;
-
- if (needHorizontal && mayNeedVertical)
- needVertical = true;
-
- if (needHorizontal)
- viewsize.height -= hScrollbarHeight;
-
- if (needVertical)
- viewsize.width -= vScrollbarWidth;
-
- return viewsize;
-}
-
-/*************************************************************************/
-
-/**
- * Returns the height of a horizontal scrollbar.
- *
- * @return The height of a horizontal scrollbar.
- */
-public int
-getHScrollbarHeight()
-{
- ScrollPanePeer spp = (ScrollPanePeer)getPeer();
- if (spp != null)
- return(spp.getHScrollbarHeight());
- else
- return(0); // FIXME: What to do here?
-}
-
-/*************************************************************************/
-
-/**
- * Returns the width of a vertical scrollbar.
- *
- * @return The width of a vertical scrollbar.
- */
-public int
-getVScrollbarWidth()
-{
- ScrollPanePeer spp = (ScrollPanePeer)getPeer();
- if (spp != null)
- return(spp.getVScrollbarWidth());
- else
- return(0); // FIXME: What to do here?
-}
-
-/*************************************************************************/
-
-/**
- * Returns the current scroll position of the viewport.
- *
- * @return The current scroll position of the viewport.
- */
-public Point
-getScrollPosition()
-{
- int x = 0;
- int y = 0;
-
- Adjustable v = getVAdjustable();
- Adjustable h = getHAdjustable();
-
- if (v != null)
- y = v.getValue();
- if (h != null)
- x = h.getValue();
-
- return(new Point(x, y));
-}
-
-/*************************************************************************/
-
-/**
- * Sets the scroll position to the specified value.
- *
- * @param scrollPosition The new scrollPosition.
- *
- * @exception IllegalArgumentException If the specified value is outside
- * the legal scrolling range.
- */
-public void
-setScrollPosition(Point scrollPosition) throws IllegalArgumentException
-{
- setScrollPosition(scrollPosition.x, scrollPosition.y);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the scroll position to the specified value.
- *
- * @param x The new X coordinate of the scroll position.
- * @param y The new Y coordinate of the scroll position.
- *
- * @exception IllegalArgumentException If the specified value is outside
- * the legal scrolling range.
- */
-public void
-setScrollPosition(int x, int y)
-{
- Adjustable h = getHAdjustable();
- Adjustable v = getVAdjustable();
-
- if (h != null)
- h.setValue(x);
- if (v != null)
- v.setValue(y);
-
- ScrollPanePeer spp = (ScrollPanePeer)getPeer();
- if (spp != null)
- spp.setScrollPosition(x, y);
-}
-
-/*************************************************************************/
-
-/**
- * Notifies this object that it should create its native peer.
- */
-public void
-addNotify()
-{
- if (!isDisplayable ())
- return;
-
- setPeer((ComponentPeer)getToolkit().createScrollPane(this));
- super.addNotify();
-
- Component[] list = getComponents();
- if (list != null && list.length > 0 && ! (list[0] instanceof Panel))
- {
- Panel panel = new Panel();
- panel.setLayout(new BorderLayout());
- panel.add(list[0], BorderLayout.CENTER);
- add(panel);
- }
-}
-
-/*************************************************************************/
-
-/**
- * Notifies this object that it should destroy its native peers.
- */
-public void
-removeNotify()
-{
- super.removeNotify();
-}
-
-/*************************************************************************/
-
-/**
- * Adds the specified child component to this container. A
- * ScrollPane
can have at most one child, so if a second
- * one is added, then first one is removed.
- *
- * @param component The component to add to this container.
- * @param constraints A list of layout constraints for this object.
- * @param index The index at which to add the child, which is ignored
- * in this implementation.
- */
- protected final void addImpl (Component component, Object constraints,
- int index)
-{
- Component[] list = getComponents();
- if ((list != null) && (list.length > 0))
- remove(list[0]);
-
- super.addImpl(component, constraints, -1);
-
- doLayout();
-}
-
-/*************************************************************************/
-
-/**
- * Lays out this component. This consists of resizing the sole child
- * component to its perferred size.
- */
-public void
-doLayout()
-{
- layout ();
-}
-
-/*************************************************************************/
-
-/**
- * Lays out this component. This consists of resizing the sole child
- * component to its perferred size.
- *
- * @deprecated This method is deprecated in favor of
- * doLayout()
.
- */
-public void
-layout()
-{
- Component[] list = getComponents ();
- if ((list != null) && (list.length > 0))
- {
- Dimension dim = list[0].getPreferredSize ();
- Dimension vp = getViewportSize ();
-
- if (dim.width < vp.width)
- dim.width = vp.width;
-
- if (dim.height < vp.height)
- dim.height = vp.height;
-
- ScrollPanePeer peer = (ScrollPanePeer) getPeer ();
- if (peer != null)
- peer.childResized (dim.width, dim.height);
-
- list[0].setSize (dim);
-
- Point p = getScrollPosition ();
- if (p.x > dim.width)
- p.x = dim.width;
- if (p.y > dim.height)
- p.y = dim.height;
-
- setScrollPosition (p);
- }
-}
-
-/*************************************************************************/
-
-/**
- * This method overrides its superclass method to ensure no layout
- * manager is set for this container. ScrollPane
's do
- * not have layout managers.
- *
- * @param layoutManager Ignored
- */
-public final void
-setLayout(LayoutManager layoutManager)
-{
- return;
-}
-
-/*************************************************************************/
-
-/**
- * Prints all of the components in this container.
- *
- * @param graphics The desired graphics context for printing.
- */
-public void
-printComponents(Graphics graphics)
-{
- super.printComponents(graphics);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debug string for this object.
- *
- * @return A debug string for this object.
- */
-public String
-paramString()
-{
- Insets insets = getInsets();
- return getName() + ","
- + getX() + ","
- + getY() + ","
- + getWidth() + "x" + getHeight() + ","
- + "ScrollPosition=(" + scrollPosition.getX() + ","
- + scrollPosition.getY() + "),"
- + "Insets=(" + insets.top + ","
- + insets.left + ","
- + insets.bottom + ","
- + insets.right + "),"
- + "ScrollbarDisplayPolicy=" + getScrollbarDisplayPolicy() + ","
- + "wheelScrollingEnabled=" + isWheelScrollingEnabled();
-}
-
- /**
- * Tells whether or not an event is enabled.
- *
- * @since 1.4
- */
- protected boolean eventTypeEnabled (int type)
- {
- if (type == MouseEvent.MOUSE_WHEEL)
- return wheelScrollingEnabled;
-
- return super.eventTypeEnabled (type);
- }
-
- /**
- * Tells whether or not wheel scrolling is enabled.
- *
- * @since 1.4
- */
- public boolean isWheelScrollingEnabled ()
- {
- return wheelScrollingEnabled;
- }
-
- /**
- * Enables/disables wheel scrolling.
- *
- * @since 1.4
- */
- public void setWheelScrollingEnabled (boolean enable)
- {
- wheelScrollingEnabled = enable;
- }
-
- protected class AccessibleAWTScrollPane extends AccessibleAWTContainer
- {
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.SCROLL_PANE;
- }
- }
-
- /**
- * Gets the AccessibleContext associated with this ScrollPane
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTScrollPane();
- return accessibleContext;
- }
-} // class ScrollPane
-
diff --git a/libjava/java/awt/ScrollPaneAdjustable.java b/libjava/java/awt/ScrollPaneAdjustable.java
deleted file mode 100644
index cfca19b4423..00000000000
--- a/libjava/java/awt/ScrollPaneAdjustable.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/* ScrollPaneAdjustable.java -- Scrollbars for a ScrollPane
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.AdjustmentListener;
-import java.io.Serializable;
-
-/**
- * Need this class since the serialization spec for ScrollPane
- * uses it.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.4
- */
-public class ScrollPaneAdjustable
- implements Adjustable, Serializable
-{
- private static final long serialVersionUID = -3359745691033257079L;
-
- ScrollPane sp;
- int orientation;
- int value;
- int minimum;
- int maximum;
- int visibleAmount;
- int unitIncrement = 1;
- int blockIncrement = 1;
- AdjustmentListener adjustmentListener;
-
- private transient boolean valueIsAdjusting = false;
-
- ScrollPaneAdjustable (ScrollPane sp, int orientation)
- {
- this.sp = sp;
- this.orientation = orientation;
- }
-
- ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum,
- int maximum, int visibleAmount, int unitIncrement,
- int blockIncrement)
- {
- this.sp = sp;
- this.orientation = orientation;
- this.value = value;
- this.minimum = minimum;
- this.maximum = maximum;
- this.visibleAmount = visibleAmount;
- this.unitIncrement = unitIncrement;
- this.blockIncrement = blockIncrement;
- }
-
- public void addAdjustmentListener (AdjustmentListener listener)
- {
- AWTEventMulticaster.add (adjustmentListener, listener);
- }
-
- public void removeAdjustmentListener (AdjustmentListener listener)
- {
- AWTEventMulticaster.remove (adjustmentListener, listener);
- }
-
- public AdjustmentListener[] getAdjustmentListeners ()
- {
- return (AdjustmentListener[]) AWTEventMulticaster.getListeners
- (adjustmentListener, AdjustmentListener.class);
- }
-
- public int getBlockIncrement ()
- {
- return blockIncrement;
- }
-
- public int getMaximum ()
- {
- return maximum;
- }
-
- public int getMinimum ()
- {
- return minimum;
- }
-
- public int getOrientation ()
- {
- return orientation;
- }
-
- public int getUnitIncrement ()
- {
- return unitIncrement;
- }
-
- public int getValue ()
- {
- return value;
- }
-
- public int getVisibleAmount ()
- {
- return visibleAmount;
- }
-
- public void setBlockIncrement (int blockIncrement)
- {
- this.blockIncrement = blockIncrement;
- }
-
- public void setMaximum (int maximum)
- {
- this.maximum = maximum;
- }
-
- public void setMinimum (int minimum)
- {
- this.minimum = minimum;
- }
-
- public void setUnitIncrement (int unitIncrement)
- {
- this.unitIncrement = unitIncrement;
- }
-
- public void setValue (int value)
- {
- this.value = value;
-
- if (value < minimum)
- minimum = value;
-
- if (value > maximum)
- maximum = value;
- }
-
- public void setVisibleAmount (int visibleAmount)
- {
- this.visibleAmount = visibleAmount;
- }
-
- public String paramString ()
- {
- throw new Error ("not implemented");
- }
-
- /**
- * Returns true if the value is in the process of changing.
- *
- * @since 1.4
- */
- public boolean getValueIsAdjusting ()
- {
- return valueIsAdjusting;
- }
-
- /**
- * Sets the value of valueIsAdjusting.
- *
- * @since 1.4
- */
- public void setValueIsAdjusting (boolean valueIsAdjusting)
- {
- this.valueIsAdjusting = valueIsAdjusting;
- }
-} // class ScrollPaneAdjustable
-
diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java
deleted file mode 100644
index 6e506c78584..00000000000
--- a/libjava/java/awt/Scrollbar.java
+++ /dev/null
@@ -1,825 +0,0 @@
-/* Scrollbar.java -- AWT Scrollbar widget
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.AdjustmentEvent;
-import java.awt.event.AdjustmentListener;
-import java.awt.peer.ScrollbarPeer;
-import java.util.EventListener;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-import javax.accessibility.AccessibleValue;
-
-/**
- * This class implements a scrollbar widget.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-public class Scrollbar extends Component implements Accessible, Adjustable
-{
- // FIXME: Serialization readObject/writeObject
-
- /**
- * Constant indicating that a scrollbar is horizontal.
- */
- public static final int HORIZONTAL = 0;
-
- /**
- * Constant indicating that a scrollbar is vertical.
- */
- public static final int VERTICAL = 1;
-
- /**
- * Serialization Constant.
- */
- private static final long serialVersionUID = 8451667562882310543L;
-
- /**
- * @serial The amount by which the value of the scrollbar is changed
- * when incrementing in line mode.
- */
- private int lineIncrement;
-
- /**
- * @serial The amount by which the value of the scrollbar is changed
- * when incrementing in page mode.
- */
- private int pageIncrement;
-
- /**
- * @serial The maximum value for this scrollbar
- */
- private int maximum;
-
- /**
- * @serial The minimum value for this scrollbar
- */
- private int minimum;
-
- /**
- * @serial The orientation of this scrollbar, which will be either
- * the HORIZONTAL
or VERTICAL
constant
- * from this class.
- */
- private int orientation;
-
- /**
- * @serial The current value of this scrollbar.
- */
- private int value;
-
- /**
- * @serial The width of the scrollbar's thumb, which is relative
- * to the minimum and maximum value of the scrollbar.
- */
- private int visibleAmount;
-
- /**
- * List of AdjustmentListener's.
- */
- private AdjustmentListener adjustment_listeners;
-
- /**
- * true if the scrollbar is adjusting, false otherwise.
- */
- private transient boolean valueIsAdjusting = false;
-
- /**
- * The number used to generate the name returned by getName.
- */
- private static transient long next_scrollbar_number;
-
- /**
- * Initializes a new instance of Scrollbar
with a
- * vertical orientation and default values for all other parameters.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- */
- public Scrollbar()
- {
- this(VERTICAL);
- }
-
- /**
- * Initializes a new instance of Scrollbar
with the
- * specified orientation and default values for all other parameters.
- * The orientation must be either the constant HORIZONTAL
or
- * VERTICAL
from this class. An incorrect value will throw
- * an exception.
- *
- * @param orientation The orientation of this scrollbar.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- * @exception IllegalArgumentException If the orientation value is not valid.
- */
- public Scrollbar(int orientation) throws IllegalArgumentException
- {
- this(orientation, 0, 10, 0, 100);
- }
-
- /**
- * Initializes a new instance of Scrollbar
with the
- * specified parameters. The orientation must be either the constant
- * HORIZONTAL
or VERTICAL
. An incorrect value
- * will throw an exception. Inconsistent values for other parameters
- * are silently corrected to valid values.
- *
- * @param orientation The orientation of this scrollbar.
- * @param value The initial value of the scrollbar.
- * @param visibleAmount The width of the scrollbar thumb.
- * @param minimum The minimum value of the scrollbar.
- * @param maximum The maximum value of the scrollbar.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- * @exception IllegalArgumentException If the orientation value is not valid.
- */
- public Scrollbar(int orientation, int value, int visibleAmount, int minimum,
- int maximum) throws IllegalArgumentException
- {
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException();
-
- if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
- throw new IllegalArgumentException("Bad orientation value: "
- + orientation);
-
- this.orientation = orientation;
-
- setValues(value, visibleAmount, minimum, maximum);
-
- // Default is 1 according to online docs.
- lineIncrement = 1;
-
- // Default is 10 according to javadocs.
- pageIncrement = 10;
- }
-
- /**
- * Returns the orientation constant for this object.
- *
- * @return The orientation constant for this object.
- */
- public int getOrientation()
- {
- return orientation;
- }
-
- /**
- * Sets the orientation of this scrollbar to the specified value. This
- * value must be either the constant HORIZONTAL
or
- * VERTICAL
from this class or an exception will be thrown.
- *
- * @param orientation The new orientation value.
- *
- * @exception IllegalArgumentException If the orientation value is not valid.
- */
- public void setOrientation(int orientation)
- {
- if ((orientation != HORIZONTAL) && (orientation != VERTICAL))
- throw new IllegalArgumentException("Bad orientation value: "
- + orientation);
-
- // FIXME: Communicate to peer? Or must this be called before peer creation?
- this.orientation = orientation;
- }
-
- /**
- * Returns the current value for this scrollbar.
- *
- * @return The current value for this scrollbar.
- */
- public int getValue()
- {
- return value;
- }
-
- /**
- * Sets the current value for this scrollbar to the specified value.
- * If this is inconsistent with the minimum and maximum values for this
- * scrollbar, the value is silently adjusted.
- *
- * @param value The new value for this scrollbar.
- */
- public void setValue(int value)
- {
- setValues(value, visibleAmount, minimum, maximum);
- }
-
- /**
- * Returns the maximum value for this scrollbar.
- *
- * @return The maximum value for this scrollbar.
- */
- public int getMaximum()
- {
- return maximum;
- }
-
- /**
- * Sets the maximum value for this scrollbar to the specified value.
- * If the value is less than the current minimum value, it is silent
- * set to equal the minimum value.
- *
- * @param maximum The new maximum value for this scrollbar.
- */
- public void setMaximum(int maximum)
- {
- setValues(value, visibleAmount, minimum, maximum);
- }
-
- /**
- * Returns the minimum value for this scrollbar.
- *
- * @return The minimum value for this scrollbar.
- */
- public int getMinimum()
- {
- return minimum;
- }
-
- /**
- * Sets the minimum value for this scrollbar to the specified value. If
- * this is not consistent with the current value and maximum, it is
- * silently adjusted to be consistent.
- *
- * @param minimum The new minimum value for this scrollbar.
- */
- public void setMinimum(int minimum)
- {
- setValues(value, visibleAmount, minimum, maximum);
- }
-
- /**
- * Returns the width of the scrollbar's thumb, in units relative to the
- * maximum and minimum value of the scrollbar.
- *
- * @return The width of the scrollbar's thumb.
- */
- public int getVisibleAmount()
- {
- return getVisible();
- }
-
- /**
- * Returns the width of the scrollbar's thumb, in units relative to the
- * maximum and minimum value of the scrollbar.
- *
- * @return The width of the scrollbar's thumb.
- *
- * @deprecated This method is deprecated in favor of
- * getVisibleAmount()
.
- */
- public int getVisible()
- {
- return visibleAmount;
- }
-
- /**
- * Sets the width of the scrollbar's thumb, in units relative to the
- * maximum and minimum value of the scrollbar.
- *
- * @param visibleAmount The new visible amount value of the scrollbar.
- */
- public void setVisibleAmount(int visibleAmount)
- {
- setValues(value, visibleAmount, minimum, maximum);
- }
-
- /**
- * Sets the current value, visible amount, minimum, and maximum for this
- * scrollbar. These values are adjusted to be internally consistent
- * if necessary.
- *
- * @param value The new value for this scrollbar.
- * @param visibleAmount The new visible amount for this scrollbar.
- * @param minimum The new minimum value for this scrollbar.
- * @param maximum The new maximum value for this scrollbar.
- */
- public synchronized void setValues(int value, int visibleAmount,
- int minimum, int maximum)
- {
- if (maximum < minimum)
- maximum = minimum;
-
- if (value < minimum)
- value = minimum;
-
- if (value > maximum)
- value = maximum;
-
- if (visibleAmount > maximum - minimum)
- visibleAmount = maximum - minimum;
-
- ScrollbarPeer peer = (ScrollbarPeer) getPeer();
- if (peer != null
- && (this.value != value || this.visibleAmount != visibleAmount
- || this.minimum != minimum || this.maximum != maximum))
- peer.setValues(value, visibleAmount, minimum, maximum);
-
- this.value = value;
- this.visibleAmount = visibleAmount;
- this.minimum = minimum;
- this.maximum = maximum;
-
- int range = maximum - minimum;
- if (lineIncrement > range)
- {
- if (range == 0)
- lineIncrement = 1;
- else
- lineIncrement = range;
-
- if (peer != null)
- peer.setLineIncrement(lineIncrement);
- }
-
- if (pageIncrement > range)
- {
- if (range == 0)
- pageIncrement = 1;
- else
- pageIncrement = range;
-
- if (peer != null)
- peer.setPageIncrement(pageIncrement);
- }
- }
-
- /**
- * Returns the value added or subtracted when the user activates the scrollbar
- * scroll by a "unit" amount.
- *
- * @return The unit increment value.
- */
- public int getUnitIncrement()
- {
- return getLineIncrement();
- }
-
- /**
- * Returns the value added or subtracted when the user selects the scrollbar
- * scroll by a "unit" amount control.
- *
- * @return The unit increment value.
- *
- * @deprecated This method is deprecated in favor of
- * getUnitIncrement()
.
- */
- public int getLineIncrement()
- {
- return lineIncrement;
- }
-
- /**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "unit" amount control.
- *
- * @param unitIncrement The new unit increment amount.
- */
- public synchronized void setUnitIncrement(int unitIncrement)
- {
- setLineIncrement(unitIncrement);
- }
-
- /**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "unit" amount control.
- *
- * @param lineIncrement The new unit increment amount.
- *
- * @deprecated This method is deprecated in favor of
- * setUnitIncrement()
.
- */
- public void setLineIncrement(int lineIncrement)
- {
- if (lineIncrement < 0)
- throw new IllegalArgumentException("Unit increment less than zero.");
-
- int range = maximum - minimum;
- if (lineIncrement > range)
- {
- if (range == 0)
- lineIncrement = 1;
- else
- lineIncrement = range;
- }
-
- if (lineIncrement == this.lineIncrement)
- return;
-
- this.lineIncrement = lineIncrement;
-
- ScrollbarPeer peer = (ScrollbarPeer) getPeer();
- if (peer != null)
- peer.setLineIncrement(this.lineIncrement);
- }
-
- /**
- * Returns the value added or subtracted when the user activates the scrollbar
- * scroll by a "block" amount.
- *
- * @return The block increment value.
- */
- public int getBlockIncrement()
- {
- return getPageIncrement();
- }
-
- /**
- * Returns the value added or subtracted when the user selects the scrollbar
- * scroll by a "block" amount control.
- *
- * @return The block increment value.
- *
- * @deprecated This method is deprecated in favor of
- * getBlockIncrement()
.
- */
- public int getPageIncrement()
- {
- return pageIncrement;
- }
-
- /**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "block" amount control.
- *
- * @param blockIncrement The new block increment amount.
- */
- public synchronized void setBlockIncrement(int blockIncrement)
- {
- setPageIncrement(blockIncrement);
- }
-
- /**
- * Sets the value added or subtracted to the scrollbar value when the
- * user selects the scroll by a "block" amount control.
- *
- * @param pageIncrement The new block increment amount.
- *
- * @deprecated This method is deprecated in favor of
- * setBlockIncrement()
.
- */
- public void setPageIncrement(int pageIncrement)
- {
- if (pageIncrement < 0)
- throw new IllegalArgumentException("Block increment less than zero.");
-
- int range = maximum - minimum;
- if (pageIncrement > range)
- {
- if (range == 0)
- pageIncrement = 1;
- else
- pageIncrement = range;
- }
-
- if (pageIncrement == this.pageIncrement)
- return;
-
- this.pageIncrement = pageIncrement;
-
- ScrollbarPeer peer = (ScrollbarPeer) getPeer();
- if (peer != null)
- peer.setPageIncrement(this.pageIncrement);
- }
-
- /**
- * Notifies this object to create its native peer.
- */
- public synchronized void addNotify()
- {
- if (peer == null)
- peer = getToolkit().createScrollbar(this);
- super.addNotify();
- }
-
- /**
- * Adds a new adjustment listener to the list of registered listeners
- * for this object.
- *
- * @param listener The listener to add.
- */
- public synchronized void addAdjustmentListener(AdjustmentListener listener)
- {
- adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners,
- listener);
- enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);
- }
-
- /**
- * Removes the specified listener from the list of registered listeners
- * for this object.
- *
- * @param listener The listener to remove.
- */
- public synchronized void removeAdjustmentListener(AdjustmentListener listener)
- {
- adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners,
- listener);
- }
-
- /**
- * Processes events for this scrollbar. It does this by calling
- * processAdjustmentEvent()
if the event is an instance of
- * AdjustmentEvent
, otherwise it calls the superclass to
- * process the event.
- *
- * @param event The event to process.
- */
- protected void processEvent(AWTEvent event)
- {
- if (event instanceof AdjustmentEvent)
- processAdjustmentEvent((AdjustmentEvent) event);
- else
- super.processEvent(event);
- }
-
- /**
- * Processes adjustment events for this object by dispatching them to
- * any registered listeners. Note that this method will only be called
- * if adjustment events are enabled. This will happen automatically if
- * any listeners are registered. Otherwise, it can be enabled by a
- * call to enableEvents()
.
- *
- * @param event The event to process.
- */
- protected void processAdjustmentEvent(AdjustmentEvent event)
- {
- value = event.getValue();
- if (adjustment_listeners != null)
- adjustment_listeners.adjustmentValueChanged(event);
- }
-
- void dispatchEventImpl(AWTEvent e)
- {
- if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST
- && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST
- && (adjustment_listeners != null
- || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
- }
-
- /**
- * Returns a debugging string for this object.
- *
- * @return A debugging string for this object.
- */
- protected String paramString()
- {
- return ("value=" + getValue() + ",visibleAmount=" + getVisibleAmount()
- + ",minimum=" + getMinimum() + ",maximum=" + getMaximum()
- + ",pageIncrement=" + pageIncrement + ",lineIncrement="
- + lineIncrement + ",orientation="
- + (orientation == HORIZONTAL ? "HORIZONTAL" : "VERTICAL")
- + super.paramString());
- }
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this Scrollbar
. FooListeners are registered using the
- * addFooListener method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements java.util.EventListener.
- */
- public EventListener[] getListeners(Class listenerType)
- {
- if (listenerType == AdjustmentListener.class)
- return AWTEventMulticaster.getListeners(adjustment_listeners,
- listenerType);
-
- return super.getListeners(listenerType);
- }
-
- /**
- * Returns an array of all registered adjustment listeners.
- */
- public AdjustmentListener[] getAdjustmentListeners()
- {
- return (AdjustmentListener[]) getListeners(AdjustmentListener.class);
- }
-
- /**
- * Returns true if the value is in the process of changing.
- *
- * @since 1.4
- */
- public boolean getValueIsAdjusting()
- {
- return valueIsAdjusting;
- }
-
- /**
- * Sets the value of valueIsAdjusting.
- *
- * @since 1.4
- */
- public void setValueIsAdjusting(boolean valueIsAdjusting)
- {
- this.valueIsAdjusting = valueIsAdjusting;
- }
-
- /**
- * Generate a unique name for this scroll bar.
- *
- * @return A unique name for this scroll bar.
- */
- String generateName()
- {
- return "scrollbar" + getUniqueLong();
- }
-
- private static synchronized long getUniqueLong()
- {
- return next_scrollbar_number++;
- }
-
- /**
- * This class provides accessibility support for the
- * scrollbar.
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
- protected class AccessibleAWTScrollBar extends AccessibleAWTComponent
- implements AccessibleValue
- {
- /**
- * Serialization constant to match JDK 1.5
- */
- private static final long serialVersionUID = -344337268523697807L;
-
- /**
- * Returns the role of this accessible object.
- *
- * @return the instance of AccessibleRole
,
- * which describes this object.
- *
- * @see javax.accessibility.AccessibleRole
- */
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.SCROLL_BAR;
- }
-
- /**
- * Returns the state set of this accessible object.
- *
- * @return a set of AccessibleState
s which
- * represent the current state of the accessible object.
- *
- * @see javax.accessibility.AccessibleState
- * @see javax.accessibility.AccessibleStateSet
- */
- public AccessibleStateSet getAccessibleStateSet()
- {
- AccessibleStateSet states = super.getAccessibleStateSet();
- if (getOrientation() == HORIZONTAL)
- states.add(AccessibleState.HORIZONTAL);
- else
- states.add(AccessibleState.VERTICAL);
- if (getValueIsAdjusting())
- states.add(AccessibleState.BUSY);
- return states;
- }
-
- /**
- * Returns an implementation of the AccessibleValue
- * interface for this accessible object. In this case, the
- * current instance is simply returned (with a more appropriate
- * type), as it also implements the accessible value as well as
- * the context.
- *
- * @return the accessible value associated with this context.
- *
- * @see javax.accessibility.AccessibleValue
- */
- public AccessibleValue getAccessibleValue()
- {
- return this;
- }
-
- /**
- * Returns the current value of this accessible object.
- * In this case, this is the same as the value for
- * the scrollbar, wrapped in an Integer
- * object.
- *
- * @return the numeric value of this scrollbar.
- *
- * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
- */
- public Number getCurrentAccessibleValue()
- {
- return new Integer(getValue());
- }
-
- /**
- * Sets the current value of this accessible object
- * to that supplied. In this case, the value of the
- * scrollbar is set, and this method always returns
- * true.
- *
- * @param number the new accessible value.
- *
- * @return true if the value was set.
- *
- * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
- */
- public boolean setCurrentAccessibleValue(Number number)
- {
- setValue(number.intValue());
- return true;
- }
-
- /**
- * Returns the minimum acceptable accessible value used
- * by this object. In this case, this is the same as
- * the minimum value of the scrollbar, wrapped in an
- * object.
- *
- * @return the minimum value of this scrollbar.
- *
- * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
- */
- public Number getMinimumAccessibleValue()
- {
- return new Integer(getMinimum());
- }
-
- /**
- * Returns the maximum acceptable accessible value used
- * by this object. In this case, this is the same as
- * the maximum value of the scrollbar, wrapped in an
- * object.
- *
- * @return the maximum value of this scrollbar.
- *
- * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
- */
- public Number getMaximumAccessibleValue()
- {
- return new Integer(getMaximum());
- }
- }
-
- /**
- * Gets the AccessibleContext associated with this Scrollbar
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTScrollBar();
-
- return accessibleContext;
- }
-}
diff --git a/libjava/java/awt/Shape.java b/libjava/java/awt/Shape.java
deleted file mode 100644
index bd8a4343528..00000000000
--- a/libjava/java/awt/Shape.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Shape.java -- the classic Object-Oriented shape interface
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.AffineTransform;
-import java.awt.geom.PathIterator;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * This interface represents an abstract shape. The shape is described by
- * a {@link PathIterator}, and has callbacks for determining bounding box,
- * where points and rectangles lie in relation to the shape, and tracing
- * the trajectory.
- *
- * contains
or intersects
.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see PathIterator
- * @see AffineTransform
- * @see java.awt.geom.FlatteningPathIterator
- * @see java.awt.geom.GeneralPath
- * @since 1.0
- * @status updated to 1.4
- */
-public interface Shape
-{
- /**
- * Returns a Rectange
that bounds the shape. There is no
- * guarantee that this is the minimum bounding box, particularly if
- * the shape overflows the finite integer range of a bound. Generally,
- * getBounds2D
returns a tighter bound.
- *
- * @return the shape's bounding box
- * @see #getBounds2D()
- */
- Rectangle getBounds();
-
- /**
- * Returns a high precision bounding box of the shape. There is no guarantee
- * that this is the minimum bounding box, but at least it never overflows.
- *
- * @return the shape's bounding box
- * @see #getBounds()
- * @since 1.2
- */
- Rectangle2D getBounds2D();
-
- /**
- * Test if the coordinates lie in the shape.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @return true if (x,y) lies inside the shape
- * @since 1.2
- */
- boolean contains(double x, double y);
-
- /**
- * Test if the point lie in the shape.
- *
- * @param p the high-precision point
- * @return true if p lies inside the shape
- * @throws NullPointerException if p is null
- * @since 1.2
- */
- boolean contains(Point2D p);
-
- /**
- * Test if a high-precision rectangle intersects the shape. This is true
- * if any point in the rectangle is in the shape, with the caveat that the
- * operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
- * class can be used for more precise answers.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle, undefined results if negative
- * @param h the height of the rectangle, undefined results if negative
- * @return true if the rectangle intersects this shape
- * @see java.awt.geom.Area
- * @since 1.2
- */
- boolean intersects(double x, double y, double w, double h);
-
- /**
- * Test if a high-precision rectangle intersects the shape. This is true
- * if any point in the rectangle is in the shape, with the caveat that the
- * operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
- * class can be used for more precise answers.
- *
- * @param r the rectangle
- * @return true if the rectangle intersects this shape
- * @throws NullPointerException if r is null
- * @see #intersects(double, double, double, double)
- * @since 1.2
- */
- boolean intersects(Rectangle2D r);
-
- /**
- * Test if a high-precision rectangle lies completely in the shape. This is
- * true if all points in the rectangle are in the shape, with the caveat
- * that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
- * class can be used for more precise answers.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle, undefined results if negative
- * @param h the height of the rectangle, undefined results if negative
- * @return true if the rectangle is contained in this shape
- * @see java.awt.geom.Area
- * @since 1.2
- */
- boolean contains(double x, double y, double w, double h);
-
- /**
- * Test if a high-precision rectangle lies completely in the shape. This is
- * true if all points in the rectangle are in the shape, with the caveat
- * that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
- * class can be used for more precise answers.
- *
- * @param r the rectangle
- * @return true if the rectangle is contained in this shape
- * @throws NullPointerException if r is null
- * @see #contains(double, double, double, double)
- * @since 1.2
- */
- boolean contains(Rectangle2D r);
-
- /**
- * Return an iterator along the shape boundary. If the optional transform
- * is provided, the iterator is transformed accordingly. Each call returns
- * a new object, independent from others in use. It is recommended, but
- * not required, that the Shape isolate iterations from future changes to
- * the boundary, and document this fact.
- *
- * @param transform an optional transform to apply to the iterator
- * @return a new iterator over the boundary
- * @since 1.2
- */
- PathIterator getPathIterator(AffineTransform transform);
-
- /**
- * Return an iterator along the flattened version of the shape boundary.
- * Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE points are returned in the
- * iterator. The flatness paramter controls how far points are allowed to
- * differ from the real curve; although a limit on accuracy may cause this
- * parameter to be enlarged if needed.
- *
- * drawLine
.
- * Strokes must be immutable, because the graphics object does not clone
- * them.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see BasicStroke
- * @see Graphics2D#setStroke(Stroke)
- * @since 1.1
- * @status updated to 1.4
- */
-public interface Stroke
-{
- /**
- * Returns a shape which outlines the boundary of the given shape, in
- * effect converting the infinitely thin line into a new shape.
- *
- * @param s the shape to stroke
- * @return the stroked outline shape
- */
- Shape createStrokedShape(Shape s);
-} // interface Stroke
diff --git a/libjava/java/awt/SystemColor.java b/libjava/java/awt/SystemColor.java
deleted file mode 100644
index 2ead74a0dbd..00000000000
--- a/libjava/java/awt/SystemColor.java
+++ /dev/null
@@ -1,462 +0,0 @@
-/* SystemColor.java -- access dynamic system color values
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.ColorModel;
-import java.io.Serializable;
-
-/**
- * This class contains the various "system colors" in use by the native
- * windowing system. The getRGB()
method is dynamic on systems
- * which support dynamic system color changes, and most methods in the
- * superclass are written to use this dynamic value when reporting colors.
- * However, the equals()
method is not dynamic, and does not
- * track the actual color of instances in this class. This means that equals
- * may give surprising results; you are better off relying on getRGB.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public final class SystemColor extends Color implements Serializable
-{
- // Implementation note: To be serial compatible with JDK, this class must
- // violate the semantic meaning of super.value to be one of the
- // NUM_COLORS constants instead of the actual RGB value. Hence there are
- // a lot of ugly workarounds in Color and in this class. I would have
- // designed it MUCH differently, making a separate id field in this class.
-
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 4503142729533789064L;
-
- /**
- * Array index of the desktop color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #desktop
- */
- public static final int DESKTOP = 0;
-
- /**
- * Array index of the active caption color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #activeCaption
- */
- public static final int ACTIVE_CAPTION = 1;
-
- /**
- * Array index of the active caption text color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #activeCaptionText
- */
- public static final int ACTIVE_CAPTION_TEXT = 2;
-
- /**
- * Array index of the active caption border color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #activeCaptionBorder
- */
- public static final int ACTIVE_CAPTION_BORDER = 3;
-
- /**
- * Array index of the inactive caption color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #inactiveCaption
- */
- public static final int INACTIVE_CAPTION = 4;
-
- /**
- * Array index of the inactive caption text color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #inactiveCaptionText
- */
- public static final int INACTIVE_CAPTION_TEXT = 5;
-
- /**
- * Array index of the inactive caption border color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #inactiveCaptionBorder
- */
- public static final int INACTIVE_CAPTION_BORDER = 6;
-
- /**
- * Array index of the window background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #window
- */
- public static final int WINDOW = 7;
-
- /**
- * Array index of the window border color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #windowBorder
- */
- public static final int WINDOW_BORDER = 8;
-
- /**
- * Array index of the window text color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #windowText
- */
- public static final int WINDOW_TEXT = 9;
-
- /**
- * Array index of the menu background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #menu
- */
- public static final int MENU = 10;
-
- /**
- * Array index of the menu text color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #menuText
- */
- public static final int MENU_TEXT = 11;
-
- /**
- * Array index of the text background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #text
- */
- public static final int TEXT = 12;
-
- /**
- * Array index of the text foreground color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #textText
- */
- public static final int TEXT_TEXT = 13;
-
- /**
- * Array index of the highlighted text background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #textHighlight
- */
- public static final int TEXT_HIGHLIGHT = 14;
-
- /**
- * Array index of the highlighted text foreground color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #textHighlightText
- */
- public static final int TEXT_HIGHLIGHT_TEXT = 15;
-
- /**
- * Array index of the inactive text foreground color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #textInactiveText
- */
- public static final int TEXT_INACTIVE_TEXT = 16;
-
- /**
- * Array index of the control background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #control
- */
- public static final int CONTROL = 17;
-
- /**
- * Array index of the control text color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #controlText
- */
- public static final int CONTROL_TEXT = 18;
-
- /**
- * Array index of the highlighted control background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #controlHighlight
- */
- public static final int CONTROL_HIGHLIGHT = 19;
-
- /**
- * Array index of the lightly highlighted control background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #controlLtHighlight
- */
- public static final int CONTROL_LT_HIGHLIGHT = 20;
-
- /**
- * Array index of the shadowed control background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #controlShadow
- */
- public static final int CONTROL_SHADOW = 21;
-
- /**
- * Array index of the darkly shadowed control background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #controlDkShadow
- */
- public static final int CONTROL_DK_SHADOW = 22;
-
- /**
- * Array index of the scrollbar background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #scrollbar
- */
- public static final int SCROLLBAR = 23;
-
- /**
- * Array index of the info background color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #info
- */
- public static final int INFO = 24;
-
- /**
- * Array index of the info text color. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- *
- * @see #infoText
- */
- public static final int INFO_TEXT = 25;
-
- /**
- * The number of system colors. Used by
- * {@link Toolkit#loadSystemColors(int[])}.
- */
- public static final int NUM_COLORS = 26;
-
- /**
- * The internal array used to dynamically update getRGB()
.
- */
- private static final int[] colors = new int[NUM_COLORS];
-
- /** The desktop color. */
- public static final SystemColor desktop
- = new SystemColor(DESKTOP);
-
- /** The active caption background color. */
- public static final SystemColor activeCaption
- = new SystemColor(ACTIVE_CAPTION);
-
- /** The active caption text color. */
- public static final SystemColor activeCaptionText
- = new SystemColor(ACTIVE_CAPTION_TEXT);
-
- /** The active caption border color. */
- public static final SystemColor activeCaptionBorder
- = new SystemColor(ACTIVE_CAPTION_BORDER);
-
- /** The inactive caption background color. */
- public static final SystemColor inactiveCaption
- = new SystemColor(INACTIVE_CAPTION);
-
- /** The inactive caption text color. */
- public static final SystemColor inactiveCaptionText
- = new SystemColor(INACTIVE_CAPTION_TEXT);
-
- /** The inactive caption border color. */
- public static final SystemColor inactiveCaptionBorder
- = new SystemColor(INACTIVE_CAPTION_BORDER);
-
- /** The window background color. */
- public static final SystemColor window
- = new SystemColor(WINDOW);
-
- /** The window border color. */
- public static final SystemColor windowBorder
- = new SystemColor(WINDOW_BORDER);
-
- /** The window text color. */
- public static final SystemColor windowText
- = new SystemColor(WINDOW_TEXT);
-
- /** The menu background color. */
- public static final SystemColor menu
- = new SystemColor(MENU);
-
- /** The menu text color. */
- public static final SystemColor menuText
- = new SystemColor(MENU_TEXT);
-
- /** The text background color. */
- public static final SystemColor text
- = new SystemColor(TEXT);
-
- /** The text foreground color. */
- public static final SystemColor textText
- = new SystemColor(TEXT_TEXT);
-
- /** The highlighted text background color. */
- public static final SystemColor textHighlight
- = new SystemColor(TEXT_HIGHLIGHT);
-
- /** The highlighted text foreground color. */
- public static final SystemColor textHighlightText
- = new SystemColor(TEXT_HIGHLIGHT_TEXT);
-
- /** The inactive text color. */
- public static final SystemColor textInactiveText
- = new SystemColor(TEXT_INACTIVE_TEXT);
-
- /** The control background color. */
- public static final SystemColor control
- = new SystemColor(CONTROL);
-
- /** The control text color. */
- public static final SystemColor controlText
- = new SystemColor(CONTROL_TEXT);
-
- /** The control highlight color. */
- public static final SystemColor controlHighlight
- = new SystemColor(CONTROL_HIGHLIGHT);
-
- /** The control light highlight color. */
- public static final SystemColor controlLtHighlight
- = new SystemColor(CONTROL_LT_HIGHLIGHT);
-
- /** The control shadow color. */
- public static final SystemColor controlShadow
- = new SystemColor(CONTROL_SHADOW);
-
- /** The control dark shadow color. */
- public static final SystemColor controlDkShadow
- = new SystemColor(CONTROL_DK_SHADOW);
-
- /** The scrollbar color. */
- public static final SystemColor scrollbar
- = new SystemColor(SCROLLBAR);
-
- /** The info text background color. */
- public static final SystemColor info
- = new SystemColor(INFO);
-
- /** The info text foreground color. */
- public static final SystemColor infoText
- = new SystemColor(INFO_TEXT);
-
- /**
- * Construct a system color which is dynamically updated.
- *
- * @param id the color id
- */
- private SystemColor(int id)
- {
- // Note: See Color#Color(int, boolean) to explain why we use this
- // particular constructor.
- super(id, true);
- }
-
- /**
- * Returns the RGB value for this color, in the sRGB color space. The blue
- * value will be in bits 0-7, green in 8-15, red in 6-23, and the alpha
- * value (bits 24-31) is 0xff. This is dynamically updated, so it may not
- * match the results of getRed()
, getGreen()
, or
- * getBlue()
.
- *
- * @return the current RGB value
- */
- public int getRGB()
- {
- Toolkit.getDefaultToolkit().loadSystemColors(colors);
- return colors[value] | ALPHA_MASK;
- }
-
- /**
- * Returns a paint context, used for filling areas of a raster scan with
- * the current value of this system color. Since the system colors may be
- * dynamically updated, the returned value may not always be the same; but
- * as the system color is solid, the context does not need any of the
- * passed parameters to do its job.
- *
- * @param cm the requested color model
- * @param deviceBounds the bounding box in device coordinates, ignored
- * @param userBounds the bounding box in user coordinates, ignored
- * @param xform the bounds transformation, ignored
- * @param hints any rendering hints, ignored
- * @return a context for painting this solid color
- */
- public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
- Rectangle2D userBounds,
- AffineTransform xform,
- RenderingHints hints)
- {
- Toolkit.getDefaultToolkit().loadSystemColors(colors);
- int color = colors[value] | ALPHA_MASK;
- if (context == null || color != context.color || !context.getColorModel().equals(cm))
- context = new ColorPaintContext(cm,color);
- return context;
- }
-
- /**
- * Returns a string describing this color. This is in the format
- * "java.awt.SystemColor[i=" + index + ']', where index is one of the
- * integer constants of this class. Unfortunately, this description
- * does not describe the current value of the color; for that you should
- * use new Color(syscolor.getRGB()).toString()
.
- *
- * @return a string describing this color
- */
- public String toString()
- {
- return "java.awt.SystemColor[i=" + value + ']';
- }
-} // class SystemColor
diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java
deleted file mode 100644
index d422d3306d2..00000000000
--- a/libjava/java/awt/TextArea.java
+++ /dev/null
@@ -1,629 +0,0 @@
-/* TextArea.java -- A multi-line text entry component
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.KeyEvent;
-import java.awt.peer.ComponentPeer;
-import java.awt.peer.TextAreaPeer;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleStateSet;
-
-
-/**
- * A TextArea is a text component capable of displaying multiple lines
- * of user-editable text. A TextArea handles its own scrolling and
- * can display vertical and horizontal scrollbars as navigation aids.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class TextArea extends TextComponent implements java.io.Serializable
-{
- /**
- * Display both horiztonal and vertical scroll bars.
- */
- public static final int SCROLLBARS_BOTH = 0;
-
- /**
- * Display vertical scroll bar only.
- */
- public static final int SCROLLBARS_VERTICAL_ONLY = 1;
-
- /**
- * Display horizatonal scroll bar only.
- */
- public static final int SCROLLBARS_HORIZONTAL_ONLY = 2;
-
- /**
- * Do not display scrollbars.
- */
- public static final int SCROLLBARS_NONE = 3;
-
- /**
- * Serialization constant.
- */
- private static final long serialVersionUID = 3692302836626095722L;
-
- /**
- * @serial The number of columns used in this text area's preferred
- * and minimum size calculations.
- */
- private int columns;
-
- /**
- * @serial The number of rows used in this text area's preferred and
- * minimum size calculations.
- */
- private int rows;
-
- /**
- * @serial The scrollbar display policy. One of SCROLLBARS_BOTH,
- * SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY,
- * SCROLLBARS_NONE.
- */
- private int scrollbarVisibility;
-
- /*
- * The number used to generate the name returned by getName.
- */
- private static transient long next_text_number;
-
- /**
- * Initialize a new instance of TextArea
that is empty.
- * Conceptually the TextArea
has 0 rows and 0 columns
- * but its initial bounds are defined by its peer or by the
- * container in which it is packed. Both horizontal and vertical
- * scrollbars will be displayed.
- *
- * @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
- */
- public TextArea ()
- {
- this ("", 0, 0, SCROLLBARS_BOTH);
- }
-
- /**
- * Initialize a new instance of TextArea
that contains
- * the specified text. Conceptually the TextArea
has 0
- * rows and 0 columns but its initial bounds are defined by its peer
- * or by the container in which it is packed. Both horizontal and
- * veritcal scrollbars will be displayed.
- *
- * @param text The text to display in this text area.
- *
- * @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
- */
- public TextArea (String text)
- {
- this (text, 0, 0, SCROLLBARS_BOTH);
- }
-
- /**
- * Initialize a new instance of TextArea
that is empty
- * and can display the specified number of rows and columns of text,
- * without the need to scroll. Both horizontal and vertical
- * scrollbars will be displayed.
- *
- * @param rows The number of rows in this text area.
- * @param columns The number of columns in this text area.
- *
- * @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
- */
- public TextArea (int rows, int columns)
- {
- this ("", rows, columns, SCROLLBARS_BOTH);
- }
-
- /**
- * Initialize a new instance of TextArea
that can
- * display the specified number of rows and columns of text, without
- * the need to scroll. The TextArea initially contains the
- * specified text.
- *
- * @param text The text to display in this text area.
- * @param rows The number of rows in this text area.
- * @param columns The number of columns in this text area.
- *
- * @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
- */
- public TextArea (String text, int rows, int columns)
- {
- this (text, rows, columns, SCROLLBARS_BOTH);
- }
-
- /**
- * Initialize a new instance of TextArea
that initially
- * contains the specified text. The TextArea can display the
- * specified number of rows and columns of text, without the need to
- * scroll. This constructor allows specification of the scroll bar
- * display policy.
- *
- * @param text The text to display in this text area.
- * @param rows The number of rows in this text area.
- * @param columns The number of columns in this text area.
- * @param scrollbarVisibility The scroll bar display policy. One of
- * SCROLLBARS_BOTH, SCROLLBARS_VERTICAL_ONLY,
- * SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE.
- *
- * @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
- */
- public TextArea (String text, int rows, int columns, int scrollbarVisibility)
- {
- super (text);
-
- if (GraphicsEnvironment.isHeadless ())
- throw new HeadlessException ();
-
- if (rows < 0 || columns < 0)
- throw new IllegalArgumentException ("Bad row or column value");
-
- if (scrollbarVisibility != SCROLLBARS_BOTH
- && scrollbarVisibility != SCROLLBARS_VERTICAL_ONLY
- && scrollbarVisibility != SCROLLBARS_HORIZONTAL_ONLY
- && scrollbarVisibility != SCROLLBARS_NONE)
- throw new IllegalArgumentException ("Bad scrollbar visibility value");
-
- this.rows = rows;
- this.columns = columns;
- this.scrollbarVisibility = scrollbarVisibility;
-
- // TextAreas need to receive tab key events so we override the
- // default forward and backward traversal key sets.
- Set s = new HashSet ();
- s.add (AWTKeyStroke.getAWTKeyStroke (KeyEvent.VK_TAB,
- KeyEvent.CTRL_DOWN_MASK));
- setFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, s);
- s = new HashSet ();
- s.add (AWTKeyStroke.getAWTKeyStroke (KeyEvent.VK_TAB,
- KeyEvent.SHIFT_DOWN_MASK
- | KeyEvent.CTRL_DOWN_MASK));
- setFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, s);
- }
-
- /**
- * Retrieve the number of columns that this text area would prefer
- * to display. This value may or may not correspond to the number
- * of columns that are actually displayed.
- *
- * @return The preferred number of columns.
- */
- public int getColumns ()
- {
- return columns;
- }
-
- /**
- * Set the preferred number of columns for this text area. This
- * method does not cause the number of columns displayed by the text
- * area to be updated, if the text area is currently visible.
- *
- * @param columns The preferred number of columns.
- *
- * @exception IllegalArgumentException If columns is less than zero.
- */
- public synchronized void setColumns (int columns)
- {
- if (columns < 0)
- throw new IllegalArgumentException ("Value is less than zero: "
- + columns);
-
- this.columns = columns;
- }
-
- /**
- * Retrieve the number of rows that this text area would prefer to
- * display. This value may or may not correspond to the number of
- * rows that are actually displayed.
- *
- * @return The preferred number of rows.
- */
- public int getRows ()
- {
- return rows;
- }
-
- /**
- * Set the preferred number of rows for this text area. This method
- * does not cause the number of columns displayed by the text area
- * to be updated, if the text area is currently visible.
- *
- * @param rows The preferred number of rows.
- *
- * @exception IllegalArgumentException If rows is less than zero.
- */
- public synchronized void setRows (int rows)
- {
- if (rows < 1)
- throw new IllegalArgumentException ("Value is less than one: " + rows);
-
- this.rows = rows;
- }
-
- /**
- * Retrieve the minimum size for this text area, considering the
- * text area's current row and column values. A text area's minimum
- * size depends on the number of rows and columns of text it would
- * prefer to display, and on the size of the font in which the text
- * would be displayed.
- *
- * @return The minimum size for this text field.
- */
- public Dimension getMinimumSize ()
- {
- return getMinimumSize (getRows (), getColumns ());
- }
-
- /**
- * Retrieve the minimum size that this text area would have if its
- * row and column values were equal to those specified. A text
- * area's minimum size depends on the number of rows and columns of
- * text it would prefer to display, and on the size of the font in
- * which the text would be displayed.
- *
- * @param rows The number of rows to use in the minimum size
- * calculation.
- * @param columns The number of columns to use in the minimum size
- * calculation.
- *
- * @return The minimum size for this text area.
- */
- public Dimension getMinimumSize (int rows, int columns)
- {
- return minimumSize (rows, columns);
- }
-
- /**
- * Retrieve the minimum size for this text area, considering the
- * text area's current row and column values. A text area's minimum
- * size depends on the number of rows and columns of text it would
- * prefer to display, and on the size of the font in which the text
- * would be displayed.
- *
- * @return The minimum size for this text area.
- *
- * @deprecated This method is deprecated in favor of
- * getMinimumSize ()
.
- */
- public Dimension minimumSize ()
- {
- return minimumSize (getRows (), getColumns ());
- }
-
- /**
- * Retrieve the minimum size that this text area would have if its
- * row and column values were equal to those specified. A text
- * area's minimum size depends on the number of rows and columns of
- * text it would prefer to display, and on the size of the font in
- * which the text would be displayed.
- *
- * @param rows The number of rows to use in the minimum size
- * calculation.
- * @param columns The number of columns to use in the minimum size
- * calculation.
- *
- * @return The minimum size for this text area.
- *
- * @deprecated This method is deprecated in favor of
- * getMinimumSize (int, int)
.
- */
- public Dimension minimumSize (int rows, int columns)
- {
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
- // Sun returns Dimension (0,0) in this case.
- if (peer == null)
- return new Dimension (0, 0);
-
- return peer.getMinimumSize (rows, columns);
- }
-
- /**
- * Retrieve the preferred size for this text area, considering the
- * text area's current row and column values. A text area's preferred
- * size depends on the number of rows and columns of text it would
- * prefer to display, and on the size of the font in which the text
- * would be displayed.
- *
- * @return The preferred size for this text field.
- */
- public Dimension getPreferredSize ()
- {
- return getPreferredSize (getRows (), getColumns ());
- }
-
- /**
- * Retrieve the preferred size that this text area would have if its
- * row and column values were equal to those specified. A text
- * area's preferred size depends on the number of rows and columns
- * of text it would prefer to display, and on the size of the font
- * in which the text would be displayed.
- *
- * @param rows The number of rows to use in the preferred size
- * calculation.
- * @param columns The number of columns to use in the preferred size
- * calculation.
- *
- * @return The preferred size for this text area.
- */
- public Dimension getPreferredSize (int rows, int columns)
- {
- return preferredSize (rows, columns);
- }
-
- /**
- * Retrieve the preferred size for this text area, considering the
- * text area's current row and column values. A text area's preferred
- * size depends on the number of rows and columns of text it would
- * prefer to display, and on the size of the font in which the text
- * would be displayed.
- *
- * @return The preferred size for this text field.
- *
- * @deprecated This method is deprecated in favor of
- * getPreferredSize ()
.
- */
- public Dimension preferredSize ()
- {
- return preferredSize (getRows (), getColumns ());
- }
-
- /**
- * Retrieve the preferred size that this text area would have if its
- * row and column values were equal to those specified. A text
- * area's preferred size depends on the number of rows and columns
- * of text it would prefer to display, and on the size of the font
- * in which the text would be displayed.
- *
- * @param rows The number of rows to use in the preferred size
- * calculation.
- * @param columns The number of columns to use in the preferred size
- * calculation.
- *
- * @return The preferred size for this text area.
- *
- * @deprecated This method is deprecated in favor of
- * getPreferredSize (int, int)
.
- */
- public Dimension preferredSize (int rows, int columns)
- {
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
- // Sun returns Dimension (0,0) in this case.
- if (peer == null)
- return new Dimension (0, 0);
-
- return peer.getPreferredSize (rows, columns);
- }
-
- /**
- * Retrieve the scroll bar display policy -- one of SCROLLBARS_BOTH,
- * SCROLLBARS_VERTICAL_ONLY, SCROLLBARS_HORIZONTAL_ONLY,
- * SCROLLBARS_NONE.
- *
- * @return The current scroll bar display policy.
- */
- public int getScrollbarVisibility ()
- {
- return scrollbarVisibility;
- }
-
- /**
- * Notify this object that it should create its native peer.
- */
- public void addNotify ()
- {
- if (getPeer () == null)
- setPeer ((ComponentPeer) getToolkit().createTextArea (this));
- }
-
- /**
- * Append the specified text to the end of the current text.
- *
- * @param str The text to append.
- */
- public void append (String str)
- {
- appendText (str);
- }
-
- /**
- * Append the specified text to the end of the current text.
- *
- * @param str The text to append.
- *
- * @deprecated This method is deprecated in favor of
- * append ()
.
- */
- public void appendText (String str)
- {
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
- if (peer != null)
- peer.insert (str, peer.getText().length ());
- }
-
- /**
- * Insert the specified text at the specified position. The first
- * character in the text area is at position zero.
- *
- * @param str The text to insert.
- * @param pos The position at which to insert text.
- */
- public void insert (String str, int pos)
- {
- insertText (str, pos);
- }
-
- /**
- * Insert the specified text at the specified position. The first
- * character in the text area is at position zero.
- *
- * @param str The text to insert.
- * @param pos The position at which to insert text.
- *
- * @deprecated This method is deprecated in favor of
- * insert ()
.
- */
- public void insertText (String str, int pos)
- {
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
- if (peer != null)
- peer.insert (str, pos);
- }
-
- /**
- * Replace a range of characters with the specified text. The
- * character at the start position will be replaced, unless start ==
- * end. The character at the end posistion will not be replaced.
- * The first character in the text area is at position zero. The
- * length of the replacement text may differ from the length of the
- * text that is replaced.
- *
- * @param str The new text for the range.
- * @param start The start position of the replacement range.
- * @param end The end position of the replacement range.
- */
- public void replaceRange (String str, int start, int end)
- {
- replaceText (str, start, end);
- }
-
- /**
- * Replace a range of characters with the specified text. The
- * character at the start position will be replaced, unless start ==
- * end. The character at the end posistion will not be replaced.
- * The first character in the text area is at position zero. The
- * length of the replacement text may differ from the length of the
- * text that is replaced.
- *
- * @param str The new text for the range.
- * @param start The start position of the replacement range.
- * @param end The end position of the replacement range.
- *
- * @deprecated This method is deprecated in favor of
- * replaceRange ()
.
- */
- public void replaceText (String str, int start, int end)
- {
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
- if (peer != null)
- peer.replaceRange (str, start, end);
- }
-
- /**
- * Retrieve a debugging string for this text area.
- *
- * @return A debugging string for this text area.
- */
- protected String paramString ()
- {
- String sbVisibility = "";
-
- switch (scrollbarVisibility)
- {
- case SCROLLBARS_BOTH:
- sbVisibility = "both";
- break;
- case SCROLLBARS_VERTICAL_ONLY:
- sbVisibility = "vertical-only";
- break;
- case SCROLLBARS_HORIZONTAL_ONLY:
- sbVisibility = "horizontal-only";
- break;
- case SCROLLBARS_NONE:
- sbVisibility = "none";
- break;
- }
-
- String editable = "";
- if (isEditable ())
- editable = "editable,";
-
- return getName () + "," + getX () + "," + getY () + "," + getWidth ()
- + "x" + getHeight () + "," + "text=" + getText () + "," + editable
- + "selection=" + getSelectionStart () + "-" + getSelectionEnd ()
- + ",rows=" + rows + ",columns=" + columns + ",scrollbarVisibility="
- + sbVisibility;
- }
-
- /**
- * Generate a unique name for this text area.
- *
- * @return A unique name for this text area.
- */
- String generateName ()
- {
- return "text" + getUniqueLong ();
- }
-
- private static synchronized long getUniqueLong ()
- {
- return next_text_number++;
- }
-
- protected class AccessibleAWTTextArea extends AccessibleAWTTextComponent
- {
- protected AccessibleAWTTextArea()
- {
- }
-
- public AccessibleStateSet getAccessibleStateSet()
- {
- return super.getAccessibleStateSet();
- }
- }
-
- /**
- * Gets the AccessibleContext associated with this TextArea
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTTextArea();
- return accessibleContext;
- }
-}
diff --git a/libjava/java/awt/TextComponent.java b/libjava/java/awt/TextComponent.java
deleted file mode 100644
index 9edbd88fe33..00000000000
--- a/libjava/java/awt/TextComponent.java
+++ /dev/null
@@ -1,739 +0,0 @@
-/* TextComponent.java -- Widgets for entering text
- Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.TextEvent;
-import java.awt.event.TextListener;
-import java.awt.peer.TextComponentPeer;
-import java.io.Serializable;
-import java.text.BreakIterator;
-import java.util.EventListener;
-
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-import javax.accessibility.AccessibleText;
-import javax.swing.text.AttributeSet;
-
-/**
- * This class provides common functionality for widgets than
- * contain text.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class TextComponent extends Component
- implements Serializable, Accessible
-{
-
-/*
- * Static Variables
- */
-
-// Constant for serialization
-private static final long serialVersionUID = -2214773872412987419L;
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial Indicates whether or not this component is editable.
- * This is package-private to avoid an accessor method.
- */
-boolean editable;
-
-/**
- * @serial The starting position of the selected text region.
- * This is package-private to avoid an accessor method.
- */
-int selectionStart;
-
-/**
- * @serial The ending position of the selected text region.
- * This is package-private to avoid an accessor method.
- */
-int selectionEnd;
-
-/**
- * @serial The text in the component
- * This is package-private to avoid an accessor method.
- */
-String text;
-
-/**
- * A list of listeners that will receive events from this object.
- */
-protected transient TextListener textListener;
-
- protected class AccessibleAWTTextComponent
- extends AccessibleAWTComponent
- implements AccessibleText, TextListener
- {
- // Constructor
- // Adds a listener for tracking caret changes
- public AccessibleAWTTextComponent()
- {
- TextComponent.this.addTextListener(this);
- }
-
- public AccessibleRole getAccessibleRole()
- {
- return AccessibleRole.TEXT;
- }
-
- public AccessibleStateSet getAccessibleStateSet()
- {
- // TODO: Docs say PropertyChangeEvent will fire if this state changes.
- // That means that the event has to fire when editable changes.
- AccessibleStateSet ss = super.getAccessibleStateSet();
- if (editable)
- ss.add(AccessibleState.EDITABLE);
- return ss;
- }
-
- public AccessibleText getAccessibleText()
- {
- return this;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getIndexAtPoint(java.awt.Point)
- */
- public int getIndexAtPoint(Point point)
- {
- return TextComponent.this.getIndexAtPoint(point);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getCharacterBounds(int)
- */
- public Rectangle getCharacterBounds(int index)
- {
- return TextComponent.this.getCharacterBounds(index);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getCharCount()
- */
- public int getCharCount()
- {
- return text.length();
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getCaretPosition()
- */
- public int getCaretPosition()
- {
- return TextComponent.this.getCaretPosition();
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getAtIndex(int, int)
- */
- public String getAtIndex(int part, int index)
- {
- if (index < 0 || index >= text.length())
- return null;
- BreakIterator it = null;
- switch (part)
- {
- case CHARACTER:
- return text.substring(index, index + 1);
- case WORD:
- it = BreakIterator.getWordInstance();
- break;
- case SENTENCE:
- it = BreakIterator.getSentenceInstance();
- break;
- default:
- return null;
- }
- it.setText(text);
- int start = index;
- if (!it.isBoundary(index))
- start = it.preceding(index);
- int end = it.following(index);
- if (end == -1)
- return text.substring(index);
- else
- return text.substring(index, end);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getAfterIndex(int, int)
- */
- public String getAfterIndex(int part, int index) {
- if (index < 0 || index >= text.length())
- return null;
- BreakIterator it = null;
- switch (part)
- {
- case CHARACTER:
- return text.substring(index, index + 1);
- case WORD:
- it = BreakIterator.getWordInstance();
- break;
- case SENTENCE:
- it = BreakIterator.getSentenceInstance();
- break;
- default:
- return null;
- }
- it.setText(text);
- int start = index;
- if (!it.isBoundary(index))
- start = it.following(index);
- // Make sure there was a complete unit. I.e. if index is in the middle
- // of a word, return null if there is no word after the that one.
- if (start == -1)
- return null;
- int end = it.following(start);
- if (end == -1)
- return text.substring(index);
- else
- return text.substring(index, end);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getBeforeIndex(int, int)
- */
- public String getBeforeIndex(int part, int index)
- {
- if (index < 1 || index >= text.length())
- return null;
- BreakIterator it = null;
- switch (part)
- {
- case CHARACTER:
- return text.substring(index - 1, index);
- case WORD:
- it = BreakIterator.getWordInstance();
- break;
- case SENTENCE:
- it = BreakIterator.getSentenceInstance();
- break;
- default:
- return null;
- }
- it.setText(text);
- int end = index;
- if (!it.isBoundary(index))
- end = it.preceding(index);
- // Make sure there was a complete unit. I.e. if index is in the middle
- // of a word, return null if there is no word before that one.
- if (end == -1)
- return null;
- int start = it.preceding(end);
- if (start == -1)
- return text.substring(0, end);
- else
- return text.substring(start, end);
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getCharacterAttribute(int)
- */
- public AttributeSet getCharacterAttribute(int index)
- {
- // FIXME: I suspect this really gets filled in by subclasses.
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getSelectionStart()
- */
- public int getSelectionStart() {
- // TODO Auto-generated method stub
- return selectionStart;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getSelectionEnd()
- */
- public int getSelectionEnd()
- {
- return selectionEnd;
- }
-
- /* (non-Javadoc)
- * @see javax.accessibility.AccessibleText#getSelectedText()
- */
- public String getSelectedText()
- {
- if (selectionEnd - selectionStart > 0)
- return text.substring(selectionStart, selectionEnd);
- else
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.TextListener#textValueChanged(java.awt.event.TextEvent)
- */
- public void textValueChanged(TextEvent event)
- {
- // TODO Auto-generated method stub
-
- }
-
- }
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-TextComponent(String text)
-{
- this.text = text;
- this.editable = true;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the text in this component
- *
- * @return The text in this component.
- */
-public synchronized String
-getText()
-{
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- text = tcp.getText();
-
- return(text);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the text in this component to the specified string.
- *
- * @param text The new text for this component.
- */
-public synchronized void
-setText(String text)
-{
- if (text == null)
- text = "";
-
- this.text = text;
-
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- tcp.setText(text);
- setCaretPosition(0);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string that contains the text that is currently selected.
- *
- * @return The currently selected text region.
- */
-public synchronized String
-getSelectedText()
-{
- String alltext = getText();
- int start = getSelectionStart();
- int end = getSelectionEnd();
-
- return(alltext.substring(start, end));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the starting position of the selected text region.
- * If the text is not selected then caret position is returned.
- *
- * @return The starting position of the selected text region.
- */
-public synchronized int
-getSelectionStart()
-{
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- selectionStart = tcp.getSelectionStart();
-
- return(selectionStart);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the starting position of the selected region to the
- * specified value. If the specified value is out of range, then it
- * will be silently changed to the nearest legal value.
- *
- * @param selectionStart The new start position for selected text.
- */
-public synchronized void
-setSelectionStart(int selectionStart)
-{
- select(selectionStart, getSelectionEnd());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the ending position of the selected text region.
- * If the text is not selected, then caret position is returned
- *
- * @return The ending position of the selected text region.
- */
-public synchronized int
-getSelectionEnd()
-{
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- selectionEnd = tcp.getSelectionEnd();
-
- return(selectionEnd);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the ending position of the selected region to the
- * specified value. If the specified value is out of range, then it
- * will be silently changed to the nearest legal value.
- *
- * @param selectionEnd The new start position for selected text.
- */
-public synchronized void
-setSelectionEnd(int selectionEnd)
-{
- select(getSelectionStart(), selectionEnd);
-}
-
-/*************************************************************************/
-
-/**
- * This method sets the selected text range to the text between the
- * specified start and end positions. Illegal values for these
- * positions are silently fixed.
- *
- * @param selectionStart The new start position for the selected text.
- * @param selectionEnd The new end position for the selected text.
- */
-public synchronized void
-select(int selectionStart, int selectionEnd)
-{
- if (selectionStart < 0)
- selectionStart = 0;
-
- if (selectionStart > getText().length())
- selectionStart = text.length();
-
- if (selectionEnd > text.length())
- selectionEnd = text.length();
-
- if (selectionStart > getSelectionEnd())
- selectionStart = selectionEnd;
-
- this.selectionStart = selectionStart;
- this.selectionEnd = selectionEnd;
-
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- tcp.select(selectionStart, selectionEnd);
-}
-
-/*************************************************************************/
-
-/**
- * Selects all of the text in the component.
- */
-public synchronized void
-selectAll()
-{
- select(0, getText().length());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the current caret position in the text.
- *
- * @return The caret position in the text.
- */
-public synchronized int
-getCaretPosition()
-{
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- return(tcp.getCaretPosition());
- else
- return(0);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the caret position to the specified value.
- *
- * @param caretPosition The new caret position.
- *
- * @exception IllegalArgumentException If the value supplied for position
- * is less than zero.
- *
- * @since 1.1
- */
-public synchronized void
-setCaretPosition(int caretPosition)
-{
- if (caretPosition < 0)
- throw new IllegalArgumentException ();
-
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- tcp.setCaretPosition(caretPosition);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this component's text can be edited.
- *
- * @return true
if the text can be edited, false
- * otherwise.
- */
-public boolean
-isEditable()
-{
- return(editable);
-}
-
-/*************************************************************************/
-
-/**
- * Sets whether or not this component's text can be edited.
- *
- * @param editable true
to enable editing of the text,
- * false
to disable it.
- */
-public synchronized void
-setEditable(boolean editable)
-{
- this.editable = editable;
-
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- tcp.setEditable(editable);
-}
-
-/*************************************************************************/
-
-/**
- * Notifies the component that it should destroy its native peer.
- */
-public void
-removeNotify()
-{
- super.removeNotify();
-}
-
-/*************************************************************************/
-
-/**
- * Adds a new listener to the list of text listeners for this
- * component.
- *
- * @param listener The listener to be added.
- */
-public synchronized void
-addTextListener(TextListener listener)
-{
- textListener = AWTEventMulticaster.add(textListener, listener);
-
- enableEvents(AWTEvent.TEXT_EVENT_MASK);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified listener from the list of listeners
- * for this component.
- *
- * @param listener The listener to remove.
- */
-public synchronized void
-removeTextListener(TextListener listener)
-{
- textListener = AWTEventMulticaster.remove(textListener, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified event for this component. Text events are
- * processed by calling the processTextEvent()
method.
- * All other events are passed to the superclass method.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof TextEvent)
- processTextEvent((TextEvent)event);
- else
- super.processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified text event by dispatching it to any listeners
- * that are registered. Note that this method will only be called
- * if text event's are enabled. This will be true if there are any
- * registered listeners, or if the event has been specifically
- * enabled using enableEvents()
.
- *
- * @param event The text event to process.
- */
-protected void
-processTextEvent(TextEvent event)
-{
- if (textListener != null)
- textListener.textValueChanged(event);
-}
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= TextEvent.TEXT_LAST
- && e.id >= TextEvent.TEXT_FIRST
- && (textListener != null
- || (eventMask & AWTEvent.TEXT_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debugging string.
- *
- * @return A debugging string.
- */
-protected String
-paramString()
-{
- return(getClass().getName() + "(text=" + getText() + ")");
-}
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this TextComponent
. FooListeners are registered using
- * the addFooListener method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements java.util.EventListener.
- */
- public EventListener[] getListeners (Class listenerType)
- {
- if (listenerType == TextListener.class)
- return AWTEventMulticaster.getListeners (textListener, listenerType);
-
- return super.getListeners (listenerType);
- }
-
- /**
- * Returns all text listeners registered to this object.
- */
- public TextListener[] getTextListeners ()
- {
- return (TextListener[]) getListeners (TextListener.class);
- }
-
- /**
- * Gets the AccessibleContext associated with this TextComponent
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTTextComponent();
- return accessibleContext;
- }
-
-
- /*******************************/
- // Provide AccessibleAWTTextComponent access to several peer functions that
- // aren't publicly exposed. This is package-private to avoid an accessor
- // method.
- synchronized int
- getIndexAtPoint(Point p)
- {
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- return tcp.getIndexAtPoint(p.x, p.y);
- return -1;
- }
-
- synchronized Rectangle
- getCharacterBounds(int i)
- {
- TextComponentPeer tcp = (TextComponentPeer)getPeer();
- if (tcp != null)
- return tcp.getCharacterBounds(i);
- return null;
- }
-
-
-
-
-} // class TextComponent
-
diff --git a/libjava/java/awt/TextField.java b/libjava/java/awt/TextField.java
deleted file mode 100644
index 4d62d024aad..00000000000
--- a/libjava/java/awt/TextField.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/* TextField.java -- A one line text entry field
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.peer.ComponentPeer;
-import java.awt.peer.TextFieldPeer;
-import java.util.EventListener;
-
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleStateSet;
-
-/**
- * This class implements a single line text entry field widget
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class TextField extends TextComponent
-{
-
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = -2966288784432217853L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial The number of columns in the text entry field.
- */
-private int columns;
-
-/**
- * @serial The character that is echoed when doing protected input
- */
-private char echoChar;
-
-// List of registered ActionListener's for this object.
-private ActionListener action_listeners;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of TextField
that is empty
- * and has one column.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- */
-public
-TextField()
-{
- this("", 1);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of TextField
containing
- * the specified text. The number of columns will be equal to the
- * length of the text string.
- *
- * @param text The text to display in the field.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- */
-public
-TextField(String text)
-{
- this(text, text.length());
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of TextField
that is empty
- * and has the specified number of columns.
- *
- * @param columns The number of columns in the text field.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- */
-public
-TextField(int columns)
-{
- this("", columns);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of TextField
with the
- * specified text and number of columns.
- *
- * @param text The text to display in the field.
- * @param columns The number of columns in the field.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true,
- */
-public
-TextField(String text, int columns)
-{
- super(text);
- this.columns = columns;
-
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * Returns the number of columns in the field.
- *
- * @return The number of columns in the field.
- */
-public int
-getColumns()
-{
- return(columns);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the number of columns in this field to the specified value.
- *
- * @param columns The new number of columns in the field.
- *
- * @exception IllegalArgumentException If columns is less than zero.
- */
-public synchronized void
-setColumns(int columns)
-{
- if (columns < 0)
- throw new IllegalArgumentException("Value is less than zero: " +
- columns);
-
- this.columns = columns;
- // FIXME: How to we communicate this to our peer?
-}
-
-/*************************************************************************/
-
-/**
- * Returns the character that is echoed to the screen when a text
- * field is protected (such as when a password is being entered).
- *
- * @return The echo character for this text field.
- */
-public char
-getEchoChar()
-{
- return(echoChar);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the character that is echoed when protected input such as
- * a password is displayed.
- *
- * @param echoChar The new echo character.
- */
-public void
-setEchoChar(char echoChar)
-{
- setEchoCharacter (echoChar);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the character that is echoed when protected input such as
- * a password is displayed.
- *
- * @param echoChar The new echo character.
- *
- * @deprecated This method is deprecated in favor of
- * setEchoChar()
- */
-public void
-setEchoCharacter(char echoChar)
-{
- this.echoChar = echoChar;
-
- TextFieldPeer peer = (TextFieldPeer) getPeer ();
- if (peer != null)
- peer.setEchoChar (echoChar);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this text field has an echo character set
- * so that characters the user type are not echoed to the screen.
- *
- * @return true
if an echo character is set,
- * false
otherwise.
- */
-public boolean
-echoCharIsSet()
-{
- if (echoChar == '\u0000')
- return(false);
- else
- return(true);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size for this text field.
- *
- * @return The minimum size for this text field.
- */
-public Dimension
-getMinimumSize()
-{
- return getMinimumSize (getColumns ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size of a text field with the specified number
- * of columns.
- *
- * @param columns The number of columns to get the minimum size for.
- */
-public Dimension
-getMinimumSize(int columns)
-{
- return minimumSize (columns);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size for this text field.
- *
- * @return The minimum size for this text field.
- *
- * @deprecated This method is deprecated in favor of
- * getMinimumSize()
.
- */
-public Dimension
-minimumSize()
-{
- return minimumSize (getColumns ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the minimum size of a text field with the specified number
- * of columns.
- *
- * @param columns The number of columns to get the minimum size for.
- *
- * @deprecated This method is deprecated in favor of
- * getMinimumSize(int)
.
- */
-public Dimension
-minimumSize(int columns)
-{
- TextFieldPeer peer = (TextFieldPeer) getPeer ();
- if (peer == null)
- return null; // FIXME: What do we do if there is no peer?
-
- return peer.getMinimumSize (columns);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size for this text field.
- *
- * @return The preferred size for this text field.
- */
-public Dimension
-getPreferredSize()
-{
- return getPreferredSize (getColumns ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size of a text field with the specified number
- * of columns.
- *
- * @param columns The number of columns to get the preferred size for.
- */
-public Dimension
-getPreferredSize(int columns)
-{
- return preferredSize (columns);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size for this text field.
- *
- * @return The preferred size for this text field.
- *
- * @deprecated This method is deprecated in favor of
- * getPreferredSize()
.
- */
-public Dimension
-preferredSize()
-{
- return preferredSize (getColumns ());
-}
-
-/*************************************************************************/
-
-/**
- * Returns the preferred size of a text field with the specified number
- * of columns.
- *
- * @param columns The number of columns to get the preferred size for.
- *
- * @deprecated This method is deprecated in favor of
- * getPreferredSize(int)
.
- */
-public Dimension
-preferredSize(int columns)
-{
- TextFieldPeer peer = (TextFieldPeer) getPeer ();
- if (peer == null)
- return new Dimension (0, 0);
-
- return peer.getPreferredSize (columns);
-}
-
-/*************************************************************************/
-
-/**
- * Notifies this object that it should create its native peer.
- */
-public void
-addNotify()
-{
- if (getPeer() != null)
- return;
-
- setPeer((ComponentPeer)getToolkit().createTextField(this));
-}
-
-/*************************************************************************/
-
-/**
- * Addes a new listener to the list of action listeners for this
- * object.
- *
- * @param listener The listener to add to the list.
- */
-public synchronized void
-addActionListener(ActionListener listener)
-{
- action_listeners = AWTEventMulticaster.add(action_listeners, listener);
-
- enableEvents(AWTEvent.ACTION_EVENT_MASK);
-}
-
-/*************************************************************************/
-
-/**
- * Removes the specified listener from the list of action listeners
- * for this object.
- *
- * @param listener The listener to remove from the list.
- */
-public synchronized void
-removeActionListener(ActionListener listener)
-{
- action_listeners = AWTEventMulticaster.remove(action_listeners, listener);
-}
-
-/*************************************************************************/
-
-/**
- * Processes the specified event. If the event is an instance of
- * ActionEvent
then processActionEvent()
is
- * called to process it, otherwise the event is sent to the
- * superclass.
- *
- * @param event The event to process.
- */
-protected void
-processEvent(AWTEvent event)
-{
- if (event instanceof ActionEvent)
- processActionEvent((ActionEvent)event);
- else
- super.processEvent(event);
-}
-
-/*************************************************************************/
-
-/**
- * Processes an action event by calling any registered listeners.
- * Note to subclasses: This method is not called unless action events
- * are enabled on this object. This will be true if any listeners
- * are registered, or if action events were specifically enabled
- * using enableEvents()
.
- *
- * @param event The event to process.
- */
-protected void
-processActionEvent(ActionEvent event)
-{
- if (action_listeners != null)
- action_listeners.actionPerformed(event);
-}
-
-void
-dispatchEventImpl(AWTEvent e)
-{
- if (e.id <= ActionEvent.ACTION_LAST
- && e.id >= ActionEvent.ACTION_FIRST
- && (action_listeners != null
- || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a debug string for this object.
- *
- * @return A debug string for this object.
- */
-protected String
-paramString()
-{
- return(getClass().getName() + "(columns=" + getColumns() + ",echoChar=" +
- getEchoChar());
-}
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this TextField
. FooListeners are registered using the
- * addFooListener method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements java.util.EventListener.
- *
- * @since 1.3
- */
- public EventListener[] getListeners (Class listenerType)
- {
- if (listenerType == ActionListener.class)
- return AWTEventMulticaster.getListeners (action_listeners, listenerType);
-
- return super.getListeners (listenerType);
- }
-
- /**
- * Return all ActionListeners register to this TextField
object
- * as an array.
- *
- * @since 1.4
- */
- public ActionListener[] getActionListeners ()
- {
- return (ActionListener[]) getListeners (ActionListener.class);
- }
-
- protected class AccessibleAWTTextField extends AccessibleAWTTextComponent
- {
- protected AccessibleAWTTextField()
- {
- }
-
- public AccessibleStateSet getAccessibleStateSet()
- {
- return super.getAccessibleStateSet();
- }
- }
-
- public AccessibleContext getAccessibleContext()
- {
- return new AccessibleAWTTextField();
- }
-
-} // class TextField
diff --git a/libjava/java/awt/TexturePaint.java b/libjava/java/awt/TexturePaint.java
deleted file mode 100644
index a12e38463f1..00000000000
--- a/libjava/java/awt/TexturePaint.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* TexturePaint.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.awt.image.ColorModel;
-
-/** STUB CLASS ONLY */
-public class TexturePaint implements Paint
-{
- private final BufferedImage texture;
- private final Rectangle2D anchor;
- public TexturePaint(BufferedImage texture, Rectangle2D anchor)
- {
- this.texture = texture;
- this.anchor = anchor;
- }
- public BufferedImage getImage()
- {
- return texture;
- }
- public Rectangle2D getAnchorRect()
- {
- return anchor;
- }
- public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
- Rectangle2D userBounds,
- AffineTransform xform,
- RenderingHints hints)
- {
- throw new Error("not implemented");
- }
- public int getTransparency()
- {
- throw new Error("not implemented");
- }
-} // class TexturePaint
diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java
deleted file mode 100644
index c7c6f9f0ecb..00000000000
--- a/libjava/java/awt/Toolkit.java
+++ /dev/null
@@ -1,995 +0,0 @@
-/* Toolkit.java -- AWT Toolkit superclass
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt;
-
-import java.awt.datatransfer.Clipboard;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.DragGestureListener;
-import java.awt.dnd.DragGestureRecognizer;
-import java.awt.dnd.DragSource;
-import java.awt.dnd.peer.DragSourceContextPeer;
-import java.awt.event.AWTEventListener;
-import java.awt.event.KeyEvent;
-import java.awt.im.InputMethodHighlight;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.peer.ButtonPeer;
-import java.awt.peer.CanvasPeer;
-import java.awt.peer.CheckboxMenuItemPeer;
-import java.awt.peer.CheckboxPeer;
-import java.awt.peer.ChoicePeer;
-import java.awt.peer.DialogPeer;
-import java.awt.peer.FileDialogPeer;
-import java.awt.peer.FontPeer;
-import java.awt.peer.FramePeer;
-import java.awt.peer.LabelPeer;
-import java.awt.peer.LightweightPeer;
-import java.awt.peer.ListPeer;
-import java.awt.peer.MenuBarPeer;
-import java.awt.peer.MenuItemPeer;
-import java.awt.peer.MenuPeer;
-import java.awt.peer.PanelPeer;
-import java.awt.peer.PopupMenuPeer;
-import java.awt.peer.ScrollPanePeer;
-import java.awt.peer.ScrollbarPeer;
-import java.awt.peer.TextAreaPeer;
-import java.awt.peer.TextFieldPeer;
-import java.awt.peer.WindowPeer;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * The AWT system uses a set of native peer objects to implement its
- * widgets. These peers are provided by a peer toolkit, that is accessed
- * via a subclass of this superclass. The system toolkit is retrieved
- * by the static methods getDefaultToolkit
. This method
- * determines the system toolkit by examining the system property
- * awt.toolkit
. That property is set to the name of the
- * Toolkit
subclass for the specified peer set. If the
- * awt.toolkit
property is not set, then the default
- * toolkit gnu.java.awt.peer.gtk.GtkToolkit
is used. This
- * toolkit creates its peers using the GTK+ toolkit.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public abstract class Toolkit
-{
- /** The default toolkit name. */
- private static String default_toolkit_name
- = gnu.classpath.Configuration.default_awt_peer_toolkit;
-
- /**
- * The toolkit in use. Once we load it, we don't ever change it
- * if the awt.toolkit property is set.
- */
- private static Toolkit toolkit;
-
- /** The toolkit properties. */
- private static Properties props = new Properties();
-
- protected final Map desktopProperties = new Properties();
-
- protected final PropertyChangeSupport desktopPropsSupport
- = new PropertyChangeSupport(this);
-
- /**
- * Default constructor for subclasses.
- */
- public Toolkit()
- {
- }
-
- /**
- * Creates a peer object for the specified Button
.
- *
- * @param target The Button
to create the peer for.
- *
- * @return The peer for the specified Button
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ButtonPeer createButton(Button target);
-
- /**
- * Creates a peer object for the specified TextField
.
- *
- * @param target The TextField
to create the peer for.
- *
- * @return The peer for the specified TextField
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract TextFieldPeer createTextField(TextField target);
-
- /**
- * Creates a peer object for the specified Label
.
- *
- * @param target The Label
to create the peer for.
- *
- * @return The peer for the specified Label
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract LabelPeer createLabel(Label target);
-
- /**
- * Creates a peer object for the specified List
.
- *
- * @param target The List
to create the peer for.
- *
- * @return The peer for the specified List
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ListPeer createList(List target);
-
- /**
- * Creates a peer object for the specified Checkbox
.
- *
- * @param target The Checkbox
to create the peer for.
- *
- * @return The peer for the specified Checkbox
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract CheckboxPeer createCheckbox(Checkbox target);
-
- /**
- * Creates a peer object for the specified Scrollbar
.
- *
- * @param target The Scrollbar
to create the peer for.
- *
- * @return The peer for the specified Scrollbar
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ScrollbarPeer createScrollbar(Scrollbar target);
-
- /**
- * Creates a peer object for the specified ScrollPane
.
- *
- * @param target The ScrollPane
to create the peer for.
- *
- * @return The peer for the specified ScrollPane
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ScrollPanePeer createScrollPane(ScrollPane target);
-
- /**
- * Creates a peer object for the specified TextArea
.
- *
- * @param target The TextArea
to create the peer for.
- *
- * @return The peer for the specified TextArea
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract TextAreaPeer createTextArea(TextArea target);
-
- /**
- * Creates a peer object for the specified Choice
.
- *
- * @param target The Choice
to create the peer for.
- *
- * @return The peer for the specified Choice
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract ChoicePeer createChoice(Choice target);
-
- /**
- * Creates a peer object for the specified Frame
.
- *
- * @param target The Frame
to create the peer for.
- *
- * @return The peer for the specified Frame
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract FramePeer createFrame(Frame target);
-
- /**
- * Creates a peer object for the specified Canvas
.
- *
- * @param target The Canvas
to create the peer for.
- *
- * @return The peer for the specified Canvas
object.
- */
- protected abstract CanvasPeer createCanvas(Canvas target);
-
- /**
- * Creates a peer object for the specified Panel
.
- *
- * @param target The Panel
to create the peer for.
- *
- * @return The peer for the specified Panel
object.
- */
- protected abstract PanelPeer createPanel(Panel target);
-
- /**
- * Creates a peer object for the specified Window
.
- *
- * @param target The Window
to create the peer for.
- *
- * @return The peer for the specified Window
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract WindowPeer createWindow(Window target);
-
- /**
- * Creates a peer object for the specified Dialog
.
- *
- * @param target The dialog to create the peer for
- *
- * @return The peer for the specified font name.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract DialogPeer createDialog(Dialog target);
-
- /**
- * Creates a peer object for the specified MenuBar
.
- *
- * @param target The MenuBar
to create the peer for.
- *
- * @return The peer for the specified MenuBar
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract MenuBarPeer createMenuBar(MenuBar target);
-
- /**
- * Creates a peer object for the specified Menu
.
- *
- * @param target The Menu
to create the peer for.
- *
- * @return The peer for the specified Menu
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract MenuPeer createMenu(Menu target);
-
- /**
- * Creates a peer object for the specified PopupMenu
.
- *
- * @param target The PopupMenu
to create the peer for.
- *
- * @return The peer for the specified PopupMenu
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract PopupMenuPeer createPopupMenu(PopupMenu target);
-
- /**
- * Creates a peer object for the specified MenuItem
.
- *
- * @param target The MenuItem
to create the peer for.
- *
- * @return The peer for the specified MenuItem
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract MenuItemPeer createMenuItem(MenuItem target);
-
- /**
- * Creates a peer object for the specified FileDialog
.
- *
- * @param target The FileDialog
to create the peer for.
- *
- * @return The peer for the specified FileDialog
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract FileDialogPeer createFileDialog(FileDialog target);
-
- /**
- * Creates a peer object for the specified CheckboxMenuItem
.
- *
- * @param target The CheckboxMenuItem
to create the peer for.
- *
- * @return The peer for the specified CheckboxMenuItem
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected abstract CheckboxMenuItemPeer
- createCheckboxMenuItem(CheckboxMenuItem target);
-
- /**
- * Creates a peer object for the specified Component
. The
- * peer returned by this method is not a native windowing system peer
- * with its own native window. Instead, this method allows the component
- * to draw on its parent window as a "lightweight" widget.
- *
- * @param target The Component
to create the peer for.
- *
- * @return The peer for the specified Component
object.
- */
- protected LightweightPeer createComponent(Component target)
- {
- return new gnu.java.awt.peer.GLightweightPeer (target);
- }
-
- /**
- * Creates a peer object for the specified font name.
- *
- * @param name The font to create the peer for.
- * @param style The font style to create the peer for.
- *
- * @return The peer for the specified font name.
- *
- * @deprecated
- */
- protected abstract FontPeer getFontPeer(String name, int style);
-
- /**
- * Copies the current system colors into the specified array. This is
- * the interface used by the SystemColor
class. Although
- * this method fills in the array with some default colors a real Toolkit
- * should override this method and provide real system colors for the
- * native GUI platform.
- *
- * @param systemColors The array to copy the system colors into.
- * It must be at least 26 elements.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- *
- * @see java.awt.SystemColor
- */
- protected void loadSystemColors(int systemColors[])
- {
- systemColors[SystemColor.DESKTOP] = 0xFF005C5C;
- systemColors[SystemColor.ACTIVE_CAPTION] = 0xFF000080;
- systemColors[SystemColor.ACTIVE_CAPTION_TEXT] = 0xFFFFFFFF;
- systemColors[SystemColor.ACTIVE_CAPTION_BORDER] = 0xFFC0C0C0;
- systemColors[SystemColor.INACTIVE_CAPTION] = 0xFF808080;
- systemColors[SystemColor.INACTIVE_CAPTION_TEXT] = 0xFFC0C0C0;
- systemColors[SystemColor.INACTIVE_CAPTION_BORDER] = 0xFFC0C0C0;
- systemColors[SystemColor.WINDOW] = 0xFFFFFFFF;
- systemColors[SystemColor.WINDOW_BORDER] = 0xFF000000;
- systemColors[SystemColor.WINDOW_TEXT] = 0xFF000000;
- systemColors[SystemColor.MENU] = 0xFFC0C0C0;
- systemColors[SystemColor.MENU_TEXT] = 0xFF000000;
- systemColors[SystemColor.TEXT] = 0xFFC0C0C0;
- systemColors[SystemColor.TEXT_TEXT] = 0xFF000000;
- systemColors[SystemColor.TEXT_HIGHLIGHT] = 0xFF000090;
- systemColors[SystemColor.TEXT_HIGHLIGHT_TEXT] = 0xFFFFFFFF;
- systemColors[SystemColor.TEXT_INACTIVE_TEXT] = 0xFF808080;
- systemColors[SystemColor.CONTROL] = 0xFFC0C0C0;
- systemColors[SystemColor.CONTROL_TEXT] = 0xFF000000;
- systemColors[SystemColor.CONTROL_HIGHLIGHT] = 0xFFFFFFFF;
- systemColors[SystemColor.CONTROL_LT_HIGHLIGHT] = 0xFFE0E0E0;
- systemColors[SystemColor.CONTROL_SHADOW] = 0xFF808080;
- systemColors[SystemColor.CONTROL_DK_SHADOW] = 0xFF000000;
- systemColors[SystemColor.SCROLLBAR] = 0xFFE0E0E0;
- systemColors[SystemColor.INFO] = 0xFFE0E000;
- systemColors[SystemColor.INFO_TEXT] = 0xFF000000;
- }
-
- /**
- * @since 1.4
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public void setDynamicLayout(boolean dynamic)
- {
- }
-
- /**
- * @since 1.4
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- protected boolean isDynamicLayoutSet()
- {
- return false;
- }
-
- /**
- * @since 1.4
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public boolean isDynamicLayoutActive()
- {
- return false;
- }
-
- /**
- * Returns the dimensions of the screen in pixels.
- *
- * @return The dimensions of the screen in pixels.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract Dimension getScreenSize();
-
- /**
- * Returns the screen resolution in dots per square inch.
- *
- * @return The screen resolution in dots per square inch.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract int getScreenResolution();
-
- /**
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- *
- * @since 1.4
- */
- public Insets getScreenInsets(GraphicsConfiguration gc)
- {
- return null;
- }
-
- /**
- * Returns the color model of the screen.
- *
- * @return The color model of the screen.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract ColorModel getColorModel();
-
- /**
- * Returns the names of the available fonts.
- *
- * @return The names of the available fonts.
- *
- * @deprecated
- */
- public abstract String[] getFontList();
-
- /**
- * Return the font metrics for the specified font
- *
- * @param name The name of the font to return metrics for.
- *
- * @return The requested font metrics.
- *
- * @deprecated
- */
- public abstract FontMetrics getFontMetrics(Font name);
-
- /**
- * Flushes any buffered data to the screen so that it is in sync with
- * what the AWT system has drawn to it.
- */
- public abstract void sync();
-
- /**
- * Returns an instance of the default toolkit. The default toolkit is
- * the subclass of Toolkit
specified in the system property
- * awt.toolkit
, or gnu.java.awt.peer.gtk.GtkToolkit
- * if the property is not set.
- *
- * @return An instance of the system default toolkit.
- *
- * @throws AWTError If the toolkit cannot be loaded.
- */
- public static Toolkit getDefaultToolkit()
- {
- if (toolkit != null)
- return toolkit;
- String toolkit_name = System.getProperty("awt.toolkit",
- default_toolkit_name);
- try
- {
- Class cls = Class.forName(toolkit_name);
- Object obj = cls.newInstance();
- if (!(obj instanceof Toolkit))
- throw new AWTError(toolkit_name + " is not a subclass of " +
- "java.awt.Toolkit");
- toolkit = (Toolkit) obj;
- return toolkit;
- }
- catch (ThreadDeath death)
- {
- throw death;
- }
- catch (Throwable t)
- {
- AWTError e = new AWTError("Cannot load AWT toolkit: " + toolkit_name);
- throw (AWTError) e.initCause(t);
- }
- }
-
- /**
- * Returns an image from the specified file, which must be in a
- * recognized format. Supported formats vary from toolkit to toolkit.
- *
- * @return name The name of the file to read the image from.
- */
- public abstract Image getImage(String name);
-
- /**
- * Returns an image from the specified URL, which must be in a
- * recognized format. Supported formats vary from toolkit to toolkit.
- *
- * @return url The URl to read the image from.
- */
- public abstract Image getImage(URL url);
-
- public abstract Image createImage(String filename);
-
- public abstract Image createImage(URL url);
-
- /**
- * Readies an image to be rendered on the screen. The width and height
- * values can be set to the default sizes for the image by passing -1
- * in those parameters.
- *
- * @param image The image to prepare for rendering.
- * @param width The width of the image.
- * @param height The height of the image.
- * @param observer The observer to receive events about the preparation
- * process.
- *
- * @return true
if the image is already prepared for rendering,
- * false
otherwise.
- */
- public abstract boolean prepareImage(Image image, int width, int height,
- ImageObserver observer);
-
- /**
- * Checks the status of specified image as it is being readied for
- * rendering.
- *
- * @param image The image to prepare for rendering.
- * @param width The width of the image.
- * @param height The height of the image.
- * @param observer The observer to receive events about the preparation
- * process.
- *
- * @return A union of the bitmasks from
- * java.awt.image.ImageObserver
that indicates the current
- * state of the imaging readying process.
- */
- public abstract int checkImage(Image image, int width, int height,
- ImageObserver observer);
-
- /**
- * Creates an image using the specified ImageProducer
- *
- * @param producer The ImageProducer
to create the image from.
- *
- * @return The created image.
- */
- public abstract Image createImage(ImageProducer producer);
-
- /**
- * Creates an image from the specified byte array. The array must be in
- * a recognized format. Supported formats vary from toolkit to toolkit.
- *
- * @param data The raw image data.
- *
- * @return The created image.
- */
- public Image createImage(byte[] data)
- {
- return createImage(data, 0, data.length);
- }
-
- /**
- * Creates an image from the specified portion of the byte array passed.
- * The array must be in a recognized format. Supported formats vary from
- * toolkit to toolkit.
- *
- * @param data The raw image data.
- * @param offset The offset into the data where the image data starts.
- * @param len The length of the image data.
- *
- * @return The created image.
- */
- public abstract Image createImage(byte[] data, int offset, int len);
-
- /**
- * Returns a instance of PrintJob
for the specified
- * arguments.
- *
- * @param frame The window initiating the print job.
- * @param title The print job title.
- * @param props The print job properties.
- *
- * @return The requested print job, or null
if the job
- * was cancelled.
- *
- * @exception NullPointerException If frame is null,
- * or GraphicsEnvironment.isHeadless() returns true.
- * @exception SecurityException If this thread is not allowed to initiate
- * a print job request.
- */
- public abstract PrintJob getPrintJob(Frame frame, String title,
- Properties props);
-
- /**
- * Returns a instance of PrintJob
for the specified
- * arguments.
- *
- * @param frame The window initiating the print job.
- * @param title The print job title.
- * @param jobAttr A set of job attributes which will control the print job.
- * @param pageAttr A set of page attributes which will control the print job.
- *
- * @exception NullPointerException If frame is null, and either jobAttr is null
- * or jobAttr.getDialog() returns JobAttributes.DialogType.NATIVE.
- * @exception IllegalArgumentException If pageAttrspecifies differing cross
- * feed and feed resolutions, or when GraphicsEnvironment.isHeadless() returns
- * true.
- * @exception SecurityException If this thread is not allowed to initiate
- * a print job request.
- *
- * @since 1.3
- */
- public PrintJob getPrintJob(Frame frame, String title,
- JobAttributes jobAttr, PageAttributes pageAttr)
- {
- return null;
- }
-
- /**
- * Causes a "beep" tone to be generated.
- */
- public abstract void beep();
-
- /**
- * Returns the system clipboard.
- *
- * @return THe system clipboard.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public abstract Clipboard getSystemClipboard();
-
- /**
- * Gets the singleton instance of the system selection as a Clipboard object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- *
- * @since 1.4
- */
- public Clipboard getSystemSelection()
- {
- return null;
- }
-
- /**
- * Returns the accelerator key mask for menu shortcuts. The default is
- * Event.CTRL_MASK
. A toolkit must override this method
- * to change the default.
- *
- * @return The key mask for the menu accelerator key.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public int getMenuShortcutKeyMask()
- {
- return Event.CTRL_MASK;
- }
-
- /**
- * Returns whether the given locking key on the keyboard is currently in its
- * "on" state.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- * @exception IllegalArgumentException If keyCode is not one of the valid keys.
- * @exception UnsupportedOperationException If the host system doesn't allow
- * getting the state of this key programmatically, or if the keyboard doesn't
- * have this key.
- */
- public boolean getLockingKeyState(int keyCode)
- {
- if (keyCode != KeyEvent.VK_CAPS_LOCK
- && keyCode != KeyEvent.VK_NUM_LOCK
- && keyCode != KeyEvent.VK_SCROLL_LOCK)
- throw new IllegalArgumentException();
-
- throw new UnsupportedOperationException();
- }
-
- /**
- * Sets the state of the given locking key on the keyboard.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- * @exception IllegalArgumentException If keyCode is not one of the valid keys.
- * @exception UnsupportedOperationException If the host system doesn't allow
- * getting the state of this key programmatically, or if the keyboard doesn't
- * have this key.
- */
- public void setLockingKeyState(int keyCode, boolean on)
- {
- if (keyCode != KeyEvent.VK_CAPS_LOCK
- && keyCode != KeyEvent.VK_NUM_LOCK
- && keyCode != KeyEvent.VK_SCROLL_LOCK)
- throw new IllegalArgumentException();
-
- throw new UnsupportedOperationException();
- }
-
- /**
- * Returns the native container object of the specified component. This
- * method is necessary because the parent component might be a lightweight
- * component.
- *
- * @param component The component to fetch the native container for.
- *
- * @return The native container object for this component.
- */
- protected static Container getNativeContainer(Component component)
- {
- component = component.getParent();
- while (true)
- {
- if (component == null)
- return null;
- if (! (component instanceof Container))
- {
- component = component.getParent();
- continue;
- }
- if (component.getPeer() instanceof LightweightPeer)
- {
- component = component.getParent();
- continue;
- }
- return (Container) component;
- }
- }
-
- /**
- * Creates a new custom cursor object.
- *
- * @exception IndexOutOfBoundsException If the hotSpot values are outside
- * the bounds of the cursor.
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
- {
- // Presumably the only reason this isn't abstract is for backwards
- // compatibility? FIXME?
- return null;
- }
-
- /**
- * Returns the supported cursor dimension which is closest to the
- * desired sizes.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
- {
- return new Dimension (0,0);
- }
-
- /**
- * Returns the maximum number of colors the Toolkit supports in a custom
- * cursor palette.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public int getMaximumCursorColors()
- {
- return 0;
- }
-
- /**
- * Returns whether Toolkit supports this state for Frames.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- *
- * @since 1.4
- */
- public boolean isFrameStateSupported(int state)
- {
- return false;
- }
-
- /**
- * Returns the value of the property with the specified name, or the
- * default value if the property does not exist.
- *
- * @param key The name of the property to retrieve.
- * @param def The default value of the property.
- */
- public static String getProperty(String key, String def)
- {
- return props.getProperty(key, def);
- }
-
-
- /**
- * Returns the event queue that is suitable for the calling context.
- *
- * Window
with the specified
- * parent. The window will initially be invisible.
- *
- * @param owner The owning Frame
of this window.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null; this exception is always
- * thrown when GraphicsEnvironment.isHeadless returns true.
- */
- public Window(Frame owner)
- {
- this (owner, owner.getGraphicsConfiguration ());
- }
-
- /**
- * Initializes a new instance of Window
with the specified
- * parent. The window will initially be invisible.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null; this exception is always
- * thrown when GraphicsEnvironment.isHeadless returns true.
- *
- * @since 1.2
- */
- public Window(Window owner)
- {
- this (owner, owner.getGraphicsConfiguration ());
- }
-
- /**
- * Initializes a new instance of Window
with the specified
- * parent. The window will initially be invisible.
- *
- * @exception IllegalArgumentException If owner is null or if gc is not from a
- * screen device; this exception is always thrown when
- * GraphicsEnvironment.isHeadless returns true.
- *
- * @since 1.3
- */
- 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;
- }
-
- GraphicsConfiguration getGraphicsConfigurationImpl()
- {
- if (graphicsConfiguration != null)
- return graphicsConfiguration;
-
- return super.getGraphicsConfigurationImpl();
- }
-
- /**
- * Creates the native peer for this window.
- */
- public void addNotify()
- {
- if (peer == null)
- peer = getToolkit().createWindow(this);
- super.addNotify();
- }
-
- /**
- * Relays out this window's child components at their preferred size.
- *
- * @specnote pack() doesn't appear to be called internally by show(), so
- * we duplicate some of the functionality.
- */
- public void pack()
- {
- if (parent != null && !parent.isDisplayable())
- parent.addNotify();
- if (peer == null)
- addNotify();
-
- setSize(getPreferredSize());
-
- validate();
- }
-
- /**
- * Shows on-screen this window and any of its owned windows for whom
- * isVisible returns true.
- */
- public void show()
- {
- if (parent != null && !parent.isDisplayable())
- parent.addNotify();
- if (peer == null)
- addNotify();
-
- // Show visible owned windows.
- synchronized (getTreeLock())
- {
- Iterator e = ownedWindows.iterator();
- while(e.hasNext())
- {
- Window w = (Window)(((Reference) e.next()).get());
- if (w != null)
- {
- if (w.isVisible())
- w.getPeer().setVisible(true);
- }
- else
- // Remove null weak reference from ownedWindows.
- // Unfortunately this can't be done in the Window's
- // finalize method because there is no way to guarantee
- // synchronous access to ownedWindows there.
- e.remove();
- }
- }
- validate();
- super.show();
- toFront();
-
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
- manager.setGlobalFocusedWindow (this);
-
- if (!shown)
- {
- FocusTraversalPolicy policy = getFocusTraversalPolicy ();
- Component initialFocusOwner = null;
-
- if (policy != null)
- initialFocusOwner = policy.getInitialComponent (this);
-
- if (initialFocusOwner != null)
- initialFocusOwner.requestFocusInWindow ();
-
- shown = true;
- }
- }
-
- public void hide()
- {
- // Hide visible owned windows.
- synchronized (getTreeLock ())
- {
- Iterator e = ownedWindows.iterator();
- while(e.hasNext())
- {
- Window w = (Window)(((Reference) e.next()).get());
- if (w != null)
- {
- if (w.isVisible() && w.getPeer() != null)
- w.getPeer().setVisible(false);
- }
- else
- e.remove();
- }
- }
- super.hide();
- }
-
- public boolean isDisplayable()
- {
- if (super.isDisplayable())
- return true;
- return peer != null;
- }
-
- /**
- * Destroys any resources associated with this window. This includes
- * all components in the window and all owned top-level windows.
- */
- public void dispose()
- {
- hide();
-
- synchronized (getTreeLock ())
- {
- Iterator e = ownedWindows.iterator();
- while(e.hasNext())
- {
- Window w = (Window)(((Reference) e.next()).get());
- if (w != null)
- w.dispose();
- else
- // Remove null weak reference from ownedWindows.
- e.remove();
- }
-
- for (int i = 0; i < ncomponents; ++i)
- component[i].removeNotify();
- this.removeNotify();
-
- // Post a WINDOW_CLOSED event.
- WindowEvent we = new WindowEvent(this, WindowEvent.WINDOW_CLOSED);
- getToolkit().getSystemEventQueue().postEvent(we);
- }
- }
-
- /**
- * Sends this window to the back so that all other windows display in
- * front of it.
- */
- public void toBack()
- {
- if (peer != null)
- {
- WindowPeer wp = (WindowPeer) peer;
- wp.toBack();
- }
- }
-
- /**
- * Brings this window to the front so that it displays in front of
- * any other windows.
- */
- public void toFront()
- {
- if (peer != null)
- {
- WindowPeer wp = (WindowPeer) peer;
- wp.toFront();
- }
- }
-
- /**
- * Returns the toolkit used to create this window.
- *
- * @return The toolkit used to create this window.
- *
- * @specnote Unlike Component.getToolkit, this implementation always
- * returns the value of Toolkit.getDefaultToolkit().
- */
- public Toolkit getToolkit()
- {
- return Toolkit.getDefaultToolkit();
- }
-
- /**
- * Returns the warning string that will be displayed if this window is
- * popped up by an unsecure applet or application.
- *
- * @return The unsecure window warning message.
- */
- public final String getWarningString()
- {
- return warningString;
- }
-
- /**
- * Returns the locale that this window is configured for.
- *
- * @return The locale this window is configured for.
- */
- public Locale getLocale()
- {
- return locale == null ? Locale.getDefault() : locale;
- }
-
- /*
- /** @since 1.2
- public InputContext getInputContext()
- {
- // FIXME
- }
- */
-
- /**
- * Sets the cursor for this window to the specifiec cursor.
- *
- * @param cursor The new cursor for this window.
- */
- public void setCursor(Cursor cursor)
- {
- super.setCursor(cursor);
- }
-
- public Window getOwner()
- {
- return (Window) parent;
- }
-
- /** @since 1.2 */
- public Window[] getOwnedWindows()
- {
- Window [] trimmedList;
- synchronized (getTreeLock ())
- {
- // Windows with non-null weak references in ownedWindows.
- Window [] validList = new Window [ownedWindows.size()];
-
- Iterator e = ownedWindows.iterator();
- int numValid = 0;
- while (e.hasNext())
- {
- Window w = (Window)(((Reference) e.next()).get());
- if (w != null)
- validList[numValid++] = w;
- else
- // Remove null weak reference from ownedWindows.
- e.remove();
- }
-
- if (numValid != validList.length)
- {
- trimmedList = new Window [numValid];
- System.arraycopy (validList, 0, trimmedList, 0, numValid);
- }
- else
- trimmedList = validList;
- }
- return trimmedList;
- }
-
- /**
- * Adds the specified listener to the list of WindowListeners
- * that will receive events for this window.
- *
- * @param listener The WindowListener
to add.
- */
- public synchronized void addWindowListener(WindowListener listener)
- {
- windowListener = AWTEventMulticaster.add(windowListener, listener);
- }
-
- /**
- * Removes the specified listener from the list of
- * WindowListeners
that will receive events for this window.
- *
- * @param listener The WindowListener
to remove.
- */
- public synchronized void removeWindowListener(WindowListener listener)
- {
- windowListener = AWTEventMulticaster.remove(windowListener, listener);
- }
-
- /**
- * Returns an array of all the window listeners registered on this window.
- *
- * @since 1.4
- */
- public synchronized WindowListener[] getWindowListeners()
- {
- return (WindowListener[])
- AWTEventMulticaster.getListeners(windowListener,
- WindowListener.class);
- }
-
- /**
- * Returns an array of all the window focus listeners registered on this
- * window.
- *
- * @since 1.4
- */
- public synchronized WindowFocusListener[] getWindowFocusListeners()
- {
- return (WindowFocusListener[])
- AWTEventMulticaster.getListeners(windowFocusListener,
- WindowFocusListener.class);
- }
-
- /**
- * Returns an array of all the window state listeners registered on this
- * window.
- *
- * @since 1.4
- */
- public synchronized WindowStateListener[] getWindowStateListeners()
- {
- return (WindowStateListener[])
- AWTEventMulticaster.getListeners(windowStateListener,
- WindowStateListener.class);
- }
-
- /**
- * Adds the specified listener to this window.
- */
- public void addWindowFocusListener (WindowFocusListener wfl)
- {
- windowFocusListener = AWTEventMulticaster.add (windowFocusListener, wfl);
- }
-
- /**
- * Adds the specified listener to this window.
- *
- * @since 1.4
- */
- public void addWindowStateListener (WindowStateListener wsl)
- {
- windowStateListener = AWTEventMulticaster.add (windowStateListener, wsl);
- }
-
- /**
- * Removes the specified listener from this window.
- */
- public void removeWindowFocusListener (WindowFocusListener wfl)
- {
- windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl);
- }
-
- /**
- * Removes the specified listener from this window.
- *
- * @since 1.4
- */
- public void removeWindowStateListener (WindowStateListener wsl)
- {
- windowStateListener = AWTEventMulticaster.remove (windowStateListener, wsl);
- }
-
- /**
- * Returns an array of all the objects currently registered as FooListeners
- * upon this Window. FooListeners are registered using the addFooListener
- * method.
- *
- * @exception ClassCastException If listenerType doesn't specify a class or
- * interface that implements java.util.EventListener.
- *
- * @since 1.3
- */
- public EventListener[] getListeners(Class listenerType)
- {
- if (listenerType == WindowListener.class)
- return getWindowListeners();
- return super.getListeners(listenerType);
- }
-
- void dispatchEventImpl(AWTEvent e)
- {
- // Make use of event id's in order to avoid multiple instanceof tests.
- if (e.id <= WindowEvent.WINDOW_LAST
- && e.id >= WindowEvent.WINDOW_FIRST
- && (windowListener != null
- || windowFocusListener != null
- || windowStateListener != null
- || (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0))
- processEvent(e);
- else
- super.dispatchEventImpl(e);
- }
-
- /**
- * Processes the specified event for this window. If the event is an
- * instance of WindowEvent
, then
- * processWindowEvent()
is called to process the event,
- * otherwise the superclass version of this method is invoked.
- *
- * @param evt The event to process.
- */
- protected void processEvent(AWTEvent evt)
- {
- if (evt instanceof WindowEvent)
- processWindowEvent((WindowEvent) evt);
- else
- super.processEvent(evt);
- }
-
- /**
- * Dispatches this event to any listeners that are listening for
- * WindowEvents
on this window. This method only gets
- * invoked if it is enabled via enableEvents()
or if
- * a listener has been added.
- *
- * @param evt The event to process.
- */
- protected void processWindowEvent(WindowEvent evt)
- {
- int id = evt.getID();
-
- if (id == WindowEvent.WINDOW_GAINED_FOCUS
- || id == WindowEvent.WINDOW_LOST_FOCUS)
- processWindowFocusEvent (evt);
- else if (id == WindowEvent.WINDOW_STATE_CHANGED)
- processWindowStateEvent (evt);
- else
- {
- if (windowListener != null)
- {
- switch (evt.getID())
- {
- case WindowEvent.WINDOW_ACTIVATED:
- windowListener.windowActivated(evt);
- break;
-
- case WindowEvent.WINDOW_CLOSED:
- windowListener.windowClosed(evt);
- break;
-
- case WindowEvent.WINDOW_CLOSING:
- windowListener.windowClosing(evt);
- break;
-
- case WindowEvent.WINDOW_DEACTIVATED:
- windowListener.windowDeactivated(evt);
- break;
-
- case WindowEvent.WINDOW_DEICONIFIED:
- windowListener.windowDeiconified(evt);
- break;
-
- case WindowEvent.WINDOW_ICONIFIED:
- windowListener.windowIconified(evt);
- break;
-
- case WindowEvent.WINDOW_OPENED:
- windowListener.windowOpened(evt);
- break;
-
- default:
- break;
- }
- }
- }
- }
-
- /**
- * Identifies if this window is active. The active window is a Frame or
- * Dialog that has focus or owns the active window.
- *
- * @return true if active, else false.
- * @since 1.4
- */
- public boolean isActive()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
- return manager.getActiveWindow() == this;
- }
-
- /**
- * Identifies if this window is focused. A window is focused if it is the
- * focus owner or it contains the focus owner.
- *
- * @return true if focused, else false.
- * @since 1.4
- */
- public boolean isFocused()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
- return manager.getFocusedWindow() == this;
- }
-
- /**
- * Returns the child window that has focus if this window is active.
- * This method returns null
if this window is not active
- * or no children have focus.
- *
- * @return The component that has focus, or null
if no
- * component has focus.
- */
- public Component getFocusOwner ()
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- Window activeWindow = manager.getActiveWindow ();
-
- // The currently-focused Component belongs to the active Window.
- if (activeWindow == this)
- return manager.getFocusOwner ();
- else
- return windowFocusOwner;
- }
-
- /**
- * Set the focus owner for this window. This method is used to
- * remember which component was focused when this window lost
- * top-level focus, so that when it regains top-level focus the same
- * child component can be refocused.
- *
- * @param windowFocusOwner the component in this window that owns
- * the focus.
- */
- void setFocusOwner (Component windowFocusOwner)
- {
- this.windowFocusOwner = windowFocusOwner;
- }
-
- /**
- * Post a Java 1.0 event to the event queue.
- *
- * @param e The event to post.
- *
- * @deprecated
- */
- public boolean postEvent(Event e)
- {
- return handleEvent (e);
- }
-
- /**
- * Tests whether or not this window is visible on the screen.
- *
- * @return true
if this window is visible, false
- * otherwise.
- */
- public boolean isShowing()
- {
- return super.isShowing();
- }
-
- public void setLocationRelativeTo (Component c)
- {
- if (c == null || !c.isShowing ())
- {
- int x = 0;
- int y = 0;
-
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
- Point center = ge.getCenterPoint ();
- x = center.x - (width / 2);
- y = center.y - (height / 2);
- setLocation (x, y);
- }
- // FIXME: handle case where component is non-null.
- }
-
- /**
- * A BltBufferStrategy for windows.
- */
- private class WindowBltBufferStrategy extends BltBufferStrategy
- {
- /**
- * Creates a block transfer strategy for this window.
- *
- * @param numBuffers the number of buffers in this strategy
- * @param accelerated true if the buffer should be accelerated,
- * false otherwise
- */
- WindowBltBufferStrategy(int numBuffers, boolean accelerated)
- {
- super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(accelerated),
- new ImageCapabilities(accelerated),
- BufferCapabilities.FlipContents.COPIED));
- }
- }
-
- /**
- * A FlipBufferStrategy for windows.
- */
- private class WindowFlipBufferStrategy extends FlipBufferStrategy
- {
- /**
- * Creates a flip buffer strategy for this window.
- *
- * @param numBuffers the number of buffers in this strategy
- *
- * @throws AWTException if the requested number of buffers is not
- * supported
- */
- WindowFlipBufferStrategy(int numBuffers)
- throws AWTException
- {
- super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(true),
- new ImageCapabilities(true),
- BufferCapabilities.FlipContents.COPIED));
- }
- }
-
- /**
- * Creates a buffering strategy that manages how this window is
- * repainted. This method attempts to create the optimum strategy
- * based on the desired number of buffers. Hardware or software
- * acceleration may be used.
- *
- * createBufferStrategy attempts different levels of optimization,
- * but guarantees that some strategy with the requested number of
- * buffers will be created even if it is not optimal. First it
- * attempts to create a page flipping strategy, then an accelerated
- * blitting strategy, then an unaccelerated blitting strategy.
- *
- * Calling this method causes any existing buffer strategy to be
- * destroyed.
- *
- * @param numBuffers the number of buffers in this strategy
- *
- * @throws IllegalArgumentException if requested number of buffers
- * is less than one
- * @throws IllegalStateException if this window is not displayable
- *
- * @since 1.4
- */
- public void createBufferStrategy(int numBuffers)
- {
- if (numBuffers < 1)
- throw new IllegalArgumentException("Window.createBufferStrategy: number"
- + " of buffers is less than one");
-
- if (!isDisplayable())
- throw new IllegalStateException("Window.createBufferStrategy: window is"
- + " not displayable");
-
- // try a flipping strategy
- try
- {
- bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
- return;
- }
- catch (AWTException e)
- {
- }
-
- // try an accelerated blitting strategy
- try
- {
- bufferStrategy = new WindowBltBufferStrategy(numBuffers, true);
- }
- catch (AWTException e)
- {
- }
-
- // fall back to an unaccelerated blitting strategy
- try
- {
- bufferStrategy = new WindowBltBufferStrategy(numBuffers, false);
- }
- catch (AWTException e)
- {
- }
- }
-
- /**
- * Creates a buffering strategy that manages how this window is
- * repainted. This method attempts to create a strategy based on
- * the specified capabilities and throws an exception if the
- * requested strategy is not supported.
- *
- * Calling this method causes any existing buffer strategy to be
- * destroyed.
- *
- * @param numBuffers the number of buffers in this strategy
- * @param caps the requested buffering capabilities
- *
- * @throws AWTException if the requested capabilities are not
- * supported
- * @throws IllegalArgumentException if requested number of buffers
- * is less than one or if caps is null
- *
- * @since 1.4
- */
- public void createBufferStrategy(int numBuffers,
- BufferCapabilities caps)
- {
- if (numBuffers < 1)
- throw new IllegalArgumentException("Window.createBufferStrategy: number"
- + " of buffers is less than one");
-
- if (caps == null)
- throw new IllegalArgumentException("Window.createBufferStrategy:"
- + " capabilities object is null");
-
- // a flipping strategy was requested
- if (caps.isPageFlipping())
- {
- try
- {
- bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
- }
- catch (AWTException e)
- {
- }
- }
- else
- bufferStrategy = new WindowBltBufferStrategy(numBuffers, true);
- }
-
- /**
- * Returns the buffer strategy used by the window.
- *
- * @return the buffer strategy.
- * @since 1.4
- */
- public BufferStrategy getBufferStrategy()
- {
- return bufferStrategy;
- }
-
- /**
- * @since 1.2
- *
- * @deprecated
- */
- public void applyResourceBundle(ResourceBundle rb)
- {
- throw new Error ("Not implemented");
- }
-
- /**
- * @since 1.2
- *
- * @deprecated
- */
- public void applyResourceBundle(String rbName)
- {
- ResourceBundle rb = ResourceBundle.getBundle(rbName, Locale.getDefault(),
- ClassLoader.getSystemClassLoader());
- if (rb != null)
- applyResourceBundle(rb);
- }
-
- /**
- * Gets the AccessibleContext associated with this Window
.
- * The context is created, if necessary.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- /* Create the context if this is the first request */
- if (accessibleContext == null)
- accessibleContext = new AccessibleAWTWindow();
- return accessibleContext;
- }
-
- /**
- * Get graphics configuration. The implementation for Window will
- * not ask any parent containers, since Window is a toplevel
- * window and not actually embedded in the parent component.
- */
- public GraphicsConfiguration getGraphicsConfiguration()
- {
- if (graphicsConfiguration != null) return graphicsConfiguration;
- if (peer != null) return peer.getGraphicsConfiguration();
- return null;
- }
-
- protected void processWindowFocusEvent(WindowEvent event)
- {
- if (windowFocusListener != null)
- {
- switch (event.getID ())
- {
- case WindowEvent.WINDOW_GAINED_FOCUS:
- windowFocusListener.windowGainedFocus (event);
- break;
-
- case WindowEvent.WINDOW_LOST_FOCUS:
- windowFocusListener.windowLostFocus (event);
- break;
-
- default:
- break;
- }
- }
- }
-
- /**
- * @since 1.4
- */
- protected void processWindowStateEvent(WindowEvent event)
- {
- if (windowStateListener != null
- && event.getID () == WindowEvent.WINDOW_STATE_CHANGED)
- windowStateListener.windowStateChanged (event);
- }
-
- /**
- * Returns whether this Window
can get the focus or not.
- *
- * @since 1.4
- */
- public final boolean isFocusableWindow ()
- {
- if (getFocusableWindowState () == false)
- return false;
-
- if (this instanceof Dialog
- || this instanceof Frame)
- return true;
-
- // FIXME: Implement more possible cases for returning true.
-
- return false;
- }
-
- /**
- * Returns the value of the focusableWindowState property.
- *
- * @since 1.4
- */
- public boolean getFocusableWindowState ()
- {
- return focusableWindowState;
- }
-
- /**
- * Sets the value of the focusableWindowState property.
- *
- * @since 1.4
- */
- public void setFocusableWindowState (boolean focusableWindowState)
- {
- this.focusableWindowState = focusableWindowState;
- }
-
- // setBoundsCallback is needed so that when a user moves a window,
- // the Window's location can be updated without calling the peer's
- // setBounds method. When a user moves a window the peer window's
- // location is updated automatically and the windowing system sends
- // a message back to the application informing it of its updated
- // dimensions. We must update the AWT Window class with these new
- // dimensions. But we don't want to call the peer's setBounds
- // method, because the peer's dimensions have already been updated.
- // (Under X, having this method prevents Configure event loops when
- // moving windows: Component.setBounds -> peer.setBounds ->
- // postConfigureEvent -> Component.setBounds -> ... In some cases
- // Configure event loops cause windows to jitter back and forth
- // continuously).
- void setBoundsCallback (int x, int y, int w, int h)
- {
- if (this.x == x && this.y == y && width == w && height == h)
- return;
- invalidate();
- boolean resized = width != w || height != h;
- boolean moved = this.x != x || this.y != y;
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- if (resized && isShowing ())
- {
- ComponentEvent ce =
- new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- if (moved && isShowing ())
- {
- ComponentEvent ce =
- new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED);
- getToolkit().getSystemEventQueue().postEvent(ce);
- }
- }
-
- /**
- * Generate a unique name for this window.
- *
- * @return A unique name for this window.
- */
- String generateName()
- {
- return "win" + getUniqueLong();
- }
-
- private static synchronized long getUniqueLong()
- {
- return next_window_number++;
- }
-}
diff --git a/libjava/java/awt/color/CMMException.java b/libjava/java/awt/color/CMMException.java
deleted file mode 100644
index ab328ec8492..00000000000
--- a/libjava/java/awt/color/CMMException.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* CMMException.java -- error in the native CMM
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.color;
-
-/**
- * Thrown when there is an error in the native CMM.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @status updated to 1.4
- */
-public class CMMException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 5775558044142994965L;
-
- /**
- * Create a new instance with a specified detailed error message.
- *
- * @param message the message
- */
- public CMMException(String message)
- {
- super(message);
- }
-} // class CMMException
diff --git a/libjava/java/awt/color/ColorSpace.java b/libjava/java/awt/color/ColorSpace.java
deleted file mode 100644
index 79369da710f..00000000000
--- a/libjava/java/awt/color/ColorSpace.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/* ColorSpace.java -- transforms between color spaces
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.color;
-
-import java.io.Serializable;
-
-/**
- * NEEDS DOCUMENTATION
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @since 1.2
- */
-public abstract class ColorSpace implements Serializable
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -409452704308689724L;
-
- public static final int TYPE_XYZ = 0;
- public static final int TYPE_Lab = 1;
- public static final int TYPE_Luv = 2;
- public static final int TYPE_YCbCr = 3;
- public static final int TYPE_Yxy = 4;
- public static final int TYPE_RGB = 5;
- public static final int TYPE_GRAY = 6;
- public static final int TYPE_HSV = 7;
- public static final int TYPE_HLS = 8;
- public static final int TYPE_CMYK = 9;
- // mysterious gap in the enumeration sequenece
- public static final int TYPE_CMY = 11;
- public static final int TYPE_2CLR = 12;
- public static final int TYPE_3CLR = 13;
- public static final int TYPE_4CLR = 14;
- public static final int TYPE_5CLR = 15;
- public static final int TYPE_6CLR = 16;
- public static final int TYPE_7CLR = 17;
- public static final int TYPE_8CLR = 18;
- public static final int TYPE_9CLR = 19;
- public static final int TYPE_ACLR = 20;
- public static final int TYPE_BCLR = 21;
- public static final int TYPE_CCLR = 22;
- public static final int TYPE_DCLR = 23;
- public static final int TYPE_ECLR = 24;
- public static final int TYPE_FCLR = 25;
-
- public static final int CS_sRGB = 1000;
- public static final int CS_LINEAR_RGB = 1004;
- public static final int CS_CIEXYZ = 1001;
- public static final int CS_PYCC = 1002;
- public static final int CS_GRAY = 1003;
-
- private static final int CS_BASE = CS_sRGB;
- private static final int CS_END = CS_LINEAR_RGB + 1;
- private static final int CS_COUNT = CS_END - CS_BASE;
-
- // Instances are lazily instantiated
- private static final ColorSpace[] INSTANCES = new ColorSpace[CS_COUNT];
-
- /**
- * @serial
- */
- // Visible in subclass.
- final int type;
-
- /**
- * @serial
- */
- // Visible in subclass.
- final int numComponents;
-
- protected ColorSpace(int type, int numcomponents)
- {
- this.type = type;
- numComponents = numcomponents;
- }
-
- public static ColorSpace getInstance(int colorspace)
- {
- if ((colorspace >= CS_BASE) && (colorspace < CS_END))
- {
- int instanceIndex = colorspace - CS_BASE;
- if (INSTANCES[instanceIndex] == null)
- {
- ICC_Profile profile = new ICC_Profile(colorspace);
- INSTANCES[instanceIndex] = new ICC_ColorSpace(profile);
- }
- return INSTANCES[instanceIndex];
- }
- throw new IllegalArgumentException("unknown/unsupported colorspace");
- }
-
- public boolean isCS_sRGB()
- {
- return type == CS_sRGB;
- }
-
- /**
- * Transforms a color value assumed to be in this ColorSpace into a value in
- * the default CS_sRGB color space.
- *
- * @exception ArrayIndexOutOfBoundsException If array length is not at least
- * the number of components in this ColorSpace.
- */
- public abstract float[] toRGB(float[] colorvalue);
-
- public abstract float[] fromRGB(float[] rgbvalue);
-
- public abstract float[] toCIEXYZ(float[] colorvalue);
-
- public abstract float[] fromCIEXYZ(float[] colorvalue);
-
- public int getType()
- {
- return type;
- }
-
- public int getNumComponents()
- {
- return numComponents;
- }
-
- public String getName(int idx)
- {
- return "type " + type;
- }
-
- /**
- * @since 1.4
- */
- public float getMinValue(int idx)
- {
- if (idx < 0 || idx >= numComponents)
- throw new IllegalArgumentException();
- return 0;
- }
-
- /**
- * @since 1.4
- */
- public float getMaxValue(int idx)
- {
- if (idx < 0 || idx >= numComponents)
- throw new IllegalArgumentException();
- return 1;
- }
-} // class ColorSpace
diff --git a/libjava/java/awt/color/ICC_ColorSpace.java b/libjava/java/awt/color/ICC_ColorSpace.java
deleted file mode 100644
index b50048cf94b..00000000000
--- a/libjava/java/awt/color/ICC_ColorSpace.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/* ICC_ColorSpace.java -- the canonical color space implementation
- Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.color;
-
-import gnu.java.awt.color.CieXyzConverter;
-import gnu.java.awt.color.ClutProfileConverter;
-import gnu.java.awt.color.ColorSpaceConverter;
-import gnu.java.awt.color.GrayProfileConverter;
-import gnu.java.awt.color.GrayScaleConverter;
-import gnu.java.awt.color.LinearRGBConverter;
-import gnu.java.awt.color.PyccConverter;
-import gnu.java.awt.color.RgbProfileConverter;
-import gnu.java.awt.color.SrgbConverter;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-
-/**
- * ICC_ColorSpace - an implementation of ColorSpace
- *
- * While an ICC_Profile class abstracts the data in an ICC profile file
- * an ICC_ColorSpace performs the color space conversions defined by
- * an ICC_Profile instance.
- *
- * Typically, an ICC_Profile will either be created using getInstance,
- * either from the built-in colorspaces, or from an ICC profile file.
- * Then a ICC_Colorspace will be used to perform transforms from the
- * device colorspace to and from the profile color space.
- *
- * The PCS used by ColorSpace is CIE XYZ relative a D50 white point.
- * (Profiles using a CIE Lab PCS will have their input and output converted
- * to D50 CIE XYZ accordingly.
- *
- * Note that a valid profile may not contain transforms in both directions,
- * in which case the output may be undefined.
- * All built-in colorspaces have bidirectional transforms, but developers
- * using an ICC profile file may want to check the profile class using
- * the ICC_Profile.getProfileClass() method. Input class profiles are
- * guaranteed to have transforms to the PCS, output class profiles are
- * guaranteed to have transforms from the PCS to device space.
- *
- * @author Sven de Marothy
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @since 1.2
- */
-public class ICC_ColorSpace extends ColorSpace
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 3455889114070431483L;
-
- /**
- * @serial
- */
- private ICC_Profile thisProfile;
-
- /**
- * @serial
- */
- private float[] minVal;
-
- /**
- * @serial
- */
- private float[] maxVal;
-
- /**
- * @serial
- */
- private float[] diffMinMax;
-
- /**
- * @serial
- */
- private float[] invDiffMinMax;
-
- /**
- * @serial
- */
- private boolean needScaleInit;
-
- /**
- * Tells us if the PCS is CIE LAB (must be CIEXYZ otherwise)
- */
- private transient int type;
- private transient int nComponents;
- private transient ColorSpaceConverter converter;
-
- /**
- * Constructs a new ICC_ColorSpace from an ICC_Profile object.
- *
- * @exception IllegalArgumentException If profile is inappropriate for
- * representing a ColorSpace.
- */
- public ICC_ColorSpace(ICC_Profile profile)
- {
- super(profile.getColorSpaceType(), profile.getNumComponents());
-
- converter = getConverter(profile);
- thisProfile = profile;
- nComponents = profile.getNumComponents();
- type = profile.getColorSpaceType();
- makeArrays();
- }
-
- /**
- * Return the profile
- */
- public ICC_Profile getProfile()
- {
- return thisProfile;
- }
-
- /**
- * Transforms a color value assumed to be in this ColorSpace into a value in
- * the default CS_sRGB color space.
- *
- * @exception ArrayIndexOutOfBoundsException If array length is not at least
- * the number of components in this ColorSpace.
- */
- public float[] toRGB(float[] colorvalue)
- {
- return converter.toRGB(colorvalue);
- }
-
- /**
- * Transforms a color value assumed to be in the default CS_sRGB color space
- * into this ColorSpace.
- *
- * @exception ArrayIndexOutOfBoundsException If array length is not at
- * least 3.
- */
- public float[] fromRGB(float[] rgbvalue)
- {
- return converter.fromRGB(rgbvalue);
- }
-
- /**
- * Transforms a color value assumed to be in this ColorSpace into the
- * CS_CIEXYZ conversion color space.
- *
- * @exception ArrayIndexOutOfBoundsException If array length is not at
- * least the number of components in this ColorSpace.
- */
- public float[] toCIEXYZ(float[] colorvalue)
- {
- return converter.toCIEXYZ(colorvalue);
- }
-
- /**
- * Transforms a color value assumed to be in the CS_CIEXYZ conversion color
- * space into this ColorSpace.
- *
- * @exception ArrayIndexOutOfBoundsException If array length is not at
- * least 3.
- */
- public float[] fromCIEXYZ(float[] colorvalue)
- {
- return converter.fromCIEXYZ(colorvalue);
- }
-
- public boolean isCS_sRGB()
- {
- return converter instanceof SrgbConverter;
- }
-
- /**
- * Returns the minimum normalized color component value for the specified
- * component.
- *
- * @exception IllegalArgumentException If component is less than 0 or greater
- * than numComponents - 1.
- *
- * @since 1.4
- */
- public float getMinValue(int idx)
- {
- // FIXME: Not 100% certain of this.
- if (type == ColorSpace.TYPE_Lab && (idx == 1 || idx == 2))
- return -128f;
-
- if (idx < 0 || idx >= nComponents)
- throw new IllegalArgumentException();
- return 0;
- }
-
- /**
- * Returns the maximum normalized color component value for the specified
- * component.
- *
- * @exception IllegalArgumentException If component is less than 0 or greater
- * than numComponents - 1.
- *
- * @since 1.4
- */
- public float getMaxValue(int idx)
- {
- if (type == ColorSpace.TYPE_XYZ && idx >= 0 && idx <= 2)
- return 1 + 32767 / 32768f;
- else if (type == ColorSpace.TYPE_Lab)
- {
- if (idx == 0)
- return 100;
- if (idx == 1 || idx == 2)
- return 127;
- }
- if (idx < 0 || idx >= nComponents)
- throw new IllegalArgumentException();
- return 1;
- }
-
- /**
- * Returns a colorspace converter suitable for a given profile
- */
- private ColorSpaceConverter getConverter(ICC_Profile profile)
- {
- ColorSpaceConverter converter;
- switch (profile.isPredefined())
- {
- case CS_sRGB:
- converter = new SrgbConverter();
- break;
- case CS_CIEXYZ:
- converter = new CieXyzConverter();
- break;
- case CS_GRAY:
- converter = new GrayScaleConverter();
- break;
- case CS_LINEAR_RGB:
- converter = new LinearRGBConverter();
- break;
- case CS_PYCC:
- converter = new PyccConverter();
- break;
- default:
- if (profile instanceof ICC_ProfileRGB)
- converter = new RgbProfileConverter((ICC_ProfileRGB) profile);
- else if (profile instanceof ICC_ProfileGray)
- converter = new GrayProfileConverter((ICC_ProfileGray) profile);
- else
- converter = new ClutProfileConverter(profile);
- break;
- }
- return converter;
- }
-
- /**
- * Serialization compatibility requires these variable to be set,
- * although we don't use them. Perhaps we should?
- */
- private void makeArrays()
- {
- minVal = new float[nComponents];
- maxVal = new float[nComponents];
-
- invDiffMinMax = diffMinMax = null;
- for (int i = 0; i < nComponents; i++)
- {
- minVal[i] = getMinValue(i);
- maxVal[i] = getMaxValue(i);
- }
- needScaleInit = true;
- }
-
- /**
- * Deserializes the object
- */
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
- // set up objects
- converter = getConverter(thisProfile);
- nComponents = thisProfile.getNumComponents();
- type = thisProfile.getColorSpaceType();
- }
-} // class ICC_ColorSpace
diff --git a/libjava/java/awt/color/ICC_Profile.java b/libjava/java/awt/color/ICC_Profile.java
deleted file mode 100644
index 75f55a1dacb..00000000000
--- a/libjava/java/awt/color/ICC_Profile.java
+++ /dev/null
@@ -1,1244 +0,0 @@
-/* ICC_Profile.java -- color space profiling
- Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.color;
-
-import gnu.java.awt.color.ProfileHeader;
-import gnu.java.awt.color.TagEntry;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamException;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-/**
- * ICC Profile - represents an ICC Color profile.
- * The ICC profile format is a standard file format which maps the transform
- * from a device color space to a standard Profile Color Space (PCS), which
- * can either be CIE L*a*b or CIE XYZ.
- * (With the exception of device link profiles which map from one device space
- * to another)
- *
- * ICC profiles calibrated to specific input/output devices are used when color
- * fidelity is of importance.
- *
- * An instance of ICC_Profile can be created using the getInstance() methods,
- * either using one of the predefined color spaces enumerated in ColorSpace,
- * or from an ICC profile file, or from an input stream.
- *
- * An ICC_ColorSpace object can then be created to transform color values
- * through the profile.
- *
- * The ICC_Profile class implements the version 2 format specified by
- * International Color Consortium Specification ICC.1:1998-09,
- * and its addendum ICC.1A:1999-04, April 1999
- * (available at www.color.org)
- *
- * @author Sven de Marothy
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @since 1.2
- */
-public class ICC_Profile implements Serializable
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -3938515861990936766L;
-
- /**
- * ICC Profile classes
- */
- public static final int CLASS_INPUT = 0;
- public static final int CLASS_DISPLAY = 1;
- public static final int CLASS_OUTPUT = 2;
- public static final int CLASS_DEVICELINK = 3;
- public static final int CLASS_COLORSPACECONVERSION = 4;
- public static final int CLASS_ABSTRACT = 5;
- public static final int CLASS_NAMEDCOLOR = 6;
-
- /**
- * ICC Profile class signatures
- */
- public static final int icSigInputClass = 0x73636e72; // 'scnr'
- public static final int icSigDisplayClass = 0x6d6e7472; // 'mntr'
- public static final int icSigOutputClass = 0x70727472; // 'prtr'
- public static final int icSigLinkClass = 0x6c696e6b; // 'link'
- public static final int icSigColorSpaceClass = 0x73706163; // 'spac'
- public static final int icSigAbstractClass = 0x61627374; // 'abst'
- public static final int icSigNamedColorClass = 0x6e6d636c; // 'nmcl'
-
- /**
- * Color space signatures
- */
- public static final int icSigXYZData = 0x58595A20; // 'XYZ '
- public static final int icSigLabData = 0x4C616220; // 'Lab '
- public static final int icSigLuvData = 0x4C757620; // 'Luv '
- public static final int icSigYCbCrData = 0x59436272; // 'YCbr'
- public static final int icSigYxyData = 0x59787920; // 'Yxy '
- public static final int icSigRgbData = 0x52474220; // 'RGB '
- public static final int icSigGrayData = 0x47524159; // 'GRAY'
- public static final int icSigHsvData = 0x48535620; // 'HSV '
- public static final int icSigHlsData = 0x484C5320; // 'HLS '
- public static final int icSigCmykData = 0x434D594B; // 'CMYK'
- public static final int icSigCmyData = 0x434D5920; // 'CMY '
- public static final int icSigSpace2CLR = 0x32434C52; // '2CLR'
- public static final int icSigSpace3CLR = 0x33434C52; // '3CLR'
- public static final int icSigSpace4CLR = 0x34434C52; // '4CLR'
- public static final int icSigSpace5CLR = 0x35434C52; // '5CLR'
- public static final int icSigSpace6CLR = 0x36434C52; // '6CLR'
- public static final int icSigSpace7CLR = 0x37434C52; // '7CLR'
- public static final int icSigSpace8CLR = 0x38434C52; // '8CLR'
- public static final int icSigSpace9CLR = 0x39434C52; // '9CLR'
- public static final int icSigSpaceACLR = 0x41434C52; // 'ACLR'
- public static final int icSigSpaceBCLR = 0x42434C52; // 'BCLR'
- public static final int icSigSpaceCCLR = 0x43434C52; // 'CCLR'
- public static final int icSigSpaceDCLR = 0x44434C52; // 'DCLR'
- public static final int icSigSpaceECLR = 0x45434C52; // 'ECLR'
- public static final int icSigSpaceFCLR = 0x46434C52; // 'FCLR'
-
- /**
- * Rendering intents
- */
- public static final int icPerceptual = 0;
- public static final int icRelativeColorimetric = 1;
- public static final int icSaturation = 2;
- public static final int icAbsoluteColorimetric = 3;
-
- /**
- * Tag signatures
- */
- public static final int icSigAToB0Tag = 0x41324230; // 'A2B0'
- public static final int icSigAToB1Tag = 0x41324231; // 'A2B1'
- public static final int icSigAToB2Tag = 0x41324232; // 'A2B2'
- public static final int icSigBlueColorantTag = 0x6258595A; // 'bXYZ'
- public static final int icSigBlueTRCTag = 0x62545243; // 'bTRC'
- public static final int icSigBToA0Tag = 0x42324130; // 'B2A0'
- public static final int icSigBToA1Tag = 0x42324131; // 'B2A1'
- public static final int icSigBToA2Tag = 0x42324132; // 'B2A2'
- public static final int icSigCalibrationDateTimeTag = 0x63616C74; // 'calt'
- public static final int icSigCharTargetTag = 0x74617267; // 'targ'
- public static final int icSigCopyrightTag = 0x63707274; // 'cprt'
- public static final int icSigCrdInfoTag = 0x63726469; // 'crdi'
- public static final int icSigDeviceMfgDescTag = 0x646D6E64; // 'dmnd'
- public static final int icSigDeviceModelDescTag = 0x646D6464; // 'dmdd'
- public static final int icSigDeviceSettingsTag = 0x64657673; // 'devs'
- public static final int icSigGamutTag = 0x67616D74; // 'gamt'
- public static final int icSigGrayTRCTag = 0x6b545243; // 'kTRC'
- public static final int icSigGreenColorantTag = 0x6758595A; // 'gXYZ'
- public static final int icSigGreenTRCTag = 0x67545243; // 'gTRC'
- public static final int icSigLuminanceTag = 0x6C756d69; // 'lumi'
- public static final int icSigMeasurementTag = 0x6D656173; // 'meas'
- public static final int icSigMediaBlackPointTag = 0x626B7074; // 'bkpt'
- public static final int icSigMediaWhitePointTag = 0x77747074; // 'wtpt'
- public static final int icSigNamedColor2Tag = 0x6E636C32; // 'ncl2'
- public static final int icSigOutputResponseTag = 0x72657370; // 'resp'
- public static final int icSigPreview0Tag = 0x70726530; // 'pre0'
- public static final int icSigPreview1Tag = 0x70726531; // 'pre1'
- public static final int icSigPreview2Tag = 0x70726532; // 'pre2'
- public static final int icSigProfileDescriptionTag = 0x64657363; // 'desc'
- public static final int icSigProfileSequenceDescTag = 0x70736571; // 'pseq'
- public static final int icSigPs2CRD0Tag = 0x70736430; // 'psd0'
- public static final int icSigPs2CRD1Tag = 0x70736431; // 'psd1'
- public static final int icSigPs2CRD2Tag = 0x70736432; // 'psd2'
- public static final int icSigPs2CRD3Tag = 0x70736433; // 'psd3'
- public static final int icSigPs2CSATag = 0x70733273; // 'ps2s'
- public static final int icSigPs2RenderingIntentTag = 0x70733269; // 'ps2i'
- public static final int icSigRedColorantTag = 0x7258595A; // 'rXYZ'
- public static final int icSigRedTRCTag = 0x72545243; // 'rTRC'
- public static final int icSigScreeningDescTag = 0x73637264; // 'scrd'
- public static final int icSigScreeningTag = 0x7363726E; // 'scrn'
- public static final int icSigTechnologyTag = 0x74656368; // 'tech'
- public static final int icSigUcrBgTag = 0x62666420; // 'bfd '
- public static final int icSigViewingCondDescTag = 0x76756564; // 'vued'
- public static final int icSigViewingConditionsTag = 0x76696577; // 'view'
- public static final int icSigChromaticityTag = 0x6368726D; // 'chrm'
-
- /**
- * Non-ICC tag 'head' for use in retrieving the header with getData()
- */
- public static final int icSigHead = 0x68656164;
-
- /**
- * Header offsets
- */
- public static final int icHdrSize = 0;
- public static final int icHdrCmmId = 4;
- public static final int icHdrVersion = 8;
- public static final int icHdrDeviceClass = 12;
- public static final int icHdrColorSpace = 16;
- public static final int icHdrPcs = 20;
- public static final int icHdrDate = 24;
- public static final int icHdrMagic = 36;
- public static final int icHdrPlatform = 40;
- public static final int icHdrFlags = 44;
- public static final int icHdrManufacturer = 48;
- public static final int icHdrModel = 52;
- public static final int icHdrAttributes = 56;
- public static final int icHdrRenderingIntent = 64;
- public static final int icHdrIlluminant = 68;
- public static final int icHdrCreator = 80;
-
- /**
- *
- */
- public static final int icTagType = 0;
- public static final int icTagReserved = 4;
- public static final int icCurveCount = 8;
- public static final int icCurveData = 12;
- public static final int icXYZNumberX = 8;
-
- /**
- * offset of the Tag table
- */
- private static final int tagTableOffset = 128;
-
- /**
- * @serial
- */
- private static final int iccProfileSerializedDataVersion = 1;
-
- /**
- * Constants related to generating profiles for
- * built-in colorspace profiles
- */
- /**
- * Copyright notice to stick into built-in-profile files.
- */
- private static final String copyrightNotice = "Generated by GNU Classpath.";
-
- /**
- * Resolution of the TRC to use for predefined profiles.
- * 1024 should suffice.
- */
- private static final int TRC_POINTS = 1024;
-
- /**
- * CIE 1931 D50 white point (in Lab coordinates)
- */
- private static final float[] D50 = { 0.96422f, 1.00f, 0.82521f };
-
- /**
- * Color space profile ID
- * Set to the predefined profile class (e.g. CS_sRGB) if a predefined
- * color space is used, set to -1 otherwise.
- * (or if the profile has been modified)
- */
- private transient int profileID;
-
- /**
- * The profile header data
- */
- private transient ProfileHeader header;
-
- /**
- * A hashtable containing the profile tags as TagEntry objects
- */
- private transient Hashtable tagTable;
-
- /**
- * Contructor for predefined colorspaces
- */
- ICC_Profile(int profileID)
- {
- header = null;
- tagTable = null;
- createProfile(profileID);
- }
-
- /**
- * Constructs an ICC_Profile from a header and a table of loaded tags.
- */
- ICC_Profile(ProfileHeader h, Hashtable tags) throws IllegalArgumentException
- {
- header = h;
- tagTable = tags;
- profileID = -1; // Not a predefined color space
- }
-
- /**
- * Constructs an ICC_Profile from a byte array of data.
- */
- ICC_Profile(byte[] data) throws IllegalArgumentException
- {
- // get header and verify it
- header = new ProfileHeader(data);
- header.verifyHeader(data.length);
- tagTable = createTagTable(data);
- profileID = -1; // Not a predefined color space
- }
-
- /**
- * Free up the used memory.
- */
- protected void finalize()
- {
- }
-
- /**
- * Returns an ICC_Profile instance from a byte array of profile data.
- *
- * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
- * may be returned if appropriate.
- *
- * @throws IllegalArgumentException if the profile data is an invalid
- * v2 profile.
- *
- * @param data - the profile data
- * @return An ICC_Profile object
- */
- public static ICC_Profile getInstance(byte[] data)
- {
- ProfileHeader header = new ProfileHeader(data);
-
- // verify it as a correct ICC header, including size
- header.verifyHeader(data.length);
-
- Hashtable tags = createTagTable(data);
-
- if (isRGBProfile(header, tags))
- return new ICC_ProfileRGB(data);
- if (isGrayProfile(header, tags))
- return new ICC_ProfileGray(data);
-
- return new ICC_Profile(header, tags);
- }
-
- /**
- * Returns an predefined ICC_Profile instance.
- *
- * This will construct an ICC_Profile instance from one of the predefined
- * color spaces in the ColorSpace class. (e.g. CS_sRGB, CS_GRAY, etc)
- *
- * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
- * may be returned if appropriate.
- *
- * @return An ICC_Profile object
- */
- public static ICC_Profile getInstance(int cspace)
- {
- if (cspace == ColorSpace.CS_sRGB || cspace == ColorSpace.CS_LINEAR_RGB)
- return new ICC_ProfileRGB(cspace);
- if (cspace == ColorSpace.CS_GRAY)
- return new ICC_ProfileGray(cspace);
- return new ICC_Profile(cspace);
- }
-
- /**
- * Returns an ICC_Profile instance from an ICC Profile file.
- *
- * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
- * may be returned if appropriate.
- *
- * @throws IllegalArgumentException if the profile data is an invalid
- * v2 profile.
- * @throws IOException if the file could not be read.
- *
- * @param filename - the file name of the profile file.
- * @return An ICC_Profile object
- */
- public static ICC_Profile getInstance(String filename)
- throws IOException
- {
- return getInstance(new FileInputStream(filename));
- }
-
- /**
- * Returns an ICC_Profile instance from an InputStream.
- *
- * This method can be used for reading ICC profiles embedded in files
- * which support this. (JPEG and SVG for instance).
- *
- * The stream is treated in the following way: The profile header
- * (128 bytes) is read first, and the header is validated. If the profile
- * header is valid, it will then attempt to read the rest of the profile
- * from the stream. The stream is not closed after reading.
- *
- * An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
- * may be returned if appropriate.
- *
- * @throws IllegalArgumentException if the profile data is an invalid
- * v2 profile.
- * @throws IOException if the stream could not be read.
- *
- * @param in - the input stream to read the profile from.
- * @return An ICC_Profile object
- */
- public static ICC_Profile getInstance(InputStream in)
- throws IOException
- {
- // read the header
- byte[] headerData = new byte[ProfileHeader.HEADERSIZE];
- if (in.read(headerData) != ProfileHeader.HEADERSIZE)
- throw new IllegalArgumentException("Invalid profile header");
-
- ProfileHeader header = new ProfileHeader(headerData);
-
- // verify it as a correct ICC header, but do not verify the
- // size as we are reading from a stream.
- header.verifyHeader(-1);
-
- // get the size
- byte[] data = new byte[header.getSize()];
- System.arraycopy(headerData, 0, data, 0, ProfileHeader.HEADERSIZE);
-
- // read the rest
- if (in.read(data, ProfileHeader.HEADERSIZE,
- header.getSize() - ProfileHeader.HEADERSIZE) != header.getSize()
- - ProfileHeader.HEADERSIZE)
- throw new IOException("Incorrect profile size");
-
- return getInstance(data);
- }
-
- /**
- * Returns the major version number
- */
- public int getMajorVersion()
- {
- return header.getMajorVersion();
- }
-
- /**
- * Returns the minor version number.
- *
- * Only the least-significant byte contains data, in BCD form:
- * the least-significant nibble is the BCD bug fix revision,
- * the most-significant nibble is the BCD minor revision number.
- *
- * (E.g. For a v2.1.0 profile this will return 0x10
)
- */
- public int getMinorVersion()
- {
- return header.getMinorVersion();
- }
-
- /**
- * Returns the device class of this profile,
- *
- * (E.g. CLASS_INPUT for a scanner profile,
- * CLASS_OUTPUT for a printer)
- */
- public int getProfileClass()
- {
- return header.getProfileClass();
- }
-
- /**
- * Returns the color space of this profile, in terms
- * of the color space constants defined in ColorSpace.
- * (For example, it may be a ColorSpace.TYPE_RGB)
- */
- public int getColorSpaceType()
- {
- return header.getColorSpace();
- }
-
- /**
- * Returns the color space of this profile's Profile Connection Space (OCS)
- *
- * In terms of the color space constants defined in ColorSpace.
- * This may be TYPE_XYZ or TYPE_Lab
- */
- public int getPCSType()
- {
- return header.getProfileColorSpace();
- }
-
- /**
- * Writes the profile data to an ICC profile file.
- * @param filename - The name of the file to write
- * @throws IOException if the write failed.
- */
- public void write(String filename) throws IOException
- {
- FileOutputStream out = new FileOutputStream(filename);
- write(out);
- out.flush();
- out.close();
- }
-
- /**
- * Writes the profile data in ICC profile file-format to a stream.
- * This is useful for embedding ICC profiles in file formats which
- * support this (such as JPEG and SVG).
- *
- * The stream is not closed after writing.
- * @param out - The outputstream to which the profile data should be written
- * @throws IOException if the write failed.
- */
- public void write(OutputStream out) throws IOException
- {
- out.write(getData());
- }
-
- /**
- * Returns the data corresponding to this ICC_Profile as a byte array.
- *
- * @return The data in a byte array,
- * where the first element corresponds to first byte of the profile file.
- */
- public byte[] getData()
- {
- int size = getSize();
- byte[] data = new byte[size];
-
- // Header
- System.arraycopy(header.getData(size), 0, data, 0, ProfileHeader.HEADERSIZE);
- // # of tags
- byte[] tt = getTagTable();
- System.arraycopy(tt, 0, data, ProfileHeader.HEADERSIZE, tt.length);
-
- Enumeration e = tagTable.elements();
- while (e.hasMoreElements())
- {
- TagEntry tag = (TagEntry) e.nextElement();
- System.arraycopy(tag.getData(), 0,
- data, tag.getOffset(), tag.getSize());
- }
- return data;
- }
-
- /**
- * Returns the ICC profile tag data
- * The non ICC-tag icSigHead is also permitted to request the header data.
- *
- * @param tagSignature The ICC signature of the requested tag
- * @return A byte array containing the tag data
- */
- public byte[] getData(int tagSignature)
- {
- if (tagSignature == icSigHead)
- return header.getData(getSize());
-
- TagEntry t = (TagEntry) tagTable.get(TagEntry.tagHashKey(tagSignature));
- if (t == null)
- return null;
- return t.getData();
- }
-
- /**
- * Sets the ICC profile tag data.
- *
- * Note that an ICC profile can only contain one tag of each type, if
- * a tag already exists with the given signature, it is replaced.
- *
- * @param tagSignature - The signature of the tag to set
- * @param data - A byte array containing the tag data
- */
- public void setData(int tagSignature, byte[] data)
- {
- profileID = -1; // Not a predefined color space if modified.
-
- if (tagSignature == icSigHead)
- header = new ProfileHeader(data);
- else
- {
- TagEntry t = new TagEntry(tagSignature, data);
- tagTable.put(t.hashKey(), t);
- }
- }
-
- /**
- * Get the number of components in the profile's device color space.
- */
- public int getNumComponents()
- {
- int[] lookup =
- {
- ColorSpace.TYPE_RGB, 3, ColorSpace.TYPE_CMY, 3,
- ColorSpace.TYPE_CMYK, 4, ColorSpace.TYPE_GRAY, 1,
- ColorSpace.TYPE_YCbCr, 3, ColorSpace.TYPE_XYZ, 3,
- ColorSpace.TYPE_Lab, 3, ColorSpace.TYPE_HSV, 3,
- ColorSpace.TYPE_2CLR, 2, ColorSpace.TYPE_Luv, 3,
- ColorSpace.TYPE_Yxy, 3, ColorSpace.TYPE_HLS, 3,
- ColorSpace.TYPE_3CLR, 3, ColorSpace.TYPE_4CLR, 4,
- ColorSpace.TYPE_5CLR, 5, ColorSpace.TYPE_6CLR, 6,
- ColorSpace.TYPE_7CLR, 7, ColorSpace.TYPE_8CLR, 8,
- ColorSpace.TYPE_9CLR, 9, ColorSpace.TYPE_ACLR, 10,
- ColorSpace.TYPE_BCLR, 11, ColorSpace.TYPE_CCLR, 12,
- ColorSpace.TYPE_DCLR, 13, ColorSpace.TYPE_ECLR, 14,
- ColorSpace.TYPE_FCLR, 15
- };
- for (int i = 0; i < lookup.length; i += 2)
- if (header.getColorSpace() == lookup[i])
- return lookup[i + 1];
- return 3; // should never happen.
- }
-
- /**
- * After deserializing we must determine if the class we want
- * is really one of the more specialized ICC_ProfileRGB or
- * ICC_ProfileGray classes.
- */
- protected Object readResolve() throws ObjectStreamException
- {
- if (isRGBProfile(header, tagTable))
- return new ICC_ProfileRGB(getData());
- if (isGrayProfile(header, tagTable))
- return new ICC_ProfileGray(getData());
- return this;
- }
-
- /**
- * Deserializes an instance
- */
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
- String predef = (String) s.readObject();
- byte[] data = (byte[]) s.readObject();
-
- if (data != null)
- {
- header = new ProfileHeader(data);
- tagTable = createTagTable(data);
- profileID = -1; // Not a predefined color space
- }
-
- if (predef != null)
- {
- predef = predef.intern();
- if (predef.equals("CS_sRGB"))
- createProfile(ColorSpace.CS_sRGB);
- if (predef.equals("CS_LINEAR_RGB"))
- createProfile(ColorSpace.CS_LINEAR_RGB);
- if (predef.equals("CS_CIEXYZ"))
- createProfile(ColorSpace.CS_CIEXYZ);
- if (predef.equals("CS_GRAY"))
- createProfile(ColorSpace.CS_GRAY);
- if (predef.equals("CS_PYCC"))
- createProfile(ColorSpace.CS_PYCC);
- }
- }
-
- /**
- * Serializes an instance
- * The format is a String and a byte array,
- * The string is non-null if the instance is one of the built-in profiles.
- * Otherwise the byte array is non-null and represents the profile data.
- */
- private void writeObject(ObjectOutputStream s) throws IOException
- {
- s.defaultWriteObject();
- if (profileID == ColorSpace.CS_sRGB)
- s.writeObject("CS_sRGB");
- else if (profileID == ColorSpace.CS_LINEAR_RGB)
- s.writeObject("CS_LINEAR_RGB");
- else if (profileID == ColorSpace.CS_CIEXYZ)
- s.writeObject("CS_CIEXYZ");
- else if (profileID == ColorSpace.CS_GRAY)
- s.writeObject("CS_GRAY");
- else if (profileID == ColorSpace.CS_PYCC)
- s.writeObject("CS_PYCC");
- else
- {
- s.writeObject(null); // null string
- s.writeObject(getData()); // data
- return;
- }
- s.writeObject(null); // null data
- }
-
- /**
- * Sorts a ICC profile byte array into TagEntry objects stored in
- * a hash table.
- */
- private static Hashtable createTagTable(byte[] data)
- throws IllegalArgumentException
- {
- ByteBuffer buf = ByteBuffer.wrap(data);
- int nTags = buf.getInt(tagTableOffset);
-
- Hashtable tagTable = new Hashtable();
- for (int i = 0; i < nTags; i++)
- {
- TagEntry te = new TagEntry(buf.getInt(tagTableOffset
- + i * TagEntry.entrySize + 4),
- buf.getInt(tagTableOffset
- + i * TagEntry.entrySize + 8),
- buf.getInt(tagTableOffset
- + i * TagEntry.entrySize + 12),
- data);
-
- if (tagTable.put(te.hashKey(), te) != null)
- throw new IllegalArgumentException("Duplicate tag in profile:" + te);
- }
- return tagTable;
- }
-
- /**
- * Returns the total size of the padded, stored data
- * Note: Tags must be stored on 4-byte aligned offsets.
- */
- private int getSize()
- {
- int totalSize = ProfileHeader.HEADERSIZE; // size of header
-
- int tagTableSize = 4 + tagTable.size() * TagEntry.entrySize; // size of tag table
- if ((tagTableSize & 0x0003) != 0)
- tagTableSize += 4 - (tagTableSize & 0x0003); // pad
- totalSize += tagTableSize;
-
- Enumeration e = tagTable.elements();
- while (e.hasMoreElements())
- { // tag data
- int tagSize = ((TagEntry) e.nextElement()).getSize();
- if ((tagSize & 0x0003) != 0)
- tagSize += 4 - (tagSize & 0x0003); // pad
- totalSize += tagSize;
- }
- return totalSize;
- }
-
- /**
- * Generates the tag index table
- */
- private byte[] getTagTable()
- {
- int tagTableSize = 4 + tagTable.size() * TagEntry.entrySize;
- if ((tagTableSize & 0x0003) != 0)
- tagTableSize += 4 - (tagTableSize & 0x0003); // pad
-
- int offset = 4;
- int tagOffset = ProfileHeader.HEADERSIZE + tagTableSize;
- ByteBuffer buf = ByteBuffer.allocate(tagTableSize);
- buf.putInt(tagTable.size()); // number of tags
-
- Enumeration e = tagTable.elements();
- while (e.hasMoreElements())
- {
- TagEntry tag = (TagEntry) e.nextElement();
- buf.putInt(offset, tag.getSignature());
- buf.putInt(offset + 4, tagOffset);
- buf.putInt(offset + 8, tag.getSize());
- tag.setOffset(tagOffset);
- int tagSize = tag.getSize();
- if ((tagSize & 0x0003) != 0)
- tagSize += 4 - (tagSize & 0x0003); // pad
- tagOffset += tagSize;
- offset += 12;
- }
- return buf.array();
- }
-
- /**
- * Returns if the criteria for an ICC_ProfileRGB are met.
- * This means:
- * Color space is TYPE_RGB
- * (r,g,b)ColorantTags included
- * (r,g,b)TRCTags included
- * mediaWhitePointTag included
- */
- private static boolean isRGBProfile(ProfileHeader header, Hashtable tags)
- {
- if (header.getColorSpace() != ColorSpace.TYPE_RGB)
- return false;
- if (tags.get(TagEntry.tagHashKey(icSigRedColorantTag)) == null)
- return false;
- if (tags.get(TagEntry.tagHashKey(icSigGreenColorantTag)) == null)
- return false;
- if (tags.get(TagEntry.tagHashKey(icSigBlueColorantTag)) == null)
- return false;
- if (tags.get(TagEntry.tagHashKey(icSigRedTRCTag)) == null)
- return false;
- if (tags.get(TagEntry.tagHashKey(icSigGreenTRCTag)) == null)
- return false;
- if (tags.get(TagEntry.tagHashKey(icSigBlueTRCTag)) == null)
- return false;
- return (tags.get(TagEntry.tagHashKey(icSigMediaWhitePointTag)) != null);
- }
-
- /**
- * Returns if the criteria for an ICC_ProfileGray are met.
- * This means:
- * Colorspace is TYPE_GRAY
- * grayTRCTag included
- * mediaWhitePointTag included
- */
- private static boolean isGrayProfile(ProfileHeader header, Hashtable tags)
- {
- if (header.getColorSpace() != ColorSpace.TYPE_GRAY)
- return false;
- if (tags.get(TagEntry.tagHashKey(icSigGrayTRCTag)) == null)
- return false;
- return (tags.get(TagEntry.tagHashKey(icSigMediaWhitePointTag)) != null);
- }
-
- /**
- * Returns curve data for a 'curv'-type tag
- * If it's a gamma curve, a single entry will be returned with the
- * gamma value (including 1.0 for linear response)
- * Otherwise the TRC table is returned.
- *
- * (Package private - used by ICC_ProfileRGB and ICC_ProfileGray)
- */
- short[] getCurve(int signature)
- {
- byte[] data = getData(signature);
- short[] curve;
-
- // can't find tag?
- if (data == null)
- return null;
-
- // not an curve type tag?
- ByteBuffer buf = ByteBuffer.wrap(data);
- if (buf.getInt(0) != 0x63757276) // 'curv' type
- return null;
- int count = buf.getInt(8);
- if (count == 0)
- {
- curve = new short[1];
- curve[0] = 0x0100; // 1.00 in u8fixed8
- return curve;
- }
- if (count == 1)
- {
- curve = new short[1];
- curve[0] = buf.getShort(12); // other u8fixed8 gamma
- return curve;
- }
- curve = new short[count];
- for (int i = 0; i < count; i++)
- curve[i] = buf.getShort(12 + i * 2);
- return curve;
- }
-
- /**
- * Returns XYZ tristimulus values for an 'XYZ ' type tag
- * @return the XYZ values, or null if the tag was not an 'XYZ ' type tag.
- *
- * (Package private - used by ICC_ProfileXYZ and ICC_ProfileGray)
- */
- float[] getXYZData(int signature)
- {
- byte[] data = getData(signature);
-
- // can't find tag?
- if (data == null)
- return null;
-
- // not an XYZData type tag?
- ByteBuffer buf = ByteBuffer.wrap(data);
- if (buf.getInt(0) != icSigXYZData) // 'XYZ ' type
- return null;
-
- float[] point = new float[3];
-
- // get the X,Y,Z tristimulus values
- point[0] = ((float) buf.getInt(8)) / 65536f;
- point[1] = ((float) buf.getInt(12)) / 65536f;
- point[2] = ((float) buf.getInt(16)) / 65536f;
- return point;
- }
-
- /**
- * Returns the profile ID if it's a predefined profile
- * Or -1 for a profile loaded from an ICC profile
- *
- * (Package private - used by ICC_ColorSpace)
- */
- int isPredefined()
- {
- return profileID;
- }
-
- /**
- * Creates a tag of XYZ-value type.
- */
- private byte[] makeXYZData(float[] values)
- {
- ByteBuffer buf = ByteBuffer.allocate(20);
- buf.putInt(0, icSigXYZData); // 'XYZ '
- buf.putInt(4, 0);
- buf.putInt(8, (int) (values[0] * 65536.0));
- buf.putInt(12, (int) (values[1] * 65536.0));
- buf.putInt(16, (int) (values[2] * 65536.0));
- return buf.array();
- }
-
- /**
- * Creates a tag of text type
- */
- private byte[] makeTextTag(String text)
- {
- int length = text.length();
- ByteBuffer buf = ByteBuffer.allocate(8 + length + 1);
- byte[] data;
- try
- {
- data = text.getBytes("US-ASCII");
- }
- catch (UnsupportedEncodingException e)
- {
- data = new byte[length]; // shouldn't happen
- }
-
- buf.putInt(0, (int) 0x74657874); // 'text'
- buf.putInt(4, 0);
- for (int i = 0; i < length; i++)
- buf.put(8 + i, data[i]);
- buf.put(8 + length, (byte) 0); // null-terminate
- return buf.array();
- }
-
- /**
- * Creates a tag of textDescriptionType
- */
- private byte[] makeDescTag(String text)
- {
- int length = text.length();
- ByteBuffer buf = ByteBuffer.allocate(90 + length + 1);
- buf.putInt(0, (int) 0x64657363); // 'desc'
- buf.putInt(4, 0); // reserved
- buf.putInt(8, length + 1); // ASCII length, including null termination
- byte[] data;
-
- try
- {
- data = text.getBytes("US-ASCII");
- }
- catch (UnsupportedEncodingException e)
- {
- data = new byte[length]; // shouldn't happen
- }
-
- for (int i = 0; i < length; i++)
- buf.put(12 + i, data[i]);
- buf.put(12 + length, (byte) 0); // null-terminate
-
- for (int i = 0; i < 39; i++)
- buf.putShort(13 + length + (i * 2), (short) 0); // 78 bytes we can ignore
-
- return buf.array();
- }
-
- /**
- * Creates a tag of TRC type (linear curve)
- */
- private byte[] makeTRC()
- {
- ByteBuffer buf = ByteBuffer.allocate(12);
- buf.putInt(0, 0x63757276); // 'curv' type
- buf.putInt(4, 0); // reserved
- buf.putInt(8, 0);
- return buf.array();
- }
-
- /**
- * Creates a tag of TRC type (single gamma value)
- */
- private byte[] makeTRC(float gamma)
- {
- short gammaValue = (short) (gamma * 256f);
- ByteBuffer buf = ByteBuffer.allocate(14);
- buf.putInt(0, 0x63757276); // 'curv' type
- buf.putInt(4, 0); // reserved
- buf.putInt(8, 1);
- buf.putShort(12, gammaValue); // 1.00 in u8fixed8
- return buf.array();
- }
-
- /**
- * Creates a tag of TRC type (TRC curve points)
- */
- private byte[] makeTRC(float[] trc)
- {
- ByteBuffer buf = ByteBuffer.allocate(12 + 2 * trc.length);
- buf.putInt(0, 0x63757276); // 'curv' type
- buf.putInt(4, 0); // reserved
- buf.putInt(8, trc.length); // number of points
-
- // put the curve values
- for (int i = 0; i < trc.length; i++)
- buf.putShort(12 + i * 2, (short) (trc[i] * 65535f));
-
- return buf.array();
- }
-
- /**
- * Creates an identity color lookup table.
- */
- private byte[] makeIdentityClut()
- {
- final int nIn = 3;
- final int nOut = 3;
- final int nInEntries = 256;
- final int nOutEntries = 256;
- final int gridpoints = 16;
-
- // gridpoints**nIn
- final int clutSize = 2 * nOut * gridpoints * gridpoints * gridpoints;
- final int totalSize = clutSize + 2 * nInEntries * nIn
- + 2 * nOutEntries * nOut + 52;
-
- ByteBuffer buf = ByteBuffer.allocate(totalSize);
- buf.putInt(0, 0x6D667432); // 'mft2'
- buf.putInt(4, 0); // reserved
- buf.put(8, (byte) nIn); // number input channels
- buf.put(9, (byte) nOut); // number output channels
- buf.put(10, (byte) gridpoints); // number gridpoints
- buf.put(11, (byte) 0); // padding
-
- // identity matrix
- buf.putInt(12, 65536); // = 1 in s15.16 fixed point
- buf.putInt(16, 0);
- buf.putInt(20, 0);
- buf.putInt(24, 0);
- buf.putInt(28, 65536);
- buf.putInt(32, 0);
- buf.putInt(36, 0);
- buf.putInt(40, 0);
- buf.putInt(44, 65536);
-
- buf.putShort(48, (short) nInEntries); // input table entries
- buf.putShort(50, (short) nOutEntries); // output table entries
-
- // write the linear input channels, unsigned 16.16 fixed point,
- // from 0.0 to FF.FF
- for (int channel = 0; channel < 3; channel++)
- for (int i = 0; i < nInEntries; i++)
- {
- short n = (short) ((i << 8) | i); // assumes 256 entries
- buf.putShort(52 + (channel * nInEntries + i) * 2, n);
- }
- int clutOffset = 52 + nInEntries * nIn * 2;
-
- for (int x = 0; x < gridpoints; x++)
- for (int y = 0; y < gridpoints; y++)
- for (int z = 0; z < gridpoints; z++)
- {
- int offset = clutOffset + z * 2 * nOut + y * gridpoints * 2 * nOut
- + x * gridpoints * gridpoints * 2 * nOut;
- double xf = ((double) x) / ((double) gridpoints - 1.0);
- double yf = ((double) y) / ((double) gridpoints - 1.0);
- double zf = ((double) z) / ((double) gridpoints - 1.0);
- buf.putShort(offset, (short) (xf * 65535.0));
- buf.putShort(offset + 2, (short) (yf * 65535.0));
- buf.putShort(offset + 4, (short) (zf * 65535.0));
- }
-
- for (int channel = 0; channel < 3; channel++)
- for (int i = 0; i < nOutEntries; i++)
- {
- short n = (short) ((i << 8) | i); // assumes 256 entries
- buf.putShort(clutOffset + clutSize + (channel * nOutEntries + i) * 2,
- n);
- }
-
- return buf.array();
- }
-
- /**
- * Creates profile data corresponding to the built-in colorspaces.
- */
- private void createProfile(int colorSpace) throws IllegalArgumentException
- {
- this.profileID = colorSpace;
- header = new ProfileHeader();
- tagTable = new Hashtable();
-
- switch (colorSpace)
- {
- case ColorSpace.CS_sRGB:
- createRGBProfile();
- return;
- case ColorSpace.CS_LINEAR_RGB:
- createLinearRGBProfile();
- return;
- case ColorSpace.CS_CIEXYZ:
- createCIEProfile();
- return;
- case ColorSpace.CS_GRAY:
- createGrayProfile();
- return;
- case ColorSpace.CS_PYCC:
- createPyccProfile();
- return;
- default:
- throw new IllegalArgumentException("Not a predefined color space!");
- }
- }
-
- /**
- * Creates an ICC_Profile representing the sRGB color space
- */
- private void createRGBProfile()
- {
- header.setColorSpace( ColorSpace.TYPE_RGB );
- header.setProfileColorSpace( ColorSpace.TYPE_XYZ );
- ICC_ColorSpace cs = new ICC_ColorSpace(this);
-
- float[] r = { 1f, 0f, 0f };
- float[] g = { 0f, 1f, 0f };
- float[] b = { 0f, 0f, 1f };
- float[] black = { 0f, 0f, 0f };
-
- // CIE 1931 D50 white point (in Lab coordinates)
- float[] white = D50;
-
- // Get tristimulus values (matrix elements)
- r = cs.toCIEXYZ(r);
- g = cs.toCIEXYZ(g);
- b = cs.toCIEXYZ(b);
-
- // Generate the sRGB TRC curve, this is the linear->nonlinear
- // RGB transform.
- cs = new ICC_ColorSpace(getInstance(ICC_ColorSpace.CS_LINEAR_RGB));
- float[] points = new float[TRC_POINTS];
- float[] in = new float[3];
- for (int i = 0; i < TRC_POINTS; i++)
- {
- in[0] = in[1] = in[2] = ((float) i) / ((float) TRC_POINTS - 1);
- in = cs.fromRGB(in);
- // Note this value is the same for all components.
- points[i] = in[0];
- }
-
- setData(icSigRedColorantTag, makeXYZData(r));
- setData(icSigGreenColorantTag, makeXYZData(g));
- setData(icSigBlueColorantTag, makeXYZData(b));
- setData(icSigMediaWhitePointTag, makeXYZData(white));
- setData(icSigMediaBlackPointTag, makeXYZData(black));
- setData(icSigRedTRCTag, makeTRC(points));
- setData(icSigGreenTRCTag, makeTRC(points));
- setData(icSigBlueTRCTag, makeTRC(points));
- setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
- setData(icSigProfileDescriptionTag, makeDescTag("Generic sRGB"));
- this.profileID = ColorSpace.CS_sRGB;
- }
-
- /**
- * Creates an linear sRGB profile
- */
- private void createLinearRGBProfile()
- {
- header.setColorSpace(ColorSpace.TYPE_RGB);
- header.setProfileColorSpace(ColorSpace.TYPE_XYZ);
- ICC_ColorSpace cs = new ICC_ColorSpace(this);
-
- float[] r = { 1f, 0f, 0f };
- float[] g = { 0f, 1f, 0f };
- float[] b = { 0f, 0f, 1f };
- float[] black = { 0f, 0f, 0f };
-
- float[] white = D50;
-
- // Get tristimulus values (matrix elements)
- r = cs.toCIEXYZ(r);
- g = cs.toCIEXYZ(g);
- b = cs.toCIEXYZ(b);
-
- setData(icSigRedColorantTag, makeXYZData(r));
- setData(icSigGreenColorantTag, makeXYZData(g));
- setData(icSigBlueColorantTag, makeXYZData(b));
-
- setData(icSigMediaWhitePointTag, makeXYZData(white));
- setData(icSigMediaBlackPointTag, makeXYZData(black));
-
- setData(icSigRedTRCTag, makeTRC());
- setData(icSigGreenTRCTag, makeTRC());
- setData(icSigBlueTRCTag, makeTRC());
- setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
- setData(icSigProfileDescriptionTag, makeDescTag("Linear RGB"));
- this.profileID = ColorSpace.CS_LINEAR_RGB;
- }
-
- /**
- * Creates an CIE XYZ identity profile
- */
- private void createCIEProfile()
- {
- header.setColorSpace( ColorSpace.TYPE_XYZ );
- header.setProfileColorSpace( ColorSpace.TYPE_XYZ );
- header.setProfileClass( CLASS_COLORSPACECONVERSION );
- ICC_ColorSpace cs = new ICC_ColorSpace(this);
-
- float[] white = D50;
-
- setData(icSigMediaWhitePointTag, makeXYZData(white));
- setData(icSigAToB0Tag, makeIdentityClut());
- setData(icSigBToA0Tag, makeIdentityClut());
- setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
- setData(icSigProfileDescriptionTag, makeDescTag("CIE XYZ identity profile"));
- this.profileID = ColorSpace.CS_CIEXYZ;
- }
-
- /**
- * Creates a linear gray ICC_Profile
- */
- private void createGrayProfile()
- {
- header.setColorSpace(ColorSpace.TYPE_GRAY);
- header.setProfileColorSpace(ColorSpace.TYPE_XYZ);
-
- // CIE 1931 D50 white point (in Lab coordinates)
- float[] white = D50;
-
- setData(icSigMediaWhitePointTag, makeXYZData(white));
- setData(icSigGrayTRCTag, makeTRC(1.0f));
- setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
- setData(icSigProfileDescriptionTag, makeDescTag("Linear grayscale"));
- this.profileID = ColorSpace.CS_GRAY;
- }
-
- /**
- * XXX Implement me
- */
- private void createPyccProfile()
- {
- header.setColorSpace(ColorSpace.TYPE_3CLR);
- header.setProfileColorSpace(ColorSpace.TYPE_XYZ);
-
- // Create CLUTs here. :-)
-
- setData(icSigCopyrightTag, makeTextTag(copyrightNotice));
- setData(icSigProfileDescriptionTag, makeDescTag("Photo YCC"));
- this.profileID = ColorSpace.CS_PYCC;
- }
-} // class ICC_Profile
diff --git a/libjava/java/awt/color/ICC_ProfileGray.java b/libjava/java/awt/color/ICC_ProfileGray.java
deleted file mode 100644
index 3b5948dc8fc..00000000000
--- a/libjava/java/awt/color/ICC_ProfileGray.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/* ICC_ProfileGray.java -- the ICC profile for a Gray colorspace
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.color;
-
-/**
- * ICC_ProfileGray - a special case of ICC_Profiles.
- *
- * The ICC_Profile.getInstance() method will return an instance of the
- * ICC_ProfileGray subclass when all the following conditions are met:
- * The device color space of the profile is TYPE_GRAY.
- * The profile contains a gray TRCTag.
- * The profile contains a mediaWhitePointTag.
- *
- * As per the ICC specification, the color space conversion can then
- * be done through the following method:
- * linearGray = grayTRC[deviceGray]
- *
- * Note that if the profile contains a CLUT for the color space conversion,
- * it should be used instead, and the TRC information ignored.
- *
- * @author Sven de Marothy
- * @since 1.2
- */
-public class ICC_ProfileGray extends ICC_Profile
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -1124721290732002649L;
- private transient float[] whitePoint;
-
- /**
- * Package-private constructor used by ICC_ColorSpace for creating an
- * ICC_ProfileGray from a predefined ColorSpace (CS_GRAY)
- */
- ICC_ProfileGray(int cspace)
- {
- super(cspace);
- whitePoint = getXYZData(icSigMediaWhitePointTag);
- }
-
- /**
- * Package-private constructor used by ICC_ColorSpace for creating an
- * ICC_ProfileGray from profile data.
- */
- ICC_ProfileGray(byte[] data)
- {
- super(data);
- whitePoint = getXYZData(icSigMediaWhitePointTag);
- }
-
-
- /**
- * Returns the media white point of the profile.
- */
- public float[] getMediaWhitePoint()
- {
- float[] wp = new float[3];
- wp[0] = whitePoint[0];
- wp[1] = whitePoint[1];
- wp[2] = whitePoint[2];
- return wp;
- }
-
- /**
- * Returns the TRC gamma value.
- * @throws ProfileDataException if the TRC is described by a lookup
- * table and not a gamma value.
- */
- 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.");
-
- // convert the unsigned 7.8 fixed-point gamma to a float.
- double gamma = (double) (data[0] & (0xFFFF)) / 256.0;
- return (float) gamma;
- }
-
- /**
- * Returns the TRC lookup table.
- * @throws ProfileDataException if the TRC is described by a gamma value
- * and not a lookup table.
- */
- 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;
- }
-} // class ICC_ProfileGray
diff --git a/libjava/java/awt/color/ICC_ProfileRGB.java b/libjava/java/awt/color/ICC_ProfileRGB.java
deleted file mode 100644
index 00393328bbd..00000000000
--- a/libjava/java/awt/color/ICC_ProfileRGB.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/* ICC_ProfileRGB.java -- the ICC profile for a RGB colorspace
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.color;
-
-/**
- * ICC_ProfileRGB - a special case of ICC_Profiles.
- *
- * The ICC_Profile.getInstance() method will return an instance of the
- * ICC_ProfileRGB subclass when all the following conditions are met:
- * The device color space of the profile is TYPE_RGB.
- * The profile contains red, green and blue ColorantTags.
- * The profile contains red, green and blue TRCTags.
- * The profile contains a mediaWhitePointTag included.
- *
- * As per the ICC specification, the color space conversion can then
- * be done through the following method:
- * linearR = redTRC[deviceR]
- * linearG = greenTRC[deviceG]
- * linearB = blueTRC[deviceB]
- * TRC curves are either a single gamma value, or a 1-dimensional lookup table.
- *
- * Followed by the matrix transform:
- * PCS = M*linear
- *
- * Where PCS is the vector of profile color space (must be XYZ) coordinates,
- * linear is the vector of linear RGB coordinates, and the matrix M is
- * constructed from the ColorantTags, where the columns are red, green and
- * blue respectively, and the rows are X, Y and Z.
- *
- * Note that if the profile contains a CLUT for the color space conversion,
- * it should be used instead, and the TRC information ignored.
- *
- * @author Sven de Marothy
- * @since 1.2
- */
-public class ICC_ProfileRGB extends ICC_Profile
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 8505067385152579334L;
-
- public static final int REDCOMPONENT = 0;
-
- public static final int GREENCOMPONENT = 1;
-
- public static final int BLUECOMPONENT = 2;
-
- private transient float[][] matrix;
-
- private transient float[] gamma;
-
- private transient float[] whitePoint;
-
-
- /**
- * Package-private constructor used by ICC_ColorSpace for creating an
- * ICC_ProfileRGB from a predefined ColorSpace (CS_LINEAR_RGB and CS_sRGB)
- */
- ICC_ProfileRGB(int cspace)
- {
- super(cspace);
- matrix = createMatrix();
- whitePoint = getXYZData(icSigMediaWhitePointTag);
- }
-
- /**
- * Package-private constructor used by ICC_ColorSpace for creating an
- * ICC_ProfileRGB from profile data.
- */
- ICC_ProfileRGB(byte[] data)
- {
- super(data);
- matrix = createMatrix();
- whitePoint = getXYZData(icSigMediaWhitePointTag);
- }
-
- /**
- * Returns the media white point of the profile.
- */
- public float[] getMediaWhitePoint()
- {
- float[] wp = new float[3];
- wp[0] = whitePoint[0];
- wp[1] = whitePoint[1];
- wp[2] = whitePoint[2];
- return wp;
- }
-
- /**
- * Returns the colorant matrix of the conversion.
- */
- public float[][] getMatrix()
- {
- float[][] mat = new float[3][3];
- for (int i = 0; i < 3; i++)
- for (int j = 0; j < 3; j++)
- mat[i][j] = matrix[i][j];
- return mat;
- }
-
- /**
- * Returns the gamma value of a component
- * @throws ProfileDataException if the TRC is described by a lookup
- * table and not a gamma value.
- */
- public float getGamma(int component)
- {
- short[] data;
- switch (component)
- {
- case REDCOMPONENT:
- data = getCurve(icSigRedTRCTag);
- break;
- case GREENCOMPONENT:
- data = getCurve(icSigGreenTRCTag);
- break;
- case BLUECOMPONENT:
- data = getCurve(icSigBlueTRCTag);
- break;
- default:
- throw new IllegalArgumentException("Not a valid component");
- }
- if (data == null)
- throw new IllegalArgumentException("Error reading TRC");
-
- if (data.length != 1)
- throw new ProfileDataException("Not a single-gamma TRC");
-
- // convert the unsigned 7.8 fixed-point gamma to a float.
- float gamma = (float) (((int) data[0] & 0xFF00) >> 8);
- double fraction = ((int) data[0] & 0x00FF) / 256.0;
- gamma += (float) fraction;
- return gamma;
- }
-
- /**
- * Returns the TRC lookup table for a component
- * @throws ProfileDataException if the TRC is described by a gamma
- * value and not a lookup table.
- */
- public short[] getTRC(int component)
- {
- short[] data;
- switch (component)
- {
- case REDCOMPONENT:
- data = getCurve(icSigRedTRCTag);
- break;
- case GREENCOMPONENT:
- data = getCurve(icSigGreenTRCTag);
- break;
- case BLUECOMPONENT:
- data = getCurve(icSigBlueTRCTag);
- break;
- default:
- throw new IllegalArgumentException("Not a valid component");
- }
- if (data == null)
- throw new IllegalArgumentException("Error reading TRC");
-
- if (data.length <= 1)
- throw new ProfileDataException("Gamma value, not a TRC table.");
-
- return data;
- }
-
- /**
- * Creates the colorspace conversion matrix from the RGB tristimulus
- * values.
- */
- private float[][] createMatrix() throws IllegalArgumentException
- {
- float[][] mat = new float[3][3];
- float[] r;
- float[] g;
- float[] b;
- r = getXYZData(icSigRedColorantTag);
- g = getXYZData(icSigGreenColorantTag);
- b = getXYZData(icSigBlueColorantTag);
- if (r == null || g == null || b == null)
- throw new IllegalArgumentException("Error reading colorant tags!");
- for (int i = 0; i < 3; i++)
- {
- mat[i][0] = r[i];
- mat[i][1] = g[i];
- mat[i][2] = b[i];
- }
- return mat;
- }
-} // class ICC_ProfileRGB
diff --git a/libjava/java/awt/color/ProfileDataException.java b/libjava/java/awt/color/ProfileDataException.java
deleted file mode 100644
index 1af23b1835c..00000000000
--- a/libjava/java/awt/color/ProfileDataException.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ProfileDataException.java -- error in processing an ICC_Profile
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.color;
-
-/**
- * Thrown when there is an error accessing or processing an
- * ICC_Profile
.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @status updated to 1.4
- */
-public class ProfileDataException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 7286140888240322498L;
-
- /**
- * Create a new instance with a specified detailed error message.
- *
- * @param message the message
- */
- public ProfileDataException(String message)
- {
- super(message);
- }
-} // class ProfileDataException
diff --git a/libjava/java/awt/datatransfer/Clipboard.java b/libjava/java/awt/datatransfer/Clipboard.java
deleted file mode 100644
index 9953a724dba..00000000000
--- a/libjava/java/awt/datatransfer/Clipboard.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Clipboard.java -- Class for transferring data via cut and paste.
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-/**
- * This class allows data to be transferred using a cut and paste type
- * mechanism.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Clipboard
-{
- /**
- * The data being transferred.
- */
- protected Transferable contents;
-
- /**
- * The owner of this clipboard.
- */
- protected ClipboardOwner owner;
-
- // The clipboard name
- private String name;
-
- /**
- * Initializes a new instance of Clipboard
with the
- * specified name.
- *
- * @param name The clipboard name.
- */
- public Clipboard(String name)
- {
- this.name = name;
- }
-
- /**
- * Returns the name of the clipboard.
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Returns the contents of the clipboard.
- *
- * @param requestor The object requesting the contents.
- *
- * @exception IllegalStateException If the clipboard is currently unavailable
- */
- public synchronized Transferable getContents(Object requestor)
- {
- return contents;
- }
-
- /**
- * Sets the content and owner of this clipboard.
- * If the given owner is different from the current owner
- * then lostOwnership is called on the current owner.
- * XXX - is this called with the old or new contents.
- *
- * @param contents The new clipboard contents.
- * @param owner The new clipboard owner
- *
- * @exception IllegalStateException If the clipboard is currently unavailable
- */
- public synchronized void setContents(Transferable contents, ClipboardOwner owner)
- {
- if (this.owner != owner)
- if (this.owner != null)
- this.owner.lostOwnership(this, contents);
-
- this.owner = owner;
- this.contents = contents;
- }
-}
-
diff --git a/libjava/java/awt/datatransfer/ClipboardOwner.java b/libjava/java/awt/datatransfer/ClipboardOwner.java
deleted file mode 100644
index df758254a55..00000000000
--- a/libjava/java/awt/datatransfer/ClipboardOwner.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ClipboardOwner.java -- Interface for clipboard providers
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-/**
- * This interface is for classes that will own a clipboard object.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public interface ClipboardOwner
-{
- /**
- * This method is called to notify this object that it no longer
- * has ownership of the specified Clipboard
.
- *
- * @param clipboard The clipboard for which ownership was lost.
- * @param contents The contents of the clipboard which are no longer owned.
- */
- void lostOwnership (Clipboard clipboard, Transferable contents);
-}
-
diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java
deleted file mode 100644
index e5fbd240293..00000000000
--- a/libjava/java/awt/datatransfer/DataFlavor.java
+++ /dev/null
@@ -1,1034 +0,0 @@
-/* DataFlavor.java -- A type of data to transfer via the clipboard.
- Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-
-/**
- * This class represents a particular data format used for transferring
- * data via the clipboard.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class DataFlavor implements java.io.Externalizable, Cloneable
-{
- static final long serialVersionUID = 8367026044764648243L;
-
- // FIXME: Serialization: Need to write methods for.
-
-/**
- * This is the data flavor used for tranferring plain text. The MIME
- * type is "text/plain; charset=unicode". The representation class
- * is java.io.InputStream
.
- *
- * @deprecated The charset unicode is platform specific and InputStream
- * deals with bytes not chars. Use getRederForText()
.
- */
-public static final DataFlavor plainTextFlavor;
-
-/**
- * This is the data flavor used for transferring Java strings. The
- * MIME type is "application/x-java-serialized-object" and the
- * representation class is java.lang.String
.
- */
-public static final DataFlavor stringFlavor;
-
-/**
- * This is a data flavor used for transferring lists of files. The
- * representation type is a java.util.List
, with each element of
- * the list being a java.io.File
.
- */
-public static final DataFlavor javaFileListFlavor;
-
-/**
- * This is an image flavor used for transferring images. The
- * representation type is a java.awt.Image
.
- */
-public static final DataFlavor imageFlavor;
-
-/**
- * This is the MIME type used for transferring a serialized object.
- * The representation class is the type of object be deserialized.
- */
-public static final String javaSerializedObjectMimeType =
- "application/x-java-serialized-object";
-
-/**
- * This is the MIME type used to transfer a Java object reference within
- * the same JVM. The representation class is the class of the object
- * being transferred.
- */
-public static final String javaJVMLocalObjectMimeType =
- "application/x-java-jvm-local-objectref";
-
-/**
- * This is the MIME type used to transfer a link to a remote object.
- * The representation class is the type of object being linked to.
- */
-public static final String javaRemoteObjectMimeType =
- "application/x-java-remote-object";
-
-static
-{
- plainTextFlavor
- = new DataFlavor(java.io.InputStream.class,
- "text/plain; charset=unicode",
- "plain unicode text");
-
- stringFlavor
- = new DataFlavor(java.lang.String.class,
- "Java Unicode String");
-
- javaFileListFlavor
- = new DataFlavor(java.util.List.class,
- "Java File List");
-
- // javaFileListFlavor.mimeType = "application/x-java-file-list";
-
- imageFlavor
- = new DataFlavor(java.awt.Image.class,
- "Java Image");
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-// The MIME type for this flavor
-private final String mimeType;
-
-// The representation class for this flavor
-private final Class representationClass;
-
-// The human readable name of this flavor
-private String humanPresentableName;
-
-/*************************************************************************/
-
-/*
- * Static Methods
- */
-
-/**
- * This method attempts to load the named class. The following class
- * loaders are searched in order: the bootstrap class loader, the
- * system class loader, the context class loader (if it exists), and
- * the specified fallback class loader.
- *
- * @param className The name of the class to load.
- * @param classLoader The class loader to use if all others fail, which
- * may be null
.
- *
- * @exception ClassNotFoundException If the class cannot be loaded.
- */
-protected static final Class
-tryToLoadClass(String className, ClassLoader classLoader)
- throws ClassNotFoundException
-{
- try
- {
- return(Class.forName(className));
- }
- catch(Exception e) { ; }
- // Commented out for Java 1.1
- /*
- try
- {
- return(className.getClass().getClassLoader().findClass(className));
- }
- catch(Exception e) { ; }
-
- try
- {
- return(ClassLoader.getSystemClassLoader().findClass(className));
- }
- catch(Exception e) { ; }
- */
-
- // FIXME: What is the context class loader?
- /*
- try
- {
- }
- catch(Exception e) { ; }
- */
-
- if (classLoader != null)
- return(classLoader.loadClass(className));
- else
- throw new ClassNotFoundException(className);
-}
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Empty public constructor needed for externalization.
- * Should not be used for normal instantiation.
- */
-public
-DataFlavor()
-{
- mimeType = null;
- representationClass = null;
- humanPresentableName = null;
-}
-
-/*************************************************************************/
-
-/**
- * Private constructor.
- */
-private
-DataFlavor(Class representationClass,
- String mimeType,
- String humanPresentableName)
-{
- this.representationClass = representationClass;
- this.mimeType = mimeType;
- if (humanPresentableName != null)
- this.humanPresentableName = humanPresentableName;
- else
- this.humanPresentableName = mimeType;
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of DataFlavor
. The class
- * and human readable name are specified, the MIME type will be
- * "application/x-java-serialized-object". If the human readable name
- * is not specified (null
) then the human readable name
- * will be the same as the MIME type.
- *
- * @param representationClass The representation class for this object.
- * @param humanPresentableName The display name of the object.
- */
-public
-DataFlavor(Class representationClass, String humanPresentableName)
-{
- this(representationClass,
- "application/x-java-serialized-object"
- + "; class="
- + representationClass.getName(),
- humanPresentableName);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of DataFlavor
with the
- * specified MIME type and description. If the MIME type has a
- * "class=<rep class>" parameter then the representation class will
- * be the class name specified. Otherwise the class defaults to
- * java.io.InputStream
. If the human readable name
- * is not specified (null
) then the human readable name
- * will be the same as the MIME type.
- *
- * @param mimeType The MIME type for this flavor.
- * @param humanPresentableName The display name of this flavor.
- * @param classLoader The class loader for finding classes if the default
- * class loaders do not work.
- *
- * @exception IllegalArgumentException If the representation class
- * specified cannot be loaded.
- * @exception ClassNotFoundException If the class is not loaded.
- */
-public
-DataFlavor(String mimeType, String humanPresentableName,
- ClassLoader classLoader) throws ClassNotFoundException
-{
- this(getRepresentationClassFromMime(mimeType, classLoader),
- mimeType, humanPresentableName);
-}
-
-private static Class
-getRepresentationClassFromMime(String mimeString, ClassLoader classLoader)
-{
- String classname = getParameter("class", mimeString);
- if (classname != null)
- {
- try
- {
- return tryToLoadClass(classname, classLoader);
- }
- catch(Exception e)
- {
- throw new IllegalArgumentException("classname: " + e.getMessage());
- }
- }
- else
- {
- return java.io.InputStream.class;
- }
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of DataFlavor
with the
- * specified MIME type and description. If the MIME type has a
- * "class=<rep class>" parameter then the representation class will
- * be the class name specified. Otherwise the class defaults to
- * java.io.InputStream
. If the human readable name
- * is not specified (null
) then the human readable name
- * will be the same as the MIME type. This is the same as calling
- * new DataFlavor(mimeType, humanPresentableName, null)
.
- *
- * @param mimeType The MIME type for this flavor.
- * @param humanPresentableName The display name of this flavor.
- *
- * @exception IllegalArgumentException If the representation class
- * specified cannot be loaded.
- */
-public
-DataFlavor(String mimeType, String humanPresentableName)
-{
- this (getRepresentationClassFromMime (mimeType, null), humanPresentableName);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of DataFlavor
with the specified
- * MIME type. This type can have a "class=" parameter to specify the
- * representation class, and then the class must exist or an exception will
- * be thrown. If there is no "class=" parameter then the representation class
- * will be java.io.InputStream
. This is the same as calling
- * new DataFlavor(mimeType, null)
.
- *
- * @param mimeType The MIME type for this flavor.
- *
- * @exception IllegalArgumentException If a class is not specified in
- * the MIME type.
- * @exception ClassNotFoundException If the class cannot be loaded.
- */
-public
-DataFlavor(String mimeType) throws ClassNotFoundException
-{
- this(mimeType, null);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the MIME type of this flavor.
- *
- * @return The MIME type for this flavor.
- */
-public String
-getMimeType()
-{
- return(mimeType);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the representation class for this flavor.
- *
- * @return The representation class for this flavor.
- */
-public Class
-getRepresentationClass()
-{
- return(representationClass);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the human presentable name for this flavor.
- *
- * @return The human presentable name for this flavor.
- */
-public String
-getHumanPresentableName()
-{
- return(humanPresentableName);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the primary MIME type for this flavor.
- *
- * @return The primary MIME type for this flavor.
- */
-public String
-getPrimaryType()
-{
- int idx = mimeType.indexOf("/");
- if (idx == -1)
- return(mimeType);
-
- return(mimeType.substring(0, idx));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the MIME subtype for this flavor.
- *
- * @return The MIME subtype for this flavor.
- */
-public String
-getSubType()
-{
- int idx = mimeType.indexOf("/");
- if (idx == -1)
- return("");
-
- String subtype = mimeType.substring(idx + 1);
-
- idx = subtype.indexOf(" ");
- if (idx == -1)
- return(subtype);
- else
- return(subtype.substring(0, idx));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the value of the named MIME type parameter, or null
- * if the parameter does not exist. Given the parameter name and the mime
- * string.
- *
- * @param paramName The name of the parameter.
- * @param mimeString The mime string from where the name should be found.
- *
- * @return The value of the parameter or null.
- */
-private static String
-getParameter(String paramName, String mimeString)
-{
- int idx = mimeString.indexOf(paramName + "=");
- if (idx == -1)
- return(null);
-
- String value = mimeString.substring(idx + paramName.length() + 1);
-
- idx = value.indexOf(" ");
- if (idx == -1)
- return(value);
- else
- return(value.substring(0, idx));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the value of the named MIME type parameter, or null
- * if the parameter does not exist.
- *
- * @param paramName The name of the paramter.
- *
- * @return The value of the parameter.
- */
-public String
-getParameter(String paramName)
-{
- return getParameter(paramName, mimeType);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the human presentable name to the specified value.
- *
- * @param humanPresentableName The new display name.
- */
-public void
-setHumanPresentableName(String humanPresentableName)
-{
- this.humanPresentableName = humanPresentableName;
-}
-
-/*************************************************************************/
-
-/**
- * Tests the MIME type of this object for equality against the specified
- * MIME type.
- *
- * @param mimeType The MIME type to test against.
- *
- * @return true
if the MIME type is equal to this object's
- * MIME type, false
otherwise.
- *
- * @exception NullPointerException If mimeType is null.
- */
-public boolean
-isMimeTypeEqual(String mimeType)
-{
- // FIXME: Need to handle default attributes and parameters
-
- return(this.mimeType.equals(mimeType));
-}
-
-/*************************************************************************/
-
-/**
- * Tests the MIME type of this object for equality against the specified
- * data flavor's MIME type
- *
- * @param flavor The flavor to test against.
- *
- * @return true
if the flavor's MIME type is equal to this
- * object's MIME type, false
otherwise.
- */
-public final boolean
-isMimeTypeEqual(DataFlavor flavor)
-{
- return(isMimeTypeEqual(flavor.getMimeType()));
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this flavor represents a serialized object.
- *
- * @return true
if this flavor represents a serialized
- * object, false
otherwise.
- */
-public boolean
-isMimeTypeSerializedObject()
-{
- return(mimeType.startsWith(javaSerializedObjectMimeType));
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this flavor has a representation class of
- * java.io.InputStream
.
- *
- * @return true
if the representation class of this flavor
- * is java.io.InputStream
, false
otherwise.
- */
-public boolean
-isRepresentationClassInputStream()
-{
- return(representationClass.getName().equals("java.io.InputStream"));
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether the representation class for this flavor is
- * serializable.
- *
- * @return true
if the representation class is serializable,
- * false
otherwise.
- */
-public boolean
-isRepresentationClassSerializable()
-{
- Class[] interfaces = representationClass.getInterfaces();
-
- int i = 0;
- while (i < interfaces.length)
- {
- if (interfaces[i].getName().equals("java.io.Serializable"))
- return(true);
- ++i;
- }
-
- return(false);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether the representation class for his flavor is remote.
- *
- * @return true
if the representation class is remote,
- * false
otherwise.
- */
-public boolean
-isRepresentationClassRemote()
-{
- // FIXME: Implement
- throw new RuntimeException("Not implemented");
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this flavor represents a serialized object.
- *
- * @return true
if this flavor represents a serialized
- * object, false
otherwise.
- */
-public boolean
-isFlavorSerializedObjectType()
-{
- // FIXME: What is the diff between this and isMimeTypeSerializedObject?
- return(mimeType.startsWith(javaSerializedObjectMimeType));
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this flavor represents a remote object.
- *
- * @return true
if this flavor represents a remote object,
- * false
otherwise.
- */
-public boolean
-isFlavorRemoteObjectType()
-{
- return(mimeType.startsWith(javaRemoteObjectMimeType));
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this flavor represents a list of files.
- *
- * @return true
if this flavor represents a list of files,
- * false
otherwise.
- */
-public boolean
-isFlavorJavaFileListType()
-{
- if (this.mimeType.equals(javaFileListFlavor.mimeType) &&
- this.representationClass.equals(javaFileListFlavor.representationClass))
- return(true);
-
- return(false);
-}
-
-/*************************************************************************/
-
-/**
- * Returns a copy of this object.
- *
- * @return A copy of this object.
- *
- * @exception CloneNotSupportedException If the object's class does not support
- * the Cloneable interface. Subclasses that override the clone method can also
- * throw this exception to indicate that an instance cannot be cloned.
- */
-public Object clone () throws CloneNotSupportedException
-{
- try
- {
- return(super.clone());
- }
- catch(Exception e)
- {
- return(null);
- }
-}
-
-/*************************************************************************/
-
-/**
- * This method test the specified DataFlavor
for equality
- * against this object. This will be true if the MIME type and
- * representation type are the equal.
- *
- * @param flavor The DataFlavor
to test against.
- *
- * @return true
if the flavor is equal to this object,
- * false
otherwise.
- */
-public boolean
-equals(DataFlavor flavor)
-{
- if (flavor == null)
- return(false);
-
- if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase()))
- return(false);
-
- if (!this.representationClass.equals(flavor.representationClass))
- return(false);
-
- return(true);
-}
-
-/*************************************************************************/
-
-/**
- * This method test the specified Object
for equality
- * against this object. This will be true if the following conditions
- * are met:
- *
- *
- *
- * @param obj The null
.DataFlavor
.Object
to test against.
- *
- * @return true
if the flavor is equal to this object,
- * false
otherwise.
- */
-public boolean
-equals(Object obj)
-{
- if (!(obj instanceof DataFlavor))
- return(false);
-
- return(equals((DataFlavor)obj));
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not the specified string is equal to the MIME type
- * of this object.
- *
- * @param str The string to test against.
- *
- * @return true
if the string is equal to this object's MIME
- * type, false
otherwise.
- *
- * @deprecated Not compatible with hashCode()
.
- * Use isMimeTypeEqual()
- */
-public boolean
-equals(String str)
-{
- return(isMimeTypeEqual(str));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the hash code for this data flavor.
- * The hash code is based on the (lower case) mime type and the
- * representation class.
- */
-public int
-hashCode()
-{
- return(mimeType.toLowerCase().hashCode()^representationClass.hashCode());
-}
-
-/*************************************************************************/
-
-/**
- * Returns true
when the given DataFlavor
- * matches this one.
- */
-public boolean
-match(DataFlavor dataFlavor)
-{
- // XXX - How is this different from equals?
- return(equals(dataFlavor));
-}
-
-/*************************************************************************/
-
-/**
- * This method exists for backward compatibility. It simply returns
- * the same name/value pair passed in.
- *
- * @param name The parameter name.
- * @param value The parameter value.
- *
- * @return The name/value pair.
- *
- * @deprecated
- */
-protected String
-normalizeMimeTypeParameter(String name, String value)
-{
- return(name + "=" + value);
-}
-
-/*************************************************************************/
-
-/**
- * This method exists for backward compatibility. It simply returns
- * the MIME type string unchanged.
- *
- * @param type The MIME type.
- *
- * @return The MIME type.
- *
- * @deprecated
- */
-protected String
-normalizeMimeType(String type)
-{
- return(type);
-}
-
-/*************************************************************************/
-
-/**
- * Serialize this class.
- *
- * @param stream The ObjectOutput
stream to serialize to.
- *
- * @exception IOException If an error occurs.
- */
-public void
-writeExternal(ObjectOutput stream) throws IOException
-{
- // FIXME: Implement me
-}
-
-/*************************************************************************/
-
-/**
- * De-serialize this class.
- *
- * @param stream The ObjectInput
stream to deserialize from.
- *
- * @exception IOException If an error ocurs.
- * @exception ClassNotFoundException If the class for an object being restored
- * cannot be found.
- */
-public void
-readExternal(ObjectInput stream) throws IOException, ClassNotFoundException
-{
- // FIXME: Implement me
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this DataFlavor. Including the
- * representation class name, MIME type and human presentable name.
- */
-public String
-toString()
-{
- return("DataFlavor[representationClass="
- + representationClass.getName()
- + ",mimeType="
- + mimeType
- + "humanPresentableName="
- + humanPresentableName);
-}
-
-/*************************************************************************/
-
-/**
- * XXX - Currently returns plainTextFlavor
.
- */
-public static final DataFlavor
-getTextPlainUnicodeFlavor()
-{
- return(plainTextFlavor);
-}
-
-/*************************************************************************/
-
-/**
- * XXX - Currently returns java.io.InputStream
.
- *
- * @since 1.3
- */
-public final Class
-getDefaultRepresentationClass()
-{
- return(java.io.InputStream.class);
-}
-/*************************************************************************/
-
-/**
- * XXX - Currently returns java.io.InputStream
.
- */
-public final String
-getDefaultRepresentationClassAsString()
-{
- return(getDefaultRepresentationClass().getName());
-}
-
-/*************************************************************************/
-
-/**
- * Selects the best supported text flavor on this implementation.
- * Returns null
when none of the given flavors is liked.
- *
- * The DataFlavor
returned the first data flavor in the
- * array that has either a representation class which is (a subclass of)
- * Reader
or String
, or has a representation
- * class which is (a subclass of) InputStream
and has a
- * primary MIME type of "text" and has an supported encoding.
- */
-public static final DataFlavor
-selectBestTextFlavor(DataFlavor[] availableFlavors)
-{
- for(int i=0; iTransferable
.
- *
- * If the representation class is a (subclass of) Reader
- * then an instance of the representation class is returned. If the
- * representatation class is a String
then a
- * StringReader
is returned. And if the representation class
- * is a (subclass of) InputStream
and the primary MIME type
- * is "text" then a InputStreamReader
for the correct charset
- * encoding is returned.
- *
- * @param transferable The Transferable
for which a text
- * Reader
is requested.
- *
- * @exception IllegalArgumentException If the representation class is not one
- * of the seven listed above or the Transferable has null data.
- * @exception NullPointerException If the Transferable is null.
- * @exception UnsupportedFlavorException when the transferable doesn't
- * support this DataFlavor
. Or if the representable class
- * isn't a (subclass of) Reader
, String
,
- * InputStream
and/or the primary MIME type isn't "text".
- * @exception IOException when any IOException occurs.
- * @exception UnsupportedEncodingException if the "charset" isn't supported
- * on this platform.
- */
-public Reader getReaderForText(Transferable transferable)
- throws UnsupportedFlavorException, IOException
-{
- if (!transferable.isDataFlavorSupported(this))
- throw new UnsupportedFlavorException(this);
-
- if (Reader.class.isAssignableFrom(representationClass))
- return((Reader)transferable.getTransferData(this));
-
- if (String.class.isAssignableFrom(representationClass))
- return(new StringReader((String)transferable.getTransferData(this)));
-
- if (InputStream.class.isAssignableFrom(representationClass)
- && "text".equals(getPrimaryType()))
- {
- InputStream in = (InputStream)transferable.getTransferData(this);
- String encoding = getParameter("charset");
- if (encoding == null)
- encoding = "us-ascii";
- return(new InputStreamReader(in, encoding));
- }
-
- throw new UnsupportedFlavorException(this);
-}
-
- /**
- * Returns whether the representation class for this DataFlavor is
- * @see java.nio.ByteBuffer or a subclass thereof.
- *
- * @since 1.4
- */
- public boolean isRepresentationClassByteBuffer ()
- {
- return ByteBuffer.class.isAssignableFrom (representationClass);
- }
-
- /**
- * Returns whether the representation class for this DataFlavor is
- * @see java.nio.CharBuffer or a subclass thereof.
- *
- * @since 1.4
- */
- public boolean isRepresentationClassCharBuffer ()
- {
- return CharBuffer.class.isAssignableFrom (representationClass);
- }
-
- /**
- * Returns whether the representation class for this DataFlavor is
- * @see java.io.Reader or a subclass thereof.
- *
- * @since 1.4
- */
- public boolean isRepresentationClassReader ()
- {
- return Reader.class.isAssignableFrom (representationClass);
- }
-
-} // class DataFlavor
-
diff --git a/libjava/java/awt/datatransfer/FlavorMap.java b/libjava/java/awt/datatransfer/FlavorMap.java
deleted file mode 100644
index 59718c4513c..00000000000
--- a/libjava/java/awt/datatransfer/FlavorMap.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* FlavorMap.java -- Maps between flavor names and MIME types.
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-import java.util.Map;
-
-/**
- * This interface maps between native platform type names and DataFlavors.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public interface FlavorMap
-{
- /**
- * Maps the specified DataFlavor
objects to the native
- * data type name. The returned Map
has keys that are
- * the data flavors and values that are strings. The returned map
- * may be modified. This can be useful for implementing nested mappings.
- *
- * @param flavors An array of data flavors to map
- * or null for all data flavors.
- *
- * @return A Map
of native data types.
- */
- Map getNativesForFlavors (DataFlavor[] flavors);
-
- /**
- * Maps the specified native type names to DataFlavor
's.
- * The returned Map
has keys that are strings and values
- * that are DataFlavor
's. The returned map may be
- * modified. This can be useful for implementing nested mappings.
- *
- * @param natives An array of native types to map
- * or null for all native types.
- *
- * @return A Map
of data flavors.
- */
- Map getFlavorsForNatives (String[] natives);
-}
diff --git a/libjava/java/awt/datatransfer/FlavorTable.java b/libjava/java/awt/datatransfer/FlavorTable.java
deleted file mode 100644
index 11cdda06ca7..00000000000
--- a/libjava/java/awt/datatransfer/FlavorTable.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* FlavorTable.java -- A relaxed mapping between flavors
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-import java.util.List;
-
-/**
- * A FlavorMap which no longer requires a 1-to-1 mapping between flavors. Any
- * native can map to multiple flavors, and any flavor can map to multiple
- * natives; although the mappings are usually symmetric.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.4
- * @status updated to 1.4
- */
-public interface FlavorTable extends FlavorMap
-{
- /**
- * Returns a list of String natives corresponding to the given flavor. The
- * list should be sorted from best to worst. The list must be modifiable
- * without affecting this table.
- *
- * @param flavor the flavor to look up, or null to return all natives
- * @return the sorted list of natives
- */
- List getNativesForFlavor(DataFlavor flavor);
-
- /**
- * Returns a list of flavors corresponding to the given String native. The
- * list should be sorted from best to worst. The list must be modifiable
- * without affecting this table.
- *
- * @param name the native name to look up, or null to return all flavors
- * @return the sorted list of flavors
- */
- List getFlavorsForNative(String name);
-}
diff --git a/libjava/java/awt/datatransfer/MimeTypeParseException.java b/libjava/java/awt/datatransfer/MimeTypeParseException.java
deleted file mode 100644
index 6113ab760b8..00000000000
--- a/libjava/java/awt/datatransfer/MimeTypeParseException.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* MimeTypeParseException.java -- thrown when MIME string couldn't be parsed
- Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-/**
- * MIME string couldn't be parsed correctly.
- *
- * @author Mark Wielaard (mark@klomp.org)
- * @status updated to 1.4
- */
-public class MimeTypeParseException extends Exception
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -5604407764691570741L;
-
- /**
- * Create a new instance without any message.
- */
- public MimeTypeParseException()
- {
- }
-
- /**
- * Create a new instance with a specified detailed error message.
- *
- * @param message the message
- */
- public MimeTypeParseException(String message)
- {
- super(message);
- }
-} // class MimeTypeParseException
diff --git a/libjava/java/awt/datatransfer/StringSelection.java b/libjava/java/awt/datatransfer/StringSelection.java
deleted file mode 100644
index b74f2fa6418..00000000000
--- a/libjava/java/awt/datatransfer/StringSelection.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/* StringSelection.java -- Clipboard handler for text.
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-/**
- * This class transfers a string as plain text using the clipboard.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class StringSelection implements Transferable, ClipboardOwner
-{
-
-/*
- * Class Variables
- */
-
-// List of flavors we support
-// XXX: DataFlavor.plainTextFlavor is deprecated.
-static final DataFlavor[] supported_flavors
- = { DataFlavor.stringFlavor,
- DataFlavor.plainTextFlavor };
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-// This is the data to transfer
-private String data;
-
- /**
- * Transfer the specfied string as text.
- *
- * @param data the data for the string selection
- */
- public StringSelection(String data)
- {
- this.data = data;
- }
-
-/**
- * Returns a list of supported data flavors.
- *
- * @return A list of supported data flavors.
- */
-public DataFlavor[]
-getTransferDataFlavors()
-{
- return(supported_flavors);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not the specified data flavor is supported.
- *
- * @param flavor The data flavor to test.
- *
- * @return true
if the data flavor is supported,
- * false
otherwise.
- */
-public boolean
-isDataFlavorSupported(DataFlavor flavor)
-{
- for (int i = 0; i < supported_flavors.length; i++)
- if (supported_flavors[i].equals(flavor))
- return(true);
-
- return(false);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the data in the requested format.
- *
- * @param flavor The desired data flavor.
- *
- * @return The transferred data.
- *
- * @exception UnsupportedFlavorException If the specified flavor is not
- * supported.
- * @exception IOException If any other error occurs.
- */
-public Object
-getTransferData(DataFlavor flavor) throws UnsupportedFlavorException,
- IOException
-{
- if (!isDataFlavorSupported(flavor))
- throw new UnsupportedFlavorException(flavor);
-
- if (DataFlavor.plainTextFlavor == flavor)
- /* The behavior of this method for DataFlavor.plainTextFlavor and
- equivalent DataFlavors is inconsistent with the definition of
- DataFlavor.plainTextFlavor. We choose to do like Sun's implementation
- and return a Reader instead of an InputString. */
- /* return(new StringBufferInputStream(data)); */
- return(new StringReader(data));
- else // DataFlavor.stringFlavor
- return data;
-}
-
-/*************************************************************************/
-
-/**
- * Called when ownership of the clipboard object is lost.
- *
- * @param clipboard The affected clipboard.
- * @param contents The clipboard contents.
- */
-public void
-lostOwnership(Clipboard clipboard, Transferable contents)
-{
- // FIXME: What does this do?
-}
-
-} // class StringSelection
-
diff --git a/libjava/java/awt/datatransfer/SystemFlavorMap.java b/libjava/java/awt/datatransfer/SystemFlavorMap.java
deleted file mode 100644
index f6530f5117c..00000000000
--- a/libjava/java/awt/datatransfer/SystemFlavorMap.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/* SystemFlavorMap.java -- Maps between native flavor names and MIME types.
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class maps between native platform type names and DataFlavors.
- *
- * XXX - The current implementation does no mapping at all.
- *
- * @author Mark Wielaard (mark@klomp.org)
- *
- * @since 1.2
- */
-public final class SystemFlavorMap implements FlavorMap, FlavorTable
-{
- /**
- * The default (instance) flavor map.
- */
- private static FlavorMap defaultFlavorMap;
-
- /**
- * Private constructor.
- */
- private SystemFlavorMap ()
- {
- }
-
- /**
- * Maps the specified DataFlavor
objects to the native
- * data type name. The returned Map
has keys that are
- * the data flavors and values that are strings. The returned map
- * may be modified. This can be useful for implementing nested mappings.
- *
- * @param flavors An array of data flavors to map
- * or null for all data flavors.
- *
- * @return A Map
of native data types to data flavors.
- */
- public Map getNativesForFlavors (DataFlavor[] flavors)
- {
- return new HashMap();
- }
-
- /**
- * Maps the specified native type names to DataFlavor
's.
- * The returned Map
has keys that are strings and values
- * that are DataFlavor
's. The returned map may be
- * modified. This can be useful for implementing nested mappings.
- *
- * @param natives An array of native types to map
- * or null for all native types.
- *
- * @return A Map
of data flavors to native type names.
- */
- public Map getFlavorsForNatives (String[] natives)
- {
- return new HashMap();
- }
-
- /**
- * Returns the default (instance) (System)FlavorMap.
- */
- public static FlavorMap getDefaultFlavorMap ()
- {
- if (defaultFlavorMap == null)
- defaultFlavorMap = new SystemFlavorMap ();
-
- return defaultFlavorMap;
- }
-
- /**
- * Returns the native type name for the given java mime type.
- */
- public static String encodeJavaMIMEType (String mime)
- {
- return null;
- }
-
- /**
- * Returns the native type name for the given data flavor.
- */
- public static String encodeDataFlavor (DataFlavor df)
- {
- return null;
- }
-
- /**
- * Returns true if the native type name can be represented as
- * a java mime type.
- */
- public static boolean isJavaMIMEType (String name)
- {
- return false;
- }
-
- /**
- * Returns the java mime type for the given the native type name.
- */
- public static String decodeJavaMIMEType (String name)
- {
- return null;
- }
-
- /**
- * Returns the data flavor given the native type name
- * or null when no such data flavor exists.
- */
- public static DataFlavor decodeDataFlavor (String name)
- throws ClassNotFoundException
- {
- String javaMIMEType = decodeJavaMIMEType (name);
-
- if (javaMIMEType != null)
- return new DataFlavor (javaMIMEType);
- else
- return null;
- }
-
- public List getFlavorsForNative (String nat)
- {
- throw new Error ("Not implemented");
- }
-
- public List getNativesForFlavor (DataFlavor flav)
- {
- throw new Error ("Not implemented");
- }
-
-} // class SystemFlavorMap
diff --git a/libjava/java/awt/datatransfer/Transferable.java b/libjava/java/awt/datatransfer/Transferable.java
deleted file mode 100644
index 80753923618..00000000000
--- a/libjava/java/awt/datatransfer/Transferable.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Transferable.java -- Data transfer source
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-import java.io.IOException;
-
-/**
- * This interface is implemented by classes that can transfer data.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public interface Transferable
-{
- /**
- * This method returns a list of available data flavors for the data being
- * transferred. The array returned will be sorted from most preferred
- * flavor at the beginning to least preferred at the end.
- *
- * @return adA list of data flavors for this data
- */
- DataFlavor[] getTransferDataFlavors();
-
- /**
- * Tests whether or not this data can be delivered in the specified data
- * flavor.
- *
- * @param flavor the data flavor to test
- * @return true if the data flavor is supported
- */
- boolean isDataFlavorSupported(DataFlavor flavor);
-
- /**
- * Returns the data in the specified DataFlavor
.
- *
- * @param flavor the data flavor to return
- * @return the data in the appropriate flavor
- * @throws UnsupportedFlavorException if the flavor is not supported
- * @throws IOException if the data is not available
- * @see DataFlavor#getRepresentationClass
- */
- Object getTransferData(DataFlavor flavor)
- throws UnsupportedFlavorException, IOException;
-
-} // interface Transferable
-
diff --git a/libjava/java/awt/datatransfer/UnsupportedFlavorException.java b/libjava/java/awt/datatransfer/UnsupportedFlavorException.java
deleted file mode 100644
index 1c1da0348c3..00000000000
--- a/libjava/java/awt/datatransfer/UnsupportedFlavorException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* UnsupportedFlavorException.java -- ata flavor is not valid
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.datatransfer;
-
-/**
- * The data flavor requested is not supported for the transfer data.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see Transferable#getTransferData(DataFlavor)
- * @status updated to 1.4
- */
-public class UnsupportedFlavorException extends Exception
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 5383814944251665601L;
-
- /**
- * Initializes a new instance of UnsupportedDataFlavor
- * for the specified data flavor.
- *
- * @param flavor the data flavor that is not supported
- */
- public UnsupportedFlavorException(DataFlavor flavor)
- {
- super(flavor == null ? null : flavor.getHumanPresentableName());
- }
-} // class UnsupportedFlavorException
diff --git a/libjava/java/awt/dnd/Autoscroll.java b/libjava/java/awt/dnd/Autoscroll.java
deleted file mode 100644
index ba4d4476cfc..00000000000
--- a/libjava/java/awt/dnd/Autoscroll.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Autoscroll.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Insets;
-import java.awt.Point;
-
-/**
- * During DnD operations it is possible that a user may wish to drop the
- * subject of the operation on a region of a scrollable GUI control that
- * is not currently visible to the user.
- *
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.2
- * @status updated to 1.4
- */
-public interface Autoscroll
-{
- /**
- * This method returns the Insets describing the autoscrolling region or
- * border relative to the geometry of the implementing Component
- */
- Insets getAutoscrollInsets ();
-
- /**
- * Notify the Component to autoscroll
- *
- * @param location A Point indicating the location of the cursor that
- * triggered this operation
- */
- void autoscroll (Point location);
-
-} // interface Autoscroll
-
diff --git a/libjava/java/awt/dnd/DnDConstants.java b/libjava/java/awt/dnd/DnDConstants.java
deleted file mode 100644
index 85c9c0528e6..00000000000
--- a/libjava/java/awt/dnd/DnDConstants.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* DnDConstants.java -- constants for drag-and-drop operations
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-/**
- * This class contains various constants used in drag-and-drop operations.
- * Why it is not an interface is beyond me.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public final class DnDConstants
-{
- /** No action takes place. */
- public static final int ACTION_NONE = 0;
-
- /** The copy action. */
- public static final int ACTION_COPY = 1;
-
- /** The move action. */
- public static final int ACTION_MOVE = 2;
-
- /** Either a copy or a move. */
- public static final int ACTION_COPY_OR_MOVE = 3;
-
- /**
- * A link action. This does not copy or move, but creates a reference back
- * to the original. However, since platforms differ on how a reference should
- * behave, this action is not recommended for common use.
- */
- public static final int ACTION_LINK = 1073741824;
-
- /** A synonym for {@link #ACTION_LINK}. */
- public static final int ACTION_REFERENCE = ACTION_LINK;
-
- private DnDConstants()
- {
- // Do nothing here.
- }
-}
diff --git a/libjava/java/awt/dnd/DnDEventMulticaster.java b/libjava/java/awt/dnd/DnDEventMulticaster.java
deleted file mode 100644
index d9f5ec00f1d..00000000000
--- a/libjava/java/awt/dnd/DnDEventMulticaster.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* DnDEventMulticaster.java -- helper class for listener chains in java.awt.dnd
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.AWTEventMulticaster;
-import java.util.EventListener;
-
-class DnDEventMulticaster extends AWTEventMulticaster
-{
- protected DnDEventMulticaster (EventListener a, EventListener b)
- {
- super (a, b);
- }
-
- public static DragSourceListener add (DragSourceListener a,
- DragSourceListener b)
- {
- return (DragSourceListener) addInternal (a, b);
- }
-
- public static DragSourceMotionListener add (DragSourceMotionListener a,
- DragSourceMotionListener b)
- {
- return (DragSourceMotionListener) addInternal (a, b);
- }
-
- public static DragSourceListener remove (DragSourceListener a,
- DragSourceListener b)
- {
- return (DragSourceListener) removeInternal (a, b);
- }
-
- public static DragSourceMotionListener remove (DragSourceMotionListener a,
- DragSourceMotionListener b)
- {
- return (DragSourceMotionListener) removeInternal (a, b);
- }
-}
diff --git a/libjava/java/awt/dnd/DragGestureEvent.java b/libjava/java/awt/dnd/DragGestureEvent.java
deleted file mode 100644
index 9f2bc7c98b8..00000000000
--- a/libjava/java/awt/dnd/DragGestureEvent.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/* DragGestureEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.datatransfer.Transferable;
-import java.awt.event.InputEvent;
-import java.util.EventObject;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * STUBBED
- * @see DragGestureRecognizer
- * @see DragGestureListener
- * @see DragSource
- * @since 1.2
- */
-public class DragGestureEvent extends EventObject
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 9080172649166731306L;
-
- private DragSource dragSource;
- private Component component;
- private final Point origin;
- private final int action;
-
- public DragGestureEvent(DragGestureRecognizer dgr, int action, Point origin,
- List events)
- {
- super(dgr);
- if (origin == null || events == null)
- throw new IllegalArgumentException();
- this.origin = origin;
- this.action = action;
- }
-
- public DragGestureRecognizer getSourceAsDragGestureRecognizer()
- {
- return (DragGestureRecognizer) source;
- }
- public Component getComponent()
- {
- return null;
- }
- public DragSource getDragSource()
- {
- return null;
- }
- public Point getDragOrigin()
- {
- return origin;
- }
- public Iterator iterator()
- {
- return null;
- }
- public Object[] toArray()
- {
- return null;
- }
- public Object[] toArray(Object[] array)
- {
- return array;
- }
- public int getDragAction()
- {
- return 0;
- }
- public InputEvent getTriggerEvent()
- {
- return null;
- }
-
- /**
- * Starts the drag given the initial Cursor to display, the Transferable
- * object, and the DragSourceListener to use.
- *
- * @exception InvalidDnDOperationException If the Drag and Drop system is
- * unable to initiate a drag operation, or if the user attempts to start
- * a drag while an existing drag operation is still executing.
- */
- public void startDrag(Cursor dragCursor, Transferable trans)
- {
- startDrag(dragCursor, null, null, trans, null);
- }
-
- /**
- * Starts the drag given the initial Cursor to display, the Transferable
- * object, and the DragSourceListener to use.
- *
- * @exception InvalidDnDOperationException If the Drag and Drop system is
- * unable to initiate a drag operation, or if the user attempts to start
- * a drag while an existing drag operation is still executing.
- */
- public void startDrag(Cursor dragCursor, Transferable trans,
- DragSourceListener l)
- {
- startDrag(dragCursor, null, null, trans, l);
- }
-
- /**
- * Starts the drag given the initial Cursor to display, the Transferable
- * object, and the DragSourceListener to use.
- *
- * @exception InvalidDnDOperationException If the Drag and Drop system is
- * unable to initiate a drag operation, or if the user attempts to start
- * a drag while an existing drag operation is still executing.
- */
- public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset,
- Transferable trans, DragSourceListener l)
- {
- }
-} // class DragGestureEvent
diff --git a/libjava/java/awt/dnd/DragGestureListener.java b/libjava/java/awt/dnd/DragGestureListener.java
deleted file mode 100644
index e8befe80f19..00000000000
--- a/libjava/java/awt/dnd/DragGestureListener.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* DragGestureListener.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.util.EventListener;
-
-/**
- * This is a listener for starting a drag-and-drop gesture. Upon receiving
- * notification, the implementor then starts the drag operation.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see DragGestureRecognizer
- * @see DragGestureEvent
- * @see DragSource
- * @since 1.2
- * @status updated to 1.4
- */
-public interface DragGestureListener extends EventListener
-{
- /**
- * Called when the native platform notifies the virtual machine that a
- * drag-and-drop has been initiated.
- *
- * @param e the event
- */
- void dragGestureRecognized(DragGestureEvent e);
-} // interface DragGestureListener
diff --git a/libjava/java/awt/dnd/DragGestureRecognizer.java b/libjava/java/awt/dnd/DragGestureRecognizer.java
deleted file mode 100644
index 07b822e7a68..00000000000
--- a/libjava/java/awt/dnd/DragGestureRecognizer.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/* DragGestureRecognizer.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Component;
-import java.awt.Point;
-import java.awt.event.InputEvent;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.TooManyListenersException;
-
-/**
- * STUBBED
- * @since 1.2
- */
-public abstract class DragGestureRecognizer implements Serializable
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 8996673345831063337L;
-
- protected DragSource dragSource;
- protected Component component;
- protected transient DragGestureListener dragGestureListener;
- protected int sourceActions;
- protected ArrayList events = new ArrayList();
-
- protected DragGestureRecognizer(DragSource ds, Component c, int sa,
- DragGestureListener dgl)
- {
- if (ds == null)
- throw new IllegalArgumentException();
- dragSource = ds;
- component = c;
- sourceActions = sa;
- dragGestureListener = dgl;
- }
-
- protected DragGestureRecognizer(DragSource ds, Component c, int sa)
- {
- this(ds, c, sa, null);
- }
-
- protected DragGestureRecognizer(DragSource ds, Component c)
- {
- this(ds, c, 0, null);
- }
-
- protected DragGestureRecognizer(DragSource ds)
- {
- this(ds, null, 0, null);
- }
-
- protected abstract void registerListeners();
-
- protected abstract void unregisterListeners();
-
- public DragSource getDragSource()
- {
- return dragSource;
- }
-
- public Component getComponent()
- {
- return component;
- }
-
- public void setComponent(Component c)
- {
- component = c;
- }
-
- public int getSourceActions()
- {
- return sourceActions;
- }
-
- public void setSourceActions(int sa)
- {
- sourceActions = sa;
- }
-
- public InputEvent getTriggerEvent()
- {
- return events.size() > 0 ? (InputEvent) events.get(0) : null;
- }
-
- public void resetRecognizer()
- {
- throw new Error("not implemented");
- }
-
- /**
- * Register a new DragGestureListener.
- *
- * @exception TooManyListenersException If a DragGestureListener has already
- * been added.
- */
- public void addDragGestureListener(DragGestureListener dgl)
- throws TooManyListenersException
- {
- if (dragGestureListener != null)
- throw new TooManyListenersException();
- dragGestureListener = dgl;
- }
-
- public void removeDragGestureListener(DragGestureListener dgl)
- {
- if (dragGestureListener != dgl)
- throw new IllegalArgumentException();
- dragGestureListener = null;
- }
-
- protected void fireDragGestureRecognized(int dragAction, Point p)
- {
- throw new Error("not implemented");
- }
-
- protected void appendEvent(InputEvent e)
- {
- if (e == null)
- return;
- events.add(e);
- }
-
- private void readObject(ObjectInputStream s)
- throws ClassNotFoundException, IOException
- {
- s.defaultReadObject();
- dragGestureListener = (DragGestureListener) s.readObject();
- }
-
- private void writeObject(ObjectOutputStream s) throws IOException
- {
- s.defaultWriteObject();
- s.writeObject(dragGestureListener instanceof Serializable
- ? dragGestureListener : null);
- }
-} // class DragGestureRecognizer
diff --git a/libjava/java/awt/dnd/DragSource.java b/libjava/java/awt/dnd/DragSource.java
deleted file mode 100644
index 13ffc961510..00000000000
--- a/libjava/java/awt/dnd/DragSource.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/* DragSource.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.GraphicsEnvironment;
-import java.awt.HeadlessException;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.Toolkit;
-import java.awt.datatransfer.FlavorMap;
-import java.awt.datatransfer.SystemFlavorMap;
-import java.awt.datatransfer.Transferable;
-import java.awt.dnd.peer.DragSourceContextPeer;
-import java.io.Serializable;
-import java.util.EventListener;
-
-/**
- * @since 1.2
- */
-public class DragSource implements Serializable
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 6236096958971414066L;
-
- public static final Cursor DefaultCopyDrop = null;
- public static final Cursor DefaultMoveDrop = null;
- public static final Cursor DefaultLinkDrop = null;
- public static final Cursor DefaultCopyNoDrop = null;
- public static final Cursor DefaultMoveNoDrop = null;
- public static final Cursor DefaultLinkNoDrop = null;
-
- private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap ();
-
- private transient DragSourceListener dragSourceListener;
- private transient DragSourceMotionListener dragSourceMotionListener;
-
- /**
- * Initializes the drag source.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public DragSource()
- {
- if (GraphicsEnvironment.isHeadless())
- throw new HeadlessException ();
- }
-
- /**
- * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- */
- public static DragSource getDefaultDragSource()
- {
- return null;
- }
-
- public static boolean isDragImageSupported()
- {
- return false;
- }
-
- /**
- * Start a drag, given the DragGestureEvent that initiated the drag.
- *
- * @exception InvalidDnDOperationException If the Drag and Drop system is
- * unable to initiate a drag operation, or if the user attempts to start
- * a drag while an existing drag operation is still executing.
- */
- public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
- Image dragImage, Point imageOffset,
- Transferable trans, DragSourceListener dsl,
- FlavorMap map)
- {
- }
-
- /**
- * Start a drag, given the DragGestureEvent that initiated the drag.
- *
- * @exception InvalidDnDOperationException If the Drag and Drop system is
- * unable to initiate a drag operation, or if the user attempts to start
- * a drag while an existing drag operation is still executing.
- */
- public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
- Transferable trans, DragSourceListener dsl,
- FlavorMap map)
- {
- startDrag(trigger, dragCursor, null, null, trans, dsl, map);
- }
-
- /**
- * Start a drag, given the DragGestureEvent that initiated the drag.
- *
- * @exception InvalidDnDOperationException If the Drag and Drop system is
- * unable to initiate a drag operation, or if the user attempts to start
- * a drag while an existing drag operation is still executing.
- */
- public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
- Image dragImage, Point imageOffset,
- Transferable trans, DragSourceListener dsl)
- {
- startDrag(trigger, dragCursor, dragImage, imageOffset, trans, dsl, null);
- }
-
- /**
- * Start a drag, given the DragGestureEvent that initiated the drag.
- *
- * @exception InvalidDnDOperationException If the Drag and Drop system is
- * unable to initiate a drag operation, or if the user attempts to start
- * a drag while an existing drag operation is still executing.
- */
- public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
- Transferable trans, DragSourceListener dsl)
- {
- startDrag(trigger, dragCursor, null, null, trans, dsl, null);
- }
-
- /**
- * Creates the DragSourceContext to handle this drag.
- *
- * @exception IllegalArgumentException FIXME
- * @exception NullPointerException If dscp, dgl, dragImage or t is null.
- */
- protected DragSourceContext
- createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
- Cursor cursor, Image image, Point offset,
- Transferable t, DragSourceListener dsl)
- {
- return null;
- }
-
- public FlavorMap getFlavorMap()
- {
- return flavorMap;
- }
-
- public DragGestureRecognizer
- createDragGestureRecognizer(Class recognizer, Component c, int actions,
- DragGestureListener dgl)
- {
- return Toolkit.getDefaultToolkit ()
- .createDragGestureRecognizer (recognizer, this, c, actions,
- dgl);
- }
-
- public DragGestureRecognizer
- createDefaultDragGestureRecognizer(Component c, int actions,
- DragGestureListener dgl)
- {
- return createDragGestureRecognizer (MouseDragGestureRecognizer.class, c,
- actions, dgl);
- }
-
- /**
- * @since 1.4
- */
- public void addDragSourceListener(DragSourceListener l)
- {
- DnDEventMulticaster.add (dragSourceListener, l);
- }
-
- /**
- * @since 1.4
- */
- public void removeDragSourceListener(DragSourceListener l)
- {
- DnDEventMulticaster.remove (dragSourceListener, l);
- }
-
- /**
- * @since 1.4
- */
- public DragSourceListener[] getDragSourceListeners()
- {
- return (DragSourceListener[]) getListeners (DragSourceListener.class);
- }
-
- /**
- * @since 1.4
- */
- public void addDragSourceMotionListener(DragSourceMotionListener l)
- {
- DnDEventMulticaster.add (dragSourceMotionListener, l);
- }
-
- /**
- * @since 1.4
- */
- public void removeDragSourceMotionListener(DragSourceMotionListener l)
- {
- DnDEventMulticaster.remove (dragSourceMotionListener, l);
- }
-
- /**
- * @since 1.4
- */
- public DragSourceMotionListener[] getDragSourceMotionListeners ()
- {
- return (DragSourceMotionListener[]) getListeners
- (DragSourceMotionListener.class);
- }
-
- /**
- * @since 1.4
- */
- public EventListener[] getListeners (Class listenerType)
- {
- if (listenerType == DragSourceListener.class)
- return DnDEventMulticaster.getListeners (dragSourceListener,
- listenerType);
-
- if (listenerType == DragSourceMotionListener.class)
- return DnDEventMulticaster.getListeners (dragSourceMotionListener,
- listenerType);
-
- // Return an empty EventListener array.
- return new EventListener [0];
- }
-} // class DragSource
diff --git a/libjava/java/awt/dnd/DragSourceAdapter.java b/libjava/java/awt/dnd/DragSourceAdapter.java
deleted file mode 100644
index 90d9a698347..00000000000
--- a/libjava/java/awt/dnd/DragSourceAdapter.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* DragSourceAdapter.java -- drag-and-drop listener adapter
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-/**
- * This class implements DragSourceListener
and
- * DragSourceMotionListener
, and implements all methods
- * with empty bodies. This allows a listener interested in implementing only
- * a subset of these interfaces to extend this class and override only the
- * desired methods.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see DragSourceEvent
- * @see DragSourceListener
- * @see DragSourceMotionListener
- * @since 1.4
- * @status updated to 1.4
- */
-public abstract class DragSourceAdapter
- implements DragSourceListener, DragSourceMotionListener
-{
- /**
- * Default constructor.
- */
- public DragSourceAdapter()
- {
- }
-
- /**
- * Called when the cursor hotspot enters a drop site which will accept the
- * drag.
- *
- * @param e the event
- */
- public void dragEnter(DragSourceDragEvent e)
- {
- }
-
- /**
- * Called when the cursor hotspot moves inside of a drop site which will
- * accept the drag.
- *
- * @param e the event
- */
- public void dragOver(DragSourceDragEvent e)
- {
- }
-
- /**
- * Called whenever the mouse is moved during a drag-and-drop operation.
- *
- * @param e the event
- */
- public void dragMouseMoved(DragSourceDragEvent e)
- {
- }
-
- /**
- * Called when the user modifies the drop gesture. This is often the case
- * when additional mouse or key events are received during the drag.
- *
- * @param e the event
- */
- public void dropActionChanged(DragSourceDragEvent e)
- {
- }
-
- /**
- * Called when the cursor hotspot moves outside of a drop site which will
- * accept the drag. This could also happen if the drop site is no longer
- * active, or no longer accepts the drag.
- *
- * @param e the event
- */
- public void dragExit(DragSourceEvent e)
- {
- }
-
- /**
- * Called when the drag and drop operation is complete. After this event,
- * getDropSuccess
of the event is valid, and
- * getDropAction
holds the action requested by the drop site.
- * Furthermore, the DragSourceContext
is invalidated.
- *
- * @param e the event
- */
- public void dragDropEnd(DragSourceDropEvent e)
- {
- }
-} // class DragSourceAdapter
diff --git a/libjava/java/awt/dnd/DragSourceContext.java b/libjava/java/awt/dnd/DragSourceContext.java
deleted file mode 100644
index 2cf0d6d0bc9..00000000000
--- a/libjava/java/awt/dnd/DragSourceContext.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/* DragSourceContext.java --
- Copyright (C) 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.datatransfer.Transferable;
-import java.awt.dnd.peer.DragSourceContextPeer;
-import java.io.Serializable;
-import java.util.TooManyListenersException;
-
-/**
- * @since 1.2
- */
-public class DragSourceContext
- implements DragSourceListener, DragSourceMotionListener, Serializable
-{
- /**
- * Compatible with JDK 1.2+
- */
- static final long serialVersionUID = -115407898692194719L;
-
- protected static final int DEFAULT = 0;
- protected static final int ENTER = 1;
- protected static final int OVER = 2;
- protected static final int CHANGED = 3;
-
- private DragSourceContextPeer peer;
- private Cursor cursor;
- private Transferable transferable;
- private DragGestureEvent trigger;
- private DragSourceListener dragSourceListener;
- private boolean useCustomCursor; // FIXME: currently unused but needed for serialization.
- private int sourceActions; // FIXME: currently unused but needed for serialization.
- private Image image;
- private Point offset;
-
- /**
- * Initializes a drag source context.
- *
- * @exception IllegalArgumentException If Component or DragSource of trigger
- * are null, the drag action for the trigger event is DnDConstants.ACTION_NONE
- * or if the source actions for the DragGestureRecognizer associated with the
- * trigger event are equal to DnDConstants.ACTION_NONE.
- * @exception NullPointerException If peer or trigger is null.
- */
- public DragSourceContext (DragSourceContextPeer peer,
- DragGestureEvent trigger, Cursor cursor,
- Image image, Point offset, Transferable trans,
- DragSourceListener dsl)
- {
- if (peer == null
- || trigger == null)
- throw new NullPointerException ();
-
- if (trigger.getComponent () == null
- || trigger.getDragSource () == null
- || trigger.getDragAction () == DnDConstants.ACTION_NONE
- || trigger.getSourceAsDragGestureRecognizer ()
- .getSourceActions () == DnDConstants.ACTION_NONE)
- throw new IllegalArgumentException ();
-
- this.peer = peer;
- this.trigger = trigger;
- this.cursor = cursor;
- this.image = image;
- this.offset = offset;
- this.transferable = trans;
- this.dragSourceListener = dsl;
-
- throw new Error ("not implemented");
- }
-
- public DragSource getDragSource()
- {
- return trigger.getDragSource ();
- }
-
- public Component getComponent()
- {
- return trigger.getComponent ();
- }
-
- public DragGestureEvent getTrigger()
- {
- return trigger;
- }
-
- public int getSourceActions()
- {
- return trigger.getSourceAsDragGestureRecognizer ().getSourceActions ();
- }
-
- public void setCursor (Cursor cursor)
- {
- this.cursor = cursor;
- // FIXME: Check if we need to do more here
- }
-
- public Cursor getCursor()
- {
- return cursor;
- }
-
- /**
- * Adds a DragSourceListener
.
- *
- * @exception TooManyListenersException If a DragSourceListener
- * has already been added.
- */
- public void addDragSourceListener (DragSourceListener dsl)
- throws TooManyListenersException
- {
- if (dragSourceListener != null)
- throw new TooManyListenersException ();
-
- dragSourceListener = dsl;
- }
-
- public void removeDragSourceListener (DragSourceListener dsl)
- {
- if (dragSourceListener == dsl)
- dragSourceListener = null;
- }
-
- public void transferablesFlavorsChanged()
- {
- }
-
- public void dragEnter(DragSourceDragEvent e)
- {
- }
-
- public void dragOver(DragSourceDragEvent e)
- {
- }
-
- public void dragExit(DragSourceEvent e)
- {
- }
-
- public void dropActionChanged(DragSourceDragEvent e)
- {
- }
-
- public void dragDropEnd(DragSourceDropEvent e)
- {
- }
-
- public void dragMouseMoved(DragSourceDragEvent e)
- {
- }
-
- public Transferable getTransferable()
- {
- return transferable;
- }
-
- protected void updateCurrentCursor(int dropOp, int targetAct, int status)
- {
- }
-} // class DragSourceContext
diff --git a/libjava/java/awt/dnd/DragSourceDragEvent.java b/libjava/java/awt/dnd/DragSourceDragEvent.java
deleted file mode 100644
index 511700b616d..00000000000
--- a/libjava/java/awt/dnd/DragSourceDragEvent.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* DragSourceDragEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import gnu.java.awt.EventModifier;
-
-/**
- * @author Michael Koch
- * @since 1.2
- */
-public class DragSourceDragEvent extends DragSourceEvent
-{
- /**
- * Compatible with JDK 1.2+
- */
- private static final long serialVersionUID = 481346297933902471L;
-
- private final int dropAction;
- private final int targetActions;
- private final int gestureModifiers;
-
- public DragSourceDragEvent(DragSourceContext context, int dropAction,
- int actions, int modifiers)
- {
- super(context);
- this.dropAction = dropAction;
- targetActions = actions;
- gestureModifiers = EventModifier.extend(modifiers);
- }
-
- public DragSourceDragEvent(DragSourceContext context, int dropAction,
- int actions, int modifiers, int x, int y)
- {
- super(context, x, y);
- this.dropAction = dropAction;
- targetActions = actions;
- gestureModifiers = EventModifier.extend(modifiers);
- }
-
- public int getTargetActions()
- {
- return targetActions;
- }
-
- public int getGestureModifiers()
- {
- return EventModifier.revert(gestureModifiers);
- }
-
- public int getGestureModifiersEx()
- {
- return gestureModifiers;
- }
-
- public int getUserAction()
- {
- return dropAction;
- }
-
- public int getDropAction()
- {
- return (dropAction
- & targetActions
- & ((DragSourceContext) source).getSourceActions());
- }
-} // class DragSourceDragEvent
diff --git a/libjava/java/awt/dnd/DragSourceDropEvent.java b/libjava/java/awt/dnd/DragSourceDropEvent.java
deleted file mode 100644
index 7621262d839..00000000000
--- a/libjava/java/awt/dnd/DragSourceDropEvent.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* DragSourceDragEvent.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.dnd;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.2
- *
- * Written using JDK 1.4.1 Online API
- * Status: JDK 1.4 complete
- */
-public class DragSourceDropEvent extends DragSourceEvent
-{
- /**
- * Compatible with JDK 1.2+
- */
- private static final long serialVersionUID = -5571321229470821891L;
-
- private final int dropAction;
- private final boolean dropSuccess;
-
- public DragSourceDropEvent (DragSourceContext context)
- {
- super (context);
- this.dropAction = 0;
- this.dropSuccess = false;
- }
-
- public DragSourceDropEvent (DragSourceContext context, int dropAction,
- boolean dropSuccess)
- {
- super (context);
- this.dropAction = dropAction;
- this.dropSuccess = dropSuccess;
- }
-
- public DragSourceDropEvent (DragSourceContext context, int dropAction,
- boolean dropSuccess, int x, int y)
- {
- super (context, x, y);
- this.dropAction = dropAction;
- this.dropSuccess = dropSuccess;
- }
-
- public int getDropAction()
- {
- return dropAction & ((DragSourceContext) source).getSourceActions();
- }
-
- public boolean getDropSuccess()
- {
- return dropSuccess;
- }
-} // class DragSourceDropEvent
diff --git a/libjava/java/awt/dnd/DragSourceEvent.java b/libjava/java/awt/dnd/DragSourceEvent.java
deleted file mode 100644
index c5cd42a4e2b..00000000000
--- a/libjava/java/awt/dnd/DragSourceEvent.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* DragSourceEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Point;
-import java.util.EventObject;
-
-/**
- * @since 1.2
- */
-public class DragSourceEvent extends EventObject
-{
- /**
- * Compatible with JDK 1.2+
- */
- private static final long serialVersionUID = -763287114604032641L;
-
- private final boolean locationSpecified;
- private final int x;
- private final int y;
-
- public DragSourceEvent(DragSourceContext context)
- {
- super(context);
- locationSpecified = false;
- x = 0;
- y = 0;
- }
-
- public DragSourceEvent(DragSourceContext context, int x, int y)
- {
- super(context);
- locationSpecified = true;
- this.x = x;
- this.y = y;
- }
-
- public DragSourceContext getDragSourceContext()
- {
- return (DragSourceContext) source;
- }
-
- public Point getLocation()
- {
- return locationSpecified ? new Point(x, y) : null;
- }
-
- public int getX()
- {
- return x;
- }
-
- public int getY()
- {
- return y;
- }
-} // class DragSourceEvent
diff --git a/libjava/java/awt/dnd/DragSourceListener.java b/libjava/java/awt/dnd/DragSourceListener.java
deleted file mode 100644
index aac6e94ebe7..00000000000
--- a/libjava/java/awt/dnd/DragSourceListener.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/* DragSourceListener.java -- listen to events during the drag
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.util.EventListener;
-
-/**
- * This class allows an object to listen for drag and drop events. It can
- * be used to provide appropriate feedback for "drag over" actions. You can
- * also use a DragSourceAdapter
to filter the events you are
- * interested in.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public interface DragSourceListener extends EventListener
-{
- /**
- * Called when the cursor hotspot enters a drop site which will accept the
- * drag.
- *
- * @param e the drag source drag event
- */
- void dragEnter(DragSourceDragEvent e);
-
- /**
- * Called when the cursor hotspot moves inside of a drop site which will
- * accept the drag.
- *
- * @param e the drag source drag event
- */
- void dragOver(DragSourceDragEvent e);
-
- /**
- * Called when the user modifies the drop gesture. This is often the case
- * when additional mouse or key events are received during the drag.
- *
- * @param e the drag source drag event
- */
- void dropActionChanged(DragSourceDragEvent e);
-
- /**
- * Called when the cursor hotspot moves outside of a drop site which will
- * accept the drag. This could also happen if the drop site is no longer
- * active, or no longer accepts the drag.
- *
- * @param e the drag source drag event
- */
- void dragExit(DragSourceEvent e);
-
- /**
- * Called when the drag and drop operation is complete. After this event,
- * getDropSuccess
of the event is valid, and
- * getDropAction
holds the action requested by the drop site.
- * Furthermore, the DragSourceContext
is invalidated.
- *
- * @param e the drag source drag event
- */
- void dragDropEnd(DragSourceDropEvent e);
-} // interface DragSourceListener
diff --git a/libjava/java/awt/dnd/DragSourceMotionListener.java b/libjava/java/awt/dnd/DragSourceMotionListener.java
deleted file mode 100644
index 5d04c227100..00000000000
--- a/libjava/java/awt/dnd/DragSourceMotionListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* DragSourceMotionListener.java -- tracks motion in the drag source
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.util.EventListener;
-
-/**
- * This is a listener for mouse motion in the drag source before the drop
- * event occurs. You can also use a DragSourceAdapter
to filter
- * the events you are interested in.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see DragSourceDragEvent
- * @see DragSource
- * @see DragSourceListener
- * @see DragSourceAdapter
- * @since 1.4
- * @status updated to 1.4
- */
-public interface DragSourceMotionListener extends EventListener
-{
- /**
- * Called whenever the mouse is moved during a drag-and-drop operation.
- *
- * @param e the event
- */
- void dragMouseMoved(DragSourceDragEvent e);
-} // interface DragSourceMotionListener
diff --git a/libjava/java/awt/dnd/DropTarget.java b/libjava/java/awt/dnd/DropTarget.java
deleted file mode 100644
index 9fd7ef896fb..00000000000
--- a/libjava/java/awt/dnd/DropTarget.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/* DropTarget.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Component;
-import java.awt.GraphicsEnvironment;
-import java.awt.HeadlessException;
-import java.awt.Point;
-import java.awt.datatransfer.FlavorMap;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.Serializable;
-import java.util.EventListener;
-import java.util.TooManyListenersException;
-
-/**
- * @author Michael Koch
- * @since 1.2
- */
-public class DropTarget
- implements DropTargetListener, EventListener, Serializable
-{
- /**
- * Compatible with JDK 1.2+
- */
- private static final long serialVersionUID = -6283860791671019047L;
-
- /** @specnote According to the online documentation, this is
- * protected, but in reality it is public. */
- public static class DropTargetAutoScroller
- implements ActionListener
- {
- private Component component;
- private Point point;
-
- protected DropTargetAutoScroller (Component c, Point p)
- {
- component = c;
- point = p;
- }
-
- protected void updateLocation (Point newLocn)
- {
- point = newLocn;
- }
-
- protected void stop ()
- {
- }
-
- public void actionPerformed (ActionEvent e)
- {
- }
- }
-
- private Component component;
- private FlavorMap flavorMap;
- private int actions;
- private DropTargetContext dropTargetContext;
- private DropTargetListener dropTargetListener;
- private boolean active = true;
-
- /**
- * Creates a DropTarget
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
- public DropTarget ()
- {
- this (null, 0, null, true, null);
- }
-
- /**
- * Creates a DropTarget
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
- public DropTarget (Component c, DropTargetListener dtl)
- {
- this (c, 0, dtl, true, null);
- }
-
- /**
- * Creates a DropTarget
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
- public DropTarget (Component c, int i, DropTargetListener dtl)
- {
- this (c, i, dtl, true, null);
- }
-
- /**
- * Creates a DropTarget
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
- public DropTarget (Component c, int i, DropTargetListener dtl, boolean b)
- {
- this (c, i, dtl, b, null);
- }
-
- /**
- * Creates a DropTarget
object.
- *
- * @exception HeadlessException If GraphicsEnvironment.isHeadless()
- * returns true.
- */
- public DropTarget (Component c, int i, DropTargetListener dtl, boolean b,
- FlavorMap fm)
- {
- if (GraphicsEnvironment.isHeadless ())
- throw new HeadlessException ();
-
- component = c;
- actions = i;
- dropTargetListener = dtl;
- flavorMap = fm;
-
- setActive (b);
- }
-
- /**
- * Sets the component associated with this drop target object.
- */
- public void setComponent (Component c)
- {
- component = c;
- }
-
- /**
- * Returns the component associated with this drop target object.
- */
- public Component getComponent ()
- {
- return component;
- }
-
- /**
- * Sets the default actions.
- */
- public void setDefaultActions (int ops)
- {
- actions = ops;
- }
-
- /**
- * Returns the default actions.
- */
- public int getDefaultActions ()
- {
- return actions;
- }
-
- public void setActive (boolean active)
- {
- this.active = active;
- }
-
- public boolean isActive()
- {
- return active;
- }
-
- /**
- * Adds a new DropTargetListener
.
- *
- * @exception TooManyListenersException Sun's JDK does not, despite
- * documentation, throw this exception here when you install an additional
- * DropTargetListener
. So to be compatible, we do the same
- * thing.
- */
- public void addDropTargetListener (DropTargetListener dtl)
- throws TooManyListenersException
- {
- dropTargetListener = dtl;
- }
-
- public void removeDropTargetListener(DropTargetListener dtl)
- {
- // FIXME: Do we need to do something with dtl ?
- dropTargetListener = null;
- }
-
- public void dragEnter(DropTargetDragEvent dtde)
- {
- }
-
- public void dragOver(DropTargetDragEvent dtde)
- {
- }
-
- public void dropActionChanged(DropTargetDragEvent dtde)
- {
- }
-
- public void dragExit(DropTargetEvent dte)
- {
- }
-
- public void drop(DropTargetDropEvent dtde)
- {
- }
-
- public FlavorMap getFlavorMap()
- {
- return flavorMap;
- }
-
- public void setFlavorMap(FlavorMap fm)
- {
- flavorMap = fm;
- }
-
- public void addNotify(java.awt.peer.ComponentPeer peer)
- {
- }
-
- public void removeNotify(java.awt.peer.ComponentPeer peer)
- {
- }
-
- public DropTargetContext getDropTargetContext()
- {
- if (dropTargetContext == null)
- dropTargetContext = createDropTargetContext ();
-
- return dropTargetContext;
- }
-
- protected DropTargetContext createDropTargetContext()
- {
- return new DropTargetContext (this);
- }
-
- protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller
- (Component c, Point p)
- {
- return new DropTarget.DropTargetAutoScroller (c, p);
- }
-
- protected void initializeAutoscrolling(Point p)
- {
- }
-
- protected void updateAutoscroll(Point dragCursorLocn)
- {
- }
-
- protected void clearAutoscroll()
- {
- }
-} // class DropTarget
diff --git a/libjava/java/awt/dnd/DropTargetAdapter.java b/libjava/java/awt/dnd/DropTargetAdapter.java
deleted file mode 100644
index 13c6b9f4b6d..00000000000
--- a/libjava/java/awt/dnd/DropTargetAdapter.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* DragSourceAdapter.java -- drag-and-drop listener adapter
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.dnd;
-
-/**
- * This class implements DropTargetListener
, and implements all methods
- * with empty bodies. This allows a listener interested in implementing only
- * a subset of these interfaces to extend this class and override only the
- * desired methods.
- *
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.4
- * @status updated to 1.4
- */
-public abstract class DropTargetAdapter
- implements DropTargetListener
-{
- /**
- * Default constructor.
- */
- public DropTargetAdapter()
- {
- }
-
- /**
- * Called when the cursor hotspot enters a drop site which will accept the
- * drag.
- *
- * @param e the event
- */
- public void dragEnter (DropTargetDragEvent e)
- {
- }
-
- /**
- * Called when the cursor hotspot moves inside of a drop site which will
- * accept the drag.
- *
- * @param e the event
- */
- public void dragOver (DropTargetDragEvent e)
- {
- }
-
- /**
- * Called when the user modifies the drop gesture. This is often the case
- * when additional mouse or key events are received during the drag.
- *
- * @param e the event
- */
- public void dropActionChanged (DropTargetDragEvent e)
- {
- }
-
- /**
- * Called when the cursor hotspot moves outside of a drop site which will
- * accept the drag. This could also happen if the drop site is no longer
- * active, or no longer accepts the drag.
- *
- * @param e the event
- */
- public void dragExit(DropTargetEvent e)
- {
- }
-} // class DropTargetAdapter
diff --git a/libjava/java/awt/dnd/DropTargetContext.java b/libjava/java/awt/dnd/DropTargetContext.java
deleted file mode 100644
index d1fb66e6f35..00000000000
--- a/libjava/java/awt/dnd/DropTargetContext.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/* DropTargetContext.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.dnd;
-
-import java.awt.Component;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.2
- */
-public class DropTargetContext implements Serializable
-{
- static final long serialVersionUID = -634158968993743371L;
-
- /** @specnote According to the online documentation, this is
- * protected, but in reality it is public. */
- public class TransferableProxy implements Transferable
- {
- protected boolean isLocal;
- protected Transferable transferable;
-
- TransferableProxy (Transferable t, boolean local)
- {
- this.transferable = t;
- this.isLocal = local;
- }
-
- public DataFlavor[] getTransferDataFlavors ()
- {
- return transferable.getTransferDataFlavors ();
- }
-
- public boolean isDataFlavorSupported (DataFlavor flavor)
- {
- return transferable.isDataFlavorSupported (flavor);
- }
-
- public Object getTransferData (DataFlavor flavor)
- throws UnsupportedFlavorException, IOException
- {
- return transferable.getTransferData (flavor);
- }
- }
-
- private DropTarget dropTarget;
- private int targetActions;
- private java.awt.dnd.peer.DropTargetContextPeer dtcp;
-
- // package private
- DropTargetContext (DropTarget dropTarget)
- {
- this.dropTarget = dropTarget;
- }
-
- public DropTarget getDropTarget ()
- {
- return dropTarget;
- }
-
- public Component getComponent ()
- {
- return dropTarget.getComponent ();
- }
-
- public void addNotify (java.awt.dnd.peer.DropTargetContextPeer dtcp)
- {
- this.dtcp = dtcp;
- }
-
- public void removeNotify ()
- {
- this.dtcp = null;
- }
-
- protected void setTargetActions (int actions)
- {
- targetActions = actions;
- }
-
- protected int getTargetActions()
- {
- return targetActions;
- }
-
- /**
- * Signals that the drop is completed.
- *
- * @exception InvalidDnDOperationException If a drop is not outstanding.
- */
- public void dropComplete (boolean success)
- {
- // FIXME: implement this
- }
-
- protected void acceptDrag (int dragOperation)
- {
- // FIXME: implement this
- }
-
- protected void rejectDrag ()
- {
- // FIXME: implement this
- }
-
- protected void acceptDrop (int dropOperation)
- {
- // FIXME: implement this
- }
-
- protected void rejectDrop ()
- {
- // FIXME: implement this
- }
-
- protected DataFlavor[] getCurrentDataFlavors ()
- {
- // FIXME: implement this
- return null;
- }
-
- protected List getCurrentDataFlavorsAsList ()
- {
- return Arrays.asList (getCurrentDataFlavors ());
- }
-
- protected boolean isDataFlavorSupported (DataFlavor flavor)
- {
- return getCurrentDataFlavorsAsList ().contains (flavor);
- }
-
- /**
- * Return the Transferable
operandof this operation.
- *
- * @exception InvalidDnDOperationException If a drag is not outstanding.
- */
- protected Transferable getTransferable() throws InvalidDnDOperationException
- {
- // FIXME: implement this
- return null;
- }
-
- protected Transferable createTransferableProxy(Transferable t, boolean local)
- {
- return new TransferableProxy (t, local);
- }
-} // class DropTargetContext
diff --git a/libjava/java/awt/dnd/DropTargetDragEvent.java b/libjava/java/awt/dnd/DropTargetDragEvent.java
deleted file mode 100644
index 6cdc3a292be..00000000000
--- a/libjava/java/awt/dnd/DropTargetDragEvent.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* DropTargetDragEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.awt.Point;
-import java.awt.datatransfer.DataFlavor;
-import java.util.List;
-
-/**
- * @since 1.2
- */
-public class DropTargetDragEvent extends DropTargetEvent
-{
- /**
- * Compatible with 1.2+
- */
- private static final long serialVersionUID = -8422265619058953682L;
-
- private final int dropAction;
- private final int srcActions;
- private final Point location;
-
- /**
- * Initializes a DropTargetDragEvent
.
- *
- * @exception IllegalArgumentException If dropAction is not one of DnDConstants,
- * srcActions is not a bitwise mask of DnDConstants, or dtc is null.
- * @exception NullPointerException If location is null.
- */
- public DropTargetDragEvent (DropTargetContext context, Point location,
- int dropAction, int srcActions)
- {
- super (context);
-
- if (location == null)
- throw new NullPointerException ();
-
- if (context == null)
- throw new IllegalArgumentException ();
-
- if (dropAction != DnDConstants.ACTION_NONE
- && dropAction != DnDConstants.ACTION_COPY
- && dropAction != DnDConstants.ACTION_MOVE
- && dropAction != DnDConstants.ACTION_COPY_OR_MOVE
- && dropAction != DnDConstants.ACTION_LINK
- && dropAction != DnDConstants.ACTION_REFERENCE)
- throw new IllegalArgumentException ();
-
- int srcActionsMask = DnDConstants.ACTION_NONE
- | DnDConstants.ACTION_COPY
- | DnDConstants.ACTION_MOVE
- | DnDConstants.ACTION_COPY_OR_MOVE
- | DnDConstants.ACTION_LINK
- | DnDConstants.ACTION_REFERENCE;
-
- if (~(srcActions ^ srcActionsMask) != 0)
- throw new IllegalArgumentException ();
-
- this.dropAction = dropAction;
- this.srcActions = srcActions;
- this.location = location;
- }
-
- public void acceptDrag (int dragOperation)
- {
- context.acceptDrag (dragOperation);
- }
-
- public DataFlavor[] getCurrentDataFlavors ()
- {
- return context.getCurrentDataFlavors ();
- }
-
- public List getCurrentDataFlavorsAsList ()
- {
- return context.getCurrentDataFlavorsAsList ();
- }
-
- public int getDropAction()
- {
- return 0;
- //return dropAction & ((DropTargetContext) source).getTargetActions();
- }
-
- public Point getLocation ()
- {
- return location;
- }
-
- public int getSourceActions ()
- {
- return srcActions;
- }
-
- public boolean isDataFlavorSupported (DataFlavor df)
- {
- return context.isDataFlavorSupported (df);
- }
-
- public void rejectDrag ()
- {
- context.rejectDrag ();
- }
-} // class DropTargetDragEvent
diff --git a/libjava/java/awt/dnd/DropTargetDropEvent.java b/libjava/java/awt/dnd/DropTargetDropEvent.java
deleted file mode 100644
index 0c0777f78d0..00000000000
--- a/libjava/java/awt/dnd/DropTargetDropEvent.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/* DropTargetDropEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.dnd;
-
-import java.awt.Point;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.util.List;
-
-/**
- * @since 1.2
- */
-public class DropTargetDropEvent extends DropTargetEvent
-{
- /**
- * Compatible with JDK 1.2+
- */
- private static final long serialVersionUID = -1721911170440459322L;
-
- private final int dropAction;
- private final int actions;
- private final Point location;
- private final boolean isLocalTx;
-
- /**
- * Initializes a DropTargetDropEvent
. By default this constructor
- * assumes that the target is not int same JVM.
- *
- * @exception IllegalArgumentException If dropAction is not one of DnDConstants,
- * actions is not a bitwise mask of DnDConstants, or dtc is null.
- * @exception NullPointerException If location is null.
- */
- public DropTargetDropEvent (DropTargetContext dtc, Point location,
- int dropAction, int actions)
- {
- this (dtc, location, dropAction, actions, false);
- }
-
- /**
- * Initializes a DropTargetDropEvent
.
- *
- * @exception IllegalArgumentException If dropAction is not one of DnDConstants,
- * actions is not a bitwise mask of DnDConstants, or dtc is null.
- * @exception NullPointerException If location is null.
- */
- public DropTargetDropEvent (DropTargetContext dtc, Point location,
- int dropAction, int actions, boolean isLocalTx)
- {
- super (dtc);
-
- if (location == null)
- throw new NullPointerException ();
-
- if (dtc == null)
- throw new IllegalArgumentException ();
-
- if (dropAction != DnDConstants.ACTION_NONE
- && dropAction != DnDConstants.ACTION_COPY
- && dropAction != DnDConstants.ACTION_MOVE
- && dropAction != DnDConstants.ACTION_COPY_OR_MOVE
- && dropAction != DnDConstants.ACTION_LINK
- && dropAction != DnDConstants.ACTION_REFERENCE)
- throw new IllegalArgumentException ();
-
- int actionsMask = DnDConstants.ACTION_NONE
- | DnDConstants.ACTION_COPY
- | DnDConstants.ACTION_MOVE
- | DnDConstants.ACTION_COPY_OR_MOVE
- | DnDConstants.ACTION_LINK
- | DnDConstants.ACTION_REFERENCE;
-
- if (~(actions ^ actionsMask) != 0)
- throw new IllegalArgumentException ();
-
- this.dropAction = dropAction;
- this.actions = actions;
- this.location = location;
- this.isLocalTx = isLocalTx;
- }
-
- public Point getLocation ()
- {
- return location;
- }
-
- public DataFlavor[] getCurrentDataFlavors ()
- {
- return context.getCurrentDataFlavors ();
- }
-
- public List getCurrentDataFlavorsAsList ()
- {
- return context.getCurrentDataFlavorsAsList ();
- }
-
- public boolean isDataFlavorSupported (DataFlavor flavor)
- {
- return context.isDataFlavorSupported (flavor);
- }
-
- public int getSourceActions ()
- {
- return actions;
- }
-
- public int getDropAction ()
- {
- return dropAction;
- }
-
- public Transferable getTransferable ()
- {
- return context.getTransferable ();
- }
-
- public void acceptDrop (int dropAction)
- {
- context.acceptDrop (dropAction);
- }
-
- public void rejectDrop ()
- {
- context.rejectDrop ();
- }
-
- public void dropComplete (boolean success)
- {
- // FIXME: implement this
- }
-
- public boolean isLocalTransfer()
- {
- return isLocalTx;
- }
-} // class DropTargetDropEvent
diff --git a/libjava/java/awt/dnd/DropTargetEvent.java b/libjava/java/awt/dnd/DropTargetEvent.java
deleted file mode 100644
index 56a4d481a16..00000000000
--- a/libjava/java/awt/dnd/DropTargetEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/* DropTarget.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.dnd;
-
-import java.util.EventObject;
-
-public class DropTargetEvent extends EventObject
-{
- protected DropTargetContext context;
-
- public DropTargetEvent (DropTargetContext context)
- {
- super (context);
- this.context = context;
- }
-
- public DropTargetContext getDropTargetContext ()
- {
- return context;
- }
-}
diff --git a/libjava/java/awt/dnd/DropTargetListener.java b/libjava/java/awt/dnd/DropTargetListener.java
deleted file mode 100644
index ceb839bac27..00000000000
--- a/libjava/java/awt/dnd/DropTargetListener.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* DropTargetListener.java -- listen to events during the drop
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-import java.util.EventListener;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.2
- * @status updated to 1.4
- */
-public interface DropTargetListener extends EventListener
-{
- /**
- * Called when the cursor hotspot enters a drop site which will accept the
- * drag.
- *
- * @param e the drag source drag event
- */
- void dragEnter (DropTargetDragEvent e);
-
- /**
- * Called when the cursor hotspot moves inside of a drop site which will
- * accept the drag.
- *
- * @param e the drag source drag event
- */
- void dragOver (DropTargetDragEvent e);
-
- /**
- * Called when the user modifies the drop gesture. This is often the case
- * when additional mouse or key events are received during the drag.
- *
- * @param e the drag source drag event
- */
- void dropActionChanged (DropTargetDragEvent e);
-
- /**
- * Called when the cursor hotspot moves outside of a drop site which will
- * accept the drag. This could also happen if the drop site is no longer
- * active, or no longer accepts the drag.
- *
- * @param e the drag source drag event
- */
- void dragExit (DropTargetEvent e);
-
- /**
- * Called when the drag operation has terminated with a drop.
- *
- * @param e the drag source drag event
- */
- void drop (DropTargetDropEvent e);
-} // interface DropTargetListener
diff --git a/libjava/java/awt/dnd/InvalidDnDOperationException.java b/libjava/java/awt/dnd/InvalidDnDOperationException.java
deleted file mode 100644
index 2fd9767e03d..00000000000
--- a/libjava/java/awt/dnd/InvalidDnDOperationException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* InvalidDnDOperationException.java -- thrown when drag-and-drop fails
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd;
-
-/**
- * Thrown when a method in the java.awt.dnd package is unable to perform a
- * requested operation, usually because the underlying DnD system is in the
- * wrong state.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public class InvalidDnDOperationException extends IllegalStateException
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -6062568741193956678L;
-
- /**
- * Create an exception without a message.
- */
- public InvalidDnDOperationException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public InvalidDnDOperationException(String s)
- {
- super(s);
- }
-} // class InvalidDnDOperationException
diff --git a/libjava/java/awt/dnd/MouseDragGestureRecognizer.java b/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
deleted file mode 100644
index 9a2a7bc4c79..00000000000
--- a/libjava/java/awt/dnd/MouseDragGestureRecognizer.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* MouseDragGestureRecognizer.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.dnd;
-
-import java.awt.Component;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- */
-public abstract class MouseDragGestureRecognizer
- extends DragGestureRecognizer
- implements MouseListener, MouseMotionListener
-{
- /**
- * Creates a MouseDragGestureRecognizer
object.
- */
- protected MouseDragGestureRecognizer (DragSource ds, Component c, int act,
- DragGestureListener dgl)
- {
- super (ds, c, act, dgl);
- }
-
- /**
- * Creates a MouseDragGestureRecognizer
object.
- */
- protected MouseDragGestureRecognizer (DragSource ds, Component c, int act)
- {
- super (ds, c, act);
- }
-
- /**
- * Creates a MouseDragGestureRecognizer
object.
- */
- protected MouseDragGestureRecognizer (DragSource ds, Component c)
- {
- super (ds, c);
- }
-
- /**
- * Creates a MouseDragGestureRecognizer
object.
- */
- protected MouseDragGestureRecognizer (DragSource ds)
- {
- super (ds);
- }
-
- protected void registerListeners ()
- {
- component.addMouseListener (this);
- component.addMouseMotionListener (this);
- }
-
- protected void unregisterListeners ()
- {
- component.removeMouseListener (this);
- component.removeMouseMotionListener (this);
- }
-
- public void mouseClicked (MouseEvent e)
- {
- // Do nothing in here by default.
- }
-
- public void mousePressed (MouseEvent e)
- {
- // Do nothing in here by default.
- }
-
- public void mouseReleased (MouseEvent e)
- {
- // Do nothing in here by default.
- }
-
- public void mouseEntered (MouseEvent e)
- {
- // Do nothing in here by default.
- }
-
- public void mouseExited (MouseEvent e)
- {
- // Do nothing in here by default.
- }
-
- public void mouseDragged (MouseEvent e)
- {
- // Do nothing in here by default.
- }
-
- public void mouseMoved (MouseEvent e)
- {
- // Do nothing in here by default.
- }
-} // class MouseDragGestureRecognizer
diff --git a/libjava/java/awt/dnd/peer/DragSourceContextPeer.java b/libjava/java/awt/dnd/peer/DragSourceContextPeer.java
deleted file mode 100644
index 8c134b623a7..00000000000
--- a/libjava/java/awt/dnd/peer/DragSourceContextPeer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* DragSourceContextPeer.java -- interface for drag-and-drop peers
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd.peer;
-
-import java.awt.Cursor;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.dnd.DragSourceContext;
-import java.awt.dnd.InvalidDnDOperationException;
-
-/**
- * STUBBED
- */
-public interface DragSourceContextPeer
-{
- void startDrag(DragSourceContext context, Cursor c, Image i, Point p)
- throws InvalidDnDOperationException;
- Cursor getCursor();
- void setCursor(Cursor c) throws InvalidDnDOperationException;
- void transferablesFlavorsChanged();
-} // interface DragSourceContextPeer
diff --git a/libjava/java/awt/dnd/peer/DropTargetContextPeer.java b/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
deleted file mode 100644
index 6eae29b3810..00000000000
--- a/libjava/java/awt/dnd/peer/DropTargetContextPeer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* DropTargetContextPeer.java -- interface for drag-and-drop peers
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.dnd.peer;
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.dnd.DropTarget;
-import java.awt.dnd.InvalidDnDOperationException;
-
-
-/**
- * Used to control state of recipient protocol from the
- * DropTargetListener
. Occurs when a Component
- * with an associated DropTarget
and visible geometry is first
- * intersected by a logical cursor.
- *
- * @author Michael Koch (konqueror@gmx.de)
- */
-public interface DropTargetContextPeer
-{
- void setTargetActions(int actions);
- int getTargetActions();
- DropTarget getDropTarget();
- DataFlavor[] getTransferDataFlavors();
- Transferable getTransferable() throws InvalidDnDOperationException;
- boolean isTransferableJVMLocal();
- void acceptDrag(int dragAction);
- void rejectDrag();
- void acceptDrop(int dropAction);
- void rejectDrop();
- void dropComplete(boolean success);
-}
diff --git a/libjava/java/awt/dnd/peer/DropTargetPeer.java b/libjava/java/awt/dnd/peer/DropTargetPeer.java
deleted file mode 100644
index ec17cbe4be9..00000000000
--- a/libjava/java/awt/dnd/peer/DropTargetPeer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/* DropTargetPeer.java -- interface for drag-and-drop peers
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.dnd.peer;
-
-import java.awt.dnd.DropTarget;
-
-/**
- */
-public interface DropTargetPeer
-{
- void addDropTarget (DropTarget target);
- void removeDropTarget (DropTarget target);
-} // interface DropTargetContextPeer
diff --git a/libjava/java/awt/event/AWTEventListener.java b/libjava/java/awt/event/AWTEventListener.java
deleted file mode 100644
index 8662b74006d..00000000000
--- a/libjava/java/awt/event/AWTEventListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* AWTEventListener.java -- listen for all events in the AWT system
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.util.EventListener;
-
-/**
- * This listener is for classes that need to listen to all events in the AWT
- * system. In general, this should not be used except for classes like
- * javax.accessibility or by event recorders.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see AWTEvent
- * @see Toolkit#addAWTEventListener(AWTEventListener, long)
- * @see Toolkit#removeAWTEventListener(AWTEventListener)
- * @since 1.2
- * @status updated to 1.4
- */
-public interface AWTEventListener extends EventListener
-{
- /**
- * This method is called when any event in the AWT system is dispatched.
- *
- * @param event the AWTEvent that was dispatched
- */
- void eventDispatched(AWTEvent event);
-} // interface AWTEventListener
diff --git a/libjava/java/awt/event/AWTEventListenerProxy.java b/libjava/java/awt/event/AWTEventListenerProxy.java
deleted file mode 100644
index 9fccfc7ea2c..00000000000
--- a/libjava/java/awt/event/AWTEventListenerProxy.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/* AWTEventListenerProxy.java -- wrapper/filter for AWTEventListener
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.util.EventListenerProxy;
-
-/**
- * This class allows adding an AWTEventListener which only pays attention to
- * a specific event mask.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Toolkit
- * @see EventListenerProxy
- * @since 1.4
- * @status updated to 1.4
- */
-public class AWTEventListenerProxy extends EventListenerProxy
- implements AWTEventListener
-{
- /** The event mask. */
- private final long mask;
-
- /**
- * Construct an AWT Event Listener which only listens to events in the given
- * mask, passing the work on to the real listener.
- *
- * @param eventMask the mask of events to listen to
- * @param listener the wrapped listener
- */
- public AWTEventListenerProxy(long eventMask, AWTEventListener listener)
- {
- super(listener);
- mask = eventMask;
- }
-
- /**
- * Forwards events on to the delegate if they meet the event mask.
- *
- * @param event the property change event to filter
- * @throws NullPointerException if the delegate this was created with is null
- */
- public void eventDispatched(AWTEvent event)
- {
- int id = event == null ? 0 : event.getID();
- if (((mask & AWTEvent.ACTION_EVENT_MASK) != 0
- && event instanceof ActionEvent)
- || ((mask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0
- && event instanceof AdjustmentEvent)
- || ((mask & AWTEvent.COMPONENT_EVENT_MASK) != 0
- && event instanceof ComponentEvent
- && (id >= ComponentEvent.COMPONENT_FIRST
- && id <= ComponentEvent.COMPONENT_LAST))
- || ((mask & AWTEvent.CONTAINER_EVENT_MASK) != 0
- && event instanceof ContainerEvent)
- || ((mask & AWTEvent.FOCUS_EVENT_MASK) != 0
- && event instanceof FocusEvent)
- || ((mask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0
- && event instanceof HierarchyEvent
- && (id == HierarchyEvent.ANCESTOR_MOVED
- || id == HierarchyEvent.ANCESTOR_RESIZED))
- || ((mask & AWTEvent.HIERARCHY_EVENT_MASK) != 0
- && event instanceof HierarchyEvent
- && id == HierarchyEvent.HIERARCHY_CHANGED)
- || ((mask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0
- && event instanceof InputMethodEvent)
- || ((mask & AWTEvent.INVOCATION_EVENT_MASK) != 0
- && event instanceof InvocationEvent)
- || ((mask & AWTEvent.ITEM_EVENT_MASK) != 0
- && event instanceof ItemEvent)
- || ((mask & AWTEvent.KEY_EVENT_MASK) != 0
- && event instanceof KeyEvent)
- || ((mask & AWTEvent.MOUSE_EVENT_MASK) != 0
- && event instanceof MouseEvent
- && (id == MouseEvent.MOUSE_PRESSED
- || id == MouseEvent.MOUSE_RELEASED
- || id == MouseEvent.MOUSE_CLICKED
- || id == MouseEvent.MOUSE_ENTERED
- || id == MouseEvent.MOUSE_EXITED))
- || ((mask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0
- && event instanceof MouseEvent
- && (id == MouseEvent.MOUSE_MOVED
- || id == MouseEvent.MOUSE_DRAGGED))
- || ((mask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0
- && event instanceof MouseWheelEvent)
- || ((mask & AWTEvent.PAINT_EVENT_MASK) != 0
- && event instanceof PaintEvent)
- || ((mask & AWTEvent.TEXT_EVENT_MASK) != 0
- && event instanceof TextEvent)
- || ((mask & AWTEvent.WINDOW_EVENT_MASK) != 0
- && event instanceof WindowEvent
- && (id == WindowEvent.WINDOW_OPENED
- || id == WindowEvent.WINDOW_CLOSING
- || id == WindowEvent.WINDOW_CLOSED
- || id == WindowEvent.WINDOW_ICONIFIED
- || id == WindowEvent.WINDOW_DEICONIFIED
- || id == WindowEvent.WINDOW_ACTIVATED
- || id == WindowEvent.WINDOW_DEACTIVATED))
- || ((mask & AWTEvent.WINDOW_FOCUS_EVENT_MASK) != 0
- && event instanceof WindowEvent
- && (id == WindowEvent.WINDOW_GAINED_FOCUS
- || id == WindowEvent.WINDOW_LOST_FOCUS))
- || ((mask & AWTEvent.WINDOW_STATE_EVENT_MASK) != 0
- && event instanceof WindowEvent
- && id == WindowEvent.WINDOW_STATE_CHANGED))
- ((AWTEventListener) getListener()).eventDispatched(event);
- }
-
- /**
- * This returns the event mask associated with this listener.
- *
- * @return the event mask
- */
- public long getEventMask()
- {
- return mask;
- }
-} // class AWTEventListenerProxy
diff --git a/libjava/java/awt/event/ActionEvent.java b/libjava/java/awt/event/ActionEvent.java
deleted file mode 100644
index 4bce7d45ce0..00000000000
--- a/libjava/java/awt/event/ActionEvent.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/* ActionEvent.java -- an action has been triggered
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.awt.EventQueue;
-
-/**
- * This event is generated when an action on a component (such as a
- * button press) occurs.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ActionListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class ActionEvent extends AWTEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -7671078796273832149L;
-
- /** Bit mask indicating the shift key was pressed. */
- public static final int SHIFT_MASK = InputEvent.SHIFT_MASK;
-
- /** Bit mask indicating the control key was pressed. */
- public static final int CTRL_MASK = InputEvent.CTRL_MASK;
-
- /** Bit mask indicating the that meta key was pressed. */
- public static final int META_MASK = InputEvent.META_MASK;
-
- /** Bit mask indicating that the alt key was pressed. */
- public static final int ALT_MASK = InputEvent.ALT_MASK;
-
- /** The first id number in the range of action id's. */
- public static final int ACTION_FIRST = 1001;
-
- /** The last id number in the range of action id's. */
- public static final int ACTION_LAST = 1001;
-
- /** An event id indicating that an action has occurred. */
- public static final int ACTION_PERFORMED = 1001;
-
- /**
- * A nonlocalized string that gives more specific details of the event cause.
- *
- * @see #getActionCommand()
- * @serial the command for this event
- */
- private final String actionCommand;
-
- /**
- * The bitmask of the modifiers that were pressed during the action.
- *
- * @see #getModifiers()
- * @serial modifiers for this event
- */
- private final int modifiers;
-
- /**
- * The timestamp of this event; usually the same as the underlying input
- * event.
- *
- * @see #getWhen()
- * @serial the timestamp of the event
- * @since 1.4
- */
- private final long when;
-
- /**
- * Initializes a new instance of ActionEvent
with the
- * specified source, id, and command. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the event source
- * @param id the event id
- * @param command the command string for this action
- * @throws IllegalArgumentException if source is null
- */
- public ActionEvent(Object source, int id, String command)
- {
- this(source, id, command, EventQueue.getMostRecentEventTime(), 0);
- }
-
- /**
- * Initializes a new instance of ActionEvent
with the
- * specified source, id, command, and modifiers. Note that an invalid id
- * leads to unspecified results.
- *
- * @param source the event source
- * @param id the event id
- * @param command the command string for this action
- * @param modifiers the bitwise or of modifier keys down during the action
- * @throws IllegalArgumentException if source is null
- */
- public ActionEvent(Object source, int id, String command, int modifiers)
- {
- this(source, id, command, EventQueue.getMostRecentEventTime(), modifiers);
- }
-
- /**
- * Initializes a new instance of ActionEvent
with the
- * specified source, id, command, and modifiers, and timestamp. Note that
- * an invalid id leads to unspecified results.
- *
- * @param source the event source
- * @param id the event id
- * @param command the command string for this action
- * @param when the timestamp of the event
- * @param modifiers the bitwise or of modifier keys down during the action
- * @throws IllegalArgumentException if source is null
- * @since 1.4
- */
- public ActionEvent(Object source, int id, String command, long when,
- int modifiers)
- {
- super(source, id);
- actionCommand = command;
- this.when = when;
- this.modifiers = modifiers;
- }
-
- /**
- * Returns the command string associated with this action.
- *
- * @return the command string associated with this action
- */
- public String getActionCommand()
- {
- return actionCommand;
- }
-
- /**
- * Gets the timestamp of when this action took place. Usually, this
- * corresponds to the timestamp of the underlying InputEvent.
- *
- * @return the timestamp of this action
- * @since 1.4
- */
- public long getWhen()
- {
- return when;
- }
-
- /**
- * Returns the keys held down during the action. This value will be a
- * combination of the bit mask constants defined in this class, or 0 if no
- * modifiers were pressed.
- *
- * @return the modifier bits
- */
- public int getModifiers()
- {
- return modifiers;
- }
-
- /**
- * Returns a string that identifies the action event. This is in the format
- * "ACTION_PERFORMED,cmd=" + getActionCommand() + ",when=" + getWhen()
- * + ",modifiers=" + <modifier string>
, where the modifier
- * string is in the order "Meta", "Ctrl", "Alt", "Shift", "Alt Graph", and
- * "Button1", separated by '+', according to the bits set in getModifiers().
- *
- * @return a string identifying the event
- */
- public String paramString()
- {
- StringBuffer s = new StringBuffer(id == ACTION_PERFORMED
- ? "ACTION_PERFORMED,cmd="
- : "unknown type,cmd=");
- s.append(actionCommand).append(",when=").append(when).append(",modifiers");
- int len = s.length();
- s.setLength(len + 1);
- if ((modifiers & META_MASK) != 0)
- s.append("+Meta");
- if ((modifiers & CTRL_MASK) != 0)
- s.append("+Ctrl");
- if ((modifiers & ALT_MASK) != 0)
- s.append("+Alt");
- if ((modifiers & SHIFT_MASK) != 0)
- s.append("+Shift");
- if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0)
- s.append("+Alt Graph");
- if ((modifiers & InputEvent.BUTTON1_MASK) != 0)
- s.append("+Button1");
- s.setCharAt(len, '=');
- return s.toString();
- }
-} // class ActionEvent
diff --git a/libjava/java/awt/event/ActionListener.java b/libjava/java/awt/event/ActionListener.java
deleted file mode 100644
index 4c302cca310..00000000000
--- a/libjava/java/awt/event/ActionListener.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ActionListener.java -- listens for action events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that listen for action events.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ActionEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface ActionListener extends EventListener
-{
- /**
- * This method is invoked when an action occurs.
- *
- * @param event the ActionEvent
that occurred
- */
- void actionPerformed(ActionEvent event);
-}
diff --git a/libjava/java/awt/event/AdjustmentEvent.java b/libjava/java/awt/event/AdjustmentEvent.java
deleted file mode 100644
index 867c577d356..00000000000
--- a/libjava/java/awt/event/AdjustmentEvent.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/* AdjustmentEvent.java -- an adjustable value was changed
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.awt.Adjustable;
-
-/**
- * This class represents an event that is generated when an adjustable
- * value is changed.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see Adjustable
- * @see AdjustmentListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class AdjustmentEvent extends AWTEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 5700290645205279921L;
-
- /** This is the first id in the range of ids used by adjustment events. */
- public static final int ADJUSTMENT_FIRST = 601;
-
- /** This is the last id in the range of ids used by adjustment events. */
- public static final int ADJUSTMENT_LAST = 601;
-
- /** This is the id indicating an adjustment value changed. */
- public static final int ADJUSTMENT_VALUE_CHANGED = 601;
-
- /** Adjustment type for unit increments. */
- public static final int UNIT_INCREMENT = 1;
-
- /** Adjustment type for unit decrements. */
- public static final int UNIT_DECREMENT = 2;
-
- /** Adjustment type for block decrements. */
- public static final int BLOCK_DECREMENT = 3;
-
- /** Adjustment type for block increments. */
- public static final int BLOCK_INCREMENT = 4;
-
- /** Adjustment type for tracking adjustments. */
- public static final int TRACK = 5;
-
- /**
- * The adjustable object that caused the event.
- *
- * @see #getAdjustable()
- * @serial the cause
- */
- private final Adjustable adjustable;
-
- /**
- * The type of adjustment, one of {@link #UNIT_INCREMENT},
- * {@link #UNIT_DECREMENT}, {@link #BLOCK_INCREMENT},
- * {@link #BLOCK_DECREMENT}, or {@link #TRACK}.
- *
- * @see #getAdjustmentType()
- * @serial the adjustment type
- */
- private final int adjustmentType;
-
- /**
- * The new value of the adjustable; it should be in the range of the
- * adjustable cause.
- *
- * @see #getValue()
- * @serial the adjustment value
- */
- private final int value;
-
- /**
- * True if this is in a series of multiple adjustment events.
- *
- * @see #getValueIsAdjusting()
- * @serial true if this is not the last adjustment
- * @since 1.4
- */
- private final boolean isAdjusting;
-
- /**
- * Initializes an instance of AdjustmentEvent
with the
- * specified source, id, type, and value. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param type the event type, one of the constants of this class
- * @param value the value of the adjustment
- * @throws IllegalArgumentException if source is null
- */
- public AdjustmentEvent(Adjustable source, int id, int type, int value)
- {
- this(source, id, type, value, false);
- }
-
- /**
- * Initializes an instance of AdjustmentEvent
with the
- * specified source, id, type, and value. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param type the event type, one of the constants of this class
- * @param value the value of the adjustment
- * @param isAdjusting if this event is in a chain of adjustments
- * @throws IllegalArgumentException if source is null
- * @since 1.4
- */
- public AdjustmentEvent(Adjustable source, int id, int type, int value,
- boolean isAdjusting)
- {
- super(source, id);
- this.adjustmentType = type;
- this.value = value;
- adjustable = source;
- this.isAdjusting = isAdjusting;
- }
-
- /**
- * This method returns the source of the event as an Adjustable
.
- *
- * @return the Adjustable
source of the event
- */
- public Adjustable getAdjustable()
- {
- return adjustable;
- }
-
- /**
- * Returns the new value of the adjustable object.
- *
- * @return the value of the event
- */
- public int getValue()
- {
- return value;
- }
-
- /**
- * Returns the type of the event, which will be one of
- * {@link #UNIT_INCREMENT}, {@link #UNIT_DECREMENT},
- * {@link #BLOCK_INCREMENT}, {@link #BLOCK_DECREMENT}, or {@link #TRACK}.
- *
- * @return the type of the event
- */
- public int getAdjustmentType()
- {
- return adjustmentType;
- }
-
- /**
- * Test if this event is part of a sequence of multiple adjustements.
- *
- * @return true if this is not the last adjustment
- * @since 1.4
- */
- public boolean getValueIsAdjusting()
- {
- return isAdjusting;
- }
-
- /**
- * Returns a string that describes the event. This is in the format
- * "ADJUSTMENT_VALUE_CHANGED,adjType=" + <type> + ",value="
- * + getValue() + ",isAdjusting=" + getValueIsAdjusting()
, where
- * type is the name of the constant returned by getAdjustmentType().
- *
- * @return a string that describes the event
- */
- public String paramString()
- {
- return (id == ADJUSTMENT_VALUE_CHANGED
- ? "ADJUSTMENT_VALUE_CHANGED,adjType=" : "unknown type,adjType=")
- + (adjustmentType == UNIT_INCREMENT ? "UNIT_INCREMENT,value="
- : adjustmentType == UNIT_DECREMENT ? "UNIT_DECREMENT,value="
- : adjustmentType == BLOCK_INCREMENT ? "BLOCK_INCREMENT,value="
- : adjustmentType == BLOCK_DECREMENT ? "BLOCK_DECREMENT,value="
- : adjustmentType == TRACK ? "TRACK,value=" : "unknown type,value=")
- + value + ",isAdjusting=" + isAdjusting;
- }
-} // class AdjustmentEvent
diff --git a/libjava/java/awt/event/AdjustmentListener.java b/libjava/java/awt/event/AdjustmentListener.java
deleted file mode 100644
index 1eb2e3bcfa1..00000000000
--- a/libjava/java/awt/event/AdjustmentListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* AdjustmentListener.java -- listen for adjustment events
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * Interface for classes that listen for adjustment events.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public interface AdjustmentListener extends EventListener
-{
- /**
- * This method is called when an adjustable value changes.
- *
- * @param event the AdjustmentEvent
that occurred
- */
- void adjustmentValueChanged(AdjustmentEvent event);
-} // interface AdjustmentListener
diff --git a/libjava/java/awt/event/ComponentAdapter.java b/libjava/java/awt/event/ComponentAdapter.java
deleted file mode 100644
index 6b4893f0fc2..00000000000
--- a/libjava/java/awt/event/ComponentAdapter.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/* ComponentAdapter.java -- convenience class for writing component listeners
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-/**
- * This class implements ComponentListener
and implements
- * all methods with empty bodies. This allows a listener interested in
- * implementing only a subset of the ComponentListener
- * interface to extend this class and override only the desired methods.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ComponentEvent
- * @see ComponentListener
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class ComponentAdapter implements ComponentListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public ComponentAdapter()
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void componentResized(ComponentEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void componentMoved(ComponentEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void componentShown(ComponentEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void componentHidden(ComponentEvent event)
- {
- }
-} // class ComponentAdapter
diff --git a/libjava/java/awt/event/ComponentEvent.java b/libjava/java/awt/event/ComponentEvent.java
deleted file mode 100644
index ba9c2a5b3f2..00000000000
--- a/libjava/java/awt/event/ComponentEvent.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/* ComponentEvent.java -- notification of events for components
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.awt.Component;
-
-/**
- * This class is for events generated when a component is moved, resized,
- * hidden, or shown. These events normally do not need to be handled by the
- * application, since the AWT system automatically takes care of them. This
- * is also the superclass for other events on components, but
- * ComponentListeners ignore such subclasses.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ComponentAdapter
- * @see ComponentListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class ComponentEvent extends AWTEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 8101406823902992965L;
-
- /** This is the first id in the range of ids used by this class. */
- public static final int COMPONENT_FIRST = 100;
-
- /** This is the last id in the range of ids used by this class. */
- public static final int COMPONENT_LAST = 103;
-
- /** This id indicates that a component was moved. */
- public static final int COMPONENT_MOVED = 100;
-
- /** This id indicates that a component was resized. */
- public static final int COMPONENT_RESIZED = 101;
-
- /** This id indicates that a component was shown. */
- public static final int COMPONENT_SHOWN = 102;
-
- /** This id indicates that a component was hidden. */
- public static final int COMPONENT_HIDDEN = 103;
-
- /**
- * Initializes a new instance of ComponentEvent
with the
- * specified source and id. Note that an invalid id leads to unspecified
- * results.
- *
- * @param source the source of the event
- * @param id the event id
- * @throws IllegalArgumentException if source is null
- */
- public ComponentEvent(Component source, int id)
- {
- super(source, id);
- }
-
- /**
- * This method returns the event source as a Component
. If the
- * source has subsequently been modified to a non-Component, this returns
- * null.
- *
- * @return the event source as a Component
, or null
- */
- public Component getComponent()
- {
- return source instanceof Component ? (Component) source : null;
- }
-
- /**
- * This method returns a string identifying this event. This is the field
- * name of the id type, and for COMPONENT_MOVED or COMPONENT_RESIZED, the
- * new bounding box of the component.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- // Unlike Sun, we don't throw NullPointerException or ClassCastException
- // when source was illegally changed.
- switch (id)
- {
- case COMPONENT_MOVED:
- return "COMPONENT_MOVED "
- + (source instanceof Component
- ? ((Component) source).getBounds() : (Object) "");
- case COMPONENT_RESIZED:
- return "COMPONENT_RESIZED "
- + (source instanceof Component
- ? ((Component) source).getBounds() : (Object) "");
- case COMPONENT_SHOWN:
- return "COMPONENT_SHOWN";
- case COMPONENT_HIDDEN:
- return "COMPONENT_HIDDEN";
- default:
- return "unknown type";
- }
- }
-} // class ComponentEvent
diff --git a/libjava/java/awt/event/ComponentListener.java b/libjava/java/awt/event/ComponentListener.java
deleted file mode 100644
index b43faaed7ff..00000000000
--- a/libjava/java/awt/event/ComponentListener.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ComponentListener.java -- receive all events for a component
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that receive all events from a component.
- * Normally it is not necessary to process these events since the AWT
- * handles them internally, taking all appropriate actions. To watch a subset
- * of these events, use a ComponentAdapter.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ComponentAdapter
- * @see ComponentEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface ComponentListener extends EventListener
-{
- /**
- * This method is called when the component is resized.
- *
- * @param event the ComponentEvent
indicating the resize
- */
- void componentResized(ComponentEvent event);
-
- /**
- * This method is called when the component is moved.
- *
- * @param event the ComponentEvent
indicating the move
- */
- void componentMoved(ComponentEvent event);
-
- /**
- * This method is called when the component is made visible.
- *
- * @param event the ComponentEvent
indicating the visibility
- */
- void componentShown(ComponentEvent event);
-
- /**
- * This method is called when the component is hidden.
- *
- * @param event the ComponentEvent
indicating the visibility
- */
- void componentHidden(ComponentEvent event);
-} // interface ComponentListener
diff --git a/libjava/java/awt/event/ContainerAdapter.java b/libjava/java/awt/event/ContainerAdapter.java
deleted file mode 100644
index c847adfa211..00000000000
--- a/libjava/java/awt/event/ContainerAdapter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ContainerAdapter.java -- convenience class for writing container listeners
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-/**
- * This class implements ContainerListener
and implements
- * all methods with empty bodies. This allows a listener interested in
- * implementing only a subset of the ContainerListener
- * interface to extend this class and override only the desired methods.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ContainerEvent
- * @see ContainerListener
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class ContainerAdapter implements ContainerListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public ContainerAdapter()
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void componentAdded(ContainerEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void componentRemoved(ContainerEvent event)
- {
- }
-} // class ContainerAdapter
diff --git a/libjava/java/awt/event/ContainerEvent.java b/libjava/java/awt/event/ContainerEvent.java
deleted file mode 100644
index 3c401fe1a04..00000000000
--- a/libjava/java/awt/event/ContainerEvent.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ContainerEvent.java -- components added/removed from a container
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.Component;
-import java.awt.Container;
-
-/**
- * This event is generated when a component is added or removed from a
- * container. Applications do not ordinarily need to handle these events
- * since the AWT system handles them internally.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ContainerAdapter
- * @see ContainerListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class ContainerEvent extends ComponentEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -4114942250539772041L;
-
- /** This is the first id in the id range used by this class. */
- public static final int CONTAINER_FIRST = 300;
-
- /** This is the last id in the id range used by this class. */
- public static final int CONTAINER_LAST = 301;
-
- /** This id indicates a component was added to the container. */
- public static final int COMPONENT_ADDED = 300;
-
- /** This id indicates a component was removed from the container. */
- public static final int COMPONENT_REMOVED = 301;
-
- /**
- * The non-null child component that was added or removed.
- *
- * @serial the child component that changed
- */
- private final Component child;
-
- /**
- * Initializes a new instance of ContainerEvent
with the
- * specified source and id. Additionally, the affected child component
- * is also passed as a parameter. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the source container of the event
- * @param id the event id
- * @param child the child component affected by this event
- * @throws IllegalArgumentException if source is null
- */
- public ContainerEvent(Component source, int id, Component child)
- {
- super(source, id);
- this.child = child;
- }
-
- /**
- * Returns the source of this event as a Container
.
- *
- * @return the source of the event
- * @throws ClassCastException if the source is changed to a non-Container
- */
- public Container getContainer()
- {
- return (Container) source;
- }
-
- /**
- * This method returns the child object that was added or removed from
- * the container.
- *
- * @return the child object added or removed
- */
- public Component getChild()
- {
- return child;
- }
-
- /**
- * This method returns a string identifying this event. It is formatted as:
- * (getID() == COMPONENT_ADDED ? "COMPONENT_ADDED"
- * : "COMPONENT_REMOVED") + ",child=" + getChild().getName()
.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- // Unlike Sun, we don't throw NullPointerException if child is illegally
- // null.
- return (id == COMPONENT_ADDED ? "COMPONENT_ADDED,child="
- : id == COMPONENT_REMOVED ? "COMPONENT_REMOVED,child="
- : "unknown type,child=") + (child == null ? "" : child.getName());
- }
-} // class ContainerEvent
diff --git a/libjava/java/awt/event/ContainerListener.java b/libjava/java/awt/event/ContainerListener.java
deleted file mode 100644
index b37d4340839..00000000000
--- a/libjava/java/awt/event/ContainerListener.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ContainerListener.java -- listen for container events
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to listen for all events from
- * container objects. This is normally not necessary since the AWT system
- * listens for and processes these events. To watch a subset of these events,
- * use a ContainerAdapter.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ContainerAdapter
- * @see ContainerEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface ContainerListener extends EventListener
-{
- /**
- * This method is called when a component is added to the container.
- *
- * @param event the ContainerEvent
indicating component addition
- */
- void componentAdded(ContainerEvent event);
-
- /**
- * This method is called when a component is removed from the container.
- *
- * @param event the ContainerEvent
indicating component removal
- */
- void componentRemoved(ContainerEvent event);
-} // interface ContainerListener
diff --git a/libjava/java/awt/event/FocusAdapter.java b/libjava/java/awt/event/FocusAdapter.java
deleted file mode 100644
index fb0532a3a91..00000000000
--- a/libjava/java/awt/event/FocusAdapter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* FocusAdapter.java -- convenience class for writing focus listeners
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-/**
- * This class implements FocusListener
and implements all
- * methods with empty bodies. This allows a listener interested in
- * implementing only a subset of the FocusListener
interface to
- * extend this class and override only the desired methods.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see FocusEvent
- * @see FocusListener
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class FocusAdapter implements FocusListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public FocusAdapter()
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void focusGained(FocusEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void focusLost(FocusEvent event)
- {
- }
-} // class FocusAdapter
diff --git a/libjava/java/awt/event/FocusEvent.java b/libjava/java/awt/event/FocusEvent.java
deleted file mode 100644
index a44284aea75..00000000000
--- a/libjava/java/awt/event/FocusEvent.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/* FocusEvent.java -- generated for a focus change
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.Component;
-
-/**
- * This class represents an event generated when a focus change occurs for a
- * component. There are both temporary changes, such as when focus is stolen
- * during a sroll then returned, and permanent changes, such as when the user
- * TABs through focusable components.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see FocusAdapter
- * @see FocusListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class FocusEvent extends ComponentEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 523753786457416396L;
-
- /** This is the first id in the range of ids used by this class. */
- public static final int FOCUS_FIRST = 1004;
-
- /** This is the last id in the range of ids used by this class. */
- public static final int FOCUS_LAST = 1005;
-
- /** This is the event id for a focus gained event. */
- public static final int FOCUS_GAINED = 1004;
-
- /** This is the event id for a focus lost event. */
- public static final int FOCUS_LOST = 1005;
-
- /**
- * Indicates whether or not the focus change is temporary.
- *
- * @see #isTemporary()
- * @serial true if the focus change is temporary
- */
- private final boolean temporary;
-
- /**
- * The other component which is giving up or stealing focus from this
- * component, if known.
- *
- * @see #getOppositeComponent()
- * @serial the component with the opposite focus event, or null
- * @since 1.4
- */
- private final Component opposite;
-
- /**
- * Initializes a new instance of FocusEvent
with the
- * specified source, id, temporary status, and opposite counterpart. Note
- * that an invalid id leads to unspecified results.
- *
- * @param source the component that is gaining or losing focus
- * @param id the event id
- * @param temporary true if the focus change is temporary
- * @param opposite the component receiving the opposite focus event, or null
- * @throws IllegalArgumentException if source is null
- */
- public FocusEvent(Component source, int id, boolean temporary,
- Component opposite)
- {
- super(source, id);
- this.temporary = temporary;
- this.opposite = opposite;
- }
-
- /**
- * Initializes a new instance of FocusEvent
with the
- * specified source, id, and temporary status. Note that an invalid id
- * leads to unspecified results.
- *
- * @param source the component that is gaining or losing focus
- * @param id the event id
- * @param temporary true if the focus change is temporary
- * @throws IllegalArgumentException if source is null
- */
- public FocusEvent(Component source, int id, boolean temporary)
- {
- this(source, id, temporary, null);
- }
-
- /**
- * Initializes a new instance of FocusEvent
with the
- * specified source and id. Note that an invalid id leads to unspecified
- * results.
- *
- * @param source the component that is gaining or losing focus
- * @param id the event id
- * @throws IllegalArgumentException if source is null
- */
- public FocusEvent(Component source, int id)
- {
- this(source, id, false, null);
- }
-
- /**
- * This method tests whether or not the focus change is temporary or
- * permanent.
- *
- * @return true if the focus change is temporary
- */
- public boolean isTemporary()
- {
- return temporary;
- }
-
- /**
- * Returns the component which received the opposite focus event. If this
- * component gained focus, the opposite lost focus; likewise if this
- * component is giving up focus, the opposite is gaining it. If this
- * information is unknown, perhaps because the opposite is a native
- * application, this returns null.
- *
- * @return the component with the focus opposite, or null
- * @since 1.4
- */
- public Component getOppositeComponent()
- {
- return opposite;
- }
-
- /**
- * Returns a string identifying this event. This is formatted as:
- * (getID() == FOCUS_GAINED ? "FOCUS_GAINED" : "FOCUS_LOST")
- * + (isTemporary() ? ",temporary," : ",permanent,") + "opposite="
- * + getOppositeComponent()
.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- return (id == FOCUS_GAINED ? "FOCUS_GAINED"
- : id == FOCUS_LOST ? "FOCUS_LOST" : "unknown type")
- + (temporary ? ",temporary,opposite=" : ",permanent,opposite=")
- + opposite;
- }
-} // class FocusEvent
diff --git a/libjava/java/awt/event/FocusListener.java b/libjava/java/awt/event/FocusListener.java
deleted file mode 100644
index 1f7201825a7..00000000000
--- a/libjava/java/awt/event/FocusListener.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* FocusListener.java -- listen for focus changes
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to be notified of changes of
- * keyboard focus for a component. To watch a subset of these events, use a
- * FocusAdapter.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see FocusAdapter
- * @see FocusEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface FocusListener extends EventListener
-{
- /**
- * This method is called when a component gains the keyboard focus.
- *
- * @param event the FocusEvent
indicating that focus was gained
- */
- void focusGained(FocusEvent event);
-
- /**
- * This method is invoked when a component loses the keyboard focus.
- *
- * @param event the FocusEvent
indicating that focus was lost
- */
- void focusLost(FocusEvent event);
-} // interface FocusListener
diff --git a/libjava/java/awt/event/HierarchyBoundsAdapter.java b/libjava/java/awt/event/HierarchyBoundsAdapter.java
deleted file mode 100644
index 340cf01edf1..00000000000
--- a/libjava/java/awt/event/HierarchyBoundsAdapter.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/* HierarchyBoundsAdapter.java -- convenience class for writing listeners
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.event;
-
-/**
- * This class implements HierarchyBoundsListener
and implements
- * all methods with empty bodies. This allows a listener interested in
- * implementing only a subset of the HierarchyBoundsListener
- * interface to extend this class and override only the desired methods.
- *
- * @author Bryce McKinlay
- * @see HierarchyBoundsListener
- * @see HierarchyEvent
- * @since 1.3
- * @status updated to 1.4
- */
-public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public HierarchyBoundsAdapter()
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void ancestorMoved(HierarchyEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void ancestorResized(HierarchyEvent event)
- {
- }
-}
diff --git a/libjava/java/awt/event/HierarchyBoundsListener.java b/libjava/java/awt/event/HierarchyBoundsListener.java
deleted file mode 100644
index 689623744e3..00000000000
--- a/libjava/java/awt/event/HierarchyBoundsListener.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* HierarchyBoundsListener.java -- listens to bounds changes of parents
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This listens for changes in an ancestors size or location. Normally it is
- * not necessary to process these events since the AWT handles them
- * internally, taking all appropriate actions. To watch a subset of these
- * events, use a HierarchyBoundsAdapter.
- *
- * @author Bryce McKinlay
- * @see HierarchyBoundsAdapter
- * @see HierarchyEvent
- * @since 1.3
- * @status updated to 1.4
- */
-public interface HierarchyBoundsListener extends EventListener
-{
- /**
- * Called when an ancestor component of the source is moved.
- *
- * @param e the event describing the ancestor's motion
- */
- void ancestorMoved(HierarchyEvent e);
-
- /**
- * Called when an ancestor component is resized.
- *
- * @param e the event describing the ancestor's resizing
- */
- void ancestorResized(HierarchyEvent e);
-} // interface HierarchyBoundsListener
diff --git a/libjava/java/awt/event/HierarchyEvent.java b/libjava/java/awt/event/HierarchyEvent.java
deleted file mode 100644
index e10cefbefcb..00000000000
--- a/libjava/java/awt/event/HierarchyEvent.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/* HierarchyEvent.java -- generated for a change in hierarchy
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.awt.Component;
-import java.awt.Container;
-
-/**
- * This class represents an event generated for an ancestor component which
- * may affect this component. These events normally do not need to be handled
- * by the application, since the AWT system automatically takes care of them.
- *
- * HierarchyEvent
with the
- * specified parameters. Note that an invalid id leads to unspecified
- * results.
- *
- * @param source the component whose hierarchy changed
- * @param id the event id
- * @param changed the top component in the tree of changed hierarchy
- * @param changedParent the updated parent of this object
- * @throws IllegalArgumentException if source is null
- */
- public HierarchyEvent(Component source, int id, Component changed,
- Container changedParent)
- {
- this(source, id, changed, changedParent, 0);
- }
-
- /**
- * Initializes a new instance of HierarchyEvent
with the
- * specified parameters. Note that an invalid id leads to unspecified
- * results.
- *
- * @param source the component whose hierarchy changed
- * @param id the event id
- * @param changed the top component in the tree of changed hierarchy
- * @param changedParent the updated parent of this object
- * @param changeFlags the bitmask of specific HIERARCHY_CHANGED events
- * @throws IllegalArgumentException if source is null
- */
- public HierarchyEvent(Component source, int id, Component changed,
- Container changedParent, long changeFlags)
- {
- super(source, id);
- this.changed = changed;
- this.changedParent = changedParent;
- this.changeFlags = changeFlags;
- }
-
- /**
- * This method returns the event source as a Component
. If the
- * source has subsequently been modified to a non-Component, this returns
- * null.
- *
- * @return the event source as a Component
, or null
- */
- public Component getComponent()
- {
- return source instanceof Component ? (Component) source : null;
- }
-
- /**
- * Returns the component at the top of the hierarchy which changed.
- *
- * @return the top changed component
- */
- public Component getChanged()
- {
- return changed;
- }
-
- /**
- * Returns the parent of the component listed in getChanged()
.
- * If the cause of this event was Container.add
, this is the
- * new parent; if the cause was Container.remove
, this is the
- * old parent; otherwise it is the unchanged parent.
- *
- * @return the parent container of the changed component
- */
- public Container getChangedParent()
- {
- return changedParent;
- }
-
- /**
- * If this is a HIERARCHY_CHANGED event, this returns a bitmask of the
- * types of changes that took place.
- *
- * @return the bitwise or of hierarchy change types, or 0
- * @see #PARENT_CHANGED
- * @see #DISPLAYABILITY_CHANGED
- * @see #SHOWING_CHANGED
- */
- public long getChangeFlags()
- {
- return changeFlags;
- }
-
- /**
- * This method returns a string identifying this event. This is the field
- * name of the id type, followed by a parenthesized listing of the changed
- * component and its parent container. In addition, if the type is
- * HIERARCHY_CHANGED, the flags preceed the changed component, in the
- * order PARENT_CHANGED, DISPLAYABILITY_CHANGED, and SHOWING_CHANGED.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- StringBuffer r = new StringBuffer();
- switch (id)
- {
- case HIERARCHY_CHANGED:
- r.append("HIERARCHY_CHANGED (");
- if ((changeFlags & PARENT_CHANGED) != 0)
- r.append("PARENT_CHANGED,");
- if ((changeFlags & DISPLAYABILITY_CHANGED) != 0)
- r.append("DISPLAYABILITY_CHANGED,");
- if ((changeFlags & SHOWING_CHANGED) != 0)
- r.append("SHOWING_CHANGED,");
- break;
- case ANCESTOR_MOVED:
- r.append("ANCESTOR_MOVED (");
- break;
- case ANCESTOR_RESIZED:
- r.append("ANCESTOR_RESIZED (");
- break;
- default:
- return "unknown type";
- }
- r.append(changed).append(',').append(changedParent).append(')');
- return r.toString();
- }
-} // class HierarchyEvent
diff --git a/libjava/java/awt/event/HierarchyListener.java b/libjava/java/awt/event/HierarchyListener.java
deleted file mode 100644
index f90414b866b..00000000000
--- a/libjava/java/awt/event/HierarchyListener.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* HierarchyListener.java -- listens to changes in the component hierarchy
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This listens for changes in the hierarchy tree of components. Normally it is
- * not necessary to process these events since the AWT handles them
- * internally, taking all appropriate actions.
- *
- * @author Bryce McKinlay
- * @see HierarchyEvent
- * @since 1.3
- * @status updated to 1.4
- */
-public interface HierarchyListener extends EventListener
-{
- /**
- * Called when the hierarchy of this component changes. Use
- * getChangeFlags()
on the event to see what exactly changed.
- *
- * @param e the event describing the change
- */
- void hierarchyChanged(HierarchyEvent e);
-} // interface HierarchyListener
diff --git a/libjava/java/awt/event/InputEvent.java b/libjava/java/awt/event/InputEvent.java
deleted file mode 100644
index 8f9aed611f8..00000000000
--- a/libjava/java/awt/event/InputEvent.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/* InputEvent.java -- common superclass of component input events
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import gnu.java.awt.EventModifier;
-
-import java.awt.Component;
-
-/**
- * This is the common superclass for all component input classes. These are
- * passed to listeners before the component, so that listeners can consume
- * the event before it does its default behavior.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see KeyEvent
- * @see KeyAdapter
- * @see MouseEvent
- * @see MouseAdapter
- * @see MouseMotionAdapter
- * @see MouseWheelEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class InputEvent extends ComponentEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -2482525981698309786L;
-
- /**
- * This is the bit mask which indicates the shift key is down. It is
- * recommended that SHIFT_DOWN_MASK be used instead.
- *
- * @see #SHIFT_DOWN_MASK
- */
- public static final int SHIFT_MASK = 1;
-
- /**
- * This is the bit mask which indicates the control key is down. It is
- * recommended that CTRL_DOWN_MASK be used instead.
- *
- * @see #CTRL_DOWN_MASK
- */
- public static final int CTRL_MASK = 2;
-
- /**
- * This is the bit mask which indicates the meta key is down. It is
- * recommended that META_DOWN_MASK be used instead.
- *
- * @see #META_DOWN_MASK
- */
- public static final int META_MASK = 4;
-
- /**
- * This is the bit mask which indicates the alt key is down. It is
- * recommended that ALT_DOWN_MASK be used instead.
- *
- * @see #ALT_DOWN_MASK
- */
- public static final int ALT_MASK = 8;
-
- /**
- * This is the bit mask which indicates the alt-graph modifier is in effect.
- * It is recommended that ALT_GRAPH_DOWN_MASK be used instead.
- *
- * @see #ALT_GRAPH_DOWN_MASK
- */
- public static final int ALT_GRAPH_MASK = 0x20;
-
- /**
- * This bit mask indicates mouse button one is down. It is recommended that
- * BUTTON1_DOWN_MASK be used instead.
- *
- * @see #BUTTON1_DOWN_MASK
- */
- public static final int BUTTON1_MASK = 0x10;
-
- /**
- * This bit mask indicates mouse button two is down. It is recommended that
- * BUTTON2_DOWN_MASK be used instead.
- *
- * @see #BUTTON2_DOWN_MASK
- */
- public static final int BUTTON2_MASK = 8;
-
- /**
- * This bit mask indicates mouse button three is down. It is recommended
- * that BUTTON3_DOWN_MASK be used instead.
- *
- * @see #BUTTON3_DOWN_MASK
- */
- public static final int BUTTON3_MASK = 4;
-
- /**
- * The SHIFT key extended modifier.
- *
- * @since 1.4
- */
- public static final int SHIFT_DOWN_MASK = 0x0040;
-
- /**
- * The CTRL key extended modifier.
- *
- * @since 1.4
- */
- public static final int CTRL_DOWN_MASK = 0x0080;
-
- /**
- * The META key extended modifier.
- *
- * @since 1.4
- */
- public static final int META_DOWN_MASK = 0x0100;
-
- /**
- * The ALT key extended modifier.
- *
- * @since 1.4
- */
- public static final int ALT_DOWN_MASK = 0x0200;
-
- /**
- * The mouse button1 key extended modifier.
- *
- * @since 1.4
- */
- public static final int BUTTON1_DOWN_MASK = 0x0400;
-
- /**
- * The mouse button2 extended modifier.
- *
- * @since 1.4
- */
- public static final int BUTTON2_DOWN_MASK = 0x0800;
-
- /**
- * The mouse button3 extended modifier.
- *
- * @since 1.4
- */
- public static final int BUTTON3_DOWN_MASK = 0x1000;
-
- /**
- * The ALT_GRAPH key extended modifier.
- *
- * @since 1.4
- */
- public static final int ALT_GRAPH_DOWN_MASK = 0x2000;
-
- /** The mask to convert new to old, package visible for use in subclasses. */
- static final int CONVERT_MASK
- = EventModifier.NEW_MASK & ~(BUTTON2_DOWN_MASK | BUTTON3_DOWN_MASK);
-
- /**
- * The timestamp when this event occurred.
- *
- * @see #getWhen()
- * @serial the timestamp
- */
- private final long when;
-
- /**
- * The modifiers in effect for this event. Package visible for use by
- * subclasses. The old style (bitmask 0x3f) should not be mixed with the
- * new style (bitmasks 0xffffffc0).
- *
- * @see #getModifiers()
- * @see MouseEvent
- * @serial the modifier state, stored in the new style
- */
- int modifiers;
-
- /**
- * Initializes a new instance of InputEvent
with the specified
- * source, id, timestamp, and modifiers. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param when the timestamp when the event occurred
- * @param modifiers the modifiers in effect for this event, old or new style
- * @throws IllegalArgumentException if source is null
- */
- InputEvent(Component source, int id, long when, int modifiers)
- {
- super(source, id);
- this.when = when;
- this.modifiers = EventModifier.extend(modifiers);
- }
-
- /**
- * This method tests whether or not the shift key was down during the event.
- *
- * @return true if the shift key is down
- */
- public boolean isShiftDown()
- {
- return (modifiers & SHIFT_DOWN_MASK) != 0;
- }
-
- /**
- * This method tests whether or not the control key was down during the
- * event.
- *
- * @return true if the control key is down
- */
- public boolean isControlDown()
- {
- return (modifiers & CTRL_DOWN_MASK) != 0;
- }
-
- /**
- * This method tests whether or not the meta key was down during the event.
- *
- * @return true if the meta key is down
- */
- public boolean isMetaDown()
- {
- return (modifiers & META_DOWN_MASK) != 0;
- }
-
- /**
- * This method tests whether or not the alt key was down during the event.
- *
- * @return true if the alt key is down
- */
- public boolean isAltDown()
- {
- return (modifiers & ALT_DOWN_MASK) != 0;
- }
-
- /**
- * This method tests whether or not the alt-graph modifier was in effect
- * during the event.
- *
- * @return true if the alt-graph modifier is down
- */
- public boolean isAltGraphDown()
- {
- return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
- }
-
- /**
- * This method returns the timestamp when this event occurred.
- *
- * @return the timestamp when this event occurred
- */
- public long getWhen()
- {
- return when;
- }
-
- /**
- * This method returns the old-style modifiers in effect for this event.
- * Note that this is ambiguous between button2 and alt, and between
- * button3 and meta. Also, code which generated these modifiers tends to
- * only list the modifier that just changed, even if others were down at
- * the time. Consider using getModifiersEx instead. This will be a union
- * of the bit masks defined in this class that are applicable to the event.
- *
- * @return the modifiers in effect for this event
- * @see #getModifiersEx()
- */
- public int getModifiers()
- {
- return EventModifier.revert(modifiers);
- }
-
- /**
- * Returns the extended modifiers (new-style) for this event. This represents
- * the state of all modal keys and mouse buttons at the time of the event,
- * and does not suffer from the problems mentioned in getModifiers.
- *
- *
- * int onmask = InputEvent.SHIFT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK;
- * int offmask = InputEvent.CTRL_DOWN_MASK;
- * return (event.getModifiersEx() & (onmask | offmask)) == onmask;
- *
- *
- * @return the bitwise or of all modifiers pressed during the event
- * @since 1.4
- */
- public int getModifiersEx()
- {
- return modifiers;
- }
-
- /**
- * Consumes this event. A consumed event is not processed further by the AWT
- * system.
- */
- public void consume()
- {
- consumed = true;
- }
-
- /**
- * This method tests whether or not this event has been consumed.
- *
- * @return true if this event has been consumed
- */
- public boolean isConsumed()
- {
- return consumed;
- }
-
- /**
- * Convert the extended modifier bitmask into a String, such as "Shift" or
- * "Ctrl+Button1".
- *
- * XXX Sun claims this can be localized via the awt.properties file - how
- * do we implement that?
- *
- * @param modifiers the modifiers
- * @return a string representation of the modifiers in this bitmask
- * @since 1.4
- */
- public static String getModifiersExText(int modifiers)
- {
- modifiers &= EventModifier.NEW_MASK;
- if (modifiers == 0)
- return "";
- StringBuffer s = new StringBuffer();
- if ((modifiers & META_DOWN_MASK) != 0)
- s.append("Meta+");
- if ((modifiers & CTRL_DOWN_MASK) != 0)
- s.append("Ctrl+");
- if ((modifiers & ALT_DOWN_MASK) != 0)
- s.append("Alt+");
- if ((modifiers & SHIFT_DOWN_MASK) != 0)
- s.append("Shift+");
- if ((modifiers & ALT_GRAPH_DOWN_MASK) != 0)
- s.append("Alt Graph+");
- if ((modifiers & BUTTON1_DOWN_MASK) != 0)
- s.append("Button1+");
- if ((modifiers & BUTTON2_DOWN_MASK) != 0)
- s.append("Button2+");
- if ((modifiers & BUTTON3_DOWN_MASK) != 0)
- s.append("Button3+");
- return s.substring(0, s.length() - 1);
- }
-} // class InputEvent
diff --git a/libjava/java/awt/event/InputMethodEvent.java b/libjava/java/awt/event/InputMethodEvent.java
deleted file mode 100644
index f6711a8fa5a..00000000000
--- a/libjava/java/awt/event/InputMethodEvent.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/* InputMethodEvent.java -- events from a text input method
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.awt.Component;
-import java.awt.EventQueue;
-import java.awt.font.TextHitInfo;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.text.AttributedCharacterIterator;
-
-/**
- * This class is for event generated by change in a text input method.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see InputMethodListener
- * @since 1.2
- * @status updated to 1.4
- */
-public class InputMethodEvent extends AWTEvent
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 4727190874778922661L;
-
- /** This is the first id in the range of event ids used by this class. */
- public static final int INPUT_METHOD_FIRST = 1100;
-
- /** This event id indicates that the text in the input method has changed. */
- public static final int INPUT_METHOD_TEXT_CHANGED = 1100;
-
- /** This event id indicates that the input method curor point has changed. */
- public static final int CARET_POSITION_CHANGED = 1101;
-
- /** This is the last id in the range of event ids used by this class. */
- public static final int INPUT_METHOD_LAST = 1101;
-
- /**
- * The timestamp when this event was created.
- *
- * @serial the timestamp
- * @since 1.4
- */
- private long when;
-
- /** The input method text. */
- private final transient AttributedCharacterIterator text;
-
- /** The number of committed characters in the text. */
- private final transient int committedCharacterCount;
-
- /** The caret. */
- private final transient TextHitInfo caret;
-
- /** The most important position to be visible. */
- private final transient TextHitInfo visiblePosition;
-
- /**
- * Initializes a new instance of InputMethodEvent
with the
- * specified source, id, timestamp, text, char count, caret, and visible
- * position.
- *
- * @param source the source that generated the event
- * @param id the event id
- * @param when the timestamp of the event
- * @param text the input text
- * @param committedCharacterCount the number of committed characters
- * @param caret the caret position
- * @param visiblePosition the position most important to make visible
- * @throws IllegalArgumentException if source is null, id is invalid, id is
- * CARET_POSITION_CHANGED and text is non-null, or if
- * committedCharacterCount is out of range
- * @since 1.4
- */
- public InputMethodEvent(Component source, int id, long when,
- AttributedCharacterIterator text,
- int committedCharacterCount, TextHitInfo caret,
- TextHitInfo visiblePosition)
- {
- super(source, id);
- this.when = when;
- this.text = text;
- this.committedCharacterCount = committedCharacterCount;
- this.caret = caret;
- this.visiblePosition = visiblePosition;
- if (id < INPUT_METHOD_FIRST || id > INPUT_METHOD_LAST
- || (id == CARET_POSITION_CHANGED && text != null)
- || committedCharacterCount < 0
- || (committedCharacterCount
- > (text == null ? 0 : text.getEndIndex() - text.getBeginIndex())))
- throw new IllegalArgumentException();
- }
-
- /**
- * Initializes a new instance of InputMethodEvent
with the
- * specified source, id, text, char count, caret, and visible position.
- *
- * @param source the source that generated the event
- * @param id the event id
- * @param text the input text
- * @param committedCharacterCount the number of committed characters
- * @param caret the caret position
- * @param visiblePosition the position most important to make visible
- * @throws IllegalArgumentException if source is null, id is invalid, id is
- * CARET_POSITION_CHANGED and text is non-null, or if
- * committedCharacterCount is out of range
- * @since 1.4
- */
- public InputMethodEvent(Component source, int id,
- AttributedCharacterIterator text,
- int committedCharacterCount, TextHitInfo caret,
- TextHitInfo visiblePosition)
- {
- this(source, id, EventQueue.getMostRecentEventTime(), text,
- committedCharacterCount, caret, visiblePosition);
- }
-
- /**
- * Initializes a new instance of InputMethodEvent
with the
- * specified source, id, caret, and visible position, and with a null
- * text and char count.
- *
- * @param source the source that generated the event
- * @param id the event id
- * @param caret the caret position
- * @param visiblePosition the position most important to make visible
- * @throws IllegalArgumentException if source is null or id is invalid
- * @since 1.4
- */
- public InputMethodEvent(Component source, int id, TextHitInfo caret,
- TextHitInfo visiblePosition)
- {
- this(source, id, EventQueue.getMostRecentEventTime(), null, 0, caret,
- visiblePosition);
- }
-
- /**
- * This method returns the input method text. This can be null
,
- * and will always be null for CARET_POSITION_CHANGED
events.
- * Characters from 0 to getCommittedCharacterCount()-1
have
- * been committed, the remaining characters are composed text.
- *
- * @return the input method text, or null
- */
- public AttributedCharacterIterator getText()
- {
- return text;
- }
-
- /**
- * Returns the number of committed characters in the input method text.
- *
- * @return the number of committed characters in the input method text
- */
- public int getCommittedCharacterCount()
- {
- return committedCharacterCount;
- }
-
- /**
- * Returns the caret position. The caret offset is relative to the composed
- * text of the most recent INPUT_METHOD_TEXT_CHANGED
event.
- *
- * @return the caret position, or null
- */
- public TextHitInfo getCaret()
- {
- return caret;
- }
-
- /**
- * Returns the position that is most important to be visible, or null if
- * such a hint is not necessary. The caret offset is relative to the composed
- * text of the most recent INPUT_METHOD_TEXT_CHANGED
event.
- *
- * @return the position that is most important to be visible
- */
- public TextHitInfo getVisiblePosition()
- {
- return visiblePosition;
- }
-
- /**
- * This method consumes the event. A consumed event is not processed
- * in the default manner by the component that generated it.
- */
- public void consume()
- {
- consumed = true;
- }
-
- /**
- * This method tests whether or not this event has been consumed.
- *
- * @return true if the event has been consumed
- */
- public boolean isConsumed()
- {
- return consumed;
- }
-
- /**
- * Return the timestamp of this event.
- *
- * @return the timestamp
- * @since 1.4
- */
- public long getWhen()
- {
- return when;
- }
-
- /**
- * This method returns a string identifying the event. This contains the
- * event ID, the committed and composed characters separated by '+', the
- * number of committed characters, the caret, and the visible position.
- *
- * @return a string identifying the event
- */
- public String paramString()
- {
- StringBuffer s
- = new StringBuffer(80 + (text == null ? 0
- : text.getEndIndex() - text.getBeginIndex()));
- s.append(id == INPUT_METHOD_TEXT_CHANGED ? "INPUT_METHOD_TEXT_CHANGED, "
- : "CARET_POSITION_CHANGED, ");
- if (text == null)
- s.append("no text, 0 characters committed, caret: ");
- else
- {
- s.append('"');
- int i = text.getBeginIndex();
- int j = committedCharacterCount;
- while (--j >= 0)
- s.append(text.setIndex(i++));
- s.append("\" + \"");
- j = text.getEndIndex() - i;
- while (--j >= 0)
- s.append(text.setIndex(i++));
- s.append("\", ").append(committedCharacterCount)
- .append(" characters committed, caret: ");
- }
- s.append(caret == null ? (Object) "no caret" : caret).append(", ")
- .append(visiblePosition == null ? (Object) "no visible position"
- : visiblePosition);
- return s.toString();
- }
-
- /**
- * Reads in the object from a serial stream, updating when to
- * {@link EventQueue#getMostRecentEventTime()} if necessary.
- *
- * @param s the stream to read from
- * @throws IOException if deserialization fails
- * @throws ClassNotFoundException if deserialization fails
- * @serialData default, except for updating when
- */
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
- if (when == 0)
- when = EventQueue.getMostRecentEventTime();
- }
-} // class InputMethodEvent
diff --git a/libjava/java/awt/event/InputMethodListener.java b/libjava/java/awt/event/InputMethodListener.java
deleted file mode 100644
index 8baf022983a..00000000000
--- a/libjava/java/awt/event/InputMethodListener.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* InputMethodListener.java -- listen for input method events
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to receive events from an input
- * method. For a text component to use input methods, it must also install
- * an InputMethodRequests handler.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see InputMethodEvent
- * @see InputMethodRequests
- * @since 1.2
- * @status updated to 1.4
- */
-public interface InputMethodListener extends EventListener
-{
- /**
- * This method is called when the text is changed.
- *
- * @param event the InputMethodEvent
indicating the text change
- */
- void inputMethodTextChanged(InputMethodEvent event);
-
- /**
- * This method is called when the cursor position within the text is changed.
- *
- * @param event the InputMethodEvent
indicating the change
- */
- void caretPositionChanged(InputMethodEvent event);
-} // interface InputMethodListener
diff --git a/libjava/java/awt/event/InvocationEvent.java b/libjava/java/awt/event/InvocationEvent.java
deleted file mode 100644
index 75feb62bd94..00000000000
--- a/libjava/java/awt/event/InvocationEvent.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/* InvocationEvent.java -- call a runnable when dispatched
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.awt.ActiveEvent;
-import java.awt.EventQueue;
-
-/**
- * This event executes {@link Runnable#run()} of a target object when it is
- * dispatched. This class is used by calls to invokeLater
and
- * invokeAndWait
, so client code can use this fact to avoid
- * writing special-casing AWTEventListener objects.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ActiveEvent
- * @see EventQueue#invokeLater(Runnable)
- * @see EventQueue#invokeAndWait(Runnable)
- * @see AWTEventListener
- * @since 1.2
- * @status updated to 1.4
- */
-public class InvocationEvent extends AWTEvent implements ActiveEvent
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 436056344909459450L;
-
- /** This is the first id in the range of event ids used by this class. */
- public static final int INVOCATION_FIRST = 1200;
-
- /** This is the default id for this event type. */
- public static final int INVOCATION_DEFAULT = 1200;
-
- /** This is the last id in the range of event ids used by this class. */
- public static final int INVOCATION_LAST = 1200;
-
- /**
- * This is the Runnable
object to call when dispatched.
- *
- * @serial the runnable to execute
- */
- protected Runnable runnable;
-
- /**
- * This is the object to call notifyAll()
on when
- * the call to run()
returns, or null
if no
- * object is to be notified.
- *
- * @serial the object to notify
- */
- protected Object notifier;
-
- /**
- * This variable is set to true
if exceptions are caught
- * and stored in a variable during the call to run()
, otherwise
- * exceptions are ignored and propagate up.
- *
- * @serial true to catch exceptions
- */
- protected boolean catchExceptions;
-
- /**
- * This is the caught exception thrown in the run()
method. It
- * is null if exceptions are ignored, the run method hasn't completed, or
- * there were no exceptions.
- *
- * @serial the caught exception, if any
- */
- private Exception exception;
-
- /**
- * The timestamp when this event was created.
- *
- * @see #getWhen()
- * @serial the timestamp
- * @since 1.4
- */
- private final long when = EventQueue.getMostRecentEventTime();
-
- /**
- * Initializes a new instance of InvocationEvent
with the
- * specified source and runnable.
- *
- * @param source the source of the event
- * @param runnable the Runnable
object to invoke
- * @throws IllegalArgumentException if source is null
- */
- public InvocationEvent(Object source, Runnable runnable)
- {
- this(source, INVOCATION_DEFAULT, runnable, null, false);
- }
-
- /**
- * Initializes a new instance of InvocationEvent
with the
- * specified source, runnable, and notifier. It will also catch exceptions
- * if specified. If notifier is non-null, this will call notifyAll() on
- * the object when the runnable is complete. If catchExceptions is true,
- * this traps any exception in the runnable, otherwise it lets the exception
- * propagate up the Event Dispatch thread.
- *
- * @param source the source of the event
- * @param runnable the Runnable
object to invoke
- * @param notifier the object to notify, or null
- * @param catchExceptions true to catch exceptions from the runnable
- */
- public InvocationEvent(Object source, Runnable runnable, Object notifier,
- boolean catchExceptions)
- {
- this(source, INVOCATION_DEFAULT, runnable, notifier, catchExceptions);
- }
-
- /**
- * Initializes a new instance of InvocationEvent
with the
- * specified source, runnable, and notifier. It will also catch exceptions
- * if specified. If notifier is non-null, this will call notifyAll() on
- * the object when the runnable is complete. If catchExceptions is true,
- * this traps any exception in the runnable, otherwise it lets the exception
- * propagate up the Event Dispatch thread. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param runnable the Runnable
object to invoke
- * @param notifier the object to notify, or null
- * @param catchExceptions true to catch exceptions from the runnable
- */
- protected InvocationEvent(Object source, int id, Runnable runnable,
- Object notifier, boolean catchExceptions)
- {
- super(source, id);
- this.runnable = runnable;
- this.notifier = notifier;
- this.catchExceptions = catchExceptions;
- }
-
- /**
- * This method calls the run()
method of the runnable, traps
- * exceptions if instructed to do so, and calls notifyAll()
- * on any notifier if all worked successfully.
- */
- public void dispatch()
- {
- if (catchExceptions)
- try
- {
- runnable.run();
- }
- catch (Exception e)
- {
- exception = e;
- }
- else
- runnable.run();
-
- Object o = notifier;
- if (o != null)
- synchronized(o)
- {
- o.notifyAll();
- }
- }
-
- /**
- * This method returns the exception that occurred during the execution of
- * the runnable, or null
if not exception was thrown or
- * exceptions were not caught.
- *
- * @return the exception thrown by the runnable
- */
- public Exception getException()
- {
- return exception;
- }
-
- /**
- * Gets the timestamp of when this event was created.
- *
- * @return the timestamp of this event
- * @since 1.4
- */
- public long getWhen()
- {
- return when;
- }
-
- /**
- * This method returns a string identifying this event. This is formatted as:
- * "INVOCATION_DEFAULT,runnable=" + runnable + ",notifier=" + notifier
- * + ",catchExceptions=" + catchExceptions + ",when=" + getWhen()
.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- return (id == INVOCATION_DEFAULT ? "INVOCATION_DEFAULT,runnable="
- : "unknown type,runnable=") + runnable + ",notifier=" + notifier
- + ",catchExceptions=" + catchExceptions + ",when=" + when;
- }
-} // class InvocationEvent
diff --git a/libjava/java/awt/event/ItemEvent.java b/libjava/java/awt/event/ItemEvent.java
deleted file mode 100644
index 467815b1608..00000000000
--- a/libjava/java/awt/event/ItemEvent.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/* ItemEvent.java -- event for item state changes
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-import java.awt.ItemSelectable;
-
-/**
- * This event is generated when a selection item changes state. This is an
- * abstraction that distills a large number of individual mouse or keyboard
- * events into a simpler "item selected" and "item deselected" events.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ItemSelectable
- * @see ItemListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class ItemEvent extends AWTEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -608708132447206933L;
-
- /** This is the first id in the event id range used by this class. */
- public static final int ITEM_FIRST = 701;
-
- /** This is the last id in the event id range used by this class. */
- public static final int ITEM_LAST = 701;
-
- /** This event id indicates a state change occurred. */
- public static final int ITEM_STATE_CHANGED = 701;
-
- /** This type indicates that the item was selected. */
- public static final int SELECTED = 1;
-
- /** This type indicates that the item was deselected. */
- public static final int DESELECTED = 2;
-
- /**
- * The item affected by this event.
- *
- * @serial the item of the selection
- */
- private final Object item;
-
- /**
- * The state change direction, one of {@link #SELECTED} or
- * {@link #DESELECTED}.
- *
- * @serial the selection state
- */
- private final int stateChange;
-
- /**
- * Initializes a new instance of ItemEvent
with the specified
- * source, id, and state change constant. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param item the item affected by the state change
- * @param stateChange one of {@link #SELECTED} or {@link #DESELECTED}
- */
- public ItemEvent(ItemSelectable source, int id, Object item, int stateChange)
- {
- super(source, id);
- this.item = item;
- this.stateChange = stateChange;
- }
-
- /**
- * This method returns the event source as an ItemSelectable
.
- *
- * @return the event source as an ItemSelected
- * @throws ClassCastException if source is changed to a non-ItemSelectable
- */
- public ItemSelectable getItemSelectable()
- {
- return (ItemSelectable) source;
- }
-
- /**
- * Returns the item affected by this state change.
- *
- * @return the item affected by this state change
- */
- public Object getItem()
- {
- return item;
- }
-
- /**
- * Returns the type of state change, either {@link #SELECTED} or
- * {@link #DESELECTED}.
- *
- * @return the type of state change
- */
- public int getStateChange()
- {
- return stateChange;
- }
-
- /**
- * Returns a string identifying this event. This is in the format:
- * "ITEM_STATE_CHANGED,item=" + item + ",stateChange="
- * + (getStateChange() == DESELECTED ? "DESELECTED" : "SELECTED")
.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- return (id == ITEM_STATE_CHANGED ? "ITEM_STATE_CHANGED,item="
- : "unknown type,item=") + item + ",stateChange="
- + (stateChange == SELECTED ? "SELECTED"
- : stateChange == DESELECTED ? "DESELECTED" : "unknown type");
- }
-} // class ItemEvent
diff --git a/libjava/java/awt/event/ItemListener.java b/libjava/java/awt/event/ItemListener.java
deleted file mode 100644
index 34fe7901b12..00000000000
--- a/libjava/java/awt/event/ItemListener.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ItemListener.java -- listen for item events
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to receive events when an
- * item's selection state changes.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ItemSelectable
- * @see ItemEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface ItemListener extends EventListener
-{
- /**
- * This method is called when an item's state is changed.
- *
- * @param event the ItemEvent
indicating the change
- */
- void itemStateChanged(ItemEvent event);
-} // interface ItemListener
diff --git a/libjava/java/awt/event/KeyAdapter.java b/libjava/java/awt/event/KeyAdapter.java
deleted file mode 100644
index c01d61ff339..00000000000
--- a/libjava/java/awt/event/KeyAdapter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/* KeyAdapter.java -- convenience class for writing key listeners
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-/**
- * This class implements KeyListener
and implements all methods
- * with empty bodies. This allows a listener interested in implementing only
- * a subset of the KeyListener
interface to extend this class
- * and override only the desired methods.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see KeyEvent
- * @see KeyListener
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class KeyAdapter implements KeyListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public KeyAdapter()
- {
- }
-
- /**
- * Implements this method in the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void keyTyped(KeyEvent event)
- {
- }
-
- /**
- * Implements this method in the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void keyPressed(KeyEvent event)
- {
- }
-
- /**
- * Implements this method in the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void keyReleased(KeyEvent event)
- {
- }
-} // class KeyAdapter
diff --git a/libjava/java/awt/event/KeyEvent.java b/libjava/java/awt/event/KeyEvent.java
deleted file mode 100644
index a40a8e15c04..00000000000
--- a/libjava/java/awt/event/KeyEvent.java
+++ /dev/null
@@ -1,1740 +0,0 @@
-/* KeyEvent.java -- event for key presses
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import gnu.java.awt.EventModifier;
-
-import java.awt.Component;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-
-/**
- * This event is generated when a key is pressed or released. There are two
- * categories of key events:
- *
- * getKeyCode
method will return VK_UNDEFINED
,
- * and getKeyChar
will return a valid Unicode character or
- * CHAR_UNDEFINED
.
- *
- * getKeyCode
method will return one of the
- * VK_*
constants (except VK_UNDEFINED), and the
- * getKeyChar
method is undefined.
- *
- * KeyEvent
with the specified
- * information. Note that an invalid id leads to unspecified results.
- *
- * @param source the component that generated this event
- * @param id the event id
- * @param when the timestamp when the even occurred
- * @param modifiers the modifier keys during the event, in old or new style
- * @param keyCode the integer constant for the virtual key type
- * @param keyChar the Unicode value of the key
- * @param keyLocation the location of the key
- * @throws IllegalArgumentException if source is null, if keyLocation is
- * invalid, or if (id == KEY_TYPED && (keyCode != VK_UNDEFINED
- * || keyChar == CHAR_UNDEFINED))
- */
- public KeyEvent(Component source, int id, long when, int modifiers,
- int keyCode, char keyChar, int keyLocation)
- {
- super(source, id, when, modifiers);
- this.keyCode = keyCode;
- this.keyChar = keyChar;
- this.keyLocation = keyLocation;
- if ((id == KEY_TYPED && (keyCode != VK_UNDEFINED
- || keyChar == CHAR_UNDEFINED))
- || keyLocation < KEY_LOCATION_UNKNOWN
- || keyLocation > KEY_LOCATION_NUMPAD)
- throw new IllegalArgumentException();
- }
-
- /**
- * Initializes a new instance of KeyEvent
with the specified
- * information. Note that an invalid id leads to unspecified results.
- *
- * @param source the component that generated this event
- * @param id the event id
- * @param when the timestamp when the even occurred
- * @param modifiers the modifier keys during the event, in old or new style
- * @param keyCode the integer constant for the virtual key type
- * @param keyChar the Unicode value of the key
- * @throws IllegalArgumentException if source is null, or if
- * (id == KEY_TYPED && (keyCode != VK_UNDEFINED
- * || keyChar == CHAR_UNDEFINED))
- */
- public KeyEvent(Component source, int id, long when, int modifiers,
- int keyCode, char keyChar)
- {
- this(source, id, when, modifiers, keyCode, keyChar, KEY_LOCATION_UNKNOWN);
- }
-
- /**
- * Initializes a new instance of KeyEvent
with the specified
- * information. Note that an invalid id leads to unspecified results.
- *
- * @param source the component that generated this event
- * @param id the event id
- * @param when the timestamp when the even occurred
- * @param modifiers the modifier keys during the event, in old or new style
- * @param keyCode the integer constant for the virtual key type
- * @throws IllegalArgumentException if source is null, or if
- * id == KEY_TYPED but keyCode != VK_UNDEFINED
- *
- * @deprecated
- */
- public KeyEvent(Component source, int id, long when, int modifiers,
- int keyCode)
- {
- this(source, id, when, modifiers, keyCode, '\0', KEY_LOCATION_UNKNOWN);
- }
-
- /**
- * Returns the key code for the event key. This will be one of the
- * VK_*
constants defined in this class. If the event type is
- * KEY_TYPED, the result will be VK_UNDEFINED.
- *
- * @return the key code for this event
- */
- public int getKeyCode()
- {
- return keyCode;
- }
-
- /**
- * Sets the key code for this event. This must be one of the
- * VK_*
constants defined in this class.
- *
- * @param keyCode the new key code for this event
- */
- public void setKeyCode(int keyCode)
- {
- this.keyCode = keyCode;
- }
-
- /**
- * Returns the Unicode value for the event key. This will be
- * CHAR_UNDEFINED
if there is no Unicode equivalent for
- * this key, usually when this is a KEY_PRESSED or KEY_RELEASED event.
- *
- * @return the Unicode character for this event
- */
- public char getKeyChar()
- {
- return keyChar;
- }
-
- /**
- * Sets the Unicode character for this event to the specified value.
- *
- * @param keyChar the new Unicode character for this event
- */
- public void setKeyChar(char keyChar)
- {
- this.keyChar = keyChar;
- }
-
- /**
- * Sets the modifier keys to the specified value. This should be a union
- * of the bit mask constants from InputEvent
. The use of this
- * method is not recommended, particularly for KEY_TYPED events, which do
- * not check if the modifiers were changed.
- *
- * @param modifiers the new modifier value, in either old or new style
- * @see InputEvent
- *
- * @deprecated
- */
- public void setModifiers(int modifiers)
- {
- this.modifiers = EventModifier.extend(modifiers);
- }
-
- /**
- * Returns the keyboard location of the key that generated this event. This
- * provides a way to distinguish between keys like left and right shift
- * which share a common key code. The result will be one of
- * {@link #KEY_LOCATION_UNKNOWN}, {@link #KEY_LOCATION_STANDARD},
- * {@link #KEY_LOCATION_LEFT}, {@link #KEY_LOCATION_RIGHT}, or
- * {@link #KEY_LOCATION_NUMPAD}.
- *
- * @return the key location
- * @since 1.4
- */
- public int getKeyLocation()
- {
- return keyLocation;
- }
-
- /**
- * Returns the text name of key code, such as "HOME", "F1", or "A".
- *
- * XXX Sun claims this can be localized via the awt.properties file - how
- * do we implement that?
- *
- * @return the text name of the key code
- */
- public static String getKeyText(int keyCode)
- {
- switch (keyCode)
- {
- case VK_CANCEL:
- return "Cancel";
- case VK_BACK_SPACE:
- return "Backspace";
- case VK_TAB:
- return "Tab";
- case VK_ENTER:
- return "Enter";
- case VK_CLEAR:
- return "Clear";
- case VK_SHIFT:
- return "Shift";
- case VK_CONTROL:
- return "Ctrl";
- case VK_ALT:
- return "Alt";
- case VK_PAUSE:
- return "Pause";
- case VK_CAPS_LOCK:
- return "Caps Lock";
- case VK_KANA:
- return "Kana";
- case VK_FINAL:
- return "Final";
- case VK_KANJI:
- return "Kanji";
- case VK_ESCAPE:
- return "Escape";
- case VK_CONVERT:
- return "Convert";
- case VK_NONCONVERT:
- return "No Convert";
- case VK_ACCEPT:
- return "Accept";
- case VK_MODECHANGE:
- return "Mode Change";
- case VK_SPACE:
- return "Space";
- case VK_PAGE_UP:
- return "Page Up";
- case VK_PAGE_DOWN:
- return "Page Down";
- case VK_END:
- return "End";
- case VK_HOME:
- return "Home";
- case VK_LEFT:
- case VK_KP_LEFT:
- return "Left";
- case VK_UP:
- case VK_KP_UP:
- return "Up";
- case VK_RIGHT:
- case VK_KP_RIGHT:
- return "Right";
- case VK_DOWN:
- case VK_KP_DOWN:
- return "Down";
- case VK_MINUS:
- return "Minus";
- case VK_MULTIPLY:
- return "NumPad *";
- case VK_ADD:
- return "NumPad +";
- case VK_SEPARATOR:
- return "NumPad ,";
- case VK_SUBTRACT:
- return "NumPad -";
- case VK_DECIMAL:
- return "NumPad .";
- case VK_DIVIDE:
- return "NumPad /";
- case VK_DELETE:
- return "Delete";
- case VK_DEAD_GRAVE:
- return "Dead Grave";
- case VK_DEAD_ACUTE:
- return "Dead Acute";
- case VK_DEAD_CIRCUMFLEX:
- return "Dead Circumflex";
- case VK_DEAD_TILDE:
- return "Dead Tilde";
- case VK_DEAD_MACRON:
- return "Dead Macron";
- case VK_DEAD_BREVE:
- return "Dead Breve";
- case VK_DEAD_ABOVEDOT:
- return "Dead Above Dot";
- case VK_DEAD_DIAERESIS:
- return "Dead Diaeresis";
- case VK_DEAD_ABOVERING:
- return "Dead Above Ring";
- case VK_DEAD_DOUBLEACUTE:
- return "Dead Double Acute";
- case VK_DEAD_CARON:
- return "Dead Caron";
- case VK_DEAD_CEDILLA:
- return "Dead Cedilla";
- case VK_DEAD_OGONEK:
- return "Dead Ogonek";
- case VK_DEAD_IOTA:
- return "Dead Iota";
- case VK_DEAD_VOICED_SOUND:
- return "Dead Voiced Sound";
- case VK_DEAD_SEMIVOICED_SOUND:
- return "Dead Semivoiced Sound";
- case VK_NUM_LOCK:
- return "Num Lock";
- case VK_SCROLL_LOCK:
- return "Scroll Lock";
- case VK_AMPERSAND:
- return "Ampersand";
- case VK_ASTERISK:
- return "Asterisk";
- case VK_QUOTEDBL:
- return "Double Quote";
- case VK_LESS:
- return "Less";
- case VK_PRINTSCREEN:
- return "Print Screen";
- case VK_INSERT:
- return "Insert";
- case VK_HELP:
- return "Help";
- case VK_META:
- return "Meta";
- case VK_GREATER:
- return "Greater";
- case VK_BRACELEFT:
- return "Left Brace";
- case VK_BRACERIGHT:
- return "Right Brace";
- case VK_BACK_QUOTE:
- return "Back Quote";
- case VK_QUOTE:
- return "Quote";
- case VK_ALPHANUMERIC:
- return "Alphanumeric";
- case VK_KATAKANA:
- return "Katakana";
- case VK_HIRAGANA:
- return "Hiragana";
- case VK_FULL_WIDTH:
- return "Full-Width";
- case VK_HALF_WIDTH:
- return "Half-Width";
- case VK_ROMAN_CHARACTERS:
- return "Roman Characters";
- case VK_ALL_CANDIDATES:
- return "All Candidates";
- case VK_PREVIOUS_CANDIDATE:
- return "Previous Candidate";
- case VK_CODE_INPUT:
- return "Code Input";
- case VK_JAPANESE_KATAKANA:
- return "Japanese Katakana";
- case VK_JAPANESE_HIRAGANA:
- return "Japanese Hiragana";
- case VK_JAPANESE_ROMAN:
- return "Japanese Roman";
- case VK_KANA_LOCK:
- return "Kana Lock";
- case VK_INPUT_METHOD_ON_OFF:
- return "Input Method On/Off";
- case VK_AT:
- return "At";
- case VK_COLON:
- return "Colon";
- case VK_CIRCUMFLEX:
- return "Circumflex";
- case VK_DOLLAR:
- return "Dollar";
- case VK_EURO_SIGN:
- return "Euro";
- case VK_EXCLAMATION_MARK:
- return "Exclamation Mark";
- case VK_INVERTED_EXCLAMATION_MARK:
- return "Inverted Exclamation Mark";
- case VK_LEFT_PARENTHESIS:
- return "Left Parenthesis";
- case VK_NUMBER_SIGN:
- return "Number Sign";
- case VK_PLUS:
- return "Plus";
- case VK_RIGHT_PARENTHESIS:
- return "Right Parenthesis";
- case VK_UNDERSCORE:
- return "Underscore";
- case VK_COMPOSE:
- return "Compose";
- case VK_ALT_GRAPH:
- return "Alt Graph";
- case VK_STOP:
- return "Stop";
- case VK_AGAIN:
- return "Again";
- case VK_PROPS:
- return "Props";
- case VK_UNDO:
- return "Undo";
- case VK_COPY:
- return "Copy";
- case VK_PASTE:
- return "Paste";
- case VK_FIND:
- return "Find";
- case VK_CUT:
- return "Cut";
- case VK_COMMA:
- case VK_PERIOD:
- case VK_SLASH:
- case VK_0:
- case VK_1:
- case VK_2:
- case VK_3:
- case VK_4:
- case VK_5:
- case VK_6:
- case VK_7:
- case VK_8:
- case VK_9:
- case VK_SEMICOLON:
- case VK_EQUALS:
- case VK_A:
- case VK_B:
- case VK_C:
- case VK_D:
- case VK_E:
- case VK_F:
- case VK_G:
- case VK_H:
- case VK_I:
- case VK_J:
- case VK_K:
- case VK_L:
- case VK_M:
- case VK_N:
- case VK_O:
- case VK_P:
- case VK_Q:
- case VK_R:
- case VK_S:
- case VK_T:
- case VK_U:
- case VK_V:
- case VK_W:
- case VK_X:
- case VK_Y:
- case VK_Z:
- case VK_OPEN_BRACKET:
- case VK_BACK_SLASH:
- case VK_CLOSE_BRACKET:
- return "" + (char) keyCode;
- case VK_NUMPAD0:
- case VK_NUMPAD1:
- case VK_NUMPAD2:
- case VK_NUMPAD3:
- case VK_NUMPAD4:
- case VK_NUMPAD5:
- case VK_NUMPAD6:
- case VK_NUMPAD7:
- case VK_NUMPAD8:
- case VK_NUMPAD9:
- return "NumPad-" + (keyCode - VK_NUMPAD0);
- case VK_F1:
- case VK_F2:
- case VK_F3:
- case VK_F4:
- case VK_F5:
- case VK_F6:
- case VK_F7:
- case VK_F8:
- case VK_F9:
- case VK_F10:
- case VK_F11:
- case VK_F12:
- return "F" + (keyCode - (VK_F1 - 1));
- case VK_F13:
- case VK_F14:
- case VK_F15:
- case VK_F16:
- case VK_F17:
- case VK_F18:
- case VK_F19:
- case VK_F20:
- case VK_F21:
- case VK_F22:
- case VK_F23:
- case VK_F24:
- return "F" + (keyCode - (VK_F13 - 13));
- default:
- // This is funky on negative numbers, but that's Sun's fault.
- return "Unknown keyCode: 0x" + (keyCode < 0 ? "-" : "")
- + Integer.toHexString(Math.abs(keyCode));
- }
- }
-
- /**
- * Returns a string describing the modifiers, such as "Shift" or
- * "Ctrl+Button1".
- *
- * XXX Sun claims this can be localized via the awt.properties file - how
- * do we implement that?
- *
- * @param modifiers the old-style modifiers to convert to text
- * @return a string representation of the modifiers in this bitmask
- */
- public static String getKeyModifiersText(int modifiers)
- {
- return getModifiersExText(EventModifier.extend(modifiers
- & EventModifier.OLD_MASK));
- }
-
- /**
- * Tests whether or not this key is an action key. An action key typically
- * does not fire a KEY_TYPED event, and is not a modifier.
- *
- * @return true if this is an action key
- */
- public boolean isActionKey()
- {
- switch (keyCode)
- {
- case VK_PAUSE:
- case VK_CAPS_LOCK:
- case VK_KANA:
- case VK_FINAL:
- case VK_KANJI:
- case VK_CONVERT:
- case VK_NONCONVERT:
- case VK_ACCEPT:
- case VK_MODECHANGE:
- case VK_PAGE_UP:
- case VK_PAGE_DOWN:
- case VK_END:
- case VK_HOME:
- case VK_LEFT:
- case VK_UP:
- case VK_RIGHT:
- case VK_DOWN:
- case VK_F1:
- case VK_F2:
- case VK_F3:
- case VK_F4:
- case VK_F5:
- case VK_F6:
- case VK_F7:
- case VK_F8:
- case VK_F9:
- case VK_F10:
- case VK_F11:
- case VK_F12:
- case VK_NUM_LOCK:
- case VK_SCROLL_LOCK:
- case VK_PRINTSCREEN:
- case VK_INSERT:
- case VK_HELP:
- case VK_KP_UP:
- case VK_KP_DOWN:
- case VK_KP_LEFT:
- case VK_KP_RIGHT:
- case VK_ALPHANUMERIC:
- case VK_KATAKANA:
- case VK_HIRAGANA:
- case VK_FULL_WIDTH:
- case VK_HALF_WIDTH:
- case VK_ROMAN_CHARACTERS:
- case VK_ALL_CANDIDATES:
- case VK_PREVIOUS_CANDIDATE:
- case VK_CODE_INPUT:
- case VK_JAPANESE_KATAKANA:
- case VK_JAPANESE_HIRAGANA:
- case VK_JAPANESE_ROMAN:
- case VK_KANA_LOCK:
- case VK_INPUT_METHOD_ON_OFF:
- case VK_F13:
- case VK_F14:
- case VK_F15:
- case VK_F16:
- case VK_F17:
- case VK_F18:
- case VK_F19:
- case VK_F20:
- case VK_F21:
- case VK_F22:
- case VK_F23:
- case VK_F24:
- case VK_STOP:
- case VK_AGAIN:
- case VK_PROPS:
- case VK_UNDO:
- case VK_COPY:
- case VK_PASTE:
- case VK_FIND:
- case VK_CUT:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Returns a string identifying the event. This is formatted as the
- * field name of the id type, followed by the keyCode, then the
- * keyChar, modifiers (if any), extModifiers (if any), and
- * keyLocation.
- *
- * @return a string identifying the event
- */
- public String paramString()
- {
- StringBuffer s = new StringBuffer();
-
- switch (id)
- {
- case KEY_PRESSED:
- s.append("KEY_PRESSED");
- break;
- case KEY_RELEASED:
- s.append("KEY_RELEASED");
- break;
- case KEY_TYPED:
- s.append("KEY_TYPED");
- break;
- default:
- s.append("unknown type");
- }
-
- s.append(",keyCode=").append(keyCode);
-
- s.append(",keyText=").append(getKeyText(keyCode));
-
- s.append(",keyChar=");
- if (isActionKey()
- || keyCode == VK_SHIFT
- || keyCode == VK_CONTROL
- || keyCode == VK_ALT)
- s.append("Undefined keyChar");
- else
- {
- /* This output string must be selected by examining keyChar
- * rather than keyCode, because key code information is not
- * included in KEY_TYPED events.
- */
- if (keyChar == VK_BACK_SPACE
- || keyChar == VK_TAB
- || keyChar == VK_ENTER
- || keyChar == VK_ESCAPE
- || keyChar == VK_DELETE)
- s.append(getKeyText(keyChar));
- else
- s.append("'").append(keyChar).append("'");
- }
-
- if ((modifiers & CONVERT_MASK) != 0)
- s.append(",modifiers=").append(getModifiersExText(modifiers
- & CONVERT_MASK));
- if (modifiers != 0)
- s.append(",extModifiers=").append(getModifiersExText(modifiers));
-
- s.append(",keyLocation=KEY_LOCATION_");
- switch (keyLocation)
- {
- case KEY_LOCATION_UNKNOWN:
- s.append("UNKNOWN");
- break;
- case KEY_LOCATION_STANDARD:
- s.append("STANDARD");
- break;
- case KEY_LOCATION_LEFT:
- s.append("LEFT");
- break;
- case KEY_LOCATION_RIGHT:
- s.append("RIGHT");
- break;
- case KEY_LOCATION_NUMPAD:
- s.append("NUMPAD");
- }
-
- return s.toString();
- }
-
- /**
- * Reads in the object from a serial stream.
- *
- * @param s the stream to read from
- * @throws IOException if deserialization fails
- * @throws ClassNotFoundException if deserialization fails
- * @serialData default, except that the modifiers are converted to new style
- */
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
- modifiers = EventModifier.extend(modifiers);
- }
-} // class KeyEvent
diff --git a/libjava/java/awt/event/KeyListener.java b/libjava/java/awt/event/KeyListener.java
deleted file mode 100644
index 5c0a640f67e..00000000000
--- a/libjava/java/awt/event/KeyListener.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* KeyListener.java -- listen for keyboard presses
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to receive keyboard events. To
- * watch a subset of these events, use a KeyAdapter.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see KeyAdapter
- * @see KeyEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface KeyListener extends EventListener
-{
- /**
- * This method is called when a key is typed. A key is considered typed
- * when it and all modifiers have been pressed and released, mapping to
- * a single virtual key.
- *
- * @param event the KeyEvent
indicating that a key was typed
- */
- void keyTyped(KeyEvent event);
-
- /**
- * This method is called when a key is pressed.
- *
- * @param event the KeyEvent
indicating the key press
- */
- void keyPressed(KeyEvent event);
-
- /**
- * This method is called when a key is released.
- *
- * @param event the KeyEvent
indicating the key release
- */
- void keyReleased(KeyEvent event);
-} // interface KeyListener
diff --git a/libjava/java/awt/event/MouseAdapter.java b/libjava/java/awt/event/MouseAdapter.java
deleted file mode 100644
index 9f40c285ac7..00000000000
--- a/libjava/java/awt/event/MouseAdapter.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/* MouseAdapter.java -- convenience class for writing mouse listeners
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-/**
- * This class implements MouseListener
and implements all methods
- * with empty bodies. This allows a listener interested in implementing only
- * a subset of the MouseListener
interface to extend this class
- * and override only the desired methods.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see MouseEvent
- * @see MouseListener
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class MouseAdapter implements MouseListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public MouseAdapter()
- {
- }
-
- /**
- * Implements this method in the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void mouseClicked(MouseEvent event)
- {
- }
-
- /**
- * Implements this method in the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void mousePressed(MouseEvent event)
- {
- }
-
- /**
- * Implements this method in the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void mouseReleased(MouseEvent event)
- {
- }
-
- /**
- * Implements this method in the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void mouseEntered(MouseEvent event)
- {
- }
-
- /**
- * Implements this method in the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void mouseExited(MouseEvent event)
- {
- }
-} // class MouseAdapter
diff --git a/libjava/java/awt/event/MouseEvent.java b/libjava/java/awt/event/MouseEvent.java
deleted file mode 100644
index 249c3d112e4..00000000000
--- a/libjava/java/awt/event/MouseEvent.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/* MouseEvent.java -- a mouse event
- Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import gnu.java.awt.EventModifier;
-
-import java.awt.Component;
-import java.awt.Point;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-
-/**
- * This event is generated for a mouse event. There are three main categories
- * of mouse events: Regular events include pressing, releasing, and clicking
- * buttons, as well as moving over the boundary of the unobscured portion of
- * a component. Motion events include movement and dragging. Wheel events are
- * covered separately by the subclass MouseWheelEvent.
- *
- * getModifiers
, and is returned by getButton
,
- * while all buttons that are down show up in getModifiersEx
.
- *
- * MouseEvent
with the specified
- * information. Note that an invalid id leads to unspecified results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param when the timestamp of when the event occurred
- * @param modifiers the modifier keys during the event, in old or new style
- * @param x the X coordinate of the mouse point
- * @param y the Y coordinate of the mouse point
- * @param clickCount the number of mouse clicks for this event
- * @param popupTrigger true if this event triggers a popup menu
- * @param button the most recent mouse button to change state
- * @throws IllegalArgumentException if source is null or button is invalid
- * @since 1.4
- */
- public MouseEvent(Component source, int id, long when, int modifiers,
- int x, int y, int clickCount, boolean popupTrigger,
- int button)
- {
- super(source, id, when, modifiers);
- this.x = x;
- this.y = y;
- this.clickCount = clickCount;
- this.popupTrigger = popupTrigger;
- this.button = button;
- if (button < NOBUTTON || button > BUTTON3)
- throw new IllegalArgumentException();
- if ((modifiers & EventModifier.OLD_MASK) != 0)
- {
- if ((modifiers & BUTTON1_MASK) != 0)
- this.button = BUTTON1;
- else if ((modifiers & BUTTON2_MASK) != 0)
- this.button = BUTTON2;
- else if ((modifiers & BUTTON3_MASK) != 0)
- this.button = BUTTON3;
- }
- }
-
- /**
- * Initializes a new instance of MouseEvent
with the specified
- * information. Note that an invalid id leads to unspecified results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param when the timestamp of when the event occurred
- * @param modifiers the modifier keys during the event, in old or new style
- * @param x the X coordinate of the mouse point
- * @param y the Y coordinate of the mouse point
- * @param clickCount the number of mouse clicks for this event
- * @param popupTrigger true if this event triggers a popup menu
- * @throws IllegalArgumentException if source is null
- */
- public MouseEvent(Component source, int id, long when, int modifiers,
- int x, int y, int clickCount, boolean popupTrigger)
- {
- this(source, id, when, modifiers, x, y, clickCount, popupTrigger,
- NOBUTTON);
- }
-
- /**
- * This method returns the X coordinate of the mouse position. This is
- * relative to the source component.
- *
- * @return the x coordinate
- */
- public int getX()
- {
- return x;
- }
-
- /**
- * This method returns the Y coordinate of the mouse position. This is
- * relative to the source component.
- *
- * @return the y coordinate
- */
- public int getY()
- {
- return y;
- }
-
- /**
- * This method returns a Point
for the x,y position of
- * the mouse pointer. This is relative to the source component.
- *
- * @return a Point
for the event position
- */
- public Point getPoint()
- {
- return new Point(x, y);
- }
-
- /**
- * Translates the event coordinates by the specified x and y offsets.
- *
- * @param dx the value to add to the X coordinate of this event
- * @param dy the value to add to the Y coordiante of this event
- */
- public void translatePoint(int dx, int dy)
- {
- x += dx;
- y += dy;
- }
-
- /**
- * This method returns the number of mouse clicks associated with this
- * event.
- *
- * @return the number of mouse clicks for this event
- */
- public int getClickCount()
- {
- return clickCount;
- }
-
- /**
- * Returns which button, if any, was the most recent to change state. This
- * will be one of {@link #NOBUTTON}, {@link #BUTTON1}, {@link #BUTTON2}, or
- * {@link #BUTTON3}.
- *
- * @return the button that changed state
- * @since 1.4
- */
- public int getButton()
- {
- return button;
- }
-
- /**
- * This method tests whether or not the event is a popup menu trigger. This
- * should be checked in both MousePressed and MouseReleased to be
- * cross-platform compatible, as different systems have different popup
- * triggers.
- *
- * @return true if the event is a popup menu trigger
- */
- public boolean isPopupTrigger()
- {
- return popupTrigger;
- }
-
- /**
- * Returns a string describing the modifiers, such as "Shift" or
- * "Ctrl+Button1".
- *
- * XXX Sun claims this can be localized via the awt.properties file - how
- * do we implement that?
- *
- * @param modifiers the old-style modifiers to convert to text
- * @return a string representation of the modifiers in this bitmask
- */
- public static String getMouseModifiersText(int modifiers)
- {
- modifiers &= EventModifier.OLD_MASK;
- if ((modifiers & BUTTON2_MASK) != 0)
- modifiers |= BUTTON2_DOWN_MASK;
- if ((modifiers & BUTTON3_MASK) != 0)
- modifiers |= BUTTON3_DOWN_MASK;
- return getModifiersExText(EventModifier.extend(modifiers));
- }
-
- /**
- * Returns a string identifying this event. This is formatted as the field
- * name of the id type, followed by the (x,y) point, the most recent button
- * changed, modifiers (if any), extModifiers (if any), and clickCount.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- StringBuffer s = new StringBuffer();
- switch (id)
- {
- case MOUSE_CLICKED:
- s.append("MOUSE_CLICKED,(");
- break;
- case MOUSE_PRESSED:
- s.append("MOUSE_PRESSED,(");
- break;
- case MOUSE_RELEASED:
- s.append("MOUSE_RELEASED,(");
- break;
- case MOUSE_MOVED:
- s.append("MOUSE_MOVED,(");
- break;
- case MOUSE_ENTERED:
- s.append("MOUSE_ENTERED,(");
- break;
- case MOUSE_EXITED:
- s.append("MOUSE_EXITED,(");
- break;
- case MOUSE_DRAGGED:
- s.append("MOUSE_DRAGGED,(");
- break;
- case MOUSE_WHEEL:
- s.append("MOUSE_WHEEL,(");
- break;
- default:
- s.append("unknown type,(");
- }
- s.append(x).append(',').append(y).append("),button=").append(button);
- if ((modifiers & EventModifier.NEW_MASK) != 0)
- {
- int mod = modifiers;
- if ((mod & (ALT_DOWN_MASK | BUTTON2_DOWN_MASK)) != 0)
- mod |= ALT_DOWN_MASK | BUTTON2_DOWN_MASK;
- if ((mod & (META_DOWN_MASK | BUTTON3_DOWN_MASK)) != 0)
- mod |= META_DOWN_MASK | BUTTON3_DOWN_MASK;
- s.append(",modifiers=").append(getModifiersExText(mod));
- }
- if (modifiers != 0)
- s.append(",extModifiers=").append(getModifiersExText(modifiers));
- return s.append(",clickCount=").append(clickCount).toString();
- }
-
- /**
- * Reads in the object from a serial stream.
- *
- * @param s the stream to read from
- * @throws IOException if deserialization fails
- * @throws ClassNotFoundException if deserialization fails
- * @serialData default, except that the modifiers are converted to new style
- */
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
- if ((modifiers & EventModifier.OLD_MASK) != 0)
- {
- if ((modifiers & BUTTON1_MASK) != 0)
- button = BUTTON1;
- else if ((modifiers & BUTTON2_MASK) != 0)
- button = BUTTON2;
- else if ((modifiers & BUTTON3_MASK) != 0)
- button = BUTTON3;
- modifiers = EventModifier.extend(modifiers);
- }
- }
-} // class MouseEvent
diff --git a/libjava/java/awt/event/MouseListener.java b/libjava/java/awt/event/MouseListener.java
deleted file mode 100644
index 4508019e108..00000000000
--- a/libjava/java/awt/event/MouseListener.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* MouseListener.java -- listen for mouse clicks and crossing component edges
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to receive mouse events other than
- * simple motion events. This includes clicks (but not mouse wheel events),
- * and crossing component boundaries without change in button status. To
- * track moves and drags, use MouseMotionListener, and to track wheel events,
- * use MouseWheelListener. To watch a subset of these events, use a
- * MouseAdapter.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see MouseAdapter
- * @see MouseEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface MouseListener extends EventListener
-{
- /**
- * This method is called when the mouse is clicked (pressed and released
- * in short succession) on a component.
- *
- * @param event the MouseEvent
indicating the click
- */
- void mouseClicked(MouseEvent event);
-
- /**
- * This method is called when the mouse is pressed over a component.
- *
- * @param event the MouseEvent
for the press
- */
- void mousePressed(MouseEvent event);
-
- /**
- * This method is called when the mouse is released over a component.
- *
- * @param event the MouseEvent
for the release
- */
- void mouseReleased(MouseEvent event);
-
- /**
- * This method is called when the mouse enters a component.
- *
- * @param event the MouseEvent
for the entry
- */
- void mouseEntered(MouseEvent event);
-
- /**
- * This method is called when the mouse exits a component.
- *
- * @param event the MouseEvent
for the exit
- */
- void mouseExited(MouseEvent event);
-} // interface MouseListener
diff --git a/libjava/java/awt/event/MouseMotionAdapter.java b/libjava/java/awt/event/MouseMotionAdapter.java
deleted file mode 100644
index 8a295f66cc0..00000000000
--- a/libjava/java/awt/event/MouseMotionAdapter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* MouseMotionAdapter.java -- convenience class for mouse motion listeners
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-/**
- * This class implements MouseMotionListener
and implements all
- * methods with empty bodies. This allows a listener interested in
- * implementing only a subset of the MouseMotionListener
- * interface to extend this class and override only the desired methods.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see MouseEvent
- * @see MouseMotionListener
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class MouseMotionAdapter implements MouseMotionListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public MouseMotionAdapter()
- {
- }
-
- /**
- * Implement this method in the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void mouseDragged(MouseEvent event)
- {
- }
-
- /**
- * Implement this method in the interface with an empty body.
- *
- * @param event the event, ignored in this implementation
- */
- public void mouseMoved(MouseEvent event)
- {
- }
-} // class MouseMotionAdapter
diff --git a/libjava/java/awt/event/MouseMotionListener.java b/libjava/java/awt/event/MouseMotionListener.java
deleted file mode 100644
index ba2c5698b11..00000000000
--- a/libjava/java/awt/event/MouseMotionListener.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* MouseMotionListener.java -- listen to mouse motion events
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to be notified of mouse movements.
- * This includes moves and drags, but not crossing component boundaries. To
- * track other mouse events, use MouseListener or MouseWheelListener. To
- * watch a subset of these events, use a MouseMotionAdapter.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see MouseMotionAdapter
- * @see MouseEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface MouseMotionListener extends EventListener
-{
- /**
- * This method is called when the mouse is moved over a component
- * while a button has been pressed.
- *
- * @param event the MouseEvent
indicating the motion
- */
- void mouseDragged(MouseEvent event);
-
- /**
- * This method is called when the mouse is moved over a component
- * while no button is pressed.
- *
- * @param event the MouseEvent
indicating the motion
- */
- void mouseMoved(MouseEvent event);
-} // interface MouseMotionListener
diff --git a/libjava/java/awt/event/MouseWheelEvent.java b/libjava/java/awt/event/MouseWheelEvent.java
deleted file mode 100644
index 04286088bd1..00000000000
--- a/libjava/java/awt/event/MouseWheelEvent.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/* MouseWheelEvent.java -- a mouse wheel event
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.Component;
-
-/**
- * This event is generated for a mouse wheel rotation. The wheel (the middle
- * mouse button on most modern mice) can be rotated towards or away from the
- * user, and is ofteh used for scrolling.
- *
- * MouseWheelEvent
with the
- * specified information. Note that an invalid id leads to unspecified
- * results.
- *
- * @param source the source of the event
- * @param id the event id
- * @param when the timestamp of when the event occurred
- * @param modifiers any modifier bits for this event
- * @param x the X coordinate of the mouse point
- * @param y the Y coordinate of the mouse point
- * @param clickCount the number of mouse clicks for this event
- * @param popupTrigger true if this event triggers a popup menu
- * @param scrollType one of {@link #WHEEL_UNIT_SCROLL},
- * {@link #WHEEL_BLOCK_SCROLL}
- * @param scrollAmount the number of units to scroll, ignored for block type
- * @param wheelRotation the number of rotation "clicks"
- * @throws IllegalArgumentException if source is null
- * @see MouseEvent#MouseEvent(Component, int, long, int, int, int, int,
- * boolean)
- */
- public MouseWheelEvent(Component source, int id, long when, int modifiers,
- int x, int y, int clickCount, boolean popupTrigger,
- int scrollType, int scrollAmount, int wheelRotation)
- {
- super(source, id, when, modifiers, x, y, clickCount, popupTrigger);
- this.scrollType = scrollType;
- this.scrollAmount = scrollAmount;
- this.wheelRotation = wheelRotation;
- }
-
- /**
- * This method returns the scrolling pattern this event requests. Legal
- * values are WHEEL_UNIT_SCROLL and WHEEL_BLOCK_SCROLL.
- *
- * @return the scroll type
- * @see Adjustable#getUnitIncrement()
- * @see Adjustable#getBlockIncrement()
- * @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
- * @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int)
- */
- public int getScrollType()
- {
- return scrollType;
- }
-
- /**
- * Returns the number of units to scroll in response to this event. This
- * only makes sense when the scroll type is WHEEL_UNIT_SCROLL.
- *
- * @return the number of scroll units, if defined
- * @see #getScrollType()
- */
- public int getScrollAmount()
- {
- return scrollAmount;
- }
-
- /**
- * Gets the number of "clicks" the wheel was rotated. Negative values move
- * up (away) from the user, positive values move down (towards) the user.
- *
- * @return the number of rotation clicks
- */
- public int getWheelRotation()
- {
- return wheelRotation;
- }
-
- /**
- * This is a convenience method which aids in a common listener for scrolling
- * a scrollpane (although this is already built into ScrollPane and
- * JScrollPane). This method only makes sense when getScrollType() returns
- * WHEEL_UNIT_SCROLL.
- *
- * super.paramString() + ",scrollType=WHEEL_" +
- * (getScrollType() == WHEEL_UNIT_SCROLL ? "UNIT" : "BLOCK")
- * + "_SCROLL,scrollAmount=" + getScrollAmount() + ",wheelRotation="
- * + getWheelRotation()
.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- return super.paramString() + ",scrollType="
- + (scrollType == WHEEL_UNIT_SCROLL ? "WHEEL_UNIT_SCROLL"
- : scrollType == WHEEL_BLOCK_SCROLL ? "WHEEL_BLOCK_SCROLL"
- : "unknown scroll type")
- + ",scrollAmount=" + scrollAmount + ",wheelRotation=" + wheelRotation;
- }
-} // class MouseWheelEvent
diff --git a/libjava/java/awt/event/MouseWheelListener.java b/libjava/java/awt/event/MouseWheelListener.java
deleted file mode 100644
index 1125582e1df..00000000000
--- a/libjava/java/awt/event/MouseWheelListener.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* MouseWheelListener.java -- listen for mouse wheel events
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to receive mouse wheel events. For
- * other events, use MouseListener or MouseMotionListener.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see MouseWheelEvent
- * @since 1.4
- * @status updated to 1.4
- */
-public interface MouseWheelListener extends EventListener
-{
- /**
- * This method is called when the mouse wheel is rotated.
- *
- * @param event the MouseWheelEvent
indicating the rotation
- */
- void mouseWheelMoved(MouseWheelEvent event);
-} // interface MouseWheelListener
diff --git a/libjava/java/awt/event/PaintEvent.java b/libjava/java/awt/event/PaintEvent.java
deleted file mode 100644
index bb89c3722b5..00000000000
--- a/libjava/java/awt/event/PaintEvent.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/* PaintEvent.java -- an area of the screen needs to be repainted
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.Component;
-import java.awt.Rectangle;
-
-/**
- * This event is generated when an area of the screen needs to be painted.
- * This event is not meant for users, but exists to allow proper serialization
- * behavior in the EventQueue with user-accessible events.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class PaintEvent extends ComponentEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 1267492026433337593L;
-
- /** This is the first id in the range of event ids used by this class. */
- public static final int PAINT_FIRST = 800;
-
- /** This is the last id in the range of event ids used by this class. */
- public static final int PAINT_LAST = 801;
-
- /** This id is for paint event types. */
- public static final int PAINT = 800;
-
- /** This id is for update event types. */
- public static final int UPDATE = 801;
-
- /**
- * This is the rectange to be painted or updated.
- *
- * @see #getUpdateRect()
- * @see #setUpdateRect(Rectangle)
- * @serial the non-null rectangle to be painted
- */
- private Rectangle updateRect;
-
- /**
- * Initializes a new instance of PaintEvent
with the specified
- * source, id, and update region. Note that an invalid id leads to
- * unspecified results.
- *
- * @param source the event source
- * @param id the event id
- * @param updateRect the rectangle to repaint
- * @throws IllegalArgumentException if source is null
- */
- public PaintEvent(Component source, int id, Rectangle updateRect)
- {
- super(source, id);
- this.updateRect = updateRect;
- }
-
- /**
- * Returns the rectange to be updated for this event.
- *
- * @return the rectangle to update
- */
- public Rectangle getUpdateRect()
- {
- return updateRect;
- }
-
- /**
- * Sets the rectangle to be updated for this event.
- *
- * @param updateRect the new update rectangle for this event
- */
- public void setUpdateRect(Rectangle updateRect)
- {
- this.updateRect = updateRect;
- }
-
- /**
- * Returns a string identifying this event.
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- return (id == PAINT ? "PAINT,updateRect=" : id == UPDATE
- ? "UPDATE,updateRect=" : "unknown type,updateRect=") + updateRect;
- }
-} // class PaintEvent
diff --git a/libjava/java/awt/event/TextEvent.java b/libjava/java/awt/event/TextEvent.java
deleted file mode 100644
index 43f4bb0e95b..00000000000
--- a/libjava/java/awt/event/TextEvent.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* TextEvent.java -- event for text changes
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.AWTEvent;
-
-/**
- * This event is generated when a text box changes contents. This is an
- * abstraction that distills a large number of individual mouse or keyboard
- * events into a simpler "text changed" event.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see TextComponent
- * @see TextListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class TextEvent extends AWTEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 6269902291250941179L;
-
- /** This is the first id in the range of event ids used by this class. */
- public static final int TEXT_FIRST = 900;
-
- /** This is the last id in the range of event ids used by this class. */
- public static final int TEXT_LAST = 900;
-
- /** This event id indicates that the text of an object has changed. */
- public static final int TEXT_VALUE_CHANGED = 900;
-
- /**
- * Initializes a new instance of TextEvent
with the specified
- * source and id. Note that an invalid id leads to unspecified results.
- *
- * @param source the (TextComponent) object that generated this event
- * @param id the event id
- * @throws IllegalArgumentException if source is null
- */
- public TextEvent(Object source, int id)
- {
- super(source, id);
- }
-
- /**
- * Returns a string identifying this event. This is "TEXT_VALUE_CHANGED".
- *
- * @return a string identifying this event
- */
- public String paramString()
- {
- return id == TEXT_VALUE_CHANGED ? "TEXT_VALUE_CHANGED" : "unknown type";
- }
-} // class TextEvent
diff --git a/libjava/java/awt/event/TextListener.java b/libjava/java/awt/event/TextListener.java
deleted file mode 100644
index bcdd7fa7a11..00000000000
--- a/libjava/java/awt/event/TextListener.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* TextListener.java -- listen for text changes
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to be notified when text changes
- * in a component.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see TextEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface TextListener extends EventListener
-{
- /**
- * This method is called when the text being monitored changes.
- *
- * @param event the TextEvent
indicating the change
- */
- void textValueChanged(TextEvent event);
-} // interface TextListener
diff --git a/libjava/java/awt/event/WindowAdapter.java b/libjava/java/awt/event/WindowAdapter.java
deleted file mode 100644
index 708de588c05..00000000000
--- a/libjava/java/awt/event/WindowAdapter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/* WindowAdapter.java -- convenience class for writing window listeners
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-/**
- * This class implements WindowListener
,
- * WindowStateListener
, and WindowFocusListener
, and
- * implements all methods with empty bodies. This allows a listener
- * interested in listening to only a subset of any WindowEvent
- * actions to extend this class and override only the desired methods.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see ComponentEvent
- * @see ComponentListener
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class WindowAdapter
- implements WindowListener, WindowStateListener, WindowFocusListener
-{
- /**
- * Do nothing default constructor for subclasses.
- */
- public WindowAdapter()
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void windowOpened(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void windowClosing(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void windowClosed(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void windowIconified(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void windowDeiconified(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void windowActivated(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- */
- public void windowDeactivated(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- * @since 1.4
- */
- public void windowStateChanged(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- * @since 1.4
- */
- public void windowGainedFocus(WindowEvent event)
- {
- }
-
- /**
- * Implements this method from the interface with an empty method body.
- *
- * @param event the event, ignored in this implementation
- * @since 1.4
- */
- public void windowLostFocus(WindowEvent event)
- {
- }
-} // class WindowAdapter
diff --git a/libjava/java/awt/event/WindowEvent.java b/libjava/java/awt/event/WindowEvent.java
deleted file mode 100644
index 19229ca9dbc..00000000000
--- a/libjava/java/awt/event/WindowEvent.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/* WindowEvent.java -- window change event
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.awt.Window;
-
-/**
- * This event is generated when there is a change in a window. This includes
- * creation, closing, iconification, activation, and focus changes. There
- * are three listeners, for three types of events: WindowListeners deal with
- * the lifecycle of a window, WindowStateListeners deal with window state
- * like maximization, and WindowFocusListeners deal with focus switching to
- * or from a window.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see WindowAdapter
- * @see WindowListener
- * @see WindowFocusListener
- * @see WindowStateListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class WindowEvent extends ComponentEvent
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -1567959133147912127L;
-
- /** This is the first id in the range of event ids used by this class. */
- public static final int WINDOW_FIRST = 200;
-
- /** This is the id for a window that is opened. */
- public static final int WINDOW_OPENED = 200;
-
- /** This is the id for a window that is about to close. */
- public static final int WINDOW_CLOSING = 201;
-
- /** This is the id for a window that finished closing. */
- public static final int WINDOW_CLOSED = 202;
-
- /** This is the id for a window that is iconified. */
- public static final int WINDOW_ICONIFIED = 203;
-
- /** This is the id for a window that is de-iconified. */
- public static final int WINDOW_DEICONIFIED = 204;
-
- /** This is the id for a window that is activated. */
- public static final int WINDOW_ACTIVATED = 205;
-
- /** This is the id for a window that is de-activated. */
- public static final int WINDOW_DEACTIVATED = 206;
-
- /**
- * This is the id for a window becoming the focused window.
- *
- * @since 1.4
- */
- public static final int WINDOW_GAINED_FOCUS = 207;
-
- /**
- * This is the id for a window losing all focus.
- *
- * @since 1.4
- */
- public static final int WINDOW_LOST_FOCUS = 208;
-
- /**
- * This is the id for a window state change, such as maximization.
- *
- * @since 1.4
- */
- public static final int WINDOW_STATE_CHANGED = 209;
-
- /** This is the last id in the range of event ids used by this class. */
- public static final int WINDOW_LAST = 209;
-
- /**
- * The other Window involved in a focus or activation change. For
- * WINDOW_ACTIVATED and WINDOW_GAINED_FOCUS events, this is the window that
- * lost focus; for WINDOW_DEACTIVATED and WINDOW_LOST_FOCUS, this is the
- * window that stole focus; and for other events (or when native
- * implementation does not have the data available), this is null.
- *
- * @see #getOppositeWindow()
- * @serial the opposite window, or null
- * @since 1.4
- */
- private final Window opposite;
-
- /**
- * The former state of the window.
- *
- * @serial bitmask of the old window state
- * @since 1.4
- */
- private final int oldState;
-
- /**
- * The present state of the window.
- *
- * @serial bitmask of the new window state
- * @since 1.4
- */
- private final int newState;
-
- /**
- * Initializes a new instance of WindowEvent
with the specified
- * parameters. Note that an invalid id leads to unspecified results.
- *
- * @param source the window that generated this event
- * @param id the event id
- * @param opposite the window that received the opposite event, or null
- * @param oldState the previous state of this window
- * @param newState the new state of this window
- * @throws IllegalArgumentException if source is null
- * @since 1.4
- */
- public WindowEvent(Window source, int id, Window opposite,
- int oldState, int newState)
- {
- super(source, id);
- this.opposite = opposite;
- this.oldState = oldState;
- this.newState = newState;
- }
-
- /**
- * Initializes a new instance of WindowEvent
with the specified
- * parameters. Note that an invalid id leads to unspecified results.
- *
- * @param source the window that generated this event
- * @param id the event id
- * @param opposite the window that received the opposite event, or null
- * @throws IllegalArgumentException if source is null
- * @since 1.4
- */
- public WindowEvent(Window source, int id, Window opposite)
- {
- this(source, id, opposite, 0, 0);
- }
-
- /**
- * Initializes a new instance of WindowEvent
with the specified
- * parameters. Note that an invalid id leads to unspecified results.
- *
- * @param source the window that generated this event
- * @param id the event id
- * @param oldState the previous state of this window
- * @param newState the new state of this window
- * @throws IllegalArgumentException if source is null
- * @since 1.4
- */
- public WindowEvent(Window source, int id, int oldState, int newState)
- {
- this(source, id, null, oldState, newState);
- }
-
- /**
- * Initializes a new instance of WindowEvent
with the specified
- * parameters. Note that an invalid id leads to unspecified results.
- *
- * @param source the window that generated this event
- * @param id the event id
- * @throws IllegalArgumentException if source is null
- */
- public WindowEvent(Window source, int id)
- {
- this(source, id, null, 0, 0);
- }
-
- /**
- * Returns the event source as a Window
. If the source has
- * subsequently been modified to a non-Window, this returns null.
- *
- * @return the event source as a Window
- */
- public Window getWindow()
- {
- return source instanceof Window ? (Window) source : null;
- }
-
- /**
- * Returns the opposite window if this window was involved in an activation
- * or focus change. For WINDOW_ACTIVATED and WINDOW_GAINED_FOCUS events,
- * this is the window that lost focus; for WINDOW_DEACTIVATED and
- * WINDOW_LOST_FOCUS, this is the window that stole focus; and for other
- * events (or when native implementation does not have the data available),
- * this is null.
- *
- * @return the opposite window, or null
- * @since 1.4
- */
- public Window getOppositeWindow()
- {
- return opposite;
- }
-
- /**
- * Returns the state of this window before the event. This is the bitwise
- * or of fields in Frame: NORMAL, ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT,
- * and MAXIMIZED_BOTH.
- *
- * @return the former state
- * @see Frame#getExtendedState()
- * @since 1.4
- */
- public int getOldState()
- {
- return oldState;
- }
-
- /**
- * Returns the state of this window after the event. This is the bitwise
- * or of fields in Frame: NORMAL, ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT,
- * and MAXIMIZED_BOTH.
- *
- * @return the updated state
- * @see Frame#getExtendedState()
- * @since 1.4
- */
- public int getNewState()
- {
- return newState;
- }
-
- /**
- * Returns a string that identifies this event. This is formatted as the
- * field name of the id, followed by the opposite window, old state, and
- * new state.
- *
- * @return a string that identifies this event
- */
- public String paramString()
- {
- StringBuffer s = new StringBuffer();
- switch (id)
- {
- case WINDOW_OPENED:
- s.append("WINDOW_OPENED,opposite=");
- break;
- case WINDOW_CLOSING:
- s.append("WINDOW_CLOSING,opposite=");
- break;
- case WINDOW_CLOSED:
- s.append("WINDOW_CLOSED,opposite=");
- break;
- case WINDOW_ICONIFIED:
- s.append("WINDOW_ICONIFIED,opposite=");
- break;
- case WINDOW_DEICONIFIED:
- s.append("WINDOW_DEICONIFIED,opposite=");
- break;
- case WINDOW_ACTIVATED:
- s.append("WINDOW_ACTIVATED,opposite=");
- break;
- case WINDOW_DEACTIVATED:
- s.append("WINDOW_DEACTIVATED,opposite=");
- break;
- case WINDOW_GAINED_FOCUS:
- s.append("WINDOW_GAINED_FOCUS,opposite=");
- break;
- case WINDOW_LOST_FOCUS:
- s.append("WINDOW_LOST_FOCUS,opposite=");
- break;
- case WINDOW_STATE_CHANGED:
- s.append("WINDOW_STATE_CHANGED,opposite=");
- break;
- default:
- s.append("unknown type,opposite=");
- }
- return s.append(opposite).append(",oldState=").append(oldState)
- .append(",newState=").append(newState).toString();
- }
-} // class WindowEvent
diff --git a/libjava/java/awt/event/WindowFocusListener.java b/libjava/java/awt/event/WindowFocusListener.java
deleted file mode 100644
index 738425353e3..00000000000
--- a/libjava/java/awt/event/WindowFocusListener.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* WindowFocusListener.java -- listens for window focus events
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to monitor events for window
- * focus changes. To watch a subset of these events, use a WindowAdapter.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see WindowAdapter
- * @see WindowEvent
- * @since 1.4
- * @status updated to 1.4
- */
-public interface WindowFocusListener extends EventListener
-{
- /**
- * This method is called when a window gains focus.
- *
- * @param event the WindowEvent
indicating the focus change
- */
- void windowGainedFocus(WindowEvent event);
-
- /**
- * This method is called when a window loses focus.
- *
- * @param event the WindowEvent
indicating the focus change
- */
- void windowLostFocus(WindowEvent event);
-} // interface WindowFocusListener
diff --git a/libjava/java/awt/event/WindowListener.java b/libjava/java/awt/event/WindowListener.java
deleted file mode 100644
index 3b0a1da23ef..00000000000
--- a/libjava/java/awt/event/WindowListener.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* WindowListener.java -- listens for window events
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to monitor events for window
- * changes. To watch a subset of these events, use a WindowAdapter.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @see WindowAdapter
- * @see WindowEvent
- * @since 1.1
- * @status updated to 1.4
- */
-public interface WindowListener extends EventListener
-{
- /**
- * This method is called when the window is made visible.
- *
- * @param event the WindowEvent
indicating the change
- */
- void windowOpened(WindowEvent event);
-
- /**
- * This method is called when the user calls the system menu close
- * function, giving the program a chance to cancel the close.
- *
- * @param event the WindowEvent
indicating the close attempt
- */
- void windowClosing(WindowEvent event);
-
- /**
- * This method is called when the window is closed.
- *
- * @param event the WindowEvent
indicating the dispose
- */
- void windowClosed(WindowEvent event);
-
- /**
- * This method is called when the window is iconified.
- *
- * @param event the WindowEvent
indicating the iconification
- * @see Frame#setIconImage(Image)
- */
- void windowIconified(WindowEvent event);
-
- /**
- * This method is called when the window is deiconified.
- *
- * @param event the WindowEvent
indicating the deiconification
- */
- void windowDeiconified(WindowEvent event);
-
- /**
- * This method is called when a window is activated. Only Frames and Dialogs
- * can be active, and the active window always contains the component with
- * focus.
- *
- * @param event the WindowEvent
indicating the activation
- */
- void windowActivated(WindowEvent event);
-
- /**
- * This method is called when the window is deactivated.
- *
- * @param event the WindowEvent
indicating the deactivation
- */
- void windowDeactivated(WindowEvent event);
-} // interface WindowListener
diff --git a/libjava/java/awt/event/WindowStateListener.java b/libjava/java/awt/event/WindowStateListener.java
deleted file mode 100644
index 9bc6174fda1..00000000000
--- a/libjava/java/awt/event/WindowStateListener.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* WindowStateListener.java -- listens for window state changes
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.event;
-
-import java.util.EventListener;
-
-/**
- * This interface is for classes that wish to monitor events for window
- * state changes.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see WindowAdapter
- * @see WindowEvent
- * @since 1.4
- * @status updated to 1.4
- */
-public interface WindowStateListener extends EventListener
-{
- /**
- * This method is called when the window state is changed, because of
- * iconification or maximization.
- *
- * @param event the WindowEvent
indicating the change
- */
- void windowStateChanged(WindowEvent event);
-} // interface WindowStateListener
diff --git a/libjava/java/awt/font/FontRenderContext.java b/libjava/java/awt/font/FontRenderContext.java
deleted file mode 100644
index 78564a647da..00000000000
--- a/libjava/java/awt/font/FontRenderContext.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/* FontRenderContext.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.geom.AffineTransform;
-
-/**
- * @author Michael Koch
- */
-public class FontRenderContext
-{
- private AffineTransform affineTransform;
- private boolean isAntiAliased;
- private boolean usesFractionalMetrics;
-
- /**
- * Construct a new FontRenderContext
.
- */
- protected FontRenderContext()
- {
- // Do nothing here.
- }
-
- /**
- * Construct a new FontRenderContext
.
- */
- public FontRenderContext (AffineTransform tx, boolean isAntiAliased,
- boolean usesFractionalMetrics)
- {
- if (tx != null
- && !tx.isIdentity ())
- {
- this.affineTransform = new AffineTransform (tx);
- }
-
- this.isAntiAliased = isAntiAliased;
- this.usesFractionalMetrics = usesFractionalMetrics;
- }
-
- public boolean equals (Object obj)
- {
- if (! (obj instanceof FontRenderContext))
- return false;
-
- return equals ((FontRenderContext) obj);
- }
-
- public boolean equals (FontRenderContext rhs)
- {
- return (affineTransform.equals (rhs.getTransform ())
- && isAntiAliased == rhs.isAntiAliased ()
- && usesFractionalMetrics == rhs.usesFractionalMetrics ());
- }
-
-
- /**
- * Retrieves the affine transform for scaling typographical points
- * to raster pixels.
- *
- * @return a clone of the transform object.
- */
- public AffineTransform getTransform ()
- {
- if (affineTransform == null)
- return new AffineTransform ();
- else
- return new AffineTransform (affineTransform);
- }
-
-
- /**
- * Returns the hash code of the font render context.
- */
- public int hashCode ()
- {
- // FIXME: check what SUN does here.
- return affineTransform == null ? 0 : affineTransform.hashCode ();
- }
-
- public boolean isAntiAliased ()
- {
- return isAntiAliased;
- }
-
- public boolean usesFractionalMetrics ()
- {
- return usesFractionalMetrics;
- }
-}
-
diff --git a/libjava/java/awt/font/GlyphJustificationInfo.java b/libjava/java/awt/font/GlyphJustificationInfo.java
deleted file mode 100644
index 5f45fd58498..00000000000
--- a/libjava/java/awt/font/GlyphJustificationInfo.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* GlyphJustificationInfo.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-/**
- * @author Michael Koch
- */
-public final class GlyphJustificationInfo
-{
- public static final int PRIORITY_KASHIDA = 0;
- public static final int PRIORITY_WHITESPACE = 1;
- public static final int PRIORITY_INTERCHAR = 2;
- public static final int PRIORITY_NONE = 3;
-
- public final float weight;
- public final int growPriority;
- public final boolean growAbsorb;
- public final float growLeftLimit;
- public final float growRightLimit;
- public final int shrinkPriority;
- public final boolean shrinkAbsorb;
- public final float shrinkLeftLimit;
- public final float shrinkRightLimit;
-
- public GlyphJustificationInfo (float weight, boolean growAbsorb,
- int growPriority, float growLeftLimit,
- float growRightLimit, boolean shrinkAbsorb,
- int shrinkPriority, float shrinkLeftLimit,
- float shrinkRightLimit)
- {
- this.weight = weight;
- this.growAbsorb = growAbsorb;
- this.growPriority = growPriority;
- this.growLeftLimit = growLeftLimit;
- this.growRightLimit = growRightLimit;
- this.shrinkAbsorb = shrinkAbsorb;
- this.shrinkPriority = shrinkPriority;
- this.shrinkLeftLimit = shrinkLeftLimit;
- this.shrinkRightLimit = shrinkRightLimit;
- }
-}
diff --git a/libjava/java/awt/font/GlyphMetrics.java b/libjava/java/awt/font/GlyphMetrics.java
deleted file mode 100644
index 28b2088cf8e..00000000000
--- a/libjava/java/awt/font/GlyphMetrics.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* GlyphMetrics.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.geom.Rectangle2D;
-
-/**
- * @author Michael Koch
- */
-public final class GlyphMetrics
-{
- public static final byte COMBINING = 2;
- public static final byte COMPONENT = 3;
- public static final byte LIGATURE = 1;
- public static final byte STANDARD = 0;
- public static final byte WHITESPACE = 4;
-
- private boolean horizontal;
- private float advanceX;
- private float advanceY;
- private Rectangle2D bounds;
- private byte glyphType;
-
- public GlyphMetrics (boolean horizontal, float advanceX, float advanceY,
- Rectangle2D bounds, byte glyphType)
- {
- this.horizontal = horizontal;
- this.advanceX = advanceX;
- this.advanceY = advanceY;
- this.bounds = bounds;
- this.glyphType = glyphType;
- }
-
- public GlyphMetrics (float advance, Rectangle2D bounds, byte glyphType)
- {
- this (true, advance, advance, bounds, glyphType);
- }
-
- public float getAdvance ()
- {
- return horizontal ? advanceX : advanceY;
- }
-
- public float getAdvanceX ()
- {
- return advanceX;
- }
-
- public float getAdvanceY ()
- {
- return advanceY;
- }
-
- public Rectangle2D getBounds2D ()
- {
- return bounds;
- }
-
- public float getLSB ()
- {
- throw new Error ("not implemented");
- }
-
- public float getRSB ()
- {
- throw new Error ("not implemented");
- }
-
- public int getType ()
- {
- return glyphType;
- }
-
- public boolean isCombining ()
- {
- return (glyphType == COMBINING);
- }
-
- public boolean isComponent ()
- {
- return (glyphType == COMPONENT);
- }
-
- public boolean isLigature()
- {
- return (glyphType == LIGATURE);
- }
-
- public boolean isStandard()
- {
- return (glyphType == STANDARD);
- }
-
- public boolean isWhitespace()
- {
- return (glyphType == WHITESPACE);
- }
-}
diff --git a/libjava/java/awt/font/GlyphVector.java b/libjava/java/awt/font/GlyphVector.java
deleted file mode 100644
index 57e2581edb4..00000000000
--- a/libjava/java/awt/font/GlyphVector.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/* GlyphVector.java
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.Font;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * @author Michael Koch
- */
-public abstract class GlyphVector implements Cloneable
-{
- public static final int FLAG_COMPLEX_GLYPHS = 8;
- public static final int FLAG_HAS_POSITION_ADJUSTMENTS = 2;
- public static final int FLAG_HAS_TRANSFORMS = 1;
- public static final int FLAG_MASK = 15;
- public static final int FLAG_RUN_RTL = 4;
-
- /**
- * Constructs a GlyphVector
object.
- */
- public GlyphVector ()
- {
- }
-
- public abstract boolean equals (GlyphVector set);
-
- public abstract Font getFont ();
-
- public abstract FontRenderContext getFontRenderContext ();
-
- public int getGlyphCharIndex (int glyphIndex)
- {
- throw new Error ("not implemented");
- }
-
- public int[] getGlyphCharIndices (int beginGlyphIndex, int numEntries,
- int[] codeReturn)
- {
- throw new Error ("not implemented");
- }
-
- public abstract int getGlyphCode (int glyphIndex);
-
- public abstract int[] getGlyphCodes (int beginGlyphIndex, int numEntries,
- int[] codeReturn);
-
- public abstract GlyphJustificationInfo getGlyphJustificationInfo
- (int glyphIndex);
-
- public abstract Shape getGlyphLogicalBounds (int glyphIndex);
-
- public abstract GlyphMetrics getGlyphMetrics (int glyphIndex);
-
- public abstract Shape getGlyphOutline (int glyphIndex);
-
- public Shape getGlyphOutline (int glyphIndex, float x, float y)
- {
- throw new Error ("not implemented");
- }
-
- public Rectangle getGlyphPixelBounds (int index, FontRenderContext renderFRC,
- float x, float y)
- {
- throw new Error ("not implemented");
- }
-
- public abstract Point2D getGlyphPosition (int glyphIndex);
-
- public abstract float[] getGlyphPositions (int beginGlyphIndex,
- int numEntries,
- float[] positionReturn);
-
- public abstract AffineTransform getGlyphTransform (int glyphIndex);
-
- public abstract Shape getGlyphVisualBounds (int glyphIndex);
-
- public int getLayoutFlags ()
- {
- throw new Error ("not implemented");
- }
-
- public abstract Rectangle2D getLogicalBounds ();
-
- public abstract int getNumGlyphs ();
-
- public abstract Shape getOutline ();
-
- public abstract Shape getOutline (float x, float y);
-
- public Rectangle getPixelBounds (FontRenderContext renderFRC,
- float x, float y)
- {
- throw new Error ("not implemented");
- }
-
- public abstract Rectangle2D getVisualBounds ();
-
- public abstract void performDefaultLayout ();
-
- public abstract void setGlyphPosition (int glyphIndex, Point2D newPos);
-
- public abstract void setGlyphTransform (int glyphIndex,
- AffineTransform newTX);
-}
diff --git a/libjava/java/awt/font/GraphicAttribute.java b/libjava/java/awt/font/GraphicAttribute.java
deleted file mode 100644
index 79eae9955f5..00000000000
--- a/libjava/java/awt/font/GraphicAttribute.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GraphicAttribute.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * @author Michael Koch
- */
-public abstract class GraphicAttribute
-{
- public static final int BOTTOM_ALIGNMENT = -2;
- public static final int CENTER_BASELINE = 1;
- public static final int HANGING_BASELINE = 2;
- public static final int ROMAN_BASELINE = 0;
- public static final int TOP_ALIGNMENT = -1;
-
- private int alignment;
-
- protected GraphicAttribute (int alignment)
- {
- this.alignment = alignment;
- }
-
- public abstract void draw (Graphics2D graphics, float x, float y);
-
- public abstract float getAdvance ();
-
- public final int getAlignment ()
- {
- return alignment;
- }
-
- public abstract float getAscent ();
-
- public Rectangle2D getBounds ()
- {
- throw new Error ("not implemented");
- }
-
- public abstract float getDescent ();
-
- public GlyphJustificationInfo getJustificationInfo ()
- {
- throw new Error ("not implemented");
- }
-}
diff --git a/libjava/java/awt/font/ImageGraphicAttribute.java b/libjava/java/awt/font/ImageGraphicAttribute.java
deleted file mode 100644
index 77413f95dfc..00000000000
--- a/libjava/java/awt/font/ImageGraphicAttribute.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* ImageGraphicAttribute.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.geom.Rectangle2D;
-
-/**
- * @author Michael Koch
- */
-public final class ImageGraphicAttribute extends GraphicAttribute
-{
- private Image image;
-
- public ImageGraphicAttribute (Image image, int alignment)
- {
- super (alignment);
- this.image = image;
- }
-
- public ImageGraphicAttribute (Image image, int alignment, float originX,
- float originY)
- {
- super (alignment);
- this.image = image;
-
- throw new Error ("not implemented");
- }
-
- public void draw (Graphics2D graphics, float x, float y)
- {
- throw new Error ("not implemented");
- }
-
- public boolean equals (Object obj)
- {
- if (! (obj instanceof ImageGraphicAttribute))
- return false;
-
- return equals ((ImageGraphicAttribute) obj);
- }
-
- public boolean equals (ImageGraphicAttribute rhs)
- {
- throw new Error ("not implemented");
- }
-
- public float getAdvance ()
- {
- throw new Error ("not implemented");
- }
-
- public float getAscent ()
- {
- throw new Error ("not implemented");
- }
-
- public Rectangle2D getBounds ()
- {
- throw new Error ("not implemented");
- }
-
- public float getDescent ()
- {
- throw new Error ("not implemented");
- }
-
- public int hashCode ()
- {
- throw new Error ("not implemented");
- }
-}
diff --git a/libjava/java/awt/font/LineBreakMeasurer.java b/libjava/java/awt/font/LineBreakMeasurer.java
deleted file mode 100644
index 0a6a96922bd..00000000000
--- a/libjava/java/awt/font/LineBreakMeasurer.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* LineBreakMeasurer.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.text.AttributedCharacterIterator;
-import java.text.BreakIterator;
-
-public final class LineBreakMeasurer
-{
- private AttributedCharacterIterator ci;
- private FontRenderContext frc;
- private BreakIterator bi;
-
- /**
- * Constructs a LineBreakMeasurer
object.
- */
- public LineBreakMeasurer (AttributedCharacterIterator text,
- FontRenderContext frc)
- {
- this (text, null, frc);
- }
-
- /**
- * Constructs a LineBreakMeasurer
object.
- */
- public LineBreakMeasurer (AttributedCharacterIterator text,
- BreakIterator breakIter, FontRenderContext frc)
- {
- this.ci = text;
- this.bi = breakIter;
- this.frc = frc;
- }
-
- public void deleteChar (AttributedCharacterIterator newParagraph,
- int deletePos)
- {
- throw new Error ("not implemented");
- }
-
- public int getPosition ()
- {
- return ci.getIndex ();
- }
-
- public void insertChar (AttributedCharacterIterator newParagraph,
- int insertPos)
- {
- throw new Error ("not implemented");
- }
-
- public TextLayout nextLayout (float wrappingWidth)
- {
- throw new Error ("not implemented");
- }
-
- public TextLayout nextLayout (float wrappingWidth, int offsetLimit,
- boolean requireNextWord)
- {
- throw new Error ("not implemented");
- }
-
- public int nextOffset (float wrappingWidth)
- {
- throw new Error ("not implemented");
- }
-
- public int nextOffset (float wrappingWidth, int offsetLimit,
- boolean requireNextWord)
- {
- throw new Error ("not implemented");
- }
-
- public void setPosition (int newPosition)
- {
- ci.setIndex (newPosition);
- }
-}
diff --git a/libjava/java/awt/font/LineMetrics.java b/libjava/java/awt/font/LineMetrics.java
deleted file mode 100644
index 3c45ad19a6e..00000000000
--- a/libjava/java/awt/font/LineMetrics.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* LineMetrics.java -- Information about about a line display characteristics
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-/**
- * @author Michael Koch
- */
-public abstract class LineMetrics
-{
- public abstract float getAscent();
-
- public abstract int getBaselineIndex();
-
- public abstract float[] getBaselineOffsets();
-
- public abstract float getDescent();
-
- public abstract float getHeight();
-
- public abstract float getLeading();
-
- public abstract int getNumChars();
-
- public abstract float getStrikethroughOffset();
-
- public abstract float getStrikethroughThickness();
-
- public abstract float getUnderlineOffset();
-
- public abstract float getUnderlineThickness();
-}
diff --git a/libjava/java/awt/font/MultipleMaster.java b/libjava/java/awt/font/MultipleMaster.java
deleted file mode 100644
index 57417ea6010..00000000000
--- a/libjava/java/awt/font/MultipleMaster.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* MultipleMaster.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.Font;
-
-/**
- * @author Michael Koch
- */
-public interface MultipleMaster
-{
- Font deriveMMFont (float[] axes);
-
- Font deriveMMFont (float[] glyphWidths, float avgStemWidth,
- float typicalCapHeight, float typicalXHeight,
- float italicAngle);
-
- float[] getDesignAxisDefaults();
-
- String[] getDesignAxisNames();
-
- float[] getDesignAxisRanges();
-
- int getNumDesignAxes();
-}
diff --git a/libjava/java/awt/font/NumericShaper.java b/libjava/java/awt/font/NumericShaper.java
deleted file mode 100644
index efbdcd49dc4..00000000000
--- a/libjava/java/awt/font/NumericShaper.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/* NumericShaper.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.io.Serializable;
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public final class NumericShaper implements Serializable
-{
- private static final long serialVersionUID = -8022764705923730308L;
-
- public static final int ALL_RANGES = 524287;
- public static final int ARABIC = 2;
- public static final int BENGALI = 16;
- public static final int DEVANAGARI = 8;
- public static final int EASTERN_ARABIC = 4;
- public static final int ETHIOPIC = 65536;
- public static final int EUROPEAN = 1;
- public static final int GUJARATI = 64;
- public static final int GURMUKHI = 32;
- public static final int KANNADA = 1024;
- public static final int KHMER = 131072;
- public static final int LAO = 8192;
- public static final int MALAYALAM = 2048;
- public static final int MONGOLIAN = 262144;
- public static final int MYANMAR = 32768;
- public static final int ORIYA = 128;
- public static final int TAMIL = 256;
- public static final int TELUGU = 512;
- public static final int THAI = 4096;
- public static final int TIBETAN = 16384;
-
- private int ranges;
- private int context;
-
- private NumericShaper (int ranges, int context)
- {
- this.ranges = ranges;
- this.context = context;
- }
-
- public boolean equals (Object obj)
- {
- if (! (obj instanceof NumericShaper))
- return false;
-
- NumericShaper tmp = (NumericShaper) obj;
-
- return (ranges == tmp.ranges
- && context == tmp.context);
- }
-
- public static NumericShaper getContextualShaper (int ranges)
- {
- throw new Error ("not implemented");
- }
-
- public static NumericShaper getContextualShaper (int ranges,
- int defaultContext)
- {
- throw new Error ("not implemented");
- }
-
- public int getRanges ()
- {
- return ranges;
- }
-
- public static NumericShaper getShaper (int singleRange)
- {
- throw new Error ("not implemented");
- }
-
- public int hashCode ()
- {
- throw new Error ("not implemented");
- }
-
- public boolean isContextual ()
- {
- throw new Error ("not implemented");
- }
-
- public void shape (char[] text, int start, int count)
- {
- shape (text, start, count, context);
- }
-
- public void shape (char[] text, int start, int count, int context)
- {
- throw new Error ("not implemented");
- }
-
- public String toString ()
- {
- throw new Error ("not implemented");
- }
-}
diff --git a/libjava/java/awt/font/OpenType.java b/libjava/java/awt/font/OpenType.java
deleted file mode 100644
index ece3279cc7f..00000000000
--- a/libjava/java/awt/font/OpenType.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/* OpenType.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-/**
- * @author Michael Koch
- */
-public interface OpenType
-{
- int TAG_ACNT = 1633906292;
- int TAG_AVAR = 1635148146;
- int TAG_BASE = 1111577413;
- int TAG_BDAT = 1650745716;
- int TAG_BLOC = 1651273571;
- int TAG_BSLN = 1651731566;
- int TAG_CFF = 1128678944;
- int TAG_CMAP = 1668112752;
- int TAG_CVAR = 1668702578;
- int TAG_CVT = 1668707360;
- int TAG_DSIG = 1146308935;
- int TAG_EBDT = 1161970772;
- int TAG_EBLC = 1161972803;
- int TAG_EBSC = 1161974595;
- int TAG_FDSC = 1717859171;
- int TAG_FEAT = 1717920116;
- int TAG_FMTX = 1718449272;
- int TAG_FPGM = 1718642541;
- int TAG_FVAR = 1719034226;
- int TAG_GASP = 1734439792;
- int TAG_GDEF = 1195656518;
- int TAG_GLYF = 1735162214;
- int TAG_GPOS = 1196445523;
- int TAG_GSUB = 1196643650;
- int TAG_GVAR = 1735811442;
- int TAG_HDMX = 1751412088;
- int TAG_HEAD = 1751474532;
- int TAG_HHEA = 1751672161;
- int TAG_HMTX = 1752003704;
- int TAG_JSTF = 1246975046;
- int TAG_JUST = 1786082164;
- int TAG_KERN = 1801810542;
- int TAG_LCAR = 1818452338;
- int TAG_LOCA = 1819239265;
- int TAG_LTSH = 1280594760;
- int TAG_MAXP = 1835104368;
- int TAG_MMFX = 1296909912;
- int TAG_MMSD = 1296913220;
- int TAG_MORT = 1836020340;
- int TAG_NAME = 1851878757;
- int TAG_OPBD = 1836020340;
- int TAG_OS2 = 1330851634;
- int TAG_PCLT = 1346587732;
- int TAG_POST = 1886352244;
- int TAG_PREP = 1886545264;
- int TAG_PROP = 1886547824;
- int TAG_TRAK = 1953653099;
- int TAG_TYP1 = 1954115633;
- int TAG_VDMX = 1447316824;
- int TAG_VHEA = 1986553185;
- int TAG_VMTX = 1986884728;
-
- byte[] getFontTable (int sfntTag);
-
- byte[] getFontTable (int sfntTag, int offset, int count);
-
- byte[] getFontTable (String strSfntTag);
-
- byte[] getFontTable (String strSfntTag, int offset, int count);
-
- int getFontTableSize (int sfntTag);
-
- int getFontTableSize (String strSfntTag);
-
- int getVersion ();
-}
diff --git a/libjava/java/awt/font/ShapeGraphicAttribute.java b/libjava/java/awt/font/ShapeGraphicAttribute.java
deleted file mode 100644
index 6d64dece5d8..00000000000
--- a/libjava/java/awt/font/ShapeGraphicAttribute.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ShapeGraphicAttribute.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.geom.Rectangle2D;
-
-public final class ShapeGraphicAttribute extends GraphicAttribute
-{
- public static final boolean FILL = false;
- public static final boolean STROKE = true;
-
- private Shape shape;
- private boolean stroke;
-
- public ShapeGraphicAttribute (Shape shape, int alignment, boolean stroke)
- {
- super (alignment);
- this.shape = shape;
- this.stroke = stroke;
- }
-
- public void draw (Graphics2D graphics, float x, float y)
- {
- throw new Error ("not implemented");
- }
-
- public boolean equals (Object obj)
- {
- if (! (obj instanceof ShapeGraphicAttribute))
- return false;
-
- return equals ((ShapeGraphicAttribute) obj);
- }
-
- public boolean equals (ShapeGraphicAttribute rhs)
- {
- return (shape.equals (rhs.shape)
- && getAlignment () == rhs.getAlignment ()
- && stroke == rhs.stroke);
- }
-
- public float getAdvance ()
- {
- throw new Error ("not implemented");
- }
-
- public float getAscent ()
- {
- throw new Error ("not implemented");
- }
-
- public Rectangle2D getBounds ()
- {
- return shape.getBounds2D ();
- }
-
- public float getDescent ()
- {
- throw new Error ("not implemented");
- }
-
- public int hashCode ()
- {
- // FIXME: Check what SUN does here
- return shape.hashCode ();
- }
-}
diff --git a/libjava/java/awt/font/TextAttribute.java b/libjava/java/awt/font/TextAttribute.java
deleted file mode 100644
index 6f5ed59f915..00000000000
--- a/libjava/java/awt/font/TextAttribute.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/* TextAttribute.java --
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.io.InvalidObjectException;
-import java.text.AttributedCharacterIterator;
-
-/**
- * Attributes (and associated values) that can be used to define an
- * {@link java.text.AttributedString}.
- */
-public final class TextAttribute extends AttributedCharacterIterator.Attribute
-{
- private static final long serialVersionUID = 7744112784117861702L;
-
- /** A key for the background paint attribute. */
- public static final TextAttribute BACKGROUND =
- new TextAttribute("background");
-
- /** A key for the BIDI_EMBEDDING attribute. */
- public static final TextAttribute BIDI_EMBEDDING =
- new TextAttribute("bidi_embedding");
-
- /** A key for the CHAR_REPLACEMENT attribute. */
- public static final TextAttribute CHAR_REPLACEMENT =
- new TextAttribute("char_replacement");
-
- /** A key for the FAMILY attribute. */
- public static final TextAttribute FAMILY = new TextAttribute("family");
-
- /** A key for the font attribute. */
- public static final TextAttribute FONT = new TextAttribute("font");
-
- /** A key for the foreground paint attribute. */
- public static final TextAttribute FOREGROUND =
- new TextAttribute("foreground");
-
- /** A key for the INPUT_METHOD_HIGHLIGHT attribute. */
- public static final TextAttribute INPUT_METHOD_HIGHLIGHT =
- new TextAttribute("input method highlight");
-
- /** A key for the INPUT_METHOD_UNDERLINE attribute. */
- public static final TextAttribute INPUT_METHOD_UNDERLINE =
- new TextAttribute("input method underline");
-
- /** A key for the text justification attribute. */
- public static final TextAttribute JUSTIFICATION =
- new TextAttribute("justification");
-
- /**
- * A value that can be used with the {@link #JUSTIFICATION} attribute to
- * indicate full justification of the text.
- */
- public static final Float JUSTIFICATION_FULL = new Float(1.0);
-
- /**
- * A value that can be used with the {@link #JUSTIFICATION} attribute to
- * indicate no justification of the text.
- */
- public static final Float JUSTIFICATION_NONE = new Float(0.0);
-
- /** A key for the NUMERIC_SHAPING attribute. */
- public static final TextAttribute NUMERIC_SHAPING =
- new TextAttribute("numeric_shaping");
-
- /** A key for the POSTURE attribute. */
- public static final TextAttribute POSTURE = new TextAttribute("posture");
-
- /** A value that can be used with the {@link #POSTURE} attribute. */
- public static final Float POSTURE_OBLIQUE = new Float(0.2);
-
- /** A value that can be used with the {@link #POSTURE} attribute. */
- public static final Float POSTURE_REGULAR = new Float(0.0);
-
- /** A key for the RUN_DIRECTION attribute. */
- public static final TextAttribute RUN_DIRECTION =
- new TextAttribute("run_direction");
-
- /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
- public static final Boolean RUN_DIRECTION_LTR = Boolean.FALSE;
-
- /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
- public static final Boolean RUN_DIRECTION_RTL = Boolean.TRUE;
-
- /** A key for the text size attribute. */
- public static final TextAttribute SIZE = new TextAttribute("size");
-
- /** A key for the STRIKETHROUGH attribute. */
- public static final TextAttribute STRIKETHROUGH =
- new TextAttribute("strikethrough");
-
- /** A value that can be used with the {@link #STRIKETHROUGH} attribute. */
- public static final Boolean STRIKETHROUGH_ON = Boolean.TRUE;
-
- /** A key for the SUPERSCRIPT attribute. */
- public static final TextAttribute SUPERSCRIPT =
- new TextAttribute("superscript");
-
- /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
- public static final Integer SUPERSCRIPT_SUB = new Integer(-1);
-
- /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
- public static final Integer SUPERSCRIPT_SUPER = new Integer(1);
-
- /** A key for the SWAP_COLORS attribute. */
- public static final TextAttribute SWAP_COLORS =
- new TextAttribute("swap_colors");
-
- /** A value that can be used with the {@link #SWAP_COLORS} attribute. */
- public static final Boolean SWAP_COLORS_ON = Boolean.TRUE;
-
- /** A key for the TRANFORM attribute. */
- public static final TextAttribute TRANSFORM = new TextAttribute("transform");
-
- /** A key for the UNDERLINE attribute. */
- public static final TextAttribute UNDERLINE = new TextAttribute("underline");
-
- /** A value that can be used with the {@link #UNDERLINE} attribute. */
- public static final Integer UNDERLINE_LOW_DASHED = new Integer(5);
-
- /** A value that can be used with the {@link #UNDERLINE} attribute. */
- public static final Integer UNDERLINE_LOW_DOTTED = new Integer(3);
-
- /** A value that can be used with the {@link #UNDERLINE} attribute. */
- public static final Integer UNDERLINE_LOW_GRAY = new Integer(4);
-
- /** A value that can be used with the {@link #UNDERLINE} attribute. */
- public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer(1);
-
- /** A value that can be used with the {@link #UNDERLINE} attribute. */
- public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer(2);
-
- /** A value that can be used with the {@link #UNDERLINE} attribute. */
- public static final Integer UNDERLINE_ON = new Integer(0);
-
- /** A key for the WEIGHT attribute. */
- public static final TextAttribute WEIGHT = new TextAttribute("weight");
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_BOLD = new Float(2.0);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_DEMIBOLD = new Float(1.75);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_DEMILIGHT = new Float(0.875);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_EXTRA_LIGHT = new Float(0.5);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_EXTRABOLD = new Float(2.5);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_HEAVY = new Float(2.25);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_LIGHT = new Float(0.75);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_MEDIUM = new Float(1.5);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_REGULAR = new Float(1.0);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_SEMIBOLD = new Float(1.25);
-
- /** A value that can be used with the {@link #WEIGHT} attribute. */
- public static final Float WEIGHT_ULTRABOLD = new Float(2.75);
-
- /** A key for the WIDTH attribute. */
- public static final TextAttribute WIDTH = new TextAttribute("width");
-
- /** A value that can be used with the {@link #WIDTH} attribute. */
- public static final Float WIDTH_CONDENSED = new Float(0.75);
-
- /** A value that can be used with the {@link #WIDTH} attribute. */
- public static final Float WIDTH_EXTENDED = new Float(1.5);
-
- /** A value that can be used with the {@link #WIDTH} attribute. */
- public static final Float WIDTH_REGULAR = new Float(1.0);
-
- /** A value that can be used with the {@link #WIDTH} attribute. */
- public static final Float WIDTH_SEMI_CONDENSED = new Float(0.875);
-
- /** A value that can be used with the {@link #WIDTH} attribute. */
- public static final Float WIDTH_SEMI_EXTENDED = new Float(1.25);
-
- /**
- * Creates a new attribute.
- *
- * @param name the name.
- */
- protected TextAttribute(String name)
- {
- super(name);
- }
-
- /**
- * After deserialization, this method ensures that only one instance of
- * each attribute is used.
- *
- * @return The (single) attribute instance.
- *
- * @throws InvalidObjectException if the attribute is not recognised.
- */
- protected Object readResolve()
- throws InvalidObjectException
- {
- if (this.getName().equals("background"))
- return BACKGROUND;
-
- if (this.getName().equals("bidi_embedding"))
- return BIDI_EMBEDDING;
-
- if (this.getName().equals("char_replacement"))
- return CHAR_REPLACEMENT;
-
- if (this.getName().equals("family"))
- return FAMILY;
-
- if (this.getName().equals("font"))
- return FONT;
-
- if (this.getName().equals("foreground"))
- return FOREGROUND;
-
- if (this.getName().equals("input method highlight"))
- return INPUT_METHOD_HIGHLIGHT;
-
- if (this.getName().equals("input method underline"))
- return INPUT_METHOD_UNDERLINE;
-
- if (this.getName().equals("justification"))
- return JUSTIFICATION;
-
- if (this.getName().equals("numeric_shaping"))
- return NUMERIC_SHAPING;
-
- if (this.getName().equals("posture"))
- return POSTURE;
-
- if (this.getName().equals("run_direction"))
- return RUN_DIRECTION;
-
- if (this.getName().equals("size"))
- return SIZE;
-
- if (this.getName().equals("strikethrough"))
- return STRIKETHROUGH;
-
- if (this.getName().equals("superscript"))
- return SUPERSCRIPT;
-
- if (this.getName().equals("swap_colors"))
- return SWAP_COLORS;
-
- if (this.getName().equals("transform"))
- return TRANSFORM;
-
- if (this.getName().equals("underline"))
- return UNDERLINE;
-
- if (this.getName().equals("weight"))
- return WEIGHT;
-
- if (this.getName().equals("width"))
- return WIDTH;
-
- throw new InvalidObjectException("Can't resolve Attribute: " + getName());
- }
-}
diff --git a/libjava/java/awt/font/TextHitInfo.java b/libjava/java/awt/font/TextHitInfo.java
deleted file mode 100644
index 2b23e1963cd..00000000000
--- a/libjava/java/awt/font/TextHitInfo.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/* TextHitInfo.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.font;
-
-/**
- * @author John Leuner (jewel@debian.org)
- */
-public final class TextHitInfo
-{
- private int charIndex;
- private boolean leadingEdge;
-
- TextHitInfo (int charIndex, boolean leadingEdge)
- {
- this.charIndex = charIndex;
- this.leadingEdge = leadingEdge;
- }
-
- public int getCharIndex()
- {
- return charIndex;
- }
-
- public boolean isLeadingEdge()
- {
- return leadingEdge;
- }
-
- public int getInsertionIndex()
- {
- return (leadingEdge ? charIndex : charIndex + 1);
- }
-
- public int hashCode()
- {
- return charIndex;
- }
-
- public boolean equals(Object obj)
- {
- if(obj instanceof TextHitInfo)
- return this.equals((TextHitInfo) obj);
-
- return false;
- }
-
- public boolean equals(TextHitInfo hitInfo)
- {
- return (charIndex == hitInfo.getCharIndex ())
- && (leadingEdge == hitInfo.isLeadingEdge ());
- }
-
- public static TextHitInfo leading(int charIndex)
- {
- return new TextHitInfo (charIndex, true);
- }
-
- public static TextHitInfo trailing(int charIndex)
- {
- return new TextHitInfo (charIndex, false);
- }
-
- public static TextHitInfo beforeOffset(int offset)
- {
- return new TextHitInfo (offset, false);
- }
-
- public static TextHitInfo afterOffset(int offset)
- {
- return new TextHitInfo (offset, true);
- }
-
- public TextHitInfo getOtherHit()
- {
- return (leadingEdge ? trailing (charIndex - 1) : leading (charIndex + 1));
- }
-
- public TextHitInfo getOffsetHit(int offset)
- {
- return new TextHitInfo (charIndex + offset, leadingEdge);
- }
-
- public String toString()
- {
- return "TextHitInfo["
- + charIndex
- + (leadingEdge ? "L" : "T" )
- + "]";
- }
-}
diff --git a/libjava/java/awt/font/TextLayout.java b/libjava/java/awt/font/TextLayout.java
deleted file mode 100644
index bb641614a92..00000000000
--- a/libjava/java/awt/font/TextLayout.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/* TextLayout.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import gnu.java.awt.ClasspathToolkit;
-import gnu.java.awt.peer.ClasspathTextLayoutPeer;
-
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.Toolkit;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-import java.text.AttributedCharacterIterator;
-import java.text.AttributedString;
-import java.util.Map;
-
-/**
- * @author Michael Koch
- */
-public final class TextLayout implements Cloneable
-{
- public static final CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy ();
- ClasspathTextLayoutPeer peer;
-
- public static class CaretPolicy
- {
- public CaretPolicy ()
- {
- // Do nothing here.
- }
-
- public TextHitInfo getStrongCaret (TextHitInfo hit1, TextHitInfo hit2,
- TextLayout layout)
- {
- return layout.peer.getStrongCaret(hit1, hit2);
- }
- }
-
- public TextLayout (AttributedCharacterIterator text, FontRenderContext frc)
- {
- AttributedString as = new AttributedString (text);
- ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
- peer = tk.getClasspathTextLayoutPeer(as, frc);
- }
-
- public TextLayout (String string, Font font, FontRenderContext frc)
- {
- AttributedString as = new AttributedString (string);
- as.addAttribute (TextAttribute.FONT, font);
- ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
- peer = tk.getClasspathTextLayoutPeer(as, frc);
- }
-
- public TextLayout (String string, Map attributes, FontRenderContext frc)
- {
- AttributedString as = new AttributedString (string, attributes);
- ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
- peer = tk.getClasspathTextLayoutPeer(as, frc);
- }
-
- protected Object clone ()
- {
- try
- {
- TextLayout tl = (TextLayout) super.clone ();
- tl.peer = (ClasspathTextLayoutPeer) this.peer.clone();
- return tl;
- }
- catch (CloneNotSupportedException e)
- {
- // This should never occur
- throw new InternalError ();
- }
- }
-
-
- public void draw (Graphics2D g2, float x, float y)
- {
- peer.draw(g2, x, y);
- }
-
- public boolean equals (Object obj)
- {
- if (! (obj instanceof TextLayout))
- return false;
-
- return equals ((TextLayout) obj);
- }
-
- public boolean equals (TextLayout tl)
- {
- return this.peer.equals(tl.peer);
- }
-
- public float getAdvance ()
- {
- return peer.getAdvance();
- }
-
- public float getAscent ()
- {
- return peer.getAscent();
- }
-
- public byte getBaseline ()
- {
- return peer.getBaseline();
- }
-
- public float[] getBaselineOffsets ()
- {
- return peer.getBaselineOffsets();
- }
-
- public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
- {
- return peer.getBlackBoxBounds(firstEndpoint, secondEndpoint);
- }
-
- public Rectangle2D getBounds()
- {
- return peer.getBounds();
- }
-
- public float[] getCaretInfo (TextHitInfo hit)
- {
- return getCaretInfo(hit, getBounds());
- }
-
- public float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds)
- {
- return peer.getCaretInfo(hit, bounds);
- }
-
- public Shape getCaretShape (TextHitInfo hit)
- {
- return getCaretShape(hit, getBounds());
- }
-
- public Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds)
- {
- return peer.getCaretShape(hit, bounds);
- }
-
- public Shape[] getCaretShapes (int offset)
- {
- return getCaretShapes(offset, getBounds());
- }
-
- public Shape[] getCaretShapes (int offset, Rectangle2D bounds)
- {
- return getCaretShapes(offset, getBounds(), DEFAULT_CARET_POLICY);
- }
-
- public Shape[] getCaretShapes (int offset, Rectangle2D bounds,
- TextLayout.CaretPolicy policy)
- {
- return peer.getCaretShapes(offset, bounds, policy);
- }
-
- public int getCharacterCount ()
- {
- return peer.getCharacterCount();
- }
-
- public byte getCharacterLevel (int index)
- {
- return peer.getCharacterLevel(index);
- }
-
- public float getDescent ()
- {
- return peer.getDescent();
- }
-
- public TextLayout getJustifiedLayout (float justificationWidth)
- {
- return peer.getJustifiedLayout(justificationWidth);
- }
-
- public float getLeading ()
- {
- return peer.getLeading();
- }
-
- public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint)
- {
- return getLogicalHighlightShape (firstEndpoint, secondEndpoint, getBounds());
- }
-
- public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
- Rectangle2D bounds)
- {
- return peer.getLogicalHighlightShape(firstEndpoint, secondEndpoint, bounds);
- }
-
- public int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
- TextHitInfo secondEndpoint)
- {
- return peer.getLogicalRangesForVisualSelection(firstEndpoint, secondEndpoint);
- }
-
- public TextHitInfo getNextLeftHit (int offset)
- {
- return getNextLeftHit(offset, DEFAULT_CARET_POLICY);
- }
-
- public TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy)
- {
- return peer.getNextLeftHit(offset, policy);
- }
-
- public TextHitInfo getNextLeftHit (TextHitInfo hit)
- {
- return getNextLeftHit(hit.getCharIndex());
- }
-
- public TextHitInfo getNextRightHit (int offset)
- {
- return getNextRightHit(offset, DEFAULT_CARET_POLICY);
- }
-
- public TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy)
- {
- return peer.getNextRightHit(offset, policy);
- }
-
- public TextHitInfo getNextRightHit (TextHitInfo hit)
- {
- return getNextRightHit(hit.getCharIndex());
- }
-
- public Shape getOutline (AffineTransform tx)
- {
- return peer.getOutline(tx);
- }
-
- public float getVisibleAdvance ()
- {
- return peer.getVisibleAdvance();
- }
-
- public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
- TextHitInfo secondEndpoint)
- {
- return getVisualHighlightShape(firstEndpoint, secondEndpoint, getBounds());
- }
-
- public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
- TextHitInfo secondEndpoint,
- Rectangle2D bounds)
- {
- return peer.getVisualHighlightShape(firstEndpoint, secondEndpoint, bounds);
- }
-
- public TextHitInfo getVisualOtherHit (TextHitInfo hit)
- {
- return peer.getVisualOtherHit(hit);
- }
-
- protected void handleJustify (float justificationWidth)
- {
- peer.handleJustify(justificationWidth);
- }
-
- public int hashCode ()
- {
- return peer.hashCode();
- }
-
- public TextHitInfo hitTestChar (float x, float y)
- {
- return hitTestChar(x, y, getBounds());
- }
-
- public TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds)
- {
- return peer.hitTestChar(x, y, bounds);
- }
-
- public boolean isLeftToRight ()
- {
- return peer.isLeftToRight();
- }
-
- public boolean isVertical ()
- {
- return peer.isVertical();
- }
-
- public String toString ()
- {
- return peer.toString();
- }
-}
diff --git a/libjava/java/awt/font/TextMeasurer.java b/libjava/java/awt/font/TextMeasurer.java
deleted file mode 100644
index 7fcdc87a83c..00000000000
--- a/libjava/java/awt/font/TextMeasurer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/* TextMeasurer.java
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.text.AttributedCharacterIterator;
-
-/**
- * @author Michael Koch
- * @since 1.3
- */
-public final class TextMeasurer implements Cloneable
-{
- private AttributedCharacterIterator ci;
- private FontRenderContext frc;
-
- public TextMeasurer (AttributedCharacterIterator text, FontRenderContext frc)
- {
- this.ci = text;
- this.frc = frc;
- }
-
- protected Object clone ()
- {
- try
- {
- return super.clone ();
- }
- catch (CloneNotSupportedException e)
- {
- // This may never occur
- throw new InternalError ();
- }
- }
-
- public void deleteChar (AttributedCharacterIterator newParagraph,
- int deletePos)
- {
- throw new Error ("not implemented");
- }
-
- public float getAdvanceBetween (int start, int limit)
- {
- throw new Error ("not implemented");
- }
-
- public TextLayout getLayout (int start, int limit)
- {
- throw new Error ("not implemented");
- }
-
- public int getLineBreakIndex (int start, float maxAdvance)
- {
- throw new Error ("not implemented");
- }
-
- public void insertChar (AttributedCharacterIterator newParagraph,
- int insertPos)
- {
- throw new Error ("not implemented");
- }
-}
diff --git a/libjava/java/awt/font/TransformAttribute.java b/libjava/java/awt/font/TransformAttribute.java
deleted file mode 100644
index 977cafa032e..00000000000
--- a/libjava/java/awt/font/TransformAttribute.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* TransformAttribute.java --
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.font;
-
-import java.awt.geom.AffineTransform;
-import java.io.Serializable;
-
-/**
- * This class provides a mechanism for using an {@link AffineTransform} as
- * an immutable attribute (for example, in the
- * {@link java.text.AttributedString} class). Any transform passed to
- * this class is copied before being stored, and any transform handed out
- * by this class is a copy of the stored transform. In this way, it is
- * not possible to modify the stored transform.
- *
- * @author Michael Koch
- */
-public final class TransformAttribute implements Serializable
-{
- private static final long serialVersionUID = 3356247357827709530L;
-
- private AffineTransform affineTransform;
-
- /**
- * Creates a new attribute that contains a copy of the given transform.
- *
- * @param transform the transform (null
not permitted).
- *
- * @throws IllegalArgumentException if transform
is
- * null
.
- */
- public TransformAttribute (AffineTransform transform)
- {
- if (transform == null)
- {
- throw new IllegalArgumentException("Null 'transform' not permitted.");
- }
- this.affineTransform = new AffineTransform (transform);
- }
-
- /**
- * Returns a copy of the transform contained by this attribute.
- *
- * @return A copy of the transform.
- */
- public AffineTransform getTransform ()
- {
- return (AffineTransform) affineTransform.clone();
- }
-
- /**
- * Returns true
if the transform contained by this attribute is
- * an identity transform, and false
otherwise.
- *
- * @return true
if the transform contained by this attribute is
- * an identity transform, and false
otherwise.
- *
- * @since 1.4
- */
- public boolean isIdentity ()
- {
- return (affineTransform == null ? false : affineTransform.isIdentity ());
- }
-}
diff --git a/libjava/java/awt/geom/AffineTransform.java b/libjava/java/awt/geom/AffineTransform.java
deleted file mode 100644
index 4d1a4d6d5d4..00000000000
--- a/libjava/java/awt/geom/AffineTransform.java
+++ /dev/null
@@ -1,1487 +0,0 @@
-/* AffineTransform.java -- transform coordinates between two 2-D spaces
- Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.geom;
-
-import java.awt.Shape;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-
-/**
- * This class represents an affine transformation between two coordinate
- * spaces in 2 dimensions. Such a transform preserves the "straightness"
- * and "parallelness" of lines. The transform is built from a sequence of
- * translations, scales, flips, rotations, and shears.
- *
- *
- * [ x'] [ m00 m01 m02 ] [ x ] [ m00*x + m01*y + m02 ]
- * [ y'] = [ m10 m11 m12 ] [ y ] = [ m10*x + m11*y + m12 ]
- * [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
- *
- * The bottom row of the matrix is constant, so a transform can be uniquely
- * represented (as in {@link #toString()}) by
- * "[[m00, m01, m02], [m10, m11, m12]]".
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status partially updated to 1.4, still has some problems
- */
-public class AffineTransform implements Cloneable, Serializable
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 1330973210523860834L;
-
- /**
- * The transformation is the identity (x' = x, y' = y). All other transforms
- * have either a combination of the appropriate transform flag bits for
- * their type, or the type GENERAL_TRANSFORM.
- *
- * @see #TYPE_TRANSLATION
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_FLIP
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- * @see #getType()
- */
- public static final int TYPE_IDENTITY = 0;
-
- /**
- * The transformation includes a translation - shifting in the x or y
- * direction without changing length or angles.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_FLIP
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- * @see #getType()
- */
- public static final int TYPE_TRANSLATION = 1;
-
- /**
- * The transformation includes a uniform scale - length is scaled in both
- * the x and y directions by the same amount, without affecting angles.
- * This is mutually exclusive with TYPE_GENERAL_SCALE.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_TRANSLATION
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_FLIP
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- * @see #TYPE_MASK_SCALE
- * @see #getType()
- */
- public static final int TYPE_UNIFORM_SCALE = 2;
-
- /**
- * The transformation includes a general scale - length is scaled in either
- * or both the x and y directions, but by different amounts; without
- * affecting angles. This is mutually exclusive with TYPE_UNIFORM_SCALE.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_TRANSLATION
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_FLIP
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- * @see #TYPE_MASK_SCALE
- * @see #getType()
- */
- public static final int TYPE_GENERAL_SCALE = 4;
-
- /**
- * This constant checks if either variety of scale transform is performed.
- *
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- */
- public static final int TYPE_MASK_SCALE = 6;
-
- /**
- * The transformation includes a flip about an axis, swapping between
- * right-handed and left-handed coordinate systems. In a right-handed
- * system, the positive x-axis rotates counter-clockwise to the positive
- * y-axis; in a left-handed system it rotates clockwise.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_TRANSLATION
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- * @see #getType()
- */
- public static final int TYPE_FLIP = 64;
-
- /**
- * The transformation includes a rotation of a multiple of 90 degrees (PI/2
- * radians). Angles are rotated, but length is preserved. This is mutually
- * exclusive with TYPE_GENERAL_ROTATION.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_TRANSLATION
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_FLIP
- * @see #TYPE_GENERAL_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- * @see #TYPE_MASK_ROTATION
- * @see #getType()
- */
- public static final int TYPE_QUADRANT_ROTATION = 8;
-
- /**
- * The transformation includes a rotation by an arbitrary angle. Angles are
- * rotated, but length is preserved. This is mutually exclusive with
- * TYPE_QUADRANT_ROTATION.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_TRANSLATION
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_FLIP
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- * @see #TYPE_MASK_ROTATION
- * @see #getType()
- */
- public static final int TYPE_GENERAL_ROTATION = 16;
-
- /**
- * This constant checks if either variety of rotation is performed.
- *
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- */
- public static final int TYPE_MASK_ROTATION = 24;
-
- /**
- * The transformation is an arbitrary conversion of coordinates which
- * could not be decomposed into the other TYPEs.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_TRANSLATION
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_FLIP
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- * @see #getType()
- */
- public static final int TYPE_GENERAL_TRANSFORM = 32;
-
- /**
- * The X coordinate scaling element of the transform matrix.
- *
- * @serial matrix[0,0]
- */
- private double m00;
-
- /**
- * The Y coordinate shearing element of the transform matrix.
- *
- * @serial matrix[1,0]
- */
- private double m10;
-
- /**
- * The X coordinate shearing element of the transform matrix.
- *
- * @serial matrix[0,1]
- */
- private double m01;
-
- /**
- * The Y coordinate scaling element of the transform matrix.
- *
- * @serial matrix[1,1]
- */
- private double m11;
-
- /**
- * The X coordinate translation element of the transform matrix.
- *
- * @serial matrix[0,2]
- */
- private double m02;
-
- /**
- * The Y coordinate translation element of the transform matrix.
- *
- * @serial matrix[1,2]
- */
- private double m12;
-
- /** The type of this transform. */
- private transient int type;
-
- /**
- * Construct a new identity transform:
- *
- * [ 1 0 0 ]
- * [ 0 1 0 ]
- * [ 0 0 1 ]
- *
- */
- public AffineTransform()
- {
- m00 = m11 = 1;
- }
-
- /**
- * Create a new transform which copies the given one.
- *
- * @param tx the transform to copy
- * @throws NullPointerException if tx is null
- */
- public AffineTransform(AffineTransform tx)
- {
- setTransform(tx);
- }
-
- /**
- * Construct a transform with the given matrix entries:
- *
- * [ m00 m01 m02 ]
- * [ m10 m11 m12 ]
- * [ 0 0 1 ]
- *
- *
- * @param m00 the x scaling component
- * @param m10 the y shearing component
- * @param m01 the x shearing component
- * @param m11 the y scaling component
- * @param m02 the x translation component
- * @param m12 the y translation component
- */
- public AffineTransform(float m00, float m10,
- float m01, float m11,
- float m02, float m12)
- {
- this.m00 = m00;
- this.m10 = m10;
- this.m01 = m01;
- this.m11 = m11;
- this.m02 = m02;
- this.m12 = m12;
- updateType();
- }
-
- /**
- * Construct a transform from a sequence of float entries. The array must
- * have at least 4 entries, which has a translation factor of 0; or 6
- * entries, for specifying all parameters:
- *
- * [ f[0] f[2] (f[4]) ]
- * [ f[1] f[3] (f[5]) ]
- * [ 0 0 1 ]
- *
- *
- * @param f the matrix to copy from, with at least 4 (6) entries
- * @throws NullPointerException if f is null
- * @throws ArrayIndexOutOfBoundsException if f is too small
- */
- public AffineTransform(float[] f)
- {
- m00 = f[0];
- m10 = f[1];
- m01 = f[2];
- m11 = f[3];
- if (f.length >= 6)
- {
- m02 = f[4];
- m12 = f[5];
- }
- updateType();
- }
-
- /**
- * Construct a transform with the given matrix entries:
- *
- * [ m00 m01 m02 ]
- * [ m10 m11 m12 ]
- * [ 0 0 1 ]
- *
- *
- * @param m00 the x scaling component
- * @param m10 the y shearing component
- * @param m01 the x shearing component
- * @param m11 the y scaling component
- * @param m02 the x translation component
- * @param m12 the y translation component
- */
- public AffineTransform(double m00, double m10, double m01,
- double m11, double m02, double m12)
- {
- this.m00 = m00;
- this.m10 = m10;
- this.m01 = m01;
- this.m11 = m11;
- this.m02 = m02;
- this.m12 = m12;
- updateType();
- }
-
- /**
- * Construct a transform from a sequence of double entries. The array must
- * have at least 4 entries, which has a translation factor of 0; or 6
- * entries, for specifying all parameters:
- *
- * [ d[0] d[2] (d[4]) ]
- * [ d[1] d[3] (d[5]) ]
- * [ 0 0 1 ]
- *
- *
- * @param d the matrix to copy from, with at least 4 (6) entries
- * @throws NullPointerException if d is null
- * @throws ArrayIndexOutOfBoundsException if d is too small
- */
- public AffineTransform(double[] d)
- {
- m00 = d[0];
- m10 = d[1];
- m01 = d[2];
- m11 = d[3];
- if (d.length >= 6)
- {
- m02 = d[4];
- m12 = d[5];
- }
- updateType();
- }
-
- /**
- * Returns a translation transform:
- *
- * [ 1 0 tx ]
- * [ 0 1 ty ]
- * [ 0 0 1 ]
- *
- *
- * @param tx the x translation distance
- * @param ty the y translation distance
- * @return the translating transform
- */
- public static AffineTransform getTranslateInstance(double tx, double ty)
- {
- AffineTransform t = new AffineTransform();
- t.setToTranslation(tx, ty);
- return t;
- }
-
- /**
- * Returns a rotation transform. A positive angle (in radians) rotates
- * the positive x-axis to the positive y-axis:
- *
- * [ cos(theta) -sin(theta) 0 ]
- * [ sin(theta) cos(theta) 0 ]
- * [ 0 0 1 ]
- *
- *
- * @param theta the rotation angle
- * @return the rotating transform
- */
- public static AffineTransform getRotateInstance(double theta)
- {
- AffineTransform t = new AffineTransform();
- t.setToRotation(theta);
- return t;
- }
-
- /**
- * Returns a rotation transform about a point. A positive angle (in radians)
- * rotates the positive x-axis to the positive y-axis. This is the same
- * as calling:
- *
- * AffineTransform tx = new AffineTransform();
- * tx.setToTranslation(x, y);
- * tx.rotate(theta);
- * tx.translate(-x, -y);
- *
- *
- *
- * [ cos(theta) -sin(theta) x-x*cos+y*sin ]
- * [ sin(theta) cos(theta) y-x*sin-y*cos ]
- * [ 0 0 1 ]
- *
- *
- * @param theta the rotation angle
- * @param x the x coordinate of the pivot point
- * @param y the y coordinate of the pivot point
- * @return the rotating transform
- */
- public static AffineTransform getRotateInstance(double theta,
- double x, double y)
- {
- AffineTransform t = new AffineTransform();
- t.setToTranslation(x, y);
- t.rotate(theta);
- t.translate(-x, -y);
- return t;
- }
-
- /**
- * Returns a scaling transform:
- *
- * [ sx 0 0 ]
- * [ 0 sy 0 ]
- * [ 0 0 1 ]
- *
- *
- * @param sx the x scaling factor
- * @param sy the y scaling factor
- * @return the scaling transform
- */
- public static AffineTransform getScaleInstance(double sx, double sy)
- {
- AffineTransform t = new AffineTransform();
- t.setToScale(sx, sy);
- return t;
- }
-
- /**
- * Returns a shearing transform (points are shifted in the x direction based
- * on a factor of their y coordinate, and in the y direction as a factor of
- * their x coordinate):
- *
- * [ 1 shx 0 ]
- * [ shy 1 0 ]
- * [ 0 0 1 ]
- *
- *
- * @param shx the x shearing factor
- * @param shy the y shearing factor
- * @return the shearing transform
- */
- public static AffineTransform getShearInstance(double shx, double shy)
- {
- AffineTransform t = new AffineTransform();
- t.setToShear(shx, shy);
- return t;
- }
-
- /**
- * Returns the type of this transform. The result is always valid, although
- * it may not be the simplest interpretation (in other words, there are
- * sequences of transforms which reduce to something simpler, which this
- * does not always detect). The result is either TYPE_GENERAL_TRANSFORM,
- * or a bit-wise combination of TYPE_TRANSLATION, the mutually exclusive
- * TYPE_*_ROTATIONs, and the mutually exclusive TYPE_*_SCALEs.
- *
- * @return The type.
- *
- * @see #TYPE_IDENTITY
- * @see #TYPE_TRANSLATION
- * @see #TYPE_UNIFORM_SCALE
- * @see #TYPE_GENERAL_SCALE
- * @see #TYPE_QUADRANT_ROTATION
- * @see #TYPE_GENERAL_ROTATION
- * @see #TYPE_GENERAL_TRANSFORM
- */
- public int getType()
- {
- return type;
- }
-
- /**
- * Return the determinant of this transform matrix. If the determinant is
- * non-zero, the transform is invertible; otherwise operations which require
- * an inverse throw a NoninvertibleTransformException. A result very near
- * zero, due to rounding errors, may indicate that inversion results do not
- * carry enough precision to be meaningful.
- *
- *
- * | m00 m01 m02 |
- * | m10 m11 m12 | = m00 * m11 - m01 * m10
- * | 0 0 1 |
- *
- *
- * @return the determinant
- * @see #createInverse()
- */
- public double getDeterminant()
- {
- return m00 * m11 - m01 * m10;
- }
-
- /**
- * Return the matrix of values used in this transform. If the matrix has
- * fewer than 6 entries, only the scale and shear factors are returned;
- * otherwise the translation factors are copied as well. The resulting
- * values are:
- *
- * [ d[0] d[2] (d[4]) ]
- * [ d[1] d[3] (d[5]) ]
- * [ 0 0 1 ]
- *
- *
- * @param d the matrix to store the results into; with 4 (6) entries
- * @throws NullPointerException if d is null
- * @throws ArrayIndexOutOfBoundsException if d is too small
- */
- public void getMatrix(double[] d)
- {
- d[0] = m00;
- d[1] = m10;
- d[2] = m01;
- d[3] = m11;
- if (d.length >= 6)
- {
- d[4] = m02;
- d[5] = m12;
- }
- }
-
- /**
- * Returns the X coordinate scaling factor of the matrix.
- *
- * @return m00
- * @see #getMatrix(double[])
- */
- public double getScaleX()
- {
- return m00;
- }
-
- /**
- * Returns the Y coordinate scaling factor of the matrix.
- *
- * @return m11
- * @see #getMatrix(double[])
- */
- public double getScaleY()
- {
- return m11;
- }
-
- /**
- * Returns the X coordinate shearing factor of the matrix.
- *
- * @return m01
- * @see #getMatrix(double[])
- */
- public double getShearX()
- {
- return m01;
- }
-
- /**
- * Returns the Y coordinate shearing factor of the matrix.
- *
- * @return m10
- * @see #getMatrix(double[])
- */
- public double getShearY()
- {
- return m10;
- }
-
- /**
- * Returns the X coordinate translation factor of the matrix.
- *
- * @return m02
- * @see #getMatrix(double[])
- */
- public double getTranslateX()
- {
- return m02;
- }
-
- /**
- * Returns the Y coordinate translation factor of the matrix.
- *
- * @return m12
- * @see #getMatrix(double[])
- */
- public double getTranslateY()
- {
- return m12;
- }
-
- /**
- * Concatenate a translation onto this transform. This is equivalent, but
- * more efficient than
- * concatenate(AffineTransform.getTranslateInstance(tx, ty))
.
- *
- * @param tx the x translation distance
- * @param ty the y translation distance
- * @see #getTranslateInstance(double, double)
- * @see #concatenate(AffineTransform)
- */
- public void translate(double tx, double ty)
- {
- m02 += tx * m00 + ty * m01;
- m12 += tx * m10 + ty * m11;
- updateType();
- }
-
- /**
- * Concatenate a rotation onto this transform. This is equivalent, but
- * more efficient than
- * concatenate(AffineTransform.getRotateInstance(theta))
.
- *
- * @param theta the rotation angle
- * @see #getRotateInstance(double)
- * @see #concatenate(AffineTransform)
- */
- public void rotate(double theta)
- {
- double c = Math.cos(theta);
- double s = Math.sin(theta);
- double n00 = m00 * c + m01 * s;
- double n01 = m00 * -s + m01 * c;
- double n10 = m10 * c + m11 * s;
- double n11 = m10 * -s + m11 * c;
- m00 = n00;
- m01 = n01;
- m10 = n10;
- m11 = n11;
- updateType();
- }
-
- /**
- * Concatenate a rotation about a point onto this transform. This is
- * equivalent, but more efficient than
- * concatenate(AffineTransform.getRotateInstance(theta, x, y))
.
- *
- * @param theta the rotation angle
- * @param x the x coordinate of the pivot point
- * @param y the y coordinate of the pivot point
- * @see #getRotateInstance(double, double, double)
- * @see #concatenate(AffineTransform)
- */
- public void rotate(double theta, double x, double y)
- {
- translate(x, y);
- rotate(theta);
- translate(-x, -y);
- }
-
- /**
- * Concatenate a scale onto this transform. This is equivalent, but more
- * efficient than
- * concatenate(AffineTransform.getScaleInstance(sx, sy))
.
- *
- * @param sx the x scaling factor
- * @param sy the y scaling factor
- * @see #getScaleInstance(double, double)
- * @see #concatenate(AffineTransform)
- */
- public void scale(double sx, double sy)
- {
- m00 *= sx;
- m01 *= sy;
- m10 *= sx;
- m11 *= sy;
- updateType();
- }
-
- /**
- * Concatenate a shearing onto this transform. This is equivalent, but more
- * efficient than
- * concatenate(AffineTransform.getShearInstance(sx, sy))
.
- *
- * @param shx the x shearing factor
- * @param shy the y shearing factor
- * @see #getShearInstance(double, double)
- * @see #concatenate(AffineTransform)
- */
- public void shear(double shx, double shy)
- {
- double n00 = m00 + (shy * m01);
- double n01 = m01 + (shx * m00);
- double n10 = m10 + (shy * m11);
- double n11 = m11 + (shx * m10);
- m00 = n00;
- m01 = n01;
- m10 = n10;
- m11 = n11;
- updateType();
- }
-
- /**
- * Reset this transform to the identity (no transformation):
- *
- * [ 1 0 0 ]
- * [ 0 1 0 ]
- * [ 0 0 1 ]
- *
- */
- public void setToIdentity()
- {
- m00 = m11 = 1;
- m01 = m02 = m10 = m12 = 0;
- type = TYPE_IDENTITY;
- }
-
- /**
- * Set this transform to a translation:
- *
- * [ 1 0 tx ]
- * [ 0 1 ty ]
- * [ 0 0 1 ]
- *
- *
- * @param tx the x translation distance
- * @param ty the y translation distance
- */
- public void setToTranslation(double tx, double ty)
- {
- m00 = m11 = 1;
- m01 = m10 = 0;
- m02 = tx;
- m12 = ty;
- type = (tx == 0 && ty == 0) ? TYPE_UNIFORM_SCALE : TYPE_TRANSLATION;
- }
-
- /**
- * Set this transform to a rotation. A positive angle (in radians) rotates
- * the positive x-axis to the positive y-axis:
- *
- * [ cos(theta) -sin(theta) 0 ]
- * [ sin(theta) cos(theta) 0 ]
- * [ 0 0 1 ]
- *
- *
- * @param theta the rotation angle
- */
- public void setToRotation(double theta)
- {
- double c = Math.cos(theta);
- double s = Math.sin(theta);
- m00 = c;
- m01 = -s;
- m02 = 0;
- m10 = s;
- m11 = c;
- m12 = 0;
- type = (c == 1 ? TYPE_IDENTITY
- : c == 0 || c == -1 ? TYPE_QUADRANT_ROTATION
- : TYPE_GENERAL_ROTATION);
- }
-
- /**
- * Set this transform to a rotation about a point. A positive angle (in
- * radians) rotates the positive x-axis to the positive y-axis. This is the
- * same as calling:
- *
- * tx.setToTranslation(x, y);
- * tx.rotate(theta);
- * tx.translate(-x, -y);
- *
- *
- *
- * [ cos(theta) -sin(theta) x-x*cos+y*sin ]
- * [ sin(theta) cos(theta) y-x*sin-y*cos ]
- * [ 0 0 1 ]
- *
- *
- * @param theta the rotation angle
- * @param x the x coordinate of the pivot point
- * @param y the y coordinate of the pivot point
- */
- public void setToRotation(double theta, double x, double y)
- {
- double c = Math.cos(theta);
- double s = Math.sin(theta);
- m00 = c;
- m01 = -s;
- m02 = x - x * c + y * s;
- m10 = s;
- m11 = c;
- m12 = y - x * s - y * c;
- updateType();
- }
-
- /**
- * Set this transform to a scale:
- *
- * [ sx 0 0 ]
- * [ 0 sy 0 ]
- * [ 0 0 1 ]
- *
- *
- * @param sx the x scaling factor
- * @param sy the y scaling factor
- */
- public void setToScale(double sx, double sy)
- {
- m00 = sx;
- m01 = m02 = m10 = m12 = 0;
- m11 = sy;
- type = (sx != sy ? TYPE_GENERAL_SCALE
- : sx == 1 ? TYPE_IDENTITY : TYPE_UNIFORM_SCALE);
- }
-
- /**
- * Set this transform to a shear (points are shifted in the x direction based
- * on a factor of their y coordinate, and in the y direction as a factor of
- * their x coordinate):
- *
- * [ 1 shx 0 ]
- * [ shy 1 0 ]
- * [ 0 0 1 ]
- *
- *
- * @param shx the x shearing factor
- * @param shy the y shearing factor
- */
- public void setToShear(double shx, double shy)
- {
- m00 = m11 = 1;
- m01 = shx;
- m10 = shy;
- m02 = m12 = 0;
- updateType();
- }
-
- /**
- * Set this transform to a copy of the given one.
- *
- * @param tx the transform to copy
- * @throws NullPointerException if tx is null
- */
- public void setTransform(AffineTransform tx)
- {
- m00 = tx.m00;
- m01 = tx.m01;
- m02 = tx.m02;
- m10 = tx.m10;
- m11 = tx.m11;
- m12 = tx.m12;
- type = tx.type;
- }
-
- /**
- * Set this transform to the given values:
- *
- * [ m00 m01 m02 ]
- * [ m10 m11 m12 ]
- * [ 0 0 1 ]
- *
- *
- * @param m00 the x scaling component
- * @param m10 the y shearing component
- * @param m01 the x shearing component
- * @param m11 the y scaling component
- * @param m02 the x translation component
- * @param m12 the y translation component
- */
- public void setTransform(double m00, double m10, double m01,
- double m11, double m02, double m12)
- {
- this.m00 = m00;
- this.m10 = m10;
- this.m01 = m01;
- this.m11 = m11;
- this.m02 = m02;
- this.m12 = m12;
- updateType();
- }
-
- /**
- * Set this transform to the result of performing the original version of
- * this followed by tx. This is commonly used when chaining transformations
- * from one space to another. In matrix form:
- *
- * [ this ] = [ this ] x [ tx ]
- *
- *
- * @param tx the transform to concatenate
- * @throws NullPointerException if tx is null
- * @see #preConcatenate(AffineTransform)
- */
- public void concatenate(AffineTransform tx)
- {
- double n00 = m00 * tx.m00 + m01 * tx.m10;
- double n01 = m00 * tx.m01 + m01 * tx.m11;
- double n02 = m00 * tx.m02 + m01 * tx.m12 + m02;
- double n10 = m10 * tx.m00 + m11 * tx.m10;
- double n11 = m10 * tx.m01 + m11 * tx.m11;
- double n12 = m10 * tx.m02 + m11 * tx.m12 + m12;
- m00 = n00;
- m01 = n01;
- m02 = n02;
- m10 = n10;
- m11 = n11;
- m12 = n12;
- updateType();
- }
-
- /**
- * Set this transform to the result of performing tx followed by the
- * original version of this. This is less common than normal concatenation,
- * but can still be used to chain transformations from one space to another.
- * In matrix form:
- *
- * [ this ] = [ tx ] x [ this ]
- *
- *
- * @param tx the transform to concatenate
- * @throws NullPointerException if tx is null
- * @see #concatenate(AffineTransform)
- */
- public void preConcatenate(AffineTransform tx)
- {
- double n00 = tx.m00 * m00 + tx.m01 * m10;
- double n01 = tx.m00 * m01 + tx.m01 * m11;
- double n02 = tx.m00 * m02 + tx.m01 * m12 + tx.m02;
- double n10 = tx.m10 * m00 + tx.m11 * m10;
- double n11 = tx.m10 * m01 + tx.m11 * m11;
- double n12 = tx.m10 * m02 + tx.m11 * m12 + tx.m12;
- m00 = n00;
- m01 = n01;
- m02 = n02;
- m10 = n10;
- m11 = n11;
- m12 = n12;
- updateType();
- }
-
- /**
- * Returns a transform, which if concatenated to this one, will result in
- * the identity transform. This is useful for undoing transformations, but
- * is only possible if the original transform has an inverse (ie. does not
- * map multiple points to the same line or point). A transform exists only
- * if getDeterminant() has a non-zero value.
- *
- * The inverse is calculated as:
- *
- *
- *
- * Let A be the matrix for which we want to find the inverse:
- *
- * A = [ m00 m01 m02 ]
- * [ m10 m11 m12 ]
- * [ 0 0 1 ]
- *
- *
- * 1
- * inverse (A) = --- x adjoint(A)
- * det
- *
- *
- *
- * = 1 [ m11 -m01 m01*m12-m02*m11 ]
- * --- x [ -m10 m00 -m00*m12+m10*m02 ]
- * det [ 0 0 m00*m11-m10*m01 ]
- *
- *
- *
- * = [ m11/det -m01/det m01*m12-m02*m11/det ]
- * [ -m10/det m00/det -m00*m12+m10*m02/det ]
- * [ 0 0 1 ]
- *
- *
- *
- *
- *
- *
- * @return a new inverse transform
- * @throws NoninvertibleTransformException if inversion is not possible
- * @see #getDeterminant()
- */
- public AffineTransform createInverse()
- throws NoninvertibleTransformException
- {
- double det = getDeterminant();
- if (det == 0)
- throw new NoninvertibleTransformException("can't invert transform");
-
- double im00 = m11 / det;
- double im10 = -m10 / det;
- double im01 = -m01 / det;
- double im11 = m00 / det;
- double im02 = (m01 * m12 - m02 * m11) / det;
- double im12 = (-m00 * m12 + m10 * m02) / det;
-
- return new AffineTransform (im00, im10, im01, im11, im02, im12);
- }
-
- /**
- * Perform this transformation on the given source point, and store the
- * result in the destination (creating it if necessary). It is safe for
- * src and dst to be the same.
- *
- * @param src the source point
- * @param dst the destination, or null
- * @return the transformation of src, in dst if it was non-null
- * @throws NullPointerException if src is null
- */
- public Point2D transform(Point2D src, Point2D dst)
- {
- if (dst == null)
- dst = new Point2D.Double();
- double x = src.getX();
- double y = src.getY();
- double nx = m00 * x + m01 * y + m02;
- double ny = m10 * x + m11 * y + m12;
- dst.setLocation(nx, ny);
- return dst;
- }
-
- /**
- * Perform this transformation on an array of points, storing the results
- * in another (possibly same) array. This will not create a destination
- * array, but will create points for the null entries of the destination.
- * The transformation is done sequentially. While having a single source
- * and destination point be the same is safe, you should be aware that
- * duplicate references to the same point in the source, and having the
- * source overlap the destination, may result in your source points changing
- * from a previous transform before it is their turn to be evaluated.
- *
- * @param src the array of source points
- * @param srcOff the starting offset into src
- * @param dst the array of destination points (may have null entries)
- * @param dstOff the starting offset into dst
- * @param num the number of points to transform
- * @throws NullPointerException if src or dst is null, or src has null
- * entries
- * @throws ArrayIndexOutOfBoundsException if array bounds are exceeded
- * @throws ArrayStoreException if new points are incompatible with dst
- */
- public void transform(Point2D[] src, int srcOff,
- Point2D[] dst, int dstOff, int num)
- {
- while (--num >= 0)
- dst[dstOff] = transform(src[srcOff++], dst[dstOff++]);
- }
-
- /**
- * Perform this transformation on an array of points, in (x,y) pairs,
- * storing the results in another (possibly same) array. This will not
- * create a destination array. All sources are copied before the
- * transformation, so that no result will overwrite a point that has not yet
- * been evaluated.
- *
- * @param srcPts the array of source points
- * @param srcOff the starting offset into src
- * @param dstPts the array of destination points
- * @param dstOff the starting offset into dst
- * @param num the number of points to transform
- * @throws NullPointerException if src or dst is null
- * @throws ArrayIndexOutOfBoundsException if array bounds are exceeded
- */
- public void transform(float[] srcPts, int srcOff,
- float[] dstPts, int dstOff, int num)
- {
- if (srcPts == dstPts && dstOff > srcOff
- && num > 1 && srcOff + 2 * num > dstOff)
- {
- float[] f = new float[2 * num];
- System.arraycopy(srcPts, srcOff, f, 0, 2 * num);
- srcPts = f;
- }
- while (--num >= 0)
- {
- float x = srcPts[srcOff++];
- float y = srcPts[srcOff++];
- dstPts[dstOff++] = (float) (m00 * x + m01 * y + m02);
- dstPts[dstOff++] = (float) (m10 * x + m11 * y + m12);
- }
- }
-
- /**
- * Perform this transformation on an array of points, in (x,y) pairs,
- * storing the results in another (possibly same) array. This will not
- * create a destination array. All sources are copied before the
- * transformation, so that no result will overwrite a point that has not yet
- * been evaluated.
- *
- * @param srcPts the array of source points
- * @param srcOff the starting offset into src
- * @param dstPts the array of destination points
- * @param dstOff the starting offset into dst
- * @param num the number of points to transform
- * @throws NullPointerException if src or dst is null
- * @throws ArrayIndexOutOfBoundsException if array bounds are exceeded
- */
- public void transform(double[] srcPts, int srcOff,
- double[] dstPts, int dstOff, int num)
- {
- if (srcPts == dstPts && dstOff > srcOff
- && num > 1 && srcOff + 2 * num > dstOff)
- {
- double[] d = new double[2 * num];
- System.arraycopy(srcPts, srcOff, d, 0, 2 * num);
- srcPts = d;
- }
- while (--num >= 0)
- {
- double x = srcPts[srcOff++];
- double y = srcPts[srcOff++];
- dstPts[dstOff++] = m00 * x + m01 * y + m02;
- dstPts[dstOff++] = m10 * x + m11 * y + m12;
- }
- }
-
- /**
- * Perform this transformation on an array of points, in (x,y) pairs,
- * storing the results in another array. This will not create a destination
- * array.
- *
- * @param srcPts the array of source points
- * @param srcOff the starting offset into src
- * @param dstPts the array of destination points
- * @param dstOff the starting offset into dst
- * @param num the number of points to transform
- * @throws NullPointerException if src or dst is null
- * @throws ArrayIndexOutOfBoundsException if array bounds are exceeded
- */
- public void transform(float[] srcPts, int srcOff,
- double[] dstPts, int dstOff, int num)
- {
- while (--num >= 0)
- {
- float x = srcPts[srcOff++];
- float y = srcPts[srcOff++];
- dstPts[dstOff++] = m00 * x + m01 * y + m02;
- dstPts[dstOff++] = m10 * x + m11 * y + m12;
- }
- }
-
- /**
- * Perform this transformation on an array of points, in (x,y) pairs,
- * storing the results in another array. This will not create a destination
- * array.
- *
- * @param srcPts the array of source points
- * @param srcOff the starting offset into src
- * @param dstPts the array of destination points
- * @param dstOff the starting offset into dst
- * @param num the number of points to transform
- * @throws NullPointerException if src or dst is null
- * @throws ArrayIndexOutOfBoundsException if array bounds are exceeded
- */
- public void transform(double[] srcPts, int srcOff,
- float[] dstPts, int dstOff, int num)
- {
- while (--num >= 0)
- {
- double x = srcPts[srcOff++];
- double y = srcPts[srcOff++];
- dstPts[dstOff++] = (float) (m00 * x + m01 * y + m02);
- dstPts[dstOff++] = (float) (m10 * x + m11 * y + m12);
- }
- }
-
- /**
- * Perform the inverse of this transformation on the given source point,
- * and store the result in the destination (creating it if necessary). It
- * is safe for src and dst to be the same.
- *
- * @param src the source point
- * @param dst the destination, or null
- * @return the inverse transformation of src, in dst if it was non-null
- * @throws NullPointerException if src is null
- * @throws NoninvertibleTransformException if the inverse does not exist
- * @see #getDeterminant()
- */
- public Point2D inverseTransform(Point2D src, Point2D dst)
- throws NoninvertibleTransformException
- {
- return createInverse().transform(src, dst);
- }
-
- /**
- * Perform the inverse of this transformation on an array of points, in
- * (x,y) pairs, storing the results in another (possibly same) array. This
- * will not create a destination array. All sources are copied before the
- * transformation, so that no result will overwrite a point that has not yet
- * been evaluated.
- *
- * @param srcPts the array of source points
- * @param srcOff the starting offset into src
- * @param dstPts the array of destination points
- * @param dstOff the starting offset into dst
- * @param num the number of points to transform
- * @throws NullPointerException if src or dst is null
- * @throws ArrayIndexOutOfBoundsException if array bounds are exceeded
- * @throws NoninvertibleTransformException if the inverse does not exist
- * @see #getDeterminant()
- */
- public void inverseTransform(double[] srcPts, int srcOff,
- double[] dstPts, int dstOff, int num)
- throws NoninvertibleTransformException
- {
- createInverse().transform(srcPts, srcOff, dstPts, dstOff, num);
- }
-
- /**
- * Perform this transformation, less any translation, on the given source
- * point, and store the result in the destination (creating it if
- * necessary). It is safe for src and dst to be the same. The reduced
- * transform is equivalent to:
- *
- * [ x' ] = [ m00 m01 ] [ x ] = [ m00 * x + m01 * y ]
- * [ y' ] [ m10 m11 ] [ y ] = [ m10 * x + m11 * y ]
- *
- *
- * @param src the source point
- * @param dst the destination, or null
- * @return the delta transformation of src, in dst if it was non-null
- * @throws NullPointerException if src is null
- */
- public Point2D deltaTransform(Point2D src, Point2D dst)
- {
- if (dst == null)
- dst = new Point2D.Double();
- double x = src.getX();
- double y = src.getY();
- double nx = m00 * x + m01 * y;
- double ny = m10 * x + m11 * y;
- dst.setLocation(nx, ny);
- return dst;
- }
-
- /**
- * Perform this transformation, less any translation, on an array of points,
- * in (x,y) pairs, storing the results in another (possibly same) array.
- * This will not create a destination array. All sources are copied before
- * the transformation, so that no result will overwrite a point that has
- * not yet been evaluated. The reduced transform is equivalent to:
- *
- * [ x' ] = [ m00 m01 ] [ x ] = [ m00 * x + m01 * y ]
- * [ y' ] [ m10 m11 ] [ y ] = [ m10 * x + m11 * y ]
- *
- *
- * @param srcPts the array of source points
- * @param srcOff the starting offset into src
- * @param dstPts the array of destination points
- * @param dstOff the starting offset into dst
- * @param num the number of points to transform
- * @throws NullPointerException if src or dst is null
- * @throws ArrayIndexOutOfBoundsException if array bounds are exceeded
- */
- public void deltaTransform(double[] srcPts, int srcOff,
- double[] dstPts, int dstOff,
- int num)
- {
- if (srcPts == dstPts && dstOff > srcOff
- && num > 1 && srcOff + 2 * num > dstOff)
- {
- double[] d = new double[2 * num];
- System.arraycopy(srcPts, srcOff, d, 0, 2 * num);
- srcPts = d;
- }
- while (--num >= 0)
- {
- double x = srcPts[srcOff++];
- double y = srcPts[srcOff++];
- dstPts[dstOff++] = m00 * x + m01 * y;
- dstPts[dstOff++] = m10 * x + m11 * y;
- }
- }
-
- /**
- * Return a new Shape, based on the given one, where the path of the shape
- * has been transformed by this transform. Notice that this uses GeneralPath,
- * which only stores points in float precision.
- *
- * @param src the shape source to transform
- * @return the shape, transformed by this, null
if src is
- * null
.
- * @see GeneralPath#transform(AffineTransform)
- */
- public Shape createTransformedShape(Shape src)
- {
- if(src == null)
- return null;
- GeneralPath p = new GeneralPath(src);
- p.transform(this);
- return p;
- }
-
- /**
- * Returns a string representation of the transform, in the format:
- * "AffineTransform[[" + m00 + ", " + m01 + ", " + m02 + "], ["
- * + m10 + ", " + m11 + ", " + m12 + "]]"
.
- *
- * @return the string representation
- */
- public String toString()
- {
- return "AffineTransform[[" + m00 + ", " + m01 + ", " + m02 + "], ["
- + m10 + ", " + m11 + ", " + m12 + "]]";
- }
-
- /**
- * Tests if this transformation is the identity:
- *
- * [ 1 0 0 ]
- * [ 0 1 0 ]
- * [ 0 0 1 ]
- *
- *
- * @return true if this is the identity transform
- */
- public boolean isIdentity()
- {
- // Rather than rely on type, check explicitly.
- return (m00 == 1 && m01 == 0 && m02 == 0
- && m10 == 0 && m11 == 1 && m12 == 0);
- }
-
- /**
- * Create a new transform of the same run-time type, with the same
- * transforming properties as this one.
- *
- * @return the clone
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * Return the hashcode for this transformation. The formula is not
- * documented, but appears to be the same as:
- *
- * long l = Double.doubleToLongBits(getScaleX());
- * l = l * 31 + Double.doubleToLongBits(getShearY());
- * l = l * 31 + Double.doubleToLongBits(getShearX());
- * l = l * 31 + Double.doubleToLongBits(getScaleY());
- * l = l * 31 + Double.doubleToLongBits(getTranslateX());
- * l = l * 31 + Double.doubleToLongBits(getTranslateY());
- * return (int) ((l >> 32) ^ l);
- *
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- long l = Double.doubleToLongBits(m00);
- l = l * 31 + Double.doubleToLongBits(m10);
- l = l * 31 + Double.doubleToLongBits(m01);
- l = l * 31 + Double.doubleToLongBits(m11);
- l = l * 31 + Double.doubleToLongBits(m02);
- l = l * 31 + Double.doubleToLongBits(m12);
- return (int) ((l >> 32) ^ l);
- }
-
- /**
- * Compares two transforms for equality. This returns true if they have the
- * same matrix values.
- *
- * @param obj the transform to compare
- * @return true if it is equal
- */
- public boolean equals(Object obj)
- {
- if (! (obj instanceof AffineTransform))
- return false;
- AffineTransform t = (AffineTransform) obj;
- return (m00 == t.m00 && m01 == t.m01 && m02 == t.m02
- && m10 == t.m10 && m11 == t.m11 && m12 == t.m12);
- }
-
- /**
- * Helper to decode the type from the matrix. This is not guaranteed
- * to find the optimal type, but at least it will be valid.
- */
- private void updateType()
- {
- double det = getDeterminant();
- if (det == 0)
- {
- type = TYPE_GENERAL_TRANSFORM;
- return;
- }
- // Scale (includes rotation by PI) or translation.
- if (m01 == 0 && m10 == 0)
- {
- if (m00 == m11)
- type = m00 == 1 ? TYPE_IDENTITY : TYPE_UNIFORM_SCALE;
- else
- type = TYPE_GENERAL_SCALE;
- if (m02 != 0 || m12 != 0)
- type |= TYPE_TRANSLATION;
- }
- // Rotation.
- else if (m00 == m11 && m01 == -m10)
- {
- type = m00 == 0 ? TYPE_QUADRANT_ROTATION : TYPE_GENERAL_ROTATION;
- if (det != 1)
- type |= TYPE_UNIFORM_SCALE;
- if (m02 != 0 || m12 != 0)
- type |= TYPE_TRANSLATION;
- }
- else
- type = TYPE_GENERAL_TRANSFORM;
- }
-
- /**
- * Reads a transform from an object stream.
- *
- * @param s the stream to read from
- * @throws ClassNotFoundException if there is a problem deserializing
- * @throws IOException if there is a problem deserializing
- */
- private void readObject(ObjectInputStream s)
- throws ClassNotFoundException, IOException
- {
- s.defaultReadObject();
- updateType();
- }
-} // class AffineTransform
diff --git a/libjava/java/awt/geom/Arc2D.java b/libjava/java/awt/geom/Arc2D.java
deleted file mode 100644
index eff34a08144..00000000000
--- a/libjava/java/awt/geom/Arc2D.java
+++ /dev/null
@@ -1,1399 +0,0 @@
-/* Arc2D.java -- represents an arc in 2-D space
- Copyright (C) 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-import java.util.NoSuchElementException;
-
-
-/**
- * This class represents all arcs (segments of an ellipse in 2-D space). The
- * arcs are defined by starting angle and extent (arc length) in degrees, as
- * opposed to radians (like the rest of Java), and can be open, chorded, or
- * wedge shaped. The angles are skewed according to the ellipse, so that 45
- * degrees always points to the upper right corner (positive x, negative y)
- * of the bounding rectangle. A positive extent draws a counterclockwise arc,
- * and while the angle can be any value, the path iterator only traverses the
- * first 360 degrees. Storage is up to the subclasses.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Sven de Marothy (sven@physto.se)
- * @since 1.2
- */
-public abstract class Arc2D extends RectangularShape
-{
- /**
- * An open arc, with no segment connecting the endpoints. This type of
- * arc still contains the same points as a chorded version.
- */
- public static final int OPEN = 0;
-
- /**
- * A closed arc with a single segment connecting the endpoints (a chord).
- */
- public static final int CHORD = 1;
-
- /**
- * A closed arc with two segments, one from each endpoint, meeting at the
- * center of the ellipse.
- */
- public static final int PIE = 2;
-
- /** The closure type of this arc. This is package-private to avoid an
- * accessor method. */
- int type;
-
- /**
- * Create a new arc, with the specified closure type.
- *
- * @param type one of {@link #OPEN}, {@link #CHORD}, or {@link #PIE}.
- * @throws IllegalArgumentException if type is invalid
- */
- protected Arc2D(int type)
- {
- if (type < OPEN || type > PIE)
- throw new IllegalArgumentException();
- this.type = type;
- }
-
- /**
- * Get the starting angle of the arc in degrees.
- *
- * @return the starting angle
- * @see #setAngleStart(double)
- */
- public abstract double getAngleStart();
-
- /**
- * Get the extent angle of the arc in degrees.
- *
- * @return the extent angle
- * @see #setAngleExtent(double)
- */
- public abstract double getAngleExtent();
-
- /**
- * Return the closure type of the arc.
- *
- * @return the closure type
- * @see #OPEN
- * @see #CHORD
- * @see #PIE
- * @see #setArcType(int)
- */
- public int getArcType()
- {
- return type;
- }
-
- /**
- * Returns the starting point of the arc.
- *
- * @return the start point
- */
- public Point2D getStartPoint()
- {
- double angle = Math.toRadians(getAngleStart());
- double rx = getWidth() / 2;
- double ry = getHeight() / 2;
- double x = getX() + rx + rx * Math.cos(angle);
- double y = getY() + ry - ry * Math.sin(angle);
- return new Point2D.Double(x, y);
- }
-
- /**
- * Returns the ending point of the arc.
- *
- * @return the end point
- */
- public Point2D getEndPoint()
- {
- double angle = Math.toRadians(getAngleStart() + getAngleExtent());
- double rx = getWidth() / 2;
- double ry = getHeight() / 2;
- double x = getX() + rx + rx * Math.cos(angle);
- double y = getY() + ry - ry * Math.sin(angle);
- return new Point2D.Double(x, y);
- }
-
- /**
- * Set the parameters of the arc. The angles are in degrees, and a positive
- * extent sweeps counterclockwise (from the positive x-axis to the negative
- * y-axis).
- *
- * @param x the new x coordinate of the upper left of the bounding box
- * @param y the new y coordinate of the upper left of the bounding box
- * @param w the new width of the bounding box
- * @param h the new height of the bounding box
- * @param start the start angle, in degrees
- * @param extent the arc extent, in degrees
- * @param type one of {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public abstract void setArc(double x, double y, double w, double h,
- double start, double extent, int type);
-
- /**
- * Set the parameters of the arc. The angles are in degrees, and a positive
- * extent sweeps counterclockwise (from the positive x-axis to the negative
- * y-axis).
- *
- * @param p the upper left point of the bounding box
- * @param d the dimensions of the bounding box
- * @param start the start angle, in degrees
- * @param extent the arc extent, in degrees
- * @param type one of {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- * @throws NullPointerException if p or d is null
- */
- public void setArc(Point2D p, Dimension2D d, double start, double extent,
- int type)
- {
- setArc(p.getX(), p.getY(), d.getWidth(), d.getHeight(), start, extent, type);
- }
-
- /**
- * Set the parameters of the arc. The angles are in degrees, and a positive
- * extent sweeps counterclockwise (from the positive x-axis to the negative
- * y-axis).
- *
- * @param r the new bounding box
- * @param start the start angle, in degrees
- * @param extent the arc extent, in degrees
- * @param type one of {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- * @throws NullPointerException if r is null
- */
- public void setArc(Rectangle2D r, double start, double extent, int type)
- {
- setArc(r.getX(), r.getY(), r.getWidth(), r.getHeight(), start, extent, type);
- }
-
- /**
- * Set the parameters of the arc from the given one.
- *
- * @param a the arc to copy
- * @throws NullPointerException if a is null
- */
- public void setArc(Arc2D a)
- {
- setArc(a.getX(), a.getY(), a.getWidth(), a.getHeight(), a.getAngleStart(),
- a.getAngleExtent(), a.getArcType());
- }
-
- /**
- * Set the parameters of the arc. The angles are in degrees, and a positive
- * extent sweeps counterclockwise (from the positive x-axis to the negative
- * y-axis). This controls the center point and radius, so the arc will be
- * circular.
- *
- * @param x the x coordinate of the center of the circle
- * @param y the y coordinate of the center of the circle
- * @param r the radius of the circle
- * @param start the start angle, in degrees
- * @param extent the arc extent, in degrees
- * @param type one of {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public void setArcByCenter(double x, double y, double r, double start,
- double extent, int type)
- {
- setArc(x - r, y - r, r + r, r + r, start, extent, type);
- }
-
- /**
- * Sets the parameters of the arc by finding the tangents of two lines, and
- * using the specified radius. The arc will be circular, will begin on the
- * tangent point of the line extending from p1 to p2, and will end on the
- * tangent point of the line extending from p2 to p3.
- *
- * XXX What happens if the points are colinear, or the radius negative?
- *
- * @param p1 the first point
- * @param p2 the tangent line intersection point
- * @param p3 the third point
- * @param r the radius of the arc
- * @throws NullPointerException if any point is null
- */
- public void setArcByTangent(Point2D p1, Point2D p2, Point2D p3, double r)
- {
- if ((p2.getX() - p1.getX()) * (p3.getY() - p1.getY())
- - (p3.getX() - p1.getX()) * (p2.getY() - p1.getY()) > 0)
- {
- Point2D p = p3;
- p3 = p1;
- p1 = p;
- }
-
- // normalized tangent vectors
- double dx1 = (p1.getX() - p2.getX()) / p1.distance(p2);
- double dy1 = (p1.getY() - p2.getY()) / p1.distance(p2);
- double dx2 = (p2.getX() - p3.getX()) / p3.distance(p2);
- double dy2 = (p2.getY() - p3.getY()) / p3.distance(p2);
- double theta1 = Math.atan2(dx1, dy1);
- double theta2 = Math.atan2(dx2, dy2);
-
- double dx = r * Math.cos(theta2) - r * Math.cos(theta1);
- double dy = -r * Math.sin(theta2) + r * Math.sin(theta1);
-
- if (theta1 < 0)
- theta1 += 2 * Math.PI;
- if (theta2 < 0)
- theta2 += 2 * Math.PI;
- if (theta2 < theta1)
- theta2 += 2 * Math.PI;
-
- // Vectors of the lines, not normalized, note we change
- // the direction of line 2.
- dx1 = p1.getX() - p2.getX();
- dy1 = p1.getY() - p2.getY();
- dx2 = p3.getX() - p2.getX();
- dy2 = p3.getY() - p2.getY();
-
- // Calculate the tangent point to the second line
- double t2 = -(dx1 * dy - dy1 * dx) / (dx2 * dy1 - dx1 * dy2);
- double x2 = t2 * (p3.getX() - p2.getX()) + p2.getX();
- double y2 = t2 * (p3.getY() - p2.getY()) + p2.getY();
-
- // calculate the center point
- double x = x2 - r * Math.cos(theta2);
- double y = y2 + r * Math.sin(theta2);
-
- setArc(x - r, y - r, 2 * r, 2 * r, Math.toDegrees(theta1),
- Math.toDegrees(theta2 - theta1), getArcType());
- }
-
- /**
- * Set the start, in degrees.
- *
- * @param start the new start angle
- * @see #getAngleStart()
- */
- public abstract void setAngleStart(double start);
-
- /**
- * Set the extent, in degrees.
- *
- * @param extent the new extent angle
- * @see #getAngleExtent()
- */
- public abstract void setAngleExtent(double extent);
-
- /**
- * Sets the starting angle to the angle of the given point relative to
- * the center of the arc. The extent remains constant; in other words,
- * this rotates the arc.
- *
- * @param p the new start point
- * @throws NullPointerException if p is null
- * @see #getStartPoint()
- * @see #getAngleStart()
- */
- public void setAngleStart(Point2D p)
- {
- // Normalize.
- double x = p.getX() - (getX() + getWidth() / 2);
- double y = p.getY() - (getY() + getHeight() / 2);
- setAngleStart(Math.toDegrees(Math.atan2(-y, x)));
- }
-
- /**
- * Sets the starting and extent angles to those of the given points
- * relative to the center of the arc. The arc will be non-empty, and will
- * extend counterclockwise.
- *
- * @param x1 the first x coordinate
- * @param y1 the first y coordinate
- * @param x2 the second x coordinate
- * @param y2 the second y coordinate
- * @see #setAngleStart(Point2D)
- */
- public void setAngles(double x1, double y1, double x2, double y2)
- {
- // Normalize the points.
- double mx = getX();
- double my = getY();
- double mw = getWidth();
- double mh = getHeight();
- x1 = x1 - (mx + mw / 2);
- y1 = y1 - (my + mh / 2);
- x2 = x2 - (mx + mw / 2);
- y2 = y2 - (my + mh / 2);
- double start = Math.toDegrees(Math.atan2(-y1, x1));
- double extent = Math.toDegrees(Math.atan2(-y2, x2)) - start;
- if (extent < 0)
- extent += 360;
- setAngleStart(start);
- setAngleExtent(extent);
- }
-
- /**
- * Sets the starting and extent angles to those of the given points
- * relative to the center of the arc. The arc will be non-empty, and will
- * extend counterclockwise.
- *
- * @param p1 the first point
- * @param p2 the second point
- * @throws NullPointerException if either point is null
- * @see #setAngleStart(Point2D)
- */
- public void setAngles(Point2D p1, Point2D p2)
- {
- setAngles(p1.getX(), p1.getY(), p2.getX(), p2.getY());
- }
-
- /**
- * Set the closure type of this arc.
- *
- * @param type one of {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- * @see #getArcType()
- */
- public void setArcType(int type)
- {
- if (type < OPEN || type > PIE)
- throw new IllegalArgumentException();
- this.type = type;
- }
-
- /**
- * Sets the location and bounds of the ellipse of which this arc is a part.
- *
- * @param x the new x coordinate
- * @param y the new y coordinate
- * @param w the new width
- * @param h the new height
- * @see #getFrame()
- */
- public void setFrame(double x, double y, double w, double h)
- {
- setArc(x, y, w, h, getAngleStart(), getAngleExtent(), type);
- }
-
- /**
- * Gets the bounds of the arc. This is much tighter than
- * getBounds
, as it takes into consideration the start and
- * end angles, and the center point of a pie wedge, rather than just the
- * overall ellipse.
- *
- * @return the bounds of the arc
- * @see #getBounds()
- */
- public Rectangle2D getBounds2D()
- {
- double extent = getAngleExtent();
- if (Math.abs(extent) >= 360)
- return makeBounds(getX(), getY(), getWidth(), getHeight());
-
- // Find the minimal bounding box. This determined by its extrema,
- // which are the center, the endpoints of the arc, and any local
- // maximum contained by the arc.
- double rX = getWidth() / 2;
- double rY = getHeight() / 2;
- double centerX = getX() + rX;
- double centerY = getY() + rY;
-
- Point2D p1 = getStartPoint();
- Rectangle2D result = makeBounds(p1.getX(), p1.getY(), 0, 0);
- result.add(getEndPoint());
-
- if (type == PIE)
- result.add(centerX, centerY);
- if (containsAngle(0))
- result.add(centerX + rX, centerY);
- if (containsAngle(90))
- result.add(centerX, centerY - rY);
- if (containsAngle(180))
- result.add(centerX - rX, centerY);
- if (containsAngle(270))
- result.add(centerX, centerY + rY);
-
- return result;
- }
-
- /**
- * Construct a bounding box in a precision appropriate for the subclass.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- * @return the rectangle for use in getBounds2D
- */
- protected abstract Rectangle2D makeBounds(double x, double y, double w,
- double h);
-
- /**
- * Tests if the given angle, in degrees, is included in the arc.
- * All angles are normalized to be between 0 and 360 degrees.
- *
- * @param a the angle to test
- * @return true if it is contained
- */
- public boolean containsAngle(double a)
- {
- double start = getAngleStart();
- double extent = getAngleExtent();
- double end = start + extent;
-
- if (extent == 0)
- return false;
-
- if (extent >= 360 || extent <= -360)
- return true;
-
- if (extent < 0)
- {
- end = start;
- start += extent;
- }
-
- start %= 360;
- while (start < 0)
- start += 360;
-
- end %= 360;
- while (end < start)
- end += 360;
-
- a %= 360;
- while (a < start)
- a += 360;
-
- return a >= start && a < end; // starting angle included, ending angle not
- }
-
- /**
- * Determines if the arc contains the given point. If the bounding box
- * is empty, then this will return false.
- *
- * The area considered 'inside' an arc of type OPEN is the same as the
- * area inside an equivalent filled CHORD-type arc. The area considered
- * 'inside' a CHORD-type arc is the same as the filled area.
- *
- * @param x the x coordinate to test
- * @param y the y coordinate to test
- * @return true if the point is inside the arc
- */
- public boolean contains(double x, double y)
- {
- double w = getWidth();
- double h = getHeight();
- double extent = getAngleExtent();
- if (w <= 0 || h <= 0 || extent == 0)
- return false;
-
- double mx = getX() + w / 2;
- double my = getY() + h / 2;
- double dx = (x - mx) * 2 / w;
- double dy = (y - my) * 2 / h;
- if ((dx * dx + dy * dy) >= 1.0)
- return false;
-
- double angle = Math.toDegrees(Math.atan2(-dy, dx));
- if (getArcType() == PIE)
- return containsAngle(angle);
-
- double a1 = Math.toRadians(getAngleStart());
- double a2 = Math.toRadians(getAngleStart() + extent);
- double x1 = mx + getWidth() * Math.cos(a1) / 2;
- double y1 = my - getHeight() * Math.sin(a1) / 2;
- double x2 = mx + getWidth() * Math.cos(a2) / 2;
- double y2 = my - getHeight() * Math.sin(a2) / 2;
- double sgn = ((x2 - x1) * (my - y1) - (mx - x1) * (y2 - y1)) * ((x2 - x1) * (y
- - y1) - (x - x1) * (y2 - y1));
-
- if (Math.abs(extent) > 180)
- {
- if (containsAngle(angle))
- return true;
- return sgn > 0;
- }
- else
- {
- if (! containsAngle(angle))
- return false;
- return sgn < 0;
- }
- }
-
- /**
- * Tests if a given rectangle intersects the area of the arc.
- *
- * For a definition of the 'inside' area, see the contains() method.
- * @see #contains(double, double)
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @return true if the two shapes share common points
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- double extent = getAngleExtent();
- if (extent == 0)
- return false;
-
- if (contains(x, y) || contains(x, y + h) || contains(x + w, y)
- || contains(x + w, y + h))
- return true;
-
- Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
-
- double a = getWidth() / 2.0;
- double b = getHeight() / 2.0;
-
- double mx = getX() + a;
- double my = getY() + b;
- double x1 = mx + a * Math.cos(Math.toRadians(getAngleStart()));
- double y1 = my - b * Math.sin(Math.toRadians(getAngleStart()));
- double x2 = mx + a * Math.cos(Math.toRadians(getAngleStart() + extent));
- double y2 = my - b * Math.sin(Math.toRadians(getAngleStart() + extent));
-
- if (getArcType() != CHORD)
- {
- // check intersections against the pie radii
- if (rect.intersectsLine(mx, my, x1, y1))
- return true;
- if (rect.intersectsLine(mx, my, x2, y2))
- return true;
- }
- else// check the chord
- if (rect.intersectsLine(x1, y1, x2, y2))
- return true;
-
- // Check the Arc segment against the four edges
- double dx;
-
- // Check the Arc segment against the four edges
- double dy;
- dy = y - my;
- dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
- if (! java.lang.Double.isNaN(dx))
- {
- if (mx + dx >= x && mx + dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (mx - dx >= x && mx - dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
- return true;
- }
- dy = (y + h) - my;
- dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
- if (! java.lang.Double.isNaN(dx))
- {
- if (mx + dx >= x && mx + dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (mx - dx >= x && mx - dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
- return true;
- }
- dx = x - mx;
- dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
- if (! java.lang.Double.isNaN(dy))
- {
- if (my + dy >= y && my + dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (my - dy >= y && my - dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
- return true;
- }
-
- dx = (x + w) - mx;
- dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
- if (! java.lang.Double.isNaN(dy))
- {
- if (my + dy >= y && my + dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (my - dy >= y && my - dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
- return true;
- }
-
- // Check whether the arc is contained within the box
- if (rect.contains(mx, my))
- return true;
-
- return false;
- }
-
- /**
- * Tests if a given rectangle is contained in the area of the arc.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @return true if the arc contains the rectangle
- */
- public boolean contains(double x, double y, double w, double h)
- {
- double extent = getAngleExtent();
- if (extent == 0)
- return false;
-
- if (! (contains(x, y) && contains(x, y + h) && contains(x + w, y)
- && contains(x + w, y + h)))
- return false;
-
- Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
-
- double a = getWidth() / 2.0;
- double b = getHeight() / 2.0;
-
- double mx = getX() + a;
- double my = getY() + b;
- double x1 = mx + a * Math.cos(Math.toRadians(getAngleStart()));
- double y1 = my - b * Math.sin(Math.toRadians(getAngleStart()));
- double x2 = mx + a * Math.cos(Math.toRadians(getAngleStart() + extent));
- double y2 = my - b * Math.sin(Math.toRadians(getAngleStart() + extent));
- if (getArcType() != CHORD)
- {
- // check intersections against the pie radii
- if (rect.intersectsLine(mx, my, x1, y1))
- return false;
-
- if (rect.intersectsLine(mx, my, x2, y2))
- return false;
- }
- else if (rect.intersectsLine(x1, y1, x2, y2))
- return false;
- return true;
- }
-
- /**
- * Tests if a given rectangle is contained in the area of the arc.
- *
- * @param r the rectangle
- * @return true if the arc contains the rectangle
- */
- public boolean contains(Rectangle2D r)
- {
- return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Returns an iterator over this arc, with an optional transformation.
- * This iterator is threadsafe, so future modifications to the arc do not
- * affect the iteration.
- *
- * @param at the transformation, or null
- * @return a path iterator
- */
- public PathIterator getPathIterator(AffineTransform at)
- {
- return new ArcIterator(this, at);
- }
-
- /**
- * This class is used to iterate over an arc. Since ellipses are a subclass
- * of arcs, this is used by Ellipse2D as well.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
- static final class ArcIterator implements PathIterator
- {
- /** The current iteration. */
- private int current;
-
- /** The last iteration. */
- private final int limit;
-
- /** The optional transformation. */
- private final AffineTransform xform;
-
- /** The x coordinate of the bounding box. */
- private final double x;
-
- /** The y coordinate of the bounding box. */
- private final double y;
-
- /** The width of the bounding box. */
- private final double w;
-
- /** The height of the bounding box. */
- private final double h;
-
- /** The start angle, in radians (not degrees). */
- private final double start;
-
- /** The extent angle, in radians (not degrees). */
- private final double extent;
-
- /** The arc closure type. */
- private final int type;
-
- /**
- * Construct a new iterator over an arc.
- *
- * @param a the arc
- * @param xform the transform
- */
- public ArcIterator(Arc2D a, AffineTransform xform)
- {
- this.xform = xform;
- x = a.getX();
- y = a.getY();
- w = a.getWidth();
- h = a.getHeight();
- double start = a.getAngleStart() * (Math.PI / 180);
- double extent = a.getAngleExtent() * (Math.PI / 180);
-
- if (extent < 0)
- {
- extent = -extent;
- start = 2 * Math.PI - extent + start;
- }
- this.start = start;
- this.extent = extent;
-
- type = a.type;
- if (w < 0 || h < 0)
- limit = -1;
- else if (extent == 0)
- limit = type;
- else if (extent <= Math.PI / 2.0)
- limit = type + 1;
- else if (extent <= Math.PI)
- limit = type + 2;
- else if (extent <= 3.0 * (Math.PI / 2.0))
- limit = type + 3;
- else
- limit = type + 4;
- }
-
- /**
- * Construct a new iterator over an ellipse.
- *
- * @param e the ellipse
- * @param xform the transform
- */
- public ArcIterator(Ellipse2D e, AffineTransform xform)
- {
- this.xform = xform;
- x = e.getX();
- y = e.getY();
- w = e.getWidth();
- h = e.getHeight();
- start = 0;
- extent = 2 * Math.PI;
- type = CHORD;
- limit = (w < 0 || h < 0) ? -1 : 5;
- }
-
- /**
- * Return the winding rule.
- *
- * @return {@link PathIterator#WIND_NON_ZERO}
- */
- public int getWindingRule()
- {
- return WIND_NON_ZERO;
- }
-
- /**
- * Test if the iteration is complete.
- *
- * @return true if more segments exist
- */
- public boolean isDone()
- {
- return current > limit;
- }
-
- /**
- * Advance the iterator.
- */
- public void next()
- {
- current++;
- }
-
- /**
- * Put the current segment into the array, and return the segment type.
- *
- * @param coords an array of 6 elements
- * @return the segment type
- * @throws NullPointerException if coords is null
- * @throws ArrayIndexOutOfBoundsException if coords is too small
- */
- public int currentSegment(float[] coords)
- {
- double[] double_coords = new double[6];
- int code = currentSegment(double_coords);
- for (int i = 0; i < 6; ++i)
- coords[i] = (float) double_coords[i];
- return code;
- }
-
- /**
- * Put the current segment into the array, and return the segment type.
- *
- * @param coords an array of 6 elements
- * @return the segment type
- * @throws NullPointerException if coords is null
- * @throws ArrayIndexOutOfBoundsException if coords is too small
- */
- public int currentSegment(double[] coords)
- {
- double rx = w / 2;
- double ry = h / 2;
- double xmid = x + rx;
- double ymid = y + ry;
-
- if (current > limit)
- throw new NoSuchElementException("arc iterator out of bounds");
-
- if (current == 0)
- {
- coords[0] = xmid + rx * Math.cos(start);
- coords[1] = ymid - ry * Math.sin(start);
- if (xform != null)
- xform.transform(coords, 0, coords, 0, 1);
- return SEG_MOVETO;
- }
-
- if (type != OPEN && current == limit)
- return SEG_CLOSE;
-
- if ((current == limit - 1) && (type == PIE))
- {
- coords[0] = xmid;
- coords[1] = ymid;
- if (xform != null)
- xform.transform(coords, 0, coords, 0, 1);
- return SEG_LINETO;
- }
-
- // note that this produces a cubic approximation of the arc segment,
- // not a true ellipsoid. there's no ellipsoid path segment code,
- // unfortunately. the cubic approximation looks about right, though.
- double kappa = (Math.sqrt(2.0) - 1.0) * (4.0 / 3.0);
- double quad = (Math.PI / 2.0);
-
- double curr_begin = start + (current - 1) * quad;
- double curr_extent = Math.min((start + extent) - curr_begin, quad);
- double portion_of_a_quadrant = curr_extent / quad;
-
- double x0 = xmid + rx * Math.cos(curr_begin);
- double y0 = ymid - ry * Math.sin(curr_begin);
-
- double x1 = xmid + rx * Math.cos(curr_begin + curr_extent);
- double y1 = ymid - ry * Math.sin(curr_begin + curr_extent);
-
- AffineTransform trans = new AffineTransform();
- double[] cvec = new double[2];
- double len = kappa * portion_of_a_quadrant;
- double angle = curr_begin;
-
- // in a hypothetical "first quadrant" setting, our first control
- // vector would be sticking up, from [1,0] to [1,kappa].
- //
- // let us recall however that in java2d, y coords are upside down
- // from what one would consider "normal" first quadrant rules, so we
- // will *subtract* the y value of this control vector from our first
- // point.
- cvec[0] = 0;
- cvec[1] = len;
- trans.scale(rx, ry);
- trans.rotate(angle);
- trans.transform(cvec, 0, cvec, 0, 1);
- coords[0] = x0 + cvec[0];
- coords[1] = y0 - cvec[1];
-
- // control vector #2 would, ideally, be sticking out and to the
- // right, in a first quadrant arc segment. again, subtraction of y.
- cvec[0] = 0;
- cvec[1] = -len;
- trans.rotate(curr_extent);
- trans.transform(cvec, 0, cvec, 0, 1);
- coords[2] = x1 + cvec[0];
- coords[3] = y1 - cvec[1];
-
- // end point
- coords[4] = x1;
- coords[5] = y1;
-
- if (xform != null)
- xform.transform(coords, 0, coords, 0, 3);
-
- return SEG_CUBICTO;
- }
- } // class ArcIterator
-
- /**
- * This class implements an arc in double precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- */
- public static class Double extends Arc2D
- {
- /** The x coordinate of the box bounding the ellipse of this arc. */
- public double x;
-
- /** The y coordinate of the box bounding the ellipse of this arc. */
- public double y;
-
- /** The width of the box bounding the ellipse of this arc. */
- public double width;
-
- /** The height of the box bounding the ellipse of this arc. */
- public double height;
-
- /** The start angle of this arc, in degrees. */
- public double start;
-
- /** The extent angle of this arc, in degrees. */
- public double extent;
-
- /**
- * Create a new, open arc at (0,0) with 0 extent.
- */
- public Double()
- {
- super(OPEN);
- }
-
- /**
- * Create a new arc of the given type at (0,0) with 0 extent.
- *
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public Double(int type)
- {
- super(type);
- }
-
- /**
- * Create a new arc with the given dimensions.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- * @param start the start angle, in degrees
- * @param extent the extent, in degrees
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public Double(double x, double y, double w, double h, double start,
- double extent, int type)
- {
- super(type);
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- this.start = start;
- this.extent = extent;
- }
-
- /**
- * Create a new arc with the given dimensions.
- *
- * @param r the bounding box
- * @param start the start angle, in degrees
- * @param extent the extent, in degrees
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- * @throws NullPointerException if r is null
- */
- public Double(Rectangle2D r, double start, double extent, int type)
- {
- super(type);
- x = r.getX();
- y = r.getY();
- width = r.getWidth();
- height = r.getHeight();
- this.start = start;
- this.extent = extent;
- }
-
- /**
- * Return the x coordinate of the bounding box.
- *
- * @return the value of x
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Return the y coordinate of the bounding box.
- *
- * @return the value of y
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Return the width of the bounding box.
- *
- * @return the value of width
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Return the height of the bounding box.
- *
- * @return the value of height
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Return the start angle of the arc, in degrees.
- *
- * @return the value of start
- */
- public double getAngleStart()
- {
- return start;
- }
-
- /**
- * Return the extent of the arc, in degrees.
- *
- * @return the value of extent
- */
- public double getAngleExtent()
- {
- return extent;
- }
-
- /**
- * Tests if the arc contains points.
- *
- * @return true if the arc has no interior
- */
- public boolean isEmpty()
- {
- return width <= 0 || height <= 0;
- }
-
- /**
- * Sets the arc to the given dimensions.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- * @param start the start angle, in degrees
- * @param extent the extent, in degrees
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public void setArc(double x, double y, double w, double h, double start,
- double extent, int type)
- {
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- this.start = start;
- this.extent = extent;
- setArcType(type);
- }
-
- /**
- * Sets the start angle of the arc.
- *
- * @param start the new start angle
- */
- public void setAngleStart(double start)
- {
- this.start = start;
- }
-
- /**
- * Sets the extent angle of the arc.
- *
- * @param extent the new extent angle
- */
- public void setAngleExtent(double extent)
- {
- this.extent = extent;
- }
-
- /**
- * Creates a tight bounding box given dimensions that more precise than
- * the bounding box of the ellipse.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- protected Rectangle2D makeBounds(double x, double y, double w, double h)
- {
- return new Rectangle2D.Double(x, y, w, h);
- }
- } // class Double
-
- /**
- * This class implements an arc in float precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- */
- public static class Float extends Arc2D
- {
- /** The x coordinate of the box bounding the ellipse of this arc. */
- public float x;
-
- /** The y coordinate of the box bounding the ellipse of this arc. */
- public float y;
-
- /** The width of the box bounding the ellipse of this arc. */
- public float width;
-
- /** The height of the box bounding the ellipse of this arc. */
- public float height;
-
- /** The start angle of this arc, in degrees. */
- public float start;
-
- /** The extent angle of this arc, in degrees. */
- public float extent;
-
- /**
- * Create a new, open arc at (0,0) with 0 extent.
- */
- public Float()
- {
- super(OPEN);
- }
-
- /**
- * Create a new arc of the given type at (0,0) with 0 extent.
- *
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public Float(int type)
- {
- super(type);
- }
-
- /**
- * Create a new arc with the given dimensions.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- * @param start the start angle, in degrees
- * @param extent the extent, in degrees
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public Float(float x, float y, float w, float h, float start,
- float extent, int type)
- {
- super(type);
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- this.start = start;
- this.extent = extent;
- }
-
- /**
- * Create a new arc with the given dimensions.
- *
- * @param r the bounding box
- * @param start the start angle, in degrees
- * @param extent the extent, in degrees
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- * @throws NullPointerException if r is null
- */
- public Float(Rectangle2D r, float start, float extent, int type)
- {
- super(type);
- x = (float) r.getX();
- y = (float) r.getY();
- width = (float) r.getWidth();
- height = (float) r.getHeight();
- this.start = start;
- this.extent = (float) extent;
- }
-
- /**
- * Return the x coordinate of the bounding box.
- *
- * @return the value of x
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Return the y coordinate of the bounding box.
- *
- * @return the value of y
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Return the width of the bounding box.
- *
- * @return the value of width
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Return the height of the bounding box.
- *
- * @return the value of height
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Return the start angle of the arc, in degrees.
- *
- * @return the value of start
- */
- public double getAngleStart()
- {
- return start;
- }
-
- /**
- * Return the extent of the arc, in degrees.
- *
- * @return the value of extent
- */
- public double getAngleExtent()
- {
- return extent;
- }
-
- /**
- * Tests if the arc contains points.
- *
- * @return true if the arc has no interior
- */
- public boolean isEmpty()
- {
- return width <= 0 || height <= 0;
- }
-
- /**
- * Sets the arc to the given dimensions.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- * @param start the start angle, in degrees
- * @param extent the extent, in degrees
- * @param type the arc type: {@link #OPEN}, {@link #CHORD}, or {@link #PIE}
- * @throws IllegalArgumentException if type is invalid
- */
- public void setArc(double x, double y, double w, double h, double start,
- double extent, int type)
- {
- this.x = (float) x;
- this.y = (float) y;
- width = (float) w;
- height = (float) h;
- this.start = (float) start;
- this.extent = (float) extent;
- setArcType(type);
- }
-
- /**
- * Sets the start angle of the arc.
- *
- * @param start the new start angle
- */
- public void setAngleStart(double start)
- {
- this.start = (float) start;
- }
-
- /**
- * Sets the extent angle of the arc.
- *
- * @param extent the new extent angle
- */
- public void setAngleExtent(double extent)
- {
- this.extent = (float) extent;
- }
-
- /**
- * Creates a tight bounding box given dimensions that more precise than
- * the bounding box of the ellipse.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- protected Rectangle2D makeBounds(double x, double y, double w, double h)
- {
- return new Rectangle2D.Float((float) x, (float) y, (float) w, (float) h);
- }
- } // class Float
-} // class Arc2D
diff --git a/libjava/java/awt/geom/Area.java b/libjava/java/awt/geom/Area.java
deleted file mode 100644
index 7a0fac43a34..00000000000
--- a/libjava/java/awt/geom/Area.java
+++ /dev/null
@@ -1,3312 +0,0 @@
-/* Area.java -- represents a shape built by constructive area geometry
- Copyright (C) 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.util.Vector;
-
-
-/**
- * The Area class represents any area for the purpose of
- * Constructive Area Geometry (CAG) manipulations. CAG manipulations
- * work as an area-wise form of boolean logic, where the basic operations are:
- *
- *
- *
- *
- *
- * Above is an illustration of the CAG operations on two ring shapes.null
not permitted).
- *
- * @throws NullPointerException if s
is null
.
- */
- public Area(Shape s)
- {
- this();
-
- Vector p = makeSegment(s);
-
- // empty path
- if (p == null)
- return;
-
- // delete empty paths
- for (int i = 0; i < p.size(); i++)
- if (((Segment) p.elementAt(i)).getSignedArea() == 0.0)
- p.remove(i--);
-
- /*
- * Resolve self intersecting paths into non-intersecting
- * solids and holes.
- * Algorithm is as follows:
- * 1: Create nodes at all self intersections
- * 2: Put all segments into a list
- * 3: Grab a segment, follow it, change direction at each node,
- * removing segments from the list in the process
- * 4: Repeat (3) until no segments remain in the list
- * 5: Remove redundant paths and sort into solids and holes
- */
- Vector paths = new Vector();
- Segment v;
-
- for (int i = 0; i < p.size(); i++)
- {
- Segment path = (Segment) p.elementAt(i);
- createNodesSelf(path);
- }
-
- if (p.size() > 1)
- {
- for (int i = 0; i < p.size() - 1; i++)
- for (int j = i + 1; j < p.size(); j++)
- {
- Segment path1 = (Segment) p.elementAt(i);
- Segment path2 = (Segment) p.elementAt(j);
- createNodes(path1, path2);
- }
- }
-
- // we have intersecting points.
- Vector segments = new Vector();
-
- for (int i = 0; i < p.size(); i++)
- {
- Segment path = v = (Segment) p.elementAt(i);
- do
- {
- segments.add(v);
- v = v.next;
- }
- while (v != path);
- }
-
- paths = weilerAtherton(segments);
- deleteRedundantPaths(paths);
- }
-
- /**
- * Performs an add (union) operation on this area with another Area.
- * @param area - the area to be unioned with this one
- */
- public void add(Area area)
- {
- if (equals(area))
- return;
- if (area.isEmpty())
- return;
-
- Area B = (Area) area.clone();
-
- Vector pathA = new Vector();
- Vector pathB = new Vector();
- pathA.addAll(solids);
- pathA.addAll(holes);
- pathB.addAll(B.solids);
- pathB.addAll(B.holes);
-
- int nNodes = 0;
-
- for (int i = 0; i < pathA.size(); i++)
- {
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
- }
-
- Vector paths = new Vector();
- Segment v;
-
- // we have intersecting points.
- Vector segments = new Vector();
-
- // In a union operation, we keep all
- // segments of A oustide B and all B outside A
- for (int i = 0; i < pathA.size(); i++)
- {
- v = (Segment) pathA.elementAt(i);
- Segment path = v;
- do
- {
- if (v.isSegmentOutside(area))
- segments.add(v);
- v = v.next;
- }
- while (v != path);
- }
-
- for (int i = 0; i < pathB.size(); i++)
- {
- v = (Segment) pathB.elementAt(i);
- Segment path = v;
- do
- {
- if (v.isSegmentOutside(this))
- segments.add(v);
- v = v.next;
- }
- while (v != path);
- }
-
- paths = weilerAtherton(segments);
- deleteRedundantPaths(paths);
- }
-
- /**
- * Performs a subtraction operation on this Area.
- * @param area the area to be subtracted from this area.
- * @throws NullPointerException if area
is null
.
- */
- public void subtract(Area area)
- {
- if (isEmpty() || area.isEmpty())
- return;
-
- if (equals(area))
- {
- reset();
- return;
- }
-
- Vector pathA = new Vector();
- Area B = (Area) area.clone();
- pathA.addAll(solids);
- pathA.addAll(holes);
-
- // reverse the directions of B paths.
- setDirection(B.holes, true);
- setDirection(B.solids, false);
-
- Vector pathB = new Vector();
- pathB.addAll(B.solids);
- pathB.addAll(B.holes);
-
- int nNodes = 0;
-
- // create nodes
- for (int i = 0; i < pathA.size(); i++)
- {
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
- }
-
- Vector paths = new Vector();
-
- // we have intersecting points.
- Vector segments = new Vector();
-
- // In a subtraction operation, we keep all
- // segments of A oustide B and all B within A
- // We outsideness-test only one segment in each path
- // and the segments before and after any node
- for (int i = 0; i < pathA.size(); i++)
- {
- Segment v = (Segment) pathA.elementAt(i);
- Segment path = v;
- if (v.isSegmentOutside(area) && v.node == null)
- segments.add(v);
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (v.isSegmentOutside(area))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
- }
-
- for (int i = 0; i < pathB.size(); i++)
- {
- Segment v = (Segment) pathB.elementAt(i);
- Segment path = v;
- if (! v.isSegmentOutside(this) && v.node == null)
- segments.add(v);
- v = v.next;
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (! v.isSegmentOutside(this))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
- }
-
- paths = weilerAtherton(segments);
- deleteRedundantPaths(paths);
- }
-
- /**
- * Performs an intersection operation on this Area.
- * @param area - the area to be intersected with this area.
- * @throws NullPointerException if area
is null
.
- */
- public void intersect(Area area)
- {
- if (isEmpty() || area.isEmpty())
- {
- reset();
- return;
- }
- if (equals(area))
- return;
-
- Vector pathA = new Vector();
- Area B = (Area) area.clone();
- pathA.addAll(solids);
- pathA.addAll(holes);
-
- Vector pathB = new Vector();
- pathB.addAll(B.solids);
- pathB.addAll(B.holes);
-
- int nNodes = 0;
-
- // create nodes
- for (int i = 0; i < pathA.size(); i++)
- {
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
- }
-
- Vector paths = new Vector();
-
- // we have intersecting points.
- Vector segments = new Vector();
-
- // In an intersection operation, we keep all
- // segments of A within B and all B within A
- // (The rest must be redundant)
- // We outsideness-test only one segment in each path
- // and the segments before and after any node
- for (int i = 0; i < pathA.size(); i++)
- {
- Segment v = (Segment) pathA.elementAt(i);
- Segment path = v;
- if (! v.isSegmentOutside(area) && v.node == null)
- segments.add(v);
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (! v.isSegmentOutside(area))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
- }
-
- for (int i = 0; i < pathB.size(); i++)
- {
- Segment v = (Segment) pathB.elementAt(i);
- Segment path = v;
- if (! v.isSegmentOutside(this) && v.node == null)
- segments.add(v);
- v = v.next;
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (! v.isSegmentOutside(this))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
- }
-
- paths = weilerAtherton(segments);
- deleteRedundantPaths(paths);
- }
-
- /**
- * Performs an exclusive-or operation on this Area.
- * @param area - the area to be XORed with this area.
- * @throws NullPointerException if area
is null
.
- */
- public void exclusiveOr(Area area)
- {
- if (area.isEmpty())
- return;
-
- if (isEmpty())
- {
- Area B = (Area) area.clone();
- solids = B.solids;
- holes = B.holes;
- return;
- }
- if (equals(area))
- {
- reset();
- return;
- }
-
- Vector pathA = new Vector();
-
- Area B = (Area) area.clone();
- Vector pathB = new Vector();
- pathA.addAll(solids);
- pathA.addAll(holes);
-
- // reverse the directions of B paths.
- setDirection(B.holes, true);
- setDirection(B.solids, false);
- pathB.addAll(B.solids);
- pathB.addAll(B.holes);
-
- int nNodes = 0;
-
- for (int i = 0; i < pathA.size(); i++)
- {
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
- }
-
- Vector paths = new Vector();
- Segment v;
-
- // we have intersecting points.
- Vector segments = new Vector();
-
- // In an XOR operation, we operate on all segments
- for (int i = 0; i < pathA.size(); i++)
- {
- v = (Segment) pathA.elementAt(i);
- Segment path = v;
- do
- {
- segments.add(v);
- v = v.next;
- }
- while (v != path);
- }
-
- for (int i = 0; i < pathB.size(); i++)
- {
- v = (Segment) pathB.elementAt(i);
- Segment path = v;
- do
- {
- segments.add(v);
- v = v.next;
- }
- while (v != path);
- }
-
- paths = weilerAtherton(segments);
- deleteRedundantPaths(paths);
- }
-
- /**
- * Clears the Area object, creating an empty area.
- */
- public void reset()
- {
- solids = new Vector();
- holes = new Vector();
- }
-
- /**
- * Returns whether this area encloses any area.
- * @return true if the object encloses any area.
- */
- public boolean isEmpty()
- {
- if (solids.size() == 0)
- return true;
-
- double totalArea = 0;
- for (int i = 0; i < solids.size(); i++)
- totalArea += Math.abs(((Segment) solids.elementAt(i)).getSignedArea());
- for (int i = 0; i < holes.size(); i++)
- totalArea -= Math.abs(((Segment) holes.elementAt(i)).getSignedArea());
- if (totalArea <= EPSILON)
- return true;
-
- return false;
- }
-
- /**
- * Determines whether the Area consists entirely of line segments
- * @return true if the Area lines-only, false otherwise
- */
- public boolean isPolygonal()
- {
- for (int i = 0; i < holes.size(); i++)
- if (! ((Segment) holes.elementAt(i)).isPolygonal())
- return false;
- for (int i = 0; i < solids.size(); i++)
- if (! ((Segment) solids.elementAt(i)).isPolygonal())
- return false;
- return true;
- }
-
- /**
- * Determines if the Area is rectangular.
- *
- *
- * null
- * permitted).
- * @return true
if the areas are equal, and false
- * otherwise.
- */
- public boolean equals(Area area)
- {
- if (area == null)
- return false;
-
- if (! getBounds2D().equals(area.getBounds2D()))
- return false;
-
- if (solids.size() != area.solids.size()
- || holes.size() != area.holes.size())
- return false;
-
- Vector pathA = new Vector();
- pathA.addAll(solids);
- pathA.addAll(holes);
- Vector pathB = new Vector();
- pathB.addAll(area.solids);
- pathB.addAll(area.holes);
-
- int nPaths = pathA.size();
- boolean[][] match = new boolean[2][nPaths];
-
- for (int i = 0; i < nPaths; i++)
- {
- for (int j = 0; j < nPaths; j++)
- {
- Segment p1 = (Segment) pathA.elementAt(i);
- Segment p2 = (Segment) pathB.elementAt(j);
- if (! match[0][i] && ! match[1][j])
- if (p1.pathEquals(p2))
- match[0][i] = match[1][j] = true;
- }
- }
-
- boolean result = true;
- for (int i = 0; i < nPaths; i++)
- result = result && match[0][i] && match[1][i];
- return result;
- }
-
- /**
- * Transforms this area by the AffineTransform at.
- *
- * @param at the transform.
- */
- public void transform(AffineTransform at)
- {
- for (int i = 0; i < solids.size(); i++)
- ((Segment) solids.elementAt(i)).transformSegmentList(at);
- for (int i = 0; i < holes.size(); i++)
- ((Segment) holes.elementAt(i)).transformSegmentList(at);
-
- // Note that the orientation is not invariant under inversion
- if ((at.getType() & AffineTransform.TYPE_FLIP) != 0)
- {
- setDirection(holes, false);
- setDirection(solids, true);
- }
- }
-
- /**
- * Returns a new Area equal to this one, transformed
- * by the AffineTransform at.
- * @param at the transform.
- * @return the transformed area
- * @throws NullPointerException if at
is null
.
- */
- public Area createTransformedArea(AffineTransform at)
- {
- Area a = (Area) clone();
- a.transform(at);
- return a;
- }
-
- /**
- * Determines if the point (x,y) is contained within this Area.
- *
- * @param x the x-coordinate of the point.
- * @param y the y-coordinate of the point.
- * @return true if the point is contained, false otherwise.
- */
- public boolean contains(double x, double y)
- {
- int n = 0;
- for (int i = 0; i < solids.size(); i++)
- if (((Segment) solids.elementAt(i)).contains(x, y))
- n++;
-
- for (int i = 0; i < holes.size(); i++)
- if (((Segment) holes.elementAt(i)).contains(x, y))
- n--;
-
- return (n != 0);
- }
-
- /**
- * Determines if the Point2D p is contained within this Area.
- *
- * @param p the point.
- * @return true
if the point is contained, false
- * otherwise.
- * @throws NullPointerException if p
is null
.
- */
- public boolean contains(Point2D p)
- {
- return contains(p.getX(), p.getY());
- }
-
- /**
- * Determines if the rectangle specified by (x,y) as the upper-left
- * and with width w and height h is completely contained within this Area,
- * returns false otherwise.true
if the rectangle is considered contained
- */
- public boolean contains(double x, double y, double w, double h)
- {
- LineSegment[] l = new LineSegment[4];
- l[0] = new LineSegment(x, y, x + w, y);
- l[1] = new LineSegment(x, y + h, x + w, y + h);
- l[2] = new LineSegment(x, y, x, y + h);
- l[3] = new LineSegment(x + w, y, x + w, y + h);
-
- // Since every segment in the area must a contour
- // between inside/outside segments, ANY intersection
- // will mean the rectangle is not entirely contained.
- for (int i = 0; i < 4; i++)
- {
- for (int path = 0; path < solids.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) solids.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return false;
- v = v.next;
- }
- while (v != start);
- }
- for (int path = 0; path < holes.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) holes.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return false;
- v = v.next;
- }
- while (v != start);
- }
- }
-
- // Is any point inside?
- if (! contains(x, y))
- return false;
-
- // Final hoop: Is the rectangle non-intersecting and inside,
- // but encloses a hole?
- Rectangle2D r = new Rectangle2D.Double(x, y, w, h);
- for (int path = 0; path < holes.size(); path++)
- if (! ((Segment) holes.elementAt(path)).isSegmentOutside(r))
- return false;
-
- return true;
- }
-
- /**
- * Determines if the Rectangle2D specified by r is completely contained
- * within this Area, returns false otherwise.true
if the rectangle is considered contained
- *
- * @throws NullPointerException if r
is null
.
- */
- public boolean contains(Rectangle2D r)
- {
- return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Determines if the rectangle specified by (x,y) as the upper-left
- * and with width w and height h intersects any part of this Area.
- *
- * @param x the x-coordinate for the rectangle.
- * @param y the y-coordinate for the rectangle.
- * @param w the width of the rectangle.
- * @param h the height of the rectangle.
- * @return true
if the rectangle intersects the area,
- * false
otherwise.
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- if (solids.size() == 0)
- return false;
-
- LineSegment[] l = new LineSegment[4];
- l[0] = new LineSegment(x, y, x + w, y);
- l[1] = new LineSegment(x, y + h, x + w, y + h);
- l[2] = new LineSegment(x, y, x, y + h);
- l[3] = new LineSegment(x + w, y, x + w, y + h);
-
- // Return true on any intersection
- for (int i = 0; i < 4; i++)
- {
- for (int path = 0; path < solids.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) solids.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return true;
- v = v.next;
- }
- while (v != start);
- }
- for (int path = 0; path < holes.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) holes.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return true;
- v = v.next;
- }
- while (v != start);
- }
- }
-
- // Non-intersecting, Is any point inside?
- if (contains(x + w * 0.5, y + h * 0.5))
- return true;
-
- // What if the rectangle encloses the whole shape?
- Point2D p = ((Segment) solids.elementAt(0)).getMidPoint();
- if ((new Rectangle2D.Double(x, y, w, h)).contains(p))
- return true;
- return false;
- }
-
- /**
- * Determines if the Rectangle2D specified by r intersects any
- * part of this Area.
- * @param r the rectangle to test intersection with (null
- * not permitted).
- * @return true
if the rectangle intersects the area,
- * false
otherwise.
- * @throws NullPointerException if r
is null
.
- */
- public boolean intersects(Rectangle2D r)
- {
- return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Returns a PathIterator object defining the contour of this Area,
- * transformed by at.
- *
- * @param at the transform.
- * @return A path iterator.
- */
- public PathIterator getPathIterator(AffineTransform at)
- {
- return (new AreaIterator(at));
- }
-
- /**
- * Returns a flattened PathIterator object defining the contour of this
- * Area, transformed by at and with a defined flatness.
- *
- * @param at the transform.
- * @param flatness the flatness.
- * @return A path iterator.
- */
- public PathIterator getPathIterator(AffineTransform at, double flatness)
- {
- return new FlatteningPathIterator(getPathIterator(at), flatness);
- }
-
- //---------------------------------------------------------------------
- // Non-public methods and classes
-
- /**
- * Private pathiterator object.
- */
- private class AreaIterator implements PathIterator
- {
- private Vector segments;
- private int index;
- private AffineTransform at;
-
- // Simple compound type for segments
- class IteratorSegment
- {
- int type;
- double[] coords;
-
- IteratorSegment()
- {
- coords = new double[6];
- }
- }
-
- /**
- * The contructor here does most of the work,
- * creates a vector of IteratorSegments, which can
- * readily be returned
- */
- public AreaIterator(AffineTransform at)
- {
- this.at = at;
- index = 0;
- segments = new Vector();
- Vector allpaths = new Vector();
- allpaths.addAll(solids);
- allpaths.addAll(holes);
-
- for (int i = 0; i < allpaths.size(); i++)
- {
- Segment v = (Segment) allpaths.elementAt(i);
- Segment start = v;
-
- IteratorSegment is = new IteratorSegment();
- is.type = SEG_MOVETO;
- is.coords[0] = start.P1.getX();
- is.coords[1] = start.P1.getY();
- segments.add(is);
-
- do
- {
- is = new IteratorSegment();
- is.type = v.pathIteratorFormat(is.coords);
- segments.add(is);
- v = v.next;
- }
- while (v != start);
-
- is = new IteratorSegment();
- is.type = SEG_CLOSE;
- segments.add(is);
- }
- }
-
- public int currentSegment(double[] coords)
- {
- IteratorSegment s = (IteratorSegment) segments.elementAt(index);
- if (at != null)
- at.transform(s.coords, 0, coords, 0, 3);
- else
- for (int i = 0; i < 6; i++)
- coords[i] = s.coords[i];
- return (s.type);
- }
-
- public int currentSegment(float[] coords)
- {
- IteratorSegment s = (IteratorSegment) segments.elementAt(index);
- double[] d = new double[6];
- if (at != null)
- {
- at.transform(s.coords, 0, d, 0, 3);
- for (int i = 0; i < 6; i++)
- coords[i] = (float) d[i];
- }
- else
- for (int i = 0; i < 6; i++)
- coords[i] = (float) s.coords[i];
- return (s.type);
- }
-
- // Note that the winding rule should not matter here,
- // EVEN_ODD is chosen because it renders faster.
- public int getWindingRule()
- {
- return (PathIterator.WIND_EVEN_ODD);
- }
-
- public boolean isDone()
- {
- return (index >= segments.size());
- }
-
- public void next()
- {
- index++;
- }
- }
-
- /**
- * Performs the fundamental task of the Weiler-Atherton algorithm,
- * traverse a list of segments, for each segment:
- * Follow it, removing segments from the list and switching paths
- * at each node. Do so until the starting segment is reached.
- *
- * Returns a Vector of the resulting paths.
- */
- private Vector weilerAtherton(Vector segments)
- {
- Vector paths = new Vector();
- while (segments.size() > 0)
- {
- // Iterate over the path
- Segment start = (Segment) segments.elementAt(0);
- Segment s = start;
- do
- {
- segments.remove(s);
- if (s.node != null)
- { // switch over
- s.next = s.node;
- s.node = null;
- }
- s = s.next; // continue
- }
- while (s != start);
-
- paths.add(start);
- }
- return paths;
- }
-
- /**
- * A small wrapper class to store intersection points
- */
- private class Intersection
- {
- Point2D p; // the 2D point of intersection
- double ta; // the parametric value on a
- double tb; // the parametric value on b
- Segment seg; // segment placeholder for node setting
-
- public Intersection(Point2D p, double ta, double tb)
- {
- this.p = p;
- this.ta = ta;
- this.tb = tb;
- }
- }
-
- /**
- * Returns the recursion depth necessary to approximate the
- * curve by line segments within the error RS_EPSILON.
- *
- * This is done with Wang's formula:
- * L0 = max{0<=i<=N-2}(|xi - 2xi+1 + xi+2|,|yi - 2yi+1 + yi+2|)
- * r0 = log4(sqrt(2)*N*(N-1)*L0/8e)
- * Where e is the maximum distance error (RS_EPSILON)
- */
- private int getRecursionDepth(CubicSegment curve)
- {
- double x0 = curve.P1.getX();
- double y0 = curve.P1.getY();
-
- double x1 = curve.cp1.getX();
- double y1 = curve.cp1.getY();
-
- double x2 = curve.cp2.getX();
- double y2 = curve.cp2.getY();
-
- double x3 = curve.P2.getX();
- double y3 = curve.P2.getY();
-
- double L0 = Math.max(Math.max(Math.abs(x0 - 2 * x1 + x2),
- Math.abs(x1 - 2 * x2 + x3)),
- Math.max(Math.abs(y0 - 2 * y1 + y2),
- Math.abs(y1 - 2 * y2 + y3)));
-
- double f = Math.sqrt(2) * 6.0 * L0 / (8.0 * RS_EPSILON);
-
- int r0 = (int) Math.ceil(Math.log(f) / Math.log(4.0));
- return (r0);
- }
-
- /**
- * Performs recursive subdivision:
- * @param c1 - curve 1
- * @param c2 - curve 2
- * @param depth1 - recursion depth of curve 1
- * @param depth2 - recursion depth of curve 2
- * @param t1 - global parametric value of the first curve's starting point
- * @param t2 - global parametric value of the second curve's starting point
- * @param w1 - global parametric length of curve 1
- * @param c1 - global parametric length of curve 2
- *
- * The final four parameters are for keeping track of the parametric
- * value of the curve. For a full curve t = 0, w = 1, w is halved with
- * each subdivision.
- */
- private void recursiveSubdivide(CubicCurve2D c1, CubicCurve2D c2,
- int depth1, int depth2, double t1,
- double t2, double w1, double w2)
- {
- boolean flat1 = depth1 <= 0;
- boolean flat2 = depth2 <= 0;
-
- if (flat1 && flat2)
- {
- double xlk = c1.getP2().getX() - c1.getP1().getX();
- double ylk = c1.getP2().getY() - c1.getP1().getY();
-
- double xnm = c2.getP2().getX() - c2.getP1().getX();
- double ynm = c2.getP2().getY() - c2.getP1().getY();
-
- double xmk = c2.getP1().getX() - c1.getP1().getX();
- double ymk = c2.getP1().getY() - c1.getP1().getY();
- double det = xnm * ylk - ynm * xlk;
-
- if (det + 1.0 == 1.0)
- return;
-
- double detinv = 1.0 / det;
- double s = (xnm * ymk - ynm * xmk) * detinv;
- double t = (xlk * ymk - ylk * xmk) * detinv;
- if ((s < 0.0) || (s > 1.0) || (t < 0.0) || (t > 1.0))
- return;
-
- double[] temp = new double[2];
- temp[0] = t1 + s * w1;
- temp[1] = t2 + t * w1;
- cc_intersections.add(temp);
- return;
- }
-
- CubicCurve2D.Double c11 = new CubicCurve2D.Double();
- CubicCurve2D.Double c12 = new CubicCurve2D.Double();
- CubicCurve2D.Double c21 = new CubicCurve2D.Double();
- CubicCurve2D.Double c22 = new CubicCurve2D.Double();
-
- if (! flat1 && ! flat2)
- {
- depth1--;
- depth2--;
- w1 = w1 * 0.5;
- w2 = w2 * 0.5;
- c1.subdivide(c11, c12);
- c2.subdivide(c21, c22);
- if (c11.getBounds2D().intersects(c21.getBounds2D()))
- recursiveSubdivide(c11, c21, depth1, depth2, t1, t2, w1, w2);
- if (c11.getBounds2D().intersects(c22.getBounds2D()))
- recursiveSubdivide(c11, c22, depth1, depth2, t1, t2 + w2, w1, w2);
- if (c12.getBounds2D().intersects(c21.getBounds2D()))
- recursiveSubdivide(c12, c21, depth1, depth2, t1 + w1, t2, w1, w2);
- if (c12.getBounds2D().intersects(c22.getBounds2D()))
- recursiveSubdivide(c12, c22, depth1, depth2, t1 + w1, t2 + w2, w1, w2);
- return;
- }
-
- if (! flat1)
- {
- depth1--;
- c1.subdivide(c11, c12);
- w1 = w1 * 0.5;
- if (c11.getBounds2D().intersects(c2.getBounds2D()))
- recursiveSubdivide(c11, c2, depth1, depth2, t1, t2, w1, w2);
- if (c12.getBounds2D().intersects(c2.getBounds2D()))
- recursiveSubdivide(c12, c2, depth1, depth2, t1 + w1, t2, w1, w2);
- return;
- }
-
- depth2--;
- c2.subdivide(c21, c22);
- w2 = w2 * 0.5;
- if (c1.getBounds2D().intersects(c21.getBounds2D()))
- recursiveSubdivide(c1, c21, depth1, depth2, t1, t2, w1, w2);
- if (c1.getBounds2D().intersects(c22.getBounds2D()))
- recursiveSubdivide(c1, c22, depth1, depth2, t1, t2 + w2, w1, w2);
- }
-
- /**
- * Returns a set of interesections between two Cubic segments
- * Or null if no intersections were found.
- *
- * The method used to find the intersection is recursive midpoint
- * subdivision. Outline description:
- *
- * 1) Check if the bounding boxes of the curves intersect,
- * 2) If so, divide the curves in the middle and test the bounding
- * boxes again,
- * 3) Repeat until a maximum recursion depth has been reached, where
- * the intersecting curves can be approximated by line segments.
- *
- * This is a reasonably accurate method, although the recursion depth
- * is typically around 20, the bounding-box tests allow for significant
- * pruning of the subdivision tree.
- *
- * This is package-private to avoid an accessor method.
- */
- Intersection[] cubicCubicIntersect(CubicSegment curve1, CubicSegment curve2)
- {
- Rectangle2D r1 = curve1.getBounds();
- Rectangle2D r2 = curve2.getBounds();
-
- if (! r1.intersects(r2))
- return null;
-
- cc_intersections = new Vector();
- recursiveSubdivide(curve1.getCubicCurve2D(), curve2.getCubicCurve2D(),
- getRecursionDepth(curve1), getRecursionDepth(curve2),
- 0.0, 0.0, 1.0, 1.0);
-
- if (cc_intersections.size() == 0)
- return null;
-
- Intersection[] results = new Intersection[cc_intersections.size()];
- for (int i = 0; i < cc_intersections.size(); i++)
- {
- double[] temp = (double[]) cc_intersections.elementAt(i);
- results[i] = new Intersection(curve1.evaluatePoint(temp[0]), temp[0],
- temp[1]);
- }
- cc_intersections = null;
- return (results);
- }
-
- /**
- * Returns the intersections between a line and a quadratic bezier
- * Or null if no intersections are found1
- * This is done through combining the line's equation with the
- * parametric form of the Bezier and solving the resulting quadratic.
- * This is package-private to avoid an accessor method.
- */
- Intersection[] lineQuadIntersect(LineSegment l, QuadSegment c)
- {
- double[] y = new double[3];
- double[] x = new double[3];
- double[] r = new double[3];
- int nRoots;
- double x0 = c.P1.getX();
- double y0 = c.P1.getY();
- double x1 = c.cp.getX();
- double y1 = c.cp.getY();
- double x2 = c.P2.getX();
- double y2 = c.P2.getY();
-
- double lx0 = l.P1.getX();
- double ly0 = l.P1.getY();
- double lx1 = l.P2.getX();
- double ly1 = l.P2.getY();
- double dx = lx1 - lx0;
- double dy = ly1 - ly0;
-
- // form r(t) = y(t) - x(t) for the bezier
- y[0] = y0;
- y[1] = 2 * (y1 - y0);
- y[2] = (y2 - 2 * y1 + y0);
-
- x[0] = x0;
- x[1] = 2 * (x1 - x0);
- x[2] = (x2 - 2 * x1 + x0);
-
- // a point, not a line
- if (dy == 0 && dx == 0)
- return null;
-
- // line on y axis
- if (dx == 0 || (dy / dx) > 1.0)
- {
- double k = dx / dy;
- x[0] -= lx0;
- y[0] -= ly0;
- y[0] *= k;
- y[1] *= k;
- y[2] *= k;
- }
- else
- {
- double k = dy / dx;
- x[0] -= lx0;
- y[0] -= ly0;
- x[0] *= k;
- x[1] *= k;
- x[2] *= k;
- }
-
- for (int i = 0; i < 3; i++)
- r[i] = y[i] - x[i];
-
- if ((nRoots = QuadCurve2D.solveQuadratic(r)) > 0)
- {
- Intersection[] temp = new Intersection[nRoots];
- int intersections = 0;
- for (int i = 0; i < nRoots; i++)
- {
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- Point2D p = c.evaluatePoint(t);
-
- // if the line is on an axis, snap the point to that axis.
- if (dx == 0)
- p.setLocation(lx0, p.getY());
- if (dy == 0)
- p.setLocation(p.getX(), ly0);
-
- if (p.getX() <= Math.max(lx0, lx1)
- && p.getX() >= Math.min(lx0, lx1)
- && p.getY() <= Math.max(ly0, ly1)
- && p.getY() >= Math.min(ly0, ly1))
- {
- double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
- temp[i] = new Intersection(p, lineparameter, t);
- intersections++;
- }
- }
- else
- temp[i] = null;
- }
- if (intersections == 0)
- return null;
-
- Intersection[] rValues = new Intersection[intersections];
-
- for (int i = 0; i < nRoots; i++)
- if (temp[i] != null)
- rValues[--intersections] = temp[i];
- return (rValues);
- }
- return null;
- }
-
- /**
- * Returns the intersections between a line and a cubic segment
- * This is done through combining the line's equation with the
- * parametric form of the Bezier and solving the resulting quadratic.
- * This is package-private to avoid an accessor method.
- */
- Intersection[] lineCubicIntersect(LineSegment l, CubicSegment c)
- {
- double[] y = new double[4];
- double[] x = new double[4];
- double[] r = new double[4];
- int nRoots;
- double x0 = c.P1.getX();
- double y0 = c.P1.getY();
- double x1 = c.cp1.getX();
- double y1 = c.cp1.getY();
- double x2 = c.cp2.getX();
- double y2 = c.cp2.getY();
- double x3 = c.P2.getX();
- double y3 = c.P2.getY();
-
- double lx0 = l.P1.getX();
- double ly0 = l.P1.getY();
- double lx1 = l.P2.getX();
- double ly1 = l.P2.getY();
- double dx = lx1 - lx0;
- double dy = ly1 - ly0;
-
- // form r(t) = y(t) - x(t) for the bezier
- y[0] = y0;
- y[1] = 3 * (y1 - y0);
- y[2] = 3 * (y2 + y0 - 2 * y1);
- y[3] = y3 - 3 * y2 + 3 * y1 - y0;
-
- x[0] = x0;
- x[1] = 3 * (x1 - x0);
- x[2] = 3 * (x2 + x0 - 2 * x1);
- x[3] = x3 - 3 * x2 + 3 * x1 - x0;
-
- // a point, not a line
- if (dy == 0 && dx == 0)
- return null;
-
- // line on y axis
- if (dx == 0 || (dy / dx) > 1.0)
- {
- double k = dx / dy;
- x[0] -= lx0;
- y[0] -= ly0;
- y[0] *= k;
- y[1] *= k;
- y[2] *= k;
- y[3] *= k;
- }
- else
- {
- double k = dy / dx;
- x[0] -= lx0;
- y[0] -= ly0;
- x[0] *= k;
- x[1] *= k;
- x[2] *= k;
- x[3] *= k;
- }
- for (int i = 0; i < 4; i++)
- r[i] = y[i] - x[i];
-
- if ((nRoots = CubicCurve2D.solveCubic(r)) > 0)
- {
- Intersection[] temp = new Intersection[nRoots];
- int intersections = 0;
- for (int i = 0; i < nRoots; i++)
- {
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- // if the line is on an axis, snap the point to that axis.
- Point2D p = c.evaluatePoint(t);
- if (dx == 0)
- p.setLocation(lx0, p.getY());
- if (dy == 0)
- p.setLocation(p.getX(), ly0);
-
- if (p.getX() <= Math.max(lx0, lx1)
- && p.getX() >= Math.min(lx0, lx1)
- && p.getY() <= Math.max(ly0, ly1)
- && p.getY() >= Math.min(ly0, ly1))
- {
- double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
- temp[i] = new Intersection(p, lineparameter, t);
- intersections++;
- }
- }
- else
- temp[i] = null;
- }
-
- if (intersections == 0)
- return null;
-
- Intersection[] rValues = new Intersection[intersections];
- for (int i = 0; i < nRoots; i++)
- if (temp[i] != null)
- rValues[--intersections] = temp[i];
- return (rValues);
- }
- return null;
- }
-
- /**
- * Returns the intersection between two lines, or null if there is no
- * intersection.
- * This is package-private to avoid an accessor method.
- */
- Intersection linesIntersect(LineSegment a, LineSegment b)
- {
- Point2D P1 = a.P1;
- Point2D P2 = a.P2;
- Point2D P3 = b.P1;
- Point2D P4 = b.P2;
-
- if (! Line2D.linesIntersect(P1.getX(), P1.getY(), P2.getX(), P2.getY(),
- P3.getX(), P3.getY(), P4.getX(), P4.getY()))
- return null;
-
- double x1 = P1.getX();
- double y1 = P1.getY();
- double rx = P2.getX() - x1;
- double ry = P2.getY() - y1;
-
- double x2 = P3.getX();
- double y2 = P3.getY();
- double sx = P4.getX() - x2;
- double sy = P4.getY() - y2;
-
- double determinant = sx * ry - sy * rx;
- double nom = (sx * (y2 - y1) + sy * (x1 - x2));
-
- // Parallel lines don't intersect. At least we pretend they don't.
- if (Math.abs(determinant) < EPSILON)
- return null;
-
- nom = nom / determinant;
-
- if (nom == 0.0)
- return null;
- if (nom == 1.0)
- return null;
-
- Point2D p = new Point2D.Double(x1 + nom * rx, y1 + nom * ry);
-
- return new Intersection(p, p.distance(P1) / P1.distance(P2),
- p.distance(P3) / P3.distance(P4));
- }
-
- /**
- * Determines if two points are equal, within an error margin
- * 'snap distance'
- * This is package-private to avoid an accessor method.
- */
- boolean pointEquals(Point2D a, Point2D b)
- {
- return (a.equals(b) || a.distance(b) < PE_EPSILON);
- }
-
- /**
- * Helper method
- * Turns a shape into a Vector of Segments
- */
- private Vector makeSegment(Shape s)
- {
- Vector paths = new Vector();
- PathIterator pi = s.getPathIterator(null);
- double[] coords = new double[6];
- Segment subpath = null;
- Segment current = null;
- double cx;
- double cy;
- double subpathx;
- double subpathy;
- cx = cy = subpathx = subpathy = 0.0;
-
- this.windingRule = pi.getWindingRule();
-
- while (! pi.isDone())
- {
- Segment v;
- switch (pi.currentSegment(coords))
- {
- case PathIterator.SEG_MOVETO:
- if (subpath != null)
- { // close existing open path
- current.next = new LineSegment(cx, cy, subpathx, subpathy);
- current = current.next;
- current.next = subpath;
- }
- subpath = null;
- subpathx = cx = coords[0];
- subpathy = cy = coords[1];
- break;
-
- // replace 'close' with a line-to.
- case PathIterator.SEG_CLOSE:
- if (subpath != null && (subpathx != cx || subpathy != cy))
- {
- current.next = new LineSegment(cx, cy, subpathx, subpathy);
- current = current.next;
- current.next = subpath;
- cx = subpathx;
- cy = subpathy;
- subpath = null;
- }
- else if (subpath != null)
- {
- current.next = subpath;
- subpath = null;
- }
- break;
- case PathIterator.SEG_LINETO:
- if (cx != coords[0] || cy != coords[1])
- {
- v = new LineSegment(cx, cy, coords[0], coords[1]);
- if (subpath == null)
- {
- subpath = current = v;
- paths.add(subpath);
- }
- else
- {
- current.next = v;
- current = current.next;
- }
- cx = coords[0];
- cy = coords[1];
- }
- break;
- case PathIterator.SEG_QUADTO:
- v = new QuadSegment(cx, cy, coords[0], coords[1], coords[2],
- coords[3]);
- if (subpath == null)
- {
- subpath = current = v;
- paths.add(subpath);
- }
- else
- {
- current.next = v;
- current = current.next;
- }
- cx = coords[2];
- cy = coords[3];
- break;
- case PathIterator.SEG_CUBICTO:
- v = new CubicSegment(cx, cy, coords[0], coords[1], coords[2],
- coords[3], coords[4], coords[5]);
- if (subpath == null)
- {
- subpath = current = v;
- paths.add(subpath);
- }
- else
- {
- current.next = v;
- current = current.next;
- }
-
- // check if the cubic is self-intersecting
- double[] lpts = ((CubicSegment) v).getLoop();
- if (lpts != null)
- {
- // if it is, break off the loop into its own path.
- v.subdivideInsert(lpts[0]);
- v.next.subdivideInsert((lpts[1] - lpts[0]) / (1.0 - lpts[0]));
-
- CubicSegment loop = (CubicSegment) v.next;
- v.next = loop.next;
- loop.next = loop;
-
- v.P2 = v.next.P1 = loop.P2 = loop.P1; // snap points
- paths.add(loop);
- current = v.next;
- }
-
- cx = coords[4];
- cy = coords[5];
- break;
- }
- pi.next();
- }
-
- if (subpath != null)
- { // close any open path
- if (subpathx != cx || subpathy != cy)
- {
- current.next = new LineSegment(cx, cy, subpathx, subpathy);
- current = current.next;
- current.next = subpath;
- }
- else
- current.next = subpath;
- }
-
- if (paths.size() == 0)
- return (null);
-
- return (paths);
- }
-
- /**
- * Find the intersections of two separate closed paths,
- * A and B, split the segments at the intersection points,
- * and create nodes pointing from one to the other
- */
- private int createNodes(Segment A, Segment B)
- {
- int nNodes = 0;
-
- Segment a = A;
- Segment b = B;
-
- do
- {
- do
- {
- nNodes += a.splitIntersections(b);
- b = b.next;
- }
- while (b != B);
-
- a = a.next; // move to the next segment
- }
- while (a != A); // until one wrap.
-
- return (nNodes);
- }
-
- /**
- * Find the intersections of a path with itself.
- * Splits the segments at the intersection points,
- * and create nodes pointing from one to the other.
- */
- private int createNodesSelf(Segment A)
- {
- int nNodes = 0;
- Segment a = A;
-
- if (A.next == A)
- return 0;
-
- do
- {
- Segment b = a.next;
- do
- {
- if (b != a) // necessary
- nNodes += a.splitIntersections(b);
- b = b.next;
- }
- while (b != A);
- a = a.next; // move to the next segment
- }
- while (a != A); // until one wrap.
-
- return (nNodes);
- }
-
- /**
- * Deletes paths which are redundant from a list, (i.e. solid areas within
- * solid areas) Clears any nodes. Sorts the remaining paths into solids
- * and holes, sets their orientation and sets the solids and holes lists.
- */
- private void deleteRedundantPaths(Vector paths)
- {
- int npaths = paths.size();
-
- int[][] contains = new int[npaths][npaths];
- int[][] windingNumbers = new int[npaths][2];
- int neg;
- Rectangle2D[] bb = new Rectangle2D[npaths]; // path bounding boxes
-
- neg = ((windingRule == PathIterator.WIND_NON_ZERO) ? -1 : 1);
-
- for (int i = 0; i < npaths; i++)
- bb[i] = ((Segment) paths.elementAt(i)).getPathBounds();
-
- // Find which path contains which, assign winding numbers
- for (int i = 0; i < npaths; i++)
- {
- Segment pathA = (Segment) paths.elementAt(i);
- pathA.nullNodes(); // remove any now-redundant nodes, in case.
- int windingA = pathA.hasClockwiseOrientation() ? 1 : neg;
-
- for (int j = 0; j < npaths; j++)
- if (i != j)
- {
- Segment pathB = (Segment) paths.elementAt(j);
-
- // A contains B
- if (bb[i].intersects(bb[j]))
- {
- Segment s = pathB.next;
- while (s.P1.getY() == s.P2.getY() && s != pathB)
- s = s.next;
- Point2D p = s.getMidPoint();
- if (pathA.contains(p.getX(), p.getY()))
- contains[i][j] = windingA;
- }
- else
- // A does not contain B
- contains[i][j] = 0;
- }
- else
- contains[i][j] = windingA; // i == j
- }
-
- for (int i = 0; i < npaths; i++)
- {
- windingNumbers[i][0] = 0;
- for (int j = 0; j < npaths; j++)
- windingNumbers[i][0] += contains[j][i];
- windingNumbers[i][1] = contains[i][i];
- }
-
- Vector solids = new Vector();
- Vector holes = new Vector();
-
- if (windingRule == PathIterator.WIND_NON_ZERO)
- {
- for (int i = 0; i < npaths; i++)
- {
- if (windingNumbers[i][0] == 0)
- holes.add(paths.elementAt(i));
- else if (windingNumbers[i][0] - windingNumbers[i][1] == 0
- && Math.abs(windingNumbers[i][0]) == 1)
- solids.add(paths.elementAt(i));
- }
- }
- else
- {
- windingRule = PathIterator.WIND_NON_ZERO;
- for (int i = 0; i < npaths; i++)
- {
- if ((windingNumbers[i][0] & 1) == 0)
- holes.add(paths.elementAt(i));
- else if ((windingNumbers[i][0] & 1) == 1)
- solids.add(paths.elementAt(i));
- }
- }
-
- setDirection(holes, false);
- setDirection(solids, true);
- this.holes = holes;
- this.solids = solids;
- }
-
- /**
- * Sets the winding direction of a Vector of paths
- * @param clockwise gives the direction,
- * true = clockwise, false = counter-clockwise
- */
- private void setDirection(Vector paths, boolean clockwise)
- {
- Segment v;
- for (int i = 0; i < paths.size(); i++)
- {
- v = (Segment) paths.elementAt(i);
- if (clockwise != v.hasClockwiseOrientation())
- v.reverseAll();
- }
- }
-
- /**
- * Class representing a linked-list of vertices forming a closed polygon,
- * convex or concave, without holes.
- */
- private abstract class Segment implements Cloneable
- {
- // segment type, PathIterator segment types are used.
- Point2D P1;
- Point2D P2;
- Segment next;
- Segment node;
-
- Segment()
- {
- P1 = P2 = null;
- node = next = null;
- }
-
- /**
- * Reverses the direction of a single segment
- */
- abstract void reverseCoords();
-
- /**
- * Returns the segment's midpoint
- */
- abstract Point2D getMidPoint();
-
- /**
- * Returns the bounding box of this segment
- */
- abstract Rectangle2D getBounds();
-
- /**
- * Transforms a single segment
- */
- abstract void transform(AffineTransform at);
-
- /**
- * Returns the PathIterator type of a segment
- */
- abstract int getType();
-
- /**
- */
- abstract int splitIntersections(Segment b);
-
- /**
- * Returns the PathIterator coords of a segment
- */
- abstract int pathIteratorFormat(double[] coords);
-
- /**
- * Returns the number of intersections on the positive X axis,
- * with the origin at (x,y), used for contains()-testing
- *
- * (Although that could be done by the line-intersect methods,
- * a dedicated method is better to guarantee consitent handling
- * of endpoint-special-cases)
- */
- abstract int rayCrossing(double x, double y);
-
- /**
- * Subdivides the segment at parametric value t, inserting
- * the new segment into the linked list after this,
- * such that this becomes [0,t] and this.next becomes [t,1]
- */
- abstract void subdivideInsert(double t);
-
- /**
- * Returns twice the area of a curve, relative the P1-P2 line
- * Used for area calculations.
- */
- abstract double curveArea();
-
- /**
- * Compare two segments.
- */
- abstract boolean equals(Segment b);
-
- /**
- * Determines if this path of segments contains the point (x,y)
- */
- boolean contains(double x, double y)
- {
- Segment v = this;
- int crossings = 0;
- do
- {
- int n = v.rayCrossing(x, y);
- crossings += n;
- v = v.next;
- }
- while (v != this);
- return ((crossings & 1) == 1);
- }
-
- /**
- * Nulls all nodes of the path. Clean up any 'hairs'.
- */
- void nullNodes()
- {
- Segment v = this;
- do
- {
- v.node = null;
- v = v.next;
- }
- while (v != this);
- }
-
- /**
- * Transforms each segment in the closed path
- */
- void transformSegmentList(AffineTransform at)
- {
- Segment v = this;
- do
- {
- v.transform(at);
- v = v.next;
- }
- while (v != this);
- }
-
- /**
- * Determines the winding direction of the path
- * By the sign of the area.
- */
- boolean hasClockwiseOrientation()
- {
- return (getSignedArea() > 0.0);
- }
-
- /**
- * Returns the bounds of this path
- */
- public Rectangle2D getPathBounds()
- {
- double xmin;
- double xmax;
- double ymin;
- double ymax;
- xmin = xmax = P1.getX();
- ymin = ymax = P1.getY();
-
- Segment v = this;
- do
- {
- Rectangle2D r = v.getBounds();
- xmin = Math.min(r.getMinX(), xmin);
- ymin = Math.min(r.getMinY(), ymin);
- xmax = Math.max(r.getMaxX(), xmax);
- ymax = Math.max(r.getMaxY(), ymax);
- v = v.next;
- }
- while (v != this);
-
- return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
- }
-
- /**
- * Calculates twice the signed area of the path;
- */
- double getSignedArea()
- {
- Segment s;
- double area = 0.0;
-
- s = this;
- do
- {
- area += s.curveArea();
-
- area += s.P1.getX() * s.next.P1.getY()
- - s.P1.getY() * s.next.P1.getX();
- s = s.next;
- }
- while (s != this);
-
- return area;
- }
-
- /**
- * Reverses the orientation of the whole polygon
- */
- void reverseAll()
- {
- reverseCoords();
- Segment v = next;
- Segment former = this;
- while (v != this)
- {
- v.reverseCoords();
- Segment vnext = v.next;
- v.next = former;
- former = v;
- v = vnext;
- }
- next = former;
- }
-
- /**
- * Inserts a Segment after this one
- */
- void insert(Segment v)
- {
- Segment n = next;
- next = v;
- v.next = n;
- }
-
- /**
- * Returns if this segment path is polygonal
- */
- boolean isPolygonal()
- {
- Segment v = this;
- do
- {
- if (! (v instanceof LineSegment))
- return false;
- v = v.next;
- }
- while (v != this);
- return true;
- }
-
- /**
- * Clones this path
- */
- Segment cloneSegmentList() throws CloneNotSupportedException
- {
- Vector list = new Vector();
- Segment v = next;
-
- while (v != this)
- {
- list.add(v);
- v = v.next;
- }
-
- Segment clone = (Segment) this.clone();
- v = clone;
- for (int i = 0; i < list.size(); i++)
- {
- clone.next = (Segment) ((Segment) list.elementAt(i)).clone();
- clone = clone.next;
- }
- clone.next = v;
- return v;
- }
-
- /**
- * Creates a node between this segment and segment b
- * at the given intersection
- * @return the number of nodes created (0 or 1)
- */
- int createNode(Segment b, Intersection i)
- {
- Point2D p = i.p;
- if ((pointEquals(P1, p) || pointEquals(P2, p))
- && (pointEquals(b.P1, p) || pointEquals(b.P2, p)))
- return 0;
-
- subdivideInsert(i.ta);
- b.subdivideInsert(i.tb);
-
- // snap points
- b.P2 = b.next.P1 = P2 = next.P1 = i.p;
-
- node = b.next;
- b.node = next;
- return 1;
- }
-
- /**
- * Creates multiple nodes from a list of intersections,
- * This must be done in the order of ascending parameters,
- * and the parameters must be recalculated in accordance
- * with each split.
- * @return the number of nodes created
- */
- protected int createNodes(Segment b, Intersection[] x)
- {
- Vector v = new Vector();
- for (int i = 0; i < x.length; i++)
- {
- Point2D p = x[i].p;
- if (! ((pointEquals(P1, p) || pointEquals(P2, p))
- && (pointEquals(b.P1, p) || pointEquals(b.P2, p))))
- v.add(x[i]);
- }
-
- int nNodes = v.size();
- Intersection[] A = new Intersection[nNodes];
- Intersection[] B = new Intersection[nNodes];
- for (int i = 0; i < nNodes; i++)
- A[i] = B[i] = (Intersection) v.elementAt(i);
-
- // Create two lists sorted by the parameter
- // Bubble sort, OK I suppose, since the number of intersections
- // cannot be larger than 9 (cubic-cubic worst case) anyway
- for (int i = 0; i < nNodes - 1; i++)
- {
- for (int j = i + 1; j < nNodes; j++)
- {
- if (A[i].ta > A[j].ta)
- {
- Intersection swap = A[i];
- A[i] = A[j];
- A[j] = swap;
- }
- if (B[i].tb > B[j].tb)
- {
- Intersection swap = B[i];
- B[i] = B[j];
- B[j] = swap;
- }
- }
- }
- // subdivide a
- Segment s = this;
- for (int i = 0; i < nNodes; i++)
- {
- s.subdivideInsert(A[i].ta);
-
- // renormalize the parameters
- for (int j = i + 1; j < nNodes; j++)
- A[j].ta = (A[j].ta - A[i].ta) / (1.0 - A[i].ta);
-
- A[i].seg = s;
- s = s.next;
- }
-
- // subdivide b, set nodes
- s = b;
- for (int i = 0; i < nNodes; i++)
- {
- s.subdivideInsert(B[i].tb);
-
- for (int j = i + 1; j < nNodes; j++)
- B[j].tb = (B[j].tb - B[i].tb) / (1.0 - B[i].tb);
-
- // set nodes
- B[i].seg.node = s.next; // node a -> b
- s.node = B[i].seg.next; // node b -> a
-
- // snap points
- B[i].seg.P2 = B[i].seg.next.P1 = s.P2 = s.next.P1 = B[i].p;
- s = s.next;
- }
- return nNodes;
- }
-
- /**
- * Determines if two paths are equal.
- * Colinear line segments are ignored in the comparison.
- */
- boolean pathEquals(Segment B)
- {
- if (! getPathBounds().equals(B.getPathBounds()))
- return false;
-
- Segment startA = getTopLeft();
- Segment startB = B.getTopLeft();
- Segment a = startA;
- Segment b = startB;
- do
- {
- if (! a.equals(b))
- return false;
-
- if (a instanceof LineSegment)
- a = ((LineSegment) a).lastCoLinear();
- if (b instanceof LineSegment)
- b = ((LineSegment) b).lastCoLinear();
-
- a = a.next;
- b = b.next;
- }
- while (a != startA && b != startB);
- return true;
- }
-
- /**
- * Return the segment with the top-leftmost first point
- */
- Segment getTopLeft()
- {
- Segment v = this;
- Segment tl = this;
- do
- {
- if (v.P1.getY() < tl.P1.getY())
- tl = v;
- else if (v.P1.getY() == tl.P1.getY())
- {
- if (v.P1.getX() < tl.P1.getX())
- tl = v;
- }
- v = v.next;
- }
- while (v != this);
- return tl;
- }
-
- /**
- * Returns if the path has a segment outside a shape
- */
- boolean isSegmentOutside(Shape shape)
- {
- return ! shape.contains(getMidPoint());
- }
- } // class Segment
-
- private class LineSegment extends Segment
- {
- public LineSegment(double x1, double y1, double x2, double y2)
- {
- super();
- P1 = new Point2D.Double(x1, y1);
- P2 = new Point2D.Double(x2, y2);
- }
-
- public LineSegment(Point2D p1, Point2D p2)
- {
- super();
- P1 = (Point2D) p1.clone();
- P2 = (Point2D) p2.clone();
- }
-
- /**
- * Clones this segment
- */
- public Object clone()
- {
- return new LineSegment(P1, P2);
- }
-
- /**
- * Transforms the segment
- */
- void transform(AffineTransform at)
- {
- P1 = at.transform(P1, null);
- P2 = at.transform(P2, null);
- }
-
- /**
- * Swap start and end points
- */
- void reverseCoords()
- {
- Point2D p = P1;
- P1 = P2;
- P2 = p;
- }
-
- /**
- * Returns the segment's midpoint
- */
- Point2D getMidPoint()
- {
- return (new Point2D.Double(0.5 * (P1.getX() + P2.getX()),
- 0.5 * (P1.getY() + P2.getY())));
- }
-
- /**
- * Returns twice the area of a curve, relative the P1-P2 line
- * Obviously, a line does not enclose any area besides the line
- */
- double curveArea()
- {
- return 0;
- }
-
- /**
- * Returns the PathIterator type of a segment
- */
- int getType()
- {
- return (PathIterator.SEG_LINETO);
- }
-
- /**
- * Subdivides the segment at parametric value t, inserting
- * the new segment into the linked list after this,
- * such that this becomes [0,t] and this.next becomes [t,1]
- */
- void subdivideInsert(double t)
- {
- Point2D p = new Point2D.Double((P2.getX() - P1.getX()) * t + P1.getX(),
- (P2.getY() - P1.getY()) * t + P1.getY());
- insert(new LineSegment(p, P2));
- P2 = p;
- next.node = node;
- node = null;
- }
-
- /**
- * Determines if two line segments are strictly colinear
- */
- boolean isCoLinear(LineSegment b)
- {
- double x1 = P1.getX();
- double y1 = P1.getY();
- double x2 = P2.getX();
- double y2 = P2.getY();
- double x3 = b.P1.getX();
- double y3 = b.P1.getY();
- double x4 = b.P2.getX();
- double y4 = b.P2.getY();
-
- if ((y1 - y3) * (x4 - x3) - (x1 - x3) * (y4 - y3) != 0.0)
- return false;
-
- return ((x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3) == 0.0);
- }
-
- /**
- * Return the last segment colinear with this one.
- * Used in comparing paths.
- */
- Segment lastCoLinear()
- {
- Segment prev = this;
- Segment v = next;
-
- while (v instanceof LineSegment)
- {
- if (isCoLinear((LineSegment) v))
- {
- prev = v;
- v = v.next;
- }
- else
- return prev;
- }
- return prev;
- }
-
- /**
- * Compare two segments.
- * We must take into account that the lines may be broken into colinear
- * subsegments and ignore them.
- */
- boolean equals(Segment b)
- {
- if (! (b instanceof LineSegment))
- return false;
- Point2D p1 = P1;
- Point2D p3 = b.P1;
-
- if (! p1.equals(p3))
- return false;
-
- Point2D p2 = lastCoLinear().P2;
- Point2D p4 = ((LineSegment) b).lastCoLinear().P2;
- return (p2.equals(p4));
- }
-
- /**
- * Returns a line segment
- */
- int pathIteratorFormat(double[] coords)
- {
- coords[0] = P2.getX();
- coords[1] = P2.getY();
- return (PathIterator.SEG_LINETO);
- }
-
- /**
- * Returns if the line has intersections.
- */
- boolean hasIntersections(Segment b)
- {
- if (b instanceof LineSegment)
- return (linesIntersect(this, (LineSegment) b) != null);
-
- if (b instanceof QuadSegment)
- return (lineQuadIntersect(this, (QuadSegment) b) != null);
-
- if (b instanceof CubicSegment)
- return (lineCubicIntersect(this, (CubicSegment) b) != null);
-
- return false;
- }
-
- /**
- * Splits intersections into nodes,
- * This one handles line-line, line-quadratic, line-cubic
- */
- int splitIntersections(Segment b)
- {
- if (b instanceof LineSegment)
- {
- Intersection i = linesIntersect(this, (LineSegment) b);
-
- if (i == null)
- return 0;
-
- return createNode(b, i);
- }
-
- Intersection[] x = null;
-
- if (b instanceof QuadSegment)
- x = lineQuadIntersect(this, (QuadSegment) b);
-
- if (b instanceof CubicSegment)
- x = lineCubicIntersect(this, (CubicSegment) b);
-
- if (x == null)
- return 0;
-
- if (x.length == 1)
- return createNode(b, (Intersection) x[0]);
-
- return createNodes(b, x);
- }
-
- /**
- * Returns the bounding box of this segment
- */
- Rectangle2D getBounds()
- {
- return (new Rectangle2D.Double(Math.min(P1.getX(), P2.getX()),
- Math.min(P1.getY(), P2.getY()),
- Math.abs(P1.getX() - P2.getX()),
- Math.abs(P1.getY() - P2.getY())));
- }
-
- /**
- * Returns the number of intersections on the positive X axis,
- * with the origin at (x,y), used for contains()-testing
- */
- int rayCrossing(double x, double y)
- {
- double x0 = P1.getX() - x;
- double y0 = P1.getY() - y;
- double x1 = P2.getX() - x;
- double y1 = P2.getY() - y;
-
- if (y0 * y1 > 0)
- return 0;
-
- if (x0 < 0 && x1 < 0)
- return 0;
-
- if (y0 == 0.0)
- y0 -= EPSILON;
-
- if (y1 == 0.0)
- y1 -= EPSILON;
-
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- EPSILON, 0.0, Double.MAX_VALUE, 0.0))
- return 1;
- return 0;
- }
- } // class LineSegment
-
- /**
- * Quadratic Bezier curve segment
- *
- * Note: Most peers don't support quadratics directly, so it might make
- * sense to represent them as cubics internally and just be done with it.
- * I think we should be peer-agnostic, however, and stay faithful to the
- * input geometry types as far as possible.
- */
- private class QuadSegment extends Segment
- {
- Point2D cp; // control point
-
- /**
- * Constructor, takes the coordinates of the start, control,
- * and end point, respectively.
- */
- QuadSegment(double x1, double y1, double cx, double cy, double x2,
- double y2)
- {
- super();
- P1 = new Point2D.Double(x1, y1);
- P2 = new Point2D.Double(x2, y2);
- cp = new Point2D.Double(cx, cy);
- }
-
- /**
- * Clones this segment
- */
- public Object clone()
- {
- return new QuadSegment(P1.getX(), P1.getY(), cp.getX(), cp.getY(),
- P2.getX(), P2.getY());
- }
-
- /**
- * Returns twice the area of a curve, relative the P1-P2 line
- *
- * The area formula can be derived by using Green's formula in the
- * plane on the parametric form of the bezier.
- */
- double curveArea()
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp.getX();
- double y1 = cp.getY();
- double x2 = P2.getX();
- double y2 = P2.getY();
-
- double P = (y2 - 2 * y1 + y0);
- double Q = 2 * (y1 - y0);
-
- double A = (x2 - 2 * x1 + x0);
- double B = 2 * (x1 - x0);
-
- double area = (B * P - A * Q) / 3.0;
- return (area);
- }
-
- /**
- * Compare two segments.
- */
- boolean equals(Segment b)
- {
- if (! (b instanceof QuadSegment))
- return false;
-
- return (P1.equals(b.P1) && cp.equals(((QuadSegment) b).cp)
- && P2.equals(b.P2));
- }
-
- /**
- * Returns a Point2D corresponding to the parametric value t
- * of the curve
- */
- Point2D evaluatePoint(double t)
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp.getX();
- double y1 = cp.getY();
- double x2 = P2.getX();
- double y2 = P2.getY();
-
- return new Point2D.Double(t * t * (x2 - 2 * x1 + x0) + 2 * t * (x1 - x0)
- + x0,
- t * t * (y2 - 2 * y1 + y0) + 2 * t * (y1 - y0)
- + y0);
- }
-
- /**
- * Returns the bounding box of this segment
- */
- Rectangle2D getBounds()
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp.getX();
- double y1 = cp.getY();
- double x2 = P2.getX();
- double y2 = P2.getY();
- double r0;
- double r1;
-
- double xmax = Math.max(x0, x2);
- double ymax = Math.max(y0, y2);
- double xmin = Math.min(x0, x2);
- double ymin = Math.min(y0, y2);
-
- r0 = 2 * (y1 - y0);
- r1 = 2 * (y2 - 2 * y1 + y0);
- if (r1 != 0.0)
- {
- double t = -r0 / r1;
- if (t > 0.0 && t < 1.0)
- {
- double y = evaluatePoint(t).getY();
- ymax = Math.max(y, ymax);
- ymin = Math.min(y, ymin);
- }
- }
- r0 = 2 * (x1 - x0);
- r1 = 2 * (x2 - 2 * x1 + x0);
- if (r1 != 0.0)
- {
- double t = -r0 / r1;
- if (t > 0.0 && t < 1.0)
- {
- double x = evaluatePoint(t).getY();
- xmax = Math.max(x, xmax);
- xmin = Math.min(x, xmin);
- }
- }
-
- return (new Rectangle2D.Double(xmin, ymin, xmax - xmin, ymax - ymin));
- }
-
- /**
- * Returns a cubic segment corresponding to this curve
- */
- CubicSegment getCubicSegment()
- {
- double x1 = P1.getX() + 2.0 * (cp.getX() - P1.getX()) / 3.0;
- double y1 = P1.getY() + 2.0 * (cp.getY() - P1.getY()) / 3.0;
- double x2 = cp.getX() + (P2.getX() - cp.getX()) / 3.0;
- double y2 = cp.getY() + (P2.getY() - cp.getY()) / 3.0;
-
- return new CubicSegment(P1.getX(), P1.getY(), x1, y1, x2, y2, P2.getX(),
- P2.getY());
- }
-
- /**
- * Returns the segment's midpoint
- */
- Point2D getMidPoint()
- {
- return evaluatePoint(0.5);
- }
-
- /**
- * Returns the PathIterator type of a segment
- */
- int getType()
- {
- return (PathIterator.SEG_QUADTO);
- }
-
- /**
- * Returns the PathIterator coords of a segment
- */
- int pathIteratorFormat(double[] coords)
- {
- coords[0] = cp.getX();
- coords[1] = cp.getY();
- coords[2] = P2.getX();
- coords[3] = P2.getY();
- return (PathIterator.SEG_QUADTO);
- }
-
- /**
- * Returns the number of intersections on the positive X axis,
- * with the origin at (x,y), used for contains()-testing
- */
- int rayCrossing(double x, double y)
- {
- double x0 = P1.getX() - x;
- double y0 = P1.getY() - y;
- double x1 = cp.getX() - x;
- double y1 = cp.getY() - y;
- double x2 = P2.getX() - x;
- double y2 = P2.getY() - y;
- double[] r = new double[3];
- int nRoots;
- int nCrossings = 0;
-
- /* check if curve may intersect X+ axis. */
- if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0) && (y0 * y1 <= 0 || y1 * y2 <= 0))
- {
- if (y0 == 0.0)
- y0 -= EPSILON;
- if (y2 == 0.0)
- y2 -= EPSILON;
-
- r[0] = y0;
- r[1] = 2 * (y1 - y0);
- r[2] = (y2 - 2 * y1 + y0);
-
- nRoots = QuadCurve2D.solveQuadratic(r);
- for (int i = 0; i < nRoots; i++)
- if (r[i] > 0.0f && r[i] < 1.0f)
- {
- double t = r[i];
- if (t * t * (x2 - 2 * x1 + x0) + 2 * t * (x1 - x0) + x0 > 0.0)
- nCrossings++;
- }
- }
- return nCrossings;
- }
-
- /**
- * Swap start and end points
- */
- void reverseCoords()
- {
- Point2D temp = P1;
- P1 = P2;
- P2 = temp;
- }
-
- /**
- * Splits intersections into nodes,
- * This one handles quadratic-quadratic only,
- * Quadratic-line is passed on to the LineSegment class,
- * Quadratic-cubic is passed on to the CubicSegment class
- */
- int splitIntersections(Segment b)
- {
- if (b instanceof LineSegment)
- return (b.splitIntersections(this));
-
- if (b instanceof CubicSegment)
- return (b.splitIntersections(this));
-
- if (b instanceof QuadSegment)
- {
- // Use the cubic-cubic intersection routine for quads as well,
- // Since a quadratic can be exactly described as a cubic, this
- // should not be a problem;
- // The recursion depth will be the same in any case.
- Intersection[] x = cubicCubicIntersect(getCubicSegment(),
- ((QuadSegment) b)
- .getCubicSegment());
- if (x == null)
- return 0;
-
- if (x.length == 1)
- return createNode(b, (Intersection) x[0]);
-
- return createNodes(b, x);
- }
- return 0;
- }
-
- /**
- * Subdivides the segment at parametric value t, inserting
- * the new segment into the linked list after this,
- * such that this becomes [0,t] and this.next becomes [t,1]
- */
- void subdivideInsert(double t)
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp.getX();
- double y1 = cp.getY();
- double x2 = P2.getX();
- double y2 = P2.getY();
-
- double p10x = x0 + t * (x1 - x0);
- double p10y = y0 + t * (y1 - y0);
- double p11x = x1 + t * (x2 - x1);
- double p11y = y1 + t * (y2 - y1);
- double p20x = p10x + t * (p11x - p10x);
- double p20y = p10y + t * (p11y - p10y);
-
- insert(new QuadSegment(p20x, p20y, p11x, p11y, x2, y2));
- P2 = next.P1;
- cp.setLocation(p10x, p10y);
-
- next.node = node;
- node = null;
- }
-
- /**
- * Transforms the segment
- */
- void transform(AffineTransform at)
- {
- P1 = at.transform(P1, null);
- P2 = at.transform(P2, null);
- cp = at.transform(cp, null);
- }
- } // class QuadSegment
-
- /**
- * Cubic Bezier curve segment
- */
- private class CubicSegment extends Segment
- {
- Point2D cp1; // control points
- Point2D cp2; // control points
-
- /**
- * Constructor - takes coordinates of the starting point,
- * first control point, second control point and end point,
- * respecively.
- */
- public CubicSegment(double x1, double y1, double c1x, double c1y,
- double c2x, double c2y, double x2, double y2)
- {
- super();
- P1 = new Point2D.Double(x1, y1);
- P2 = new Point2D.Double(x2, y2);
- cp1 = new Point2D.Double(c1x, c1y);
- cp2 = new Point2D.Double(c2x, c2y);
- }
-
- /**
- * Clones this segment
- */
- public Object clone()
- {
- return new CubicSegment(P1.getX(), P1.getY(), cp1.getX(), cp1.getY(),
- cp2.getX(), cp2.getY(), P2.getX(), P2.getY());
- }
-
- /**
- * Returns twice the area of a curve, relative the P1-P2 line
- *
- * The area formula can be derived by using Green's formula in the
- * plane on the parametric form of the bezier.
- */
- double curveArea()
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp1.getX();
- double y1 = cp1.getY();
- double x2 = cp2.getX();
- double y2 = cp2.getY();
- double x3 = P2.getX();
- double y3 = P2.getY();
-
- double P = y3 - 3 * y2 + 3 * y1 - y0;
- double Q = 3 * (y2 + y0 - 2 * y1);
- double R = 3 * (y1 - y0);
-
- double A = x3 - 3 * x2 + 3 * x1 - x0;
- double B = 3 * (x2 + x0 - 2 * x1);
- double C = 3 * (x1 - x0);
-
- double area = (B * P - A * Q) / 5.0 + (C * P - A * R) / 2.0
- + (C * Q - B * R) / 3.0;
-
- return (area);
- }
-
- /**
- * Compare two segments.
- */
- boolean equals(Segment b)
- {
- if (! (b instanceof CubicSegment))
- return false;
-
- return (P1.equals(b.P1) && cp1.equals(((CubicSegment) b).cp1)
- && cp2.equals(((CubicSegment) b).cp2) && P2.equals(b.P2));
- }
-
- /**
- * Returns a Point2D corresponding to the parametric value t
- * of the curve
- */
- Point2D evaluatePoint(double t)
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp1.getX();
- double y1 = cp1.getY();
- double x2 = cp2.getX();
- double y2 = cp2.getY();
- double x3 = P2.getX();
- double y3 = P2.getY();
-
- return new Point2D.Double(-(t * t * t) * (x0 - 3 * x1 + 3 * x2 - x3)
- + 3 * t * t * (x0 - 2 * x1 + x2)
- + 3 * t * (x1 - x0) + x0,
- -(t * t * t) * (y0 - 3 * y1 + 3 * y2 - y3)
- + 3 * t * t * (y0 - 2 * y1 + y2)
- + 3 * t * (y1 - y0) + y0);
- }
-
- /**
- * Returns the bounding box of this segment
- */
- Rectangle2D getBounds()
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp1.getX();
- double y1 = cp1.getY();
- double x2 = cp2.getX();
- double y2 = cp2.getY();
- double x3 = P2.getX();
- double y3 = P2.getY();
- double[] r = new double[3];
-
- double xmax = Math.max(x0, x3);
- double ymax = Math.max(y0, y3);
- double xmin = Math.min(x0, x3);
- double ymin = Math.min(y0, y3);
-
- r[0] = 3 * (y1 - y0);
- r[1] = 6.0 * (y2 + y0 - 2 * y1);
- r[2] = 3.0 * (y3 - 3 * y2 + 3 * y1 - y0);
-
- int n = QuadCurve2D.solveQuadratic(r);
- for (int i = 0; i < n; i++)
- {
- double t = r[i];
- if (t > 0 && t < 1.0)
- {
- double y = evaluatePoint(t).getY();
- ymax = Math.max(y, ymax);
- ymin = Math.min(y, ymin);
- }
- }
-
- r[0] = 3 * (x1 - x0);
- r[1] = 6.0 * (x2 + x0 - 2 * x1);
- r[2] = 3.0 * (x3 - 3 * x2 + 3 * x1 - x0);
- n = QuadCurve2D.solveQuadratic(r);
- for (int i = 0; i < n; i++)
- {
- double t = r[i];
- if (t > 0 && t < 1.0)
- {
- double x = evaluatePoint(t).getX();
- xmax = Math.max(x, xmax);
- xmin = Math.min(x, xmin);
- }
- }
- return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
- }
-
- /**
- * Returns a CubicCurve2D object corresponding to this segment.
- */
- CubicCurve2D getCubicCurve2D()
- {
- return new CubicCurve2D.Double(P1.getX(), P1.getY(), cp1.getX(),
- cp1.getY(), cp2.getX(), cp2.getY(),
- P2.getX(), P2.getY());
- }
-
- /**
- * Returns the parametric points of self-intersection if the cubic
- * is self-intersecting, null otherwise.
- */
- double[] getLoop()
- {
- double x0 = P1.getX();
- double y0 = P1.getY();
- double x1 = cp1.getX();
- double y1 = cp1.getY();
- double x2 = cp2.getX();
- double y2 = cp2.getY();
- double x3 = P2.getX();
- double y3 = P2.getY();
- double[] r = new double[4];
- double k;
- double R;
- double T;
- double A;
- double B;
- double[] results = new double[2];
-
- R = x3 - 3 * x2 + 3 * x1 - x0;
- T = y3 - 3 * y2 + 3 * y1 - y0;
-
- // A qudratic
- if (R == 0.0 && T == 0.0)
- return null;
-
- // true cubic
- if (R != 0.0 && T != 0.0)
- {
- A = 3 * (x2 + x0 - 2 * x1) / R;
- B = 3 * (x1 - x0) / R;
-
- double P = 3 * (y2 + y0 - 2 * y1) / T;
- double Q = 3 * (y1 - y0) / T;
-
- if (A == P || Q == B)
- return null;
-
- k = (Q - B) / (A - P);
- }
- else
- {
- if (R == 0.0)
- {
- // quadratic in x
- k = -(3 * (x1 - x0)) / (3 * (x2 + x0 - 2 * x1));
- A = 3 * (y2 + y0 - 2 * y1) / T;
- B = 3 * (y1 - y0) / T;
- }
- else
- {
- // quadratic in y
- k = -(3 * (y1 - y0)) / (3 * (y2 + y0 - 2 * y1));
- A = 3 * (x2 + x0 - 2 * x1) / R;
- B = 3 * (x1 - x0) / R;
- }
- }
-
- r[0] = -k * k * k - A * k * k - B * k;
- r[1] = 3 * k * k + 2 * k * A + 2 * B;
- r[2] = -3 * k;
- r[3] = 2;
-
- int n = CubicCurve2D.solveCubic(r);
- if (n != 3)
- return null;
-
- // sort r
- double t;
- for (int i = 0; i < 2; i++)
- for (int j = i + 1; j < 3; j++)
- if (r[j] < r[i])
- {
- t = r[i];
- r[i] = r[j];
- r[j] = t;
- }
-
- if (Math.abs(r[0] + r[2] - k) < 1E-13)
- if (r[0] >= 0.0 && r[0] <= 1.0 && r[2] >= 0.0 && r[2] <= 1.0)
- if (evaluatePoint(r[0]).distance(evaluatePoint(r[2])) < PE_EPSILON * 10)
- { // we snap the points anyway
- results[0] = r[0];
- results[1] = r[2];
- return (results);
- }
- return null;
- }
-
- /**
- * Returns the segment's midpoint
- */
- Point2D getMidPoint()
- {
- return evaluatePoint(0.5);
- }
-
- /**
- * Returns the PathIterator type of a segment
- */
- int getType()
- {
- return (PathIterator.SEG_CUBICTO);
- }
-
- /**
- * Returns the PathIterator coords of a segment
- */
- int pathIteratorFormat(double[] coords)
- {
- coords[0] = cp1.getX();
- coords[1] = cp1.getY();
- coords[2] = cp2.getX();
- coords[3] = cp2.getY();
- coords[4] = P2.getX();
- coords[5] = P2.getY();
- return (PathIterator.SEG_CUBICTO);
- }
-
- /**
- * Returns the number of intersections on the positive X axis,
- * with the origin at (x,y), used for contains()-testing
- */
- int rayCrossing(double x, double y)
- {
- double x0 = P1.getX() - x;
- double y0 = P1.getY() - y;
- double x1 = cp1.getX() - x;
- double y1 = cp1.getY() - y;
- double x2 = cp2.getX() - x;
- double y2 = cp2.getY() - y;
- double x3 = P2.getX() - x;
- double y3 = P2.getY() - y;
- double[] r = new double[4];
- int nRoots;
- int nCrossings = 0;
-
- /* check if curve may intersect X+ axis. */
- if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0 || x3 > 0.0)
- && (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
- {
- if (y0 == 0.0)
- y0 -= EPSILON;
- if (y3 == 0.0)
- y3 -= EPSILON;
-
- r[0] = y0;
- r[1] = 3 * (y1 - y0);
- r[2] = 3 * (y2 + y0 - 2 * y1);
- r[3] = y3 - 3 * y2 + 3 * y1 - y0;
-
- if ((nRoots = CubicCurve2D.solveCubic(r)) > 0)
- for (int i = 0; i < nRoots; i++)
- {
- if (r[i] > 0.0 && r[i] < 1.0)
- {
- double t = r[i];
- if (-(t * t * t) * (x0 - 3 * x1 + 3 * x2 - x3)
- + 3 * t * t * (x0 - 2 * x1 + x2) + 3 * t * (x1 - x0)
- + x0 > 0.0)
- nCrossings++;
- }
- }
- }
- return nCrossings;
- }
-
- /**
- * Swap start and end points
- */
- void reverseCoords()
- {
- Point2D p = P1;
- P1 = P2;
- P2 = p;
- p = cp1; // swap control points
- cp1 = cp2;
- cp2 = p;
- }
-
- /**
- * Splits intersections into nodes,
- * This one handles cubic-cubic and cubic-quadratic intersections
- */
- int splitIntersections(Segment b)
- {
- if (b instanceof LineSegment)
- return (b.splitIntersections(this));
-
- Intersection[] x = null;
-
- if (b instanceof QuadSegment)
- x = cubicCubicIntersect(this, ((QuadSegment) b).getCubicSegment());
-
- if (b instanceof CubicSegment)
- x = cubicCubicIntersect(this, (CubicSegment) b);
-
- if (x == null)
- return 0;
-
- if (x.length == 1)
- return createNode(b, x[0]);
-
- return createNodes(b, x);
- }
-
- /**
- * Subdivides the segment at parametric value t, inserting
- * the new segment into the linked list after this,
- * such that this becomes [0,t] and this.next becomes [t,1]
- */
- void subdivideInsert(double t)
- {
- CubicSegment s = (CubicSegment) clone();
- double p1x = (s.cp1.getX() - s.P1.getX()) * t + s.P1.getX();
- double p1y = (s.cp1.getY() - s.P1.getY()) * t + s.P1.getY();
-
- double px = (s.cp2.getX() - s.cp1.getX()) * t + s.cp1.getX();
- double py = (s.cp2.getY() - s.cp1.getY()) * t + s.cp1.getY();
-
- s.cp2.setLocation((s.P2.getX() - s.cp2.getX()) * t + s.cp2.getX(),
- (s.P2.getY() - s.cp2.getY()) * t + s.cp2.getY());
-
- s.cp1.setLocation((s.cp2.getX() - px) * t + px,
- (s.cp2.getY() - py) * t + py);
-
- double p2x = (px - p1x) * t + p1x;
- double p2y = (py - p1y) * t + p1y;
-
- double p3x = (s.cp1.getX() - p2x) * t + p2x;
- double p3y = (s.cp1.getY() - p2y) * t + p2y;
- s.P1.setLocation(p3x, p3y);
-
- // insert new curve
- insert(s);
-
- // set this curve
- cp1.setLocation(p1x, p1y);
- cp2.setLocation(p2x, p2y);
- P2 = s.P1;
- next.node = node;
- node = null;
- }
-
- /**
- * Transforms the segment
- */
- void transform(AffineTransform at)
- {
- P1 = at.transform(P1, null);
- P2 = at.transform(P2, null);
- cp1 = at.transform(cp1, null);
- cp2 = at.transform(cp2, null);
- }
- } // class CubicSegment
-} // class Area
diff --git a/libjava/java/awt/geom/CubicCurve2D.java b/libjava/java/awt/geom/CubicCurve2D.java
deleted file mode 100644
index 50c381194bb..00000000000
--- a/libjava/java/awt/geom/CubicCurve2D.java
+++ /dev/null
@@ -1,1724 +0,0 @@
-/* CubicCurve2D.java -- represents a parameterized cubic curve in 2-D space
- Copyright (C) 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.util.NoSuchElementException;
-
-
-/**
- * A two-dimensional curve that is parameterized with a cubic
- * function.
- *
- *
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Graydon Hoare (graydon@redhat.com)
- * @author Sascha Brawer (brawer@dandelis.ch)
- * @author Sven de Marothy (sven@physto.se)
- *
- * @since 1.2
- */
-public abstract class CubicCurve2D implements Shape, Cloneable
-{
- private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
- private static final double EPSILON = 1E-10;
-
- /**
- * Constructs a new CubicCurve2D. Typical users will want to
- * construct instances of a subclass, such as {@link
- * CubicCurve2D.Float} or {@link CubicCurve2D.Double}.
- */
- protected CubicCurve2D()
- {
- }
-
- /**
- * Returns the x coordinate of the curve’s start
- * point.
- */
- public abstract double getX1();
-
- /**
- * Returns the y coordinate of the curve’s start
- * point.
- */
- public abstract double getY1();
-
- /**
- * Returns the curve’s start point.
- */
- public abstract Point2D getP1();
-
- /**
- * Returns the x coordinate of the curve’s first
- * control point.
- */
- public abstract double getCtrlX1();
-
- /**
- * Returns the y coordinate of the curve’s first
- * control point.
- */
- public abstract double getCtrlY1();
-
- /**
- * Returns the curve’s first control point.
- */
- public abstract Point2D getCtrlP1();
-
- /**
- * Returns the x coordinate of the curve’s second
- * control point.
- */
- public abstract double getCtrlX2();
-
- /**
- * Returns the y coordinate of the curve’s second
- * control point.
- */
- public abstract double getCtrlY2();
-
- /**
- * Returns the curve’s second control point.
- */
- public abstract Point2D getCtrlP2();
-
- /**
- * Returns the x coordinate of the curve’s end
- * point.
- */
- public abstract double getX2();
-
- /**
- * Returns the y coordinate of the curve’s end
- * point.
- */
- public abstract double getY2();
-
- /**
- * Returns the curve’s end point.
- */
- public abstract Point2D getP2();
-
- /**
- * Changes the curve geometry, separately specifying each coordinate
- * value.
- *
- *
- *
- * @param x1 the x coordinate of the curve’s new start
- * point.
- *
- * @param y1 the y coordinate of the curve’s new start
- * point.
- *
- * @param cx1 the x coordinate of the curve’s new
- * first control point.
- *
- * @param cy1 the y coordinate of the curve’s new
- * first control point.
- *
- * @param cx2 the x coordinate of the curve’s new
- * second control point.
- *
- * @param cy2 the y coordinate of the curve’s new
- * second control point.
- *
- * @param x2 the x coordinate of the curve’s new end
- * point.
- *
- * @param y2 the y coordinate of the curve’s new end
- * point.
- */
- public abstract void setCurve(double x1, double y1, double cx1, double cy1,
- double cx2, double cy2, double x2, double y2);
-
- /**
- * Changes the curve geometry, specifying coordinate values in an
- * array.
- *
- * @param coords an array containing the new coordinate values. The
- * x coordinate of the new start point is located at
- *
coords[offset]
, its y coordinate at
- * coords[offset + 1]
. The x coordinate of the
- * new first control point is located at coords[offset +
- * 2]
, its y coordinate at coords[offset +
- * 3]
. The x coordinate of the new second control
- * point is located at coords[offset + 4]
, its y
- * coordinate at coords[offset + 5]
. The x
- * coordinate of the new end point is located at coords[offset
- * + 6]
, its y coordinate at coords[offset +
- * 7]
.
- *
- * @param offset the offset of the first coordinate value in
- * coords
.
- */
- public void setCurve(double[] coords, int offset)
- {
- setCurve(coords[offset++], coords[offset++], coords[offset++],
- coords[offset++], coords[offset++], coords[offset++],
- coords[offset++], coords[offset++]);
- }
-
- /**
- * Changes the curve geometry, specifying coordinate values in
- * separate Point objects.
- *
- *
- *
- *
p1
,
- * c1
, c2
or p2
will not
- * affect the curve geometry.
- *
- * @param p1 the new start point.
- * @param c1 the new first control point.
- * @param c2 the new second control point.
- * @param p2 the new end point.
- */
- public void setCurve(Point2D p1, Point2D c1, Point2D c2, Point2D p2)
- {
- setCurve(p1.getX(), p1.getY(), c1.getX(), c1.getY(), c2.getX(), c2.getY(),
- p2.getX(), p2.getY());
- }
-
- /**
- * Changes the curve geometry, specifying coordinate values in an
- * array of Point objects.
- *
- *
- *
- *
pts
array
- * or any of its elements will not affect the curve geometry.
- *
- * @param pts an array containing the points. The new start point
- * is located at pts[offset]
, the new first control
- * point at pts[offset + 1]
, the new second control
- * point at pts[offset + 2]
, and the new end point
- * at pts[offset + 3]
.
- *
- * @param offset the offset of the start point in pts
.
- */
- public void setCurve(Point2D[] pts, int offset)
- {
- setCurve(pts[offset].getX(), pts[offset++].getY(), pts[offset].getX(),
- pts[offset++].getY(), pts[offset].getX(), pts[offset++].getY(),
- pts[offset].getX(), pts[offset++].getY());
- }
-
- /**
- * Changes the curve geometry to that of another curve.
- *
- * @param c the curve whose coordinates will be copied.
- */
- public void setCurve(CubicCurve2D c)
- {
- setCurve(c.getX1(), c.getY1(), c.getCtrlX1(), c.getCtrlY1(),
- c.getCtrlX2(), c.getCtrlY2(), c.getX2(), c.getY2());
- }
-
- /**
- * Calculates the squared flatness of a cubic curve, directly
- * specifying each coordinate value. The flatness is the maximal
- * distance of a control point to the line between start and end
- * point.
- *
- *
- *
- *
- *
- *
- *
- *
coords[offset]
, its y coordinate at
- * coords[offset + 1]
. The x coordinate of the
- * first control point C1 is located at coords[offset +
- * 2]
, its y coordinate at coords[offset +
- * 3]
. The x coordinate of the second control point C2
- * is located at coords[offset + 4]
, its y
- * coordinate at coords[offset + 5]
. The x
- * coordinate of the end point P2 is located at coords[offset
- * + 6]
, its y coordinate at coords[offset +
- * 7]
.
- *
- * @param offset the offset of the first coordinate value in
- * coords
.
- */
- public static double getFlatnessSq(double[] coords, int offset)
- {
- return getFlatnessSq(coords[offset++], coords[offset++], coords[offset++],
- coords[offset++], coords[offset++], coords[offset++],
- coords[offset++], coords[offset++]);
- }
-
- /**
- * Calculates the flatness of a cubic curve, specifying the
- * coordinate values in an array. The flatness is the maximal
- * distance of a control point to the line between start and end
- * point.
- *
- *
- *
- *
coords[offset]
, its y coordinate at
- * coords[offset + 1]
. The x coordinate of the
- * first control point C1 is located at coords[offset +
- * 2]
, its y coordinate at coords[offset +
- * 3]
. The x coordinate of the second control point C2
- * is located at coords[offset + 4]
, its y
- * coordinate at coords[offset + 5]
. The x
- * coordinate of the end point P2 is located at coords[offset
- * + 6]
, its y coordinate at coords[offset +
- * 7]
.
- *
- * @param offset the offset of the first coordinate value in
- * coords
.
- */
- public static double getFlatness(double[] coords, int offset)
- {
- return Math.sqrt(getFlatnessSq(coords[offset++], coords[offset++],
- coords[offset++], coords[offset++],
- coords[offset++], coords[offset++],
- coords[offset++], coords[offset++]));
- }
-
- /**
- * Calculates the squared flatness of this curve. The flatness is
- * the maximal distance of a control point to the line between start
- * and end point.
- *
- *
- *
- *
- *
- *
- *
- * @param left a curve whose geometry will be set to the left half
- * of this curve, or
null
if the caller is not
- * interested in the left half.
- *
- * @param right a curve whose geometry will be set to the right half
- * of this curve, or null
if the caller is not
- * interested in the right half.
- */
- public void subdivide(CubicCurve2D left, CubicCurve2D right)
- {
- // Use empty slots at end to share single array.
- double[] d = new double[]
- {
- getX1(), getY1(), getCtrlX1(), getCtrlY1(), getCtrlX2(),
- getCtrlY2(), getX2(), getY2(), 0, 0, 0, 0, 0, 0
- };
- subdivide(d, 0, d, 0, d, 6);
- if (left != null)
- left.setCurve(d, 0);
- if (right != null)
- right.setCurve(d, 6);
- }
-
- /**
- * Subdivides a cubic curve into two halves.
- *
- *
- *
- * @param src the curve to be subdivided.
- *
- * @param left a curve whose geometry will be set to the left half
- * of
src
, or null
if the caller is not
- * interested in the left half.
- *
- * @param right a curve whose geometry will be set to the right half
- * of src
, or null
if the caller is not
- * interested in the right half.
- */
- public static void subdivide(CubicCurve2D src, CubicCurve2D left,
- CubicCurve2D right)
- {
- src.subdivide(left, right);
- }
-
- /**
- * Subdivides a cubic curve into two halves, passing all coordinates
- * in an array.
- *
- *
- *
- *
left
and right
, and
- * set rightOff
to leftOff + 6
.
- *
- * @param src an array containing the coordinates of the curve to be
- * subdivided. The x coordinate of the start point P1 is
- * located at src[srcOff]
, its y at
- * src[srcOff + 1]
. The x coordinate of the
- * first control point C1 is located at src[srcOff +
- * 2]
, its y at src[srcOff + 3]
. The
- * x coordinate of the second control point C2 is located at
- * src[srcOff + 4]
, its y at src[srcOff +
- * 5]
. The x coordinate of the end point is located at
- * src[srcOff + 6]
, its y at src[srcOff +
- * 7]
.
- *
- * @param srcOff an offset into src
, specifying
- * the index of the start point’s x coordinate.
- *
- * @param left an array that will receive the coordinates of the
- * left half of src
. It is acceptable to pass
- * src
. A caller who is not interested in the left half
- * can pass null
.
- *
- * @param leftOff an offset into left
, specifying the
- * index where the start point’s x coordinate will be
- * stored.
- *
- * @param right an array that will receive the coordinates of the
- * right half of src
. It is acceptable to pass
- * src
or left
. A caller who is not
- * interested in the right half can pass null
.
- *
- * @param rightOff an offset into right
, specifying the
- * index where the start point’s x coordinate will be
- * stored.
- */
- public static void subdivide(double[] src, int srcOff, double[] left,
- int leftOff, double[] right, int rightOff)
- {
- // To understand this code, please have a look at the image
- // "CubicCurve2D-3.png" in the sub-directory "doc-files".
- double src_C1_x;
- double src_C1_y;
- double src_C2_x;
- double src_C2_y;
- double left_P1_x;
- double left_P1_y;
- double left_C1_x;
- double left_C1_y;
- double left_C2_x;
- double left_C2_y;
- double right_C1_x;
- double right_C1_y;
- double right_C2_x;
- double right_C2_y;
- double right_P2_x;
- double right_P2_y;
- double Mid_x; // Mid = left.P2 = right.P1
- double Mid_y; // Mid = left.P2 = right.P1
-
- left_P1_x = src[srcOff];
- left_P1_y = src[srcOff + 1];
- src_C1_x = src[srcOff + 2];
- src_C1_y = src[srcOff + 3];
- src_C2_x = src[srcOff + 4];
- src_C2_y = src[srcOff + 5];
- right_P2_x = src[srcOff + 6];
- right_P2_y = src[srcOff + 7];
-
- left_C1_x = (left_P1_x + src_C1_x) / 2;
- left_C1_y = (left_P1_y + src_C1_y) / 2;
- right_C2_x = (right_P2_x + src_C2_x) / 2;
- right_C2_y = (right_P2_y + src_C2_y) / 2;
- Mid_x = (src_C1_x + src_C2_x) / 2;
- Mid_y = (src_C1_y + src_C2_y) / 2;
- left_C2_x = (left_C1_x + Mid_x) / 2;
- left_C2_y = (left_C1_y + Mid_y) / 2;
- right_C1_x = (Mid_x + right_C2_x) / 2;
- right_C1_y = (Mid_y + right_C2_y) / 2;
- Mid_x = (left_C2_x + right_C1_x) / 2;
- Mid_y = (left_C2_y + right_C1_y) / 2;
-
- if (left != null)
- {
- left[leftOff] = left_P1_x;
- left[leftOff + 1] = left_P1_y;
- left[leftOff + 2] = left_C1_x;
- left[leftOff + 3] = left_C1_y;
- left[leftOff + 4] = left_C2_x;
- left[leftOff + 5] = left_C2_y;
- left[leftOff + 6] = Mid_x;
- left[leftOff + 7] = Mid_y;
- }
-
- if (right != null)
- {
- right[rightOff] = Mid_x;
- right[rightOff + 1] = Mid_y;
- right[rightOff + 2] = right_C1_x;
- right[rightOff + 3] = right_C1_y;
- right[rightOff + 4] = right_C2_x;
- right[rightOff + 5] = right_C2_y;
- right[rightOff + 6] = right_P2_x;
- right[rightOff + 7] = right_P2_y;
- }
- }
-
- /**
- * Finds the non-complex roots of a cubic equation, placing the
- * results into the same array as the equation coefficients. The
- * following equation is being solved:
- *
- *
- *
- * eqn[3]
· x3
- * + eqn[2]
· x2
- * + eqn[1]
· x
- * + eqn[0]
- * = 0
- * eqn
will contain the
- * non-complex solutions of the equation, in no particular order.
- *
- * @return the number of non-complex solutions. A result of 0
- * indicates that the equation has no non-complex solutions. A
- * result of -1 indicates that the equation is constant (i.e.,
- * always or never zero).
- *
- * @see #solveCubic(double[], double[])
- * @see QuadCurve2D#solveQuadratic(double[],double[])
- *
- * @author Brian Gough (bjg@network-theory.com)
- * (original C implementation in the GNU Scientific Library)
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- * (adaptation to Java)
- */
- public static int solveCubic(double[] eqn)
- {
- return solveCubic(eqn, eqn);
- }
-
- /**
- * Finds the non-complex roots of a cubic equation. The following
- * equation is being solved:
- *
- *
- *
- * eqn[3]
· x3
- * + eqn[2]
· x2
- * + eqn[1]
· x
- * + eqn[0]
- * = 0
- * eqn
- * and res
.
- *
- * @return the number of non-complex solutions. A result of 0
- * indicates that the equation has no non-complex solutions. A
- * result of -1 indicates that the equation is constant (i.e.,
- * always or never zero).
- *
- * @author Brian Gough (bjg@network-theory.com)
- * (original C implementation in the GNU Scientific Library)
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- * (adaptation to Java)
- */
- public static int solveCubic(double[] eqn, double[] res)
- {
- // Adapted from poly/solve_cubic.c in the GNU Scientific Library
- // (GSL), revision 1.7 of 2003-07-26. For the original source, see
- // http://www.gnu.org/software/gsl/
- //
- // Brian Gough, the author of that code, has granted the
- // permission to use it in GNU Classpath under the GNU Classpath
- // license, and has assigned the copyright to the Free Software
- // Foundation.
- //
- // The Java implementation is very similar to the GSL code, but
- // not a strict one-to-one copy. For example, GSL would sort the
- // result.
-
- double a;
- double b;
- double c;
- double q;
- double r;
- double Q;
- double R;
- double c3;
- double Q3;
- double R2;
- double CR2;
- double CQ3;
-
- // If the cubic coefficient is zero, we have a quadratic equation.
- c3 = eqn[3];
- if (c3 == 0)
- return QuadCurve2D.solveQuadratic(eqn, res);
-
- // Divide the equation by the cubic coefficient.
- c = eqn[0] / c3;
- b = eqn[1] / c3;
- a = eqn[2] / c3;
-
- // We now need to solve x^3 + ax^2 + bx + c = 0.
- q = a * a - 3 * b;
- r = 2 * a * a * a - 9 * a * b + 27 * c;
-
- Q = q / 9;
- R = r / 54;
-
- Q3 = Q * Q * Q;
- R2 = R * R;
-
- CR2 = 729 * r * r;
- CQ3 = 2916 * q * q * q;
-
- if (R == 0 && Q == 0)
- {
- // The GNU Scientific Library would return three identical
- // solutions in this case.
- res[0] = -a / 3;
- return 1;
- }
-
- if (CR2 == CQ3)
- {
- /* this test is actually R2 == Q3, written in a form suitable
- for exact computation with integers */
- /* Due to finite precision some double roots may be missed, and
- considered to be a pair of complex roots z = x +/- epsilon i
- close to the real axis. */
- double sqrtQ = Math.sqrt(Q);
-
- if (R > 0)
- {
- res[0] = -2 * sqrtQ - a / 3;
- res[1] = sqrtQ - a / 3;
- }
- else
- {
- res[0] = -sqrtQ - a / 3;
- res[1] = 2 * sqrtQ - a / 3;
- }
- return 2;
- }
-
- if (CR2 < CQ3) /* equivalent to R2 < Q3 */
- {
- double sqrtQ = Math.sqrt(Q);
- double sqrtQ3 = sqrtQ * sqrtQ * sqrtQ;
- double theta = Math.acos(R / sqrtQ3);
- double norm = -2 * sqrtQ;
- res[0] = norm * Math.cos(theta / 3) - a / 3;
- res[1] = norm * Math.cos((theta + 2.0 * Math.PI) / 3) - a / 3;
- res[2] = norm * Math.cos((theta - 2.0 * Math.PI) / 3) - a / 3;
-
- // The GNU Scientific Library sorts the results. We don't.
- return 3;
- }
-
- double sgnR = (R >= 0 ? 1 : -1);
- double A = -sgnR * Math.pow(Math.abs(R) + Math.sqrt(R2 - Q3), 1.0 / 3.0);
- double B = Q / A;
- res[0] = A + B - a / 3;
- return 1;
- }
-
- /**
- * Determines whether a position lies inside the area bounded
- * by the curve and the straight line connecting its end points.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * @param x1 the x coordinate of the curve’s start
- * point.
- *
- * @param y1 the y coordinate of the curve’s start
- * point.
- *
- * @param cx1 the x coordinate of the curve’s first
- * control point.
- *
- * @param cy1 the y coordinate of the curve’s first
- * control point.
- *
- * @param cx2 the x coordinate of the curve’s second
- * control point.
- *
- * @param cy2 the y coordinate of the curve’s second
- * control point.
- *
- * @param x2 the x coordinate of the curve’s end
- * point.
- *
- * @param y2 the y coordinate of the curve’s end
- * point.
- */
- public Double(double x1, double y1, double cx1, double cy1, double cx2,
- double cy2, double x2, double y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx1 = cx1;
- ctrly1 = cy1;
- ctrlx2 = cx2;
- ctrly2 = cy2;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Returns the x coordinate of the curve’s start
- * point.
- */
- public double getX1()
- {
- return x1;
- }
-
- /**
- * Returns the y coordinate of the curve’s start
- * point.
- */
- public double getY1()
- {
- return y1;
- }
-
- /**
- * Returns the curve’s start point.
- */
- public Point2D getP1()
- {
- return new Point2D.Double(x1, y1);
- }
-
- /**
- * Returns the x coordinate of the curve’s first
- * control point.
- */
- public double getCtrlX1()
- {
- return ctrlx1;
- }
-
- /**
- * Returns the y coordinate of the curve’s first
- * control point.
- */
- public double getCtrlY1()
- {
- return ctrly1;
- }
-
- /**
- * Returns the curve’s first control point.
- */
- public Point2D getCtrlP1()
- {
- return new Point2D.Double(ctrlx1, ctrly1);
- }
-
- /**
- * Returns the x coordinate of the curve’s second
- * control point.
- */
- public double getCtrlX2()
- {
- return ctrlx2;
- }
-
- /**
- * Returns the y coordinate of the curve’s second
- * control point.
- */
- public double getCtrlY2()
- {
- return ctrly2;
- }
-
- /**
- * Returns the curve’s second control point.
- */
- public Point2D getCtrlP2()
- {
- return new Point2D.Double(ctrlx2, ctrly2);
- }
-
- /**
- * Returns the x coordinate of the curve’s end
- * point.
- */
- public double getX2()
- {
- return x2;
- }
-
- /**
- * Returns the y coordinate of the curve’s end
- * point.
- */
- public double getY2()
- {
- return y2;
- }
-
- /**
- * Returns the curve’s end point.
- */
- public Point2D getP2()
- {
- return new Point2D.Double(x2, y2);
- }
-
- /**
- * Changes the curve geometry, separately specifying each coordinate
- * value.
- *
- *
- *
- * @param x1 the x coordinate of the curve’s new start
- * point.
- *
- * @param y1 the y coordinate of the curve’s new start
- * point.
- *
- * @param cx1 the x coordinate of the curve’s new
- * first control point.
- *
- * @param cy1 the y coordinate of the curve’s new
- * first control point.
- *
- * @param cx2 the x coordinate of the curve’s new
- * second control point.
- *
- * @param cy2 the y coordinate of the curve’s new
- * second control point.
- *
- * @param x2 the x coordinate of the curve’s new end
- * point.
- *
- * @param y2 the y coordinate of the curve’s new end
- * point.
- */
- public void setCurve(double x1, double y1, double cx1, double cy1,
- double cx2, double cy2, double x2, double y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx1 = cx1;
- ctrly1 = cy1;
- ctrlx2 = cx2;
- ctrly2 = cy2;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Determines the smallest rectangle that encloses the
- * curve’s start, end and control points. As the
- * illustration below shows, the invisible control points may cause
- * the bounds to be much larger than the area that is actually
- * covered by the curve.
- *
- *
- */
- public Rectangle2D getBounds2D()
- {
- double nx1 = Math.min(Math.min(x1, ctrlx1), Math.min(ctrlx2, x2));
- double ny1 = Math.min(Math.min(y1, ctrly1), Math.min(ctrly2, y2));
- double nx2 = Math.max(Math.max(x1, ctrlx1), Math.max(ctrlx2, x2));
- double ny2 = Math.max(Math.max(y1, ctrly1), Math.max(ctrly2, y2));
- return new Rectangle2D.Double(nx1, ny1, nx2 - nx1, ny2 - ny1);
- }
- }
-
- /**
- * A two-dimensional curve that is parameterized with a cubic
- * function and stores coordinate values in single-precision
- * floating-point format.
- *
- * @see CubicCurve2D.Float
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
- public static class Float extends CubicCurve2D
- {
- /**
- * The x coordinate of the curve’s start point.
- */
- public float x1;
-
- /**
- * The y coordinate of the curve’s start point.
- */
- public float y1;
-
- /**
- * The x coordinate of the curve’s first control point.
- */
- public float ctrlx1;
-
- /**
- * The y coordinate of the curve’s first control point.
- */
- public float ctrly1;
-
- /**
- * The x coordinate of the curve’s second control point.
- */
- public float ctrlx2;
-
- /**
- * The y coordinate of the curve’s second control point.
- */
- public float ctrly2;
-
- /**
- * The x coordinate of the curve’s end point.
- */
- public float x2;
-
- /**
- * The y coordinate of the curve’s end point.
- */
- public float y2;
-
- /**
- * Constructs a new CubicCurve2D that stores its coordinate values
- * in single-precision floating-point format. All points are
- * initially at position (0, 0).
- */
- public Float()
- {
- }
-
- /**
- * Constructs a new CubicCurve2D that stores its coordinate values
- * in single-precision floating-point format, specifying the
- * initial position of each point.
- *
- *
- *
- * @param x1 the x coordinate of the curve’s start
- * point.
- *
- * @param y1 the y coordinate of the curve’s start
- * point.
- *
- * @param cx1 the x coordinate of the curve’s first
- * control point.
- *
- * @param cy1 the y coordinate of the curve’s first
- * control point.
- *
- * @param cx2 the x coordinate of the curve’s second
- * control point.
- *
- * @param cy2 the y coordinate of the curve’s second
- * control point.
- *
- * @param x2 the x coordinate of the curve’s end
- * point.
- *
- * @param y2 the y coordinate of the curve’s end
- * point.
- */
- public Float(float x1, float y1, float cx1, float cy1, float cx2,
- float cy2, float x2, float y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx1 = cx1;
- ctrly1 = cy1;
- ctrlx2 = cx2;
- ctrly2 = cy2;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Returns the x coordinate of the curve’s start
- * point.
- */
- public double getX1()
- {
- return x1;
- }
-
- /**
- * Returns the y coordinate of the curve’s start
- * point.
- */
- public double getY1()
- {
- return y1;
- }
-
- /**
- * Returns the curve’s start point.
- */
- public Point2D getP1()
- {
- return new Point2D.Float(x1, y1);
- }
-
- /**
- * Returns the x coordinate of the curve’s first
- * control point.
- */
- public double getCtrlX1()
- {
- return ctrlx1;
- }
-
- /**
- * Returns the y coordinate of the curve’s first
- * control point.
- */
- public double getCtrlY1()
- {
- return ctrly1;
- }
-
- /**
- * Returns the curve’s first control point.
- */
- public Point2D getCtrlP1()
- {
- return new Point2D.Float(ctrlx1, ctrly1);
- }
-
- /**
- * Returns the s coordinate of the curve’s second
- * control point.
- */
- public double getCtrlX2()
- {
- return ctrlx2;
- }
-
- /**
- * Returns the y coordinate of the curve’s second
- * control point.
- */
- public double getCtrlY2()
- {
- return ctrly2;
- }
-
- /**
- * Returns the curve’s second control point.
- */
- public Point2D getCtrlP2()
- {
- return new Point2D.Float(ctrlx2, ctrly2);
- }
-
- /**
- * Returns the x coordinate of the curve’s end
- * point.
- */
- public double getX2()
- {
- return x2;
- }
-
- /**
- * Returns the y coordinate of the curve’s end
- * point.
- */
- public double getY2()
- {
- return y2;
- }
-
- /**
- * Returns the curve’s end point.
- */
- public Point2D getP2()
- {
- return new Point2D.Float(x2, y2);
- }
-
- /**
- * Changes the curve geometry, separately specifying each coordinate
- * value as a double-precision floating-point number.
- *
- *
- *
- * @param x1 the x coordinate of the curve’s new start
- * point.
- *
- * @param y1 the y coordinate of the curve’s new start
- * point.
- *
- * @param cx1 the x coordinate of the curve’s new
- * first control point.
- *
- * @param cy1 the y coordinate of the curve’s new
- * first control point.
- *
- * @param cx2 the x coordinate of the curve’s new
- * second control point.
- *
- * @param cy2 the y coordinate of the curve’s new
- * second control point.
- *
- * @param x2 the x coordinate of the curve’s new end
- * point.
- *
- * @param y2 the y coordinate of the curve’s new end
- * point.
- */
- public void setCurve(double x1, double y1, double cx1, double cy1,
- double cx2, double cy2, double x2, double y2)
- {
- this.x1 = (float) x1;
- this.y1 = (float) y1;
- ctrlx1 = (float) cx1;
- ctrly1 = (float) cy1;
- ctrlx2 = (float) cx2;
- ctrly2 = (float) cy2;
- this.x2 = (float) x2;
- this.y2 = (float) y2;
- }
-
- /**
- * Changes the curve geometry, separately specifying each coordinate
- * value as a single-precision floating-point number.
- *
- *
- *
- * @param x1 the x coordinate of the curve’s new start
- * point.
- *
- * @param y1 the y coordinate of the curve’s new start
- * point.
- *
- * @param cx1 the x coordinate of the curve’s new
- * first control point.
- *
- * @param cy1 the y coordinate of the curve’s new
- * first control point.
- *
- * @param cx2 the x coordinate of the curve’s new
- * second control point.
- *
- * @param cy2 the y coordinate of the curve’s new
- * second control point.
- *
- * @param x2 the x coordinate of the curve’s new end
- * point.
- *
- * @param y2 the y coordinate of the curve’s new end
- * point.
- */
- public void setCurve(float x1, float y1, float cx1, float cy1, float cx2,
- float cy2, float x2, float y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx1 = cx1;
- ctrly1 = cy1;
- ctrlx2 = cx2;
- ctrly2 = cy2;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Determines the smallest rectangle that encloses the
- * curve’s start, end and control points. As the
- * illustration below shows, the invisible control points may cause
- * the bounds to be much larger than the area that is actually
- * covered by the curve.
- *
- *
- */
- public Rectangle2D getBounds2D()
- {
- float nx1 = (float) Math.min(Math.min(x1, ctrlx1), Math.min(ctrlx2, x2));
- float ny1 = (float) Math.min(Math.min(y1, ctrly1), Math.min(ctrly2, y2));
- float nx2 = (float) Math.max(Math.max(x1, ctrlx1), Math.max(ctrlx2, x2));
- float ny2 = (float) Math.max(Math.max(y1, ctrly1), Math.max(ctrly2, y2));
- return new Rectangle2D.Float(nx1, ny1, nx2 - nx1, ny2 - ny1);
- }
- }
-}
diff --git a/libjava/java/awt/geom/Dimension2D.java b/libjava/java/awt/geom/Dimension2D.java
deleted file mode 100644
index 6b5ce8830a9..00000000000
--- a/libjava/java/awt/geom/Dimension2D.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Dimension2D.java -- abstraction of a dimension
- Copyright (C) 1999, 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.geom;
-
-/**
- * This stores a dimension in 2-dimensional space - a width (along the x-axis)
- * and height (along the y-axis). The storage is left to subclasses.
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public abstract class Dimension2D implements Cloneable
-{
- /**
- * The default constructor.
- */
- protected Dimension2D()
- {
- }
-
- /**
- * Get the width of this dimension. A negative result, while legal, is
- * undefined in meaning.
- *
- * @return the width
- */
- public abstract double getWidth();
-
- /**
- * Get the height of this dimension. A negative result, while legal, is
- * undefined in meaning.
- *
- * @return the height
- */
- public abstract double getHeight();
-
- /**
- * Set the size of this dimension to the requested values. Loss of precision
- * may occur.
- *
- * @param w the new width
- * @param h the new height
- */
- public abstract void setSize(double w, double h);
-
- /**
- * Set the size of this dimension to the requested value. Loss of precision
- * may occur.
- *
- * @param d the dimension containing the new values
- *
- * @throws NullPointerException if d is null
- */
- public void setSize(Dimension2D d)
- {
- setSize(d.getWidth(), d.getHeight());
- }
-
- /**
- * Create a new dimension of the same run-time type with the same contents
- * as this one.
- *
- * @return the clone
- *
- * @exception OutOfMemoryError If there is not enough memory available.
- *
- * @since 1.2
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-} // class Dimension2D
diff --git a/libjava/java/awt/geom/Ellipse2D.java b/libjava/java/awt/geom/Ellipse2D.java
deleted file mode 100644
index e8830770f60..00000000000
--- a/libjava/java/awt/geom/Ellipse2D.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/* Ellipse2D.java -- represents an ellipse in 2-D space
- Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-
-/**
- * Ellipse2D is the shape of an ellipse.
- *
- *
- * The ellipse is defined by it's bounding box (shown in red),
- * and is defined by the implicit curve:
- * (x/a)2 +
- * (y/b)2 = 1
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- *
- * @since 1.2
- */
-public abstract class Ellipse2D extends RectangularShape
-{
- /**
- * Ellipse2D is defined as abstract.
- * Implementing classes are Ellipse2D.Float and Ellipse2D.Double.
- */
- protected Ellipse2D()
- {
- }
-
- /**
- * Determines if a point is contained within the ellipse. double
- * primitives.
- */
- public static class Double extends Ellipse2D
- {
- /**
- * The height of the ellipse.
- */
- public double height;
-
- /**
- * The width of the ellipse.
- */
- public double width;
-
- /**
- * The upper-left x coordinate of the bounding-box
- */
- public double x;
-
- /**
- * The upper-left y coordinate of the bounding-box
- */
- public double y;
-
- /**
- * Creates a new Ellipse2D with an upper-left coordinate of (0,0)
- * and a zero size.
- */
- public Double()
- {
- }
-
- /**
- * Creates a new Ellipse2D within a given rectangle
- * using double-precision coordinates.true
if the ellipse encloses no area, and
- * false
otherwise.
- *
- * @return A boolean.
- */
- public boolean isEmpty()
- {
- return height <= 0 || width <= 0;
- }
-
- /**
- * Sets the geometry of the ellipse's bounding box.float
- * primitives.
- */
- public static class Float extends Ellipse2D
- {
- /**
- * The height of the ellipse.
- */
- public float height;
-
- /**
- * The width of the ellipse.
- */
- public float width;
-
- /**
- * The upper-left x coordinate of the bounding-box
- */
- public float x;
-
- /**
- * The upper-left y coordinate of the bounding-box
- */
- public float y;
-
- /**
- * Creates a new Ellipse2D with an upper-left coordinate of (0,0)
- * and a zero size.
- */
- public Float()
- {
- }
-
- /**
- * Creates a new Ellipse2D within a given rectangle
- * using floating-point precision.true
if the ellipse encloses no area, and
- * false
otherwise.
- *
- * @return A boolean.
- */
- public boolean isEmpty()
- {
- return height <= 0 || width <= 0;
- }
-
- /**
- * Sets the geometry of the ellipse's bounding box.
- *
- * SEG_QUADTO
or
- * SEG_CUBICTO
segment is approximated by at most
- * 210 = 1024 straight lines.
- */
- public FlatteningPathIterator(PathIterator src, double flatness)
- {
- this(src, flatness, 10);
- }
-
-
- /**
- * Constructs a new PathIterator for approximating an input
- * PathIterator with straight lines. The approximation works by
- * recursive subdivisons, until the specified flatness threshold is
- * not exceeded. Additionally, the number of recursions is also
- * bound by the specified recursion limit.
- */
- public FlatteningPathIterator(PathIterator src, double flatness,
- int limit)
- {
- if (flatness < 0 || limit < 0)
- throw new IllegalArgumentException();
-
- srcIter = src;
- flatnessSq = flatness * flatness;
- recursionLimit = limit;
- fetchSegment();
- }
-
-
- /**
- * Returns the maximally acceptable flatness.
- *
- * @see QuadCurve2D#getFlatness()
- * @see CubicCurve2D#getFlatness()
- */
- public double getFlatness()
- {
- return Math.sqrt(flatnessSq);
- }
-
-
- /**
- * Returns the maximum number of recursive curve subdivisions.
- */
- public int getRecursionLimit()
- {
- return recursionLimit;
- }
-
-
- // Documentation will be copied from PathIterator.
- public int getWindingRule()
- {
- return srcIter.getWindingRule();
- }
-
-
- // Documentation will be copied from PathIterator.
- public boolean isDone()
- {
- return done;
- }
-
-
- // Documentation will be copied from PathIterator.
- public void next()
- {
- if (stackSize > 0)
- {
- --stackSize;
- if (stackSize > 0)
- {
- switch (srcSegType)
- {
- case PathIterator.SEG_QUADTO:
- subdivideQuadratic();
- return;
-
- case PathIterator.SEG_CUBICTO:
- subdivideCubic();
- return;
-
- default:
- throw new IllegalStateException();
- }
- }
- }
-
- srcIter.next();
- fetchSegment();
- }
-
-
- // Documentation will be copied from PathIterator.
- public int currentSegment(double[] coords)
- {
- if (done)
- throw new NoSuchElementException();
-
- switch (srcSegType)
- {
- case PathIterator.SEG_CLOSE:
- return srcSegType;
-
- case PathIterator.SEG_MOVETO:
- case PathIterator.SEG_LINETO:
- coords[0] = srcPosX;
- coords[1] = srcPosY;
- return srcSegType;
-
- case PathIterator.SEG_QUADTO:
- if (stackSize == 0)
- {
- coords[0] = srcPosX;
- coords[1] = srcPosY;
- }
- else
- {
- int sp = stack.length - 4 * stackSize;
- coords[0] = stack[sp + 2];
- coords[1] = stack[sp + 3];
- }
- return PathIterator.SEG_LINETO;
-
- case PathIterator.SEG_CUBICTO:
- if (stackSize == 0)
- {
- coords[0] = srcPosX;
- coords[1] = srcPosY;
- }
- else
- {
- int sp = stack.length - 6 * stackSize;
- coords[0] = stack[sp + 4];
- coords[1] = stack[sp + 5];
- }
- return PathIterator.SEG_LINETO;
- }
-
- throw new IllegalStateException();
- }
-
-
- // Documentation will be copied from PathIterator.
- public int currentSegment(float[] coords)
- {
- if (done)
- throw new NoSuchElementException();
-
- switch (srcSegType)
- {
- case PathIterator.SEG_CLOSE:
- return srcSegType;
-
- case PathIterator.SEG_MOVETO:
- case PathIterator.SEG_LINETO:
- coords[0] = (float) srcPosX;
- coords[1] = (float) srcPosY;
- return srcSegType;
-
- case PathIterator.SEG_QUADTO:
- if (stackSize == 0)
- {
- coords[0] = (float) srcPosX;
- coords[1] = (float) srcPosY;
- }
- else
- {
- int sp = stack.length - 4 * stackSize;
- coords[0] = (float) stack[sp + 2];
- coords[1] = (float) stack[sp + 3];
- }
- return PathIterator.SEG_LINETO;
-
- case PathIterator.SEG_CUBICTO:
- if (stackSize == 0)
- {
- coords[0] = (float) srcPosX;
- coords[1] = (float) srcPosY;
- }
- else
- {
- int sp = stack.length - 6 * stackSize;
- coords[0] = (float) stack[sp + 4];
- coords[1] = (float) stack[sp + 5];
- }
- return PathIterator.SEG_LINETO;
- }
-
- throw new IllegalStateException();
- }
-
-
- /**
- * Fetches the next segment from the source iterator.
- */
- private void fetchSegment()
- {
- int sp;
-
- if (srcIter.isDone())
- {
- done = true;
- return;
- }
-
- srcSegType = srcIter.currentSegment(scratch);
-
- switch (srcSegType)
- {
- case PathIterator.SEG_CLOSE:
- return;
-
- case PathIterator.SEG_MOVETO:
- case PathIterator.SEG_LINETO:
- srcPosX = scratch[0];
- srcPosY = scratch[1];
- return;
-
- case PathIterator.SEG_QUADTO:
- if (recursionLimit == 0)
- {
- srcPosX = scratch[2];
- srcPosY = scratch[3];
- stackSize = 0;
- return;
- }
- sp = 4 * recursionLimit;
- stackSize = 1;
- if (stack == null)
- {
- stack = new double[sp + /* 4 + 2 */ 6];
- recLevel = new int[recursionLimit + 1];
- }
- recLevel[0] = 0;
- stack[sp] = srcPosX; // P1.x
- stack[sp + 1] = srcPosY; // P1.y
- stack[sp + 2] = scratch[0]; // C.x
- stack[sp + 3] = scratch[1]; // C.y
- srcPosX = stack[sp + 4] = scratch[2]; // P2.x
- srcPosY = stack[sp + 5] = scratch[3]; // P2.y
- subdivideQuadratic();
- break;
-
- case PathIterator.SEG_CUBICTO:
- if (recursionLimit == 0)
- {
- srcPosX = scratch[4];
- srcPosY = scratch[5];
- stackSize = 0;
- return;
- }
- sp = 6 * recursionLimit;
- stackSize = 1;
- if ((stack == null) || (stack.length < sp + 8))
- {
- stack = new double[sp + /* 6 + 2 */ 8];
- recLevel = new int[recursionLimit + 1];
- }
- recLevel[0] = 0;
- stack[sp] = srcPosX; // P1.x
- stack[sp + 1] = srcPosY; // P1.y
- stack[sp + 2] = scratch[0]; // C1.x
- stack[sp + 3] = scratch[1]; // C1.y
- stack[sp + 4] = scratch[2]; // C2.x
- stack[sp + 5] = scratch[3]; // C2.y
- srcPosX = stack[sp + 6] = scratch[4]; // P2.x
- srcPosY = stack[sp + 7] = scratch[5]; // P2.y
- subdivideCubic();
- return;
- }
- }
-
-
- /**
- * Repeatedly subdivides the quadratic curve segment that is on top
- * of the stack. The iteration terminates when the recursion limit
- * has been reached, or when the resulting segment is flat enough.
- */
- private void subdivideQuadratic()
- {
- int sp;
- int level;
-
- sp = stack.length - 4 * stackSize - 2;
- level = recLevel[stackSize - 1];
- while ((level < recursionLimit)
- && (QuadCurve2D.getFlatnessSq(stack, sp) >= flatnessSq))
- {
- recLevel[stackSize] = recLevel[stackSize - 1] = ++level;
- QuadCurve2D.subdivide(stack, sp, stack, sp - 4, stack, sp);
- ++stackSize;
- sp -= 4;
- }
- }
-
-
- /**
- * Repeatedly subdivides the cubic curve segment that is on top
- * of the stack. The iteration terminates when the recursion limit
- * has been reached, or when the resulting segment is flat enough.
- */
- private void subdivideCubic()
- {
- int sp;
- int level;
-
- sp = stack.length - 6 * stackSize - 2;
- level = recLevel[stackSize - 1];
- while ((level < recursionLimit)
- && (CubicCurve2D.getFlatnessSq(stack, sp) >= flatnessSq))
- {
- recLevel[stackSize] = recLevel[stackSize - 1] = ++level;
-
- CubicCurve2D.subdivide(stack, sp, stack, sp - 6, stack, sp);
- ++stackSize;
- sp -= 6;
- }
- }
-
-
- /* These routines were useful for debugging. Since they would
- * just bloat the implementation, they are commented out.
- *
- *
-
- private static String segToString(int segType, double[] d, int offset)
- {
- String s;
-
- switch (segType)
- {
- case PathIterator.SEG_CLOSE:
- return "SEG_CLOSE";
-
- case PathIterator.SEG_MOVETO:
- return "SEG_MOVETO (" + d[offset] + ", " + d[offset + 1] + ")";
-
- case PathIterator.SEG_LINETO:
- return "SEG_LINETO (" + d[offset] + ", " + d[offset + 1] + ")";
-
- case PathIterator.SEG_QUADTO:
- return "SEG_QUADTO (" + d[offset] + ", " + d[offset + 1]
- + ") (" + d[offset + 2] + ", " + d[offset + 3] + ")";
-
- case PathIterator.SEG_CUBICTO:
- return "SEG_CUBICTO (" + d[offset] + ", " + d[offset + 1]
- + ") (" + d[offset + 2] + ", " + d[offset + 3]
- + ") (" + d[offset + 4] + ", " + d[offset + 5] + ")";
- }
-
- throw new IllegalStateException();
- }
-
-
- private void dumpQuadraticStack(String msg)
- {
- int sp = stack.length - 4 * stackSize - 2;
- int i = 0;
- System.err.print(" " + msg + ":");
- while (sp < stack.length)
- {
- System.err.print(" (" + stack[sp] + ", " + stack[sp+1] + ")");
- if (i < recLevel.length)
- System.out.print("/" + recLevel[i++]);
- if (sp + 3 < stack.length)
- System.err.print(" [" + stack[sp+2] + ", " + stack[sp+3] + "]");
- sp += 4;
- }
- System.err.println();
- }
-
-
- private void dumpCubicStack(String msg)
- {
- int sp = stack.length - 6 * stackSize - 2;
- int i = 0;
- System.err.print(" " + msg + ":");
- while (sp < stack.length)
- {
- System.err.print(" (" + stack[sp] + ", " + stack[sp+1] + ")");
- if (i < recLevel.length)
- System.out.print("/" + recLevel[i++]);
- if (sp + 3 < stack.length)
- {
- System.err.print(" [" + stack[sp+2] + ", " + stack[sp+3] + "]");
- System.err.print(" [" + stack[sp+4] + ", " + stack[sp+5] + "]");
- }
- sp += 6;
- }
- System.err.println();
- }
-
- *
- *
- */
-}
diff --git a/libjava/java/awt/geom/GeneralPath.java b/libjava/java/awt/geom/GeneralPath.java
deleted file mode 100644
index f54855874dc..00000000000
--- a/libjava/java/awt/geom/GeneralPath.java
+++ /dev/null
@@ -1,958 +0,0 @@
-/* GeneralPath.java -- represents a shape built from subpaths
- Copyright (C) 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.geom;
-
-import java.awt.Rectangle;
-import java.awt.Shape;
-
-
-/**
- * A general geometric path, consisting of any number of subpaths
- * constructed out of straight lines and cubic or quadratic Bezier
- * curves.
- *
- *
- *
connect
is
- * true, the new path segments are connected to the existing one with a line.
- * The winding rule of the Shape is ignored.
- */
- public void append(Shape s, boolean connect)
- {
- append(s.getPathIterator(null), connect);
- }
-
- /**
- * Appends the segments of a PathIterator to this GeneralPath.
- * Optionally, the initial {@link PathIterator#SEG_MOVETO} segment
- * of the appended path is changed into a {@link
- * PathIterator#SEG_LINETO} segment.
- *
- * @param iter the PathIterator specifying which segments shall be
- * appended.
- *
- * @param connect true
for substituting the initial
- * {@link PathIterator#SEG_MOVETO} segment by a {@link
- * PathIterator#SEG_LINETO}, or false
for not
- * performing any substitution. If this GeneralPath is currently
- * empty, connect
is assumed to be false
,
- * thus leaving the initial {@link PathIterator#SEG_MOVETO}
- * unchanged.
- */
- public void append(PathIterator iter, boolean connect)
- {
- // A bad implementation of this method had caused Classpath bug #6076.
- float[] f = new float[6];
- while (! iter.isDone())
- {
- switch (iter.currentSegment(f))
- {
- case PathIterator.SEG_MOVETO:
- if (! connect || (index == 0))
- {
- moveTo(f[0], f[1]);
- break;
- }
- if ((index >= 1) && (types[index - 1] == PathIterator.SEG_CLOSE)
- && (f[0] == xpoints[index - 1])
- && (f[1] == ypoints[index - 1]))
- break;
-
- // Fall through.
- case PathIterator.SEG_LINETO:
- lineTo(f[0], f[1]);
- break;
- case PathIterator.SEG_QUADTO:
- quadTo(f[0], f[1], f[2], f[3]);
- break;
- case PathIterator.SEG_CUBICTO:
- curveTo(f[0], f[1], f[2], f[3], f[4], f[5]);
- break;
- case PathIterator.SEG_CLOSE:
- closePath();
- break;
- }
-
- connect = false;
- iter.next();
- }
- }
-
- /**
- * Returns the path’s current winding rule.
- */
- public int getWindingRule()
- {
- return rule;
- }
-
- /**
- * Sets the path’s winding rule, which controls which areas are
- * considered ’inside’ or ’outside’ the path
- * on drawing. Valid rules are WIND_EVEN_ODD for an even-odd winding rule,
- * or WIND_NON_ZERO for a non-zero winding rule.
- */
- public void setWindingRule(int rule)
- {
- if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO)
- throw new IllegalArgumentException();
- this.rule = rule;
- }
-
- /**
- * Returns the current appending point of the path.
- */
- public Point2D getCurrentPoint()
- {
- if (subpath < 0)
- return null;
- return new Point2D.Float(xpoints[index - 1], ypoints[index - 1]);
- }
-
- /**
- * Resets the path. All points and segments are destroyed.
- */
- public void reset()
- {
- subpath = -1;
- index = 0;
- }
-
- /**
- * Applies a transform to the path.
- */
- public void transform(AffineTransform xform)
- {
- double nx;
- double ny;
- double[] m = new double[6];
- xform.getMatrix(m);
- for (int i = 0; i < index; i++)
- {
- nx = m[0] * xpoints[i] + m[2] * ypoints[i] + m[4];
- ny = m[1] * xpoints[i] + m[3] * ypoints[i] + m[5];
- xpoints[i] = (float) nx;
- ypoints[i] = (float) ny;
- }
- }
-
- /**
- * Creates a transformed version of the path.
- * @param xform the transform to apply
- * @return a new transformed GeneralPath
- */
- public Shape createTransformedShape(AffineTransform xform)
- {
- GeneralPath p = new GeneralPath(this);
- p.transform(xform);
- return p;
- }
-
- /**
- * Returns the path’s bounding box.
- */
- public Rectangle getBounds()
- {
- return getBounds2D().getBounds();
- }
-
- /**
- * Returns the path’s bounding box, in float
precision
- */
- public Rectangle2D getBounds2D()
- {
- float x1;
- float y1;
- float x2;
- float y2;
-
- if (index > 0)
- {
- x1 = x2 = xpoints[0];
- y1 = y2 = ypoints[0];
- }
- else
- x1 = x2 = y1 = y2 = 0.0f;
-
- for (int i = 0; i < index; i++)
- {
- x1 = Math.min(xpoints[i], x1);
- y1 = Math.min(ypoints[i], y1);
- x2 = Math.max(xpoints[i], x2);
- y2 = Math.max(ypoints[i], y2);
- }
- return (new Rectangle2D.Float(x1, y1, x2 - x1, y2 - y1));
- }
-
- /**
- * Evaluates if a point is within the GeneralPath,
- * The NON_ZERO winding rule is used, regardless of the
- * set winding rule.
- * @param x x coordinate of the point to evaluate
- * @param y y coordinate of the point to evaluate
- * @return true if the point is within the path, false otherwise
- */
- public boolean contains(double x, double y)
- {
- return (getWindingNumber(x, y) != 0);
- }
-
- /**
- * Evaluates if a Point2D is within the GeneralPath,
- * The NON_ZERO winding rule is used, regardless of the
- * set winding rule.
- * @param p The Point2D to evaluate
- * @return true if the point is within the path, false otherwise
- */
- public boolean contains(Point2D p)
- {
- return contains(p.getX(), p.getY());
- }
-
- /**
- * Evaluates if a rectangle is completely contained within the path.
- * This method will return false in the cases when the box
- * intersects an inner segment of the path.
- * (i.e.: The method is accurate for the EVEN_ODD winding rule)
- */
- public boolean contains(double x, double y, double w, double h)
- {
- if (! getBounds2D().intersects(x, y, w, h))
- return false;
-
- /* Does any edge intersect? */
- if (getAxisIntersections(x, y, false, w) != 0 /* top */
- || getAxisIntersections(x, y + h, false, w) != 0 /* bottom */
- || getAxisIntersections(x + w, y, true, h) != 0 /* right */
- || getAxisIntersections(x, y, true, h) != 0) /* left */
- return false;
-
- /* No intersections, is any point inside? */
- if (getWindingNumber(x, y) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Evaluates if a rectangle is completely contained within the path.
- * This method will return false in the cases when the box
- * intersects an inner segment of the path.
- * (i.e.: The method is accurate for the EVEN_ODD winding rule)
- * @param r the rectangle
- * @return true
if the rectangle is completely contained
- * within the path, false
otherwise
- */
- public boolean contains(Rectangle2D r)
- {
- return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Evaluates if a rectangle intersects the path.
- * @param x x coordinate of the rectangle
- * @param y y coordinate of the rectangle
- * @param w width of the rectangle
- * @param h height of the rectangle
- * @return true
if the rectangle intersects the path,
- * false
otherwise
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- /* Does any edge intersect? */
- if (getAxisIntersections(x, y, false, w) != 0 /* top */
- || getAxisIntersections(x, y + h, false, w) != 0 /* bottom */
- || getAxisIntersections(x + w, y, true, h) != 0 /* right */
- || getAxisIntersections(x, y, true, h) != 0) /* left */
- return true;
-
- /* No intersections, is any point inside? */
- if (getWindingNumber(x, y) != 0)
- return true;
-
- return false;
- }
-
- /**
- * Evaluates if a Rectangle2D intersects the path.
- * @param r The rectangle
- * @return true
if the rectangle intersects the path,
- * false
otherwise
- */
- public boolean intersects(Rectangle2D r)
- {
- return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * A PathIterator that iterates over the segments of a GeneralPath.
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
- private static class GeneralPathIterator implements PathIterator
- {
- /**
- * The number of coordinate values for each segment type.
- */
- private static final int[] NUM_COORDS = {
- /* 0: SEG_MOVETO */ 1,
- /* 1: SEG_LINETO */ 1,
- /* 2: SEG_QUADTO */ 2,
- /* 3: SEG_CUBICTO */ 3,
- /* 4: SEG_CLOSE */ 0};
-
- /**
- * The GeneralPath whose segments are being iterated.
- * This is package-private to avoid an accessor method.
- */
- final GeneralPath path;
-
- /**
- * The affine transformation used to transform coordinates.
- */
- private final AffineTransform transform;
-
- /**
- * The current position of the iterator.
- */
- private int pos;
-
- /**
- * Constructs a new iterator for enumerating the segments of a
- * GeneralPath.
- *
- * @param at an affine transformation for projecting the returned
- * points, or null
to return the original points
- * without any mapping.
- */
- GeneralPathIterator(GeneralPath path, AffineTransform transform)
- {
- this.path = path;
- this.transform = transform;
- }
-
- /**
- * Returns the current winding rule of the GeneralPath.
- */
- public int getWindingRule()
- {
- return path.rule;
- }
-
- /**
- * Determines whether the iterator has reached the last segment in
- * the path.
- */
- public boolean isDone()
- {
- return pos >= path.index;
- }
-
- /**
- * Advances the iterator position by one segment.
- */
- public void next()
- {
- int seg;
-
- /*
- * Increment pos by the number of coordinate pairs.
- */
- seg = path.types[pos];
- if (seg == SEG_CLOSE)
- pos++;
- else
- pos += NUM_COORDS[seg];
- }
-
- /**
- * Returns the current segment in float coordinates.
- */
- public int currentSegment(float[] coords)
- {
- int seg;
- int numCoords;
-
- seg = path.types[pos];
- numCoords = NUM_COORDS[seg];
- if (numCoords > 0)
- {
- for (int i = 0; i < numCoords; i++)
- {
- coords[i << 1] = path.xpoints[pos + i];
- coords[(i << 1) + 1] = path.ypoints[pos + i];
- }
-
- if (transform != null)
- transform.transform( /* src */
- coords, /* srcOffset */
- 0, /* dest */ coords, /* destOffset */
- 0, /* numPoints */ numCoords);
- }
- return seg;
- }
-
- /**
- * Returns the current segment in double coordinates.
- */
- public int currentSegment(double[] coords)
- {
- int seg;
- int numCoords;
-
- seg = path.types[pos];
- numCoords = NUM_COORDS[seg];
- if (numCoords > 0)
- {
- for (int i = 0; i < numCoords; i++)
- {
- coords[i << 1] = (double) path.xpoints[pos + i];
- coords[(i << 1) + 1] = (double) path.ypoints[pos + i];
- }
- if (transform != null)
- transform.transform( /* src */
- coords, /* srcOffset */
- 0, /* dest */ coords, /* destOffset */
- 0, /* numPoints */ numCoords);
- }
- return seg;
- }
- }
-
- /**
- * Creates a PathIterator for iterating along the segments of the path.
- *
- * @param at an affine transformation for projecting the returned
- * points, or null
to let the created iterator return
- * the original points without any mapping.
- */
- public PathIterator getPathIterator(AffineTransform at)
- {
- return new GeneralPathIterator(this, at);
- }
-
- /**
- * Creates a new FlatteningPathIterator for the path
- */
- public PathIterator getPathIterator(AffineTransform at, double flatness)
- {
- return new FlatteningPathIterator(getPathIterator(at), flatness);
- }
-
- /**
- * Creates a new shape of the same run-time type with the same contents
- * as this one.
- *
- * @return the clone
- *
- * @exception OutOfMemoryError If there is not enough memory available.
- *
- * @since 1.2
- */
- public Object clone()
- {
- // This class is final; no need to use super.clone().
- return new GeneralPath(this);
- }
-
- /**
- * Helper method - ensure the size of the data arrays,
- * otherwise, reallocate new ones twice the size
- */
- private void ensureSize(int size)
- {
- if (subpath < 0)
- throw new IllegalPathStateException("need initial moveto");
- if (size <= xpoints.length)
- return;
- byte[] b = new byte[types.length << 1];
- System.arraycopy(types, 0, b, 0, index);
- types = b;
- float[] f = new float[xpoints.length << 1];
- System.arraycopy(xpoints, 0, f, 0, index);
- xpoints = f;
- f = new float[ypoints.length << 1];
- System.arraycopy(ypoints, 0, f, 0, index);
- ypoints = f;
- }
-
- /**
- * Helper method - Get the total number of intersections from (x,y) along
- * a given axis, within a given distance.
- */
- private int getAxisIntersections(double x, double y, boolean useYaxis,
- double distance)
- {
- return (evaluateCrossings(x, y, false, useYaxis, distance));
- }
-
- /**
- * Helper method - returns the winding number of a point.
- */
- private int getWindingNumber(double x, double y)
- {
- /* Evaluate the crossings from x,y to infinity on the y axis (arbitrary
- choice). Note that we don't actually use Double.INFINITY, since that's
- slower, and may cause problems. */
- return (evaluateCrossings(x, y, true, true, BIG_VALUE));
- }
-
- /**
- * Helper method - evaluates the number of intersections on an axis from
- * the point (x,y) to the point (x,y+distance) or (x+distance,y).
- * @param x x coordinate.
- * @param y y coordinate.
- * @param neg True if opposite-directed intersections should cancel,
- * false to sum all intersections.
- * @param useYaxis Use the Y axis, false uses the X axis.
- * @param distance Interval from (x,y) on the selected axis to find
- * intersections.
- */
- private int evaluateCrossings(double x, double y, boolean neg,
- boolean useYaxis, double distance)
- {
- float cx = 0.0f;
- float cy = 0.0f;
- float firstx = 0.0f;
- float firsty = 0.0f;
-
- int negative = (neg) ? -1 : 1;
- double x0;
- double x1;
- double x2;
- double x3;
- double y0;
- double y1;
- double y2;
- double y3;
- double[] r = new double[4];
- int nRoots;
- double epsilon = 0.0;
- int pos = 0;
- int windingNumber = 0;
- boolean pathStarted = false;
-
- if (index == 0)
- return (0);
- if (useYaxis)
- {
- float[] swap1;
- swap1 = ypoints;
- ypoints = xpoints;
- xpoints = swap1;
- double swap2;
- swap2 = y;
- y = x;
- x = swap2;
- }
-
- /* Get a value which is hopefully small but not insignificant relative
- the path. */
- epsilon = ypoints[0] * 1E-7;
-
- if(epsilon == 0)
- epsilon = 1E-7;
-
- pos = 0;
- while (pos < index)
- {
- switch (types[pos])
- {
- case PathIterator.SEG_MOVETO:
- if (pathStarted) // close old path
- {
- x0 = cx;
- y0 = cy;
- x1 = firstx;
- y1 = firsty;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- epsilon, 0.0, distance, 0.0))
- windingNumber += (y1 < y0) ? 1 : negative;
-
- cx = firstx;
- cy = firsty;
- }
- cx = firstx = xpoints[pos] - (float) x;
- cy = firsty = ypoints[pos++] - (float) y;
- pathStarted = true;
- break;
- case PathIterator.SEG_CLOSE:
- x0 = cx;
- y0 = cy;
- x1 = firstx;
- y1 = firsty;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- epsilon, 0.0, distance, 0.0))
- windingNumber += (y1 < y0) ? 1 : negative;
-
- cx = firstx;
- cy = firsty;
- pos++;
- pathStarted = false;
- break;
- case PathIterator.SEG_LINETO:
- x0 = cx;
- y0 = cy;
- x1 = xpoints[pos] - (float) x;
- y1 = ypoints[pos++] - (float) y;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- epsilon, 0.0, distance, 0.0))
- windingNumber += (y1 < y0) ? 1 : negative;
-
- cx = xpoints[pos - 1] - (float) x;
- cy = ypoints[pos - 1] - (float) y;
- break;
- case PathIterator.SEG_QUADTO:
- x0 = cx;
- y0 = cy;
- x1 = xpoints[pos] - x;
- y1 = ypoints[pos++] - y;
- x2 = xpoints[pos] - x;
- y2 = ypoints[pos++] - y;
-
- /* check if curve may intersect X+ axis. */
- if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0)
- && (y0 * y1 <= 0 || y1 * y2 <= 0))
- {
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y2 == 0.0)
- y2 -= epsilon;
-
- r[0] = y0;
- r[1] = 2 * (y1 - y0);
- r[2] = (y2 - 2 * y1 + y0);
-
- /* degenerate roots (=tangent points) do not
- contribute to the winding number. */
- if ((nRoots = QuadCurve2D.solveQuadratic(r)) == 2)
- for (int i = 0; i < nRoots; i++)
- {
- float t = (float) r[i];
- if (t > 0.0f && t < 1.0f)
- {
- double crossing = t * t * (x2 - 2 * x1 + x0)
- + 2 * t * (x1 - x0) + x0;
- if (crossing >= 0.0 && crossing <= distance)
- windingNumber += (2 * t * (y2 - 2 * y1 + y0)
- + 2 * (y1 - y0) < 0) ? 1 : negative;
- }
- }
- }
-
- cx = xpoints[pos - 1] - (float) x;
- cy = ypoints[pos - 1] - (float) y;
- break;
- case PathIterator.SEG_CUBICTO:
- x0 = cx;
- y0 = cy;
- x1 = xpoints[pos] - x;
- y1 = ypoints[pos++] - y;
- x2 = xpoints[pos] - x;
- y2 = ypoints[pos++] - y;
- x3 = xpoints[pos] - x;
- y3 = ypoints[pos++] - y;
-
- /* check if curve may intersect X+ axis. */
- if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0 || x3 > 0.0)
- && (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
- {
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y3 == 0.0)
- y3 -= epsilon;
-
- r[0] = y0;
- r[1] = 3 * (y1 - y0);
- r[2] = 3 * (y2 + y0 - 2 * y1);
- r[3] = y3 - 3 * y2 + 3 * y1 - y0;
-
- if ((nRoots = CubicCurve2D.solveCubic(r)) != 0)
- for (int i = 0; i < nRoots; i++)
- {
- float t = (float) r[i];
- if (t > 0.0 && t < 1.0)
- {
- double crossing = -(t * t * t) * (x0 - 3 * x1
- + 3 * x2 - x3)
- + 3 * t * t * (x0 - 2 * x1 + x2)
- + 3 * t * (x1 - x0) + x0;
- if (crossing >= 0 && crossing <= distance)
- windingNumber += (3 * t * t * (y3 + 3 * y1
- - 3 * y2 - y0)
- + 6 * t * (y0 - 2 * y1 + y2)
- + 3 * (y1 - y0) < 0) ? 1 : negative;
- }
- }
- }
-
- cx = xpoints[pos - 1] - (float) x;
- cy = ypoints[pos - 1] - (float) y;
- break;
- }
- }
-
- // swap coordinates back
- if (useYaxis)
- {
- float[] swap;
- swap = ypoints;
- ypoints = xpoints;
- xpoints = swap;
- }
- return (windingNumber);
- }
-} // class GeneralPath
-
diff --git a/libjava/java/awt/geom/IllegalPathStateException.java b/libjava/java/awt/geom/IllegalPathStateException.java
deleted file mode 100644
index 4d190c74814..00000000000
--- a/libjava/java/awt/geom/IllegalPathStateException.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* IllegalPathStateException.java -- an operation was in an illegal path state
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-/**
- * Thrown when an operation on a path is in an illegal state, such as appending
- * a segment to a GeneralPath
without an initial moveto.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @see GeneralPath
- * @status updated to 1.4
- */
-public class IllegalPathStateException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -5158084205220481094L;
-
- /**
- * Create an exception with no message.
- */
- public IllegalPathStateException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param msg the message
- */
- public IllegalPathStateException(String msg)
- {
- super(msg);
- }
-}
diff --git a/libjava/java/awt/geom/Line2D.java b/libjava/java/awt/geom/Line2D.java
deleted file mode 100644
index e15e7cfe3f5..00000000000
--- a/libjava/java/awt/geom/Line2D.java
+++ /dev/null
@@ -1,1182 +0,0 @@
-/* Line2D.java -- represents a line in 2-D space, plus operations on a line
- Copyright (C) 2000, 2001, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.util.NoSuchElementException;
-
-/**
- * Represents a directed line bewteen two points in (x,y) Cartesian space.
- * Remember, on-screen graphics have increasing x from left-to-right, and
- * increasing y from top-to-bottom. The storage is left to subclasses.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author David Gilbert
- * @since 1.2
- * @status updated to 1.4
- */
-public abstract class Line2D implements Shape, Cloneable
-{
- /**
- * The default constructor.
- */
- protected Line2D()
- {
- }
-
- /**
- * Return the x coordinate of the first point.
- *
- * @return the starting x coordinate
- */
- public abstract double getX1();
-
- /**
- * Return the y coordinate of the first point.
- *
- * @return the starting y coordinate
- */
- public abstract double getY1();
-
- /**
- * Return the first point.
- *
- * @return the starting point
- */
- public abstract Point2D getP1();
-
- /**
- * Return the x coordinate of the second point.
- *
- * @return the ending x coordinate
- */
- public abstract double getX2();
-
- /**
- * Return the y coordinate of the second point.
- *
- * @return the ending y coordinate
- */
- public abstract double getY2();
-
- /**
- * Return the second point.
- *
- * @return the ending point
- */
- public abstract Point2D getP2();
-
- /**
- * Set the coordinates of the line to the given coordinates. Loss of
- * precision may occur due to rounding issues.
- *
- * @param x1 the first x coordinate
- * @param y1 the first y coordinate
- * @param x2 the second x coordinate
- * @param y2 the second y coordinate
- */
- public abstract void setLine(double x1, double y1, double x2, double y2);
-
- /**
- * Set the coordinates to the given points.
- *
- * @param p1 the first point
- * @param p2 the second point
- * @throws NullPointerException if either point is null
- */
- public void setLine(Point2D p1, Point2D p2)
- {
- setLine(p1.getX(), p1.getY(), p2.getX(), p2.getY());
- }
-
- /**
- * Set the coordinates to those of the given line.
- *
- * @param l the line to copy
- * @throws NullPointerException if l is null
- */
- public void setLine(Line2D l)
- {
- setLine(l.getX1(), l.getY1(), l.getX2(), l.getY2());
- }
-
- /**
- * Computes the relative rotation direction needed to pivot the line about
- * the first point in order to have the second point colinear with point p.
- * Because of floating point rounding, don't expect this to be a perfect
- * measure of colinearity. The answer is 1 if the line has a shorter rotation
- * in the direction of the positive X axis to the negative Y axis
- * (counter-clockwise in the default Java coordinate system), or -1 if the
- * shortest rotation is in the opposite direction (clockwise). If p
- * is already colinear, the return value is -1 if it lies beyond the first
- * point, 0 if it lies in the segment, or 1 if it lies beyond the second
- * point. If the first and second point are coincident, this returns 0.
- *
- * @param x1 the first x coordinate
- * @param y1 the first y coordinate
- * @param x2 the second x coordinate
- * @param y2 the second y coordinate
- * @param px the reference x coordinate
- * @param py the reference y coordinate
- * @return the relative rotation direction
- */
- public static int relativeCCW(double x1, double y1, double x2, double y2,
- double px, double py)
- {
- if ((x1 == x2 && y1 == y2)
- || (x1 == px && y1 == py))
- return 0; // Coincident points.
- // Translate to the origin.
- x2 -= x1;
- y2 -= y1;
- px -= x1;
- py -= y1;
- double slope2 = y2 / x2;
- double slopep = py / px;
- if (slope2 == slopep || (x2 == 0 && px == 0))
- return y2 > 0 // Colinear.
- ? (py < 0 ? -1 : py > y2 ? 1 : 0)
- : (py > 0 ? -1 : py < y2 ? 1 : 0);
- if (x2 >= 0 && slope2 >= 0)
- return px >= 0 // Quadrant 1.
- ? (slope2 > slopep ? 1 : -1)
- : (slope2 < slopep ? 1 : -1);
- if (y2 > 0)
- return px < 0 // Quadrant 2.
- ? (slope2 > slopep ? 1 : -1)
- : (slope2 < slopep ? 1 : -1);
- if (slope2 >= 0.0)
- return px >= 0 // Quadrant 3.
- ? (slope2 < slopep ? 1 : -1)
- : (slope2 > slopep ? 1 : -1);
- return px < 0 // Quadrant 4.
- ? (slope2 < slopep ? 1 : -1)
- : (slope2 > slopep ? 1 : -1);
- }
-
- /**
- * Computes the relative rotation direction needed to pivot this line about
- * the first point in order to have the second point colinear with point p.
- * Because of floating point rounding, don't expect this to be a perfect
- * measure of colinearity. The answer is 1 if the line has a shorter rotation
- * in the direction of the positive X axis to the negative Y axis
- * (counter-clockwise in the default Java coordinate system), or -1 if the
- * shortest rotation is in the opposite direction (clockwise). If p
- * is already colinear, the return value is -1 if it lies beyond the first
- * point, 0 if it lies in the segment, or 1 if it lies beyond the second
- * point. If the first and second point are coincident, this returns 0.
- *
- * @param px the reference x coordinate
- * @param py the reference y coordinate
- * @return the relative rotation direction
- * @see #relativeCCW(double, double, double, double, double, double)
- */
- public int relativeCCW(double px, double py)
- {
- return relativeCCW(getX1(), getY1(), getX2(), getY2(), px, py);
- }
-
- /**
- * Computes the relative rotation direction needed to pivot this line about
- * the first point in order to have the second point colinear with point p.
- * Because of floating point rounding, don't expect this to be a perfect
- * measure of colinearity. The answer is 1 if the line has a shorter rotation
- * in the direction of the positive X axis to the negative Y axis
- * (counter-clockwise in the default Java coordinate system), or -1 if the
- * shortest rotation is in the opposite direction (clockwise). If p
- * is already colinear, the return value is -1 if it lies beyond the first
- * point, 0 if it lies in the segment, or 1 if it lies beyond the second
- * point. If the first and second point are coincident, this returns 0.
- *
- * @param p the reference point
- * @return the relative rotation direction
- * @throws NullPointerException if p is null
- * @see #relativeCCW(double, double, double, double, double, double)
- */
- public int relativeCCW(Point2D p)
- {
- return relativeCCW(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY());
- }
-
- /**
- * Computes twice the (signed) area of the triangle defined by the three
- * points. This method is used for intersection testing.
- *
- * @param x1 the x-coordinate of the first point.
- * @param y1 the y-coordinate of the first point.
- * @param x2 the x-coordinate of the second point.
- * @param y2 the y-coordinate of the second point.
- * @param x3 the x-coordinate of the third point.
- * @param y3 the y-coordinate of the third point.
- *
- * @return Twice the area.
- */
- private static double area2(double x1, double y1,
- double x2, double y2,
- double x3, double y3)
- {
- return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
- }
-
- /**
- * Returns true
if (x3, y3) lies between (x1, y1) and (x2, y2),
- * and false otherwise, This test assumes that the three points are
- * collinear, and is used for intersection testing.
- *
- * @param x1 the x-coordinate of the first point.
- * @param y1 the y-coordinate of the first point.
- * @param x2 the x-coordinate of the second point.
- * @param y2 the y-coordinate of the second point.
- * @param x3 the x-coordinate of the third point.
- * @param y3 the y-coordinate of the third point.
- *
- * @return A boolean.
- */
- private static boolean between(double x1, double y1,
- double x2, double y2,
- double x3, double y3)
- {
- if (x1 != x2) {
- return (x1 <= x3 && x3 <= x2) || (x1 >= x3 && x3 >= x2);
- }
- else {
- return (y1 <= y3 && y3 <= y2) || (y1 >= y3 && y3 >= y2);
- }
- }
-
- /**
- * Test if the line segment (x1,y1)->(x2,y2) intersects the line segment
- * (x3,y3)->(x4,y4).
- *
- * @param x1 the first x coordinate of the first segment
- * @param y1 the first y coordinate of the first segment
- * @param x2 the second x coordinate of the first segment
- * @param y2 the second y coordinate of the first segment
- * @param x3 the first x coordinate of the second segment
- * @param y3 the first y coordinate of the second segment
- * @param x4 the second x coordinate of the second segment
- * @param y4 the second y coordinate of the second segment
- * @return true if the segments intersect
- */
- public static boolean linesIntersect(double x1, double y1,
- double x2, double y2,
- double x3, double y3,
- double x4, double y4)
- {
- double a1, a2, a3, a4;
-
- // deal with special cases
- if ((a1 = area2(x1, y1, x2, y2, x3, y3)) == 0.0)
- {
- // check if p3 is between p1 and p2 OR
- // p4 is collinear also AND either between p1 and p2 OR at opposite ends
- if (between(x1, y1, x2, y2, x3, y3))
- {
- return true;
- }
- else
- {
- if (area2(x1, y1, x2, y2, x4, y4) == 0.0)
- {
- return between(x3, y3, x4, y4, x1, y1)
- || between (x3, y3, x4, y4, x2, y2);
- }
- else {
- return false;
- }
- }
- }
- else if ((a2 = area2(x1, y1, x2, y2, x4, y4)) == 0.0)
- {
- // check if p4 is between p1 and p2 (we already know p3 is not
- // collinear)
- return between(x1, y1, x2, y2, x4, y4);
- }
-
- if ((a3 = area2(x3, y3, x4, y4, x1, y1)) == 0.0) {
- // check if p1 is between p3 and p4 OR
- // p2 is collinear also AND either between p1 and p2 OR at opposite ends
- if (between(x3, y3, x4, y4, x1, y1)) {
- return true;
- }
- else {
- if (area2(x3, y3, x4, y4, x2, y2) == 0.0) {
- return between(x1, y1, x2, y2, x3, y3)
- || between (x1, y1, x2, y2, x4, y4);
- }
- else {
- return false;
- }
- }
- }
- else if ((a4 = area2(x3, y3, x4, y4, x2, y2)) == 0.0) {
- // check if p2 is between p3 and p4 (we already know p1 is not
- // collinear)
- return between(x3, y3, x4, y4, x2, y2);
- }
- else { // test for regular intersection
- return ((a1 > 0.0) ^ (a2 > 0.0)) && ((a3 > 0.0) ^ (a4 > 0.0));
- }
- }
-
- /**
- * Test if this line intersects the line given by (x1,y1)->(x2,y2).
- *
- * @param x1 the first x coordinate of the other segment
- * @param y1 the first y coordinate of the other segment
- * @param x2 the second x coordinate of the other segment
- * @param y2 the second y coordinate of the other segment
- * @return true if the segments intersect
- * @see #linesIntersect(double, double, double, double,
- * double, double, double, double)
- */
- public boolean intersectsLine(double x1, double y1, double x2, double y2)
- {
- return linesIntersect(getX1(), getY1(), getX2(), getY2(),
- x1, y1, x2, y2);
- }
-
- /**
- * Test if this line intersects the given line.
- *
- * @param l the other segment
- * @return true if the segments intersect
- * @throws NullPointerException if l is null
- * @see #linesIntersect(double, double, double, double,
- * double, double, double, double)
- */
- public boolean intersectsLine(Line2D l)
- {
- return linesIntersect(getX1(), getY1(), getX2(), getY2(),
- l.getX1(), l.getY1(), l.getX2(), l.getY2());
- }
-
- /**
- * Measures the square of the shortest distance from the reference point
- * to a point on the line segment. If the point is on the segment, the
- * result will be 0.
- *
- * @param x1 the first x coordinate of the segment
- * @param y1 the first y coordinate of the segment
- * @param x2 the second x coordinate of the segment
- * @param y2 the second y coordinate of the segment
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the square of the distance from the point to the segment
- * @see #ptSegDist(double, double, double, double, double, double)
- * @see #ptLineDistSq(double, double, double, double, double, double)
- */
- public static double ptSegDistSq(double x1, double y1, double x2, double y2,
- double px, double py)
- {
- double pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
-
- double x, y;
- if (pd2 == 0)
- {
- // Points are coincident.
- x = x1;
- y = y2;
- }
- else
- {
- double u = ((px - x1) * (x2 - x1) + (py - y1) * (y2 - y1)) / pd2;
-
- if (u < 0)
- {
- // "Off the end"
- x = x1;
- y = y1;
- }
- else if (u > 1.0)
- {
- x = x2;
- y = y2;
- }
- else
- {
- x = x1 + u * (x2 - x1);
- y = y1 + u * (y2 - y1);
- }
- }
-
- return (x - px) * (x - px) + (y - py) * (y - py);
- }
-
- /**
- * Measures the shortest distance from the reference point to a point on
- * the line segment. If the point is on the segment, the result will be 0.
- *
- * @param x1 the first x coordinate of the segment
- * @param y1 the first y coordinate of the segment
- * @param x2 the second x coordinate of the segment
- * @param y2 the second y coordinate of the segment
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the distance from the point to the segment
- * @see #ptSegDistSq(double, double, double, double, double, double)
- * @see #ptLineDist(double, double, double, double, double, double)
- */
- public static double ptSegDist(double x1, double y1, double x2, double y2,
- double px, double py)
- {
- return Math.sqrt(ptSegDistSq(x1, y1, x2, y2, px, py));
- }
-
- /**
- * Measures the square of the shortest distance from the reference point
- * to a point on this line segment. If the point is on the segment, the
- * result will be 0.
- *
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the square of the distance from the point to the segment
- * @see #ptSegDistSq(double, double, double, double, double, double)
- */
- public double ptSegDistSq(double px, double py)
- {
- return ptSegDistSq(getX1(), getY1(), getX2(), getY2(), px, py);
- }
-
- /**
- * Measures the square of the shortest distance from the reference point
- * to a point on this line segment. If the point is on the segment, the
- * result will be 0.
- *
- * @param p the point
- * @return the square of the distance from the point to the segment
- * @throws NullPointerException if p is null
- * @see #ptSegDistSq(double, double, double, double, double, double)
- */
- public double ptSegDistSq(Point2D p)
- {
- return ptSegDistSq(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY());
- }
-
- /**
- * Measures the shortest distance from the reference point to a point on
- * this line segment. If the point is on the segment, the result will be 0.
- *
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the distance from the point to the segment
- * @see #ptSegDist(double, double, double, double, double, double)
- */
- public double ptSegDist(double px, double py)
- {
- return ptSegDist(getX1(), getY1(), getX2(), getY2(), px, py);
- }
-
- /**
- * Measures the shortest distance from the reference point to a point on
- * this line segment. If the point is on the segment, the result will be 0.
- *
- * @param p the point
- * @return the distance from the point to the segment
- * @throws NullPointerException if p is null
- * @see #ptSegDist(double, double, double, double, double, double)
- */
- public double ptSegDist(Point2D p)
- {
- return ptSegDist(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY());
- }
-
- /**
- * Measures the square of the shortest distance from the reference point
- * to a point on the infinite line extended from the segment. If the point
- * is on the segment, the result will be 0. If the segment is length 0,
- * the distance is to the common endpoint.
- *
- * @param x1 the first x coordinate of the segment
- * @param y1 the first y coordinate of the segment
- * @param x2 the second x coordinate of the segment
- * @param y2 the second y coordinate of the segment
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the square of the distance from the point to the extended line
- * @see #ptLineDist(double, double, double, double, double, double)
- * @see #ptSegDistSq(double, double, double, double, double, double)
- */
- public static double ptLineDistSq(double x1, double y1, double x2, double y2,
- double px, double py)
- {
- double pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
-
- double x, y;
- if (pd2 == 0)
- {
- // Points are coincident.
- x = x1;
- y = y2;
- }
- else
- {
- double u = ((px - x1) * (x2 - x1) + (py - y1) * (y2 - y1)) / pd2;
- x = x1 + u * (x2 - x1);
- y = y1 + u * (y2 - y1);
- }
-
- return (x - px) * (x - px) + (y - py) * (y - py);
- }
-
- /**
- * Measures the shortest distance from the reference point to a point on
- * the infinite line extended from the segment. If the point is on the
- * segment, the result will be 0. If the segment is length 0, the distance
- * is to the common endpoint.
- *
- * @param x1 the first x coordinate of the segment
- * @param y1 the first y coordinate of the segment
- * @param x2 the second x coordinate of the segment
- * @param y2 the second y coordinate of the segment
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the distance from the point to the extended line
- * @see #ptLineDistSq(double, double, double, double, double, double)
- * @see #ptSegDist(double, double, double, double, double, double)
- */
- public static double ptLineDist(double x1, double y1,
- double x2, double y2,
- double px, double py)
- {
- return Math.sqrt(ptLineDistSq(x1, y1, x2, y2, px, py));
- }
-
- /**
- * Measures the square of the shortest distance from the reference point
- * to a point on the infinite line extended from this segment. If the point
- * is on the segment, the result will be 0. If the segment is length 0,
- * the distance is to the common endpoint.
- *
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the square of the distance from the point to the extended line
- * @see #ptLineDistSq(double, double, double, double, double, double)
- */
- public double ptLineDistSq(double px, double py)
- {
- return ptLineDistSq(getX1(), getY1(), getX2(), getY2(), px, py);
- }
-
- /**
- * Measures the square of the shortest distance from the reference point
- * to a point on the infinite line extended from this segment. If the point
- * is on the segment, the result will be 0. If the segment is length 0,
- * the distance is to the common endpoint.
- *
- * @param p the point
- * @return the square of the distance from the point to the extended line
- * @throws NullPointerException if p is null
- * @see #ptLineDistSq(double, double, double, double, double, double)
- */
- public double ptLineDistSq(Point2D p)
- {
- return ptLineDistSq(getX1(), getY1(), getX2(), getY2(),
- p.getX(), p.getY());
- }
-
- /**
- * Measures the shortest distance from the reference point to a point on
- * the infinite line extended from this segment. If the point is on the
- * segment, the result will be 0. If the segment is length 0, the distance
- * is to the common endpoint.
- *
- * @param px the x coordinate of the point
- * @param py the y coordinate of the point
- * @return the distance from the point to the extended line
- * @see #ptLineDist(double, double, double, double, double, double)
- */
- public double ptLineDist(double px, double py)
- {
- return ptLineDist(getX1(), getY1(), getX2(), getY2(), px, py);
- }
-
- /**
- * Measures the shortest distance from the reference point to a point on
- * the infinite line extended from this segment. If the point is on the
- * segment, the result will be 0. If the segment is length 0, the distance
- * is to the common endpoint.
- *
- * @param p the point
- * @return the distance from the point to the extended line
- * @throws NullPointerException if p is null
- * @see #ptLineDist(double, double, double, double, double, double)
- */
- public double ptLineDist(Point2D p)
- {
- return ptLineDist(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY());
- }
-
- /**
- * Test if a point is contained inside the line. Since a line has no area,
- * this returns false.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @return false; the line does not contain points
- */
- public boolean contains(double x, double y)
- {
- return false;
- }
-
- /**
- * Test if a point is contained inside the line. Since a line has no area,
- * this returns false.
- *
- * @param p the point
- * @return false; the line does not contain points
- */
- public boolean contains(Point2D p)
- {
- return false;
- }
-
- /**
- * Tests if this line intersects the interior of the specified rectangle.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @return true if the line intersects the rectangle
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- if (w <= 0 || h <= 0)
- return false;
- double x1 = getX1();
- double y1 = getY1();
- double x2 = getX2();
- double y2 = getY2();
-
- if (x1 >= x && x1 <= x + w && y1 >= y && y1 <= y + h)
- return true;
- if (x2 >= x && x2 <= x + w && y2 >= y && y2 <= y + h)
- return true;
-
- double x3 = x + w;
- double y3 = y + h;
-
- return (linesIntersect(x1, y1, x2, y2, x, y, x, y3)
- || linesIntersect(x1, y1, x2, y2, x, y3, x3, y3)
- || linesIntersect(x1, y1, x2, y2, x3, y3, x3, y)
- || linesIntersect(x1, y1, x2, y2, x3, y, x, y));
- }
-
- /**
- * Tests if this line intersects the interior of the specified rectangle.
- *
- * @param r the rectangle
- * @return true if the line intersects the rectangle
- * @throws NullPointerException if r is null
- */
- public boolean intersects(Rectangle2D r)
- {
- return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Tests if the line contains a rectangle. Since lines have no area, this
- * always returns false.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @return false; the line does not contain points
- */
- public boolean contains(double x, double y, double w, double h)
- {
- return false;
- }
-
- /**
- * Tests if the line contains a rectangle. Since lines have no area, this
- * always returns false.
- *
- * @param r the rectangle
- * @return false; the line does not contain points
- */
- public boolean contains(Rectangle2D r)
- {
- return false;
- }
-
- /**
- * Gets a bounding box (not necessarily minimal) for this line.
- *
- * @return the integer bounding box
- * @see #getBounds2D()
- */
- public Rectangle getBounds()
- {
- return getBounds2D().getBounds();
- }
-
- /**
- * Return a path iterator, possibly applying a transform on the result. This
- * iterator is not threadsafe.
- *
- * @param at the transform, or null
- * @return a new path iterator
- */
- public PathIterator getPathIterator(final AffineTransform at)
- {
- return new PathIterator()
- {
- /** Current coordinate. */
- private int current = 0;
-
- public int getWindingRule()
- {
- return WIND_NON_ZERO;
- }
-
- public boolean isDone()
- {
- return current >= 2;
- }
-
- public void next()
- {
- current++;
- }
-
- public int currentSegment(float[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = (float) getX1();
- coords[1] = (float) getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = (float) getX2();
- coords[1] = (float) getY2();
- result = SEG_LINETO;
- break;
- default:
- throw new NoSuchElementException("line iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return result;
- }
-
- public int currentSegment(double[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = getX1();
- coords[1] = getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = getX2();
- coords[1] = getY2();
- result = SEG_LINETO;
- break;
- default:
- throw new NoSuchElementException("line iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return result;
- }
- };
- }
-
- /**
- * Return a flat path iterator, possibly applying a transform on the result.
- * This iterator is not threadsafe.
- *
- * @param at the transform, or null
- * @param flatness ignored, since lines are already flat
- * @return a new path iterator
- * @see #getPathIterator(AffineTransform)
- */
- public PathIterator getPathIterator(AffineTransform at, double flatness)
- {
- return getPathIterator(at);
- }
-
- /**
- * Create a new line of the same run-time type with the same contents as
- * this one.
- *
- * @return the clone
- *
- * @exception OutOfMemoryError If there is not enough memory available.
- *
- * @since 1.2
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * This class defines a point in double
precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
- public static class Double extends Line2D
- {
- /** The x coordinate of the first point. */
- public double x1;
-
- /** The y coordinate of the first point. */
- public double y1;
-
- /** The x coordinate of the second point. */
- public double x2;
-
- /** The y coordinate of the second point. */
- public double y2;
-
- /**
- * Construct the line segment (0,0)->(0,0).
- */
- public Double()
- {
- }
-
- /**
- * Construct the line segment with the specified points.
- *
- * @param x1 the x coordinate of the first point
- * @param y1 the y coordinate of the first point
- * @param x2 the x coordinate of the second point
- * @param y2 the y coordinate of the second point
- */
- public Double(double x1, double y1, double x2, double y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Construct the line segment with the specified points.
- *
- * @param p1 the first point
- * @param p2 the second point
- * @throws NullPointerException if either point is null
- */
- public Double(Point2D p1, Point2D p2)
- {
- x1 = p1.getX();
- y1 = p1.getY();
- x2 = p2.getX();
- y2 = p2.getY();
- }
-
- /**
- * Return the x coordinate of the first point.
- *
- * @return the value of x1
- */
- public double getX1()
- {
- return x1;
- }
-
- /**
- * Return the y coordinate of the first point.
- *
- * @return the value of y1
- */
- public double getY1()
- {
- return y1;
- }
-
- /**
- * Return the first point.
- *
- * @return the point (x1,y1)
- */
- public Point2D getP1()
- {
- return new Point2D.Double(x1, y1);
- }
-
- /**
- * Return the x coordinate of the second point.
- *
- * @return the value of x2
- */
- public double getX2()
- {
- return x2;
- }
-
- /**
- * Return the y coordinate of the second point.
- *
- * @return the value of y2
- */
- public double getY2()
- {
- return y2;
- }
-
- /**
- * Return the second point.
- *
- * @return the point (x2,y2)
- */
- public Point2D getP2()
- {
- return new Point2D.Double(x2, y2);
- }
-
- /**
- * Set this line to the given points.
- *
- * @param x1 the new x coordinate of the first point
- * @param y1 the new y coordinate of the first point
- * @param x2 the new x coordinate of the second point
- * @param y2 the new y coordinate of the second point
- */
- public void setLine(double x1, double y1, double x2, double y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Return the exact bounds of this line segment.
- *
- * @return the bounding box
- */
- public Rectangle2D getBounds2D()
- {
- double x = Math.min(x1, x2);
- double y = Math.min(y1, y2);
- double w = Math.abs(x1 - x2);
- double h = Math.abs(y1 - y2);
- return new Rectangle2D.Double(x, y, w, h);
- }
- } // class Double
-
- /**
- * This class defines a point in float
precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
- public static class Float extends Line2D
- {
- /** The x coordinate of the first point. */
- public float x1;
-
- /** The y coordinate of the first point. */
- public float y1;
-
- /** The x coordinate of the second point. */
- public float x2;
-
- /** The y coordinate of the second point. */
- public float y2;
-
- /**
- * Construct the line segment (0,0)->(0,0).
- */
- public Float()
- {
- }
-
- /**
- * Construct the line segment with the specified points.
- *
- * @param x1 the x coordinate of the first point
- * @param y1 the y coordinate of the first point
- * @param x2 the x coordinate of the second point
- * @param y2 the y coordinate of the second point
- */
- public Float(float x1, float y1, float x2, float y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Construct the line segment with the specified points.
- *
- * @param p1 the first point
- * @param p2 the second point
- * @throws NullPointerException if either point is null
- */
- public Float(Point2D p1, Point2D p2)
- {
- x1 = (float) p1.getX();
- y1 = (float) p1.getY();
- x2 = (float) p2.getX();
- y2 = (float) p2.getY();
- }
-
- /**
- * Return the x coordinate of the first point.
- *
- * @return the value of x1
- */
- public double getX1()
- {
- return x1;
- }
-
- /**
- * Return the y coordinate of the first point.
- *
- * @return the value of y1
- */
- public double getY1()
- {
- return y1;
- }
-
- /**
- * Return the first point.
- *
- * @return the point (x1,y1)
- */
- public Point2D getP1()
- {
- return new Point2D.Float(x1, y1);
- }
-
- /**
- * Return the x coordinate of the second point.
- *
- * @return the value of x2
- */
- public double getX2()
- {
- return x2;
- }
-
- /**
- * Return the y coordinate of the second point.
- *
- * @return the value of y2
- */
- public double getY2()
- {
- return y2;
- }
-
- /**
- * Return the second point.
- *
- * @return the point (x2,y2)
- */
- public Point2D getP2()
- {
- return new Point2D.Float(x2, y2);
- }
-
- /**
- * Set this line to the given points.
- *
- * @param x1 the new x coordinate of the first point
- * @param y1 the new y coordinate of the first point
- * @param x2 the new x coordinate of the second point
- * @param y2 the new y coordinate of the second point
- */
- public void setLine(double x1, double y1, double x2, double y2)
- {
- this.x1 = (float) x1;
- this.y1 = (float) y1;
- this.x2 = (float) x2;
- this.y2 = (float) y2;
- }
-
- /**
- * Set this line to the given points.
- *
- * @param x1 the new x coordinate of the first point
- * @param y1 the new y coordinate of the first point
- * @param x2 the new x coordinate of the second point
- * @param y2 the new y coordinate of the second point
- */
- public void setLine(float x1, float y1, float x2, float y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Return the exact bounds of this line segment.
- *
- * @return the bounding box
- */
- public Rectangle2D getBounds2D()
- {
- float x = Math.min(x1, x2);
- float y = Math.min(y1, y2);
- float w = Math.abs(x1 - x2);
- float h = Math.abs(y1 - y2);
- return new Rectangle2D.Float(x, y, w, h);
- }
- } // class Float
-} // class Line2D
diff --git a/libjava/java/awt/geom/NoninvertibleTransformException.java b/libjava/java/awt/geom/NoninvertibleTransformException.java
deleted file mode 100644
index 7995a52eb61..00000000000
--- a/libjava/java/awt/geom/NoninvertibleTransformException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* NoninvertibleTransformException.java -- a transform can't be inverted
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-/**
- * Thrown if an operation requires an inverse of an
- * AffineTransform
, but the transform is in a non-invertible
- * state.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @see AffineTransform
- * @status updated to 1.4
- */
-public class NoninvertibleTransformException extends Exception
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 6137225240503990466L;
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public NoninvertibleTransformException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/awt/geom/PathIterator.java b/libjava/java/awt/geom/PathIterator.java
deleted file mode 100644
index 2cd08b9b48b..00000000000
--- a/libjava/java/awt/geom/PathIterator.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/* PathIterator.java -- describes a shape by iterating over its vertices
- Copyright (C) 2000, 2002, 2003 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-/**
- * This interface provides a directed path over the boundary of a shape. The
- * path can contain 1st through 3rd order Bezier curves (lines, and quadratic
- * and cubic splines). A shape can have multiple disjoint paths via the
- * MOVETO directive, and can close a circular path back to the previos
- * MOVETO via the CLOSE directive.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see java.awt.Shape
- * @see java.awt.Stroke
- * @see FlatteningPathIterator
- * @since 1.2
- * @status updated to 1.4
- */
-public interface PathIterator
-{
- /**
- * The even-odd winding mode: a point is internal to the shape if a ray
- * from the point to infinity (in any direction) crosses an odd number of
- * segments.
- */
- int WIND_EVEN_ODD = 0;
-
- /**
- * The non-zero winding mode: a point is internal to the shape if a ray
- * from the point to infinity (in any direction) crosses a different number
- * of segments headed clockwise than those headed counterclockwise.
- */
- int WIND_NON_ZERO = 1;
-
- /**
- * Starts a new subpath. There is no segment from the previous vertex.
- */
- int SEG_MOVETO = 0;
-
- /**
- * The current segment is a line.
- */
- int SEG_LINETO = 1;
-
- /**
- * The current segment is a quadratic parametric curve. It is interpolated
- * as t varies from 0 to 1 over the current point (CP), first control point
- * (P1), and final interpolated control point (P2):
- *
- * P(t) = B(2,0)*CP + B(2,1)*P1 + B(2,2)*P2
- * 0 <= t <= 1
- * B(n,m) = mth coefficient of nth degree Bernstein polynomial
- * = C(n,m) * t^(m) * (1 - t)^(n-m)
- * C(n,m) = Combinations of n things, taken m at a time
- * = n! / (m! * (n-m)!)
- *
- */
- int SEG_QUADTO = 2;
-
- /**
- * The current segment is a cubic parametric curve (more commonly known as
- * a Bezier curve). It is interpolated as t varies from 0 to 1 over the
- * current point (CP), first control point (P1), the second control point
- * (P2), and final interpolated control point (P3):
- *
- * P(t) = B(3,0)*CP + B(3,1)*P1 + B(3,2)*P2 + B(3,3)*P3
- * 0 <= t <= 1
- * B(n,m) = mth coefficient of nth degree Bernstein polynomial
- * = C(n,m) * t^(m) * (1 - t)^(n-m)
- * C(n,m) = Combinations of n things, taken m at a time
- * = n! / (m! * (n-m)!)
- *
- */
- int SEG_CUBICTO = 3;
-
- /**
- * The current segment closes a loop by an implicit line to the previous
- * SEG_MOVETO coordinate.
- */
- int SEG_CLOSE = 4;
-
- /**
- * Returns the winding rule to determine which points are inside this path.
- *
- * @return the winding rule
- * @see #WIND_EVEN_ODD
- * @see #WIND_NON_ZERO
- */
- int getWindingRule();
-
- /**
- * Tests if the iterator is exhausted. If this returns true, currentSegment
- * and next may throw a NoSuchElementException (although this is not
- * required).
- *
- * @return true if the iteration is complete
- */
- boolean isDone();
-
- /**
- * Advance to the next segment in the iteration. It is not specified what
- * this does if called when isDone() returns true.
- *
- * @throws java.util.NoSuchElementException optional when isDone() is true
- */
- void next();
-
- /**
- * Returns the coordinates of the next point(s), as well as the type of
- * line segment. The input array must be at least a float[6], to accomodate
- * up to three (x,y) point pairs (although if you know the iterator is
- * flat, you can probably get by with a float[2]). If the returned type is
- * SEG_MOVETO or SEG_LINETO, the first point in the array is modified; if
- * the returned type is SEG_QUADTO, the first two points are modified; if
- * the returned type is SEG_CUBICTO, all three points are modified; and if
- * the returned type is SEG_CLOSE, the array is untouched.
- *
- * @param coords the array to place the point coordinates in
- * @return the segment type
- * @throws NullPointerException if coords is null
- * @throws ArrayIndexOutOfBoundsException if coords is too small
- * @throws java.util.NoSuchElementException optional when isDone() is true
- * @see #SEG_MOVETO
- * @see #SEG_LINETO
- * @see #SEG_QUADTO
- * @see #SEG_CUBICTO
- * @see #SEG_CLOSE
- */
- int currentSegment(float[] coords);
-
- /**
- * Returns the coordinates of the next point(s), as well as the type of
- * line segment. The input array must be at least a double[6], to accomodate
- * up to three (x,y) point pairs (although if you know the iterator is
- * flat, you can probably get by with a double[2]). If the returned type is
- * SEG_MOVETO or SEG_LINETO, the first point in the array is modified; if
- * the returned type is SEG_QUADTO, the first two points are modified; if
- * the returned type is SEG_CUBICTO, all three points are modified; and if
- * the returned type is SEG_CLOSE, the array is untouched.
- *
- * @param coords the array to place the point coordinates in
- * @return the segment type
- * @throws NullPointerException if coords is null
- * @throws ArrayIndexOutOfBoundsException if coords is too small
- * @throws java.util.NoSuchElementException optional when isDone() is true
- * @see #SEG_MOVETO
- * @see #SEG_LINETO
- * @see #SEG_QUADTO
- * @see #SEG_CUBICTO
- * @see #SEG_CLOSE
- */
- int currentSegment(double[] coords);
-} // interface PathIterator
diff --git a/libjava/java/awt/geom/Point2D.java b/libjava/java/awt/geom/Point2D.java
deleted file mode 100644
index 9f22a5a67c9..00000000000
--- a/libjava/java/awt/geom/Point2D.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/* Point2D.java -- generic point in 2-D space
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.geom;
-
-/**
- * This class implements a generic point in 2D Cartesian space. The storage
- * representation is left up to the subclass. Point includes two useful
- * nested classes, for float and double storage respectively.
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public abstract class Point2D implements Cloneable
-{
- /**
- * The default constructor.
- *
- * @see java.awt.Point
- * @see Point2D.Float
- * @see Point2D.Double
- */
- protected Point2D()
- {
- }
-
- /**
- * Get the X coordinate, in double precision.
- *
- * @return the x coordinate
- */
- public abstract double getX();
-
- /**
- * Get the Y coordinate, in double precision.
- *
- * @return the y coordinate
- */
- public abstract double getY();
-
- /**
- * Set the location of this point to the new coordinates. There may be a
- * loss of precision.
- *
- * @param x the new x coordinate
- * @param y the new y coordinate
- */
- public abstract void setLocation(double x, double y);
-
- /**
- * Set the location of this point to the new coordinates. There may be a
- * loss of precision.
- *
- * @param p the point to copy
- * @throws NullPointerException if p is null
- */
- public void setLocation(Point2D p)
- {
- setLocation(p.getX(), p.getY());
- }
-
- /**
- * Return the square of the distance between two points.
- *
- * @param x1 the x coordinate of point 1
- * @param y1 the y coordinate of point 1
- * @param x2 the x coordinate of point 2
- * @param y2 the y coordinate of point 2
- * @return (x2 - x1)^2 + (y2 - y1)^2
- */
- public static double distanceSq(double x1, double y1, double x2, double y2)
- {
- x2 -= x1;
- y2 -= y1;
- return x2 * x2 + y2 * y2;
- }
-
- /**
- * Return the distance between two points.
- *
- * @param x1 the x coordinate of point 1
- * @param y1 the y coordinate of point 1
- * @param x2 the x coordinate of point 2
- * @param y2 the y coordinate of point 2
- * @return the distance from (x1,y1) to (x2,y2)
- */
- public static double distance(double x1, double y1, double x2, double y2)
- {
- return Math.sqrt(distanceSq(x1, y1, x2, y2));
- }
-
- /**
- * Return the square of the distance from this point to the given one.
- *
- * @param x the x coordinate of the other point
- * @param y the y coordinate of the other point
- * @return the square of the distance
- */
- public double distanceSq(double x, double y)
- {
- return distanceSq(getX(), x, getY(), y);
- }
-
- /**
- * Return the square of the distance from this point to the given one.
- *
- * @param p the other point
- * @return the square of the distance
- * @throws NullPointerException if p is null
- */
- public double distanceSq(Point2D p)
- {
- return distanceSq(getX(), p.getX(), getY(), p.getY());
- }
-
- /**
- * Return the distance from this point to the given one.
- *
- * @param x the x coordinate of the other point
- * @param y the y coordinate of the other point
- * @return the distance
- */
- public double distance(double x, double y)
- {
- return distance(getX(), x, getY(), y);
- }
-
- /**
- * Return the distance from this point to the given one.
- *
- * @param p the other point
- * @return the distance
- * @throws NullPointerException if p is null
- */
- public double distance(Point2D p)
- {
- return distance(getX(), p.getX(), getY(), p.getY());
- }
-
- /**
- * Create a new point of the same run-time type with the same contents as
- * this one.
- *
- * @return the clone
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * Return the hashcode for this point. The formula is not documented, but
- * appears to be the same as:
- *
- * long l = Double.doubleToLongBits(getY());
- * l = l * 31 ^ Double.doubleToLongBits(getX());
- * return (int) ((l >> 32) ^ l);
- *
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- // Talk about a fun time reverse engineering this one!
- long l = java.lang.Double.doubleToLongBits(getY());
- l = l * 31 ^ java.lang.Double.doubleToLongBits(getX());
- return (int) ((l >> 32) ^ l);
- }
-
- /**
- * Compares two points for equality. This returns true if they have the
- * same coordinates.
- *
- * @param o the point to compare
- * @return true if it is equal
- */
- public boolean equals(Object o)
- {
- if (! (o instanceof Point2D))
- return false;
- Point2D p = (Point2D) o;
- return getX() == p.getX() && getY() == p.getY();
- }
-
- /**
- * This class defines a point in double
precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
- public static class Double extends Point2D
- {
- /** The X coordinate. */
- public double x;
-
- /** The Y coordinate. */
- public double y;
-
- /**
- * Create a new point at (0,0).
- */
- public Double()
- {
- }
-
- /**
- * Create a new point at (x,y).
- *
- * @param x the x coordinate
- * @param y the y coordinate
- */
- public Double(double x, double y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Return the x coordinate.
- *
- * @return the x coordinate
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Return the y coordinate.
- *
- * @return the y coordinate
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Sets the location of this point.
- *
- * @param x the new x coordinate
- * @param y the new y coordinate
- */
- public void setLocation(double x, double y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Returns a string representation of this object. The format is:
- * "Point2D.Double[" + x + ", " + y + ']'
.
- *
- * @return a string representation of this object
- */
- public String toString()
- {
- return "Point2D.Double[" + x + ", " + y + ']';
- }
- } // class Double
-
- /**
- * This class defines a point in float
precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
- public static class Float extends Point2D
- {
- /** The X coordinate. */
- public float x;
-
- /** The Y coordinate. */
- public float y;
-
- /**
- * Create a new point at (0,0).
- */
- public Float()
- {
- }
-
- /**
- * Create a new point at (x,y).
- *
- * @param x the x coordinate
- * @param y the y coordinate
- */
- public Float(float x, float y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Return the x coordinate.
- *
- * @return the x coordinate
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Return the y coordinate.
- *
- * @return the y coordinate
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Sets the location of this point.
- *
- * @param x the new x coordinate
- * @param y the new y coordinate
- */
- public void setLocation(double x, double y)
- {
- this.x = (float) x;
- this.y = (float) y;
- }
-
- /**
- * Sets the location of this point.
- *
- * @param x the new x coordinate
- * @param y the new y coordinate
- */
- public void setLocation(float x, float y)
- {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Returns a string representation of this object. The format is:
- * "Point2D.Float[" + x + ", " + y + ']'
.
- *
- * @return a string representation of this object
- */
- public String toString()
- {
- return "Point2D.Float[" + x + ", " + y + ']';
- }
- } // class Float
-} // class Point2D
diff --git a/libjava/java/awt/geom/QuadCurve2D.java b/libjava/java/awt/geom/QuadCurve2D.java
deleted file mode 100644
index 41021dbc683..00000000000
--- a/libjava/java/awt/geom/QuadCurve2D.java
+++ /dev/null
@@ -1,1467 +0,0 @@
-/* QuadCurve2D.java -- represents a parameterized quadratic curve in 2-D space
- Copyright (C) 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.util.NoSuchElementException;
-
-/**
- * A two-dimensional curve that is parameterized with a quadratic
- * function.
- *
- *
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Graydon Hoare (graydon@redhat.com)
- * @author Sascha Brawer (brawer@dandelis.ch)
- * @author Sven de Marothy (sven@physto.se)
- *
- * @since 1.2
- */
-public abstract class QuadCurve2D implements Shape, Cloneable
-{
- private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
- private static final double EPSILON = 1E-10;
-
- /**
- * Constructs a new QuadCurve2D. Typical users will want to
- * construct instances of a subclass, such as {@link
- * QuadCurve2D.Float} or {@link QuadCurve2D.Double}.
- */
- protected QuadCurve2D()
- {
- }
-
- /**
- * Returns the x coordinate of the curve’s start
- * point.
- */
- public abstract double getX1();
-
- /**
- * Returns the y coordinate of the curve’s start
- * point.
- */
- public abstract double getY1();
-
- /**
- * Returns the curve’s start point.
- */
- public abstract Point2D getP1();
-
- /**
- * Returns the x coordinate of the curve’s control
- * point.
- */
- public abstract double getCtrlX();
-
- /**
- * Returns the y coordinate of the curve’s control
- * point.
- */
- public abstract double getCtrlY();
-
- /**
- * Returns the curve’s control point.
- */
- public abstract Point2D getCtrlPt();
-
- /**
- * Returns the x coordinate of the curve’s end
- * point.
- */
- public abstract double getX2();
-
- /**
- * Returns the y coordinate of the curve’s end
- * point.
- */
- public abstract double getY2();
-
- /**
- * Returns the curve’s end point.
- */
- public abstract Point2D getP2();
-
- /**
- * Changes the curve geometry, separately specifying each coordinate
- * value.
- *
- * @param x1 the x coordinate of the curve’s new start
- * point.
- *
- * @param y1 the y coordinate of the curve’s new start
- * point.
- *
- * @param cx the x coordinate of the curve’s new
- * control point.
- *
- * @param cy the y coordinate of the curve’s new
- * control point.
- *
- * @param x2 the x coordinate of the curve’s new end
- * point.
- *
- * @param y2 the y coordinate of the curve’s new end
- * point.
- */
- public abstract void setCurve(double x1, double y1, double cx, double cy,
- double x2, double y2);
-
- /**
- * Changes the curve geometry, passing coordinate values in an
- * array.
- *
- * @param coords an array containing the new coordinate values. The
- * x coordinate of the new start point is located at
- *
coords[offset]
, its y coordinate at
- * coords[offset + 1]
. The x coordinate of the
- * new control point is located at coords[offset + 2]
,
- * its y coordinate at coords[offset + 3]
. The
- * x coordinate of the new end point is located at
- * coords[offset + 4]
, its y coordinate at
- * coords[offset + 5]
.
- *
- * @param offset the offset of the first coordinate value in
- * coords
.
- */
- public void setCurve(double[] coords, int offset)
- {
- setCurve(coords[offset++], coords[offset++], coords[offset++],
- coords[offset++], coords[offset++], coords[offset++]);
- }
-
- /**
- * Changes the curve geometry, specifying coordinate values in
- * separate Point objects.
- *
- *
- *
- *
p1
,
- * c
p2
will not affect the curve
- * geometry.
- *
- * @param p1 the new start point.
- * @param c the new control point.
- * @param p2 the new end point.
- */
- public void setCurve(Point2D p1, Point2D c, Point2D p2)
- {
- setCurve(p1.getX(), p1.getY(), c.getX(), c.getY(), p2.getX(), p2.getY());
- }
-
- /**
- * Changes the curve geometry, specifying coordinate values in an
- * array of Point objects.
- *
- *
- *
- *
pts
array
- * or any of its elements will not affect the curve geometry.
- *
- * @param pts an array containing the points. The new start point
- * is located at pts[offset]
, the new control
- * point at pts[offset + 1]
, and the new end point
- * at pts[offset + 2]
.
- *
- * @param offset the offset of the start point in pts
.
- */
- public void setCurve(Point2D[] pts, int offset)
- {
- setCurve(pts[offset].getX(), pts[offset].getY(), pts[offset + 1].getX(),
- pts[offset + 1].getY(), pts[offset + 2].getX(),
- pts[offset + 2].getY());
- }
-
- /**
- * Changes the geometry of the curve to that of another curve.
- *
- * @param c the curve whose coordinates will be copied.
- */
- public void setCurve(QuadCurve2D c)
- {
- setCurve(c.getX1(), c.getY1(), c.getCtrlX(), c.getCtrlY(), c.getX2(),
- c.getY2());
- }
-
- /**
- * Calculates the squared flatness of a quadratic curve, directly
- * specifying each coordinate value. The flatness is the distance of
- * the control point to the line between start and end point.
- *
- *
- *
- *
- *
- *
- *
- *
coords[offset]
, its y coordinate at
- * coords[offset + 1]
. The x coordinate of the
- * control point C is located at coords[offset + 2]
,
- * its y coordinate at coords[offset + 3]
. The
- * x coordinate of the end point P2 is located at
- * coords[offset + 4]
, its y coordinate at
- * coords[offset + 5]
.
- *
- * @param offset the offset of the first coordinate value in
- * coords
.
- */
- public static double getFlatnessSq(double[] coords, int offset)
- {
- return Line2D.ptSegDistSq(coords[offset], coords[offset + 1],
- coords[offset + 4], coords[offset + 5],
- coords[offset + 2], coords[offset + 3]);
- }
-
- /**
- * Calculates the flatness of a quadratic curve, specifying the
- * coordinate values in an array. The flatness is the distance of
- * the control point to the line between start and end point.
- *
- *
- *
- *
coords[offset]
, its y coordinate at
- * coords[offset + 1]
. The x coordinate of the
- * control point C is located at coords[offset + 2]
,
- * its y coordinate at coords[offset + 3]
. The
- * x coordinate of the end point P2 is located at
- * coords[offset + 4]
, its y coordinate at
- * coords[offset + 5]
.
- *
- * @param offset the offset of the first coordinate value in
- * coords
.
- */
- public static double getFlatness(double[] coords, int offset)
- {
- return Line2D.ptSegDist(coords[offset], coords[offset + 1],
- coords[offset + 4], coords[offset + 5],
- coords[offset + 2], coords[offset + 3]);
- }
-
- /**
- * Calculates the squared flatness of this curve. The flatness is
- * the distance of the control point to the line between start and
- * end point.
- *
- *
- *
- *
- *
- *
- *
- * @param left a curve whose geometry will be set to the left half
- * of this curve, or
null
if the caller is not
- * interested in the left half.
- *
- * @param right a curve whose geometry will be set to the right half
- * of this curve, or null
if the caller is not
- * interested in the right half.
- */
- public void subdivide(QuadCurve2D left, QuadCurve2D right)
- {
- // Use empty slots at end to share single array.
- double[] d = new double[]
- {
- getX1(), getY1(), getCtrlX(), getCtrlY(), getX2(), getY2(),
- 0, 0, 0, 0
- };
- subdivide(d, 0, d, 0, d, 4);
- if (left != null)
- left.setCurve(d, 0);
- if (right != null)
- right.setCurve(d, 4);
- }
-
- /**
- * Subdivides a quadratic curve into two halves.
- *
- *
- *
- * @param src the curve to be subdivided.
- *
- * @param left a curve whose geometry will be set to the left half
- * of
src
, or null
if the caller is not
- * interested in the left half.
- *
- * @param right a curve whose geometry will be set to the right half
- * of src
, or null
if the caller is not
- * interested in the right half.
- */
- public static void subdivide(QuadCurve2D src, QuadCurve2D left,
- QuadCurve2D right)
- {
- src.subdivide(left, right);
- }
-
- /**
- * Subdivides a quadratic curve into two halves, passing all
- * coordinates in an array.
- *
- *
- *
- *
left
and right
, and
- * set rightOff
to leftOff + 4
.
- *
- * @param src an array containing the coordinates of the curve to be
- * subdivided. The x coordinate of the start point is
- * located at src[srcOff]
, its y at
- * src[srcOff + 1]
. The x coordinate of the
- * control point is located at src[srcOff + 2]
, its
- * y at src[srcOff + 3]
. The x
- * coordinate of the end point is located at src[srcOff +
- * 4]
, its y at src[srcOff + 5]
.
- *
- * @param srcOff an offset into src
, specifying
- * the index of the start point’s x coordinate.
- *
- * @param left an array that will receive the coordinates of the
- * left half of src
. It is acceptable to pass
- * src
. A caller who is not interested in the left half
- * can pass null
.
- *
- * @param leftOff an offset into left
, specifying the
- * index where the start point’s x coordinate will be
- * stored.
- *
- * @param right an array that will receive the coordinates of the
- * right half of src
. It is acceptable to pass
- * src
or left
. A caller who is not
- * interested in the right half can pass null
.
- *
- * @param rightOff an offset into right
, specifying the
- * index where the start point’s x coordinate will be
- * stored.
- */
- public static void subdivide(double[] src, int srcOff, double[] left,
- int leftOff, double[] right, int rightOff)
- {
- double x1;
- double y1;
- double xc;
- double yc;
- double x2;
- double y2;
-
- x1 = src[srcOff];
- y1 = src[srcOff + 1];
- xc = src[srcOff + 2];
- yc = src[srcOff + 3];
- x2 = src[srcOff + 4];
- y2 = src[srcOff + 5];
-
- if (left != null)
- {
- left[leftOff] = x1;
- left[leftOff + 1] = y1;
- }
-
- if (right != null)
- {
- right[rightOff + 4] = x2;
- right[rightOff + 5] = y2;
- }
-
- x1 = (x1 + xc) / 2;
- x2 = (xc + x2) / 2;
- xc = (x1 + x2) / 2;
- y1 = (y1 + yc) / 2;
- y2 = (y2 + yc) / 2;
- yc = (y1 + y2) / 2;
-
- if (left != null)
- {
- left[leftOff + 2] = x1;
- left[leftOff + 3] = y1;
- left[leftOff + 4] = xc;
- left[leftOff + 5] = yc;
- }
-
- if (right != null)
- {
- right[rightOff] = xc;
- right[rightOff + 1] = yc;
- right[rightOff + 2] = x2;
- right[rightOff + 3] = y2;
- }
- }
-
- /**
- * Finds the non-complex roots of a quadratic equation, placing the
- * results into the same array as the equation coefficients. The
- * following equation is being solved:
- *
- *
- *
- * eqn[2]
· x2
- * + eqn[1]
· x
- * + eqn[0]
- * = 0
- * eqn
will contain the
- * non-complex solutions of the equation, in no particular order.
- *
- * @return the number of non-complex solutions. A result of 0
- * indicates that the equation has no non-complex solutions. A
- * result of -1 indicates that the equation is constant (i.e.,
- * always or never zero).
- *
- * @author Brian Gough (bjg@network-theory.com)
- * (original C implementation in the GNU Scientific Library)
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- * (adaptation to Java)
- */
- public static int solveQuadratic(double[] eqn)
- {
- return solveQuadratic(eqn, eqn);
- }
-
- /**
- * Finds the non-complex roots of a quadratic equation. The
- * following equation is being solved:
- *
- *
- *
- * eqn[2]
· x2
- * + eqn[1]
· x
- * + eqn[0]
- * = 0
- * eqn
- * and res
.
- *
- * @return the number of non-complex solutions. A result of 0
- * indicates that the equation has no non-complex solutions. A
- * result of -1 indicates that the equation is constant (i.e.,
- * always or never zero).
- *
- * @author Brian Gough (bjg@network-theory.com)
- * (original C implementation in the GNU Scientific Library)
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- * (adaptation to Java)
- */
- public static int solveQuadratic(double[] eqn, double[] res)
- {
- // Taken from poly/solve_quadratic.c in the GNU Scientific Library
- // (GSL), cvs revision 1.7 of 2003-07-26. For the original source,
- // see http://www.gnu.org/software/gsl/
- //
- // Brian Gough, the author of that code, has granted the
- // permission to use it in GNU Classpath under the GNU Classpath
- // license, and has assigned the copyright to the Free Software
- // Foundation.
- //
- // The Java implementation is very similar to the GSL code, but
- // not a strict one-to-one copy. For example, GSL would sort the
- // result.
- double a;
- double b;
- double c;
- double disc;
-
- c = eqn[0];
- b = eqn[1];
- a = eqn[2];
-
- // Check for linear or constant functions. This is not done by the
- // GNU Scientific Library. Without this special check, we
- // wouldn't return -1 for constant functions, and 2 instead of 1
- // for linear functions.
- if (a == 0)
- {
- if (b == 0)
- return -1;
-
- res[0] = -c / b;
- return 1;
- }
-
- disc = b * b - 4 * a * c;
-
- if (disc < 0)
- return 0;
-
- if (disc == 0)
- {
- // The GNU Scientific Library returns two identical results here.
- // We just return one.
- res[0] = -0.5 * b / a;
- return 1;
- }
-
- // disc > 0
- if (b == 0)
- {
- double r;
-
- r = Math.abs(0.5 * Math.sqrt(disc) / a);
- res[0] = -r;
- res[1] = r;
- }
- else
- {
- double sgnb;
- double temp;
-
- sgnb = (b > 0 ? 1 : -1);
- temp = -0.5 * (b + sgnb * Math.sqrt(disc));
-
- // The GNU Scientific Library sorts the result here. We don't.
- res[0] = temp / a;
- res[1] = c / temp;
- }
- return 2;
- }
-
- /**
- * Determines whether a point is inside the area bounded
- * by the curve and the straight line connecting its end points.
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- */
- public Rectangle getBounds()
- {
- return getBounds2D().getBounds();
- }
-
- public PathIterator getPathIterator(final AffineTransform at)
- {
- return new PathIterator()
- {
- /** Current coordinate. */
- private int current = 0;
-
- public int getWindingRule()
- {
- return WIND_NON_ZERO;
- }
-
- public boolean isDone()
- {
- return current >= 2;
- }
-
- public void next()
- {
- current++;
- }
-
- public int currentSegment(float[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = (float) getX1();
- coords[1] = (float) getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = (float) getCtrlX();
- coords[1] = (float) getCtrlY();
- coords[2] = (float) getX2();
- coords[3] = (float) getY2();
- result = SEG_QUADTO;
- break;
- default:
- throw new NoSuchElementException("quad iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 2);
- return result;
- }
-
- public int currentSegment(double[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = getX1();
- coords[1] = getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = getCtrlX();
- coords[1] = getCtrlY();
- coords[2] = getX2();
- coords[3] = getY2();
- result = SEG_QUADTO;
- break;
- default:
- throw new NoSuchElementException("quad iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 2);
- return result;
- }
- };
- }
-
- public PathIterator getPathIterator(AffineTransform at, double flatness)
- {
- return new FlatteningPathIterator(getPathIterator(at), flatness);
- }
-
- /**
- * Creates a new curve with the same contents as this one.
- *
- * @return the clone.
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-
- /**
- * Helper method used by contains() and intersects() methods
- * Return the number of curve/line intersections on a given axis
- * extending from a certain point. useYaxis is true for using the Y axis,
- * @param x x coordinate of the origin point
- * @param y y coordinate of the origin point
- * @param useYaxis axis to follow, if true the positive Y axis is used,
- * false uses the positive X axis.
- *
- * This is an implementation of the line-crossings algorithm,
- * Detailed in an article on Eric Haines' page:
- * http://www.acm.org/tog/editors/erich/ptinpoly/
- */
- private int getAxisIntersections(double x, double y, boolean useYaxis,
- double distance)
- {
- int nCrossings = 0;
- double a0;
- double a1;
- double a2;
- double b0;
- double b1;
- double b2;
- double[] r = new double[3];
- int nRoots;
-
- a0 = a2 = 0.0;
-
- if (useYaxis)
- {
- a0 = getY1() - y;
- a1 = getCtrlY() - y;
- a2 = getY2() - y;
- b0 = getX1() - x;
- b1 = getCtrlX() - x;
- b2 = getX2() - x;
- }
- else
- {
- a0 = getX1() - x;
- a1 = getCtrlX() - x;
- a2 = getX2() - x;
- b0 = getY1() - y;
- b1 = getCtrlY() - y;
- b2 = getY2() - y;
- }
-
- /* If the axis intersects a start/endpoint, shift it up by some small
- amount to guarantee the line is 'inside'
- If this is not done,bad behaviour may result for points on that axis. */
- if (a0 == 0.0 || a2 == 0.0)
- {
- double small = getFlatness() * EPSILON;
- if (a0 == 0.0)
- a0 -= small;
-
- if (a2 == 0.0)
- a2 -= small;
- }
-
- r[0] = a0;
- r[1] = 2 * (a1 - a0);
- r[2] = (a2 - 2 * a1 + a0);
-
- nRoots = solveQuadratic(r);
- for (int i = 0; i < nRoots; i++)
- {
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0)
- + b0;
- /* single root is always doubly degenerate in quads */
- if (crossing > 0 && crossing < distance)
- nCrossings += (nRoots == 1) ? 2 : 1;
- }
- }
-
- if (useYaxis)
- {
- if (Line2D.linesIntersect(b0, a0, b2, a2, EPSILON, 0.0, distance, 0.0))
- nCrossings++;
- }
- else
- {
- if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, EPSILON, 0.0, distance))
- nCrossings++;
- }
-
- return (nCrossings);
- }
-
- /**
- * A two-dimensional curve that is parameterized with a quadratic
- * function and stores coordinate values in double-precision
- * floating-point format.
- *
- * @see QuadCurve2D.Float
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
- public static class Double extends QuadCurve2D
- {
- /**
- * The x coordinate of the curve’s start point.
- */
- public double x1;
-
- /**
- * The y coordinate of the curve’s start point.
- */
- public double y1;
-
- /**
- * The x coordinate of the curve’s control point.
- */
- public double ctrlx;
-
- /**
- * The y coordinate of the curve’s control point.
- */
- public double ctrly;
-
- /**
- * The x coordinate of the curve’s end point.
- */
- public double x2;
-
- /**
- * The y coordinate of the curve’s end point.
- */
- public double y2;
-
- /**
- * Constructs a new QuadCurve2D that stores its coordinate values
- * in double-precision floating-point format. All points are
- * initially at position (0, 0).
- */
- public Double()
- {
- }
-
- /**
- * Constructs a new QuadCurve2D that stores its coordinate values
- * in double-precision floating-point format, specifying the
- * initial position of each point.
- *
- * @param x1 the x coordinate of the curve’s start
- * point.
- *
- * @param y1 the y coordinate of the curve’s start
- * point.
- *
- * @param cx the x coordinate of the curve’s control
- * point.
- *
- * @param cy the y coordinate of the curve’s control
- * point.
- *
- * @param x2 the x coordinate of the curve’s end
- * point.
- *
- * @param y2 the y coordinate of the curve’s end
- * point.
- */
- public Double(double x1, double y1, double cx, double cy, double x2,
- double y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx = cx;
- ctrly = cy;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Returns the x coordinate of the curve’s start
- * point.
- */
- public double getX1()
- {
- return x1;
- }
-
- /**
- * Returns the y coordinate of the curve’s start
- * point.
- */
- public double getY1()
- {
- return y1;
- }
-
- /**
- * Returns the curve’s start point.
- */
- public Point2D getP1()
- {
- return new Point2D.Double(x1, y1);
- }
-
- /**
- * Returns the x coordinate of the curve’s control
- * point.
- */
- public double getCtrlX()
- {
- return ctrlx;
- }
-
- /**
- * Returns the y coordinate of the curve’s control
- * point.
- */
- public double getCtrlY()
- {
- return ctrly;
- }
-
- /**
- * Returns the curve’s control point.
- */
- public Point2D getCtrlPt()
- {
- return new Point2D.Double(ctrlx, ctrly);
- }
-
- /**
- * Returns the x coordinate of the curve’s end
- * point.
- */
- public double getX2()
- {
- return x2;
- }
-
- /**
- * Returns the y coordinate of the curve’s end
- * point.
- */
- public double getY2()
- {
- return y2;
- }
-
- /**
- * Returns the curve’s end point.
- */
- public Point2D getP2()
- {
- return new Point2D.Double(x2, y2);
- }
-
- /**
- * Changes the geometry of the curve.
- *
- * @param x1 the x coordinate of the curve’s new
- * start point.
- *
- * @param y1 the y coordinate of the curve’s new
- * start point.
- *
- * @param cx the x coordinate of the curve’s new
- * control point.
- *
- * @param cy the y coordinate of the curve’s new
- * control point.
- *
- * @param x2 the x coordinate of the curve’s new
- * end point.
- *
- * @param y2 the y coordinate of the curve’s new
- * end point.
- */
- public void setCurve(double x1, double y1, double cx, double cy,
- double x2, double y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx = cx;
- ctrly = cy;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Determines the smallest rectangle that encloses the
- * curve’s start, end and control point. As the
- * illustration below shows, the invisible control point may cause
- * the bounds to be much larger than the area that is actually
- * covered by the curve.
- *
- *
- */
- public Rectangle2D getBounds2D()
- {
- double nx1 = Math.min(Math.min(x1, ctrlx), x2);
- double ny1 = Math.min(Math.min(y1, ctrly), y2);
- double nx2 = Math.max(Math.max(x1, ctrlx), x2);
- double ny2 = Math.max(Math.max(y1, ctrly), y2);
- return new Rectangle2D.Double(nx1, ny1, nx2 - nx1, ny2 - ny1);
- }
- }
-
- /**
- * A two-dimensional curve that is parameterized with a quadratic
- * function and stores coordinate values in single-precision
- * floating-point format.
- *
- * @see QuadCurve2D.Double
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
- public static class Float extends QuadCurve2D
- {
- /**
- * The x coordinate of the curve’s start point.
- */
- public float x1;
-
- /**
- * The y coordinate of the curve’s start point.
- */
- public float y1;
-
- /**
- * The x coordinate of the curve’s control point.
- */
- public float ctrlx;
-
- /**
- * The y coordinate of the curve’s control point.
- */
- public float ctrly;
-
- /**
- * The x coordinate of the curve’s end point.
- */
- public float x2;
-
- /**
- * The y coordinate of the curve’s end point.
- */
- public float y2;
-
- /**
- * Constructs a new QuadCurve2D that stores its coordinate values
- * in single-precision floating-point format. All points are
- * initially at position (0, 0).
- */
- public Float()
- {
- }
-
- /**
- * Constructs a new QuadCurve2D that stores its coordinate values
- * in single-precision floating-point format, specifying the
- * initial position of each point.
- *
- * @param x1 the x coordinate of the curve’s start
- * point.
- *
- * @param y1 the y coordinate of the curve’s start
- * point.
- *
- * @param cx the x coordinate of the curve’s control
- * point.
- *
- * @param cy the y coordinate of the curve’s control
- * point.
- *
- * @param x2 the x coordinate of the curve’s end
- * point.
- *
- * @param y2 the y coordinate of the curve’s end
- * point.
- */
- public Float(float x1, float y1, float cx, float cy, float x2, float y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx = cx;
- ctrly = cy;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Returns the x coordinate of the curve’s start
- * point.
- */
- public double getX1()
- {
- return x1;
- }
-
- /**
- * Returns the y coordinate of the curve’s start
- * point.
- */
- public double getY1()
- {
- return y1;
- }
-
- /**
- * Returns the curve’s start point.
- */
- public Point2D getP1()
- {
- return new Point2D.Float(x1, y1);
- }
-
- /**
- * Returns the x coordinate of the curve’s control
- * point.
- */
- public double getCtrlX()
- {
- return ctrlx;
- }
-
- /**
- * Returns the y coordinate of the curve’s control
- * point.
- */
- public double getCtrlY()
- {
- return ctrly;
- }
-
- /**
- * Returns the curve’s control point.
- */
- public Point2D getCtrlPt()
- {
- return new Point2D.Float(ctrlx, ctrly);
- }
-
- /**
- * Returns the x coordinate of the curve’s end
- * point.
- */
- public double getX2()
- {
- return x2;
- }
-
- /**
- * Returns the y coordinate of the curve’s end
- * point.
- */
- public double getY2()
- {
- return y2;
- }
-
- /**
- * Returns the curve’s end point.
- */
- public Point2D getP2()
- {
- return new Point2D.Float(x2, y2);
- }
-
- /**
- * Changes the geometry of the curve, specifying coordinate values
- * as double-precision floating-point numbers.
- *
- * @param x1 the x coordinate of the curve’s new
- * start point.
- *
- * @param y1 the y coordinate of the curve’s new
- * start point.
- *
- * @param cx the x coordinate of the curve’s new
- * control point.
- *
- * @param cy the y coordinate of the curve’s new
- * control point.
- *
- * @param x2 the x coordinate of the curve’s new
- * end point.
- *
- * @param y2 the y coordinate of the curve’s new
- * end point.
- */
- public void setCurve(double x1, double y1, double cx, double cy,
- double x2, double y2)
- {
- this.x1 = (float) x1;
- this.y1 = (float) y1;
- ctrlx = (float) cx;
- ctrly = (float) cy;
- this.x2 = (float) x2;
- this.y2 = (float) y2;
- }
-
- /**
- * Changes the geometry of the curve, specifying coordinate values
- * as single-precision floating-point numbers.
- *
- * @param x1 the x coordinate of the curve’s new
- * start point.
- *
- * @param y1 the y coordinate of the curve’s new
- * start point.
- *
- * @param cx the x coordinate of the curve’s new
- * control point.
- *
- * @param cy the y coordinate of the curve’s new
- * control point.
- *
- * @param x2 the x coordinate of the curve’s new
- * end point.
- *
- * @param y2 the y coordinate of the curve’s new
- * end point.
- */
- public void setCurve(float x1, float y1, float cx, float cy, float x2,
- float y2)
- {
- this.x1 = x1;
- this.y1 = y1;
- ctrlx = cx;
- ctrly = cy;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- /**
- * Determines the smallest rectangle that encloses the
- * curve’s start, end and control point. As the
- * illustration below shows, the invisible control point may cause
- * the bounds to be much larger than the area that is actually
- * covered by the curve.
- *
- *
- */
- public Rectangle2D getBounds2D()
- {
- float nx1 = (float) Math.min(Math.min(x1, ctrlx), x2);
- float ny1 = (float) Math.min(Math.min(y1, ctrly), y2);
- float nx2 = (float) Math.max(Math.max(x1, ctrlx), x2);
- float ny2 = (float) Math.max(Math.max(y1, ctrly), y2);
- return new Rectangle2D.Float(nx1, ny1, nx2 - nx1, ny2 - ny1);
- }
- }
-}
diff --git a/libjava/java/awt/geom/Rectangle2D.java b/libjava/java/awt/geom/Rectangle2D.java
deleted file mode 100644
index 6a255f95391..00000000000
--- a/libjava/java/awt/geom/Rectangle2D.java
+++ /dev/null
@@ -1,992 +0,0 @@
-/* Rectangle2D.java -- generic rectangles in 2-D space
- Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.geom;
-
-import java.util.NoSuchElementException;
-
-/**
- * This class describes a rectangle by a point (x,y) and dimension (w x h).
- * The actual storage is left up to subclasses.
- *
- *
contains
or intersects
is
- * undefined unless the rectangle has positive width and height.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public abstract class Rectangle2D extends RectangularShape
-{
- /**
- * The point lies left of the rectangle (p.x < r.x).
- *
- * @see #outcode(double, double)
- */
- public static final int OUT_LEFT = 1;
-
- /**
- * The point lies above the rectangle (p.y < r.y).
- *
- * @see #outcode(double, double)
- */
- public static final int OUT_TOP = 2;
-
- /**
- * The point lies right of the rectangle (p.x > r.maxX).
- *
- * @see #outcode(double, double)
- */
- public static final int OUT_RIGHT = 4;
-
- /**
- * The point lies below of the rectangle (p.y > r.maxY).
- *
- * @see #outcode(double, double)
- */
- public static final int OUT_BOTTOM = 8;
-
- /**
- * Default constructor.
- */
- protected Rectangle2D()
- {
- }
-
- /**
- * Set the bounding box of this rectangle.
- *
- * @param x the new X coordinate
- * @param y the new Y coordinate
- * @param w the new width
- * @param h the new height
- */
- public abstract void setRect(double x, double y, double w, double h);
-
- /**
- * Set the bounding box of this rectangle from the given one.
- *
- * @param r rectangle to copy
- * @throws NullPointerException if r is null
- */
- public void setRect(Rectangle2D r)
- {
- setRect(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Tests if the specified line intersects the interior of this rectangle.
- *
- * @param x1 the first x coordinate of line segment
- * @param y1 the first y coordinate of line segment
- * @param x2 the second x coordinate of line segment
- * @param y2 the second y coordinate of line segment
- * @return true if the line intersects the rectangle
- */
- public boolean intersectsLine(double x1, double y1, double x2, double y2)
- {
- double x = getX();
- double y = getY();
- double w = getWidth();
- double h = getHeight();
- if (w <= 0 || h <= 0)
- return false;
-
- if (x1 >= x && x1 <= x + w && y1 >= y && y1 <= y + h)
- return true;
- if (x2 >= x && x2 <= x + w && y2 >= y && y2 <= y + h)
- return true;
-
- double x3 = x + w;
- double y3 = y + h;
-
- return (Line2D.linesIntersect(x1, y1, x2, y2, x, y, x, y3)
- || Line2D.linesIntersect(x1, y1, x2, y2, x, y3, x3, y3)
- || Line2D.linesIntersect(x1, y1, x2, y2, x3, y3, x3, y)
- || Line2D.linesIntersect(x1, y1, x2, y2, x3, y, x, y));
- }
-
- /**
- * Tests if the specified line intersects the interior of this rectangle.
- *
- * @param l the line segment
- * @return true if the line intersects the rectangle
- * @throws NullPointerException if l is null
- */
- public boolean intersectsLine(Line2D l)
- {
- return intersectsLine(l.getX1(), l.getY1(), l.getX2(), l.getY2());
- }
-
- /**
- * Determine where the point lies with respect to this rectangle. The
- * result will be the binary OR of the appropriate bit masks.
- *
- * @param x the x coordinate to check
- * @param y the y coordinate to check
- * @return the binary OR of the result
- * @see #OUT_LEFT
- * @see #OUT_TOP
- * @see #OUT_RIGHT
- * @see #OUT_BOTTOM
- */
- public abstract int outcode(double x, double y);
-
- /**
- * Determine where the point lies with respect to this rectangle. The
- * result will be the binary OR of the appropriate bit masks.
- *
- * @param p the point to check
- * @return the binary OR of the result
- * @throws NullPointerException if p is null
- * @see #OUT_LEFT
- * @see #OUT_TOP
- * @see #OUT_RIGHT
- * @see #OUT_BOTTOM
- */
- public int outcode(Point2D p)
- {
- return outcode(p.getX(), p.getY());
- }
-
- /**
- * Set the bounding box of this rectangle.
- *
- * @param x the new X coordinate
- * @param y the new Y coordinate
- * @param w the new width
- * @param h the new height
- */
- public void setFrame(double x, double y, double w, double h)
- {
- setRect(x, y, w, h);
- }
-
- /**
- * Returns the bounds of this rectangle. A pretty useless method, as this
- * is already a rectangle.
- *
- * @return a copy of this rectangle
- */
- public Rectangle2D getBounds2D()
- {
- return (Rectangle2D) clone();
- }
-
- /**
- * Test if the given point is contained in the rectangle.
- *
- * @param x the x coordinate of the point
- * @param y the y coordinate of the point
- * @return true if (x,y) is in the rectangle
- */
- public boolean contains(double x, double y)
- {
- double mx = getX();
- double my = getY();
- double w = getWidth();
- double h = getHeight();
- return w > 0 && h > 0 && x >= mx && x < mx + w && y >= my && y < my + h;
- }
-
- /**
- * Tests if the given rectangle intersects this one. In other words, test if
- * the two rectangles share at least one internal point.
- *
- * @param x the x coordinate of the other rectangle
- * @param y the y coordinate of the other rectangle
- * @param w the width of the other rectangle
- * @param h the height of the other rectangle
- * @return true if the rectangles intersect
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- double mx = getX();
- double my = getY();
- double mw = getWidth();
- double mh = getHeight();
- return w > 0 && h > 0 && mw > 0 && mh > 0
- && x < mx + mw && x + w > mx && y < my + mh && y + h > my;
- }
-
- /**
- * Tests if this rectangle contains the given one. In other words, test if
- * this rectangle contains all points in the given one.
- *
- * @param x the x coordinate of the other rectangle
- * @param y the y coordinate of the other rectangle
- * @param w the width of the other rectangle
- * @param h the height of the other rectangle
- * @return true if this rectangle contains the other
- */
- public boolean contains(double x, double y, double w, double h)
- {
- double mx = getX();
- double my = getY();
- double mw = getWidth();
- double mh = getHeight();
- return w > 0 && h > 0 && mw > 0 && mh > 0
- && x >= mx && x + w <= mx + mw && y >= my && y + h <= my + mh;
- }
-
- /**
- * Return a new rectangle which is the intersection of this and the given
- * one. The result will be empty if there is no intersection.
- *
- * @param r the rectangle to be intersected
- * @return the intersection
- * @throws NullPointerException if r is null
- */
- public abstract Rectangle2D createIntersection(Rectangle2D r);
-
- /**
- * Intersects a pair of rectangles, and places the result in the
- * destination; this can be used to avoid object creation. This method
- * even works when the destination is also a source, although you stand
- * to lose the original data.
- *
- * @param src1 the first source
- * @param src2 the second source
- * @param dest the destination for the intersection
- * @throws NullPointerException if any rectangle is null
- */
- public static void intersect(Rectangle2D src1, Rectangle2D src2,
- Rectangle2D dest)
- {
- double x = Math.max(src1.getX(), src2.getX());
- double y = Math.max(src1.getY(), src2.getY());
- double maxx = Math.min(src1.getMaxX(), src2.getMaxX());
- double maxy = Math.min(src1.getMaxY(), src2.getMaxY());
- dest.setRect(x, y, maxx - x, maxy - y);
- }
-
- /**
- * Return a new rectangle which is the union of this and the given one.
- *
- * @param r the rectangle to be merged
- * @return the union
- * @throws NullPointerException if r is null
- */
- public abstract Rectangle2D createUnion(Rectangle2D r);
-
- /**
- * Joins a pair of rectangles, and places the result in the destination;
- * this can be used to avoid object creation. This method even works when
- * the destination is also a source, although you stand to lose the
- * original data.
- *
- * @param src1 the first source
- * @param src2 the second source
- * @param dest the destination for the union
- * @throws NullPointerException if any rectangle is null
- */
- public static void union(Rectangle2D src1, Rectangle2D src2,
- Rectangle2D dest)
- {
- double x = Math.min(src1.getX(), src2.getX());
- double y = Math.min(src1.getY(), src2.getY());
- double maxx = Math.max(src1.getMaxX(), src2.getMaxX());
- double maxy = Math.max(src1.getMaxY(), src2.getMaxY());
- dest.setRect(x, y, maxx - x, maxy - y);
- }
-
- /**
- * Modifies this rectangle so that it represents the smallest rectangle
- * that contains both the existing rectangle and the specified point.
- * However, if the point falls on one of the two borders which are not
- * inside the rectangle, a subsequent call to contains
may
- * return false.
- *
- * @param newx the X coordinate of the point to add to this rectangle
- * @param newy the Y coordinate of the point to add to this rectangle
- */
- public void add(double newx, double newy)
- {
- double minx = Math.min(getX(), newx);
- double maxx = Math.max(getMaxX(), newx);
- double miny = Math.min(getY(), newy);
- double maxy = Math.max(getMaxY(), newy);
- setRect(minx, miny, maxx - minx, maxy - miny);
- }
-
- /**
- * Modifies this rectangle so that it represents the smallest rectangle
- * that contains both the existing rectangle and the specified point.
- * However, if the point falls on one of the two borders which are not
- * inside the rectangle, a subsequent call to contains
may
- * return false.
- *
- * @param p the point to add to this rectangle
- * @throws NullPointerException if p is null
- */
- public void add(Point2D p)
- {
- add(p.getX(), p.getY());
- }
-
- /**
- * Modifies this rectangle so that it represents the smallest rectangle
- * that contains both the existing rectangle and the specified rectangle.
- *
- * @param r the rectangle to add to this rectangle
- * @throws NullPointerException if r is null
- * @see #union(Rectangle2D, Rectangle2D, Rectangle2D)
- */
- public void add(Rectangle2D r)
- {
- union(this, r, this);
- }
-
- /**
- * Return an iterator along the shape boundary. If the optional transform
- * is provided, the iterator is transformed accordingly. Each call returns
- * a new object, independent from others in use. This iterator is thread
- * safe; modifications to the rectangle do not affect the results of this
- * path instance.
- *
- * @param at an optional transform to apply to the iterator
- * @return a new iterator over the boundary
- * @since 1.2
- */
- public PathIterator getPathIterator(final AffineTransform at)
- {
- final double minx = getX();
- final double miny = getY();
- final double maxx = minx + getWidth();
- final double maxy = miny + getHeight();
- return new PathIterator()
- {
- /** Current coordinate. */
- private int current = (maxx <= minx && maxy <= miny) ? 6 : 0;
-
- public int getWindingRule()
- {
- // A test program showed that Sun J2SE 1.3.1 and 1.4.1_01
- // return WIND_NON_ZERO paths. While this does not really
- // make any difference for rectangles (because they are not
- // self-intersecting), it seems appropriate to behave
- // identically.
-
- return WIND_NON_ZERO;
- }
-
- public boolean isDone()
- {
- return current > 5;
- }
-
- public void next()
- {
- current++;
- }
-
- public int currentSegment(float[] coords)
- {
- switch (current)
- {
- case 1:
- coords[0] = (float) maxx;
- coords[1] = (float) miny;
- break;
- case 2:
- coords[0] = (float) maxx;
- coords[1] = (float) maxy;
- break;
- case 3:
- coords[0] = (float) minx;
- coords[1] = (float) maxy;
- break;
- case 0:
- case 4:
- coords[0] = (float) minx;
- coords[1] = (float) miny;
- break;
- case 5:
- return SEG_CLOSE;
- default:
- throw new NoSuchElementException("rect iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return current == 0 ? SEG_MOVETO : SEG_LINETO;
- }
-
- public int currentSegment(double[] coords)
- {
- switch (current)
- {
- case 1:
- coords[0] = maxx;
- coords[1] = miny;
- break;
- case 2:
- coords[0] = maxx;
- coords[1] = maxy;
- break;
- case 3:
- coords[0] = minx;
- coords[1] = maxy;
- break;
- case 0:
- case 4:
- coords[0] = minx;
- coords[1] = miny;
- break;
- case 5:
- return SEG_CLOSE;
- default:
- throw new NoSuchElementException("rect iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return current == 0 ? SEG_MOVETO : SEG_LINETO;
- }
- };
- }
-
- /**
- * Return an iterator along the shape boundary. If the optional transform
- * is provided, the iterator is transformed accordingly. Each call returns
- * a new object, independent from others in use. This iterator is thread
- * safe; modifications to the rectangle do not affect the results of this
- * path instance. As the rectangle is already flat, the flatness parameter
- * is ignored.
- *
- * @param at an optional transform to apply to the iterator
- * @param flatness the maximum distance for deviation from the real boundary
- * @return a new iterator over the boundary
- * @since 1.2
- */
- public PathIterator getPathIterator(AffineTransform at, double flatness)
- {
- return getPathIterator(at);
- }
-
- /**
- * Return the hashcode for this rectangle. The formula is not documented, but
- * appears to be the same as:
- *
- * long l = Double.doubleToLongBits(getX())
- * + 37 * Double.doubleToLongBits(getY())
- * + 43 * Double.doubleToLongBits(getWidth())
- * + 47 * Double.doubleToLongBits(getHeight());
- * return (int) ((l >> 32) ^ l);
- *
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- // Talk about a fun time reverse engineering this one!
- long l = java.lang.Double.doubleToLongBits(getX())
- + 37 * java.lang.Double.doubleToLongBits(getY())
- + 43 * java.lang.Double.doubleToLongBits(getWidth())
- + 47 * java.lang.Double.doubleToLongBits(getHeight());
- return (int) ((l >> 32) ^ l);
- }
-
- /**
- * Tests this rectangle for equality against the specified object. This
- * will be true if an only if the specified object is an instance of
- * Rectangle2D with the same coordinates and dimensions.
- *
- * @param obj the object to test against for equality
- * @return true if the specified object is equal to this one
- */
- public boolean equals(Object obj)
- {
- if (! (obj instanceof Rectangle2D))
- return false;
- Rectangle2D r = (Rectangle2D) obj;
- return r.getX() == getX() && r.getY() == getY()
- && r.getWidth() == getWidth() && r.getHeight() == getHeight();
- }
-
- /**
- * This class defines a rectangle in double
precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
- public static class Double extends Rectangle2D
- {
- /** The x coordinate of the lower left corner. */
- public double x;
-
- /** The y coordinate of the lower left corner. */
- public double y;
-
- /** The width of the rectangle. */
- public double width;
-
- /** The height of the rectangle. */
- public double height;
-
- /**
- * Create a rectangle at (0,0) with width 0 and height 0.
- */
- public Double()
- {
- }
-
- /**
- * Create a rectangle with the given values.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- public Double(double x, double y, double w, double h)
- {
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- }
-
- /**
- * Return the X coordinate.
- *
- * @return the value of x
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Return the Y coordinate.
- *
- * @return the value of y
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Return the width.
- *
- * @return the value of width
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Return the height.
- *
- * @return the value of height
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Test if the rectangle is empty.
- *
- * @return true if width or height is not positive
- */
- public boolean isEmpty()
- {
- return width <= 0 || height <= 0;
- }
-
- /**
- * Set the contents of this rectangle to those specified.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- public void setRect(double x, double y, double w, double h)
- {
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- }
-
- /**
- * Set the contents of this rectangle to those specified.
- *
- * @param r the rectangle to copy
- * @throws NullPointerException if r is null
- */
- public void setRect(Rectangle2D r)
- {
- x = r.getX();
- y = r.getY();
- width = r.getWidth();
- height = r.getHeight();
- }
-
- /**
- * Determine where the point lies with respect to this rectangle. The
- * result will be the binary OR of the appropriate bit masks.
- *
- * @param x the x coordinate to check
- * @param y the y coordinate to check
- * @return the binary OR of the result
- * @see #OUT_LEFT
- * @see #OUT_TOP
- * @see #OUT_RIGHT
- * @see #OUT_BOTTOM
- * @since 1.2
- */
- public int outcode(double x, double y)
- {
- int result = 0;
- if (width <= 0)
- result |= OUT_LEFT | OUT_RIGHT;
- else if (x < this.x)
- result |= OUT_LEFT;
- else if (x > this.x + width)
- result |= OUT_RIGHT;
- if (height <= 0)
- result |= OUT_BOTTOM | OUT_TOP;
- else if (y < this.y) // Remember that +y heads top-to-bottom.
- result |= OUT_TOP;
- else if (y > this.y + height)
- result |= OUT_BOTTOM;
- return result;
- }
-
- /**
- * Returns the bounds of this rectangle. A pretty useless method, as this
- * is already a rectangle.
- *
- * @return a copy of this rectangle
- */
- public Rectangle2D getBounds2D()
- {
- return new Double(x, y, width, height);
- }
-
- /**
- * Return a new rectangle which is the intersection of this and the given
- * one. The result will be empty if there is no intersection.
- *
- * @param r the rectangle to be intersected
- * @return the intersection
- * @throws NullPointerException if r is null
- */
- public Rectangle2D createIntersection(Rectangle2D r)
- {
- Double res = new Double();
- intersect(this, r, res);
- return res;
- }
-
- /**
- * Return a new rectangle which is the union of this and the given one.
- *
- * @param r the rectangle to be merged
- * @return the union
- * @throws NullPointerException if r is null
- */
- public Rectangle2D createUnion(Rectangle2D r)
- {
- Double res = new Double();
- union(this, r, res);
- return res;
- }
-
- /**
- * Returns a string representation of this rectangle. This is in the form
- * getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
- * + ",h=" + height + ']'
.
- *
- * @return a string representation of this rectangle
- */
- public String toString()
- {
- return getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
- + ",h=" + height + ']';
- }
- }
-
- /**
- * This class defines a rectangle in float
precision.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
- public static class Float extends Rectangle2D
- {
- /** The x coordinate of the lower left corner. */
- public float x;
-
- /** The y coordinate of the lower left corner. */
- public float y;
-
- /** The width of the rectangle. */
- public float width;
-
- /** The height of the rectangle. */
- public float height;
-
- /**
- * Create a rectangle at (0,0) with width 0 and height 0.
- */
- public Float()
- {
- }
-
- /**
- * Create a rectangle with the given values.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- public Float(float x, float y, float w, float h)
- {
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- }
-
- /**
- * Create a rectangle with the given values.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- Float(double x, double y, double w, double h)
- {
- this.x = (float) x;
- this.y = (float) y;
- width = (float) w;
- height = (float) h;
- }
-
- /**
- * Return the X coordinate.
- *
- * @return the value of x
- */
- public double getX()
- {
- return x;
- }
-
- /**
- * Return the Y coordinate.
- *
- * @return the value of y
- */
- public double getY()
- {
- return y;
- }
-
- /**
- * Return the width.
- *
- * @return the value of width
- */
- public double getWidth()
- {
- return width;
- }
-
- /**
- * Return the height.
- *
- * @return the value of height
- */
- public double getHeight()
- {
- return height;
- }
-
- /**
- * Test if the rectangle is empty.
- *
- * @return true if width or height is not positive
- */
- public boolean isEmpty()
- {
- return width <= 0 || height <= 0;
- }
-
- /**
- * Set the contents of this rectangle to those specified.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- public void setRect(float x, float y, float w, float h)
- {
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- }
-
- /**
- * Set the contents of this rectangle to those specified.
- *
- * @param x the x coordinate
- * @param y the y coordinate
- * @param w the width
- * @param h the height
- */
- public void setRect(double x, double y, double w, double h)
- {
- this.x = (float) x;
- this.y = (float) y;
- width = (float) w;
- height = (float) h;
- }
-
- /**
- * Set the contents of this rectangle to those specified.
- *
- * @param r the rectangle to copy
- * @throws NullPointerException if r is null
- */
- public void setRect(Rectangle2D r)
- {
- x = (float) r.getX();
- y = (float) r.getY();
- width = (float) r.getWidth();
- height = (float) r.getHeight();
- }
-
- /**
- * Determine where the point lies with respect to this rectangle. The
- * result will be the binary OR of the appropriate bit masks.
- *
- * @param x the x coordinate to check
- * @param y the y coordinate to check
- * @return the binary OR of the result
- * @see #OUT_LEFT
- * @see #OUT_TOP
- * @see #OUT_RIGHT
- * @see #OUT_BOTTOM
- * @since 1.2
- */
- public int outcode(double x, double y)
- {
- int result = 0;
- if (width <= 0)
- result |= OUT_LEFT | OUT_RIGHT;
- else if (x < this.x)
- result |= OUT_LEFT;
- else if (x > this.x + width)
- result |= OUT_RIGHT;
- if (height <= 0)
- result |= OUT_BOTTOM | OUT_TOP;
- else if (y < this.y) // Remember that +y heads top-to-bottom.
- result |= OUT_TOP;
- else if (y > this.y + height)
- result |= OUT_BOTTOM;
- return result;
- }
-
- /**
- * Returns the bounds of this rectangle. A pretty useless method, as this
- * is already a rectangle.
- *
- * @return a copy of this rectangle
- */
- public Rectangle2D getBounds2D()
- {
- return new Float(x, y, width, height);
- }
-
- /**
- * Return a new rectangle which is the intersection of this and the given
- * one. The result will be empty if there is no intersection.
- *
- * @param r the rectangle to be intersected
- * @return the intersection
- * @throws NullPointerException if r is null
- */
- public Rectangle2D createIntersection(Rectangle2D r)
- {
- Float res = new Float();
- intersect(this, r, res);
- return res;
- }
-
- /**
- * Return a new rectangle which is the union of this and the given one.
- *
- * @param r the rectangle to be merged
- * @return the union
- * @throws NullPointerException if r is null
- */
- public Rectangle2D createUnion(Rectangle2D r)
- {
- Float res = new Float();
- union(this, r, res);
- return res;
- }
-
- /**
- * Returns a string representation of this rectangle. This is in the form
- * getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
- * + ",h=" + height + ']'
.
- *
- * @return a string representation of this rectangle
- */
- public String toString()
- {
- return getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
- + ",h=" + height + ']';
- }
- }
-}
diff --git a/libjava/java/awt/geom/RectangularShape.java b/libjava/java/awt/geom/RectangularShape.java
deleted file mode 100644
index 8f66dabf2e7..00000000000
--- a/libjava/java/awt/geom/RectangularShape.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/* RectangularShape.java -- a rectangular frame for several generic shapes
- Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.geom;
-
-import java.awt.Rectangle;
-import java.awt.Shape;
-
-/**
- * This class provides a generic framework, and several helper methods, for
- * subclasses which represent geometric objects inside a rectangular frame.
- * This does not specify any geometry except for the bounding box.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @see Arc2D
- * @see Ellipse2D
- * @see Rectangle2D
- * @see RoundRectangle2D
- * @status updated to 1.4
- */
-public abstract class RectangularShape implements Shape, Cloneable
-{
- /**
- * Default constructor.
- */
- protected RectangularShape()
- {
- }
-
- /**
- * Get the x coordinate of the upper-left corner of the framing rectangle.
- *
- * @return the x coordinate
- */
- public abstract double getX();
-
- /**
- * Get the y coordinate of the upper-left corner of the framing rectangle.
- *
- * @return the y coordinate
- */
- public abstract double getY();
-
- /**
- * Get the width of the framing rectangle.
- *
- * @return the width
- */
- public abstract double getWidth();
-
- /**
- * Get the height of the framing rectangle.
- *
- * @return the height
- */
- public abstract double getHeight();
-
- /**
- * Get the minimum x coordinate in the frame. This is misnamed, or else
- * Sun has a bug, because the implementation returns getX() even when
- * getWidth() is negative.
- *
- * @return the minimum x coordinate
- */
- public double getMinX()
- {
- return getX();
- }
-
- /**
- * Get the minimum y coordinate in the frame. This is misnamed, or else
- * Sun has a bug, because the implementation returns getY() even when
- * getHeight() is negative.
- *
- * @return the minimum y coordinate
- */
- public double getMinY()
- {
- return getY();
- }
-
- /**
- * Get the maximum x coordinate in the frame. This is misnamed, or else
- * Sun has a bug, because the implementation returns getX()+getWidth() even
- * when getWidth() is negative.
- *
- * @return the maximum x coordinate
- */
- public double getMaxX()
- {
- return getX() + getWidth();
- }
-
- /**
- * Get the maximum y coordinate in the frame. This is misnamed, or else
- * Sun has a bug, because the implementation returns getY()+getHeight() even
- * when getHeight() is negative.
- *
- * @return the maximum y coordinate
- */
- public double getMaxY()
- {
- return getY() + getHeight();
- }
-
- /**
- * Return the x coordinate of the center point of the framing rectangle.
- *
- * @return the central x coordinate
- */
- public double getCenterX()
- {
- return getX() + getWidth() / 2;
- }
-
- /**
- * Return the y coordinate of the center point of the framing rectangle.
- *
- * @return the central y coordinate
- */
- public double getCenterY()
- {
- return getY() + getHeight() / 2;
- }
-
- /**
- * Return the frame around this object. Note that this may be a looser
- * bounding box than getBounds2D.
- *
- * @return the frame, in double precision
- * @see #setFrame(double, double, double, double)
- */
- public Rectangle2D getFrame()
- {
- return new Rectangle2D.Double(getX(), getY(), getWidth(), getHeight());
- }
-
- /**
- * Test if the shape is empty, meaning that no points are inside it.
- *
- * @return true if the shape is empty
- */
- public abstract boolean isEmpty();
-
- /**
- * Set the framing rectangle of this shape to the given coordinate and size.
- *
- * @param x the new x coordinate
- * @param y the new y coordinate
- * @param w the new width
- * @param h the new height
- * @see #getFrame()
- */
- public abstract void setFrame(double x, double y, double w, double h);
-
- /**
- * Set the framing rectangle of this shape to the given coordinate and size.
- *
- * @param p the new point
- * @param d the new dimension
- * @throws NullPointerException if p or d is null
- * @see #getFrame()
- */
- public void setFrame(Point2D p, Dimension2D d)
- {
- setFrame(p.getX(), p.getY(), d.getWidth(), d.getHeight());
- }
-
- /**
- * Set the framing rectangle of this shape to the given rectangle.
- *
- * @param r the new framing rectangle
- * @throws NullPointerException if r is null
- * @see #getFrame()
- */
- public void setFrame(Rectangle2D r)
- {
- setFrame(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Set the framing rectangle of this shape using two points on a diagonal.
- * The area will be positive.
- *
- * @param x1 the first x coordinate
- * @param y1 the first y coordinate
- * @param x2 the second x coordinate
- * @param y2 the second y coordinate
- */
- public void setFrameFromDiagonal(double x1, double y1, double x2, double y2)
- {
- if (x1 > x2)
- {
- double t = x2;
- x2 = x1;
- x1 = t;
- }
- if (y1 > y2)
- {
- double t = y2;
- y2 = y1;
- y1 = t;
- }
- setFrame(x1, y1, x2 - x1, y2 - y1);
- }
-
- /**
- * Set the framing rectangle of this shape using two points on a diagonal.
- * The area will be positive.
- *
- * @param p1 the first point
- * @param p2 the second point
- * @throws NullPointerException if either point is null
- */
- public void setFrameFromDiagonal(Point2D p1, Point2D p2)
- {
- setFrameFromDiagonal(p1.getX(), p1.getY(), p2.getX(), p2.getY());
- }
-
- /**
- * Set the framing rectangle of this shape using the center of the frame,
- * and one of the four corners. The area will be positive.
- *
- * @param centerX the x coordinate at the center
- * @param centerY the y coordinate at the center
- * @param cornerX the x coordinate at a corner
- * @param cornerY the y coordinate at a corner
- */
- public void setFrameFromCenter(double centerX, double centerY,
- double cornerX, double cornerY)
- {
- double halfw = Math.abs(cornerX - centerX);
- double halfh = Math.abs(cornerY - centerY);
- setFrame(centerX - halfw, centerY - halfh, halfw + halfw, halfh + halfh);
- }
-
- /**
- * Set the framing rectangle of this shape using the center of the frame,
- * and one of the four corners. The area will be positive.
- *
- * @param center the center point
- * @param corner a corner point
- * @throws NullPointerException if either point is null
- */
- public void setFrameFromCenter(Point2D center, Point2D corner)
- {
- setFrameFromCenter(center.getX(), center.getY(),
- corner.getX(), corner.getY());
- }
-
- /**
- * Tests if a point is inside the boundary of the shape.
- *
- * @param p the point to test
- * @return true if the point is inside the shape
- * @throws NullPointerException if p is null
- * @see #contains(double, double)
- */
- public boolean contains(Point2D p)
- {
- return contains(p.getX(), p.getY());
- }
-
- /**
- * Tests if a rectangle and this shape share common internal points.
- *
- * @param r the rectangle to test
- * @return true if the rectangle intersects this shpae
- * @throws NullPointerException if r is null
- * @see #intersects(double, double, double, double)
- */
- public boolean intersects(Rectangle2D r)
- {
- return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Tests if the shape completely contains the given rectangle.
- *
- * @param r the rectangle to test
- * @return true if r is contained in this shape
- * @throws NullPointerException if r is null
- * @see #contains(double, double, double, double)
- */
- public boolean contains(Rectangle2D r)
- {
- return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight());
- }
-
- /**
- * Returns a bounding box for this shape, in integer format. Notice that you
- * may get a tighter bound with getBounds2D. If the frame is empty, the
- * box is the default empty box at the origin.
- *
- * @return a bounding box
- */
- public Rectangle getBounds()
- {
- if (isEmpty())
- return new Rectangle();
- double x = getX();
- double y = getY();
- double maxx = Math.ceil(x + getWidth());
- double maxy = Math.ceil(y + getHeight());
- x = Math.floor(x);
- y = Math.floor(y);
- return new Rectangle((int) x, (int) y, (int) (maxx - x), (int) (maxy - y));
- }
-
- /**
- * Return an iterator along the shape boundary. If the optional transform
- * is provided, the iterator is transformed accordingly. The path is
- * flattened until all segments differ from the curve by at most the value
- * of the flatness parameter, within the limits of the default interpolation
- * recursion limit of 1024 segments between actual points. Each call
- * returns a new object, independent from others in use. The result is
- * threadsafe if and only if the iterator returned by
- * {@link #getPathIterator(AffineTransform)} is as well.
- *
- * @param at an optional transform to apply to the iterator
- * @param flatness the desired flatness
- * @return a new iterator over the boundary
- * @throws IllegalArgumentException if flatness is invalid
- * @since 1.2
- */
- public PathIterator getPathIterator(AffineTransform at, double flatness)
- {
- return new FlatteningPathIterator(getPathIterator(at), flatness);
- }
-
- /**
- * Create a new shape of the same run-time type with the same contents as
- * this one.
- *
- * @return the clone
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-} // class RectangularShape
diff --git a/libjava/java/awt/geom/RoundRectangle2D.java b/libjava/java/awt/geom/RoundRectangle2D.java
deleted file mode 100644
index ac0e6f8128a..00000000000
--- a/libjava/java/awt/geom/RoundRectangle2D.java
+++ /dev/null
@@ -1,533 +0,0 @@
-/* RoundRectangle2D.java -- represents a rectangle with rounded corners
- Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.geom;
-
-import java.util.NoSuchElementException;
-
-
-/** This class implements a rectangle with rounded corners.
- * @author Tom Tromey (tromey@cygnus.com)
- * @date December 3, 2000
- */
-public abstract class RoundRectangle2D extends RectangularShape
-{
- /** Return the arc height of this round rectangle. */
- public abstract double getArcHeight();
-
- /** Return the arc width of this round rectangle. */
- public abstract double getArcWidth();
-
- /** Set the values of this round rectangle
- * @param x The x coordinate
- * @param y The y coordinate
- * @param w The width
- * @param h The height
- * @param arcWidth The arc width
- * @param arcHeight The arc height
- */
- public abstract void setRoundRect(double x, double y, double w, double h,
- double arcWidth, double arcHeight);
-
- /** Create a RoundRectangle2D. This is protected because this class
- * is abstract and cannot be instantiated.
- */
- protected RoundRectangle2D()
- {
- }
-
- /** Return true if this object contains the specified point.
- * @param x The x coordinate
- * @param y The y coordinate
- */
- public boolean contains(double x, double y)
- {
- double mx = getX();
- double mw = getWidth();
- if (x < mx || x >= mx + mw)
- return false;
- double my = getY();
- double mh = getHeight();
- if (y < my || y >= my + mh)
- return false;
-
- // Now check to see if the point is in range of an arc.
- double dy = Math.min(Math.abs(my - y), Math.abs(my + mh - y));
- double dx = Math.min(Math.abs(mx - x), Math.abs(mx + mw - x));
-
- // The arc dimensions are that of the corresponding ellipse
- // thus a 90 degree segment is half of that.
- double aw = getArcWidth() / 2.0;
- double ah = getArcHeight() / 2.0;
- if (dx > aw || dy > ah)
- return true;
-
- // At this point DX represents the distance from the nearest edge
- // of the rectangle. But we want to transform it to represent the
- // scaled distance from the center of the ellipse that forms the
- // arc. Hence this code:
- dy = (ah - dy) / ah;
- dx = (aw - dx) / aw;
-
- return dx * dx + dy * dy <= 1.0;
- }
-
- /** Return true if this object contains the specified rectangle
- * @param x The x coordinate
- * @param y The y coordinate
- * @param w The width
- * @param h The height
- */
- public boolean contains(double x, double y, double w, double h)
- {
- // We have to check all four points here (for ordinary rectangles
- // we can just check opposing corners).
- return (contains(x, y) && contains(x, y + h) && contains(x + w, y + h)
- && contains(x + w, y));
- }
-
- /** Return a new path iterator which iterates over this rectangle.
- * @param at An affine transform to apply to the object
- */
- public PathIterator getPathIterator(final AffineTransform at)
- {
- final double minx = getX();
- final double miny = getY();
- final double maxx = minx + getWidth();
- final double maxy = miny + getHeight();
- final double arcwidth = getArcWidth();
- final double archeight = getArcHeight();
- return new PathIterator()
- {
- /** We iterate counterclockwise around the rectangle, starting in the
- * upper right. This variable tracks our current point, which
- * can be on either side of a given corner. */
- private int current = 0;
-
- /** Child path iterator, used for corners. */
- private PathIterator corner;
-
- /** This is used when rendering the corners. We re-use the arc
- * for each corner. */
- private Arc2D arc = new Arc2D.Double();
-
- /** Temporary array used by getPoint. */
- private double[] temp = new double[2];
-
- public int getWindingRule()
- {
- return WIND_NON_ZERO;
- }
-
- public boolean isDone()
- {
- return current > 9;
- }
-
- private void getPoint(int val)
- {
- switch (val)
- {
- case 0:
- case 8:
- temp[0] = maxx;
- temp[1] = miny + archeight;
- break;
- case 7:
- temp[0] = maxx;
- temp[1] = maxy - archeight;
- break;
- case 6:
- temp[0] = maxx - arcwidth;
- temp[1] = maxy;
- break;
- case 5:
- temp[0] = minx + arcwidth;
- temp[1] = maxy;
- break;
- case 4:
- temp[0] = minx;
- temp[1] = maxy - archeight;
- break;
- case 3:
- temp[0] = minx;
- temp[1] = miny + archeight;
- break;
- case 2:
- temp[0] = minx + arcwidth;
- temp[1] = miny;
- break;
- case 1:
- temp[0] = maxx - arcwidth;
- temp[1] = miny;
- break;
- }
- }
-
- public void next()
- {
- if (current >= 8)
- ++current;
- else if (corner != null)
- {
- // We're iterating through the corner. Work on the child
- // iterator; if it finishes, reset and move to the next
- // point along the rectangle.
- corner.next();
- if (corner.isDone())
- {
- corner = null;
- ++current;
- }
- }
- else
- {
- // Make an arc between this point on the rectangle and
- // the next one, and then iterate over this arc.
- getPoint(current);
- double x1 = temp[0];
- double y1 = temp[1];
- getPoint(current + 1);
- Rectangle2D.Double r = new Rectangle2D.Double(Math.min(x1,
- temp[0]),
- Math.min(y1,
- temp[1]),
- Math.abs(x1
- - temp[0]),
- Math.abs(y1
- - temp[1]));
- arc.setArc(r, (current >> 1) * 90.0, 90.0, Arc2D.OPEN);
- corner = arc.getPathIterator(at);
- }
- }
-
- public int currentSegment(float[] coords)
- {
- if (corner != null)
- {
- int r = corner.currentSegment(coords);
- if (r == SEG_MOVETO)
- r = SEG_LINETO;
- return r;
- }
-
- if (current < 9)
- {
- getPoint(current);
- coords[0] = (float) temp[0];
- coords[1] = (float) temp[1];
- }
- else if (current == 9)
- return SEG_CLOSE;
- else
- throw new NoSuchElementException("rect iterator out of bounds");
-
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return current == 0 ? SEG_MOVETO : SEG_LINETO;
- }
-
- public int currentSegment(double[] coords)
- {
- if (corner != null)
- {
- int r = corner.currentSegment(coords);
- if (r == SEG_MOVETO)
- r = SEG_LINETO;
- return r;
- }
-
- if (current < 9)
- {
- getPoint(current);
- coords[0] = temp[0];
- coords[1] = temp[1];
- }
- else if (current == 9)
- return SEG_CLOSE;
- else
- throw new NoSuchElementException("rect iterator out of bounds");
-
- if (at != null)
- at.transform(coords, 0, coords, 0, 1);
- return current == 0 ? SEG_MOVETO : SEG_LINETO;
- }
- };
- }
-
- /** Return true if the given rectangle intersects this shape.
- * @param x The x coordinate
- * @param y The y coordinate
- * @param w The width
- * @param h The height
- */
- public boolean intersects(double x, double y, double w, double h)
- {
- // Check if any corner is within the rectangle
- return (contains(x, y) || contains(x, y + h) || contains(x + w, y + h)
- || contains(x + w, y));
- }
-
- /** Set the boundary of this round rectangle.
- * @param x The x coordinate
- * @param y The y coordinate
- * @param w The width
- * @param h The height
- */
- public void setFrame(double x, double y, double w, double h)
- {
- // This is a bit lame.
- setRoundRect(x, y, w, h, getArcWidth(), getArcHeight());
- }
-
- /** Set the values of this round rectangle to be the same as those
- * of the argument.
- * @param rr The round rectangle to copy
- */
- public void setRoundRect(RoundRectangle2D rr)
- {
- setRoundRect(rr.getX(), rr.getY(), rr.getWidth(), rr.getHeight(),
- rr.getArcWidth(), rr.getArcHeight());
- }
-
- /** A subclass of RoundRectangle which keeps its parameters as
- * doubles. */
- public static class Double extends RoundRectangle2D
- {
- /** The height of the corner arc. */
- public double archeight;
-
- /** The width of the corner arc. */
- public double arcwidth;
-
- /** The x coordinate of this object. */
- public double x;
-
- /** The y coordinate of this object. */
- public double y;
-
- /** The width of this object. */
- public double width;
-
- /** The height of this object. */
- public double height;
-
- /** Construct a new instance, with all parameters set to 0. */
- public Double()
- {
- }
-
- /** Construct a new instance with the given arguments.
- * @param x The x coordinate
- * @param y The y coordinate
- * @param w The width
- * @param h The height
- * @param arcWidth The arc width
- * @param arcHeight The arc height
- */
- public Double(double x, double y, double w, double h, double arcWidth,
- double arcHeight)
- {
- this.x = x;
- this.y = y;
- this.width = w;
- this.height = h;
- this.arcwidth = arcWidth;
- this.archeight = arcHeight;
- }
-
- public double getArcHeight()
- {
- return archeight;
- }
-
- public double getArcWidth()
- {
- return arcwidth;
- }
-
- public Rectangle2D getBounds2D()
- {
- return new Rectangle2D.Double(x, y, width, height);
- }
-
- public double getX()
- {
- return x;
- }
-
- public double getY()
- {
- return y;
- }
-
- public double getWidth()
- {
- return width;
- }
-
- public double getHeight()
- {
- return height;
- }
-
- public boolean isEmpty()
- {
- return width <= 0 || height <= 0;
- }
-
- public void setRoundRect(double x, double y, double w, double h,
- double arcWidth, double arcHeight)
- {
- this.x = x;
- this.y = y;
- this.width = w;
- this.height = h;
- this.arcwidth = arcWidth;
- this.archeight = arcHeight;
- }
- } // class Double
-
- /** A subclass of RoundRectangle which keeps its parameters as
- * floats. */
- public static class Float extends RoundRectangle2D
- {
- /** The height of the corner arc. */
- public float archeight;
-
- /** The width of the corner arc. */
- public float arcwidth;
-
- /** The x coordinate of this object. */
- public float x;
-
- /** The y coordinate of this object. */
- public float y;
-
- /** The width of this object. */
- public float width;
-
- /** The height of this object. */
- public float height;
-
- /** Construct a new instance, with all parameters set to 0. */
- public Float()
- {
- }
-
- /** Construct a new instance with the given arguments.
- * @param x The x coordinate
- * @param y The y coordinate
- * @param w The width
- * @param h The height
- * @param arcWidth The arc width
- * @param arcHeight The arc height
- */
- public Float(float x, float y, float w, float h, float arcWidth,
- float arcHeight)
- {
- this.x = x;
- this.y = y;
- this.width = w;
- this.height = h;
- this.arcwidth = arcWidth;
- this.archeight = arcHeight;
- }
-
- public double getArcHeight()
- {
- return archeight;
- }
-
- public double getArcWidth()
- {
- return arcwidth;
- }
-
- public Rectangle2D getBounds2D()
- {
- return new Rectangle2D.Float(x, y, width, height);
- }
-
- public double getX()
- {
- return x;
- }
-
- public double getY()
- {
- return y;
- }
-
- public double getWidth()
- {
- return width;
- }
-
- public double getHeight()
- {
- return height;
- }
-
- public boolean isEmpty()
- {
- return width <= 0 || height <= 0;
- }
-
- public void setRoundRect(float x, float y, float w, float h,
- float arcWidth, float arcHeight)
- {
- this.x = x;
- this.y = y;
- this.width = w;
- this.height = h;
- this.arcwidth = arcWidth;
- this.archeight = arcHeight;
- }
-
- public void setRoundRect(double x, double y, double w, double h,
- double arcWidth, double arcHeight)
- {
- this.x = (float) x;
- this.y = (float) y;
- this.width = (float) w;
- this.height = (float) h;
- this.arcwidth = (float) arcWidth;
- this.archeight = (float) arcHeight;
- }
- } // class Float
-} // class RoundRectangle2D
diff --git a/libjava/java/awt/im/InputContext.java b/libjava/java/awt/im/InputContext.java
deleted file mode 100644
index e289677fe9c..00000000000
--- a/libjava/java/awt/im/InputContext.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/* InputContext.java -- provides the context for text input
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.im;
-
-import gnu.java.util.EmptyEnumeration;
-
-import java.awt.AWTEvent;
-import java.awt.AWTException;
-import java.awt.Component;
-import java.awt.im.spi.InputMethod;
-import java.awt.im.spi.InputMethodDescriptor;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Locale;
-
-/**
- * Provides a context for controlling input methods and keyboard layouts.
- * This class provides the communication layer between the client component,
- * and the various locale-dependent text entry input methods that can be used
- * for the client. By default, there is one instance per Window, shared among
- * all components, but this limits text entry to one component at a time.
- * Thus, text components can create their own instance to allow text entry
- * in multiple components at a time.
- *
- *
- *
- *
- *
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Component#getInputMethodRequests()
- * @see InputMethodListener
- * @since 1.2
- * @status updated to 1.4
- */
-public interface InputMethodRequests
-{
- /**
- * Gets the location of a given offset of the text. This can be used to
- * position a composition window near the location of where the composed
- * text will be inserted.
- *
- *
- *
- *
- * @param bounds the client window's current bounds, or null
- */
- void notifyClientWindowChange(Rectangle bounds);
-
- /**
- * Activate this input method for input processing. If the input method
- * provides its own windows, it should make them open and visible at this
- * time. This method is called when a client component receives a
- * FOCUS_GAINED event, or when switching to this input method from another
- * one. It is only called when the input method is inactive, assuming that
- * new instances begin in an inactive state.
- */
- void activate();
-
- /**
- * Deactivate this input method, either temporarily or permanently for the
- * given client. If the input method provides its own windows, it should
- * only close those related to the current composition (such as a lookup
- * choice panel), while leaving more persistant windows (like a control
- * panel) open to avoid screen flicker. Before control is given to another
- * input method, {@link #hideWindows()} will be called on this instance.
- * This method is called when a client component receives a
- * FOCUS_LOST event, when switching to another input method, or before
- * {@link #removeNotify()} when the client is removed.
- *
- * @param isTemporary true if the focus change is temporary
- */
- void deactivate(boolean isTemporary);
-
- /**
- * Close or hide all windows opened by this input method. This is called
- * before activating a different input method, and before calling
- * {@link #dispose()} on this instance. It is only called when the input
- * method is inactive.
- */
- void hideWindows();
-
- /**
- * Notify the input method that a client component has been removed from its
- * hierarchy, or that input method support has been disabled. This is
- * called by {@link InputContext#removeNotify()}, and only when the input
- * method is inactive.
- */
- void removeNotify();
-
- /**
- * End any input composition currently taking place. Depending on the
- * platform and user preferences, this may commit or delete uncommitted text,
- * using input method events. This may be called for a variety of reasons,
- * such as when the user moves the insertion point in the client text outside
- * the range of the composed text, or when text is saved to file. This is
- * called by {@link InputContext#endComposition()}, when switching to a
- * new input method, or by {@link InputContext#selectInputMethod(Locale)}.
- */
- void endComposition();
-
- /**
- * Disposes the input method and release any resources it is using. In
- * particular, the input method should dispose windows and close files. This
- * is called by {@link InputContext#dispose()}, when the input method is
- * inactive; and nothing will be called on this instance afterwards.
- */
- void dispose();
-
- /**
- * Returns a control object from this input method, or null. A control object
- * provides method to control the behavior of this input method, as well as
- * query information about it. The object is implementation dependent, so
- * clients must compare the result against known input method control
- * object types. This is called by
- * {@link InputContext#getInputMethodControlObject()}.
- *
- * @return the control object, or null
- */
- Object getControlObject();
-} // interface InputMethod
diff --git a/libjava/java/awt/im/spi/InputMethodContext.java b/libjava/java/awt/im/spi/InputMethodContext.java
deleted file mode 100644
index 43bee8d8617..00000000000
--- a/libjava/java/awt/im/spi/InputMethodContext.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* InputMethodContext.java -- communication between an input method and client
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.im.spi;
-
-import java.awt.Window;
-import java.awt.font.TextHitInfo;
-import java.awt.im.InputMethodRequests;
-import java.text.AttributedCharacterIterator;
-
-import javax.swing.JFrame;
-
-/**
- * Provides methods for the communication context between an input method
- * and the client component. This should be passed to
- * {@link InputMethod#setInputMethodContext(InputMethodContext)}.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- * @status updated to 1.4
- */
-public interface InputMethodContext extends InputMethodRequests
-{
- /**
- * Create an input method event and dispatch it to the client.
- *
- * @param id the event type
- * @param text an iterator over the text to be committed
- * @param count the count of characters to be committed
- * @param caret the insertion point of the commit, or null
- * @param visiblePosition the best location to make visible, or null
- */
- void dispatchInputMethodEvent(int id, AttributedCharacterIterator text,
- int count, TextHitInfo caret,
- TextHitInfo visiblePosition);
-
- /**
- * Creates a top-level window for use by the input method. This window should
- * float above all document windows and dialogs, not receive focus, and have
- * lightweight decorations (such as no title, reduced drag regions). But
- * this behavior may be modified to meet the platform style. The title may
- * or may not be displayed, depending on the platform.
- *
- * removeNotify
was
- * called on a previous client.
- * Currently this filter does nothing and needs to be implemented.
- *
- * @author C. Brian Jones (cbj@gnu.org)
- */
-public class AreaAveragingScaleFilter extends ReplicateScaleFilter
-{
- /**
- * Construct an instance of AreaAveragingScaleFilter
which
- * should be used in conjunction with a FilteredImageSource
- * object.
- *
- * @param width the width of the destination image
- * @param height the height of the destination image
- */
- public AreaAveragingScaleFilter(int width, int height) {
- super(width, height);
- }
-
- /**
- * The ImageProducer
should call this method with a
- * bit mask of hints from any of RANDOMPIXELORDER
,
- * TOPDOWNLEFTRIGHT
, COMPLETESCANLINES
,
- * SINGLEPASS
, SINGLEFRAME
from the
- * ImageConsumer
interface.
- *
- * FIXME - more than likely Sun's implementation desires
- * TOPDOWNLEFTRIGHT
order and this method is overloaded here
- * in order to assure that mask is part of the hints added to
- * the consumer.
- *
- * @param flags a bit mask of hints
- * @see ImageConsumer
- */
- public void setHints(int flags)
- {
- consumer.setHints(flags);
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as a byte
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize)
- {
- consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as an int
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels, int offset, int scansize)
- {
- consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
- }
-
-}
-
diff --git a/libjava/java/awt/image/BandCombineOp.java b/libjava/java/awt/image/BandCombineOp.java
deleted file mode 100644
index 79efb02e713..00000000000
--- a/libjava/java/awt/image/BandCombineOp.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-import java.awt.Point;
-import java.awt.RenderingHints;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * Filter Raster pixels by applying a matrix.
- *
- * BandCombineOp applies a matrix to each pixel to produce new pixel values.
- * The width of the matrix must be the same or one more than the number of
- * bands in the source Raster. If one more, the pixels in the source are
- * assumed to contain an implicit 1.0 at the end.
- *
- * The rows of the matrix are multiplied by the pixel to produce the values
- * for the destination. Therefore the destination Raster must contain the
- * same number of bands as the number of rows in the filter matrix.
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- */
-public class BandCombineOp implements RasterOp
-{
- private RenderingHints hints;
- private float[][] matrix;
-
- /**
- * Construct a BandCombineOp.
- *
- * @param matrix The matrix to filter pixels with.
- * @param hints Rendering hints to apply. Ignored.
- */
- public BandCombineOp(float[][] matrix, RenderingHints hints)
- {
- this.matrix = matrix;
- this.hints = hints;
- }
-
- /**
- * Filter Raster pixels through a matrix.
- *
- * Applies the Op matrix to source pixes to produce dest pixels. Each row
- * of the matrix is multiplied by the src pixel components to produce the
- * dest pixel. If matrix is one more than the number of bands in the src,
- * the last element is implicitly multiplied by 1, i.e. added to the sum
- * for that dest component.
- *
- * If dest is null, a suitable Raster is created. This implementation uses
- * createCompatibleDestRaster.
- *
- * @param src The source Raster.
- * @param dest The destination Raster, or null.
- * @returns The destination Raster or an allocated Raster.
- * @see java.awt.image.RasterOp#filter(java.awt.image.Raster,
- *java.awt.image.WritableRaster)
- */
- public WritableRaster filter(Raster src, WritableRaster dest) {
- if (dest == null)
- dest = createCompatibleDestRaster(src);
-
- // Filter the pixels
- float[] spix = new float[matrix[0].length];
- float[] dpix = new float[matrix.length];
- for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
- for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
- {
- // In case matrix rows have implicit translation
- spix[spix.length - 1] = 1.0f;
- src.getPixel(x, y, spix);
- for (int i = 0; i < matrix.length; i++)
- {
- dpix[i] = 0;
- for (int j = 0; j < matrix[0].length; j++)
- dpix[i] += spix[j] * matrix[i][j];
- }
- dest.setPixel(x, y, dpix);
- }
-
- return dest;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
- */
- public Rectangle2D getBounds2D(Raster src)
- {
- return src.getBounds();
- }
-
- /**
- * Creates a new WritableRaster that can be used as the destination for this
- * Op. This implementation creates a Banded Raster with data type FLOAT.
- * @see
- *java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
- */
- public WritableRaster createCompatibleDestRaster(Raster src)
- {
- return Raster.createBandedRaster(DataBuffer.TYPE_FLOAT, src.getWidth(),
- src.getHeight(), matrix.length,
- new Point(src.getMinX(), src.getMinY()));
- }
-
- /** Return corresponding destination point for source point.
- *
- * LookupOp will return the value of src unchanged.
- * @param src The source point.
- * @param dst The destination point.
- * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D,
- *java.awt.geom.Point2D)
- */
- public Point2D getPoint2D(Point2D src, Point2D dst)
- {
- if (dst == null) return (Point2D)src.clone();
- dst.setLocation(src);
- return dst;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#getRenderingHints()
- */
- public RenderingHints getRenderingHints()
- {
- return hints;
- }
-
- /** Return the matrix for this Op. */
- public float[][] getMatrix()
- {
- return matrix;
- }
-
-}
diff --git a/libjava/java/awt/image/BandedSampleModel.java b/libjava/java/awt/image/BandedSampleModel.java
deleted file mode 100644
index cf7a0c546de..00000000000
--- a/libjava/java/awt/image/BandedSampleModel.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/**
- * MultiPixelPackedSampleModel provides a single band model that supports
- * multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
- * per data element.
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- */
-public final class BandedSampleModel extends ComponentSampleModel
-{
- private int[] bitMasks;
- private int[] bitOffsets;
- private int[] sampleSize;
- private int dataBitOffset;
- private int elemBits;
- private int numberOfBits;
- private int numElems;
-
- public BandedSampleModel(int dataType, int w, int h, int numBands)
- {
- super(dataType, w, h, 1, w, new int[numBands]);
- }
-
- public BandedSampleModel(int dataType, int w, int h, int scanlineStride,
- int[] bankIndices, int[] bandOffsets)
- {
- super(dataType, w, h, 1, scanlineStride, bankIndices, bandOffsets);
- }
-
- public SampleModel createCompatibleSampleModel(int w, int h)
- {
- // NOTE: blackdown 1.4.1 sets all offsets to 0. Sun's 1.4.2 docs
- // disagree.
-
- // Compress offsets so minimum is 0, others w*scanlineStride
- int[] newoffsets = new int[bandOffsets.length];
- int[] order = new int[bandOffsets.length];
- for (int i=0; i < bandOffsets.length; i++)
- order[i] = i;
- // FIXME: This is N^2, but not a big issue, unless there's a lot of
- // bands...
- for (int i=0; i < bandOffsets.length; i++)
- for (int j=i+1; j < bandOffsets.length; i++)
- if (bankIndices[order[i]] > bankIndices[order[j]]
- || (bankIndices[order[i]] == bankIndices[order[j]]
- && bandOffsets[order[i]] > bandOffsets[order[j]]))
- {
- int t = order[i]; order[i] = order[j]; order[j] = t;
- }
- int bank = 0;
- int offset = 0;
- for (int i=0; i < bandOffsets.length; i++)
- {
- if (bankIndices[order[i]] != bank)
- {
- bank = bankIndices[order[i]];
- offset = 0;
- }
- newoffsets[order[i]] = offset;
- offset += w * scanlineStride;
- }
-
- return new BandedSampleModel(dataType, w, h, scanlineStride, bankIndices, newoffsets);
- }
-
-
- public SampleModel createSubsetSampleModel(int[] bands)
- {
- int[] newoff = new int[bands.length];
- int[] newbanks = new int[bands.length];
- for (int i=0; i < bands.length; i++)
- {
- int b = bands[i];
- newoff[i] = bandOffsets[b];
- newbanks[i] = bankIndices[b];
- }
-
- if (bands.length > bankIndices.length)
- throw new
- RasterFormatException("BandedSampleModel createSubsetSampleModel too"
- +" many bands");
-
- return new BandedSampleModel(dataType, width, height, scanlineStride,
- newbanks, newoff);
- }
-
- /**
- * Extract all samples of one pixel and return in an array of transfer type.
- *
- * Extracts the pixel at x, y from data and stores samples into the array
- * obj. If obj is null, a new array of getTransferType() is created.
- *
- * @param x The x-coordinate of the pixel rectangle to store in obj
.
- * @param y The y-coordinate of the pixel rectangle to store in obj
.
- * @param obj The primitive array to store the pixels into or null to force creation.
- * @param data The DataBuffer that is the source of the pixel data.
- * @return The primitive array containing the pixel data.
- * @see java.awt.image.SampleModel#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
- */
- public Object getDataElements(int x, int y, Object obj,
- DataBuffer data)
- {
- int pixel = getSample(x, y, 0, data);
- switch (getTransferType())
- {
- case DataBuffer.TYPE_BYTE:
- {
- byte[] b = (byte[])obj;
- if (b == null) b = new byte[numBands];
- for (int i=0; i < numBands; i++)
- b[i] = (byte)getSample(x, y, i, data);
- return b;
- }
- case DataBuffer.TYPE_SHORT:
- case DataBuffer.TYPE_USHORT:
- {
- short[] b = (short[])obj;
- if (b == null) b = new short[numBands];
- for (int i=0; i < numBands; i++)
- b[i] = (short)getSample(x, y, i, data);
- return b;
- }
- case DataBuffer.TYPE_INT:
- {
- int[] b = (int[])obj;
- if (b == null) b = new int[numBands];
- for (int i=0; i < numBands; i++)
- b[i] = getSample(x, y, i, data);
- return b;
- }
- case DataBuffer.TYPE_FLOAT:
- {
- float[] b = (float[])obj;
- if (b == null) b = new float[numBands];
- for (int i=0; i < numBands; i++)
- b[i] = getSampleFloat(x, y, i, data);
- return b;
- }
- case DataBuffer.TYPE_DOUBLE:
- {
- double[] b = (double[])obj;
- if (b == null) b = new double[numBands];
- for (int i=0; i < numBands; i++)
- b[i] = getSample(x, y, i, data);
- return b;
- }
-
- default:
- // Seems like the only sensible thing to do.
- throw new ClassCastException();
- }
- }
-
- public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
- {
- if (iArray == null) iArray = new int[numBands];
- for (int i=0; i < numBands; i++)
- iArray[i] = getSample(x, y, 0, data);
-
- return iArray;
- }
-
- /**
- * Copy pixels from a region into an array.
- *
- * Copies the samples of the pixels in the rectangle starting at x, y that
- * is w pixels wide and h scanlines high. When there is more than one band,
- * the samples stored in order before the next pixel. This ordering isn't
- * well specified in Sun's docs as of 1.4.2.
- *
- * If iArray is null, a new array is allocated, filled, and returned.
- *
- * @param x The x-coordinate of the pixel rectangle to store in
- * iArray
.
- * @param y The y-coordinate of the pixel rectangle to store in
- * iArray
.
- * @param w The width in pixels of the rectangle.
- * @param h The height in pixels of the rectangle.
- * @param iArray The int array to store the pixels into or null to force
- * creation.
- * @param data The DataBuffer that is the source of the pixel data.
- * @return The primitive array containing the pixel data.
- */
- public int[] getPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
- {
- if (iArray == null) iArray = new int[w*h*numBands];
- int outOffset = 0;
- for (y=0; yiArray
.
- * @param w The width in pixels of the rectangle.
- * @param h The height in pixels of the rectangle.
- * @param b The band to retrieve.
- * @param iArray The int array to store the pixels into or null to force
- * creation.
- * @param data The DataBuffer that is the source of the pixel data.
- * @return The primitive array containing the pixel data.
- */
- public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray,
- DataBuffer data)
- {
- if (iArray == null) iArray = new int[w*h];
- int outOffset = 0;
- for (y=0; yobj
.
- * @param obj The primitive array containing the data elements to set.
- * @param data The DataBuffer to store the data elements into.
- * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
- */
- public void setDataElements(int x, int y, Object obj, DataBuffer data)
- {
- int transferType = getTransferType();
- if (getTransferType() != data.getDataType())
- {
- throw new IllegalArgumentException("transfer type ("+
- getTransferType()+"), "+
- "does not match data "+
- "buffer type (" +
- data.getDataType() +
- ").");
- }
-
- int offset = y * scanlineStride + x;
-
- try
- {
- switch (transferType)
- {
- case DataBuffer.TYPE_BYTE:
- {
- DataBufferByte out = (DataBufferByte) data;
- byte[] in = (byte[]) obj;
- for (int i=0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
- return;
- }
- case DataBuffer.TYPE_SHORT:
- {
- DataBufferShort out = (DataBufferShort) data;
- short[] in = (short[]) obj;
- for (int i=0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
- return;
- }
- case DataBuffer.TYPE_USHORT:
- {
- DataBufferUShort out = (DataBufferUShort) data;
- short[] in = (short[]) obj;
- for (int i=0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
- return;
- }
- case DataBuffer.TYPE_INT:
- {
- DataBufferInt out = (DataBufferInt) data;
- int[] in = (int[]) obj;
- for (int i=0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
- return;
- }
- case DataBuffer.TYPE_FLOAT:
- {
- DataBufferFloat out = (DataBufferFloat) data;
- float[] in = (float[]) obj;
- for (int i=0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
- return;
- }
- case DataBuffer.TYPE_DOUBLE:
- {
- DataBufferDouble out = (DataBufferDouble) data;
- double[] in = (double[]) obj;
- for (int i=0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
- return;
- }
- default:
- throw new ClassCastException("Unsupported data type");
- }
- }
- catch (ArrayIndexOutOfBoundsException aioobe)
- {
- String msg = "While writing data elements" +
- ", x="+x+", y="+y+
- ", width="+width+", height="+height+
- ", scanlineStride="+scanlineStride+
- ", offset="+offset+
- ", data.getSize()="+data.getSize()+
- ", data.getOffset()="+data.getOffset()+
- ": " +
- aioobe;
- throw new ArrayIndexOutOfBoundsException(msg);
- }
- }
-
- public void setPixel(int x, int y, int[] iArray, DataBuffer data)
- {
- for (int b=0; b < numBands; b++)
- data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x,
- iArray[b]);
- }
-
- public void setPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
- {
- int inOffset = 0;
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = y * scanlineStride + (x + ww);
- for (int b=0; b < numBands; b++)
- data.setElem(bankIndices[b], bandOffsets[b] + offset,
- iArray[inOffset++]);
- }
- y++;
- }
- }
-
- public void setSample(int x, int y, int b, int s, DataBuffer data)
- {
- data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
- }
-
- public void setSample(int x, int y, int b, float s, DataBuffer data)
- {
- data.setElemFloat(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
- }
-
- public void setSample(int x, int y, int b, double s, DataBuffer data)
- {
- data.setElemDouble(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
- }
-
- public void setSamples(int x, int y, int w, int h, int b, int[] iArray,
- DataBuffer data)
- {
- int inOffset = 0;
-
- switch (getTransferType())
- {
- case DataBuffer.TYPE_BYTE:
- {
- DataBufferByte out = (DataBufferByte) data;
- byte[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = (byte)iArray[inOffset++];
- }
- y++;
- }
- return;
- }
- case DataBuffer.TYPE_SHORT:
- {
- DataBufferShort out = (DataBufferShort) data;
- short[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = (short)iArray[inOffset++];
- }
- y++;
- }
- return;
- }
- case DataBuffer.TYPE_USHORT:
- {
- DataBufferShort out = (DataBufferShort) data;
- short[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = (short)iArray[inOffset++];
- }
- y++;
- }
- return;
- }
- case DataBuffer.TYPE_INT:
- {
- DataBufferInt out = (DataBufferInt) data;
- int[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = iArray[inOffset++];
- }
- y++;
- }
- return;
- }
- case DataBuffer.TYPE_FLOAT:
- case DataBuffer.TYPE_DOUBLE:
- break;
- default:
- throw new ClassCastException("Unsupported data type");
- }
-
- // Default implementation probably slower for float and double
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- data.setElem(bankIndices[b], offset, iArray[inOffset++]);
- }
- y++;
- }
- }
-
- /**
- * Creates a String with some information about this SampleModel.
- * @return A String describing this SampleModel.
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- StringBuffer result = new StringBuffer();
- result.append(getClass().getName());
- result.append("[");
- result.append("scanlineStride=").append(scanlineStride);
- for(int i=0; i < bitMasks.length; i+=1)
- {
- result.append(", mask[").append(i).append("]=0x").append(Integer.toHexString(bitMasks[i]));
- }
-
- result.append("]");
- return result.toString();
- }
-}
diff --git a/libjava/java/awt/image/BufferStrategy.java b/libjava/java/awt/image/BufferStrategy.java
deleted file mode 100644
index e86aad60fe9..00000000000
--- a/libjava/java/awt/image/BufferStrategy.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/* BufferStrategy.java -- describes image buffering resources
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.BufferCapabilities;
-import java.awt.Graphics;
-
-/**
- * This class describes a strategy for managing image buffering
- * resources on a Canvas or Window. A given buffer strategy may make
- * use of hardware acceleration or take advantage of features of the
- * native graphics system. Examples of buffering strategies are
- * double or triple buffering using either flipping or blitting. For
- * the details of these algorithms see BufferCapabilities.
- *
- * To use a buffer strategy, you retrieve it from either the current
- * GraphicsConfiguration or from the Component on which you'd like to
- * draw. Then you can query the strategy's capabilities to make sure
- * they're suitable.
- *
- * If the strategy's capabilities are suitable, you can obtain a
- * graphics object and use it to draw with this strategy. Drawing
- * with a buffer strategy requires extra care, however. You'll need
- * to manually cause the next buffer to be shown on the output device.
- * And since buffer strategies are usually implemented with a
- * VolatileImage, you must frequently check that the contents of the
- * buffer are valid and that the buffer still exists.
- *
- * A buffer strategy is usually implemented using a VolatileImage.
- *
- * @see VolatileImage
- * @since 1.4
- */
-public abstract class BufferStrategy
-{
- /**
- * Creates a new buffer strategy.
- */
- public BufferStrategy()
- {
- }
-
- /**
- * Retrieves the capabilities of this buffer strategy.
- *
- * @return this buffer strategy's capabilities
- */
- public abstract BufferCapabilities getCapabilities();
-
- /**
- * Retrieves a graphics object that can be used to draw using this
- * buffer strategy. This method may not be synchronized so be
- * careful when calling it from multiple threads. You also must
- * manually dispose of this graphics object.
- *
- * @return a graphics object that can be used to draw using this
- * buffer strategy
- */
- public abstract Graphics getDrawGraphics();
-
- /**
- * Returns whether or not the buffer's resources have been reclaimed
- * by the native graphics system. If the buffer resources have been
- * lost then you'll need to obtain new resources before drawing
- * again. For details, see the documentation for VolatileImage.
- *
- * @return true if the contents were lost, false otherwise
- */
- public abstract boolean contentsLost();
-
- /**
- * Returns whether or not the buffer's resources were re-created and
- * cleared to the default background color. If the buffer's
- * resources have recently been re-created and initialized then the
- * buffer's image may need to be re-rendered. For details, see the
- * documentation for VolatileImage.
- *
- * @return true if the contents were restored, false otherwise
- */
- public abstract boolean contentsRestored();
-
- /**
- * Applies this buffer strategy. In other words, this method brings
- * the contents of the back or intermediate buffers to the front
- * buffer.
- */
- public abstract void show();
-}
diff --git a/libjava/java/awt/image/BufferedImage.java b/libjava/java/awt/image/BufferedImage.java
deleted file mode 100644
index 40da1b61910..00000000000
--- a/libjava/java/awt/image/BufferedImage.java
+++ /dev/null
@@ -1,693 +0,0 @@
-/* BufferedImage.java --
- Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import gnu.java.awt.ComponentDataBlitOp;
-
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.GraphicsEnvironment;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.Transparency;
-import java.awt.color.ColorSpace;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-/**
- * A buffered image always starts at coordinates (0, 0).
- *
- * The buffered image is not subdivided into multiple tiles. Instead,
- * the image consists of one large tile (0,0) with the width and
- * height of the image. This tile is always considered to be checked
- * out.
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public class BufferedImage extends Image
- implements WritableRenderedImage
-{
- public static final int TYPE_CUSTOM = 0,
- TYPE_INT_RGB = 1,
- TYPE_INT_ARGB = 2,
- TYPE_INT_ARGB_PRE = 3,
- TYPE_INT_BGR = 4,
- TYPE_3BYTE_BGR = 5,
- TYPE_4BYTE_ABGR = 6,
- TYPE_4BYTE_ABGR_PRE = 7,
- TYPE_USHORT_565_RGB = 8,
- TYPE_USHORT_555_RGB = 9,
- TYPE_BYTE_GRAY = 10,
- TYPE_USHORT_GRAY = 11,
- TYPE_BYTE_BINARY = 12,
- TYPE_BYTE_INDEXED = 13;
-
- static final int[] bits3 = { 8, 8, 8 };
- static final int[] bits4 = { 8, 8, 8 };
- static final int[] bits1byte = { 8 };
- static final int[] bits1ushort = { 16 };
-
- static final int[] masks_int = { 0x00ff0000,
- 0x0000ff00,
- 0x000000ff,
- DataBuffer.TYPE_INT };
- static final int[] masks_565 = { 0xf800,
- 0x07e0,
- 0x001f,
- DataBuffer.TYPE_USHORT};
- static final int[] masks_555 = { 0x7c00,
- 0x03e0,
- 0x001f,
- DataBuffer.TYPE_USHORT};
-
- Vector observers;
-
- public BufferedImage(int w, int h, int type)
- {
- ColorModel cm = null;
-
- boolean alpha = false;
- boolean premultiplied = false;
- switch (type)
- {
- case TYPE_4BYTE_ABGR_PRE:
- case TYPE_INT_ARGB_PRE:
- premultiplied = true;
- // fall through
- case TYPE_INT_ARGB:
- case TYPE_4BYTE_ABGR:
- alpha = true;
- }
-
- ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
- switch (type)
- {
- case TYPE_INT_RGB:
- case TYPE_INT_ARGB:
- case TYPE_INT_ARGB_PRE:
- case TYPE_USHORT_565_RGB:
- case TYPE_USHORT_555_RGB:
- int[] masks = null;
- switch (type)
- {
- case TYPE_INT_RGB:
- case TYPE_INT_ARGB:
- case TYPE_INT_ARGB_PRE:
- masks = masks_int;
- break;
- case TYPE_USHORT_565_RGB:
- masks = masks_565;
- break;
- case TYPE_USHORT_555_RGB:
- masks = masks_555;
- break;
- }
-
- cm = new DirectColorModel(cs,
- 32, // 32 bits in an int
- masks[0], // r
- masks[1], // g
- masks[2], // b
- alpha ? 0xff000000 : 0,
- premultiplied,
- masks[3] // data type
- );
- break;
-
- case TYPE_INT_BGR:
- String msg =
- "FIXME: Programmer is confused. Why (and how) does a " +
- "TYPE_INT_BGR image use ComponentColorModel to store " +
- "8-bit values? Is data type TYPE_INT or TYPE_BYTE. What " +
- "is the difference between TYPE_INT_BGR and TYPE_3BYTE_BGR?";
- throw new UnsupportedOperationException(msg);
-
- case TYPE_3BYTE_BGR:
- case TYPE_4BYTE_ABGR:
- case TYPE_4BYTE_ABGR_PRE:
- case TYPE_BYTE_GRAY:
- case TYPE_USHORT_GRAY:
- int[] bits = null;
- int dataType = DataBuffer.TYPE_BYTE;
- switch (type) {
- case TYPE_3BYTE_BGR:
- bits = bits3;
- break;
- case TYPE_4BYTE_ABGR:
- case TYPE_4BYTE_ABGR_PRE:
- bits = bits4;
- break;
- case TYPE_BYTE_GRAY:
- bits = bits1byte;
- break;
- case TYPE_USHORT_GRAY:
- bits = bits1ushort;
- dataType = DataBuffer.TYPE_USHORT;
- break;
- }
- cm = new ComponentColorModel(cs, bits, alpha, premultiplied,
- alpha ?
- Transparency.TRANSLUCENT:
- Transparency.OPAQUE,
- dataType);
- break;
- case TYPE_BYTE_BINARY:
- byte[] vals = { 0, (byte) 0xff };
- cm = new IndexColorModel(8, 2, vals, vals, vals);
- break;
- case TYPE_BYTE_INDEXED:
- String msg2 = "type not implemented yet";
- throw new UnsupportedOperationException(msg2);
- // FIXME: build color-cube and create color model
- }
-
- init(cm,
- cm.createCompatibleWritableRaster(w, h),
- premultiplied,
- null, // no properties
- type
- );
- }
-
- public BufferedImage(int w, int h, int type,
- IndexColorModel indexcolormodel)
- {
- if ((type != TYPE_BYTE_BINARY) && (type != TYPE_BYTE_INDEXED))
- throw new IllegalArgumentException("type must be binary or indexed");
-
- init(indexcolormodel,
- indexcolormodel.createCompatibleWritableRaster(w, h),
- false, // not premultiplied (guess)
- null, // no properties
- type);
- }
-
- public BufferedImage(ColorModel colormodel,
- WritableRaster writableraster,
- boolean premultiplied,
- Hashtable properties)
- {
- init(colormodel, writableraster, premultiplied, properties,
- TYPE_CUSTOM);
- // TODO: perhaps try to identify type?
- }
-
- WritableRaster raster;
- ColorModel colorModel;
- Hashtable properties;
- boolean isPremultiplied;
- int type;
-
- private void init(ColorModel cm,
- WritableRaster writableraster,
- boolean premultiplied,
- Hashtable properties,
- int type)
- {
- raster = writableraster;
- colorModel = cm;
- this.properties = properties;
- isPremultiplied = premultiplied;
- this.type = type;
- }
-
- //public void addTileObserver(TileObserver tileobserver) {}
-
- public void coerceData(boolean premultiplied)
- {
- colorModel = colorModel.coerceData(raster, premultiplied);
- }
-
- public WritableRaster copyData(WritableRaster dest)
- {
- if (dest == null)
- dest = raster.createCompatibleWritableRaster(getMinX(), getMinY(),
- getWidth(),getHeight());
-
- int x = dest.getMinX();
- int y = dest.getMinY();
- int w = dest.getWidth();
- int h = dest.getHeight();
-
- // create a src child that has the right bounds...
- WritableRaster src =
- raster.createWritableChild(x, y, w, h, x, y,
- null // same bands
- );
- if (src.getSampleModel () instanceof ComponentSampleModel
- && dest.getSampleModel () instanceof ComponentSampleModel)
- // Refer to ComponentDataBlitOp for optimized data blitting:
- ComponentDataBlitOp.INSTANCE.filter(src, dest);
- else
- {
- // slower path
- int samples[] = src.getPixels (x, y, w, h, (int [])null);
- dest.setPixels (x, y, w, h, samples);
- }
- return dest;
- }
-
- public Graphics2D createGraphics()
- {
- GraphicsEnvironment env;
- env = GraphicsEnvironment.getLocalGraphicsEnvironment ();
- return env.createGraphics (this);
- }
-
- public void flush() {
- }
-
- public WritableRaster getAlphaRaster()
- {
- return colorModel.getAlphaRaster(raster);
- }
-
- public ColorModel getColorModel()
- {
- return colorModel;
- }
-
- public Raster getData()
- {
- return copyData(null);
- /* TODO: this might be optimized by returning the same
- raster (not writable) as long as image data doesn't change. */
- }
-
- public Raster getData(Rectangle rectangle)
- {
- WritableRaster dest =
- raster.createCompatibleWritableRaster(rectangle);
- return copyData(dest);
- }
-
- public Graphics getGraphics()
- {
- return createGraphics();
- }
-
- public int getHeight()
- {
- return raster.getHeight();
- }
-
- public int getHeight(ImageObserver imageobserver)
- {
- return getHeight();
- }
-
- public int getMinTileX()
- {
- return 0;
- }
-
- public int getMinTileY()
- {
- return 0;
- }
-
- public int getMinX()
- {
- return 0;
- }
-
- public int getMinY()
- {
- return 0;
- }
-
- public int getNumXTiles()
- {
- return 1;
- }
-
- public int getNumYTiles()
- {
- return 1;
- }
-
- public Object getProperty(String string)
- {
- if (properties == null)
- return null;
- return properties.get(string);
- }
-
- public Object getProperty(String string, ImageObserver imageobserver)
- {
- return getProperty(string);
- }
-
-
- public String[] getPropertyNames()
- {
- // FIXME: implement
- return null;
- }
-
- public int getRGB(int x, int y)
- {
- Object rgbElem = raster.getDataElements(x, y,
- null // create as needed
- );
- return colorModel.getRGB(rgbElem);
- }
-
- public int[] getRGB(int startX, int startY, int w, int h,
- int[] rgbArray,
- int offset, int scanlineStride)
- {
- if (rgbArray == null)
- {
- /*
- 000000000000000000
- 00000[#######----- [ = start
- -----########----- ] = end
- -----#######]00000
- 000000000000000000 */
- int size = (h-1)*scanlineStride + w;
- rgbArray = new int[size];
- }
-
- int endX = startX + w;
- int endY = startY + h;
-
- /* *TODO*:
- Opportunity for optimization by examining color models...
-
- Perhaps wrap the rgbArray up in a WritableRaster with packed
- sRGB color model and perform optimized rendering into the
- array. */
-
- Object rgbElem = null;
- for (int y=startY; yByteLookupTable
instance.
- *
- * Offset is subtracted from pixel values when looking up in the translation
- * table. The same table is applied to all pixel components.
- *
- * @param offset Offset to be subtracted.
- * @param data Lookup table for all components.
- * @exception IllegalArgumentException if offset < 0.
- */
- public ByteLookupTable(int offset, byte[] data)
- throws IllegalArgumentException
- {
- super(offset, 1);
- this.data = new byte[][] {data};
- }
-
- /**
- * Return the lookup tables.
- *
- * @return the tables
- */
- public final byte[][] getTable()
- {
- return data;
- }
-
- /**
- * Return translated values for a pixel.
- *
- * For each value in the pixel src, use the value minus offset as an index
- * in the component array and copy the value there to the output for the
- * component. If dest is null, the output is a new array, otherwise the
- * translated values are written to dest. Dest can be the same array as
- * src.
- *
- * For example, if the pixel src is [2, 4, 3], and offset is 1, the output
- * is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
- * translation arrays.
- *
- * @param src Component values of a pixel.
- * @param dst Destination array for values, or null.
- * @return Translated values for the pixel.
- */
- public int[] lookupPixel(int[] src, int[] dst)
- throws ArrayIndexOutOfBoundsException
- {
- if (dst == null)
- dst = new int[src.length];
-
- if (data.length == 1)
- for (int i=0; i < src.length; i++)
- dst[i] = data[0][src[i] - offset];
- else
- for (int i=0; i < src.length; i++)
- dst[i] = data[i][src[i] - offset];
-
- return dst;
- }
-
- /**
- * Return translated values for a pixel.
- *
- * For each value in the pixel src, use the value minus offset as an index
- * in the component array and copy the value there to the output for the
- * component. If dest is null, the output is a new array, otherwise the
- * translated values are written to dest. Dest can be the same array as
- * src.
- *
- * For example, if the pixel src is [2, 4, 3], and offset is 1, the output
- * is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
- * translation arrays.
- *
- * @param src Component values of a pixel.
- * @param dst Destination array for values, or null.
- * @return Translated values for the pixel.
- */
- public byte[] lookupPixel(byte[] src, byte[] dst)
- throws ArrayIndexOutOfBoundsException
- {
- if (dst == null)
- dst = new byte[src.length];
-
- if (data.length == 1)
- for (int i=0; i < src.length; i++)
- dst[i] = data[0][((int)src[i]) - offset];
- else
- for (int i=0; i < src.length; i++)
- dst[i] = data[i][((int)src[i]) - offset];
-
- return dst;
-
- }
-}
diff --git a/libjava/java/awt/image/ColorConvertOp.java b/libjava/java/awt/image/ColorConvertOp.java
deleted file mode 100644
index 18609e0c4b0..00000000000
--- a/libjava/java/awt/image/ColorConvertOp.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/* ColorModel.java --
- Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.color.ColorSpace;
-import java.awt.color.ICC_ColorSpace;
-import java.awt.color.ICC_Profile;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * ColorConvertOp is a filter for converting an image from one colorspace to
- * another colorspace. The filter can convert the image through a sequence
- * of colorspaces or just from source to destination.
- *
- * Color conversion is done on the color components without alpha. Thus
- * if a BufferedImage has alpha premultiplied, this is divided out before
- * color conversion, and premultiplication applied if the destination
- * requires it.
- *
- * Color rendering and dithering hints may be applied if specified. This is
- * likely platform-dependent.
- *
- * @author jlquinn@optonline.net
- */
-public class ColorConvertOp implements BufferedImageOp, RasterOp
-{
- private ColorSpace srccs;
- private ColorSpace dstcs;
- private RenderingHints hints;
- private ICC_Profile[] profiles;
- private ColorSpace[] spaces;
- private boolean rasterValid;
-
-
- /**
- * Convert BufferedImage through a ColorSpace.
- *
- * This filter version is only valid for BufferedImages. The source image
- * is converted to cspace. If the destination is not null, it is then
- * converted to the destination colorspace. Normally this filter will only
- * be used with a null destination.
- *
- * @param cspace The target color space.
- * @param hints Rendering hints to use in conversion, or null.
- */
- public ColorConvertOp(ColorSpace cspace, RenderingHints hints)
- {
- if (cspace == null)
- throw new NullPointerException();
- spaces = new ColorSpace[]{cspace};
- this.hints = hints;
- rasterValid = false;
- }
-
- public ColorConvertOp(ColorSpace srcCspace, ColorSpace dstCspace,
- RenderingHints hints)
- {
- if (srcCspace == null || dstCspace == null)
- throw new NullPointerException();
- spaces = new ColorSpace[]{srcCspace, dstCspace};
- this.hints = hints;
- }
-
- /**
- * Convert from a source image destination image color space.
- *
- * This constructor builds a ColorConvertOp from an array of ICC_Profiles.
- * The source image will be converted through the sequence of color spaces
- * defined by the profiles. If the sequence of profiles doesn't give a
- * well-defined conversion, throws IllegalArgumentException.
- *
- * NOTE: Sun's docs don't clearly define what a well-defined conversion is
- * - or perhaps someone smarter can come along and sort it out.
- *
- * For BufferedImages, when the first and last profiles match the
- * requirements of the source and destination color space respectively, the
- * corresponding conversion is unnecessary. TODO: code this up. I don't
- * yet understand how you determine this.
- *
- * For Rasters, the first and last profiles must have the same number of
- * bands as the source and destination Rasters, respectively. If this is
- * not the case, or there fewer than 2 profiles, an IllegalArgumentException
- * will be thrown.
- *
- * @param profiles
- * @param hints
- */
- public ColorConvertOp(ICC_Profile[] profiles, RenderingHints hints)
- {
- if (profiles == null)
- throw new NullPointerException();
- this.hints = hints;
- this.profiles = profiles;
- // TODO: Determine if this is well-defined.
- // Create colorspace array with space for src and dest colorspace
- spaces = new ColorSpace[profiles.length];
- for (int i = 0; i < profiles.length; i++)
- spaces[i] = new ICC_ColorSpace(profiles[i]);
- }
-
- /** Convert from source image color space to destination image color space.
- *
- * Only valid for BufferedImage objects, this Op converts from the source
- * color space to the destination color space. The destination can't be
- * null for this operation.
- *
- * @param hints Rendering hints to use during conversion, or null.
- */
- public ColorConvertOp(RenderingHints hints)
- {
- this.hints = hints;
- srccs = null;
- dstcs = null;
- rasterValid = false;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage,
- java.awt.image.BufferedImage)
- */
- public final BufferedImage filter(BufferedImage src, BufferedImage dst)
- {
- // TODO: The plan is to create a scanline buffer for intermediate buffers.
- // For now we just suck it up and create intermediate buffers.
-
- if (dst == null && spaces.length == 0)
- throw new IllegalArgumentException();
-
- // Make sure input isn't premultiplied by alpha
- if (src.isAlphaPremultiplied())
- {
- BufferedImage tmp = createCompatibleDestImage(src, src.getColorModel());
- copyimage(src, tmp);
- tmp.coerceData(false);
- src = tmp;
- }
-
- ColorModel scm = src.getColorModel();
- for (int i = 0; i < spaces.length; i++)
- {
- ColorModel cm = scm.cloneColorModel(spaces[i]);
- BufferedImage tmp = createCompatibleDestImage(src, cm);
- copyimage(src, tmp);
- src = tmp;
- }
-
- // Intermediate conversions leave result in src
- if (dst == null)
- return src;
-
- // Apply final conversion
- copyimage(src, dst);
- return dst;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
- */
- public BufferedImage createCompatibleDestImage(BufferedImage src,
- ColorModel dstCM)
- {
- // FIXME: set properties to those in src
- return new BufferedImage(dstCM,
- src.getRaster().createCompatibleWritableRaster(),
- src.isPremultiplied,
- null);
- }
-
- public final ICC_Profile[] getICC_Profiles()
- {
- return profiles;
- }
-
- /** Return the rendering hints for this op. */
- public final RenderingHints getRenderingHints()
- {
- return hints;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
- */
- public final WritableRaster filter(Raster src, WritableRaster dest)
- {
- if (!rasterValid)
- throw new IllegalArgumentException();
-
- // Need to iterate through each color space - there must be at least 2
- for (int i = 1; i < spaces.length - 1; i++)
- {
- // FIXME: this is wrong. tmp needs to have the same number of bands as
- // spaces[i] has.
- WritableRaster tmp = createCompatibleDestRaster(src);
- copyraster(src, spaces[i - 1], tmp, spaces[i]);
- src = tmp;
- }
-
- // FIXME: this is wrong. dst needs to have the same number of bands as
- // spaces[i] has.
- if (dest == null)
- dest = createCompatibleDestRaster(src);
- copyraster(src, spaces[spaces.length - 2],
- dest, spaces[spaces.length - 1]);
-
- return dest;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
- */
- public WritableRaster createCompatibleDestRaster(Raster src)
- {
- return src.createCompatibleWritableRaster();
- }
-
- /** Return corresponding destination point for source point.
- *
- * LookupOp will return the value of src unchanged.
- * @param src The source point.
- * @param dst The destination point.
- * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
- */
- public final Point2D getPoint2D(Point2D src, Point2D dst)
- {
- if (dst == null) return (Point2D)src.clone();
- dst.setLocation(src);
- return dst;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
- */
- public final Rectangle2D getBounds2D(BufferedImage src)
- {
- return src.getRaster().getBounds();
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
- */
- public final Rectangle2D getBounds2D(Raster src)
- {
- return src.getBounds();
- }
-
- // According to Sven de Marothy, we need to copy the src into the dest
- // using Graphics2D, in order to use the rendering hints.
- private void copyimage(BufferedImage src, BufferedImage dst)
- {
- Graphics2D gg = dst.createGraphics();
- gg.setRenderingHints(hints);
- gg.drawImage(src, 0, 0, null);
- gg.dispose();
- }
-
- private void copyraster(Raster src, ColorSpace scs, WritableRaster dst,
- ColorSpace dcs)
- {
- float[] sbuf = new float[src.getNumBands()];
-
- if (hints.get(RenderingHints.KEY_COLOR_RENDERING) ==
- RenderingHints.VALUE_COLOR_RENDER_QUALITY)
- {
- // use cie for accuracy
- for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
- for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
- dst.setPixel(x, y,
- dcs.fromCIEXYZ(scs.toCIEXYZ(src.getPixel(x, y, sbuf))));
- }
- else
- {
- // use rgb - it's probably faster
- for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
- for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
- dst.setPixel(x, y,
- dcs.fromRGB(scs.toRGB(src.getPixel(x, y, sbuf))));
- }
- }
-
-}
diff --git a/libjava/java/awt/image/ColorModel.java b/libjava/java/awt/image/ColorModel.java
deleted file mode 100644
index 1ebcb98a76b..00000000000
--- a/libjava/java/awt/image/ColorModel.java
+++ /dev/null
@@ -1,758 +0,0 @@
-/* ColorModel.java --
- Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import gnu.java.awt.Buffers;
-
-import java.awt.Point;
-import java.awt.Transparency;
-import java.awt.color.ColorSpace;
-import java.lang.reflect.Constructor;
-import java.util.Arrays;
-
-/**
- * A color model operates with colors in several formats:
- *
- *
- *
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @author C. Brian Jones (cbj@gnu.org)
- */
-public abstract class ColorModel implements Transparency
-{
- protected int pixel_bits;
- protected int transferType;
-
- int[] bits;
- ColorSpace cspace;
- int transparency;
- boolean hasAlpha;
- boolean isAlphaPremultiplied;
-
- static int[] nArray(int value, int times)
- {
- int[] array = new int[times];
- java.util.Arrays.fill(array, value);
- return array;
- }
-
- static byte[] nArray(byte value, int times)
- {
- byte[] array = new byte[times];
- java.util.Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Constructs the default color model. The default color model
- * can be obtained by calling getRGBdefault
of this
- * class.
- * @param bits the number of bits wide used for bit size of pixel values
- */
- public ColorModel(int bits)
- {
- this(bits * 4, // total bits, sRGB, four channels
- nArray(bits, 4), // bits for each channel
- ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
- true, // has alpha
- false, // not premultiplied
- TRANSLUCENT,
- Buffers.smallestAppropriateTransferType(bits * 4));
- }
-
- /**
- * Constructs a ColorModel that translates pixel values to
- * color/alpha components.
- *
- * @exception IllegalArgumentException If the length of the bit array is less
- * than the number of color or alpha components in this ColorModel, or if the
- * transparency is not a valid value, or if the sum of the number of bits in
- * bits is less than 1 or if any of the elements in bits is less than 0.
- */
- protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace,
- boolean hasAlpha, boolean isAlphaPremultiplied,
- int transparency, int transferType)
- {
- int bits_sum = 0;
- for (int i = 0; i < bits.length; i++)
- {
- if (bits [i] < 0)
- throw new IllegalArgumentException ();
-
- bits_sum |= bits [i];
- }
-
- if ((bits.length < cspace.getNumComponents())
- || (bits_sum < 1))
- throw new IllegalArgumentException ();
-
- this.pixel_bits = pixel_bits;
- this.bits = bits;
- this.cspace = cspace;
- this.hasAlpha = hasAlpha;
- this.isAlphaPremultiplied = isAlphaPremultiplied;
- this.transparency = transparency;
- this.transferType = transferType;
- }
-
- // This is a hook for ColorConvertOp to create a colormodel with
- // a new colorspace
- ColorModel cloneColorModel(ColorSpace cspace)
- {
- Class cls = this.getClass();
- ColorModel cm;
- try {
- // This constructor will exist.
- Constructor ctor =
- cls.getConstructor(new Class[]{int.class, int[].class,
- ColorSpace.class, boolean.class,
- boolean.class, int.class, int.class});
- cm = (ColorModel)ctor.
- newInstance(new Object[]{new Integer(pixel_bits),
- bits, cspace, Boolean.valueOf(hasAlpha),
- Boolean.valueOf(isAlphaPremultiplied),
- new Integer(transparency),
- new Integer(transferType)});
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException();
- }
- return cm;
- }
-
- public void finalize()
- {
- // Do nothing here.
- }
-
- /**
- * Returns the default color model which in Sun's case is an instance
- * of DirectColorModel
.
- */
- public static ColorModel getRGBdefault()
- {
- return new DirectColorModel(32, 0xff0000, 0xff00, 0xff, 0xff000000);
- }
-
- public final boolean hasAlpha()
- {
- return hasAlpha;
- }
-
- public final boolean isAlphaPremultiplied()
- {
- return isAlphaPremultiplied;
- }
-
- /**
- * Get get number of bits wide used for the bit size of pixel values
- */
- public int getPixelSize()
- {
- return pixel_bits;
- }
-
- public int getComponentSize(int componentIdx)
- {
- return bits[componentIdx];
- }
-
- public int[] getComponentSize()
- {
- return bits;
- }
-
- public int getTransparency()
- {
- return transparency;
- }
-
- public int getNumComponents()
- {
- return getNumColorComponents() + (hasAlpha ? 1 : 0);
- }
-
- public int getNumColorComponents()
- {
- return cspace.getNumComponents();
- }
-
- /**
- * Converts pixel value to sRGB and extract red int sample scaled
- * to range [0, 255].
- *
- * @param pixel pixel value that will be interpreted according to
- * the color model, (assumed alpha premultiplied if color model says
- * so.)
- *
- * @return red sample scaled to range [0, 255], from default color
- * space sRGB, alpha non-premultiplied.
- */
- public abstract int getRed(int pixel);
-
- /**
- * Converts pixel value to sRGB and extract green int sample
- * scaled to range [0, 255].
- *
- * @see #getRed(int)
- */
- public abstract int getGreen(int pixel);
-
- /**
- * Converts pixel value to sRGB and extract blue int sample
- * scaled to range [0, 255].
- *
- * @see #getRed(int)
- */
- public abstract int getBlue(int pixel);
-
- /**
- * Extract alpha int sample from pixel value, scaled to [0, 255].
- *
- * @param pixel pixel value that will be interpreted according to
- * the color model.
- *
- * @return alpha sample, scaled to range [0, 255].
- */
- public abstract int getAlpha(int pixel);
-
- /**
- * Converts a pixel int value of the color space of the color
- * model to a sRGB pixel int value.
- *
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation.
- *
- * @param pixel pixel value that will be interpreted according to
- * the color model.
- *
- * @return a pixel in sRGB color space, encoded in default
- * 0xAARRGGBB format. */
- public int getRGB(int pixel)
- {
- return
- ((getAlpha(pixel) & 0xff) << 24) |
- (( getRed(pixel) & 0xff) << 16) |
- ((getGreen(pixel) & 0xff) << 8) |
- (( getBlue(pixel) & 0xff) << 0);
- }
-
-
- /**
- * In this color model we know that the whole pixel value will
- * always be contained within the first element of the pixel
- * array.
- */
- final int getPixelFromArray(Object inData) {
- DataBuffer data =
- Buffers.createBufferFromData(transferType, inData, 1);
- Object da = Buffers.getData(data);
-
- return data.getElem(0);
- }
-
- /**
- * Converts pixel in the given array to sRGB and extract blue int
- * sample scaled to range [0-255].
- *
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation.
- *
- * @param inData array of transferType containing a single pixel. The
- * pixel should be encoded in the natural way of the color model.
- */
- public int getRed(Object inData)
- {
- return getRed(getPixelFromArray(inData));
- }
-
- /**
- * @see #getRed(Object)
- */
- public int getGreen(Object inData)
- {
- return getGreen(getPixelFromArray(inData));
- }
-
- /**
- * @see #getRed(Object)
- */
- public int getBlue(Object inData) {
- return getBlue(getPixelFromArray(inData));
- }
-
- /**
- * @see #getRed(Object)
- */
- public int getAlpha(Object inData) {
- return getAlpha(getPixelFromArray(inData));
- }
-
- /**
- * Converts a pixel in the given array of the color space of the
- * color model to an sRGB pixel int value.
- *
- * getDataElements(int rgb, Object pixel)
.
- * I.e. (rgb == cm.getRGB(cm.getDataElements(rgb,
- * null)))
.
- *
- * @param inData array of transferType containing a single pixel. The
- * pixel should be encoded in the natural way of the color model.
- *
- * @return a pixel in sRGB color space, encoded in default
- * 0xAARRGGBB format.
- *
- * @see #getDataElements(int, Object)
- */
- public int getRGB(Object inData)
- {
- return
- ((getAlpha(inData) & 0xff) << 24) |
- (( getRed(inData) & 0xff) << 16) |
- ((getGreen(inData) & 0xff) << 8) |
- (( getBlue(inData) & 0xff) << 0);
- }
-
- /**
- * Converts an sRGB pixel int value to an array containing a
- * single pixel of the color space of the color model.
- *
- * getRGB(Object inData)
.
- *
- * Outline of conversion process:
- *
- *
- *
- *
- *
- * @param rgb The color to be converted to dataElements. A pixel
- * in sRGB color space, encoded in default 0xAARRGGBB format,
- * assumed not alpha premultiplied.
- *
- * @param pixel to avoid needless creation of arrays, an array to
- * use to return the pixel can be given. If null, a suitable array
- * will be created.
- *
- * @return An array of transferType values representing the color,
- * in the color model format. The color model defines whether the
- *
- * @see #getRGB(Object)
- */
- public Object getDataElements(int rgb, Object pixel)
- {
- // subclasses has to implement this method.
- throw new UnsupportedOperationException();
- }
-
- /**
- * Fills an array with the unnormalized component samples from a
- * pixel value. I.e. decompose the pixel, but not perform any
- * color conversion.
- *
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation.
- *
- * @param pixel pixel value encoded according to the color model.
- *
- * @return arrays of unnormalized component samples of single
- * pixel. The scale and multiplication state of the samples are
- * according to the color model. Each component sample is stored
- * as a separate element in the array.
- */
- public int[] getComponents(int pixel, int[] components, int offset)
- {
- // subclasses has to implement this method.
- throw new UnsupportedOperationException();
- }
-
- /**
- * Fills an array with the unnormalized component samples from an
- * array of transferType containing a single pixel. I.e. decompose
- * the pixel, but not perform any color conversion.
- *
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation.
- *
- * @param array of transferType containing a single pixel. The
- * pixel should be encoded in the natural way of the color model.
- *
- * @return arrays of unnormalized component samples of single
- * pixel. The scale and multiplication state of the samples are
- * according to the color model. Each component sample is stored
- * as a separate element in the array.
- */
- public int[] getComponents(Object pixel, int[] components, int offset)
- {
- // subclasses has to implement this method.
- throw new UnsupportedOperationException();
- }
-
- /**
- * Convert normalized components to unnormalized components.
- */
- public int[] getUnnormalizedComponents(float[] normComponents,
- int normOffset,
- int[] components,
- int offset)
- {
- int numComponents = getNumComponents();
- if (components == null)
- {
- components = new int[offset + numComponents];
- }
-
- for (int i=0; i(pixel == cm.getDataElement(cm.getComponents(pixel, null,
- * 0), 0))
.
- *
- * This method is overriden in subclasses since this abstract class throws
- * UnsupportedOperationException().
- *
- * @param components Array of unnormalized component samples of single
- * pixel. The scale and multiplication state of the samples are according
- * to the color model. Each component sample is stored as a separate element
- * in the array.
- * @param offset Position of the first value of the pixel in components.
- *
- * @return pixel value encoded according to the color model.
- */
- public int getDataElement(int[] components, int offset)
- {
- // subclasses have to implement this method.
- throw new UnsupportedOperationException();
- }
-
- /**
- * Converts the normalized component samples from an array to a pixel
- * value. I.e. composes the pixel from component samples, but does not
- * perform any color conversion or scaling of the samples.
- *
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation. The method provided by this abstract
- * class converts the components to unnormalized form and returns
- * getDataElement(int[], int).
- *
- * @param components Array of normalized component samples of single pixel.
- * The scale and multiplication state of the samples are according to the
- * color model. Each component sample is stored as a separate element in the
- * array.
- * @param offset Position of the first value of the pixel in components.
- *
- * @return pixel value encoded according to the color model.
- * @since 1.4
- */
- public int getDataElement (float[] components, int offset)
- {
- return
- getDataElement(getUnnormalizedComponents(components, offset, null, 0),
- 0);
- }
-
- public Object getDataElements(int[] components, int offset, Object obj)
- {
- // subclasses have to implement this method.
- throw new UnsupportedOperationException();
- }
-
- /**
- * Converts the normalized component samples from an array to an array of
- * TransferType values. I.e. composes the pixel from component samples, but
- * does not perform any color conversion or scaling of the samples.
- *
- * If obj is null, a new array of TransferType is allocated and returned.
- * Otherwise the results are stored in obj and obj is returned. If obj is
- * not long enough, ArrayIndexOutOfBounds is thrown. If obj is not an array
- * of primitives, ClassCastException is thrown.
- *
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation. The method provided by this abstract
- * class converts the components to unnormalized form and returns
- * getDataElement(int[], int, Object).
- *
- * @param components Array of normalized component samples of single pixel.
- * The scale and multiplication state of the samples are according to the
- * color model. Each component sample is stored as a separate element in the
- * array.
- * @param offset Position of the first value of the pixel in components.
- * @param obj Array of TransferType or null.
- *
- * @return pixel value encoded according to the color model.
- * @throws ArrayIndexOutOfBounds
- * @throws ClassCastException
- * @since 1.4
- */
- public Object getDataElements(float[] components, int offset, Object obj)
- {
- return
- getDataElements(getUnnormalizedComponents(components, offset, null, 0),
- 0, obj);
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof ColorModel)) return false;
-
- ColorModel o = (ColorModel) obj;
- return
- (pixel_bits == o.pixel_bits) &&
- (transferType == o.transferType) &&
- (transparency == o.transparency) &&
- (hasAlpha == o.hasAlpha) &&
- (isAlphaPremultiplied == o.isAlphaPremultiplied) &&
- Arrays.equals(bits, o.bits) &&
- (cspace.equals(o.cspace));
- }
-
- public final ColorSpace getColorSpace()
- {
- return cspace;
- }
-
- // Typically overridden
- public ColorModel coerceData(WritableRaster raster,
- boolean isAlphaPremultiplied)
- {
- if (this.isAlphaPremultiplied == isAlphaPremultiplied)
- return this;
-
- int w = raster.getWidth();
- int h = raster.getHeight();
- int x = raster.getMinX();
- int y = raster.getMinY();
- int size = w*h;
- int numColors = getNumColorComponents();
- int numComponents = getNumComponents();
- int alphaScale = (1<ColorModel
.
- *
- * @param w the number of pixels in the horizontal direction.
- * @param h the number of pixels in the vertical direction.
- */
- public SampleModel createCompatibleSampleModel(int w, int h)
- {
- int pixelStride, scanlineStride;
- int[] bandOffsets;
-
- pixelStride = getNumComponents();
- scanlineStride = pixelStride * w;
-
- /* We might be able to re-use the same bandOffsets array among
- * multiple calls to this method. However, this optimization does
- * not seem worthwile because setting up descriptive data
- * structures (such as SampleModels) is neglectible in comparision
- * to shuffling around masses of pixel data.
- */
- bandOffsets = new int[pixelStride];
- for (int i = 0; i < pixelStride; i++)
- bandOffsets[i] = i;
-
- /* FIXME: Think about whether it would make sense to return the
- * possibly more efficient PixelInterleavedSampleModel for other
- * transferTypes as well. It seems unlikely that this would break
- * any user applications, so the Mauve tests on this method
- * might be too restrictive.
- */
- switch (transferType)
- {
- case DataBuffer.TYPE_BYTE:
- case DataBuffer.TYPE_USHORT:
- return new PixelInterleavedSampleModel(transferType, w, h,
- pixelStride,
- scanlineStride,
- bandOffsets);
-
- default:
- return new ComponentSampleModel(transferType, w, h,
- pixelStride,
- scanlineStride,
- bandOffsets);
- }
- }
-
-
- public boolean isCompatibleSampleModel(SampleModel sm)
- {
- return
- (sm instanceof ComponentSampleModel) &&
- super.isCompatibleSampleModel(sm);
- }
-
- public WritableRaster getAlphaRaster(WritableRaster raster)
- {
- if (!hasAlpha()) return null;
-
- SampleModel sm = raster.getSampleModel();
- int[] alphaBand = { sm.getNumBands() - 1 };
- SampleModel alphaModel = sm.createSubsetSampleModel(alphaBand);
- DataBuffer buffer = raster.getDataBuffer();
- Point origin = new Point(0, 0);
- return Raster.createWritableRaster(alphaModel, buffer, origin);
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof ComponentColorModel)) return false;
- return super.equals(obj);
- }
-}
diff --git a/libjava/java/awt/image/ComponentSampleModel.java b/libjava/java/awt/image/ComponentSampleModel.java
deleted file mode 100644
index 953f63c1ea1..00000000000
--- a/libjava/java/awt/image/ComponentSampleModel.java
+++ /dev/null
@@ -1,544 +0,0 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-import gnu.java.awt.Buffers;
-
-/* FIXME: This class does not yet support data type TYPE_SHORT */
-
-/**
- * ComponentSampleModel supports a flexible organization of pixel samples in
- * memory, permitting pixel samples to be interleaved by band, by scanline,
- * and by pixel.
- *
- * A DataBuffer for this sample model has K banks of data. Pixels have N
- * samples, so there are N bands in the DataBuffer. Each band is completely
- * contained in one bank of data, but a bank may contain more than one band.
- * Each pixel sample is stored in a single data element.
- *
- * Within a bank, each band begins at an offset stored in bandOffsets. The
- * banks containing the band is given by bankIndices. Within the bank, there
- * are three dimensions - band, pixel, and scanline. The dimension ordering
- * is controlled by bandOffset, pixelStride, and scanlineStride, which means
- * that any combination of interleavings is supported.
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public class ComponentSampleModel extends SampleModel
-{
- protected int[] bandOffsets;
- protected int[] bankIndices;
-
- // FIXME: Should we really shadow the numBands in the superclass?
- //protected int numBands;
-
- /** Used when creating data buffers. */
- protected int numBanks;
-
- protected int scanlineStride;
-
- protected int pixelStride;
-
- private boolean tightPixelPacking = false;
-
- public ComponentSampleModel(int dataType,
- int w, int h,
- int pixelStride,
- int scanlineStride,
- int[] bandOffsets)
- {
- this(dataType, w, h, pixelStride, scanlineStride,
- new int[bandOffsets.length], bandOffsets);
- }
-
- public ComponentSampleModel(int dataType,
- int w, int h,
- int pixelStride,
- int scanlineStride,
- int[] bankIndices,
- int[] bandOffsets)
- {
- super(dataType, w, h, bandOffsets.length);
- if ((pixelStride<0) || (scanlineStride<0) ||
- (bandOffsets.length<1) ||
- (bandOffsets.length != bankIndices.length))
- throw new IllegalArgumentException();
-
- this.bandOffsets = bandOffsets;
- this.bankIndices = bankIndices;
-
- this.numBanks = 0;
- for (int b=0; bImageProducer
indicates the size of the image
- * being produced using this method. This filter overrides this
- * method in order to set the dimentions to the size of the
- * cropped rectangle instead of the size of the image.
- *
- * @param width the width of the image
- * @param height the height of the image
- */
- public void setDimensions(int width, int height)
- {
- consumer.setDimensions(this.width, this.height);
- }
-
- /**
- * An ImageProducer
can set a list of properties
- * associated with this image by using this method.
- *
- * FIXME - What property is set for this class?
- *
- * @param props the list of properties associated with this image
- */
- public void setProperties(Hashtable props)
- {
- props.put("filters", "CropImageFilter");
- consumer.setProperties(props);
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as a byte
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize)
- {
- Rectangle filterBounds = new Rectangle(this.x, this.y,
- this.width, this.height);
- Rectangle pixelBounds = new Rectangle(x, y, w, h);
-
- if (filterBounds.intersects(pixelBounds))
- {
- Rectangle bounds = filterBounds.intersection(pixelBounds);
-
- byte[] cropped = new byte[bounds.width * bounds.height];
- for (int i = 0; i < bounds.height; i++)
- {
- int start = (bounds.y - pixelBounds.y + i) * scansize + offset;
-
- for (int j = 0; j < bounds.width; j++)
- cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
- }
-
- consumer.setPixels(bounds.x, bounds.y,
- bounds.width, bounds.height,
- model, cropped, 0, bounds.width);
- }
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as an int
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels, int offset, int scansize)
- {
- Rectangle filterBounds = new Rectangle(this.x, this.y,
- this.width, this.height);
- Rectangle pixelBounds = new Rectangle(x, y, w, h);
-
- if (filterBounds.intersects(pixelBounds))
- {
- Rectangle bounds = filterBounds.intersection(pixelBounds);
-
- int[] cropped = new int[bounds.width * bounds.height];
- for (int i = 0; i < bounds.height; i++)
- {
- int start = (bounds.y - pixelBounds.y + i) * scansize + offset;
-
- for (int j = 0; j < bounds.width; j++)
- cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
- }
-
- consumer.setPixels(bounds.x, bounds.y,
- bounds.width, bounds.height,
- model, cropped, 0, bounds.width);
- }
- }
-
-}
-
diff --git a/libjava/java/awt/image/DataBuffer.java b/libjava/java/awt/image/DataBuffer.java
deleted file mode 100644
index 5bff6901e64..00000000000
--- a/libjava/java/awt/image/DataBuffer.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/**
- * Class that manages arrays of data elements. A data buffer consists
- * of one or more banks. A bank is a continuous region of data
- * elements.
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public abstract class DataBuffer
-{
- /**
- * A constant representng a data type that uses byte
primitives
- * as the storage unit.
- */
- public static final int TYPE_BYTE = 0;
-
- /**
- * A constant representng a data type that uses short
- * primitives as the storage unit.
- */
- public static final int TYPE_USHORT = 1;
-
- /**
- * A constant representng a data type that uses short
- * primitives as the storage unit.
- */
- public static final int TYPE_SHORT = 2;
-
- /**
- * A constant representng a data type that uses int
- * primitives as the storage unit.
- */
- public static final int TYPE_INT = 3;
-
- /**
- * A constant representng a data type that uses float
- * primitives as the storage unit.
- */
- public static final int TYPE_FLOAT = 4;
-
- /**
- * A constant representng a data type that uses double
- * primitives as the storage unit.
- */
- public static final int TYPE_DOUBLE = 5;
-
- /**
- * A constant representng an undefined data type.
- */
- public static final int TYPE_UNDEFINED = 32;
-
- /** The type of the data elements stored in the data buffer. */
- protected int dataType;
-
- /** The number of banks in this buffer. */
- protected int banks = 1;
-
- /** Offset into the default (0'th) bank). */
- protected int offset; // FIXME: Is offsets[0] always mirrored in offset?
-
- /** The size of the banks. */
- protected int size;
-
- /** Offset into each bank. */
- protected int[] offsets;
-
- /**
- * Creates a new DataBuffer
with the specified data type and
- * size. The dataType
should be one of the constants
- * {@link #TYPE_BYTE}, {@link #TYPE_SHORT}, {@link #TYPE_USHORT},
- * {@link #TYPE_INT}, {@link #TYPE_FLOAT} and {@link #TYPE_DOUBLE}.
- * DataBuffer
with the specified data type,
- * size and number of banks. The dataType
should be one of
- * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
- * {@link #TYPE_DOUBLE}.
- * DataBuffer
with the specified data type,
- * size and number of banks. An offset (which applies to all banks) is
- * also specified. The dataType
should be one of
- * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
- * {@link #TYPE_DOUBLE}.
- * DataBuffer
with the specified data type,
- * size and number of banks. An offset (which applies to all banks) is
- * also specified. The dataType
should be one of
- * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
- * {@link #TYPE_DOUBLE}.
- * numBanks != offsets.length
.
- */
- protected DataBuffer(int dataType, int size, int numBanks, int[] offsets) {
- this(dataType, size);
- if (numBanks != offsets.length)
- throw new ArrayIndexOutOfBoundsException();
-
- banks = numBanks;
- this.offsets = offsets;
-
- offset = offsets[0];
- }
-
- /**
- * Returns the size (number of bits) of the specified data type. Valid types
- * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
- * {@link #TYPE_DOUBLE}.
- *
- * @param dataType the data type.
- * @return The number of bits for the specified data type.
- * @throws IllegalArgumentException if dataType < 0
or
- * dataType > TYPE_DOUBLE
.
- */
- public static int getDataTypeSize(int dataType) {
- // Maybe this should be a lookup table instead.
- switch (dataType)
- {
- case TYPE_BYTE:
- return 8;
- case TYPE_USHORT:
- case TYPE_SHORT:
- return 16;
- case TYPE_INT:
- case TYPE_FLOAT:
- return 32;
- case TYPE_DOUBLE:
- return 64;
- default:
- throw new IllegalArgumentException();
- }
- }
-
- /**
- * Returns the type of the data elements in the data buffer. Valid types
- * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
- * {@link #TYPE_DOUBLE}.
- *
- * @return The type.
- */
- public int getDataType()
- {
- return dataType;
- }
-
- /**
- * Returns the size of the data buffer.
- *
- * @return The size.
- */
- public int getSize()
- {
- return size;
- }
-
- /**
- * Returns the element offset for the first data bank.
- *
- * @return The element offset.
- */
- public int getOffset()
- {
- return offset;
- }
-
- /**
- * Returns the offsets for all the data banks used by this
- * DataBuffer
.
- *
- * @return The offsets.
- */
- public int[] getOffsets()
- {
- if (offsets == null)
- {
- // is this necessary?
- offsets = new int[1];
- offsets[0] = offset;
- }
- return offsets;
- }
-
- /**
- * Returns the number of data banks for this DataBuffer
.
- * @return The number of data banks.
- */
- public int getNumBanks()
- {
- return banks;
- }
-
- /**
- * Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int i)
- {
- return getElem(0, i);
- }
-
- /**
- * Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public abstract int getElem(int bank, int i);
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int i, int val)
- {
- setElem(0, i, val);
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public abstract void setElem(int bank, int i, int val);
-
- /**
- * Returns an element from the first data bank, converted to a
- * float
. The offset (specified in the constructor) is added
- * to i
before accessing the underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public float getElemFloat(int i)
- {
- return getElem(i);
- }
-
- /**
- * Returns an element from a particular data bank, converted to a
- * float
. The offset (specified in the constructor) is
- * added to i
before accessing the underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public float getElemFloat(int bank, int i)
- {
- return getElem(bank, i);
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElemFloat(int i, float val)
- {
- setElem(i, (int) val);
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElemFloat(int bank, int i, float val)
- {
- setElem(bank, i, (int) val);
- }
-
- /**
- * Returns an element from the first data bank, converted to a
- * double
. The offset (specified in the constructor) is added
- * to i
before accessing the underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public double getElemDouble(int i)
- {
- return getElem(i);
- }
-
- /**
- * Returns an element from a particular data bank, converted to a
- * double
. The offset (specified in the constructor) is
- * added to i
before accessing the underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public double getElemDouble(int bank, int i)
- {
- return getElem(bank, i);
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElemDouble(int i, double val)
- {
- setElem(i, (int) val);
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElemDouble(int bank, int i, double val)
- {
- setElem(bank, i, (int) val);
- }
-}
diff --git a/libjava/java/awt/image/DataBufferByte.java b/libjava/java/awt/image/DataBufferByte.java
deleted file mode 100644
index ceed50832ff..00000000000
--- a/libjava/java/awt/image/DataBufferByte.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/* This is one of several classes that are nearly identical. Maybe we
- should have a central template and generate all these files. This
- is one of the cases where templates or macros would have been
- useful to have in Java.
-
- This file has been created using search-replace. My only fear is
- that these classes will grow out-of-sync as of a result of changes
- that are not propagated to the other files. As always, mirroring
- code is a maintenance nightmare. */
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public final class DataBufferByte extends DataBuffer
-{
- private byte[] data;
- private byte[][] bankData;
-
- /**
- * Creates a new data buffer with a single data bank containing the
- * specified number of byte
elements.
- *
- * @param size the number of elements in the data bank.
- */
- public DataBufferByte(int size)
- {
- super(TYPE_BYTE, size, 1, 0);
- bankData = new byte[1][];
- data = new byte[size];
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer with the specified number of data banks,
- * each containing the specified number of byte
elements.
- *
- * @param size the number of elements in the data bank.
- * @param numBanks the number of data banks.
- */
- public DataBufferByte(int size, int numBanks)
- {
- super(TYPE_BYTE, size, numBanks);
- bankData = new byte[numBanks][size];
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- */
- public DataBufferByte(byte[] dataArray, int size)
- {
- super(TYPE_BYTE, size, 1, 0);
- bankData = new byte[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank, with
- * the specified offset to the first element.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- * @param offset the offset to the first element in the array.
- */
- public DataBufferByte(byte[] dataArray, int size, int offset)
- {
- super(TYPE_BYTE, size, 1, offset);
- bankData = new byte[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferByte(byte[][] dataArray, int size)
- {
- super(TYPE_BYTE, size, dataArray.length);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks, with
- * the specified offsets to the first element in each bank.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- * @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferByte(byte[][] dataArray, int size, int[] offsets)
- {
- super(TYPE_BYTE, size, dataArray.length, offsets);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Returns the first data bank.
- *
- * @return The first data bank.
- */
- public byte[] getData()
- {
- return data;
- }
-
- /**
- * Returns a data bank.
- *
- * @param bank the bank index.
- * @return A data bank.
- */
- public byte[] getData(int bank)
- {
- return bankData[bank];
- }
-
- /**
- * Returns the array underlying this DataBuffer
.
- *
- * @return The data banks.
- */
- public byte[][] getBankData()
- {
- return bankData;
- }
-
- /**
- * Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int i)
- {
- return data[i+offset] & 0xff; // get unsigned byte as int
- }
-
- /**
- * Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int bank, int i)
- {
- // get unsigned byte as int
- return bankData[bank][i+offsets[bank]] & 0xff;
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int i, int val)
- {
- data[i+offset] = (byte) val;
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int bank, int i, int val)
- {
- bankData[bank][i+offsets[bank]] = (byte) val;
- }
-}
diff --git a/libjava/java/awt/image/DataBufferDouble.java b/libjava/java/awt/image/DataBufferDouble.java
deleted file mode 100644
index eba4a7c3c68..00000000000
--- a/libjava/java/awt/image/DataBufferDouble.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/* This is one of several classes that are nearly identical. Maybe we
- should have a central template and generate all these files. This
- is one of the cases where templates or macros would have been
- useful to have in Java.
-
- This file has been created using search-replace. My only fear is
- that these classes will grow out-of-sync as of a result of changes
- that are not propagated to the other files. As always, mirroring
- code is a maintenance nightmare. */
-
-/**
- * @since 1.4
- *
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
-public final class DataBufferDouble
- extends DataBuffer
-{
- private double[] data;
- private double[][] bankData;
-
- /**
- * Creates a new data buffer with a single data bank containing the
- * specified number of double
elements.
- *
- * @param size the number of elements in the data bank.
- */
- public DataBufferDouble(int size)
- {
- super(TYPE_DOUBLE, size, 1, 0);
- bankData = new double[1][];
- data = new double[size];
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer with the specified number of data banks,
- * each containing the specified number of double
elements.
- *
- * @param size the number of elements in the data bank.
- * @param numBanks the number of data banks.
- */
- public DataBufferDouble(int size, int numBanks)
- {
- super(TYPE_DOUBLE, size, numBanks);
- bankData = new double[numBanks][size];
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- */
- public DataBufferDouble(double[] dataArray, int size)
- {
- super(TYPE_DOUBLE, size, 1, 0);
- bankData = new double[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank, with
- * the specified offset to the first element.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- * @param offset the offset to the first element in the array.
- */
- public DataBufferDouble(double[] dataArray, int size, int offset)
- {
- super(TYPE_DOUBLE, size, 1, offset);
- bankData = new double[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferDouble(double[][] dataArray, int size)
- {
- super(TYPE_DOUBLE, size, dataArray.length);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks, with
- * the specified offsets to the first element in each bank.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- * @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferDouble(double[][] dataArray, int size, int[] offsets)
- {
- super(TYPE_DOUBLE, size, dataArray.length, offsets);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Returns the first data bank.
- *
- * @return The first data bank.
- */
- public double[] getData()
- {
- return data;
- }
-
- /**
- * Returns a data bank.
- *
- * @param bank the bank index.
- * @return A data bank.
- */
- public double[] getData(int bank)
- {
- return bankData[bank];
- }
-
- /**
- * Returns the array underlying this DataBuffer
.
- *
- * @return The data banks.
- */
- public double[][] getBankData()
- {
- return bankData;
- }
-
- /**
- * Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int i)
- {
- return (int) data[i+offset];
- }
-
- /**
- * Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int bank, int i)
- {
- return (int) bankData[bank][i+offsets[bank]];
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int i, int val)
- {
- data[i+offset] = (double) val;
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int bank, int i, int val)
- {
- bankData[bank][i+offsets[bank]] = (double) val;
- }
-
- public float getElemFloat(int i)
- {
- return (float) data[i+offset];
- }
-
- public float getElemFloat(int bank, int i)
- {
- return (float) bankData[bank][i+offsets[bank]];
- }
-
- public void setElemFloat(int i, float val)
- {
- data[i+offset] = val;
- }
-
- public void setElemFloat(int bank, int i, float val)
- {
- bankData[bank][i+offsets[bank]] = val;
- }
-
- public double getElemDouble(int i)
- {
- return data[i + offset];
- }
-
- public double getElemDouble(int bank, int i)
- {
- return bankData[bank][i + offsets[bank]];
- }
-
- public void setElemDouble(int i, double val)
- {
- data[i + offset] = val;
- }
-
- public void setElemDouble(int bank, int i, double val)
- {
- bankData[bank][i + offsets[bank]] = val;
- }
-}
diff --git a/libjava/java/awt/image/DataBufferFloat.java b/libjava/java/awt/image/DataBufferFloat.java
deleted file mode 100644
index 1d4c55b5004..00000000000
--- a/libjava/java/awt/image/DataBufferFloat.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/* This is one of several classes that are nearly identical. Maybe we
- should have a central template and generate all these files. This
- is one of the cases where templates or macros would have been
- useful to have in Java.
-
- This file has been created using search-replace. My only fear is
- that these classes will grow out-of-sync as of a result of changes
- that are not propagated to the other files. As always, mirroring
- code is a maintenance nightmare. */
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
-public final class DataBufferFloat
- extends DataBuffer
-{
- private float[] data;
- private float[][] bankData;
-
- /**
- * Creates a new data buffer with a single data bank containing the
- * specified number of float
elements.
- *
- * @param size the number of elements in the data bank.
- */
- public DataBufferFloat(int size)
- {
- super(TYPE_FLOAT, size, 1, 0);
- bankData = new float[1][];
- data = new float[size];
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer with the specified number of data banks,
- * each containing the specified number of float
elements.
- *
- * @param size the number of elements in the data bank.
- * @param numBanks the number of data banks.
- */
- public DataBufferFloat(int size, int numBanks)
- {
- super(TYPE_FLOAT, size, numBanks);
- bankData = new float[numBanks][size];
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- */
- public DataBufferFloat(float[] dataArray, int size)
- {
- super(TYPE_FLOAT, size, 1, 0);
- bankData = new float[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank, with
- * the specified offset to the first element.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- * @param offset the offset to the first element in the array.
- */
- public DataBufferFloat(float[] dataArray, int size, int offset)
- {
- super(TYPE_FLOAT, size, 1, offset);
- bankData = new float[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferFloat(float[][] dataArray, int size)
- {
- super(TYPE_FLOAT, size, dataArray.length);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks, with
- * the specified offsets to the first element in each bank.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- * @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferFloat(float[][] dataArray, int size, int[] offsets)
- {
- super(TYPE_FLOAT, size, dataArray.length, offsets);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Returns the first data bank.
- *
- * @return The first data bank.
- */
- public float[] getData()
- {
- return data;
- }
-
- /**
- * Returns a data bank.
- *
- * @param bank the bank index.
- * @return A data bank.
- */
- public float[] getData(int bank)
- {
- return bankData[bank];
- }
-
- /**
- * Returns the array underlying this DataBuffer
.
- *
- * @return The data banks.
- */
- public float[][] getBankData()
- {
- return bankData;
- }
-
- /**
- * Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int i)
- {
- return (int) data[i+offset];
- }
-
- /**
- * Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int bank, int i)
- {
- return (int) bankData[bank][i+offsets[bank]];
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int i, int val)
- {
- data[i+offset] = (float) val;
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int bank, int i, int val)
- {
- bankData[bank][i+offsets[bank]] = (float) val;
- }
-
- public float getElemFloat(int i)
- {
- return data[i+offset];
- }
-
- public float getElemFloat(int bank, int i)
- {
- return bankData[bank][i+offsets[bank]];
- }
-
- public void setElemFloat(int i, float val)
- {
- data[i+offset] = val;
- }
-
- public void setElemFloat(int bank, int i, float val)
- {
- bankData[bank][i+offsets[bank]] = val;
- }
-
- public double getElemDouble(int i)
- {
- return getElemFloat(i);
- }
-
- public double getElemDouble(int bank, int i)
- {
- return getElemFloat(bank, i);
- }
-
- public void setElemDouble(int i, double val)
- {
- setElemFloat(i, (float) val);
- }
-
- public void setElemDouble(int bank, int i, double val)
- {
- setElemFloat(bank, i, (float) val);
- }
-}
diff --git a/libjava/java/awt/image/DataBufferInt.java b/libjava/java/awt/image/DataBufferInt.java
deleted file mode 100644
index d4636caf346..00000000000
--- a/libjava/java/awt/image/DataBufferInt.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/* This is one of several classes that are nearly identical. Maybe we
- should have a central template and generate all these files. This
- is one of the cases where templates or macros would have been
- useful to have in Java.
-
- This file has been created using search-replace. My only fear is
- that these classes will grow out-of-sync as of a result of changes
- that are not propagated to the other files. As always, mirroring
- code is a maintenance nightmare. */
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public final class DataBufferInt extends DataBuffer
-{
- private int[] data;
- private int[][] bankData;
-
- /**
- * Creates a new data buffer with a single data bank containing the
- * specified number of int
elements.
- *
- * @param size the number of elements in the data bank.
- */
- public DataBufferInt(int size)
- {
- super(TYPE_INT, size, 1, 0);
- bankData = new int[1][];
- data = new int[size];
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer with the specified number of data banks,
- * each containing the specified number of int
elements.
- *
- * @param size the number of elements in the data bank.
- * @param numBanks the number of data banks.
- */
- public DataBufferInt(int size, int numBanks)
- {
- super(TYPE_INT, size, numBanks);
- bankData = new int[numBanks][size];
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- */
- public DataBufferInt(int[] dataArray, int size)
- {
- super(TYPE_INT, size, 1, 0);
- bankData = new int[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank, with
- * the specified offset to the first element.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- * @param offset the offset to the first element in the array.
- */
- public DataBufferInt(int[] dataArray, int size, int offset)
- {
- super(TYPE_INT, size, 1, offset);
- bankData = new int[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferInt(int[][] dataArray, int size)
- {
- super(TYPE_INT, size, dataArray.length);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks, with
- * the specified offsets to the first element in each bank.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- * @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferInt(int[][] dataArray, int size, int[] offsets)
- {
- super(TYPE_INT, size, dataArray.length, offsets);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Returns the first data bank.
- *
- * @return The first data bank.
- */
- public int[] getData()
- {
- return data;
- }
-
- /**
- * Returns a data bank.
- *
- * @param bank the bank index.
- * @return A data bank.
- */
- public int[] getData(int bank)
- {
- return bankData[bank];
- }
-
- /**
- * Returns the array underlying this DataBuffer
.
- *
- * @return The data banks.
- */
- public int[][] getBankData()
- {
- return bankData;
- }
-
- /**
- * Returns an element from the first data bank. The offset
is
- * added to the specified index before accessing the underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int i)
- {
- return data[i+offset];
- }
-
- /**
- * Returns an element from a particular data bank. The offset
- * is added to the specified index before accessing the underlying data
- * array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int bank, int i)
- {
- // get unsigned int as int
- return bankData[bank][i+offsets[bank]];
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int i, int val)
- {
- data[i+offset] = val;
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int bank, int i, int val)
- {
- bankData[bank][i+offsets[bank]] = val;
- }
-}
diff --git a/libjava/java/awt/image/DataBufferShort.java b/libjava/java/awt/image/DataBufferShort.java
deleted file mode 100644
index 3135dbaa721..00000000000
--- a/libjava/java/awt/image/DataBufferShort.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/* DataBufferShort.java --
- Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/* This is one of several classes that are nearly identical. Maybe we
- should have a central template and generate all these files. This
- is one of the cases where templates or macros would have been
- useful to have in Java.
-
- This file has been created using search-replace. My only fear is
- that these classes will grow out-of-sync as of a result of changes
- that are not propagated to the other files. As always, mirroring
- code is a maintenance nightmare. */
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public final class DataBufferShort extends DataBuffer
-{
- private short[] data;
- private short[][] bankData;
-
- /**
- * Creates a new data buffer with a single data bank containing the
- * specified number of short
elements.
- *
- * @param size the number of elements in the data bank.
- */
- public DataBufferShort(int size)
- {
- super(TYPE_SHORT, size, 1, 0);
- bankData = new short[1][];
- data = new short[size];
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer with the specified number of data banks,
- * each containing the specified number of short
elements.
- *
- * @param size the number of elements in the data bank.
- * @param numBanks the number of data banks.
- */
- public DataBufferShort(int size, int numBanks)
- {
- super(TYPE_SHORT, size, numBanks);
- bankData = new short[numBanks][size];
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- */
- public DataBufferShort(short[] dataArray, int size)
- {
- super(TYPE_SHORT, size, 1, 0);
- bankData = new short[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank, with
- * the specified offset to the first element.
- * dataArray
is
- * null
, but in that case an exception will be thrown
- * later if you attempt to access the data buffer.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- * @param offset the offset to the first element in the array.
- */
- public DataBufferShort(short[] dataArray, int size, int offset)
- {
- super(TYPE_SHORT, size, 1, offset);
- bankData = new short[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferShort(short[][] dataArray, int size)
- {
- super(TYPE_SHORT, size, dataArray.length);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks, with
- * the specified offsets to the first element in each bank.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- * @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferShort(short[][] dataArray, int size, int[] offsets)
- {
- super(TYPE_SHORT, size, dataArray.length, offsets);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Returns the first data bank.
- *
- * @return The first data bank.
- */
- public short[] getData()
- {
- return data;
- }
-
- /**
- * Returns a data bank.
- *
- * @param bank the bank index.
- * @return A data bank.
- */
- public short[] getData(int bank)
- {
- return bankData[bank];
- }
-
- /**
- * Returns the array underlying this DataBuffer
.
- *
- * @return The data banks.
- */
- public short[][] getBankData()
- {
- return bankData;
- }
-
- /**
- * Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int i)
- {
- return data[i+offset];
- }
-
- /**
- * Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int bank, int i)
- {
- return bankData[bank][i+offsets[bank]];
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int i, int val)
- {
- data[i+offset] = (short) val;
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int bank, int i, int val)
- {
- bankData[bank][i+offsets[bank]] = (short) val;
- }
-}
diff --git a/libjava/java/awt/image/DataBufferUShort.java b/libjava/java/awt/image/DataBufferUShort.java
deleted file mode 100644
index d42dadf86a7..00000000000
--- a/libjava/java/awt/image/DataBufferUShort.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/* DataBufferUShort.java --
- Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/* This is one of several classes that are nearly identical. Maybe we
- should have a central template and generate all these files. This
- is one of the cases where templates or macros would have been
- useful to have in Java.
-
- This file has been created using search-replace. My only fear is
- that these classes will grow out-of-sync as of a result of changes
- that are not propagated to the other files. As always, mirroring
- code is a maintenance nightmare. */
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public final class DataBufferUShort extends DataBuffer
-{
- private short[] data;
- private short[][] bankData;
-
- /**
- * Creates a new data buffer with a single data bank containing the
- * specified number of short
elements.
- *
- * @param size the number of elements in the data bank.
- */
- public DataBufferUShort(int size)
- {
- super(TYPE_USHORT, size, 1, 0);
- bankData = new short[1][];
- data = new short[size];
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer with the specified number of data banks,
- * each containing the specified number of short
elements.
- *
- * @param size the number of elements in the data bank.
- * @param numBanks the number of data banks.
- */
- public DataBufferUShort(int size, int numBanks)
- {
- super(TYPE_USHORT, size, numBanks);
- bankData = new short[numBanks][size];
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if dataArray is null
- */
- public DataBufferUShort(short[] dataArray, int size)
- {
- super(TYPE_USHORT, size, 1, 0);
- if (dataArray == null)
- throw new NullPointerException();
- bankData = new short[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data bank, with
- * the specified offset to the first element.
- *
- * @param dataArray the data bank.
- * @param size the number of elements in the data bank.
- * @param offset the offset to the first element in the array.
- *
- * @throws NullPointerException if dataArray is null
- */
- public DataBufferUShort(short[] dataArray, int size, int offset)
- {
- super(TYPE_USHORT, size, 1, offset);
- if (dataArray == null)
- throw new NullPointerException();
- bankData = new short[1][];
- data = dataArray;
- bankData[0] = data;
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferUShort(short[][] dataArray, int size)
- {
- super(TYPE_USHORT, size, dataArray.length);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Creates a new data buffer backed by the specified data banks, with
- * the specified offsets to the first element in each bank.
- *
- * @param dataArray the data banks.
- * @param size the number of elements in the data bank.
- * @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if dataArray
is
- * null
.
- */
- public DataBufferUShort(short[][] dataArray, int size, int[] offsets)
- {
- super(TYPE_USHORT, size, dataArray.length, offsets);
- bankData = dataArray;
- data = bankData[0];
- }
-
- /**
- * Returns the first data bank.
- *
- * @return The first data bank.
- */
- public short[] getData()
- {
- return data;
- }
-
- /**
- * Returns a data bank.
- *
- * @param bank the bank index.
- * @return A data bank.
- */
- public short[] getData(int bank)
- {
- return bankData[bank];
- }
-
- /**
- * Returns the array underlying this DataBuffer
.
- *
- * @return The data banks.
- */
- public short[][] getBankData()
- {
- return bankData;
- }
-
- /**
- * Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int i)
- {
- return data[i+offset] & 0xffff; // get unsigned short as int
- }
-
- /**
- * Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to i
before accessing the
- * underlying data array.
- *
- * @param bank the bank index.
- * @param i the element index.
- * @return The element.
- */
- public int getElem(int bank, int i)
- {
- // get unsigned short as int
- return bankData[bank][i+offsets[bank]] & 0xffff;
- }
-
- /**
- * Sets an element in the first data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int i, int val)
- {
- data[i+offset] = (short) val;
- }
-
- /**
- * Sets an element in a particular data bank. The offset (specified in the
- * constructor) is added to i
before updating the underlying
- * data array.
- *
- * @param bank the data bank index.
- * @param i the element index.
- * @param val the new element value.
- */
- public void setElem(int bank, int i, int val)
- {
- bankData[bank][i+offsets[bank]] = (short) val;
- }
-}
diff --git a/libjava/java/awt/image/DirectColorModel.java b/libjava/java/awt/image/DirectColorModel.java
deleted file mode 100644
index cd391da77ec..00000000000
--- a/libjava/java/awt/image/DirectColorModel.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/* DirectColorModel.java --
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import gnu.java.awt.Buffers;
-
-import java.awt.Point;
-import java.awt.Transparency;
-import java.awt.color.ColorSpace;
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- * @author C. Brian Jones (cbj@gnu.org)
- * @author Mark Benvenuto (mcb54@columbia.edu)
- */
-public class DirectColorModel extends PackedColorModel
-{
- /**
- * For the color model created with this constructor the pixels
- * will have fully opaque alpha components with a value of 255.
- * Each mask should describe a fully contiguous set of bits in the
- * most likely order of alpha, red, green, blue from the most significant
- * byte to the least significant byte.
- *
- * @param pixelBits the number of bits wide used for bit size of pixel values
- * @param rmask the bits describing the red component of a pixel
- * @param gmask the bits describing the green component of a pixel
- * @param bmask the bits describing the blue component of a pixel
- */
- public DirectColorModel(int pixelBits, int rmask, int gmask, int bmask)
- {
- this(ColorSpace.getInstance(ColorSpace.CS_sRGB), pixelBits,
- rmask, gmask, bmask, 0,
- false, // not alpha premultiplied
- Buffers.smallestAppropriateTransferType(pixelBits) // find type
- );
- }
-
- /**
- * For the color model created with this constructor the pixels
- * will have fully opaque alpha components with a value of 255.
- * Each mask should describe a fully contiguous set of bits in the
- * most likely order of red, green, blue from the most significant
- * byte to the least significant byte.
- *
- * @param pixelBits the number of bits wide used for bit size of pixel values
- * @param rmask the bits describing the red component of a pixel
- * @param gmask the bits describing the green component of a pixel
- * @param bmask the bits describing the blue component of a pixel
- * @param amask the bits describing the alpha component of a pixel
- */
- public DirectColorModel(int pixelBits,
- int rmask, int gmask, int bmask, int amask)
- {
- this(ColorSpace.getInstance(ColorSpace.CS_sRGB), pixelBits,
- rmask, gmask, bmask, amask,
- false, // not alpha premultiplied
- Buffers.smallestAppropriateTransferType(pixelBits) // find type
- );
- }
-
- public DirectColorModel(ColorSpace cspace, int pixelBits,
- int rmask, int gmask, int bmask, int amask,
- boolean isAlphaPremultiplied,
- int transferType)
- {
- super(cspace, pixelBits,
- rmask, gmask, bmask, amask, isAlphaPremultiplied,
- ((amask == 0) ? Transparency.OPAQUE : Transparency.TRANSLUCENT),
- transferType);
- }
-
- public final int getRedMask()
- {
- return getMask(0);
- }
-
- public final int getGreenMask()
- {
- return getMask(1);
- }
-
- public final int getBlueMask()
- {
- return getMask(2);
- }
-
- public final int getAlphaMask()
- {
- return hasAlpha() ? getMask(3) : 0;
- }
-
- /**
- * Get the red component of the given pixel.
- *
- */
- public final int getRed(int pixel)
- {
- return extractAndNormalizeSample(pixel, 0);
- }
-
- /**
- * Get the green component of the given pixel.
- *
- */
- public final int getGreen(int pixel)
- {
- return extractAndNormalizeSample(pixel, 1);
- }
-
- /**
- * Get the blue component of the given pixel.
- *
- */
- public final int getBlue(int pixel)
- {
- return extractAndNormalizeSample(pixel, 2);
- }
-
- /**
- * Get the alpha component of the given pixel.
- *
- */
- public final int getAlpha(int pixel)
- {
- if (!hasAlpha())
- return 0;
- return extractAndScaleSample(pixel, 3);
- }
-
- private int extractAndNormalizeSample(int pixel, int component)
- {
- int value = extractAndScaleSample(pixel, component);
- if (hasAlpha() && isAlphaPremultiplied())
- value = value*255/getAlpha(pixel);
- return value;
- }
-
- private int extractAndScaleSample(int pixel, int component)
- {
- int field = pixel & getMask(component);
- int to8BitShift =
- 8 - shifts[component] - getComponentSize(component);
- return (to8BitShift>0) ?
- (field << to8BitShift) :
- (field >>> (-to8BitShift));
- }
-
- /**
- * Get the RGB color value of the given pixel using the default
- * RGB color model.
- *
- *
- * @param pixel a pixel value
- */
- public final int getRGB(int pixel)
- {
- /* FIXME: The Sun docs show that this method is overridden, but I
- don't see any way to improve on the superclass
- implementation. */
- return super.getRGB(pixel);
- }
-
- public int getRed(Object inData)
- {
- return getRed(getPixelFromArray(inData));
- }
-
- public int getGreen(Object inData)
- {
- return getGreen(getPixelFromArray(inData));
- }
-
- public int getBlue(Object inData)
- {
- return getBlue(getPixelFromArray(inData));
- }
-
- public int getAlpha(Object inData)
- {
- return getAlpha(getPixelFromArray(inData));
- }
-
- public int getRGB(Object inData)
- {
- return getRGB(getPixelFromArray(inData));
- }
-
- /**
- * Converts a normalized pixel int value in the sRGB color
- * space to an array containing a single pixel of the color space
- * of the color model.
- *
- * getRGB(Object inData)
.
- *
- * @param rgb pixel as a normalized sRGB, 0xAARRGGBB value.
- *
- * @param pixel to avoid needless creation of arrays, an array to
- * use to return the pixel can be given. If null, a suitable array
- * will be created.
- *
- * @return array of transferType containing a single pixel. The
- * pixel should be encoded in the natural way of the color model.
- *
- * @see #getRGB(Object)
- */
- public Object getDataElements(int rgb, Object pixel)
- {
- // FIXME: handle alpha multiply
-
- int pixelValue = 0;
- int a = 0;
- if (hasAlpha()) {
- a = (rgb >>> 24) & 0xff;
- pixelValue = valueToField(a, 3, 8);
- }
-
- if (hasAlpha() && isAlphaPremultiplied())
- {
- int r, g, b;
- /* if r=0xff and a=0xff, then resulting
- value will be (r*a)>>>8 == 0xfe... This seems wrong.
- We should divide by 255 rather than shifting >>>8 after
- multiplying.
-
- Too bad, shifting is probably less expensive.
- r = ((rgb >>> 16) & 0xff)*a;
- g = ((rgb >>> 8) & 0xff)*a;
- b = ((rgb >>> 0) & 0xff)*a; */
- /* The r, g, b values we calculate are 16 bit. This allows
- us to avoid discarding the lower 8 bits obtained if
- multiplying with the alpha band. */
-
- // using 16 bit values
- r = ((rgb >>> 8) & 0xff00)*a/255;
- g = ((rgb >>> 0) & 0xff00)*a/255;
- b = ((rgb << 8) & 0xff00)*a/255;
- pixelValue |=
- valueToField(r, 0, 16) | // Red
- valueToField(g, 1, 16) | // Green
- valueToField(b, 2, 16); // Blue
- }
- else
- {
- int r, g, b;
- // using 8 bit values
- r = (rgb >>> 16) & 0xff;
- g = (rgb >>> 8) & 0xff;
- b = (rgb >>> 0) & 0xff;
-
- pixelValue |=
- valueToField(r, 0, 8) | // Red
- valueToField(g, 1, 8) | // Green
- valueToField(b, 2, 8); // Blue
- }
-
- /* In this color model, the whole pixel fits in the first element
- of the array. */
- DataBuffer buffer = Buffers.createBuffer(transferType, pixel, 1);
- buffer.setElem(0, pixelValue);
- return Buffers.getData(buffer);
- }
-
- /**
- * Converts a value to the correct field bits based on the
- * information derived from the field masks.
- *
- * @param highBit the position of the most significant bit in the
- * val parameter.
- */
- private int valueToField(int val, int component, int highBit)
- {
- int toFieldShift =
- getComponentSize(component) + shifts[component] - highBit;
- int ret = (toFieldShift>0) ?
- (val << toFieldShift) :
- (val >>> (-toFieldShift));
- return ret & getMask(component);
- }
-
- /**
- * Converts a 16 bit value to the correct field bits based on the
- * information derived from the field masks.
- */
- private int value16ToField(int val, int component)
- {
- int toFieldShift = getComponentSize(component) + shifts[component] - 16;
- return (toFieldShift>0) ?
- (val << toFieldShift) :
- (val >>> (-toFieldShift));
- }
-
- /**
- * Fills an array with the unnormalized component samples from a
- * pixel value. I.e. decompose the pixel, but not perform any
- * color conversion.
- */
- public final int[] getComponents(int pixel, int[] components, int offset)
- {
- int numComponents = getNumComponents();
- if (components == null) components = new int[offset + numComponents];
-
- for (int b=0; bsetDimensions
method.
- *
- * @param width the width of the image
- * @param height the height of the image
- */
- public void setDimensions(int width, int height)
- {
- consumer.setDimensions(width, height);
- }
-
- /**
- * An ImageProducer
can set a list of properties
- * associated with this image by using this method.
- *
- * @param props the list of properties associated with this image
- */
- public void setProperties(Hashtable props)
- {
- props.put("filters", "ImageFilter");
- consumer.setProperties(props);
- }
-
- /**
- * Override this method to process calls to this method from the
- * ImageProducer
. By default the setColorModel
- * method of the consumer is called with the specified model
.
- *
- * @param model the color model to be used most often by setPixels
- * @see ColorModel */
- public void setColorModel(ColorModel model)
- {
- consumer.setColorModel(model);
- }
-
- /**
- * The ImageProducer
should call this method with a
- * bit mask of hints from any of RANDOMPIXELORDER
,
- * TOPDOWNLEFTRIGHT
, COMPLETESCANLINES
,
- * SINGLEPASS
, SINGLEFRAME
from the
- * ImageConsumer
interface.
- *
- * @param flags a bit mask of hints
- * @see ImageConsumer
- */
- public void setHints(int flags)
- {
- consumer.setHints(flags);
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as a byte
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize)
- {
- consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as an int
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels, int offset, int scansize)
- {
- consumer.setPixels(x, y, w, h, model, pixels, offset, scansize);
- }
-
- /**
- * The ImageProducer
calls this method to indicate a
- * single frame or the entire image is complete. The method is
- * also used to indicate an error in loading or producing the
- * image.
- */
- public void imageComplete(int status)
- {
- consumer.imageComplete(status);
- }
-}
-
diff --git a/libjava/java/awt/image/ImageObserver.java b/libjava/java/awt/image/ImageObserver.java
deleted file mode 100644
index 36dd013f4e9..00000000000
--- a/libjava/java/awt/image/ImageObserver.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ImageObserver.java -- Java interface for asynchronous updates to an image
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.Image;
-
-/**
- * An object implementing the ImageObserver
interface can
- * receive updates on image construction from an
- * ImageProducer
asynchronously.
- *
- * @see ImageProducer
- * @author C. Brian Jones (cbj@gnu.org)
- */
-public interface ImageObserver
-{
- /**
- * The width of the image has been provided as the
- * width
argument to imageUpdate
.
- *
- * @see #imageUpdate
- */
- int WIDTH = 1;
-
- /**
- * The height of the image has been provided as the
- * height
argument to imageUpdate
.
- *
- * @see #imageUpdate
- */
- int HEIGHT = 2;
-
- /**
- * The properties of the image have been provided.
- *
- * @see #imageUpdate
- * @see java.awt.Image#getProperty (java.lang.String, java.awt.image.ImageObserver)
- */
- int PROPERTIES = 4;
-
- /**
- * More pixels are now available for drawing a scaled variation of
- * the image.
- *
- * @see #imageUpdate
- */
- int SOMEBITS = 8;
-
- /**
- * All the pixels needed to draw a complete frame of a multi-frame
- * image are available.
- *
- * @see #imageUpdate
- */
- int FRAMEBITS = 16;
-
- /**
- * An image with a single frame, a static image, is complete.
- *
- * @see #imageUpdate
- */
- int ALLBITS = 32;
-
- /**
- * An error was encountered while producing the image.
- *
- * @see #imageUpdate
- */
- int ERROR = 64;
-
- /**
- * Production of the image was aborted.
- *
- * @see #imageUpdate
- */
- int ABORT = 128;
-
- /**
- * This is a callback method for an asynchronous image producer to
- * provide updates on the production of the image as it happens.
- *
- * @param image the image the update refers to
- * @param flags a bit mask indicating what is provided with this update
- * @param x the x coordinate of the image
- * @param y the y coordinate of the image
- * @param width the width of the image
- * @param height the height of the image
- *
- * @see java.awt.Image
- */
- boolean imageUpdate(Image image, int flags, int x,
- int y, int width, int height);
-}
diff --git a/libjava/java/awt/image/ImageProducer.java b/libjava/java/awt/image/ImageProducer.java
deleted file mode 100644
index 49846685a3e..00000000000
--- a/libjava/java/awt/image/ImageProducer.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ImageProducer.java -- Java interface for image production
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-/**
- * An object implementing the ImageProducer
interface can
- * produce data for images. Each image has a corresponding
- * ImageProducer
which is needed for things such as
- * resizing the image.
- *
- * @see ImageConsumer
- * @author C. Brian Jones (cbj@gnu.org)
- */
-public interface ImageProducer
-{
- /**
- * Used to register an ImageConsumer
with this
- * ImageProducer
.
- */
- void addConsumer(ImageConsumer ic);
-
- /**
- * Used to determine if the given ImageConsumer
is
- * already registered with this ImageProducer
.
- */
- boolean isConsumer(ImageConsumer ic);
-
- /**
- * Used to remove an ImageConsumer
from the list of
- * registered consumers for this ImageProducer
.
- */
- void removeConsumer(ImageConsumer ic);
-
- /**
- * Used to register an ImageConsumer
with this
- * ImageProducer
and then immediately start
- * reconstruction of the image data to be delivered to all
- * registered consumers.
- */
- void startProduction(ImageConsumer ic);
-
- /**
- * Used to register an ImageConsumer
with this
- * ImageProducer
and then request that this producer
- * resend the image data in the order top-down, left-right.
- */
- void requestTopDownLeftRightResend(ImageConsumer ic);
-}
-
diff --git a/libjava/java/awt/image/ImagingOpException.java b/libjava/java/awt/image/ImagingOpException.java
deleted file mode 100644
index ca40e9ed365..00000000000
--- a/libjava/java/awt/image/ImagingOpException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ImagingOpException.java -- indicates an imaging filter failure
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-/**
- * This exception is thrown when BufferedImageOp
or
- * RasterOp
filters cannot process an image.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see BufferedImageOp
- * @see RasterOp
- * @status updated to 1.4
- */
-public class ImagingOpException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 8026288481846276658L;
-
- /**
- * Create a new instance with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public ImagingOpException(String message)
- {
- super(message);
- }
-} // class ImagingOpException
diff --git a/libjava/java/awt/image/IndexColorModel.java b/libjava/java/awt/image/IndexColorModel.java
deleted file mode 100644
index 6783f733e0a..00000000000
--- a/libjava/java/awt/image/IndexColorModel.java
+++ /dev/null
@@ -1,516 +0,0 @@
-/* IndexColorModel.java -- Java class for interpreting Pixel objects
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.color.ColorSpace;
-import java.math.BigInteger;
-
-/**
- * Color model similar to pseudo visual in X11.
- *
- * This color model maps linear pixel values to actual RGB and alpha colors.
- * Thus, pixel values are indexes into the color map. Each color component is
- * an 8-bit unsigned value.
- *
- * The IndexColorModel supports a map of valid pixels, allowing the
- * representation of holes in the the color map. The valid map is represented
- * as a BigInteger where each bit indicates the validity of the map entry with
- * the same index.
- *
- * Colors can have alpha components for transparency support. If alpha
- * component values aren't given, color values are opaque. The model also
- * supports a reserved pixel value to represent completely transparent colors,
- * no matter what the actual color component values are.
- *
- * IndexColorModel supports anywhere from 1 to 16 bit index values. The
- * allowed transfer types are DataBuffer.TYPE_BYTE and DataBuffer.TYPE_USHORT.
- *
- * @author C. Brian Jones (cbj@gnu.org)
- */
-public class IndexColorModel extends ColorModel
-{
- private int map_size;
- private boolean opaque;
- private int trans = -1;
- private int[] rgb;
- private BigInteger validBits = BigInteger.ZERO;
-
- /**
- * Each array much contain size
elements. For each
- * array, the i-th color is described by reds[i], greens[i],
- * blues[i], alphas[i], unless alphas is not specified, then all the
- * colors are opaque except for the transparent color.
- *
- * @param bits the number of bits needed to represent size
colors
- * @param size the number of colors in the color map
- * @param reds the red component of all colors
- * @param greens the green component of all colors
- * @param blues the blue component of all colors
- */
- public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues)
- {
- this (bits, size, reds, greens, blues, (byte[]) null);
- }
-
- /**
- * Each array much contain size
elements. For each
- * array, the i-th color is described by reds[i], greens[i],
- * blues[i], alphas[i], unless alphas is not specified, then all the
- * colors are opaque except for the transparent color.
- *
- * @param bits the number of bits needed to represent size
colors
- * @param size the number of colors in the color map
- * @param reds the red component of all colors
- * @param greens the green component of all colors
- * @param blues the blue component of all colors
- * @param trans the index of the transparent color
- */
- public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues, int trans)
- {
- this (bits, size, reds, greens, blues, (byte[]) null);
- this.trans = trans;
- }
-
- /**
- * Each array much contain size
elements. For each
- * array, the i-th color is described by reds[i], greens[i],
- * blues[i], alphas[i], unless alphas is not specified, then all the
- * colors are opaque except for the transparent color.
- *
- * @param bits the number of bits needed to represent size
colors
- * @param size the number of colors in the color map
- * @param reds the red component of all colors
- * @param greens the green component of all colors
- * @param blues the blue component of all colors
- * @param alphas the alpha component of all colors
- */
- public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
- byte[] blues, byte[] alphas)
- {
- // FIXME: This super() constructor should not be used since it can give
- // the wrong value for hasAlpha() which is final and cannot be overloaded
- super(bits);
- map_size = size;
- opaque = (alphas == null);
-
- rgb = new int[size];
- if (alphas == null)
- {
- for (int i = 0; i < size; i++)
- {
- rgb[i] = (0xff000000
- | ((reds[i] & 0xff) << 16)
- | ((greens[i] & 0xff) << 8)
- | (blues[i] & 0xff));
- }
- }
- else
- {
- for (int i = 0; i < size; i++)
- {
- rgb[i] = ((alphas[i] & 0xff) << 24
- | ((reds[i] & 0xff) << 16)
- | ((greens[i] & 0xff) << 8)
- | (blues[i] & 0xff));
- }
- }
-
- // Generate a bigint with 1's for every pixel
- validBits = validBits.setBit(size).subtract(BigInteger.ONE);
- }
-
- /**
- * Each array much contain size
elements. For each
- * array, the i-th color is described by reds[i], greens[i],
- * blues[i], alphas[i], unless alphas is not specified, then all the
- * colors are opaque except for the transparent color.
- *
- * @param bits the number of bits needed to represent size
colors
- * @param size the number of colors in the color map
- * @param cmap packed color components
- * @param start the offset of the first color component in cmap
- * @param hasAlpha cmap
has alpha values
- * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
- */
- public IndexColorModel (int bits, int size, byte[] cmap, int start,
- boolean hasAlpha)
- {
- this (bits, size, cmap, start, hasAlpha, -1);
- }
-
- /**
- * Construct an IndexColorModel from an array of red, green, blue, and
- * optional alpha components. The component values are interleaved as RGB(A).
- *
- * @param bits the number of bits needed to represent size
colors
- * @param size the number of colors in the color map
- * @param cmap interleaved color components
- * @param start the offset of the first color component in cmap
- * @param hasAlpha cmap
has alpha values
- * @param trans the index of the transparent color
- * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
- */
- public IndexColorModel (int bits, int size, byte[] cmap, int start,
- boolean hasAlpha, int trans)
- {
- super (bits);
- if (bits > 16)
- throw new IllegalArgumentException("bits > 16");
- if (size < 1)
- throw new IllegalArgumentException("size < 1");
- map_size = size;
- opaque = !hasAlpha;
- this.trans = trans;
-
- rgb = new int[size];
- if (hasAlpha)
- {
- for (int i = 0; i < size; i++)
- rgb[i] =
- // alpha
- ((cmap[4 * i + 3 + start] & 0xff) << 24
- // red
- | ((cmap[4 * i + start] & 0xff) << 16)
- // green
- | ((cmap[4 * i + 1 + start] & 0xff) << 8)
- // blue
- | (cmap[4 * i + 2 + start] & 0xff));
- }
- else
- {
- for (int i = 0; i < size; i++)
- rgb[i] = (0xff000000
- // red
- | ((cmap[3 * i + start] & 0xff) << 16)
- // green
- | ((cmap[3 * i + 1 + start] & 0xff) << 8)
- // blue
- | (cmap[3 * i + 2 + start] & 0xff));
- }
-
- // Generate a bigint with 1's for every pixel
- validBits = validBits.setBit(size).subtract(BigInteger.ONE);
- }
-
- /**
- * Construct an IndexColorModel from an array of size
packed
- * colors. Each int element contains 8-bit red, green, blue, and optional
- * alpha values packed in order. If hasAlpha is false, then all the colors
- * are opaque except for the transparent color.
- *
- * @param bits the number of bits needed to represent size
colors
- * @param size the number of colors in the color map
- * @param cmap packed color components
- * @param start the offset of the first color component in cmap
- * @param hasAlpha cmap
has alpha values
- * @param trans the index of the transparent color
- * @param transferType DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT
- * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
- * @throws IllegalArgumentException if transferType is something other than
- * TYPE_BYTE or TYPE_USHORT.
- */
- public IndexColorModel (int bits, int size, int[] cmap, int start,
- boolean hasAlpha, int trans, int transferType)
- {
- super(bits * 4, // total bits, sRGB, four channels
- nArray(bits, 4), // bits for each channel
- ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
- true, // has alpha
- false, // not premultiplied
- TRANSLUCENT, transferType);
- if (transferType != DataBuffer.TYPE_BYTE
- && transferType != DataBuffer.TYPE_USHORT)
- throw new IllegalArgumentException();
- if (bits > 16)
- throw new IllegalArgumentException("bits > 16");
- if (size < 1)
- throw new IllegalArgumentException("size < 1");
- map_size = size;
- opaque = !hasAlpha;
- this.trans = trans;
-
- rgb = new int[size];
- if (!hasAlpha)
- for (int i = 0; i < size; i++)
- rgb[i] = cmap[i + start] | 0xff000000;
- else
- System.arraycopy(cmap, start, rgb, 0, size);
-
- // Generate a bigint with 1's for every pixel
- validBits = validBits.setBit(size).subtract(BigInteger.ONE);
- }
-
- /**
- * Construct an IndexColorModel using a colormap with holes.
- *
- * The IndexColorModel is built from the array of ints defining the
- * colormap. Each element contains red, green, blue, and alpha
- * components. The ColorSpace is sRGB. The transparency value is
- * automatically determined.
- *
- * This constructor permits indicating which colormap entries are valid,
- * using the validBits argument. Each entry in cmap is valid if the
- * corresponding bit in validBits is set.
- *
- * @param bits the number of bits needed to represent size
colors
- * @param size the number of colors in the color map
- * @param cmap packed color components
- * @param start the offset of the first color component in cmap
- * @param transferType DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT
- * @throws IllegalArgumentException if bits < 1, bits > 16, or size < 1.
- * @throws IllegalArgumentException if transferType is something other than
- * TYPE_BYTE or TYPE_USHORT.
- */
- public IndexColorModel (int bits, int size, int[] cmap, int start,
- int transferType, BigInteger validBits)
- {
- super(bits * 4, // total bits, sRGB, four channels
- nArray(bits, 4), // bits for each channel
- ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
- true, // has alpha
- false, // not premultiplied
- TRANSLUCENT, transferType);
- if (transferType != DataBuffer.TYPE_BYTE
- && transferType != DataBuffer.TYPE_USHORT)
- throw new IllegalArgumentException();
- if (bits > 16)
- throw new IllegalArgumentException("bits > 16");
- if (size < 1)
- throw new IllegalArgumentException("size < 1");
- map_size = size;
- opaque = false;
- this.trans = -1;
- this.validBits = validBits;
-
- rgb = new int[size];
- if (!hasAlpha)
- for (int i = 0; i < size; i++)
- rgb[i] = cmap[i + start] | 0xff000000;
- else
- System.arraycopy(cmap, start, rgb, 0, size);
- }
-
- public final int getMapSize ()
- {
- return map_size;
- }
-
- /**
- * Get the index of the transparent color in this color model
- */
- public final int getTransparentPixel ()
- {
- return trans;
- }
-
- /**
- *
- */
- public final void getReds (byte[] r)
- {
- getComponents (r, 2);
- }
-
- /**
- *
- */
- public final void getGreens (byte[] g)
- {
- getComponents (g, 1);
- }
-
- /**
- *
- */
- public final void getBlues (byte[] b)
- {
- getComponents (b, 0);
- }
-
- /**
- *
- */
- public final void getAlphas (byte[] a)
- {
- getComponents (a, 3);
- }
-
- private void getComponents (byte[] c, int ci)
- {
- int i, max = (map_size < c.length) ? map_size : c.length;
- for (i = 0; i < max; i++)
- c[i] = (byte) ((generateMask (ci) & rgb[i]) >> (ci * pixel_bits));
- }
-
- /**
- * Get the red component of the given pixel.
- */
- public final int getRed (int pixel)
- {
- if (pixel < map_size)
- return (int) ((generateMask (2) & rgb[pixel]) >> (2 * pixel_bits));
-
- return 0;
- }
-
- /**
- * Get the green component of the given pixel.
- */
- public final int getGreen (int pixel)
- {
- if (pixel < map_size)
- return (int) ((generateMask (1) & rgb[pixel]) >> (1 * pixel_bits));
-
- return 0;
- }
-
- /**
- * Get the blue component of the given pixel.
- */
- public final int getBlue (int pixel)
- {
- if (pixel < map_size)
- return (int) (generateMask (0) & rgb[pixel]);
-
- return 0;
- }
-
- /**
- * Get the alpha component of the given pixel.
- */
- public final int getAlpha (int pixel)
- {
- if (opaque || pixel >= map_size)
- return 255;
-
- return (int) ((generateMask (3) & rgb[pixel]) >> (3 * pixel_bits));
- }
-
- /**
- * Get the RGB color value of the given pixel using the default
- * RGB color model.
- *
- * @param pixel a pixel value
- */
- public final int getRGB (int pixel)
- {
- if (pixel >= 0 && pixel < map_size)
- return rgb[pixel];
-
- return 0;
- }
-
- /**
- * Get the RGB color values of all pixels in the map using the default
- * RGB color model.
- *
- * @param rgb The destination array.
- */
- public final void getRGBs (int[] rgb)
- {
- System.arraycopy(this.rgb, 0, rgb, 0, map_size);
- }
-
- //pixel_bits is number of bits to be in generated mask
- private int generateMask (int offset)
- {
- return (((2 << pixel_bits ) - 1) << (pixel_bits * offset));
- }
-
- /** Return true if pixel is valid, false otherwise. */
- public boolean isValid(int pixel)
- {
- return validBits.testBit(pixel);
- }
-
- /** Return true if all pixels are valid, false otherwise. */
- public boolean isValid()
- {
- // Generate a bigint with 1's for every pixel
- BigInteger allbits = new BigInteger("0");
- allbits.setBit(map_size);
- allbits.subtract(new BigInteger("1"));
- return allbits.equals(validBits);
- }
-
- /**
- * Returns a BigInteger where each bit represents an entry in the color
- * model. If the bit is on, the entry is valid.
- */
- public BigInteger getValidPixels()
- {
- return validBits;
- }
-
- /**
- * Construct a BufferedImage with rgb pixel values from a Raster.
- *
- * Constructs a new BufferedImage in which each pixel is an RGBA int from
- * a Raster with index-valued pixels. If this model has no alpha component
- * or transparent pixel, the type of the new BufferedImage is TYPE_INT_RGB.
- * Otherwise the type is TYPE_INT_ARGB. If forceARGB is true, the type is
- * forced to be TYPE_INT_ARGB no matter what.
- *
- * @param raster The source of pixel values.
- * @param forceARGB True if type must be TYPE_INT_ARGB.
- * @return New BufferedImage with RBGA int pixel values.
- */
- public BufferedImage convertToIntDiscrete(Raster raster, boolean forceARGB)
- {
- int type = forceARGB ? BufferedImage.TYPE_INT_ARGB
- : ((opaque && trans == -1) ? BufferedImage.TYPE_INT_RGB :
- BufferedImage.TYPE_INT_ARGB);
-
- // FIXME: assuming that raster has only 1 band since pixels are supposed
- // to be int indexes.
- // FIXME: it would likely be more efficient to fetch a complete array,
- // but it would take much more memory.
- // FIXME: I'm not sure if transparent pixels or alpha values need special
- // handling here.
- BufferedImage im = new BufferedImage(raster.width, raster.height, type);
- for (int x = raster.minX; x < raster.width + raster.minX; x++)
- for (int y = raster.minY; y < raster.height + raster.minY; y++)
- im.setRGB(x, y, rgb[raster.getSample(x, y, 0)]);
-
- return im;
- }
-}
-
diff --git a/libjava/java/awt/image/Kernel.java b/libjava/java/awt/image/Kernel.java
deleted file mode 100644
index f7c29c3cde9..00000000000
--- a/libjava/java/awt/image/Kernel.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Kernel.java -- Java class for an image processing kernel
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-/**
- * Kernel represents an image processing kernel. It gets used to hold
- * convolution filters among other purposes. It stores an array of float
- * values representing a 2-dimensional array in row-major order.
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- * @version 1.0
- */
-public class Kernel implements Cloneable
-{
- private final int width;
- private final int height;
- private final float[] data;
-
- /**
- * Creates a new Kernel
instance.
- *
- * @param width The 2D width of data.
- * @param height The 2D height of data.
- * @param data The source data array.
- * @exception IllegalArgumentException if width * height < data.length.
- */
- public Kernel(int width, int height, float[] data)
- throws IllegalArgumentException
- {
- this.width = width;
- this.height = height;
- if (data.length < width * height || width < 0 || height < 0)
- throw new IllegalArgumentException();
- this.data = new float[width * height];
- System.arraycopy(data, 0, this.data, 0, width * height);
- }
-
- /**
- * Return the X origin: (width - 1) / 2
- */
- public final int getXOrigin()
- {
- return (width - 1) / 2;
- }
-
- /**
- * Return the Y origin: (height - 1) / 2
- */
- public final int getYOrigin()
- {
- return (height - 1) / 2;
- }
-
- /**
- * @return The kernel width.
- */
- public final int getWidth()
- {
- return width;
- }
-
- /**
- * @return The kernel height.
- */
- public final int getHeight()
- {
- return height;
- }
-
- /**
- * Return the kernel data.
- *
- * If data is null, allocates a new array and returns it. Otherwise, the
- * kernel values are copied into data.
- *
- * @param data Array to copy values into, or null.
- * @return The array with copied values.
- * @exception IllegalArgumentException if data != null and too small.
- */
- public final float[] getKernelData(float[] data)
- throws IllegalArgumentException
- {
- if (data == null)
- return (float[])this.data.clone();
-
- if (data.length < this.data.length)
- throw new IllegalArgumentException();
-
- System.arraycopy(this.data, 0, data, 0, this.data.length);
- return data;
- }
-
- /**
- * @return a clone of this Kernel.
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw (Error) new InternalError().initCause(e); // Impossible
- }
- }
-}
diff --git a/libjava/java/awt/image/LookupOp.java b/libjava/java/awt/image/LookupOp.java
deleted file mode 100644
index f131daabae3..00000000000
--- a/libjava/java/awt/image/LookupOp.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/* LookupOp.java -- Filter that converts each pixel using a lookup table.
- Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-/**
- * LookupOp is a filter that converts each pixel using a lookup table.
- *
- * For filtering Rasters, the lookup table must have either one component
- * that is applied to all bands, or one component for every band in the
- * Rasters.
- *
- * For BufferedImages, the lookup table may apply to both color and alpha
- * components. If the lookup table contains one component, or if there are
- * the same number of components as color components in the source, the table
- * applies to all color components. Otherwise the table applies to all
- * components including alpha. Alpha premultiplication is ignored during the
- * lookup filtering.
- *
- * After filtering, if color conversion is necessary, the conversion happens,
- * taking alpha premultiplication into account.
- *
- * @author jlquinn
- */
-public class LookupOp implements BufferedImageOp, RasterOp
-{
- private LookupTable lut;
- private RenderingHints hints;
-
- /** Construct a new LookupOp.
- *
- * @param lookup LookupTable to use.
- * @param hints Rendering hints (can be null).
- */
- public LookupOp(LookupTable lookup, RenderingHints hints)
- {
- lut = lookup;
- this.hints = hints;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage, java.awt.image.BufferedImage)
- */
- public BufferedImage filter(BufferedImage src, BufferedImage dst)
- {
- if (src.getColorModel() instanceof IndexColorModel)
- throw new IllegalArgumentException("LookupOp.filter: IndexColorModel "
- + "not allowed");
- if (dst == null)
- dst = createCompatibleDestImage(src, src.getColorModel());
-
- // Set up for potential colormodel mismatch
- BufferedImage tgt;
- if (dst.getColorModel().equals(src.getColorModel()))
- tgt = dst;
- else
- tgt = createCompatibleDestImage(src, src.getColorModel());
-
- Raster sr = src.getRaster();
- WritableRaster dr = tgt.getRaster();
-
- if (src.getColorModel().hasAlpha() &&
- (lut.getNumComponents() == 1 ||
- lut.getNumComponents() == src.getColorModel().getNumColorComponents()))
- {
- // Need to ignore alpha for lookup
- int[] dbuf = new int[src.getColorModel().getNumComponents()];
- int tmpBands = src.getColorModel().getNumColorComponents();
- int[] tmp = new int[tmpBands];
-
- // Filter the pixels
- for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
- for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
- {
- // Filter only color components, but also copy alpha
- sr.getPixel(x, y, dbuf);
- System.arraycopy(dbuf, 0, tmp, 0, tmpBands);
- dr.setPixel(x, y, lut.lookupPixel(tmp, dbuf));
- }
- }
- else if (lut.getNumComponents() != 1
- &&
- lut.getNumComponents() != src.getColorModel().getNumComponents())
- throw new IllegalArgumentException("LookupOp.filter: "
- + "Incompatible lookup "
- + "table and source image");
-
- // No alpha to ignore
- int[] dbuf = new int[src.getColorModel().getNumComponents()];
-
- // Filter the pixels
- for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
- for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
- dr.setPixel(x, y, lut.lookupPixel(sr.getPixel(x, y, dbuf), dbuf));
-
- if (tgt != dst)
- {
- // Convert between color models.
- // TODO Check that premultiplied alpha is handled correctly here.
- Graphics2D gg = dst.createGraphics();
- gg.setRenderingHints(hints);
- gg.drawImage(tgt, 0, 0, null);
- gg.dispose();
- }
-
- return dst;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
- */
- public Rectangle2D getBounds2D(BufferedImage src)
- {
- return src.getRaster().getBounds();
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
- */
- public BufferedImage createCompatibleDestImage(BufferedImage src,
- ColorModel dstCM)
- {
- // FIXME: set properties to those in src
- return new BufferedImage(dstCM,
- src.getRaster().createCompatibleWritableRaster(),
- src.isPremultiplied, null);
- }
-
- /** Return corresponding destination point for source point.
- *
- * LookupOp will return the value of src unchanged.
- * @param src The source point.
- * @param dst The destination point.
- * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
- */
- public Point2D getPoint2D(Point2D src, Point2D dst)
- {
- if (dst == null)
- return (Point2D) src.clone();
-
- dst.setLocation(src);
- return dst;
- }
-
- /** Return the LookupTable for this op. */
- public LookupTable getTable()
- {
- return lut;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#getRenderingHints()
- */
- public RenderingHints getRenderingHints()
- {
- return hints;
- }
-
- /** Filter a raster through a lookup table.
- *
- * Applies the lookup table for this Rasterop to each pixel of src and
- * puts the results in dest. If dest is null, a new Raster is created and
- * returned.
- *
- * @param src The source raster.
- * @param dest The destination raster.
- * @return The WritableRaster with the filtered pixels.
- * @throws IllegalArgumentException if lookup table has more than one
- * component but not the same as src and dest.
- * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
- */
- public WritableRaster filter(Raster src, WritableRaster dest)
- {
- if (dest == null)
- // Allocate a raster if needed
- dest = createCompatibleDestRaster(src);
- else
- if (src.getNumBands() != dest.getNumBands())
- throw new IllegalArgumentException();
-
- if (lut.getNumComponents() != 1
- && lut.getNumComponents() != src.getNumBands())
- throw new IllegalArgumentException();
-
-
- // Allocate pixel storage.
- int[] tmp = new int[src.getNumBands()];
-
- // Filter the pixels
- for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
- for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
- dest.setPixel(x, y, lut.lookupPixel(src.getPixel(x, y, tmp), tmp));
- return dest;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
- */
- public Rectangle2D getBounds2D(Raster src)
- {
- return src.getBounds();
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
- */
- public WritableRaster createCompatibleDestRaster(Raster src)
- {
- return src.createCompatibleWritableRaster();
- }
-
-}
diff --git a/libjava/java/awt/image/LookupTable.java b/libjava/java/awt/image/LookupTable.java
deleted file mode 100644
index f814b8e090b..00000000000
--- a/libjava/java/awt/image/LookupTable.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* LookupTable.java -- Java class for a pixel translation table.
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-/**
- * LookupTable represents translation arrays for pixel values. It wraps one
- * or more data arrays for each layer (or component) in an image, such as
- * Alpha, R, G, and B. When doing translation, the offset is subtracted from
- * the pixel values to allow a subset of an array to be used.
- *
- * @see ByteLookupTable
- * @see ShortLookupTable
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- * @version 1.0
- */
-public abstract class LookupTable
-{
- // Not protected since that's part of the public API.
- int offset;
- int numComponents;
-
- /**
- * Creates a new LookupTable
instance.
- *
- * If numComponents is 1, the same translation table is used for all pixel
- * components.
- *
- * @param offset Offset to be subtracted.
- * @param numComponents Number of image components.
- * @exception IllegalArgumentException if offset < 0 or numComponents < 1.
- */
- protected LookupTable(int offset, int numComponents)
- throws IllegalArgumentException
- {
- if (offset < 0 || numComponents < 1)
- throw new IllegalArgumentException();
- this.offset = offset;
- this.numComponents = numComponents;
- }
-
- /** Return the number of components. */
- public int getNumComponents()
- {
- return numComponents;
- }
-
- /** Return the offset. */
- public int getOffset()
- {
- return offset;
- }
-
-
- /**
- * Return translated values for a pixel.
- *
- * For each value in the pixel src, use the value minus offset as an index
- * in the component array and copy the value there to the output for the
- * component. If dest is null, the output is a new array, otherwise the
- * translated values are written to dest. Dest can be the same array as
- * src.
- *
- * For example, if the pixel src is [2, 4, 3], and offset is 1, the output
- * is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
- * translation arrays.
- *
- * @param src Component values of a pixel.
- * @param dest Destination array for values, or null.
- * @return Translated values for the pixel.
- */
- public abstract int[] lookupPixel(int[] src, int[] dest);
-}
diff --git a/libjava/java/awt/image/MemoryImageSource.java b/libjava/java/awt/image/MemoryImageSource.java
deleted file mode 100644
index c27e0bf7317..00000000000
--- a/libjava/java/awt/image/MemoryImageSource.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/* MemoryImageSource.java -- Java class for providing image data
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.util.Hashtable;
-import java.util.Vector;
-
-public class MemoryImageSource implements ImageProducer
-{
- private boolean animated = false;
- private boolean fullbuffers = false;
- private int[] pixeli;
- private int width;
- private int height;
- private int offset;
- private int scansize;
- private byte[] pixelb;
- private ColorModel cm;
- private Hashtable props = new Hashtable();
- private Vector consumers = new Vector();
-
- /**
- * Construct an image producer that reads image data from a byte
- * array.
- *
- * @param w width of image
- * @param h height of image
- * @param cm the color model used to represent pixel values
- * @param pix a byte array of pixel values
- * @param off the offset into the array at which the first pixel is stored
- * @param scan the number of array elements that represents a single pixel row
- */
- public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
- int scan)
- {
- this(w, h, cm, pix, off, scan, null);
- }
-
- /**
- * Constructs an ImageProducer from memory
- */
- public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
- int scan, Hashtable props)
- {
- width = w;
- height = h;
- this.cm = cm;
- offset = off;
- scansize = scan;
- this.props = props;
- int max = ((scansize > width) ? scansize : width);
- pixelb = pix;
- }
-
- /**
- * Construct an image producer that reads image data from an
- * integer array.
- *
- * @param w width of image
- * @param h height of image
- * @param cm the color model used to represent pixel values
- * @param pix an integer array of pixel values
- * @param off the offset into the array at which the first pixel is stored
- * @param scan the number of array elements that represents a single pixel row
- */
- public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
- int scan)
- {
- this(w, h, cm, pix, off, scan, null);
- }
-
- /**
- Constructs an ImageProducer from memory
- */
- public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
- int scan, Hashtable props)
- {
- width = w;
- height = h;
- this.cm = cm;
- offset = off;
- scansize = scan;
- this.props = props;
- int max = ((scansize > width) ? scansize : width);
- pixeli = pix;
- }
-
- /**
- * Constructs an ImageProducer from memory using the default RGB ColorModel
- */
- public MemoryImageSource(int w, int h, int[] pix, int off, int scan,
- Hashtable props)
- {
- this(w, h, ColorModel.getRGBdefault(), pix, off, scan, props);
- }
-
- /**
- * Constructs an ImageProducer from memory using the default RGB ColorModel
- */
- public MemoryImageSource(int w, int h, int[] pix, int off, int scan)
- {
- this(w, h, ColorModel.getRGBdefault(), pix, off, scan, null);
- }
-
- /**
- * Used to register an ImageConsumer
with this
- * ImageProducer
.
- */
- public synchronized void addConsumer(ImageConsumer ic)
- {
- if (consumers.contains(ic))
- return;
-
- consumers.addElement(ic);
- }
-
- /**
- * Used to determine if the given ImageConsumer
is
- * already registered with this ImageProducer
.
- */
- public synchronized boolean isConsumer(ImageConsumer ic)
- {
- if (consumers.contains(ic))
- return true;
- return false;
- }
-
- /**
- * Used to remove an ImageConsumer
from the list of
- * registered consumers for this ImageProducer
.
- */
- public synchronized void removeConsumer(ImageConsumer ic)
- {
- consumers.removeElement(ic);
- }
-
- /**
- * Used to register an ImageConsumer
with this
- * ImageProducer
and then immediately start
- * reconstruction of the image data to be delivered to all
- * registered consumers.
- */
- public void startProduction(ImageConsumer ic)
- {
- if (! (consumers.contains(ic)))
- consumers.addElement(ic);
-
- Vector list = (Vector) consumers.clone();
- for (int i = 0; i < list.size(); i++)
- {
- ic = (ImageConsumer) list.elementAt(i);
- sendPicture(ic);
- if (animated)
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
- else
- ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
- }
- }
-
- /**
- * Used to register an ImageConsumer
with this
- * ImageProducer
and then request that this producer
- * resend the image data in the order top-down, left-right.
- */
- public void requestTopDownLeftRightResend(ImageConsumer ic)
- {
- startProduction(ic);
- }
-
- /**
- * Changes a flag to indicate whether this MemoryImageSource supports
- * animations.
- *
- * @param animated A flag indicating whether this class supports animations
- */
- public synchronized void setAnimated(boolean animated)
- {
- this.animated = animated;
- }
-
- /**
- * A flag to indicate whether or not to send full buffer updates when
- * sending animation. If this flag is set then full buffers are sent
- * in the newPixels methods instead of just regions.
- *
- * @param fullbuffers - a flag indicating whether to send the full buffers
- */
- public synchronized void setFullBufferUpdates(boolean fullbuffers)
- {
- this.fullbuffers = fullbuffers;
- }
-
- /**
- * Send an animation frame to the image consumers.
- */
- public void newPixels()
- {
- if (animated == true)
- {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for (int i = 0; i < list.size(); i++)
- {
- ic = (ImageConsumer) list.elementAt(i);
- sendPicture(ic);
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
- }
- }
- }
-
- private void sendPicture(ImageConsumer ic)
- {
- ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
- if (props != null)
- ic.setProperties(props);
- ic.setDimensions(width, height);
- ic.setColorModel(cm);
- if (pixeli != null)
- ic.setPixels(0, 0, width, height, cm, pixeli, offset, scansize);
- else
- ic.setPixels(0, 0, width, height, cm, pixelb, offset, scansize);
- }
-
- /**
- * Send an animation frame to the image consumers containing the specified
- * pixels unless setFullBufferUpdates is set.
- */
- public synchronized void newPixels(int x, int y, int w, int h)
- {
- if (animated == true)
- {
- if (fullbuffers)
- newPixels();
- else
- {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for (int i = 0; i < list.size(); i++)
- {
- ic = (ImageConsumer) list.elementAt(i);
- ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
- if (props != null)
- ic.setProperties(props);
- if (pixeli != null)
- {
- int[] pixelbuf = new int[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset,
- pixelbuf, 0, w * h);
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- else
- {
- byte[] pixelbuf = new byte[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset,
- pixelbuf, 0, w * h);
-
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
- }
- }
- }
- }
-
- /**
- * Send an animation frame to the image consumers containing the specified
- * pixels unless setFullBufferUpdates is set.
- *
- * If framenotify is set then a notification is sent when the frame
- * is sent otherwise no status is sent.
- */
- public synchronized void newPixels(int x, int y, int w, int h,
- boolean framenotify)
- {
- if (animated == true)
- {
- if (fullbuffers)
- newPixels();
- else
- {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for (int i = 0; i < list.size(); i++)
- {
- ic = (ImageConsumer) list.elementAt(i);
- ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
- if (props != null)
- ic.setProperties(props);
- if (pixeli != null)
- {
- int[] pixelbuf = new int[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset,
- pixelbuf, 0, w * h);
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- else
- {
- byte[] pixelbuf = new byte[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset,
- pixelbuf, 0, w * h);
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- if (framenotify == true)
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
- }
- }
- }
- }
-
- public synchronized void newPixels(byte[] newpix, ColorModel newmodel,
- int offset, int scansize)
- {
- pixeli = null;
- pixelb = newpix;
- cm = newmodel;
- this.offset = offset;
- this.scansize = scansize;
- if (animated == true)
- newPixels();
- }
-
- public synchronized void newPixels(int[] newpix, ColorModel newmodel,
- int offset, int scansize)
- {
- pixelb = null;
- pixeli = newpix;
- cm = newmodel;
- this.offset = offset;
- this.scansize = scansize;
- if (animated == true)
- newPixels();
- }
-}
diff --git a/libjava/java/awt/image/MultiPixelPackedSampleModel.java b/libjava/java/awt/image/MultiPixelPackedSampleModel.java
deleted file mode 100644
index 18a6e555205..00000000000
--- a/libjava/java/awt/image/MultiPixelPackedSampleModel.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-import gnu.java.awt.Buffers;
-
-/**
- * MultiPixelPackedSampleModel provides a single band model that supports
- * multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
- * per data element.
- *
- * @author Jerry Quinn (jlquinn@optonline.net)
- */
-public class MultiPixelPackedSampleModel extends SampleModel
-{
- private int scanlineStride;
- private int[] bitMasks;
- private int[] bitOffsets;
- private int[] sampleSize;
- private int dataBitOffset;
- private int elemBits;
- private int numberOfBits;
- private int numElems;
-
- public MultiPixelPackedSampleModel(int dataType, int w, int h,
- int numberOfBits)
- {
- this(dataType, w, h, numberOfBits, 0, 0);
- }
-
- public MultiPixelPackedSampleModel(int dataType, int w, int h,
- int numberOfBits, int scanlineStride,
- int dataBitOffset)
- {
- super(dataType, w, h, 1);
-
- switch (dataType)
- {
- case DataBuffer.TYPE_BYTE:
- elemBits = 8;
- break;
- case DataBuffer.TYPE_USHORT:
- elemBits = 16;
- break;
- case DataBuffer.TYPE_INT:
- elemBits = 32;
- break;
- default:
- throw new IllegalArgumentException("MultiPixelPackedSampleModel"
- + " unsupported dataType");
- }
-
- this.dataBitOffset = dataBitOffset;
-
- this.numberOfBits = numberOfBits;
- if (numberOfBits > elemBits)
- throw new RasterFormatException("MultiPixelPackedSampleModel pixel size"
- + " larger than dataType");
- switch (numberOfBits)
- {
- case 1: case 2: case 4: case 8: case 16: case 32: break;
- default:
- throw new RasterFormatException("MultiPixelPackedSampleModel pixel"
- + " size not 2^n bits");
- }
- numElems = elemBits / numberOfBits;
-
- // Compute scan line large enough for w pixels.
- if (scanlineStride == 0)
- scanlineStride = ((dataBitOffset + w * numberOfBits) / elemBits);
- this.scanlineStride = scanlineStride;
-
-
- sampleSize = new int[1];
- sampleSize[0] = numberOfBits;
-
- bitMasks = new int[numElems];
- bitOffsets = new int[numElems];
- for (int i=0; i < numElems; i++)
- {
- bitOffsets[numElems - i- 1] = numberOfBits * i;
- bitMasks[numElems - i - 1] = ((1 << numberOfBits) - 1) <<
- bitOffsets[numElems - i - 1];
- }
- }
-
- public SampleModel createCompatibleSampleModel(int w, int h)
- {
- /* FIXME: We can avoid recalculation of bit offsets and sample
- sizes here by passing these from the current instance to a
- special private constructor. */
- return new MultiPixelPackedSampleModel(dataType, w, h, numberOfBits);
- }
-
-
- /**
- * Creates a DataBuffer for holding pixel data in the format and
- * layout described by this SampleModel. The returned buffer will
- * consist of one single bank.
- */
- public DataBuffer createDataBuffer()
- {
- int size;
-
- // FIXME: The comment refers to SinglePixelPackedSampleModel. See if the
- // same can be done for MultiPixelPackedSampleModel.
- // We can save (scanlineStride - width) pixels at the very end of
- // the buffer. The Sun reference implementation (J2SE 1.3.1 and
- // 1.4.1_01) seems to do this; tested with Mauve test code.
- size = scanlineStride * height;
-
- return Buffers.createBuffer(getDataType(), size);
- }
-
-
- public int getNumDataElements()
- {
- return 1;
- }
-
- public int[] getSampleSize()
- {
- return sampleSize;
- }
-
- public int getSampleSize(int band)
- {
- return sampleSize[0];
- }
-
- public int getOffset(int x, int y)
- {
- return scanlineStride * y + ((dataBitOffset + x*numberOfBits) / elemBits);
- }
-
- public int getBitOffset(int x)
- {
- return (dataBitOffset + x*numberOfBits) % elemBits;
- }
-
- public int getDataBitOffset()
- {
- return dataBitOffset;
- }
-
- public int getScanlineStride()
- {
- return scanlineStride;
- }
-
- public int getPixelBitStride()
- {
- return numberOfBits;
- }
-
-
- public SampleModel createSubsetSampleModel(int[] bands)
- {
- int numBands = bands.length;
- if (numBands != 1)
- throw new RasterFormatException("MultiPixelPackedSampleModel only"
- + " supports one band");
-
- return new MultiPixelPackedSampleModel(dataType, width, height,
- numberOfBits, scanlineStride,
- dataBitOffset);
- }
-
- /**
- * Extract one pixel and return in an array of transfer type.
- *
- * Extracts the pixel at x, y from data and stores into the 0th index of the
- * array obj, since there is only one band. If obj is null, a new array of
- * getTransferType() is created.
- *
- * @param x The x-coordinate of the pixel rectangle to store in obj
.
- * @param y The y-coordinate of the pixel rectangle to store in obj
.
- * @param obj The primitive array to store the pixels into or null to force creation.
- * @param data The DataBuffer that is the source of the pixel data.
- * @return The primitive array containing the pixel data.
- * @see java.awt.image.SampleModel#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
- */
- public Object getDataElements(int x, int y, Object obj,
- DataBuffer data)
- {
- int pixel = getSample(x, y, 0, data);
- switch (getTransferType())
- {
- case DataBuffer.TYPE_BYTE:
- if (obj == null) obj = new byte[1];
- ((byte[])obj)[0] = (byte)pixel;
- return obj;
- case DataBuffer.TYPE_USHORT:
- if (obj == null) obj = new short[1];
- ((short[])obj)[0] = (short)pixel;
- return obj;
- case DataBuffer.TYPE_INT:
- if (obj == null) obj = new int[1];
- ((int[])obj)[0] = pixel;
- return obj;
- default:
- // Seems like the only sensible thing to do.
- throw new ClassCastException();
- }
- }
-
- public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
- {
- if (iArray == null) iArray = new int[1];
- iArray[0] = getSample(x, y, 0, data);
-
- return iArray;
- }
-
- public int[] getPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
- {
- int offset = getOffset(x, y);
- if (iArray == null) iArray = new int[w*h];
- int outOffset = 0;
- for (y=0; yobj
.
- * @param y The y-coordinate of the data elements in obj
.
- * @param obj The primitive array containing the data elements to set.
- * @param data The DataBuffer to store the data elements into.
- * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
- */
- public void setDataElements(int x, int y, Object obj, DataBuffer data)
- {
- int transferType = getTransferType();
- if (getTransferType() != data.getDataType())
- {
- throw new IllegalArgumentException("transfer type ("+
- getTransferType()+"), "+
- "does not match data "+
- "buffer type (" +
- data.getDataType() +
- ").");
- }
-
- int offset = getOffset(x, y);
-
- try
- {
- switch (transferType)
- {
- case DataBuffer.TYPE_BYTE:
- {
- DataBufferByte out = (DataBufferByte) data;
- byte[] in = (byte[]) obj;
- out.getData()[offset] = in[0];
- return;
- }
- case DataBuffer.TYPE_USHORT:
- {
- DataBufferUShort out = (DataBufferUShort) data;
- short[] in = (short[]) obj;
- out.getData()[offset] = in[0];
- return;
- }
- case DataBuffer.TYPE_INT:
- {
- DataBufferInt out = (DataBufferInt) data;
- int[] in = (int[]) obj;
- out.getData()[offset] = in[0];
- return;
- }
- default:
- throw new ClassCastException("Unsupported data type");
- }
- }
- catch (ArrayIndexOutOfBoundsException aioobe)
- {
- String msg = "While writing data elements" +
- ", x="+x+", y="+y+
- ", width="+width+", height="+height+
- ", scanlineStride="+scanlineStride+
- ", offset="+offset+
- ", data.getSize()="+data.getSize()+
- ", data.getOffset()="+data.getOffset()+
- ": " +
- aioobe;
- throw new ArrayIndexOutOfBoundsException(msg);
- }
- }
-
- public void setPixel(int x, int y, int[] iArray, DataBuffer data)
- {
- setSample(x, y, 0, iArray[0], data);
- }
-
- public void setSample(int x, int y, int b, int s, DataBuffer data)
- {
- int bitpos =
- ((dataBitOffset + x * numberOfBits) % elemBits) / numberOfBits;
- int offset = getOffset(x, y);
-
- s = s << bitOffsets[bitpos];
- s = s & bitMasks[bitpos];
-
- int sample = data.getElem(offset);
- sample |= s;
- data.setElem(offset, sample);
- }
-
- /**
- * Creates a String with some information about this SampleModel.
- * @return A String describing this SampleModel.
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- StringBuffer result = new StringBuffer();
- result.append(getClass().getName());
- result.append("[");
- result.append("scanlineStride=").append(scanlineStride);
- for(int i=0; i < bitMasks.length; i+=1)
- {
- result.append(", mask[").append(i).append("]=0x").append(Integer.toHexString(bitMasks[i]));
- }
-
- result.append("]");
- return result.toString();
- }
-}
diff --git a/libjava/java/awt/image/PackedColorModel.java b/libjava/java/awt/image/PackedColorModel.java
deleted file mode 100644
index 894e6e66fda..00000000000
--- a/libjava/java/awt/image/PackedColorModel.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import gnu.java.awt.BitMaskExtent;
-
-import java.awt.Point;
-import java.awt.color.ColorSpace;
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public abstract class PackedColorModel extends ColorModel
-{
- private int masks[];
-
- /* Package accessibility, the DirectColorModel needs this array */
- int shifts[];
-
- public PackedColorModel(ColorSpace cspace, int pixelBits,
- int[] colorMaskArray, int alphaMask,
- boolean isAlphaPremultiplied,
- int transparency,
- int transferType)
- {
- super(pixelBits, calcBitsPerComponent(colorMaskArray, alphaMask),
- cspace, (alphaMask != 0), isAlphaPremultiplied, transparency,
- transferType);
- initMasks(colorMaskArray, alphaMask);
- if ((pixelBits<1) || (pixelBits>32)) {
- throw new IllegalArgumentException("pixels per bits must be " +
- "in the range [1, 32]");
- }
- }
-
- private static int[] calcBitsPerComponent(int[] colorMaskArray,
- int alphaMask)
- {
- int numComponents = colorMaskArray.length;
- if (alphaMask != 0) numComponents++;
-
- int[] bitsPerComponent = new int[numComponents];
-
- BitMaskExtent extent = new BitMaskExtent();
- for (int b=0; bpix
array, which must have
- * been initialized to a size of at least w * h
. The
- * data for a pixel (m, n) in the grab rectangle will be stored at
- * pix[(n - y) * scansize + (m - x) + off]
.
- *
- * @param img the Image from which to grab pixels
- * @param x the x coordinate, relative to img
's
- * top-left corner, of the grab rectangle's top-left pixel
- * @param y the y coordinate, relative to img
's
- * top-left corner, of the grab rectangle's top-left pixel
- * @param w the width of the grab rectangle, in pixels
- * @param h the height of the grab rectangle, in pixels
- * @param pix the array in which to store grabbed RGB pixel data
- * @param off the offset into the pix
array at which to
- * start storing RGB data
- * @param scansize a set of scansize
consecutive
- * elements in the pix
array represents one row of
- * pixels in the grab rectangle
- */
- public PixelGrabber(Image img, int x, int y, int w, int h,
- int pix[], int off, int scansize)
- {
- this (img.getSource(), x, y, w, h, pix, off, scansize);
- }
-
- /**
- * Construct a PixelGrabber that will retrieve RGB data from a given
- * ImageProducer.
- *
- * The RGB data will be retrieved from a rectangular region
- * (x, y, w, h)
within the image produced by
- * ip
. The data will be stored in the provided
- * pix
array, which must have been initialized to a
- * size of at least w * h
. The data for a pixel (m, n)
- * in the grab rectangle will be stored at
- * pix[(n - y) * scansize + (m - x) + off]
.
- *
- * @param ip the ImageProducer from which to grab pixels
- * @param x the x coordinate of the grab rectangle's top-left pixel,
- * specified relative to the top-left corner of the image produced
- * by ip
- * @param y the y coordinate of the grab rectangle's top-left pixel,
- * specified relative to the top-left corner of the image produced
- * by ip
- * @param w the width of the grab rectangle, in pixels
- * @param h the height of the grab rectangle, in pixels
- * @param pix the array in which to store grabbed RGB pixel data
- * @param off the offset into the pix
array at which to
- * start storing RGB data
- * @param scansize a set of scansize
consecutive
- * elements in the pix
array represents one row of
- * pixels in the grab rectangle
- */
- public PixelGrabber(ImageProducer ip, int x, int y, int w, int h,
- int pix[], int off, int scansize)
- {
- this.ip = ip;
- this.x = x;
- this.y = y;
- this.width = w;
- this.height = h;
- this.offset = off;
- this.scansize = scansize;
-
- int_pixel_buffer = pix;
- // Initialize the byte array in case ip sends us byte-formatted
- // pixel data.
- byte_pixel_buffer = new byte[pix.length * 4];
- }
-
- /**
- * Construct a PixelGrabber that will retrieve data from a given
- * Image.
- *
- * The RGB data will be retrieved from a rectangular region
- * (x, y, w, h)
within the image. The data will be
- * stored in an internal array which can be accessed by calling
- * getPixels
. The data for a pixel (m, n) in the grab
- * rectangle will be stored in the returned array at index
- * (n - y) * scansize + (m - x) + off
.
- * If forceRGB is false, then the returned data will be not be
- * converted to RGB from its format in img
.
- *
- * If w
is negative, the width of the grab region will
- * be from x to the right edge of the image. Likewise, if
- * h
is negative, the height of the grab region will be
- * from y to the bottom edge of the image.
- *
- * @param img the Image from which to grab pixels
- * @param x the x coordinate, relative to img
's
- * top-left corner, of the grab rectangle's top-left pixel
- * @param y the y coordinate, relative to img
's
- * top-left corner, of the grab rectangle's top-left pixel
- * @param w the width of the grab rectangle, in pixels
- * @param h the height of the grab rectangle, in pixels
- * @param forceRGB true to force conversion of the rectangular
- * region's pixel data to RGB
- */
- public PixelGrabber(Image img,
- int x, int y,
- int w, int h,
- boolean forceRGB)
- {
- this.ip = img.getSource();
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- // If width or height is negative, postpone pixel buffer
- // initialization until setDimensions is called back by ip.
- if (width >= 0 && height >= 0)
- {
- int_pixel_buffer = new int[width * height];
- byte_pixel_buffer = new byte[width * height];
- }
- this.forceRGB = forceRGB;
- }
-
- /**
- * Start grabbing pixels.
- *
- * Spawns an image production thread that calls back to this
- * PixelGrabber's ImageConsumer methods.
- */
- public synchronized void startGrabbing()
- {
- // Make sure we're not already grabbing.
- if (grabbing == false)
- {
- grabbing = true;
- grabberThread = new Thread ()
- {
- public void run ()
- {
- ip.startProduction (PixelGrabber.this);
- }
- };
- grabberThread.start ();
- }
- }
-
- /**
- * Abort pixel grabbing.
- */
- public synchronized void abortGrabbing()
- {
- if (grabbing)
- {
- // Interrupt the grabbing thread.
- Thread moribund = grabberThread;
- grabberThread = null;
- moribund.interrupt();
-
- imageComplete (ImageConsumer.IMAGEABORTED);
- }
- }
-
- /**
- * Have our Image or ImageProducer start sending us pixels via our
- * ImageConsumer methods and wait for all pixels in the grab
- * rectangle to be delivered.
- *
- * @return true if successful, false on abort or error
- *
- * @throws InterruptedException if interrupted by another thread.
- */
- public synchronized boolean grabPixels() throws InterruptedException
- {
- return grabPixels(0);
- }
-
- /**
- * grabPixels's behavior depends on the value of ms
.
- *
- * If ms < 0, return true if all pixels from the source image have
- * been delivered, false otherwise. Do not wait.
- *
- * If ms >= 0 then we request that our Image or ImageProducer start
- * delivering pixels to us via our ImageConsumer methods.
- *
- * If ms > 0, wait at most ms
milliseconds for
- * delivery of all pixels within the grab rectangle.
- *
- * If ms == 0, wait until all pixels have been delivered.
- *
- * @return true if all pixels from the source image have been
- * delivered, false otherwise
- *
- * @throws InterruptedException if this thread is interrupted while
- * we are waiting for pixels to be delivered
- */
- public synchronized boolean grabPixels(long ms) throws InterruptedException
- {
- if (ms < 0)
- return ((observerStatus & (ImageObserver.FRAMEBITS
- | ImageObserver.ALLBITS)) != 0);
-
- // Spawn a new ImageProducer thread to send us the image data via
- // our ImageConsumer methods.
- startGrabbing();
-
- if (ms > 0)
- {
- long stop_time = System.currentTimeMillis() + ms;
- long time_remaining;
- while (grabbing)
- {
- time_remaining = stop_time - System.currentTimeMillis();
- if (time_remaining <= 0)
- break;
- wait (time_remaining);
- }
- abortGrabbing ();
- }
- else
- wait ();
-
- // If consumerStatus is non-zero then the image is done loading or
- // an error has occurred.
- if (consumerStatus != 0)
- return setObserverStatus ();
-
- return ((observerStatus & (ImageObserver.FRAMEBITS
- | ImageObserver.ALLBITS)) != 0);
- }
-
- // Set observer status flags based on the current consumer status
- // flags. Return true if the consumer flags indicate that the
- // image was loaded successfully, or false otherwise.
- private synchronized boolean setObserverStatus ()
- {
- boolean retval = false;
-
- if ((consumerStatus & IMAGEERROR) != 0)
- observerStatus |= ImageObserver.ERROR;
-
- if ((consumerStatus & IMAGEABORTED) != 0)
- observerStatus |= ImageObserver.ABORT;
-
- if ((consumerStatus & STATICIMAGEDONE) != 0)
- {
- observerStatus |= ImageObserver.ALLBITS;
- retval = true;
- }
-
- if ((consumerStatus & SINGLEFRAMEDONE) != 0)
- {
- observerStatus |= ImageObserver.FRAMEBITS;
- retval = true;
- }
-
- return retval;
- }
-
- /**
- * @return the status of the pixel grabbing thread, represented by a
- * bitwise OR of ImageObserver flags
- */
- public synchronized int getStatus()
- {
- return observerStatus;
- }
-
- /**
- * @return the width of the grab rectangle in pixels, or a negative
- * number if the ImageProducer has not yet called our setDimensions
- * method
- */
- public synchronized int getWidth()
- {
- return width;
- }
-
- /**
- * @return the height of the grab rectangle in pixels, or a negative
- * number if the ImageProducer has not yet called our setDimensions
- * method
- */
- public synchronized int getHeight()
- {
- return height;
- }
-
- /**
- * @return a byte array of pixel data if ImageProducer delivered
- * pixel data using the byte[] variant of setPixels, or an int array
- * otherwise
- */
- public synchronized Object getPixels()
- {
- if (ints_delivered)
- return int_pixel_buffer;
- else if (bytes_delivered)
- return byte_pixel_buffer;
- else
- return null;
- }
-
- /**
- * @return the ColorModel currently being used for the majority of
- * pixel data conversions
- */
- public synchronized ColorModel getColorModel()
- {
- return model;
- }
-
- /**
- * Our ImageProducer
calls this method to indicate the
- * size of the image being produced.
- *
- * setDimensions is an ImageConsumer method. None of PixelGrabber's
- * ImageConsumer methods should be called by code that instantiates
- * a PixelGrabber. They are only made public so they can be called
- * by the PixelGrabber's ImageProducer.
- *
- * @param width the width of the image
- * @param height the height of the image
- */
- public synchronized void setDimensions(int width, int height)
- {
- // Our width wasn't set when we were constructed. Set our width
- // so that the grab region includes all pixels from x to the right
- // edge of the source image.
- if (this.width < 0)
- this.width = width - x;
-
- // Our height wasn't set when we were constructed. Set our height
- // so that the grab region includes all pixels from y to the
- // bottom edge of the source image.
- if (this.height < 0)
- this.height = height - y;
-
- if (scansize < 0)
- scansize = this.width;
-
- if (int_pixel_buffer == null)
- int_pixel_buffer = new int[this.width * this.height];
-
- if (byte_pixel_buffer == null)
- byte_pixel_buffer = new byte[this.width * this.height];
- }
-
- /**
- * Our ImageProducer
may call this method to send us a
- * list of its image's properties.
- *
- * setProperties is an ImageConsumer method. None of PixelGrabber's
- * ImageConsumer methods should be called by code that instantiates
- * a PixelGrabber. They are only made public so they can be called
- * by the PixelGrabber's ImageProducer.
- *
- * @param props a list of properties associated with the image being
- * produced
- */
- public synchronized void setProperties(Hashtable props)
- {
- this.props = props;
- }
-
- /**
- * Our ImageProducer will call setColorModel
to
- * indicate the model used by the majority of calls to
- * setPixels
. Each call to setPixels
- * could however indicate a different ColorModel
.
- *
- * setColorModel is an ImageConsumer method. None of PixelGrabber's
- * ImageConsumer methods should be called by code that instantiates
- * a PixelGrabber. They are only made public so they can be called
- * by the PixelGrabber's ImageProducer.
- *
- * @param model the color model to be used most often by setPixels
- *
- * @see ColorModel
- */
- public synchronized void setColorModel(ColorModel model)
- {
- this.model = model;
- }
-
- /**
- * Our ImageProducer
may call this method with a
- * bit mask of hints from any of RANDOMPIXELORDER
,
- * TOPDOWNLEFTRIGHT
, COMPLETESCANLINES
,
- * SINGLEPASS
, SINGLEFRAME
.
- *
- * setHints is an ImageConsumer method. None of PixelGrabber's
- * ImageConsumer methods should be called by code that instantiates
- * a PixelGrabber. They are only made public so they can be called
- * by the PixelGrabber's ImageProducer.
- *
- * @param flags a bit mask of hints
- */
- public synchronized void setHints(int flags)
- {
- hints = flags;
- }
-
- /**
- * Our ImageProducer calls setPixels to deliver a subset of its
- * pixels.
- *
- * Each element of the pixels array represents one pixel. The
- * pixel data is formatted according to the color model model.
- * The x and y parameters are the coordinates of the rectangular
- * region of pixels being delivered to this ImageConsumer,
- * specified relative to the top left corner of the image being
- * produced. Likewise, w and h are the pixel region's dimensions.
- *
- * @param x x coordinate of pixel block
- * @param y y coordinate of pixel block
- * @param w width of pixel block
- * @param h height of pixel block
- * @param model color model used to interpret pixel data
- * @param pixels pixel block data
- * @param offset offset into pixels array
- * @param scansize width of one row in the pixel block
- */
- public synchronized void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels,
- int offset, int scansize)
- {
- ColorModel currentModel;
- if (model != null)
- currentModel = model;
- else
- currentModel = this.model;
-
- for(int yp = y; yp < (y + h); yp++)
- {
- for(int xp = x; xp < (x + w); xp++)
- {
- // Check if the coordinates (xp, yp) are within the
- // pixel block that we are grabbing.
- if(xp >= this.x
- && yp >= this.y
- && xp < (this.x + this.width)
- && yp < (this.y + this.height))
- {
- int i = (yp - this.y) * this.scansize + (xp - this.x) + this.offset;
- int p = (yp - y) * scansize + (xp - x) + offset;
- if (forceRGB)
- {
- ints_delivered = true;
-
- assert (i >= 0 && i < int_pixel_buffer.length);
- assert (p >= 0 && p < pixels.length);
- int_pixel_buffer[i] = currentModel.getRGB (pixels[p] & 0xFF);
- }
- else
- {
- bytes_delivered = true;
-
- assert (i >= 0 && i < byte_pixel_buffer.length);
- assert (p >= 0 && p < pixels.length);
- byte_pixel_buffer[i] = pixels[p];
- }
- }
- }
- }
- }
-
- /**
- * Our ImageProducer calls setPixels to deliver a subset of its
- * pixels.
- *
- * Each element of the pixels array represents one pixel. The
- * pixel data is formatted according to the color model model.
- * The x and y parameters are the coordinates of the rectangular
- * region of pixels being delivered to this ImageConsumer,
- * specified relative to the top left corner of the image being
- * produced. Likewise, w and h are the pixel region's dimensions.
- *
- * @param x x coordinate of pixel block
- * @param y y coordinate of pixel block
- * @param w width of pixel block
- * @param h height of pixel block
- * @param model color model used to interpret pixel data
- * @param pixels pixel block data
- * @param offset offset into pixels array
- * @param scansize width of one row in the pixel block
- */
- public synchronized void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels,
- int offset, int scansize)
- {
- ColorModel currentModel;
- if (model != null)
- currentModel = model;
- else
- currentModel = this.model;
-
- ints_delivered = true;
-
- for(int yp = y; yp < (y + h); yp++)
- {
- for(int xp = x; xp < (x + w); xp++)
- {
- // Check if the coordinates (xp, yp) are within the
- // pixel block that we are grabbing.
- if(xp >= this.x
- && yp >= this.y
- && xp < (this.x + this.width)
- && yp < (this.y + this.height))
- {
- int i = (yp - this.y) * this.scansize + (xp - this.x) + this.offset;
- int p = (yp - y) * scansize + (xp - x) + offset;
- assert (i >= 0 && i < int_pixel_buffer.length);
- assert (p >= 0 && p < pixels.length);
- if (forceRGB)
- int_pixel_buffer[i] = currentModel.getRGB (pixels[p]);
- else
- int_pixel_buffer[i] = pixels[p];
- }
- }
- }
- }
-
- /**
- * Our ImageProducer
calls this method to inform us
- * that a single frame or the entire image is complete. The method
- * is also used to inform us of an error in loading or producing the
- * image.
- *
- * @param status the status of image production, represented by a
- * bitwise OR of ImageConsumer flags
- */
- public synchronized void imageComplete(int status)
- {
- consumerStatus = status;
- setObserverStatus ();
- grabbing = false;
- ip.removeConsumer (this);
-
- notifyAll ();
- }
-
- /**
- * @return the return value of getStatus
- *
- * @specnote The newer getStatus should be used in place of status.
- */
- public synchronized int status()
- {
- return getStatus();
- }
-}
diff --git a/libjava/java/awt/image/PixelInterleavedSampleModel.java b/libjava/java/awt/image/PixelInterleavedSampleModel.java
deleted file mode 100644
index 4c5c436edfc..00000000000
--- a/libjava/java/awt/image/PixelInterleavedSampleModel.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* PixelInterleavedSampleModel.java
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-
-/**
- * A SampleModel
that uses exactly one element of the
- * raster’s {@link DataBuffer} per pixel, holds all bands in a
- * single bank, and stores band data in pixel-interleaved manner.
- *
- * @since 1.2
- *
- * @author Sascha Brawer (brawer@dandelis.ch)
- */
-public class PixelInterleavedSampleModel
- extends ComponentSampleModel
-{
- public PixelInterleavedSampleModel(int dataType, int width, int height,
- int pixelStride, int scanlineStride,
- int[] bandOffsets)
- {
- super(dataType, width, height, pixelStride, scanlineStride,
- bandOffsets);
- }
-
-
- /**
- * Creates a new SampleModel
that is like this one, but
- * uses the specified width and height.
- *
- * @param width the number of pixels in the horizontal direction.
- *
- * @param height the number of pixels in the vertical direction.
- */
- public SampleModel createCompatibleSampleModel(int width, int height)
- {
- return new PixelInterleavedSampleModel(dataType, width, height,
- pixelStride, scanlineStride,
- bandOffsets);
- }
-
-
- /**
- * Creates a new SampleModel
that is like this one, but
- * uses only a subset of its bands.
- *
- * @param bands an array whose elements indicate which bands shall
- * be part of the subset. For example, [0, 2, 3]
would
- * create a SampleModel containing bands #0, #2 and #3.
- */
- public SampleModel createSubsetSampleModel(int[] bands)
- {
- int[] subOffsets;
-
- subOffsets = new int[bands.length];
- for (int i = 0; i < bands.length; i++)
- subOffsets[i] = bandOffsets[bands[i]];
-
- return new PixelInterleavedSampleModel(dataType, width, height,
- pixelStride, scanlineStride,
- subOffsets);
- }
-}
diff --git a/libjava/java/awt/image/RGBImageFilter.java b/libjava/java/awt/image/RGBImageFilter.java
deleted file mode 100644
index f55ebd1f99e..00000000000
--- a/libjava/java/awt/image/RGBImageFilter.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/* RGBImageFilter.java -- Java class for filtering Pixels by RGB values
- Copyright (C) 1999, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-/**
- * A filter designed to filter images in the default RGBColorModel regardless of
- * the ImageProducer's ColorModel.
- *
- * @author Mark Benvenuto (mcb54@columbia.edu)
- */
-public abstract class RGBImageFilter extends ImageFilter
-{
- protected ColorModel origmodel;
-
- protected ColorModel newmodel;
-
- /**
- Specifies whether to apply the filter to the index entries of the
- IndexColorModel. Subclasses should set this to true if the filter
- does not depend on the pixel's coordinate.
- */
- protected boolean canFilterIndexColorModel = false;
-
- /**
- Construct new RGBImageFilter.
- */
- public RGBImageFilter()
- {
- }
-
- /**
- * Sets the ColorModel used to filter with. If the specified ColorModel is IndexColorModel
- * and canFilterIndexColorModel is true, we subsitute the ColorModel for a filtered one
- * here and in setPixels whenever the original one appears. Otherwise overrides the default
- * ColorModel of ImageProducer and specifies the default RGBColorModel
- *
- * @param model the color model to be used most often by setPixels
- * @see ColorModel */
- public void setColorModel(ColorModel model)
- {
- origmodel = model;
- newmodel = model;
-
- if( ( model instanceof IndexColorModel) && canFilterIndexColorModel ) {
- newmodel = filterIndexColorModel( (IndexColorModel) model );
- consumer.setColorModel(newmodel);
- }
- else {
- consumer.setColorModel(ColorModel.getRGBdefault());
- }
- }
-
- /**
- Registers a new ColorModel to subsitute for the old ColorModel when
- setPixels encounters the a pixel with the old ColorModel. The pixel
- remains unchanged except for a new ColorModel.
-
- @param oldcm the old ColorModel
- @param newcm the new ColorModel
- */
- public void substituteColorModel(ColorModel oldcm,
- ColorModel newcm)
- {
- origmodel = oldcm;
- newmodel = newcm;
- }
-
- /**
- Filters an IndexColorModel through the filterRGB function. Uses
- coordinates of -1 to indicate its filtering an index and not a pixel.
-
- @param icm an IndexColorModel to filter
- */
- public IndexColorModel filterIndexColorModel(IndexColorModel icm)
- {
- int len = icm.getMapSize(), rgb;
- byte reds[] = new byte[len], greens[] = new byte[len], blues[] = new byte[len], alphas[] = new byte[len];
-
- icm.getAlphas( alphas );
- icm.getReds( reds );
- icm.getGreens( greens );
- icm.getBlues( blues );
-
- for( int i = 0; i < len; i++ )
- {
- rgb = filterRGB( -1, -1, makeColor ( alphas[i], reds[i], greens[i], blues[i] ) );
- alphas[i] = (byte)(( 0xff000000 & rgb ) >> 24);
- reds[i] = (byte)(( 0xff0000 & rgb ) >> 16);
- greens[i] = (byte)(( 0xff00 & rgb ) >> 8);
- blues[i] = (byte)(0xff & rgb);
- }
- return new IndexColorModel( icm.getPixelSize(), len, reds, greens, blues, alphas );
- }
-
- private int makeColor( byte a, byte r, byte g, byte b )
- {
- return ( 0xff000000 & (a << 24) | 0xff0000 & (r << 16) | 0xff00 & (g << 8) | 0xff & b );
- }
-
- /**
- This functions filters a set of RGB pixels through filterRGB.
-
- @param x the x coordinate of the rectangle
- @param y the y coordinate of the rectangle
- @param w the width of the rectangle
- @param h the height of the rectangle
- @param pixels the array of pixel values
- @param offset the index of the first pixels in the pixels
array
- @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void filterRGBPixels(int x, int y, int w, int h, int[] pixels,
- int offset, int scansize)
- {
- for (int xp = x; xp < (x + w); xp++)
- for (int yp = y; yp < (y + h); yp++)
- {
- pixels[offset] = filterRGB(xp, yp, pixels[offset]);
- offset++;
- }
- }
-
-
- /**
- * If the ColorModel is the same ColorModel which as already converted
- * then it converts it the converted ColorModel. Otherwise it passes the
- * array of pixels through filterRGBpixels.
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels,
- int offset, int scansize)
- {
- if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel)
- {
- consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize);
- }
- else
- {
- int intPixels[] =
- convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize );
- filterRGBPixels( x, y, w, h, intPixels, offset, scansize );
- consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), intPixels, offset, scansize);
- }
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as an int
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels,
- int offset, int scansize)
- {
- if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel)
- {
- consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize);
- }
- else
- {
- //FIXME: Store the filtered pixels in a separate temporary buffer?
- convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize );
- filterRGBPixels( x, y, w, h, pixels, offset, scansize );
- consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, offset, scansize);
- }
- }
-
- private int[] convertColorModelToDefault(int x, int y, int w, int h,
- ColorModel model, byte pixels[],
- int offset, int scansize)
- {
- int intPixels[] = new int[pixels.length];
- for (int i = 0; i < pixels.length; i++)
- intPixels[i] = makeColorbyDefaultCM(model, pixels[i]);
- return intPixels;
- }
-
- private void convertColorModelToDefault(int x, int y, int w, int h,
- ColorModel model, int pixels[],
- int offset, int scansize)
- {
- for (int i = 0; i < pixels.length; i++)
- pixels[i] = makeColorbyDefaultCM(model, pixels[i]);
- }
-
- private int makeColorbyDefaultCM(ColorModel model, byte rgb)
- {
- return makeColor( model.getAlpha( rgb ) * 4, model.getRed( rgb ) * 4, model.getGreen( rgb ) * 4, model.getBlue( rgb ) * 4 );
- }
-
- private int makeColorbyDefaultCM(ColorModel model, int rgb)
- {
- return makeColor( model.getAlpha( rgb ), model.getRed( rgb ), model.getGreen( rgb ), model.getBlue( rgb ) );
- }
-
- private int makeColor( int a, int r, int g, int b )
- {
- return (int)( 0xff000000 & (a << 24) | 0xff0000 & (r << 16) | 0xff00 & (g << 8) | 0xff & b );
- }
-
-
- /**
- Filters a single pixel from the default ColorModel.
-
- @param x x-coordinate
- @param y y-coordinate
- @param rgb color
- */
- public abstract int filterRGB(int x,
- int y,
- int rgb);
-}
diff --git a/libjava/java/awt/image/Raster.java b/libjava/java/awt/image/Raster.java
deleted file mode 100644
index 4af958a17c7..00000000000
--- a/libjava/java/awt/image/Raster.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.Point;
-import java.awt.Rectangle;
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public class Raster
-{
- protected SampleModel sampleModel;
- protected DataBuffer dataBuffer;
- protected int minX;
- protected int minY;
- protected int width;
- protected int height;
- protected int sampleModelTranslateX;
- protected int sampleModelTranslateY;
- protected int numBands;
- protected int numDataElements;
- protected Raster parent;
-
- protected Raster(SampleModel sampleModel, Point origin)
- {
- this(sampleModel, sampleModel.createDataBuffer(), origin);
- }
-
- protected Raster(SampleModel sampleModel, DataBuffer dataBuffer,
- Point origin)
- {
- this(sampleModel, dataBuffer,
- new Rectangle(origin.x, origin.y,
- sampleModel.getWidth(), sampleModel.getHeight()),
- origin, null);
- }
-
- protected Raster(SampleModel sampleModel, DataBuffer dataBuffer,
- Rectangle aRegion,
- Point sampleModelTranslate, Raster parent)
- {
- this.sampleModel = sampleModel;
- this.dataBuffer = dataBuffer;
- this.minX = aRegion.x;
- this.minY = aRegion.y;
- this.width = aRegion.width;
- this.height = aRegion.height;
-
- // If sampleModelTranslate is null, use (0,0). Methods such as
- // Raster.createRaster are specified to allow for a null argument.
- if (sampleModelTranslate != null)
- {
- this.sampleModelTranslateX = sampleModelTranslate.x;
- this.sampleModelTranslateY = sampleModelTranslate.y;
- }
-
- this.numBands = sampleModel.getNumBands();
- this.numDataElements = sampleModel.getNumDataElements();
- this.parent = parent;
- }
-
- public static WritableRaster createInterleavedRaster(int dataType,
- int w, int h,
- int bands,
- Point location)
- {
- int[] bandOffsets = new int[bands];
- // TODO: Maybe not generate this every time.
- for (int b=0; bRaster
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Raster
- * @status updated to 1.4
- */
-public class RasterFormatException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 96598996116164315L;
-
- /**
- * Create a new instance with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public RasterFormatException(String message)
- {
- super(message);
- }
-} // class RasterFormatException
diff --git a/libjava/java/awt/image/RasterOp.java b/libjava/java/awt/image/RasterOp.java
deleted file mode 100644
index e081ca3d2ad..00000000000
--- a/libjava/java/awt/image/RasterOp.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* RasterOp.java --
- Copyright (C) 2000, 2002, 2004, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.RenderingHints;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-public interface RasterOp
-{
- WritableRaster filter(Raster src, WritableRaster dest);
-
- Rectangle2D getBounds2D(Raster src);
-
- WritableRaster createCompatibleDestRaster(Raster src);
-
- Point2D getPoint2D(Point2D srcPoint, Point2D destPoint);
-
- RenderingHints getRenderingHints();
-}
-
diff --git a/libjava/java/awt/image/RenderedImage.java b/libjava/java/awt/image/RenderedImage.java
deleted file mode 100644
index b35f8602129..00000000000
--- a/libjava/java/awt/image/RenderedImage.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* RenderedImage.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.Rectangle;
-import java.util.Vector;
-
-/**
- * NEEDS DOCUMENTATION
- */
-public interface RenderedImage
-{
- Vector getSources();
- Object getProperty(String name);
- String[] getPropertyNames();
- ColorModel getColorModel();
- SampleModel getSampleModel();
- int getWidth();
- int getHeight();
- int getMinX();
- int getMinY();
- int getNumXTiles();
- int getNumYTiles();
- int getMinTileX();
- int getMinTileY();
- int getTileWidth();
- int getTileHeight();
- int getTileGridXOffset();
- int getTileGridYOffset();
- Raster getTile(int x, int y);
- Raster getData();
- Raster getData(Rectangle r);
- WritableRaster copyData(WritableRaster raster);
-} // interface RenderedImage
diff --git a/libjava/java/awt/image/ReplicateScaleFilter.java b/libjava/java/awt/image/ReplicateScaleFilter.java
deleted file mode 100644
index 3841e49d538..00000000000
--- a/libjava/java/awt/image/ReplicateScaleFilter.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/* ReplicateScaleFilter.java -- Java class for filtering images
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.util.Hashtable;
-
-/**
- * This filter should be used for fast scaling of images where the result
- * does not need to ensure straight lines are still straight, etc. The
- * exact method is not defined by Sun but some sort of fast Box filter should
- * probably be correct.
- *
- * Currently this filter does nothing and needs to be implemented.
- *
- * @author C. Brian Jones (cbj@gnu.org)
- */
-public class ReplicateScaleFilter extends ImageFilter
-{
- public ReplicateScaleFilter(int width, int height) {
- destHeight = height;
- destWidth = width;
- }
-
- /**
- * The height of the destination image.
- */
- protected int destHeight;
-
- /**
- * The width of the destination image.
- */
- protected int destWidth;
-
- /**
- * The height of the source image.
- */
- protected int srcHeight;
-
- /**
- * The width of the source image.
- */
- protected int srcWidth;
-
- /**
- *
- */
- protected int srcrows[];
-
- /**
- *
- */
- protected int srccols[];
-
- /**
- *
- */
- protected Object outpixbuf;
-
- /**
- * An ImageProducer
indicates the size of the image
- * being produced using this method. A filter can override this
- * method to intercept these calls from the producer in order to
- * change either the width or the height before in turn calling
- * the consumer's setDimensions
method.
- *
- * @param width the width of the image
- * @param height the height of the image
- */
- public void setDimensions(int width, int height)
- {
- srcWidth = width;
- srcHeight = height;
-
- /* If either destHeight or destWidth is < 0, the image should
- maintain its original aspect ratio. When both are < 0,
- just maintain the original width and height. */
- if (destWidth < 0 && destHeight < 0)
- {
- destWidth = width;
- destHeight = height;
- }
- else if (destWidth < 0)
- {
- destWidth = (int) (width * ((double) destHeight / srcHeight));
- }
- else if (destHeight < 0)
- {
- destHeight = (int) (height * ((double) destWidth / srcWidth));
- }
-
- consumer.setDimensions(destWidth, destHeight);
- }
-
- /**
- * An ImageProducer
can set a list of properties
- * associated with this image by using this method.
- *
- * @param props the list of properties associated with this image
- */
- public void setProperties(Hashtable props)
- {
- props.put("filters", "ReplicateScaleFilter");
- consumer.setProperties(props);
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as a byte
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize)
- {
- double rx = ((double) srcWidth) / destWidth;
- double ry = ((double) srcHeight) / destHeight;
-
- int destScansize = (int) Math.round(scansize / rx);
-
- byte[] destPixels = replicatePixels(x, y, w, h,
- model, pixels, offset, scansize,
- rx, ry, destScansize);
-
- consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
- (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
- model, destPixels, 0, destScansize);
- }
-
- /**
- * This function delivers a rectangle of pixels where any
- * pixel(m,n) is stored in the array as an int
at
- * index (n * scansize + m + offset).
- *
- * @param x the x coordinate of the rectangle
- * @param y the y coordinate of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
- * @param model the ColorModel
used to translate the pixels
- * @param pixels the array of pixel values
- * @param offset the index of the first pixels in the pixels
array
- * @param scansize the width to use in extracting pixels from the pixels
array
- */
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels, int offset, int scansize)
- {
- double rx = ((double) srcWidth) / destWidth;
- double ry = ((double) srcHeight) / destHeight;
-
- int destScansize = (int) Math.round(scansize / rx);
-
- int[] destPixels = replicatePixels(x, y, w, h,
- model, pixels, offset, scansize,
- rx, ry, destScansize);
-
- consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
- (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
- model, destPixels, 0, destScansize);
- }
-
- private byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, byte[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
- {
- byte[] destPixels =
- new byte[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
-
- int a, b;
- for (int i = 0; i < destPixels.length; i++)
- {
- a = (int) ((int) ( ((double) i) / destScansize) * ry) * srcScansize;
- b = (int) ((i % destScansize) * rx);
- if ((a + b + srcOffset) < srcPixels.length)
- destPixels[i] = srcPixels[a + b + srcOffset];
- }
-
- return destPixels;
- }
-
- private int[] replicatePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, int[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
- {
- int[] destPixels =
- new int[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
-
- int a, b;
- for (int i = 0; i < destPixels.length; i++)
- {
- a = (int) ((int) ( ((double) i) / destScansize) * ry) * srcScansize;
- b = (int) ((i % destScansize) * rx);
- if ((a + b + srcOffset) < srcPixels.length)
- destPixels[i] = srcPixels[a + b + srcOffset];
- }
-
- return destPixels;
- }
-}
-
diff --git a/libjava/java/awt/image/RescaleOp.java b/libjava/java/awt/image/RescaleOp.java
deleted file mode 100644
index 35b42f79ccd..00000000000
--- a/libjava/java/awt/image/RescaleOp.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.image;
-
-import java.awt.RenderingHints;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.util.Arrays;
-
-/**
- * @author Jerry Quinn (jlquinn@optonline.net)
- */
-public class RescaleOp implements BufferedImageOp, RasterOp
-{
- private float[] scale;
- private float[] offsets;
- private RenderingHints hints = null;
-
- public RescaleOp(float[] scaleFactors,
- float[] offsets,
- RenderingHints hints)
- {
- this.scale = scaleFactors;
- this.offsets = offsets;
- this.hints = hints;
- }
-
- public RescaleOp(float scaleFactor,
- float offset,
- RenderingHints hints)
- {
- scale = new float[]{ scaleFactor };
- offsets = new float[]{offset};
- this.hints = hints;
- }
-
- public final float[] getScaleFactors(float[] scaleFactors)
- {
- if (scaleFactors == null)
- scaleFactors = new float[scale.length];
- System.arraycopy(scale, 0, scaleFactors, 0, scale.length);
- return scaleFactors;
- }
-
- public final float[] getOffsets(float[] offsets)
- {
- if (offsets == null)
- offsets = new float[this.offsets.length];
- System.arraycopy(this.offsets, 0, offsets, 0, this.offsets.length);
- return offsets;
- }
-
- public final int getNumFactors()
- {
- return scale.length;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#getRenderingHints()
- */
- public RenderingHints getRenderingHints()
- {
- return hints;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage, java.awt.image.BufferedImage)
- */
- public final BufferedImage filter(BufferedImage src, BufferedImage dst)
- {
- // TODO Make sure premultiplied alpha is handled correctly.
- // TODO See that color conversion is handled.
- // TODO figure out how to use rendering hints.
- if (scale.length != offsets.length)
- throw new IllegalArgumentException();
-
- ColorModel scm = src.getColorModel();
- if (dst == null) dst = createCompatibleDestImage(src, null);
-
- WritableRaster wsrc = src.getRaster();
- WritableRaster wdst = dst.getRaster();
-
- // Share constant across colors except alpha
- if (scale.length == 1 || scale.length == scm.getNumColorComponents())
- {
- // Construct a raster that doesn't include an alpha band.
- int[] subbands = new int[scm.getNumColorComponents()];
- for (int i=0; i < subbands.length; i++) subbands[i] = i;
- wsrc =
- wsrc.createWritableChild(wsrc.minX, wsrc.minY, wsrc.width, wsrc.height,
- wsrc.minX, wsrc.minY, subbands);
- }
- // else all color bands
-
- filter(wsrc, wdst);
- return dst;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
- */
- public final WritableRaster filter(Raster src, WritableRaster dest)
- {
- if (dest == null) dest = src.createCompatibleWritableRaster();
-
- // Required sanity checks
- if (src.numBands != dest.numBands || scale.length != offsets.length)
- throw new IllegalArgumentException();
- if (scale.length != 1 && scale.length != src.numBands)
- throw new IllegalArgumentException();
-
- // Create scaling arrays if needed
- float[] lscale = scale;
- float[] loff = offsets;
- if (scale.length == 1)
- {
- lscale = new float[src.numBands];
- Arrays.fill(lscale, scale[0]);
- loff = new float[src.numBands];
- Arrays.fill(loff, offsets[0]);
- }
-
- // TODO The efficiency here can be improved for various data storage
- // patterns, aka SampleModels.
- float[] pixel = new float[src.numBands];
- for (int y = src.minY; y < src.height + src.minY; y++)
- for (int x = src.minX; x < src.width + src.minX; x++)
- {
- src.getPixel(x, y, pixel);
- for (int b = 0; b < src.numBands; b++)
- pixel[b] = pixel[b] * lscale[b] + loff[b];
- dest.setPixel(x, y, pixel);
- }
- return dest;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
- */
- public BufferedImage createCompatibleDestImage(BufferedImage src,
- ColorModel dstCM)
- {
- if (dstCM == null) dstCM = src.getColorModel();
- WritableRaster wr = src.getRaster().createCompatibleWritableRaster();
- BufferedImage image
- = new BufferedImage(dstCM, wr, src.isPremultiplied, null);
- return image;
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
- */
- public WritableRaster createCompatibleDestRaster(Raster src)
- {
- return src.createCompatibleWritableRaster();
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
- */
- public final Rectangle2D getBounds2D(BufferedImage src)
- {
- return src.getRaster().getBounds();
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
- */
- public final Rectangle2D getBounds2D(Raster src)
- {
- return src.getBounds();
- }
-
- /* (non-Javadoc)
- * @see java.awt.image.BufferedImageOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
- */
- public final Point2D getPoint2D(Point2D src, Point2D dst) {
- if (dst == null) dst = (Point2D) src.clone();
- else dst.setLocation(src);
- return dst;
- }
-
-}
diff --git a/libjava/java/awt/image/SampleModel.java b/libjava/java/awt/image/SampleModel.java
deleted file mode 100644
index 0c625291b64..00000000000
--- a/libjava/java/awt/image/SampleModel.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public abstract class SampleModel
-{
- /** Width of image described. */
- protected int width;
-
- /** Height of image described. */
- protected int height;
-
- /** Number of bands in the image described. */
- protected int numBands;
-
- /**
- * The DataBuffer type that is used to store the data of the image
- * described.
- */
- protected int dataType;
-
- public SampleModel(int dataType, int w, int h, int numBands)
- {
- if ((w <= 0) || (h <= 0))
- throw new IllegalArgumentException((w <= 0 ? " width<=0" : " width is ok")
- +(h <= 0 ? " height<=0" : " height is ok"));
-
- // FIXME: How can an int be greater than Integer.MAX_VALUE?
- // FIXME: How do we identify an unsupported data type?
-
- this.dataType = dataType;
- this.width = w;
- this.height = h;
- this.numBands = numBands;
- }
-
- public final int getWidth()
- {
- return width;
- }
-
- public final int getHeight()
- {
- return height;
- }
-
- public final int getNumBands()
- {
- return numBands;
- }
-
- public abstract int getNumDataElements();
-
- public final int getDataType()
- {
- return dataType;
- }
-
- public int getTransferType()
- {
- // FIXME: Is this a reasonable default implementation?
- return dataType;
- }
-
- public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
- {
- if (iArray == null) iArray = new int[numBands];
- for (int b=0; bShortLookupTable
instance.
- *
- * Offset is subtracted from pixel values when looking up in the translation
- * table. The same table is applied to all pixel components.
- *
- * @param offset Offset to be subtracted.
- * @param data Lookup table for all components.
- * @exception IllegalArgumentException if offset < 0.
- */
- public ShortLookupTable(int offset, short[] data)
- throws IllegalArgumentException
- {
- super(offset, 1);
- this.data = new short[][] {data};
- }
-
- /** Return the lookup tables. */
- public final short[][] getTable()
- {
- return data;
- }
-
- /**
- * Return translated values for a pixel.
- *
- * For each value in the pixel src, use the value minus offset as an index
- * in the component array and copy the value there to the output for the
- * component. If dest is null, the output is a new array, otherwise the
- * translated values are written to dest. Dest can be the same array as
- * src.
- *
- * For example, if the pixel src is [2, 4, 3], and offset is 1, the output
- * is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
- * translation arrays.
- *
- * @param src Component values of a pixel.
- * @param dst Destination array for values, or null.
- * @return Translated values for the pixel.
- */
- public int[] lookupPixel(int[] src, int[] dst)
- throws ArrayIndexOutOfBoundsException
- {
- if (dst == null)
- dst = new int[src.length];
-
- if (data.length == 1)
- for (int i=0; i < src.length; i++)
- dst[i] = data[0][src[i] - offset];
- else
- for (int i=0; i < src.length; i++)
- dst[i] = data[i][src[i] - offset];
-
- return dst;
- }
-
- /**
- * Return translated values for a pixel.
- *
- * For each value in the pixel src, use the value minus offset as an index
- * in the component array and copy the value there to the output for the
- * component. If dest is null, the output is a new array, otherwise the
- * translated values are written to dest. Dest can be the same array as
- * src.
- *
- * For example, if the pixel src is [2, 4, 3], and offset is 1, the output
- * is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the
- * translation arrays.
- *
- * @param src Component values of a pixel.
- * @param dst Destination array for values, or null.
- * @return Translated values for the pixel.
- */
- public short[] lookupPixel(short[] src, short[] dst)
- throws ArrayIndexOutOfBoundsException
- {
- if (dst == null)
- dst = new short[src.length];
-
- if (data.length == 1)
- for (int i=0; i < src.length; i++)
- dst[i] = data[0][((int)src[i]) - offset];
- else
- for (int i=0; i < src.length; i++)
- dst[i] = data[i][((int)src[i]) - offset];
-
- return dst;
-
- }
-}
diff --git a/libjava/java/awt/image/SinglePixelPackedSampleModel.java b/libjava/java/awt/image/SinglePixelPackedSampleModel.java
deleted file mode 100644
index 6ccce753bd3..00000000000
--- a/libjava/java/awt/image/SinglePixelPackedSampleModel.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.image;
-
-import gnu.java.awt.BitMaskExtent;
-import gnu.java.awt.Buffers;
-
-/**
- * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
- */
-public class SinglePixelPackedSampleModel extends SampleModel
-{
- private int scanlineStride;
- private int[] bitMasks;
- private int[] bitOffsets;
- private int[] sampleSize;
-
- public SinglePixelPackedSampleModel(int dataType, int w, int h,
- int[] bitMasks)
- {
- this(dataType, w, h, w, bitMasks);
- }
-
- public SinglePixelPackedSampleModel(int dataType, int w, int h,
- int scanlineStride, int[] bitMasks)
- {
- super(dataType, w, h, bitMasks.length);
-
- switch (dataType)
- {
- case DataBuffer.TYPE_BYTE:
- case DataBuffer.TYPE_USHORT:
- case DataBuffer.TYPE_INT:
- break;
- default:
- throw new IllegalArgumentException("SinglePixelPackedSampleModel unsupported dataType");
- }
-
- this.scanlineStride = scanlineStride;
- this.bitMasks = bitMasks;
-
- bitOffsets = new int[numBands];
- sampleSize = new int[numBands];
-
- BitMaskExtent extent = new BitMaskExtent();
- for (int b=0; bobj
.
- * @param w The width of the pixel rectangle to store in obj
.
- * @param h The height of the pixel rectangle to store in obj
.
- * @param obj The primitive array to store the pixels into or null to force creation.
- * @param data The DataBuffer that is the source of the pixel data.
- * @return The primitive array containing the pixel data.
- * @see java.awt.image.SampleModel#getDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
- */
- public Object getDataElements(int x, int y, int w, int h, Object obj,
- DataBuffer data)
- {
- int size = w*h;
- int dataSize = size;
- Object pixelData = null;
- switch (getTransferType())
- {
- case DataBuffer.TYPE_BYTE:
- pixelData = ((DataBufferByte) data).getData();
- if (obj == null) obj = new byte[dataSize];
- break;
- case DataBuffer.TYPE_USHORT:
- pixelData = ((DataBufferUShort) data).getData();
- if (obj == null) obj = new short[dataSize];
- break;
- case DataBuffer.TYPE_INT:
- pixelData = ((DataBufferInt) data).getData();
- if (obj == null) obj = new int[dataSize];
- break;
- default:
- // Seems like the only sensible thing to do.
- throw new ClassCastException();
- }
- if(x==0 && scanlineStride == w)
- {
- // The full width need to be copied therefore we can copy in one shot.
- System.arraycopy(pixelData, scanlineStride*y + data.getOffset(), obj, 0, size);
- }
- else
- {
- // Since we do not need the full width we need to copy line by line.
- int outOffset = 0;
- int dataOffset = scanlineStride*y + x + data.getOffset();
- for (int yy = y; yy<(y+h); yy++)
- {
- System.arraycopy(pixelData, dataOffset, obj, outOffset, w);
- dataOffset += scanlineStride;
- outOffset += w;
- }
- }
- return obj;
- }
-
-
- public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
- {
- int offset = scanlineStride*y + x;
- if (iArray == null) iArray = new int[numBands];
- int samples = data.getElem(offset);
-
- for (int b=0; bobj
.
- * @param y The y-coordinate of the data elements in obj
.
- * @param w The width of the data elements in obj
.
- * @param h The height of the data elements in obj
.
- * @param obj The primitive array containing the data elements to set.
- * @param data The DataBuffer to store the data elements into.
- * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
- */
- public void setDataElements(int x, int y, int w, int h,
- Object obj, DataBuffer data)
- {
-
- Object pixelData;
- switch (getTransferType())
- {
- case DataBuffer.TYPE_BYTE:
- pixelData = ((DataBufferByte) data).getData();
- break;
- case DataBuffer.TYPE_USHORT:
- pixelData = ((DataBufferUShort) data).getData();
- break;
- case DataBuffer.TYPE_INT:
- pixelData = ((DataBufferInt) data).getData();
- break;
- default:
- // Seems like the only sensible thing to do.
- throw new ClassCastException();
- }
-
- int inOffset = 0;
- int dataOffset = scanlineStride*y + x + data.getOffset();
- for (int yy=y; yy<(y+h); yy++)
- {
- System.arraycopy(obj,inOffset,pixelData,dataOffset,w);
- dataOffset += scanlineStride;
- inOffset += w;
- }
- }
-
-
- public void setDataElements(int x, int y, Object obj, DataBuffer data)
- {
- int offset = scanlineStride*y + x + data.getOffset();
-
- int transferType = getTransferType();
- if (getTransferType() != data.getDataType())
- {
- throw new IllegalArgumentException("transfer type ("+
- getTransferType()+"), "+
- "does not match data "+
- "buffer type (" +
- data.getDataType() +
- ").");
- }
-
- try
- {
- switch (transferType)
- {
- case DataBuffer.TYPE_BYTE:
- {
- DataBufferByte out = (DataBufferByte) data;
- byte[] in = (byte[]) obj;
- out.getData()[offset] = in[0];
- return;
- }
- case DataBuffer.TYPE_USHORT:
- {
- DataBufferUShort out = (DataBufferUShort) data;
- short[] in = (short[]) obj;
- out.getData()[offset] = in[0];
- return;
- }
- case DataBuffer.TYPE_INT:
- {
- DataBufferInt out = (DataBufferInt) data;
- int[] in = (int[]) obj;
- out.getData()[offset] = in[0];
- return;
- }
- // FIXME: Fill in the other possible types.
- default:
- throw new InternalError();
- }
- }
- catch (ArrayIndexOutOfBoundsException aioobe)
- {
- String msg = "While writing data elements" +
- ", x="+x+", y="+y+
- ", width="+width+", height="+height+
- ", scanlineStride="+scanlineStride+
- ", offset="+offset+
- ", data.getSize()="+data.getSize()+
- ", data.getOffset()="+data.getOffset()+
- ": " +
- aioobe;
- throw new ArrayIndexOutOfBoundsException(msg);
- }
- }
-
- public void setPixel(int x, int y, int[] iArray, DataBuffer data)
- {
- int offset = scanlineStride*y + x;
-
- int samples = 0;
- for (int b=0; bobj
.
- * @param w The width of the pixel rectangle in obj
.
- * @param h The height of the pixel rectangle in obj
.
- * @param iArray The primitive array containing the pixels to set.
- * @param data The DataBuffer to store the pixels into.
- * @see java.awt.image.SampleModel#setPixels(int, int, int, int, int[], java.awt.image.DataBuffer)
- */
- public void setPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
- {
- int inOffset = 0;
- int[] pixel = new int[numBands];
- for (int yy=y; yy<(y+h); yy++)
- {
- int offset = scanlineStride*yy + x;
- for (int xx=x; xx<(x+w); xx++)
- {
- int samples = 0;
- for (int b=0; bIMAGE_OK
if the image did not need to be
- * validated and didn't need to be restoredIMAGE_RESTORED
if the image may need to be
- * re-rendered.IMAGE_INCOMPATIBLE
if this image's
- * requirements are not fulfilled by the graphics configuration
- * parameter. This implies that you need to create a new
- * VolatileImage for the different GraphicsConfiguration or
- * Component. This return value implies nothing about whether the
- * image is valid or needs to be re-rendered.Book
that is empty.
- */
- public Book()
- {
- }
-
- /**
- * Returns the number of pages in this book.
- *
- * @return The number of pages in this book.
- */
- public int getNumberOfPages()
- {
- return printables.size();
- }
-
- /**
- * This method returns the PageFormat
object for the
- * specified page.
- *
- * @param page_number The number of the page to get information for, where
- * page numbers start at 0.
- *
- * @return The PageFormat
object for the specified page.
- *
- * @exception IndexOutOfBoundsException If the page number is not valid.
- */
- public PageFormat getPageFormat(int page_number)
- {
- return (PageFormat) page_formats.elementAt(page_number);
- }
-
- /**
- * This method returns the Printable
object for the
- * specified page.
- *
- * @param page_number The number of the page to get information for, where
- * page numbers start at 0.
- *
- * @return The Printable
object for the specified page.
- *
- * @exception IndexOutOfBoundsException If the page number is not valid.
- */
- public Printable getPrintable(int page_number)
- {
- return (Printable) printables.elementAt(page_number);
- }
-
- /**
- * This method appends a page to the end of the book.
- *
- * @param printable The Printable
for this page.
- * @param page_format The PageFormat
for this page.
- *
- * @exception NullPointerException If either argument is null
.
- */
- public void append(Printable printable, PageFormat page_format)
- {
- append(printable, page_format, 1);
- }
-
- /**
- * This method appends the specified number of pages to the end of the book.
- * Each one will be associated with the specified Printable
- * and PageFormat
.
- *
- * @param printable The Printable
for this page.
- * @param page_format The PageFormat
for this page.
- * @param num_pages The number of pages to append.
- *
- * @exception NullPointerException If any argument is null
.
- */
- public void append(Printable printable, PageFormat page_format, int num_pages)
- {
- for (int i = 0; i < num_pages; i++)
- {
- printables.addElement(printable);
- page_formats.addElement(page_format);
- }
- }
-
- /**
- * This method changes the Printable
and PageFormat
- * for the specified page. The page must already exist or an exception
- * will be thrown.
- *
- * @param page_num The page number to alter.
- * @param printable The new Printable
for the page.
- * @param page_format The new PageFormat
for the page.
- *
- * @throws IndexOutOfBoundsException If the specified page does not exist.
- */
- public void setPage(int page_num, Printable printable, PageFormat page_format)
- {
- printables.setElementAt(printable, page_num);
- page_formats.setElementAt(page_format, page_num);
- }
-}
diff --git a/libjava/java/awt/print/PageFormat.java b/libjava/java/awt/print/PageFormat.java
deleted file mode 100644
index 6399552de44..00000000000
--- a/libjava/java/awt/print/PageFormat.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/* PageFormat.java -- Information about the page format
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-/**
- * This class contains information about the desired page format to
- * use for printing a particular set of pages.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class PageFormat implements Cloneable
-{
-
-/*
- * Static Variables
- */
-
-/**
- * A constant for a landscaped page orientation. Used by
- * getOrientation
and setOrientation
.
- */
-public static final int LANDSCAPE = 0;
-
-/**
- * A constant for a portrait page orientation. Used by
- * getOrientation
and setOrientation
.
- */
-public static final int PORTRAIT = 1;
-
-/**
- * A constant for a reversed landscaped page orientation. This is
- * the orientation used by Macintosh's for landscape. The origin is
- * in the upper right hand corner instead of the upper left. The
- * X and Y axes are reversed. Used by getOrientation
and
- * setOrientation
.
- */
-public static final int REVERSE_LANDSCAPE = 2;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-// The page orientation
-private int orientation;
-
-// The paper type
-private Paper paper;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * This method creates a default page layout, which will be in portrait
- * format.
- */
-public
-PageFormat()
-{
- this.paper = new Paper();
- this.orientation = PORTRAIT;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * This method returns the width of the page, in 1/72nd's of an inch. The
- * "width" measured depends on orientation.
- *
- * @return The width of the page.
- */
-public double
-getWidth()
-{
- return(paper.getWidth());
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the height of the page, in 1/72nd's of an inch.
- * The "height" measured depends on the orientation.
- *
- * @return The height of the page.
- */
-public double
-getHeight()
-{
- return(paper.getHeight());
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the X coordinate value of the upper leftmost
- * drawable area of the paper.
- *
- * @return The upper leftmost imageable X coordinate.
- */
-public double
-getImageableX()
-{
- return(paper.getImageableX());
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the Y coordinate value of the upper leftmost
- * drawable area of the paper.
- *
- * @return The upper leftmost imageable Y coordinate.
- */
-public double
-getImageableY()
-{
- return(paper.getImageableY());
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the imageable width of the paper, in 1/72nd's of
- * an inch.
- *
- * @return The imageable width of the paper.
- */
-public double
-getImageableWidth()
-{
- return(paper.getImageableWidth());
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the imageable height of the paper, in 1/72nd's of
- * an inch.
- *
- * @return The imageable height of the paper.
- */
-public double getImageableHeight()
-{
- return(paper.getImageableHeight());
-}
-
-/*************************************************************************/
-
-/**
- * Returns a copy of the paper
object being used for this
- * page format.
- *
- * @return A copy of the Paper
object for this format.
- */
-public Paper
-getPaper()
-{
- return((Paper)paper.clone());
-}
-
-/*************************************************************************/
-
-/**
- * Sets the Paper
object to be used by this page format.
- *
- * @param paper The new Paper
object for this page format.
- */
-public void
-setPaper(Paper paper)
-{
- this.paper = paper;
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the current page orientation. The value returned
- * will be one of the page orientation constants from this class.
- *
- * @return The current page orientation.
- */
-public int
-getOrientation()
-{
- return(orientation);
-}
-
-/*************************************************************************/
-
-/**
- * This method sets the page orientation for this format to the
- * specified value. It must be one of the page orientation constants
- * from this class or an exception will be thrown.
- *
- * @param orientation The new page orientation.
- *
- * @exception IllegalArgumentException If the specified page orientation
- * value is not one of the constants from this class.
- */
-public void
-setOrientation(int orientation) throws IllegalArgumentException
-{
- if ((orientation != PORTRAIT) &&
- (orientation != LANDSCAPE) &&
- (orientation != REVERSE_LANDSCAPE))
- throw new IllegalArgumentException("Bad page orientation value: " +
- orientation);
-
- this.orientation = orientation;
-}
-
-/*************************************************************************/
-
-/**
- * This method returns a matrix used for transforming user space
- * coordinates to page coordinates. The value returned will be six
- * doubles as described in java.awt.geom.AffineTransform
.
- *
- * @return The transformation matrix for this page format.
- */
-public double[]
-getMatrix()
-{
- throw new RuntimeException("Not implemented since I don't know what to do");
-}
-
-/*************************************************************************/
-
-/**
- * This method returns a copy of this object.
- *
- * @return A copy of this object.
- */
-public Object
-clone()
-{
- try
- {
- return(super.clone());
- }
- catch(CloneNotSupportedException e)
- {
- return(null);
- }
-}
-
-} // class PageFormat
-
diff --git a/libjava/java/awt/print/Pageable.java b/libjava/java/awt/print/Pageable.java
deleted file mode 100644
index 12fa542a8c6..00000000000
--- a/libjava/java/awt/print/Pageable.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Pageable.java -- Pages to be printed
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-/**
- * This interface represents pages that are to be printed.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public interface Pageable
-{
-
-/*
- * Static Variables
- */
-
-/**
- * This constant is returned when getNumberOfPages()
- * cannot determine the number of pages available for printing.
- */
-int UNKNOWN_NUMBER_OF_PAGES = -1;
-
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * This method returns the number of pages this object contains, or
- * UNKNOWN_NUMBER_OF_PAGES
if it cannot determine the number
- * of pages to be printed.
- *
- * @return The number of pages to be printed, or
- * UNKNOWN_NUMBER_OF_PAGES
if this is unknown.
- */
-int
-getNumberOfPages();
-
-/*************************************************************************/
-
-/**
- * This method returns the PageFormat
instance for the
- * specified page. Page numbers start at zero. An exception is thrown if
- * the requested page does not exist.
- *
- * @param pageIndex The index of the page to return the
- * PageFormat
for.
- *
- * @return The PageFormat
for the requested page.
- *
- * @exception IndexOutOfBoundsException If the requested page number does
- * not exist.
- */
-PageFormat
-getPageFormat(int pageIndex) throws IndexOutOfBoundsException;
-
-/*************************************************************************/
-
-/**
- * This method returns the Printable
instance for the
- * specified page. Page numbers start at zero. An exception is thrown if
- * the requested page does not exist.
- *
- * @param pageIndex The index of the page to return the
- * Printable
for.
- *
- * @return The Printable
for the requested page.
- *
- * @exception IndexOutOfBoundsException If the requested page number does
- * not exist.
- */
-Printable
-getPrintable(int pageIndex) throws IndexOutOfBoundsException;
-
-} // interface Pageable
-
diff --git a/libjava/java/awt/print/Paper.java b/libjava/java/awt/print/Paper.java
deleted file mode 100644
index 4579da3ea3c..00000000000
--- a/libjava/java/awt/print/Paper.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Paper.java -- Information about a paper type.
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-/**
- * This class describes a particular type of paper.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Paper implements Cloneable
-{
-
-/*
- * Instance Variables
- */
-
-// Height of the paper
-private double height;
-
-// Width of the paper
-private double width;
-
-// Upper left imageable X coordinate
-private double imageableX;
-
-// Upper left imageable Y coordinate
-private double imageableY;
-
-// Imageable width of the page
-private double imageableWidth;
-
-// Imageable height of the page
-private double imageableHeight;
-
-/*************************************************************************/
-
-/*
- * Constructor
- */
-
-/**
- * This method creates a letter sized paper with one inch margins
- */
-public
-Paper()
-{
- width = 8.5 * 72;
- height = 11 * 72;
- imageableX = 72;
- imageableY = 72;
- imageableWidth = width - (2 * 72);
- imageableHeight = height - (2 * 72);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the height of the paper in 1/72nds of an inch.
- *
- * @return The height of the paper in 1/72nds of an inch.
- */
-public double
-getHeight()
-{
- return(height);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the width of the paper in 1/72nds of an inch.
- *
- * @return The width of the paper in 1/72nds of an inch.
- */
-public double
-getWidth()
-{
- return(width);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the X coordinate of the upper left hand corner
- * of the imageable area of the paper.
- *
- * @return The X coordinate of the upper left hand corner of the imageable
- * area of the paper.
- */
-public double
-getImageableX()
-{
- return(imageableX);
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the Y coordinate of the upper left hand corner
- * of the imageable area of the paper.
- *
- * @return The Y coordinate of the upper left hand corner of the imageable
- * area of the paper.
- */
-public double
-getImageableY()
-{
- return(imageableY);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the width of the imageable area of the paper.
- *
- * @return The width of the imageable area of the paper.
- */
-public double
-getImageableWidth()
-{
- return(imageableWidth);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the height of the imageable area of the paper.
- *
- * @return The height of the imageable area of the paper.
- */
-public double
-getImageableHeight()
-{
- return(imageableHeight);
-}
-
-/*************************************************************************/
-
-/**
- * This method sets the size of the paper to the specified width and
- * height, which are specified in 1/72nds of an inch.
- *
- * @param width The width of the paper in 1/72nds of an inch.
- * @param height The height of the paper in 1/72nds of an inch.
- */
-public void
-setSize(double width, double height)
-{
- this.width = width;
- this.height = height;
-}
-
-/*************************************************************************/
-
-/**
- * This method sets the imageable area of the paper by specifying the
- * coordinates of the upper left hand corner of that area, and its
- * length and height. All values are in 1/72nds of an inch.
- *
- * @param imageableX The X coordinate of the upper left hand corner of
- * the imageable area, in 1/72nds of an inch.
- * @param imageableY The Y coordinate of the upper left hand corner of
- * the imageable area, in 1/72nds of an inch.
- * @param imageableWidth The width of the imageable area of the paper,
- * in 1/72nds of an inch.
- * @param imageableHeight The heigth of the imageable area of the paper,
- * in 1/72nds of an inch.
- */
-public void
-setImageableArea(double imageableX, double imageableY,
- double imageableWidth, double imageableHeight)
-{
- this.imageableX = imageableX;
- this.imageableY = imageableY;
- this.imageableWidth = imageableWidth;
- this.imageableHeight = imageableHeight;
-}
-
-/*************************************************************************/
-
-/**
- * This method creates a copy of this object.
- *
- * @return A copy of this object.
- */
-public Object
-clone()
-{
- try
- {
- return(super.clone());
- }
- catch(CloneNotSupportedException e)
- {
- return(null);
- }
-}
-
-} // class Paper
-
diff --git a/libjava/java/awt/print/Printable.java b/libjava/java/awt/print/Printable.java
deleted file mode 100644
index 775167e669d..00000000000
--- a/libjava/java/awt/print/Printable.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Printable.java -- Renders a page to the print device
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.awt.print;
-
-import java.awt.Graphics;
-
-
-/**
- * This interface provides a mechanism for the actual printing of pages to the
- * printer. The object implementing this interface performs the page
- * rendering.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public interface Printable
-{
- /**
- * This value is returned by the print()
method to indicate
- * that the requested page exists and has been printed.
- */
- int PAGE_EXISTS = 0;
-
- /**
- * This value is returned by the print()
method to indicate
- * that the requested page number does not exist.
- */
- int NO_SUCH_PAGE = 1;
-
- /**
- * This method prints the specified page to the specified graphics
- * context in the specified format. The pages are numbered starting
- * from zero.
- *
- * @param graphics The graphics context to render the pages on.
- * @param format The format in which to print the page.
- * @param page_number The page number to print, where numbers start at zero.
- *
- * @return PAGE_EXISTS
if the requested page exists and was
- * successfully printed, NO_SUCH_PAGE
otherwise.
- *
- * @exception PrinterException If an error occurs during printing.
- */
- int print(Graphics graphics, PageFormat format, int page_number)
- throws PrinterException;
-}
diff --git a/libjava/java/awt/print/PrinterAbortException.java b/libjava/java/awt/print/PrinterAbortException.java
deleted file mode 100644
index 4580630790d..00000000000
--- a/libjava/java/awt/print/PrinterAbortException.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* PrinterAbortException.java -- Indicates the print job was aborted
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-/**
- * This exception is thrown when the print job is aborted, either by the
- * user or by the application.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @status updated to 1.4
- */
-public class PrinterAbortException extends PrinterException
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 4725169026278854136L;
-
- /**
- * Create a new instance with no detailed error message.
- */
- public PrinterAbortException()
- {
- }
-
- /**
- * Create a new instance with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public PrinterAbortException(String message)
- {
- super(message);
- }
-} // class PrinterAbortException
diff --git a/libjava/java/awt/print/PrinterException.java b/libjava/java/awt/print/PrinterException.java
deleted file mode 100644
index c105f549de4..00000000000
--- a/libjava/java/awt/print/PrinterException.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* PrinterException.java -- generic problem in the printing subsystem
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-/**
- * This is the generic toplevel exception for printing errors. Subclasses
- * provide more detailed descriptions of the problem.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @status updated to 1.4
- */
-public class PrinterException extends Exception
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -3757589981158265819L;
-
- /**
- * Create a new instance with no detailed error message.
- */
- public PrinterException()
- {
- }
-
- /**
- * Create a new instance with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public PrinterException(String message)
- {
- super(message);
- }
-} // class PrinterException
diff --git a/libjava/java/awt/print/PrinterGraphics.java b/libjava/java/awt/print/PrinterGraphics.java
deleted file mode 100644
index 5ca64190424..00000000000
--- a/libjava/java/awt/print/PrinterGraphics.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* PrinterGraphics.java -- Hook to return print job controller.
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-/**
- * This interface is implemented by the Graphics
instance
- * that is used for rendering pages. It provides a hook to return the
- * object that is controlling the print job.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public interface PrinterGraphics
-{
-
-/**
- * This method returns the instance of PrinterJob
that is
- * controlling this print job.
- *
- * @return The PrinterJob
that is controlling this print job.
- */
-PrinterJob
-getPrinterJob();
-
-} // interface PrinterGraphics
-
diff --git a/libjava/java/awt/print/PrinterIOException.java b/libjava/java/awt/print/PrinterIOException.java
deleted file mode 100644
index c646acdec3a..00000000000
--- a/libjava/java/awt/print/PrinterIOException.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* PrinterIOException.java -- The print job encountered an I/O error
- Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-import java.io.IOException;
-
-/**
- * This exception is thrown when the print job encounters an I/O problem
- * of some kind.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @status updated to 1.4
- */
-public class PrinterIOException extends PrinterException
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 5850870712125932846L;
-
- /**
- * The exception that caused this (duplicates Throwable).
- *
- * @serial the I/O exception that terminated the job
- */
- private final IOException mException;
-
- /**
- * Initializes a new instance with the given cause.
- *
- * @param mException the cause
- */
- public PrinterIOException(IOException mException)
- {
- super(mException == null ? null : mException.toString());
- initCause(mException);
- this.mException = mException;
- }
-
- /**
- * Gets the underlying IOException
that caused this exception.
- * This legacy method has been replaced by {@link #getCause()}.
- *
- * @return the cause
- */
- public IOException getIOException()
- {
- return mException;
- }
-
- /**
- * Gets the cause.
- *
- * @return the cause
- */
- public Throwable getCause()
- {
- return mException;
- }
-} // class PrinterIOException
-
diff --git a/libjava/java/awt/print/PrinterJob.java b/libjava/java/awt/print/PrinterJob.java
deleted file mode 100644
index e61ab61bc77..00000000000
--- a/libjava/java/awt/print/PrinterJob.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/* PrinterJob.java -- This job is the printer control class
- Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.awt.print;
-
-import java.awt.HeadlessException;
-
-import javax.print.PrintService;
-import javax.print.attribute.PrintRequestAttributeSet;
-
-/**
- * This class controls printing.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public abstract class PrinterJob
-{
- // The print service associated with this job
- private PrintService printer = null;
-
- /**
- * Creates a new print job.
- *
- * @return A PrinterJob
object for the newly created print job.
- */
- public static PrinterJob getPrinterJob()
- {
- // FIXME: Need to fix this to load a default implementation instance.
- return null;
- }
-
- /**
- * Initializes a new instance of PrinterJob
.
- */
- public PrinterJob()
- {
- }
-
- /**
- * Returns the number of copies to be printed.
- *
- * @return The number of copies to be printed.
- */
- public abstract int getCopies();
-
- /**
- * Sets the number of copies to be printed.
- *
- * @param copies The number of copies to be printed.
- */
- public abstract void setCopies(int copies);
-
- /**
- * Returns the name of the print job.
- *
- * @return The name of the print job.
- */
- public abstract String getJobName();
-
- /**
- * Sets the name of the print job.
- *
- * @param job_name The name of the print job.
- */
- public abstract void setJobName(String job_name);
-
- /**
- * Returns the printing user name.
- *
- * @return The printing username.
- */
- public abstract String getUserName();
-
- /**
- * Cancels an in progress print job.
- */
- public abstract void cancel();
-
- /**
- * Tests whether or not this job has been cancelled.
- *
- * @return true
if this job has been cancelled, false
- * otherwise.
- */
- public abstract boolean isCancelled();
-
- /**
- * Returns an instance of the default page which will have the default
- * paper and orientation.
- *
- * @return A default instance of PageFormat
.
- */
- public PageFormat defaultPage()
- {
- return new PageFormat();
- }
-
- /**
- * Clones the specified PageFormat
object then alters the
- * clone so that it represents the default page format.
- *
- * @param page_format The PageFormat
to clone.
- *
- * @return A new default page format.
- */
- public abstract PageFormat defaultPage(PageFormat page_format);
-
- /**
- * Displays a dialog box to the user which allows the page format
- * attributes to be modified.
- *
- * @param page_format The PageFormat
object to modify.
- *
- * @return The modified PageFormat
.
- */
- public abstract PageFormat pageDialog(PageFormat page_format)
- throws HeadlessException;
-
- /**
- * @since 1.4
- */
- public PageFormat pageDialog(PrintRequestAttributeSet attributes)
- throws HeadlessException
- {
- // FIXME: Implement this for real.
- return pageDialog((PageFormat) null);
- }
-
- /**
- * Prints the pages.
- */
- public abstract void print () throws PrinterException;
-
- /**
- * Prints the page with given attributes.
- */
- public abstract void print (PrintRequestAttributeSet attributes)
- throws PrinterException;
-
- /**
- * Displays a dialog box to the user which allows the print job
- * attributes to be modified.
- *
- * @return false
if the user cancels the dialog box,
- * true
otherwise.
- */
- public abstract boolean printDialog()
- throws HeadlessException;
-
- /**
- * Displays a dialog box to the user which allows the print job
- * attributes to be modified.
- *
- * @return false
if the user cancels the dialog box,
- * true
otherwise.
- */
- public boolean printDialog(PrintRequestAttributeSet attributes)
- throws HeadlessException
- {
- // FIXME: Implement this for real.
- return printDialog();
- }
-
- /**
- * This sets the pages that are to be printed.
- *
- * @param pageable The pages to be printed, which may not be null
.
- */
- public abstract void setPageable(Pageable pageable);
-
- /**
- * Sets this specified Printable
as the one to use for
- * rendering the pages on the print device.
- *
- * @param printable The Printable
for the print job.
- */
- public abstract void setPrintable(Printable printable);
-
- /**
- * Sets the Printable
and the page format for the pages
- * to be printed.
- *
- * @param printable The Printable
for the print job.
- * @param page_format The PageFormat
for the print job.
- */
- public abstract void setPrintable(Printable printable, PageFormat page_format);
-
- /**
- * Makes any alterations to the specified PageFormat
- * necessary to make it work with the current printer. The alterations
- * are made to a clone of the input object, which is then returned.
- *
- * @param page_format The PageFormat
to validate.
- *
- * @return The validated PageFormat
.
- */
- public abstract PageFormat validatePage(PageFormat page_format);
-
- /**
- * Find and return 2D image print services.
- *
- * This is the same as calling PrintServiceLookup.lookupPrintServices()
- * with Pageable service-specified DocFlavor.
- * @return Array of PrintService objects, could be empty.
- * @since 1.4
- */
- public static PrintService[] lookupPrintServices()
- {
- return new PrintService[0];
- // FIXME:
- // Enable this when javax.print has this implemented.
-// return PrintServiceLookup.lookupPrintServices(
-// new DocFlavor("application/x-java-jvm-local-objectref",
-// "java.awt.print.Pageable"),
-// null);
- }
-
- /**
- * Find and return 2D image stream print services.
- *
- * This is the same as calling
- * StreamPrintServiceFactory.lookupStreamPrintServices()
- * with Pageable service-specified DocFlavor.
- * @param mimeType The output format mime type, or null for any type.
- * @return Array of stream print services, could be empty.
- * @since 1.4
- */
- // FIXME:
- // Enable when javax.print has StreamPrintServiceFactory
-// public static StreamPrintServiceFactory[] lookupStreamPrintServices(String mimeType)
-// {
-// return StreamPrintServiceFactory.lookupStreamServiceFactories(
-// new DocFlavor("application/x-java-jvm-local-objectref",
-// "java.awt.print.Pageable"),
-// mimeType);
-// }
-
- /**
- * Return the printer for this job. If print services aren't supported by
- * the subclass, returns null.
- *
- * @return The associated PrintService.
- * @since 1.4
- */
- public PrintService getPrintService()
- {
- return null;
- }
-
- /**
- * Change the printer for this print job to service. Subclasses that
- * support setting the print service override this method. Throws
- * PrinterException when the class doesn't support setting the printer,
- * the service doesn't support Pageable or Printable interfaces for 2D
- * print output.
- * @param service The new printer to use.
- * @throws PrinterException if service is not valid.
- */
- public void setPrintService(PrintService service)
- throws PrinterException
- {
- throw new PrinterException();
- }
-}
diff --git a/libjava/java/beans/AppletInitializer.java b/libjava/java/beans/AppletInitializer.java
deleted file mode 100644
index 69dc2cae50e..00000000000
--- a/libjava/java/beans/AppletInitializer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* java.beans.AppletInitializer
- Copyright (C) 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.beans;
-
-import java.applet.Applet;
-import java.beans.beancontext.BeanContext;
-
-
-/** This interface is a mechanism for the initialization of a Java
- * Bean that is also an Applet. It is used by
- * Beans.instantiate()
.
- *
- * @author Tom Tromey (tromey@redhat.com)
- * @since 1.2
- */
-public interface AppletInitializer
-{
- /** Activate the applet. */
- void activate (Applet applet);
-
- /** This method will be called by Beans.instantiate()
- * to associated the new Applet with its AppletContext, AppletStub,
- * and Container.
- */
- void initialize (Applet applet, BeanContext context);
-}
diff --git a/libjava/java/beans/BeanDescriptor.java b/libjava/java/beans/BeanDescriptor.java
deleted file mode 100644
index 21227b2fee0..00000000000
--- a/libjava/java/beans/BeanDescriptor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* java.beans.BeanDescriptor
- Copyright (C) 1998, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-/**
- ** BeanDescriptor describes general information about a Bean, plus
- ** stores the Bean's Class and it's customizer's Class.<Bean Class Name>BeanInfo
and place it in
- ** the same package as the Bean, or in the bean info search path
- ** (see Introspector for information on search paths).null
if the
- ** events are to be acquired by Introspection.
- **/
- EventSetDescriptor[] getEventSetDescriptors();
-
- /** Get the "default" event, basically the one a RAD tool
- ** user is most likely to select.
- ** @return the index into the getEventSetDescriptors()
- ** that the user is most likely to use. Returns
- ** -1
if there is no default event.
- **/
- int getDefaultEventIndex();
-
- /** Get the properties (get/set method pairs) this Bean
- ** type supports.
- ** @return the PropertyDescriptors representing the
- ** properties this Bean type supports.
- ** Returns null
if the properties
- ** are to be obtained by Introspection.
- **/
- PropertyDescriptor[] getPropertyDescriptors();
-
- /** Get the "default" property, basically the one a RAD
- ** tool user is most likely to select.
- ** @return the index into the getPropertyDescriptors()
- ** that the user is most likely to use. Returns
- ** -1
if there is no default event.
- **/
- int getDefaultPropertyIndex();
-
- /** Get the methods this Bean type supports.
- ** @return the MethodDescriptors representing the
- ** methods this Bean type supports. Returns
- ** null
if the methods are to be
- ** obtained by Introspection.
- **/
- MethodDescriptor[] getMethodDescriptors();
-
- /** Get additional BeanInfos representing this Bean.
- ** In this version of JavaBeans, this method is used so
- ** that space and time can be saved by reading a BeanInfo
- ** for each class in the hierarchy (super, super(super),
- ** and so on).
- **
getAdditionalBeanInfo()[getAdditionalBeanInfo().length]
getAdditionalBeanInfo()[1]
getAdditionalBeanInfo()[0]
null
from this method could
- ** stop Introspection in its tracks, but it is unclear
- ** from the spec whether this is the case.
- **
- ** @return additional BeanInfos representing this Bean.
- ** null
may be returned (see Spec
- ** Note, above).
- **/
- BeanInfo[] getAdditionalBeanInfo();
-
- /** Get a visual icon for this Bean.
- ** A Bean does not have to support icons, and if it does
- ** support icons, it does not have to support every single
- ** type. Sun recommends that if you only support one
- ** type, you support 16x16 color. Sun also notes that you
- ** should try to use a type (like GIF) that allows for
- ** transparent pixels, so that the background of the RAD
- ** tool can show through.Beans
provides some helper methods that allow the basic
- * operations of Bean-ness.
- *
- * @author John Keiser
- * @author Robert Schuster
- *
- * @since 1.1
- * @status updated to 1.4
- *
- */
-public class Beans
-{
- static boolean designTime = false;
- static boolean guiAvailable = true;
-
- /**
- * Once again, we have a java.beans class with only
- * static methods that can be instantiated. When
- * will the madness end? :)
- */
- public Beans()
- {
- // Does intentionally nothing here.
- }
-
- /** Creates a bean.
- * instantiate(cl, beanName, null, null)
.null
for the system classloader.
- * @param beanName Name of a serialized bean or class name.
- * @return A newly created bean.
- * @throws IOException If access of an IO resource failed.
- * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
- */
- public static Object instantiate(ClassLoader cl, String beanName)
- throws IOException, ClassNotFoundException
- {
- return instantiate(cl, beanName, null, null);
- }
-
- /** Creates a bean.
- *
- * instantiate(cl, beanName, beanContext, null)
.null
for the system classloader.
- * @param beanName Name of a serialized bean or class name.
- * @param beanContext Context to which the newly created Bean should be added.
- * @return A newly created bean.
- * @throws IOException If access of an IO resource failed.
- * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
- */
- public static Object instantiate(
- ClassLoader cl,
- String beanName,
- BeanContext beanContext)
- throws IOException, ClassNotFoundException
- {
- return instantiate(cl, beanName, beanContext, null);
- }
-
- /** Instantiates a bean according to Beans 1.0.
- *
- * ClassLoader
was provided.BeanContext
instance is available the created bean is added to it.Applet
or subclass and an AppletInitializer
- * instance is available the applet is initialized and afterwards activated using the initializer. Additionally
- * every instantiated Applet
bean is initialized using the {@link Applet.init} method.
- * Furthermore every applet gets a default AppletStub
. The Applet
's
- * document base is the location of the ".ser" file if it was deserialized or the location of its class
- * file if it was instantiated.ClassNotFoundException
is not only thrown when a class name was unknown
- * but even when the class has public no-argument constructor
- * (IllegalAccessException
is wrapped) or an exception is thrown while
- * invoking such a constructor (causing exception is wrapped).null
for the system classloader.
- * @param beanName Name of a serialized bean or class name.
- * @param beanContext Context to which the newly created Bean should be added.
- * @param initializer The AppletInitializer which is used for initializing Applet
beans.
- * @return A newly created bean.
- * @throws IOException If access of an IO resource failed.
- * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
- */
- public static Object instantiate(
- ClassLoader cl,
- String beanName,
- BeanContext beanContext,
- AppletInitializer initializer)
- throws IOException, ClassNotFoundException
- {
- Object bean = null;
- URL beanLocation = null;
- URL classLocation = null;
-
- // Converts bean name into a resource name (eg. "a.b.c" -> "a/b/c").
- String resourceName = beanName.replace('.', '/');
-
- /* Tries to get an input stream of the Bean, reading it as a system resource
- * if no ClassLoader is present or as an application resource if a classloader
- * is given.
- */
- beanLocation =
- (cl == null)
- ? ClassLoader.getSystemResource(resourceName + ".ser")
- : cl.getResource(resourceName + ".ser");
-
- // Reads the serialized Bean from the returned URL.
- if (beanLocation != null)
- {
- // Deserializes the bean instance.
- ObjectInputStream ois =
- (cl == null)
- ? new ObjectInputStream(beanLocation.openStream())
- : new ClassLoaderObjectInputStream(
- beanLocation.openStream(),
- cl);
-
- bean = ois.readObject();
-
- /* Implementation note: The result of ObjectInputStream.readObject()
- * may have been null at this point (its a valid value to deserialize)
- * and we explicitly want to try instantiation in such a case
- * (this is important for compatibility).
- */
- }
-
- // Instantiates the Bean using reflective instantiation if it has not been created yet.
- if (bean == null)
- {
- // Makes sure that the deserialization was NOT done.
- beanLocation = null;
-
- Class beanClass;
- if (cl == null)
- {
- beanClass = Class.forName(beanName);
- classLocation =
- ClassLoader.getSystemResource(resourceName + ".class");
- }
- else
- {
- beanClass = cl.loadClass(beanName);
- classLocation = cl.getResource(resourceName + ".class");
- }
-
- // Instantiates and optionally registers the new bean.
- try
- {
- bean = beanClass.newInstance();
- }
- catch(Exception e) {
- /* Wraps all kinds of Exceptions in a ClassNotFoundException (this behavior
- * matches with official >= 1.5, this was different for <=1.4)
- */
- throw new ClassNotFoundException(null, e);
- }
- }
-
- /* Applet beans are treated in the following way:
- * - all AppletS get a default AppletStub
- * - all AppletS are initialized using the AppletInitializer instance (if it is available)
- * - as every other Bean Applets are added to a BeanContext if one is available
- * - each instantiated Applet is initialized using Applet.init() (this is not done for deserialized ones)
- * - finally AppletS get activated using the AppletInitializerS activate-Method
- *
- * The order of operations is important for compatibility.
- */
- Applet applet = null;
- if (bean instanceof Applet)
- {
- // Makes a second instanceof call unneccessary (instanceof is expensive).
- applet = (Applet) bean;
-
- /* The AppletStub's code and document base is set as follows:
- * The code base is always the URL from where the class data originated
- * (without the package name).
- * If the Applet was deserialized the document base is the location of
- * the serialized instance (usually the ".ser" file) otherwise its the URL
- * from where the class data originated (usually the absolute directory
- * location of the ".class" file).
- */
- applet.setStub(
- new DummyAppletStub(
- applet
- .getClass()
- .getProtectionDomain()
- .getCodeSource()
- .getLocation(),
- (beanLocation == null) ? classLocation : beanLocation));
-
- // Runs the Applet's initialization using an AppletInitializer.
- if (initializer != null)
- {
- initializer.initialize(applet, beanContext);
- }
- }
-
- // Adds the new bean to its BeanContext.
- if (beanContext != null)
- {
- beanContext.add(bean);
- }
-
- if (applet != null)
- {
-
- // Initializes an instantiated (not deserialized) Applet using its own method.
- if (beanLocation == null)
- {
- applet.init();
- }
-
- // Runs the Applet's activation using an AppletInitializer.
- if (initializer != null)
- {
- initializer.activate(applet);
- }
- }
-
- return bean;
- }
-
- /**
- * Returns the Bean as a different class type.
- * This should be used instead of casting to get a new
- * type view of a Bean, because in the future there may
- * be new types of Bean, even Beans spanning multiple
- * Objects.
- *
- * @param bean the Bean to cast.
- * @param newClass the Class to cast it to.
- *
- * @return the Bean as a new view, or if the operation
- * could not be performed, the Bean itself.
- */
- public static Object getInstanceOf(Object bean, Class newClass)
- {
- return bean;
- }
-
- /**
- * Determines whether the Bean can be cast to a different
- * class type.
- * This should be used instead of instanceof to determine
- * a Bean's castability, because in the future there may
- * be new types of Bean, even Beans spanning multiple
- * Objects.
- *
- * @param bean the Bean to cast.
- * @param newClass the Class to cast it to.
- *
- * @return whether the Bean can be cast to the class type
- * in question.
- */
- public static boolean isInstanceOf(Object bean, Class newBeanClass)
- {
- return newBeanClass.isInstance(bean);
- }
-
- /**
- * Returns whether the GUI is available to use.
- * java.awt.Component
.BeanContextChild
implementors implement this to get information about whether they are in a design time or runtime environment.
- * The reason this is restricted to BeanContextChild
ren is that
- * only things in the BeanContext
hierarchy are given this
- * information in the first place.
- *
- * @author John Keiser
- * @since JDK1.2
- * @see java.beans.beancontext.BeanContextChild
- */
-
-public interface DesignMode {
- /**
- * Use this name when firing PropertyChangeEvent
s from your Bean.
- * @fixme Check whether PROPERTYNAME is set to same value as Sun.
- */
- String PROPERTYNAME = "designTime";
-
- /**
- * The environment will call this method on your
- * BeanContextChild
when it is registered in a parent
- * BeanContext
or when behavior needs to switch from
- * design time to runtime behavior (or vice versa).
- * BeanContext
s are required to fire
- * PropertyChangeEvent
s when properties change.
- * designTime
is a property, and therefore when you
- * implement setDesignTime()
, you need to fire a
- * PropertyChangeEvent
with the old value, the new
- * value and using PROPERTYNAME
as the property name.
- *
- * @param designTime the new value of design time,
- * true
if it is design time,
- * false
if it is runtime.
- *
- * @fixme I'm frankly not really sure whether it's the case that
- * the BeanContext can change the status of the Bean from
- * design time to runtime. But it appears that it may be so.
- *
- * @see java.util.PropertyChangeEvent
- * @see java.beans.beancontext.BeanContext
- * @see #PROPERTYNAME
- */
- void setDesignTime(boolean designTime);
-
- /**
- * This method should tell whether it is design time or runtime.
- * @return true
if design time, false
if
- * runtime.
- */
- boolean isDesignTime();
-}
diff --git a/libjava/java/beans/EventHandler.java b/libjava/java/beans/EventHandler.java
deleted file mode 100644
index 9c85893e0f3..00000000000
--- a/libjava/java/beans/EventHandler.java
+++ /dev/null
@@ -1,606 +0,0 @@
-/* java.beans.EventHandler
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-/**
- * create
you can create
- * these listener implementations.EventHandler
instance.
- *
- * NullPointerException
if the target
- * argument is null
.
- *
- * @param target Object that will perform the action.
- * @param action A property or method of the target.
- * @param eventPropertyName A readable property of the inbound event.
- * @param listenerMethodName The listener method name triggering the action.
- */
- public EventHandler(Object target, String action, String eventPropertyName,
- String listenerMethodName)
- {
- this.target = target;
-
- // Retrieving the class is done for two reasons:
- // 1) The class object is needed very frequently in the invoke() method.
- // 2) The constructor should throw a NullPointerException if target is null.
- targetClass = target.getClass();
-
- this.action = action; // Turn this into a method or do we wait till
- // runtime
- property = eventPropertyName;
- listenerMethod = listenerMethodName;
- }
-
- /**
- * Returns the event property name.
- */
- public String getEventPropertyName()
- {
- return property;
- }
-
- /**
- * Returns the listener's method name.
- */
- public String getListenerMethodName()
- {
- return listenerMethod;
- }
-
- /**
- * Returns the target object.
- */
- public Object getTarget()
- {
- return target;
- }
-
- /**
- * Returns the action method name.
- */
- public String getAction()
- {
- return action;
- }
-
- // Fetch a qualified property like a.b.c from object o. The properties can
- // be boolean isProp or object getProp properties.
- //
- // Returns a length 2 array with the first entry containing the value
- // extracted from the property, and the second entry contains the class of
- // the method return type.
- //
- // We play this game because if the method returns a native type, the return
- // value will be a wrapper. If we then take the type of the wrapper and use
- // it to locate the action method that takes the native type, it won't match.
- private Object[] getProperty(Object o, String prop)
- {
- // Isolate the first property name from a.b.c.
- int pos;
- String rest = null;
- if ((pos = prop.indexOf('.')) != -1)
- {
- rest = prop.substring(pos + 1);
- prop = prop.substring(0, pos);
- }
-
- // Find a method named getProp. It could be isProp instead.
- Method getter;
- try
- {
- // Look for boolean property getter isProperty
- getter = o.getClass().getMethod("is" + capitalize(prop),
- null);
- }
- catch (NoSuchMethodException nsme1)
- {
- try {
- // Look for regular property getter getProperty
- getter = o.getClass().getMethod("get" + capitalize(prop),
- null);
- } catch(NoSuchMethodException nsme2) {
- try {
- // Finally look for a method of the name prop
- getter = o.getClass().getMethod(prop, null);
- } catch(NoSuchMethodException nsme3) {
- // Ok, give up with an intelligent hint for the user.
- throw new RuntimeException("Method not called: Could not find a property or method '" + prop
- + "' in " + o.getClass() + " while following the property argument '" + property + "'.");
- }
- }
- }
- try {
- Object val = getter.invoke(o, null);
-
- if (rest != null)
- return getProperty(val, rest);
-
- return new Object[] {val, getter.getReturnType()};
- } catch(InvocationTargetException ite) {
- throw new RuntimeException("Method not called: Property or method '" + prop + "' has thrown an exception.", ite);
- } catch(IllegalAccessException iae) {
- // This cannot happen because we looked up method with Class.getMethod()
- // which returns public methods only.
- throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae);
- }
- }
-
- /**
- * Invokes the EventHandler
.
- *
- * NoSuchMethodException
is thrown when the EventHandler's
- * action method or property cannot be found.
- */
- public Object invoke(Object proxy, Method method, Object[] arguments)
- {
- try {
- // The method instance of the target object. We have to find out which
- // one we have to invoke.
- Method actionMethod = null;
-
- // Listener methods that weren't specified are ignored. If listenerMethod
- // is null, then all listener methods are processed.
- if (listenerMethod != null && !method.getName().equals(listenerMethod))
- return null;
-
- // If a property is defined we definitely need a valid object at
- // arguments[0] that can be used to retrieve a value to which the
- // property of the target gets set.
- if(property != null) {
- // Extracts the argument. We will let it fail with a NullPointerException
- // the caller used a listener method that has no arguments.
- Object event = arguments[0];
-
- // Obtains the property XXX propertyType keeps showing up null - why?
- // because the object inside getProperty changes, but the ref variable
- // can't change this way, dolt! need a better way to get both values out
- // - need method and object to do the invoke and get return type
- Object v[] = getProperty(event, property);
- Object[] args = new Object[] { v[0] };
-
- // Changes the class array that controls which method signature we are going
- // to look up in the target object.
- Class[] argTypes = new Class[] { initClass((Class) v[1]) };
-
- // Tries to find a setter method to which we can apply the
- while(argTypes[0] != null) {
- try
- {
- // Look for a property setter for action.
- actionMethod = targetClass.getMethod("set" + capitalize(action), argTypes);
-
- return actionMethod.invoke(target, args);
- }
- catch (NoSuchMethodException e)
- {
- // If action as property didn't work, try as method later.
- }
-
- argTypes[0] = nextClass(argTypes[0]);
- }
-
- // We could not find a suitable setter method. Now we try again interpreting
- // action as the method name itself.
- // Since we probably have changed the block local argTypes array
- // we need to rebuild it.
- argTypes = new Class[] { initClass((Class) v[1]) };
-
- // Tries to find a setter method to which we can apply the
- while(argTypes[0] != null) {
- try
- {
- actionMethod = targetClass.getMethod(action, argTypes);
-
- return actionMethod.invoke(target, args);
- }
- catch (NoSuchMethodException e)
- {
- }
-
- argTypes[0] = nextClass(argTypes[0]);
- }
-
- throw new RuntimeException("Method not called: Could not find a public method named '"
- + action + "' in target " + targetClass + " which takes a '"
- + v[1] + "' argument or a property of this type.");
- }
-
- // If property was null we will search for a no-argument method here.
- // Note: The ordering of method lookups is important because we want to prefer no-argument
- // calls like the JDK does. This means if we have actionMethod() and actionMethod(Event) we will
- // call the first *EVEN* if we have a valid argument for the second method. This is behavior compliant
- // to the JDK.
- // If actionMethod() is not available but there is a actionMethod(Event) we take this. That makes us
- // more specification compliant than the JDK itself because this one will fail in such a case.
- try
- {
- actionMethod = targetClass.getMethod(action, null);
- }
- catch(NoSuchMethodException nsme)
- {
- // Note: If we want to be really strict the specification says that a no-argument method should
- // accept an EventObject (or subclass I guess). However since the official implementation is broken
- // anyways, it's more flexible without the EventObject restriction and we are compatible on everything
- // else this can stay this way.
- if(arguments != null && arguments.length >= 1/* && arguments[0] instanceof EventObject*/) {
- Class[] targetArgTypes = new Class[] { initClass(arguments[0].getClass()) };
-
- while(targetArgTypes[0] != null) {
- try
- {
- // If no property exists we expect the first element of the arguments to be
- // an EventObject which is then applied to the target method.
-
- actionMethod = targetClass.getMethod(action, targetArgTypes);
-
- return actionMethod.invoke(target, new Object[] { arguments[0] });
- }
- catch(NoSuchMethodException nsme2)
- {
-
- }
-
- targetArgTypes[0] = nextClass(targetArgTypes[0]);
- }
-
- }
- }
-
- // If we do not have a Method instance at this point this means that all our tries
- // failed. The JDK throws an ArrayIndexOutOfBoundsException in this case.
- if(actionMethod == null)
- throw new ArrayIndexOutOfBoundsException(0);
-
- // Invoke target.action(property)
- return actionMethod.invoke(target, null);
- } catch(InvocationTargetException ite) {
- throw new RuntimeException(ite.getCause());
- } catch(IllegalAccessException iae) {
- // Cannot happen because we always use getMethod() which returns public
- // methods only. Otherwise there is something seriously broken in
- // GNU Classpath.
- throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae);
- }
- }
-
- /**
- * listenerInterface
- * to dispatch events.
- * button.addActionListener((ActionListener)
- * EventHandler.create(ActionListener.class, target, "dispose"));
- *
- *
- *
- * button.addActionListener(new ActionListener() {
- * public void actionPerformed(ActionEvent ae) {
- * target.dispose();
- * }
- * });
- *
- *
- * action
is interpreted as a method name. If your target object
- * has no no-argument method of the given name the EventHandler tries to find
- * a method with the same name but which can accept the first argument of the
- * listener method. Usually this will be an event object but any other object
- * will be forwarded, too. Keep in mind that using a property name instead of a
- * real method here is wrong and will throw an ArrayIndexOutOfBoundsException
- * whenever one of the listener methods is called.EventHandler
will automatically convert primitives
- * to their wrapper class and vice versa. Furthermore it will call
- * a target method if it accepts a superclass of the type of the
- * first argument of the listener method.RuntimeException
and thrown out
- * of the listener method.ArrayIndexOutOfBoundsException
will be thrown when the
- * listener method is invoked.create(listenerInterface, target, action, null, null)
listenerInterface
- * to dispatch events.eventPropertyName
to "prop"
- * to denote the retrieval of a property named "prop" from the event
- * object. In case that no such property exists the EventHandler
- * will try to find a method with that name.eventPropertyName
to a value like this "a.b.c"
- * EventHandler
will recursively evaluate the properties "a", "b"
- * and "c". Again if no property can be found the EventHandler
- * tries a method name instead. This allows mixing the names, too: "a.toString"
- * will retrieve the property "a" from the event object and will then call
- * the method "toString" on it.RuntimeException
to be thrown which contains an
- * InvocationTargetException
containing the triggering exception.eventPropertyName
to a non-null value the
- * action
parameter will be interpreted as a property name
- * or a method name of the target object.
- * button.addActionListener(
- * new ActionListener() {
- * public void actionPerformed(ActionEvent ae) {
- * Object o = ae.getSource().getClass().getName();
- * textField.setText((String) o);
- * }
- * });
- *
- *
- * EventHandler
like this:button.addActionListener((ActionListener)
- * EventHandler.create(ActionListener.class, textField, "text", "source.class.name");
- *
- *
button.addActionListener((ActionListener)
- * EventHandler.create(ActionListener.class, textField, "setText", "source.class.name");
- *
- *
button.addActionListener((ActionListener)
- * EventHandler.create(ActionListener.class, textField, "setText", "getSource.getClass.getName");
- *
- *
button.addActionListener((ActionListener)
- * EventHandler.create(ActionListener.class, textField, "setText", "source.getClass.name");
- *
- *
create(listenerInterface, target, action, null, null)
- * listenerInterface
- * to dispatch events.EventHandler
's
- * usage.dispose
on a JFrame
instance
- * when the WindowListener.windowClosing()
method was invoked use
- * the following code:
- * EventHandler.create(WindowListener.class, jframeInstance, "dispose", null, "windowClosing");
- *
- * NullPointerException
is thrown if the listenerInterface
- * or target
argument are null
.
- *
- * @param listenerInterface Listener interface to implement.
- * @param target Object to invoke action on.
- * @param action Target method name to invoke.
- * @param eventPropertyName Name of property to extract from event.
- * @param listenerMethodName Listener method to implement.
- * @return A constructed proxy object.
- */
- public static Object create(Class listenerInterface, Object target,
- String action, String eventPropertyName,
- String listenerMethodName)
- {
- // Create EventHandler instance
- EventHandler eh = new EventHandler(target, action, eventPropertyName,
- listenerMethodName);
-
- // Create proxy object passing in the event handler
- Object proxy = Proxy.newProxyInstance(listenerInterface.getClassLoader(),
- new Class[] {listenerInterface},
- eh);
-
- return proxy;
- }
-
-}
diff --git a/libjava/java/beans/EventSetDescriptor.java b/libjava/java/beans/EventSetDescriptor.java
deleted file mode 100644
index 8624e643476..00000000000
--- a/libjava/java/beans/EventSetDescriptor.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/* java.beans.EventSetDescriptor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import gnu.java.lang.ClassHelper;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Vector;
-
-/**
- ** EventSetDescriptor describes the hookup between an event source
- ** class and an event listener class.
- **
- ** EventSets have several attributes: the listener class, the events
- ** that can be fired to the listener (methods in the listener class), and
- ** an add and remove listener method from the event firer's class.
- **
- **
- ** A final constraint is that event listener classes must extend from EventListener.void
return value. Any
- ** parameters and exceptions are allowed. May be public, protected or
- ** package-protected. (Don't ask me why that is, I'm just following the spec.
- ** The only place it is even mentioned is in the Java Beans white paper, and
- ** there it is only implied.)void
return value. Must
- ** take exactly one argument, of the listener class's type. May fire either
- ** zero exceptions, or one exception of type java.util.TooManyListenersException
.
- ** Must be public.void
return value.
- ** Must take exactly one argument, of the listener class's type. May not
- ** fire any exceptions. Must be public.
- **
- ** @param eventSourceClass the class containing the add/remove listener methods.
- ** @param eventSetName the programmatic name of the event set, generally starting
- ** with a lowercase letter (i.e. fooManChu instead of FooManChu). This will be used
- ** to generate the name of the event object as well as the names of the add and
- ** remove methods.
- ** @param listenerType the class containing the event firing method.
- ** @param listenerMethodName the name of the event firing method.
- ** @exception IntrospectionException if listenerType is not an EventListener,
- ** or if methods are not found or are invalid.
- **/
- public EventSetDescriptor(Class eventSourceClass,
- String eventSetName,
- Class listenerType,
- String listenerMethodName) throws IntrospectionException {
- setName(eventSetName);
- if(!java.util.EventListener.class.isAssignableFrom(listenerType)) {
- throw new IntrospectionException("Listener type is not an EventListener.");
- }
-
- String[] names = new String[1];
- names[0] = listenerMethodName;
-
- try {
- eventSetName = Character.toUpperCase(eventSetName.charAt(0)) + eventSetName.substring(1);
- } catch(StringIndexOutOfBoundsException e) {
- eventSetName = "";
- }
-
- findMethods(eventSourceClass,listenerType,names,"add"+eventSetName+"Listener","remove"+eventSetName+"Listener",eventSetName+"Event");
- this.listenerType = listenerType;
- checkAddListenerUnicast();
- if(this.removeListenerMethod.getExceptionTypes().length > 0) {
- throw new IntrospectionException("Listener remove method throws exceptions.");
- }
- }
-
- /** Create a new EventSetDescriptor.
- ** This form of the constructor allows you to specify the names of the methods and adds
- ** no new constraints on top of the rules already described at the top of the class.void <listenerMethodName>(<eventSetName>Event)
- ** (where <eventSetName>
has its first character capitalized
- ** by the constructor and the Event is a descendant of
- ** java.util.EventObject
) in class listenerType
- ** (any exceptions may be thrown).
- ** Implementation note: Note that there could conceivably be multiple
- ** methods with this type of signature (example: java.util.MouseEvent vs.
- ** my.very.own.MouseEvent). In this implementation, all methods fitting the
- ** description will be put into the EventSetDescriptor
, even
- ** though the spec says only one should be chosen (they probably weren't thinking as
- ** pathologically as I was). I don't like arbitrarily choosing things.
- ** If your class has only one such signature, as most do, you'll have no problems.void add<eventSetName>Listener(<listenerType>)
and
- ** void remove<eventSetName>Listener(<listenerType>)
in
- ** in class eventSourceClass
, where
- ** <eventSetName>
will have its first letter capitalized.
- ** Standard exception rules (see class description) apply.getDisplayName
returns in case, that no short description
- * is available.
- */
- public String getShortDescription()
- {
- return (shortDescription == null) ? getDisplayName() : shortDescription;
- }
-
- /**
- * Set the localized short description for this feature.
- *
- * @param shortDescription the new short description for this feature.
- */
- public void setShortDescription(String shortDescription)
- {
- this.shortDescription = shortDescription;
- }
-
- /**
- * Indicates whether this feature is for expert use only.
- *
- * @return true if for use by experts only,
- * or false if anyone can use it.
- */
- public boolean isExpert()
- {
- return expert;
- }
-
- /**
- * Set whether this feature is for expert use only.
- *
- * @param expert true if for use by experts only,
- * or false if anyone can use it.
- */
- public void setExpert(boolean expert)
- {
- this.expert = expert;
- }
-
- /**
- * Indicates whether this feature is for use by tools only.
- * If it is for use by tools only, then it should not be displayed.
- *
- * @return true if tools only should use it,
- * or false if anyone can see it.
- */
- public boolean isHidden()
- {
- return hidden;
- }
-
- /**
- * Set whether this feature is for use by tools only.
- * If it is for use by tools only, then it should not be displayed.
- *
- * @param hidden true if tools only should use it,
- * or false if anyone can see it.
- */
- public void setHidden(boolean hidden)
- {
- this.hidden = hidden;
- }
-
- public boolean isPreferred ()
- {
- return preferred;
- }
-
- public void setPreferred (boolean preferred)
- {
- this.preferred = preferred;
- }
-
- /**
- * Get an arbitrary value set with setValue().
- *
- * @param name the programmatic name of the key.
- *
- * @return the value associated with this name,
- * or null if there is none.
- */
- public Object getValue(String name)
- {
- return valueHash.get(name);
- }
-
- /**
- * Set an arbitrary string-value pair with this feature.
- *
- * @param name the programmatic name of the key.
- * @param value the value to associate with the name.
- */
- public void setValue(String name, Object value)
- {
- valueHash.put(name, value);
- }
-
- /**
- * Get a list of the programmatic key names set with setValue().
- *
- * @return an Enumerator over all the programmatic key names associated
- * with this feature.
- */
- public Enumeration attributeNames()
- {
- return valueHash.keys();
- }
-}
diff --git a/libjava/java/beans/IndexedPropertyDescriptor.java b/libjava/java/beans/IndexedPropertyDescriptor.java
deleted file mode 100644
index efdc7b40238..00000000000
--- a/libjava/java/beans/IndexedPropertyDescriptor.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/* java.beans.IndexedPropertyDescriptor
- Copyright (C) 1998, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-
-/**
- ** IndexedPropertyDescriptor describes information about a JavaBean
- ** indexed property, by which we mean an array-like property that
- ** has been exposed via a pair of get and set methods and another
- ** pair that allows you to get to the property by an index.FooBar[] getFoo()
- ** void setFoo(FooBar[])
- ** FooBar getFoo(int)
- ** void setFoo(int,FooBar)
- **
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 26 Jul 1998
- **/
-
-public class IndexedPropertyDescriptor extends PropertyDescriptor {
- private Class indexedPropertyType;
- private Method setIndex;
- private Method getIndex;
-
- /** Create a new IndexedPropertyDescriptor by introspection.
- ** This form of constructor creates the PropertyDescriptor by
- ** looking for getter methods named <propertyType>[] <getMethodName>()
void <setMethodName>(<propertyType>[])
<propertyType> <getMethodName>(int)
void <setMethodName>(int,<propertyType>)
get<name>()
- ** and setter methods named
- ** set<name>()
in class
- ** <beanClass>
, where <name> has its
- ** first letter capitalized by the constructor.
- *
- *
- * Events:public boolean isXXX()
- * method, then XXX is a read-only boolean property.
- * boolean getXXX()
may be supplied in
- * addition to this method, although isXXX() is the
- * one that will be used in this case and getXXX()
- * will be ignored. If there is a
- * public void setXXX(boolean)
method,
- * it is part of this group and makes it a read-write
- * property.public <type> getXXX(int)
- * method, then XXX is a read-only indexed property of
- * type <type>. If there is a
- * public void setXXX(int,<type>)
- * method, then it is a read-write indexed property of
- * type <type>. There may also be a
- * public <type>[] getXXX()
and a
- * public void setXXX(<type>)
- * method as well.public void setXXX(int,<type>)
- * method, then it is a write-only indexed property of
- * type <type>. There may also be a
- * public <type>[] getXXX()
and a
- * public void setXXX(<type>)
- * method as well.public <type> getXXX()
method,
- * then XXX is a read-only property of type
- * <type>. If there is a
- * public void setXXX(<type>)
- * method, then it will be used for the property and
- * the property will be considered read-write.public void setXXX(<type>)
- * method, then as long as XXX is not already used as
- * the name of a property, XXX is assumed to be a
- * write-only property of type <type>.PropertyVetoException
, then the
- * property in question is assumed to be constrained.
- * No properties are ever assumed to be bound
- * (Spec Note: this is not in the
- * spec, it just makes sense). See PropertyDescriptor
- * for a description of bound and constrained
- * properties.public void addXXX(<type>)
and
- * public void removeXXX(<type>)
, where
- * <type> is a descendant of
- * java.util.EventListener
, then the pair of
- * methods imply that this Bean will fire events to
- * listeners of type <type>.java.util.TooManyListenersException
, then
- * the event set is assumed to be unicast. See
- * EventSetDescriptor for a discussion of unicast event
- * sets.beanClass
,
- * first by looking for explicit information, next by
- * using standard design patterns to determine
- * information about the class.
- *
- * @param beanClass the class to get BeanInfo about.
- * @return the BeanInfo object representing the class.
- */
- public static BeanInfo getBeanInfo(Class beanClass)
- throws IntrospectionException
- {
- BeanInfo cachedInfo;
- synchronized(beanClass)
- {
- cachedInfo = (BeanInfo)beanInfoCache.get(beanClass);
- if(cachedInfo != null)
- {
- return cachedInfo;
- }
- cachedInfo = getBeanInfo(beanClass,null);
- beanInfoCache.put(beanClass,cachedInfo);
- return cachedInfo;
- }
- }
-
- /**
- * Flush all of the Introspector's internal caches.
- *
- * @since 1.2
- */
- public static void flushCaches()
- {
- beanInfoCache.clear();
-
- // Clears all the intermediate ExplicitInfo instances which
- // have been created.
- // This makes sure we have to retrieve stuff like BeanDescriptors
- // again. (Remember that FeatureDescriptor can be modified by the user.)
- ExplicitInfo.flushCaches();
- }
-
- /**
- * Flush the Introspector's internal cached information for a given
- * class.
- *
- * @param clz the class to be flushed.
- * @throws NullPointerException if clz is null.
- * @since 1.2
- */
- public static void flushFromCaches(Class clz)
- {
- synchronized (clz)
- {
- beanInfoCache.remove(clz);
- }
- }
-
- /**
- * Get the BeanInfo for class beanClass
,
- * first by looking for explicit information, next by
- * using standard design patterns to determine
- * information about the class. It crawls up the
- * inheritance tree until it hits topClass
.
- *
- * @param beanClass the Bean class.
- * @param stopClass the class to stop at.
- * @return the BeanInfo object representing the class.
- */
- public static BeanInfo getBeanInfo(Class beanClass, Class stopClass)
- throws IntrospectionException
- {
- ExplicitInfo explicit = new ExplicitInfo(beanClass, stopClass);
-
- IntrospectionIncubator ii = new IntrospectionIncubator();
- ii.setPropertyStopClass(explicit.propertyStopClass);
- ii.setEventStopClass(explicit.eventStopClass);
- ii.setMethodStopClass(explicit.methodStopClass);
- ii.addMethods(beanClass.getMethods());
-
- BeanInfoEmbryo currentInfo = ii.getBeanInfoEmbryo();
- PropertyDescriptor[] p = explicit.explicitPropertyDescriptors;
- if(p!=null)
- {
- for(int i=0;iPropertyChangeListener
-
- * associating a name with the listener. This can be used to filter the
- * changes that one is interested in.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.4
- * @status udpated to 1.4
- */
-public class PropertyChangeListenerProxy extends EventListenerProxy
- implements PropertyChangeListener
-{
- /**
- * The name of the property to listen for. Package visible for use by
- * PropertyChangeSupport.
- */
- final String propertyName;
-
- /**
- * Create a new proxy which filters property change events and only passes
- * changes to the named property on to the delegate. A null propertyName
- * or listener does not fail now, but may cause a NullPointerException down
- * the road.
- *
- * @param propertyName the property's name to filter on
- * @param listener the delegate listener
- */
- public PropertyChangeListenerProxy(String propertyName,
- PropertyChangeListener listener)
- {
- super(listener);
- this.propertyName = propertyName;
- }
-
- /**
- * Forwards the event on to the delegate if the property name matches.
- *
- * @param event the event to pass on, if it meets the filter
- * @throws NullPointerException if the delegate this was created with is null
- */
- public void propertyChange(PropertyChangeEvent event)
- {
- // Note: Sun does not filter, under the assumption that since
- // PropertyChangeSupport unwraps proxys, this method should never be
- // called by normal use of listeners.
- String name = event == null ? null : event.getPropertyName();
- if (name == null ? propertyName == null : name.equals(propertyName))
- ((PropertyChangeListener) getListener()).propertyChange(event);
- }
-
- /**
- * Gets the name of the property this proxy is filtering on.
- *
- * @return the property name
- */
- public String getPropertyName()
- {
- return propertyName;
- }
-} // class PropertyChangeListenerProxy
diff --git a/libjava/java/beans/PropertyChangeSupport.java b/libjava/java/beans/PropertyChangeSupport.java
deleted file mode 100644
index a0e64af4d29..00000000000
--- a/libjava/java/beans/PropertyChangeSupport.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/* PropertyChangeSupport.java -- support to manage property change listeners
- Copyright (C) 1998, 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.Vector;
-
-/**
- * PropertyChangeSupport makes it easy to fire property change events and
- * handle listeners. It allows chaining of listeners, as well as filtering
- * by property name. In addition, it will serialize only those listeners
- * which are serializable, ignoring the others without problem. This class
- * is thread-safe.
- *
- * @author John Keiser
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public class PropertyChangeSupport implements Serializable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 6401253773779951803L;
-
- /**
- * Maps property names (String) to named listeners (PropertyChangeSupport).
- * If this is a child instance, this field will be null.
- *
- * @serial the map of property names to named listener managers
- * @since 1.2
- */
- private Hashtable children;
-
- /**
- * The non-null source object for any generated events.
- *
- * @serial the event source
- */
- private final Object source;
-
- /**
- * A field to compare serialization versions - this class uses version 2.
- *
- * @serial the serialization format
- */
- private static final int propertyChangeSupportSerializedDataVersion = 2;
-
- /**
- * The list of all registered property listeners. If this instance was
- * created by user code, this only holds the global listeners (ie. not tied
- * to a name), and may be null. If it was created by this class, as a
- * helper for named properties, then this vector will be non-null, and this
- * instance appears as a value in the children
hashtable of
- * another instance, so that the listeners are tied to the key of that
- * hashtable entry.
- */
- private transient Vector listeners;
-
- /**
- * Create a PropertyChangeSupport to work with a specific source bean.
- *
- * @param source the source bean to use
- * @throws NullPointerException if source is null
- */
- public PropertyChangeSupport(Object source)
- {
- this.source = source;
- if (source == null)
- throw new NullPointerException();
- }
-
- /**
- * Adds a PropertyChangeListener to the list of global listeners. All
- * property change events will be sent to this listener. The listener add
- * is not unique: that is, n adds with the same listener will
- * result in n events being sent to that listener for every
- * property change. Adding a null listener may cause a NullPointerException
- * down the road. This method will unwrap a PropertyChangeListenerProxy,
- * registering the underlying delegate to the named property list.
- *
- * @param l the listener to add
- */
- public synchronized void addPropertyChangeListener(PropertyChangeListener l)
- {
- if (l instanceof PropertyChangeListenerProxy)
- {
- PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
- addPropertyChangeListener(p.propertyName,
- (PropertyChangeListener) p.getListener());
- }
- else
- {
- if (listeners == null)
- listeners = new Vector();
- listeners.add(l);
- }
- }
-
- /**
- * Removes a PropertyChangeListener from the list of global listeners. If
- * any specific properties are being listened on, they must be deregistered
- * by themselves; this will only remove the general listener to all
- * properties. If add()
has been called multiple times for a
- * particular listener, remove()
will have to be called the
- * same number of times to deregister it. This method will unwrap a
- * PropertyChangeListenerProxy, removing the underlying delegate from the
- * named property list.
- *
- * @param l the listener to remove
- */
- public synchronized void
- removePropertyChangeListener(PropertyChangeListener l)
- {
- if (l instanceof PropertyChangeListenerProxy)
- {
- PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
- removePropertyChangeListener(p.propertyName,
- (PropertyChangeListener) p.getListener());
- }
- else if (listeners != null)
- {
- listeners.remove(l);
- if (listeners.isEmpty())
- listeners = null;
- }
- }
-
- /**
- * Returns an array of all registered property change listeners. Those that
- * were registered under a name will be wrapped in a
- * PropertyChangeListenerProxy
, so you must check whether the
- * listener is an instance of the proxy class in order to see what name the
- * real listener is registered under. If there are no registered listeners,
- * this returns an empty array.
- *
- * @return the array of registered listeners
- * @see PropertyChangeListenerProxy
- * @since 1.4
- */
- public synchronized PropertyChangeListener[] getPropertyChangeListeners()
- {
- ArrayList list = new ArrayList();
- if (listeners != null)
- list.addAll(listeners);
- if (children != null)
- {
- int i = children.size();
- Iterator iter = children.entrySet().iterator();
- while (--i >= 0)
- {
- Entry e = (Entry) iter.next();
- String name = (String) e.getKey();
- Vector v = ((PropertyChangeSupport) e.getValue()).listeners;
- int j = v.size();
- while (--j >= 0)
- list.add(new PropertyChangeListenerProxy
- (name, (PropertyChangeListener) v.get(j)));
- }
- }
- return (PropertyChangeListener[])
- list.toArray(new PropertyChangeListener[list.size()]);
- }
-
- /**
- * Adds a PropertyChangeListener listening on the specified property. Events
- * will be sent to the listener only if the property name matches. The
- * listener add is not unique; that is, n adds on a particular
- * property for a particular listener will result in n events
- * being sent to that listener when that property is changed. The effect is
- * cumulative, too; if you are registered to listen to receive events on
- * all property changes, and then you register on a particular property,
- * you will receive change events for that property twice. Adding a null
- * listener may cause a NullPointerException down the road. This method
- * will unwrap a PropertyChangeListenerProxy, registering the underlying
- * delegate to the named property list if the names match, and discarding
- * it otherwise.
- *
- * @param propertyName the name of the property to listen on
- * @param l the listener to add
- * @throws NullPointerException if propertyName is null
- */
- public synchronized void addPropertyChangeListener(String propertyName,
- PropertyChangeListener l)
- {
- while (l instanceof PropertyChangeListenerProxy)
- {
- PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
- if (propertyName == null ? p.propertyName != null
- : ! propertyName.equals(p.propertyName))
- return;
- l = (PropertyChangeListener) p.getListener();
- }
- PropertyChangeSupport s = null;
- if (children == null)
- children = new Hashtable();
- else
- s = (PropertyChangeSupport) children.get(propertyName);
- if (s == null)
- {
- s = new PropertyChangeSupport(source);
- s.listeners = new Vector();
- children.put(propertyName, s);
- }
- s.listeners.add(l);
- }
-
- /**
- * Removes a PropertyChangeListener from listening to a specific property.
- * If add()
has been called multiple times for a particular
- * listener on a property, remove()
will have to be called the
- * same number of times to deregister it. This method will unwrap a
- * PropertyChangeListenerProxy, removing the underlying delegate from the
- * named property list if the names match.
- *
- * @param propertyName the property to stop listening on
- * @param l the listener to remove
- * @throws NullPointerException if propertyName is null
- */
- public synchronized void
- removePropertyChangeListener(String propertyName, PropertyChangeListener l)
- {
- if (children == null)
- return;
- PropertyChangeSupport s
- = (PropertyChangeSupport) children.get(propertyName);
- if (s == null)
- return;
- while (l instanceof PropertyChangeListenerProxy)
- {
- PropertyChangeListenerProxy p = (PropertyChangeListenerProxy) l;
- if (propertyName == null ? p.propertyName != null
- : ! propertyName.equals(p.propertyName))
- return;
- l = (PropertyChangeListener) p.getListener();
- }
- s.listeners.remove(l);
- if (s.listeners.isEmpty())
- {
- children.remove(propertyName);
- if (children.isEmpty())
- children = null;
- }
- }
-
- /**
- * Returns an array of all property change listeners registered under the
- * given property name. If there are no registered listeners, this returns
- * an empty array.
- *
- * @return the array of registered listeners
- * @throws NullPointerException if propertyName is null
- * @since 1.4
- */
- public synchronized PropertyChangeListener[]
- getPropertyChangeListeners(String propertyName)
- {
- if (children == null)
- return new PropertyChangeListener[0];
- PropertyChangeSupport s
- = (PropertyChangeSupport) children.get(propertyName);
- if (s == null)
- return new PropertyChangeListener[0];
- return (PropertyChangeListener[])
- s.listeners.toArray(new PropertyChangeListener[s.listeners.size()]);
- }
-
- /**
- * Fire a PropertyChangeEvent containing the old and new values of the
- * property to all the global listeners, and to all the listeners for the
- * specified property name. This does nothing if old and new are non-null
- * and equal.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value
- * @param newVal the new value
- */
- public void firePropertyChange(String propertyName,
- Object oldVal, Object newVal)
- {
- firePropertyChange(new PropertyChangeEvent(source, propertyName,
- oldVal, newVal));
- }
-
- /**
- * Fire a PropertyChangeEvent containing the old and new values of the
- * property to all the global listeners, and to all the listeners for the
- * specified property name. This does nothing if old and new are equal.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value
- * @param newVal the new value
- */
- public void firePropertyChange(String propertyName, int oldVal, int newVal)
- {
- if (oldVal != newVal)
- firePropertyChange(new PropertyChangeEvent(source, propertyName,
- new Integer(oldVal),
- new Integer(newVal)));
- }
-
- /**
- * Fire a PropertyChangeEvent containing the old and new values of the
- * property to all the global listeners, and to all the listeners for the
- * specified property name. This does nothing if old and new are equal.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value
- * @param newVal the new value
- */
- public void firePropertyChange(String propertyName,
- boolean oldVal, boolean newVal)
- {
- if (oldVal != newVal)
- firePropertyChange(new PropertyChangeEvent(source, propertyName,
- Boolean.valueOf(oldVal),
- Boolean.valueOf(newVal)));
- }
-
- /**
- * Fire a PropertyChangeEvent to all the global listeners, and to all the
- * listeners for the specified property name. This does nothing if old and
- * new values of the event are equal.
- *
- * @param event the event to fire
- * @throws NullPointerException if event is null
- */
- public void firePropertyChange(PropertyChangeEvent event)
- {
- if (event.oldValue != null && event.oldValue.equals(event.newValue))
- return;
- Vector v = listeners; // Be thread-safe.
- if (v != null)
- {
- int i = v.size();
- while (--i >= 0)
- ((PropertyChangeListener) v.get(i)).propertyChange(event);
- }
- Hashtable h = children; // Be thread-safe.
- if (h != null && event.propertyName != null)
- {
- PropertyChangeSupport s
- = (PropertyChangeSupport) h.get(event.propertyName);
- if (s != null)
- {
- v = s.listeners; // Be thread-safe.
- int i = v == null ? 0 : v.size();
- while (--i >= 0)
- ((PropertyChangeListener) v.get(i)).propertyChange(event);
- }
- }
- }
-
- /**
- * Tell whether the specified property is being listened on or not. This
- * will only return true
if there are listeners on all
- * properties or if there is a listener specifically on this property.
- *
- * @param propertyName the property that may be listened on
- * @return whether the property is being listened on
- * @throws NullPointerException if propertyName is null
- */
- public synchronized boolean hasListeners(String propertyName)
- {
- return listeners != null || (children != null
- && children.get(propertyName) != null);
- }
-
- /**
- * Saves the state of the object to the stream.
- *
- * @param s the stream to write to
- * @throws IOException if anything goes wrong
- * @serialData this writes out a null-terminated list of serializable
- * global property change listeners (the listeners for a named
- * property are written out as the global listeners of the
- * children, when the children hashtable is saved)
- */
- private synchronized void writeObject(ObjectOutputStream s)
- throws IOException
- {
- s.defaultWriteObject();
- if (listeners != null)
- {
- int i = listeners.size();
- while (--i >= 0)
- if (listeners.get(i) instanceof Serializable)
- s.writeObject(listeners.get(i));
- }
- s.writeObject(null);
- }
-
- /**
- * Reads the object back from stream (deserialization).
- *
- * XXX Since serialization for 1.1 streams was not documented, this may
- * not work if propertyChangeSupportSerializedDataVersion is 1.
- *
- * @param s the stream to read from
- * @throws IOException if reading the stream fails
- * @throws ClassNotFoundException if deserialization fails
- * @serialData this reads in a null-terminated list of serializable
- * global property change listeners (the listeners for a named
- * property are written out as the global listeners of the
- * children, when the children hashtable is saved)
- */
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
- PropertyChangeListener l = (PropertyChangeListener) s.readObject();
- while (l != null)
- {
- addPropertyChangeListener(l);
- l = (PropertyChangeListener) s.readObject();
- }
- // Sun is not as careful with children as we are, and lets some proxys
- // in that can never receive events. So, we clean up anything that got
- // serialized, to make sure our invariants hold.
- if (children != null)
- {
- int i = children.size();
- Iterator iter = children.entrySet().iterator();
- while (--i >= 0)
- {
- Entry e = (Entry) iter.next();
- String name = (String) e.getKey();
- PropertyChangeSupport pcs = (PropertyChangeSupport) e.getValue();
- if (pcs.listeners == null)
- pcs.listeners = new Vector();
- if (pcs.children != null)
- pcs.listeners.addAll
- (Arrays.asList(pcs.getPropertyChangeListeners(name)));
- if (pcs.listeners.size() == 0)
- iter.remove();
- else
- pcs.children = null;
- }
- if (children.size() == 0)
- children = null;
- }
- }
-} // class PropertyChangeSupport
diff --git a/libjava/java/beans/PropertyDescriptor.java b/libjava/java/beans/PropertyDescriptor.java
deleted file mode 100644
index 416d468576f..00000000000
--- a/libjava/java/beans/PropertyDescriptor.java
+++ /dev/null
@@ -1,583 +0,0 @@
-/* java.beans.PropertyDescriptor
- Copyright (C) 1998, 2001, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.beans;
-
-import java.lang.reflect.Method;
-
-/**
- ** PropertyDescriptor describes information about a JavaBean property,
- ** by which we mean a property that has been exposed via a pair of
- ** get and set methods. (There may be no get method, which means
- ** the property is write-only, or no set method, which means the
- ** the property is read-only.)
- **
- **
- ** @author John Keiser
- ** @author Robert Schuster (thebohemian@gmx.net)
- ** @since 1.1
- ** @status updated to 1.4
- **/
-
-public class PropertyDescriptor extends FeatureDescriptor
-{
- Class propertyType;
- Method getMethod;
- Method setMethod;
-
- Class propertyEditorClass;
- boolean bound;
- boolean constrained;
-
- PropertyDescriptor(String name)
- {
- setName(name);
- }
-
- /** Create a new PropertyDescriptor by introspection.
- ** This form of constructor creates the PropertyDescriptor by
- ** looking for a getter method named <propertyType> <getMethodName>()
void <setMethodName>(<propertyType>)
get<name>()
- ** (or, optionally, if the property is boolean,
- ** is<name>()
) and
- ** set<name>()
in class
- ** <beanClass>
, where <name> has its
- ** first letter capitalized by the constructor.IntrospectionException
is thrown.
- **
- ** Implementation note: If there is both are both isXXX and
- ** getXXX methods, the former is used in preference to the latter.
- ** We do not check that an isXXX method returns a boolean. In both
- ** cases, this matches the behaviour of JDK 1.4null
if the property is write-only.
- ** @param setMethodName the name of the set method or null
if the property is read-only.
- ** @exception IntrospectionException if the methods are not found
- ** or invalid.
- **/
- public PropertyDescriptor(
- String name,
- Class beanClass,
- String getMethodName,
- String setMethodName)
- throws IntrospectionException
- {
- setName(name);
- findMethods(beanClass, getMethodName, null, setMethodName);
-
- if (getMethod == null && getMethodName != null)
- {
- throw new IntrospectionException(
- "Cannot find a getter method called " + getMethodName);
- }
-
- if (setMethod == null && setMethodName != null)
- {
- throw new IntrospectionException(
- "Cannot find a setter method called " + setMethodName);
- }
-
- propertyType = checkMethods(getMethod, setMethod);
- }
-
- /** Create a new PropertyDescriptor using explicit Methods.
- ** Note that the methods will be checked for conformance to standard
- ** Property method rules, as described above at the top of this class.
- **
- ** It is possible to call this method with both Method
arguments
- ** being null
. In such a case the property type is null
.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param readMethod the read method or null
if the property is write-only.
- ** @param writeMethod the write method or null
if the property is read-only.
- ** @exception IntrospectionException if the methods are not found
- ** or invalid.
- **/
- public PropertyDescriptor(
- String name,
- Method readMethod,
- Method writeMethod)
- throws IntrospectionException
- {
- setName(name);
- getMethod = readMethod;
- setMethod = writeMethod;
- propertyType = checkMethods(getMethod, setMethod);
- }
-
- /** Get the property type.
- ** This is the type the get method returns and the set method
- ** takes in.
- **/
- public Class getPropertyType()
- {
- return propertyType;
- }
-
- /** Get the get method. Why they call it readMethod here and
- ** get everywhere else is beyond me.
- **/
- public Method getReadMethod()
- {
- return getMethod;
- }
-
- /** Sets the read method.
- * The read method is used to retrieve the value of a property. A legal
- * read method must have no arguments. Its return type must not be
- * void
. If this methods succeeds the property type
- * is adjusted to the return type of the read method.
- *
- * It is legal to set the read and the write method to null
- * or provide method which have been declared in distinct classes.
- *
- * @param readMethod The new method to be used or null
.
- * @throws IntrospectionException If the given method is invalid.
- * @since 1.2
- */
- public void setReadMethod(Method readMethod) throws IntrospectionException
- {
- propertyType = checkMethods(readMethod, setMethod);
-
- getMethod = readMethod;
- }
-
- /** Get the set method. Why they call it writeMethod here and
- ** set everywhere else is beyond me.
- **/
- public Method getWriteMethod()
- {
- return setMethod;
- }
-
- /** Sets the write method.
- * The write method is used to set the value of a property. A legal write method
- * must have a single argument which can be assigned to the property. If no
- * read method exists the property type changes to the argument type of the
- * write method.
- *
- * It is legal to set the read and the write method to null
- * or provide method which have been declared in distinct classes.
- *
- * @param writeMethod The new method to be used or null
.
- * @throws IntrospectionException If the given method is invalid.
- * @since 1.2
- */
- public void setWriteMethod(Method writeMethod)
- throws IntrospectionException
- {
- propertyType = checkMethods(getMethod, writeMethod);
-
- setMethod = writeMethod;
- }
-
- /** Get whether the property is bound. Defaults to false. **/
- public boolean isBound()
- {
- return bound;
- }
-
- /** Set whether the property is bound.
- ** As long as the the bean implements addPropertyChangeListener() and
- ** removePropertyChangeListener(), setBound(true) may safely be called.PropertyChangeListener.propertyChange())
event
- ** after the value has changed.
- ** @param bound whether the property is bound or not.
- **/
- public void setBound(boolean bound)
- {
- this.bound = bound;
- }
-
- /** Get whether the property is constrained. Defaults to false. **/
- public boolean isConstrained()
- {
- return constrained;
- }
-
- /** Set whether the property is constrained.
- ** If the set method throws java.beans.PropertyVetoException
- ** (or subclass thereof) and the bean implements addVetoableChangeListener()
- ** and removeVetoableChangeListener(), then setConstrained(true) may safely
- ** be called. Otherwise, the system behavior is undefined.
- ** Spec note: given those strict parameters, it would be nice if it
- ** got set automatically by detection, but oh well.
- **
- ** @param constrained whether the property is constrained or not.
- **/
- public void setConstrained(boolean constrained)
- {
- this.constrained = constrained;
- }
-
- /** Get the PropertyEditor class. Defaults to null. **/
- public Class getPropertyEditorClass()
- {
- return propertyEditorClass;
- }
-
- /** Set the PropertyEditor class. If the class does not implement
- ** the PropertyEditor interface, you will likely get an exception
- ** late in the game.
- ** @param propertyEditorClass the PropertyEditor class for this
- ** class to use.
- **/
- public void setPropertyEditorClass(Class propertyEditorClass)
- {
- this.propertyEditorClass = propertyEditorClass;
- }
-
- private void findMethods(
- Class beanClass,
- String getMethodName1,
- String getMethodName2,
- String setMethodName)
- throws IntrospectionException
- {
- try
- {
- // Try the first get method name
- if (getMethodName1 != null)
- {
- try
- {
- getMethod =
- beanClass.getMethod(getMethodName1, new Class[0]);
- }
- catch (NoSuchMethodException e)
- {}
- }
-
- // Fall back to the second get method name
- if (getMethod == null && getMethodName2 != null)
- {
- try
- {
- getMethod =
- beanClass.getMethod(getMethodName2, new Class[0]);
- }
- catch (NoSuchMethodException e)
- {}
- }
-
- // Try the set method name
- if (setMethodName != null)
- {
- if (getMethod != null)
- {
- // If there is a get method, use its return type to help
- // select the corresponding set method.
- Class propertyType = getMethod.getReturnType();
- if (propertyType == Void.TYPE)
- {
- String msg =
- "The property's read method has return type 'void'";
- throw new IntrospectionException(msg);
- }
-
- Class[] setArgs = new Class[] { propertyType };
- try
- {
- setMethod = beanClass.getMethod(setMethodName, setArgs);
- }
- catch (NoSuchMethodException e)
- {}
- }
- else if (getMethodName1 == null && getMethodName2 == null)
- {
- // If this is a write-only property, choose the first set method
- // with the required name, one parameter and return type 'void'
- Method[] methods = beanClass.getMethods();
- for (int i = 0; i < methods.length; i++)
- {
- if (methods[i].getName().equals(setMethodName)
- && methods[i].getParameterTypes().length == 1
- && methods[i].getReturnType() == Void.TYPE)
- {
- setMethod = methods[i];
- break;
- }
- }
- }
- }
- }
- catch (SecurityException e)
- {
- // FIXME -- shouldn't we just allow SecurityException to propagate?
- String msg =
- "SecurityException thrown on attempt to access methods.";
- throw new IntrospectionException(msg);
- }
- }
-
- /** Checks whether the given VetoableChangeListener.vetoableChange()
- ** event notifying others of the change and allowing them a chance to
- ** say it is a bad thing.Method
instances are legal read and
- * write methods. The following requirements must be met:
- *
- *
- * While checking the methods a common new property type is calculated. If the method
- * succeeds this property type is returned.
- *
- * For compatibility this has to be noted:
- * The two methods are allowed to be defined in two distinct classes and may both be null.
- *
- * @param readMethod The new read method to check.
- * @param writeMethod The new write method to check.
- * @return The common property type of the two method.
- * @throws IntrospectionException If any of the above requirements are not met.
- */
- private Class checkMethods(Method readMethod, Method writeMethod)
- throws IntrospectionException
- {
- Class newPropertyType = propertyType;
-
- // a valid read method has zero arguments and a non-void return type.
- if (readMethod != null)
- {
- if (readMethod.getParameterTypes().length > 0)
- {
- throw new IntrospectionException("read method has unexpected parameters");
- }
-
- newPropertyType = readMethod.getReturnType();
-
- if (newPropertyType == Void.TYPE)
- {
- throw new IntrospectionException("read method return type is void");
- }
- }
-
- // a valid write method has one argument which can be assigned to the property
- if (writeMethod != null)
- {
- if (writeMethod.getParameterTypes().length != 1)
- {
- String msg = "write method does not have exactly one parameter";
- throw new IntrospectionException(msg);
- }
-
- if (readMethod == null)
- {
- // changes the property type if there is no read method
- newPropertyType = writeMethod.getParameterTypes()[0];
- }
- else
- {
- // checks whether the write method can be assigned to the return type of the read
- // method (if this is not the case, the methods are not compatible)
- // note: newPropertyType may be null if no methods or method names have been
- // delivered in the constructor.
- if (newPropertyType != null
- && !newPropertyType.isAssignableFrom(
- writeMethod.getParameterTypes()[0]))
- {
- // note: newPropertyType is the same as readMethod.getReturnType() at this point
- throw new IntrospectionException("read and write method are not compatible");
- }
-
- /* note: the check whether both method are defined in related classes makes sense but is not
- * done in the JDK.
- * I leave this code here in case someone at Sun decides to add that functionality in later versions (rschuster)
- if ((!readMethod
- .getDeclaringClass()
- .isAssignableFrom(writeMethod.getDeclaringClass()))
- && (!writeMethod
- .getDeclaringClass()
- .isAssignableFrom(readMethod.getDeclaringClass())))
- {
- String msg =
- "set and get methods are not in the same class.";
- throw new IntrospectionException(msg);
- }
- */
-
- }
- }
-
- return newPropertyType;
- }
-
- /** Compares this PropertyDescriptor
against the
- * given object.
- * Two PropertyDescriptors are equals if
- *
- *
- * @return Whether both objects are equal according to the rules given above.
- * @since 1.4
- */
- public boolean equals(Object o)
- {
- if (o instanceof PropertyDescriptor)
- {
- PropertyDescriptor that = (PropertyDescriptor) o;
-
- // compares the property types and checks the case where both are null
- boolean samePropertyType =
- (propertyType == null)
- ? that.propertyType == null
- : propertyType.equals(that.propertyType);
-
- // compares the property editor classes and checks the case where both are null
- boolean samePropertyEditorClass =
- (propertyEditorClass == null)
- ? that.propertyEditorClass == null
- : propertyEditorClass.equals(that.propertyEditorClass);
-
- // compares the flags for equality
- boolean sameFlags =
- bound == that.bound && constrained == that.constrained;
-
- // compares the read methods and checks the case where both are null
- boolean sameReadMethod =
- (getMethod == null)
- ? that.getMethod == null
- : getMethod.equals(that.getMethod);
-
- boolean sameWriteMethod =
- (setMethod == null)
- ? that.setMethod == null
- : setMethod.equals(that.setMethod);
-
- return samePropertyType
- && sameFlags
- && sameReadMethod
- && sameWriteMethod
- && samePropertyEditorClass;
- }
- else
- {
- return false;
- }
-
- }
-
-}
diff --git a/libjava/java/beans/PropertyEditor.java b/libjava/java/beans/PropertyEditor.java
deleted file mode 100644
index d1c5103419f..00000000000
--- a/libjava/java/beans/PropertyEditor.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/* java.beans.PropertyEditor
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-/**
- ** PropertyEditors are custom GUI editors for specific types of values.
- **
- ** A PropertyEditor can be used, for example, if you are editing a type of value
- ** that can be more easily represented graphically, such as a Point, or one that
- ** can be more easily represented by a list, such as a boolean (true/false).
- **
- **
- ** The PropertyEditor for a particular Bean can be found using the
- ** PropertyEditorManager class, which goes through a series of different
- ** checks to find the appropriate class.setAsText(getAsText())
should be valid; i.e. the stuff you spit out in
- ** getAsText() should be able to go into setAsText().
- ** @return the value of this property in String format.
- **/
- String getAsText();
-
- /** Get a list of possible Strings which this property type can have.
- ** The value of these will be used by the RAD tool to construct some sort
- ** of list box or to check text box input, and the resulting String passed
- ** to setAsText() should be one of these. Note, however, that like most things
- ** with this mammoth, unwieldy interface, this is not guaranteed. Thus, you
- ** must check the value in setAsText() anyway.
- ** @return the list of possible String values for this property type.
- **/
- String[] getTags();
-
-
- /** The RAD tool calls this to find out whether the PropertyEditor can paint itself.
- ** @return true if it can paint itself graphically, false if it cannot.
- **/
- boolean isPaintable();
-
- /** The RAD tool calls this to paint the actual value of the property.
- ** The Graphics context will have the same current font, color, etc. as the
- ** parent Container. You may safely change the font, color, etc. and not
- ** change them back.
- **
- ** @return the initialization string for this object in Java.
- **/
- String getJavaInitializationString();
-}
diff --git a/libjava/java/beans/PropertyEditorManager.java b/libjava/java/beans/PropertyEditorManager.java
deleted file mode 100644
index da2a5678c5c..00000000000
--- a/libjava/java/beans/PropertyEditorManager.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/* java.beans.PropertyEditorManager
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import gnu.java.beans.editors.ColorEditor;
-import gnu.java.beans.editors.FontEditor;
-import gnu.java.beans.editors.NativeBooleanEditor;
-import gnu.java.beans.editors.NativeByteEditor;
-import gnu.java.beans.editors.NativeDoubleEditor;
-import gnu.java.beans.editors.NativeFloatEditor;
-import gnu.java.beans.editors.NativeIntEditor;
-import gnu.java.beans.editors.NativeLongEditor;
-import gnu.java.beans.editors.NativeShortEditor;
-import gnu.java.beans.editors.StringEditor;
-import gnu.java.lang.ClassHelper;
-
-import java.awt.Color;
-import java.awt.Font;
-
-/**
- * PropertyEditorManager is used to find property editors
- * for various types (not necessarily Beans).2
"I am a String"
new MyObject(2, "String", new StringBuffer())
- *
- *
- * protected
prior to 1.5
- */
- public PropertyEditorSupport()
- {
- eventSource = this;
- pSupport = new PropertyChangeSupport(this);
- }
-
- /** Call this constructor when you are using
- * PropertyEditorSupport as a helper object.
- *
- * This constructor throws a NullPointerException when source
is null
,
- * for compatibility reasons with J2SDK 1.5.0 .
- *
- * @param source The source to use when firing
- * property change events.
- * @since 1.5
- * @specnote this was protected
prior to 1.5
- */
- public PropertyEditorSupport(Object source)
- {
- // note: constructor rejects source being null for the sake of compatibility
- // with official 1.5.0 implementation
- if (source == null)
- throw new NullPointerException("Event source must not be null.");
-
- eventSource = source;
- pSupport = new PropertyChangeSupport(eventSource);
- }
-
- /** Sets the current value of the property and a property change
- * event is fired to all registered PropertyChangeListener instances.
- *
- * @param newValue The new value for the property.
- */
- public void setValue(Object newValue)
- {
- value = newValue;
-
- // specification in java.beans.PropertyChangeEvent says
- // that without a property name (first argument) the
- // new and the old value should always be null
- pSupport.firePropertyChange(null, null, null);
- }
-
- /** Gets the current value of the property.
- *
- * @return the current value of the property.
- */
- public Object getValue()
- {
- return value;
- }
-
- /** Gets whether this object is paintable or not.
- *
- * @return false
- */
- public boolean isPaintable()
- {
- return false;
- }
-
- /** Paints this object. This class does nothing in
- * this method.
- */
- public void paintValue(java.awt.Graphics g, java.awt.Rectangle r)
- {
- }
-
- /** Gets the Java initialization String for the current
- * value of the Object. This class returns gibberish or
- * null (though the spec does not say which).null
- */
- public String[] getTags()
- {
- return null;
- }
-
- /** Returns a custom component to edit the value.
- *
- * @return null
in this class.
- */
- public java.awt.Component getCustomEditor()
- {
- return null;
- }
-
- /** Finds out whether this property editor supports a
- * custom component to edit its value.
- *
- * @return false
in this class.
- */
- public boolean supportsCustomEditor()
- {
- return false;
- }
-
- /** Adds a property change listener to this property editor.
- *
- * @param l the listener to add.
- */
- public void addPropertyChangeListener(PropertyChangeListener l)
- {
- pSupport.addPropertyChangeListener(l);
- }
-
- /** Removes a property change listener from this property editor.
- *
- * @param l the listener to remove.
- */
- public void removePropertyChangeListener(PropertyChangeListener l)
- {
- pSupport.removePropertyChangeListener(l);
- }
-
- /** Notifies people that we've changed, although we don't
- * tell them just how.
- */
- public void firePropertyChange()
- {
- pSupport.firePropertyChange(null, null, null);
- }
-
- /** Returns the bean that is used as the source of events.
- *
- * @return The event source object
- * @since 1.5
- */
- public Object getSource()
- {
- return eventSource;
- }
-
- /** Sets the bean that is used as the source of events
- * when property changes occur.
- *
- * The event source bean is for informational purposes only
- * and should not be changed by the PropertyEditor
.
- *
- * @param source
- * @since 1.5
- */
- public void setSource(Object source)
- {
- eventSource = source;
- }
-}
diff --git a/libjava/java/beans/PropertyVetoException.java b/libjava/java/beans/PropertyVetoException.java
deleted file mode 100644
index 1f0399b4bfb..00000000000
--- a/libjava/java/beans/PropertyVetoException.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* PropertyVetoException.java -- thrown to veto a proposed property change
- Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-/**
- * PropertyVetoException is thrown when a VetoableChangeListener doesn't
- * like the proposed change.
- *
- * @author John Keiser
- * @see VetoableChangeListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class PropertyVetoException extends Exception
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 129596057694162164L;
-
- /**
- * The vetoed change.
- *
- * @serial the event that was vetoed
- */
- private final PropertyChangeEvent evt;
-
- /**
- * Instantiate this exception with the given message and property change.
- *
- * @param msg the reason for the veto
- * @param changeEvent the PropertyChangeEvent that was thrown
- */
- public PropertyVetoException(String msg, PropertyChangeEvent changeEvent)
- {
- super(msg);
- evt = changeEvent;
- }
-
- /**
- * Get the PropertyChange event that was vetoed.
- *
- * @return the vetoed change
- */
- public PropertyChangeEvent getPropertyChangeEvent()
- {
- return evt;
- }
-}
diff --git a/libjava/java/beans/SimpleBeanInfo.java b/libjava/java/beans/SimpleBeanInfo.java
deleted file mode 100644
index cfb96048498..00000000000
--- a/libjava/java/beans/SimpleBeanInfo.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/* java.beans.SimpleBeanInfo
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.awt.Image;
-import java.awt.Toolkit;
-
-/**
- ** SimpleBeanInfo is a class you may extend to more easily
- ** provide select information to the Introspector. It
- ** implements all of the methods in BeanInfo by returning
- ** null and forces the Introspector to behave exactly as
- ** if there were no BeanInfo class at all (Introspecting
- ** everything).null
.
- **/
- public BeanDescriptor getBeanDescriptor() {
- return null;
- }
-
- /** Force Introspection of the events this Bean type
- ** fires.
- ** @return null
- **/
- public EventSetDescriptor[] getEventSetDescriptors() {
- return null;
- }
-
- /** Say that there is no "default" event set.
- ** @return -1
.
- **/
- public int getDefaultEventIndex() {
- return -1;
- }
-
- /** Force Introspection of the Bean properties.
- ** @return null
.
- **/
- public PropertyDescriptor[] getPropertyDescriptors() {
- return null;
- }
-
- /** Say that there is no "default" property.
- ** @return -1
.
- **/
- public int getDefaultPropertyIndex() {
- return -1;
- }
-
- /** Force Introspection of the Bean's methods.
- ** @return null
.
- **/
- public MethodDescriptor[] getMethodDescriptors() {
- return null;
- }
-
- /** Tell the Introspector to go look for other BeanInfo
- ** itself.
- ** @return null
.
- **/
- public BeanInfo[] getAdditionalBeanInfo() {
- return null;
- }
-
- /** Say that this Bean has no icons.
- ** @param iconType the type of icon
- ** @return null
.
- **/
- public Image getIcon(int iconType) {
- return null;
- }
-
- /** Helper method to load an image using the Bean class
- ** getResource() method on the BeanInfo class (using
- ** getClass(), since you'll extend this class to get
- ** the BeanInfo). Basically it's assumed that the Bean
- ** and its BeanInfo are both loaded by the same
- ** ClassLoader, generally a reasonable assumption.
- ** @param location the URL relative
- ** @return the Image in question.
- **/
- public Image loadImage(String location) {
- return Toolkit.getDefaultToolkit().getImage(getClass().getResource(location));
- }
-}
-
diff --git a/libjava/java/beans/Statement.java b/libjava/java/beans/Statement.java
deleted file mode 100644
index 01f86dd286f..00000000000
--- a/libjava/java/beans/Statement.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/* java.beans.Statement
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-/**
- * class Statement
- *
- * A Statement captures the execution of an object method. It stores
- * the object, the method to call, and the arguments to the method and
- * provides the ability to execute the method on the object, using the
- * provided arguments.
- *
- * @since 1.4
- */
-public class Statement
-{
- private Object target;
- private String methodName;
- private Object[] arguments;
-
- // One or the other of these will get a value after execute is
- // called once, but not both.
- private transient Method method;
- private transient Constructor ctor;
-
- /**
- * Constructs a statement representing the invocation of
- * object.methodName(arg[0], arg[1], ...);
- *
- * @param target The object to invoke the method on.
- * @param methodName The object method to invoke.
- * @param arguments An array of arguments to pass to the method.
- */
- public Statement(Object target, String methodName, Object[] arguments)
- {
- this.target = target;
- this.methodName = methodName;
- this.arguments = arguments;
- }
-
- /**
- * Execute the statement.
- *
- * Finds the specified method in the target object and calls it with
- * the arguments given in the constructor.
- *
- * The most specific method according to the JLS(15.11) is used when
- * there are multiple methods with the same name.
- *
- * Execute performs some special handling for methods and
- * parameters:
- *
- * Static methods can be executed by providing the class as a
- * target.
- *
- * The method name new is reserved to call the constructor
- * new() will construct an object and return it. Not useful unless
- * an expression :-)
- *
- * If the target is an array, get and set as defined in
- * java.util.List are recognized as valid methods and mapped to the
- * methods of the same name in java.lang.reflect.Array.
- *
- * The native datatype wrappers Boolean, Byte, Character, Double,
- * Float, Integer, Long, and Short will map to methods that have
- * native datatypes as parameters, in the same way as Method.invoke.
- * However, these wrappers also select methods that actually take
- * the wrapper type as an argument.
- *
- * The Sun spec doesn't deal with overloading between int and
- * Integer carefully. If there are two methods, one that takes an
- * Integer and the other taking an int, the method chosen is not
- * specified, and can depend on the order in which the methods are
- * declared in the source file.
- *
- * @throws Exception if an exception occurs while locating or
- * invoking the method.
- */
- public void execute() throws Exception
- {
- doExecute();
- }
-
- private static Class wrappers[] =
- {
- Boolean.class, Byte.class, Character.class, Double.class, Float.class,
- Integer.class, Long.class, Short.class
- };
-
- private static Class natives[] =
- {
- Boolean.TYPE, Byte.TYPE, Character.TYPE, Double.TYPE, Float.TYPE,
- Integer.TYPE, Long.TYPE, Short.TYPE
- };
-
- // Given a wrapper class, return the native class for it. For
- // example, if c is Integer, Integer.TYPE is returned.
- private Class unwrap(Class c)
- {
- for (int i = 0; i < wrappers.length; i++)
- if (c == wrappers[i])
- return natives[i];
- return null;
- }
-
- // Return true if all args can be assigned to params, false
- // otherwise. Arrays are guaranteed to be the same length.
- private boolean compatible(Class[] params, Class[] args)
- {
- for (int i = 0; i < params.length; i++)
- {
- // Treat Integer like int if appropriate
- Class nativeType = unwrap(args[i]);
- if (nativeType != null && params[i].isPrimitive()
- && params[i].isAssignableFrom(nativeType))
- continue;
- if (params[i].isAssignableFrom(args[i]))
- continue;
-
- return false;
- }
- return true;
- }
-
- /**
- * Return true if the method arguments in first are more specific
- * than the method arguments in second, i.e. all args in first can
- * be assigned to those in second.
- *
- * A method is more specific if all parameters can also be fed to
- * the less specific method, because, e.g. the less specific method
- * accepts a base class of the equivalent argument for the more
- * specific one.
- *
- * @param first a Class[]
value
- * @param second a Class[]
value
- * @return a boolean
value
- */
- private boolean moreSpecific(Class[] first, Class[] second)
- {
- for (int j=0; j < first.length; j++)
- {
- if (second[j].isAssignableFrom(first[j]))
- continue;
- return false;
- }
- return true;
- }
-
- final Object doExecute() throws Exception
- {
- Class klazz = (target instanceof Class)
- ? (Class) target : target.getClass();
- Object args[] = (arguments == null) ? new Object[0] : arguments;
- Class argTypes[] = new Class[args.length];
- for (int i = 0; i < args.length; i++)
- argTypes[i] = args[i].getClass();
-
- if (target.getClass().isArray())
- {
- // FIXME: invoke may have to be used. For now, cast to Number
- // and hope for the best. If caller didn't behave, we go boom
- // and throw the exception.
- if (methodName.equals("get") && argTypes.length == 1)
- return Array.get(target, ((Number)args[0]).intValue());
- if (methodName.equals("set") && argTypes.length == 2)
- {
- Object obj = Array.get(target, ((Number)args[0]).intValue());
- Array.set(target, ((Number)args[0]).intValue(), args[1]);
- return obj;
- }
- throw new NoSuchMethodException("No matching method for statement " + toString());
- }
-
- // If we already cached the method, just use it.
- if (method != null)
- return method.invoke(target, args);
- else if (ctor != null)
- return ctor.newInstance(args);
-
- // Find a matching method to call. JDK seems to go through all
- // this to find the method to call.
-
- // if method name or length don't match, skip
- // Need to go through each arg
- // If arg is wrapper - check if method arg is matchable builtin
- // or same type or super
- // - check that method arg is same or super
-
- if (methodName.equals("new") && target instanceof Class)
- {
- Constructor ctors[] = klazz.getConstructors();
- for (int i = 0; i < ctors.length; i++)
- {
- // Skip methods with wrong number of args.
- Class ptypes[] = ctors[i].getParameterTypes();
- System.out.println("ptypeslen = " + ptypes.length);
- System.out.println("ptypes = " + ptypes);
- System.out.println("ctor = " + ctors[i].getName());
- for (int j=0; j < ptypes.length; j++) {
- System.out.println("param = " + ptypes[i].getName());
-
- }
-
-
- if (ptypes.length != args.length)
- continue;
-
- // Check if method matches
- if (!compatible(ptypes, argTypes))
- continue;
-
- // Use method[i] if it is more specific.
- // FIXME: should this check both directions and throw if
- // neither is more specific?
- if (ctor == null)
- {
- ctor = ctors[i];
- continue;
- }
- Class mptypes[] = ctor.getParameterTypes();
- if (moreSpecific(ptypes, mptypes))
- ctor = ctors[i];
- }
- if (ctor == null)
- throw new InstantiationException("No matching constructor for statement " + toString());
- return ctor.newInstance(args);
- }
-
- Method methods[] = klazz.getMethods();
-
- for (int i = 0; i < methods.length; i++)
- {
- // Skip methods with wrong name or number of args.
- if (!methods[i].getName().equals(methodName))
- continue;
- Class ptypes[] = methods[i].getParameterTypes();
- if (ptypes.length != args.length)
- continue;
-
- // Check if method matches
- if (!compatible(ptypes, argTypes))
- continue;
-
- // Use method[i] if it is more specific.
- // FIXME: should this check both directions and throw if
- // neither is more specific?
- if (method == null)
- {
- method = methods[i];
- continue;
- }
- Class mptypes[] = method.getParameterTypes();
- if (moreSpecific(ptypes, mptypes))
- method = methods[i];
- }
- if (method == null)
- throw new NoSuchMethodException("No matching method for statement " + toString());
- return method.invoke(target, args);
- }
-
-
-
- /** Return the statement arguments. */
- public Object[] getArguments() { return arguments; }
-
- /** Return the statement method name. */
- public String getMethodName() { return methodName; }
-
- /** Return the statement object. */
- public Object getTarget() { return target; }
-
- /** Return a string representation. */
- public String toString()
- {
- String result = target.getClass().getName() + "." + methodName + "(";
- String sep = "";
- for (int i = 0; i < arguments.length; i++)
- {
- result = result + sep + arguments[i].getClass().getName();
- sep = ", ";
- }
- result = result + ")";
- return result;
- }
-}
diff --git a/libjava/java/beans/VetoableChangeListener.java b/libjava/java/beans/VetoableChangeListener.java
deleted file mode 100644
index 5107954b033..00000000000
--- a/libjava/java/beans/VetoableChangeListener.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* VetoableChangeListener.java -- listen for a change which can be vetoed
- Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.util.EventListener;
-
-/**
- * VetoableChangeListener allows a class to monitor proposed changes to
- * properties of a Bean and, if desired, prevent them from occurring. A
- * vetoableChange() event will be fired after the property change has
- * been requested, but before it is permanent. If any listener rejects the
- * change by throwing the PropertyChangeException, a new vetoableChange()
- * event will be fired to all listeners who received a vetoableChange() event
- * in the first place, informing them to revert back to the old value. Thus,
- * the listener that threw the exception the first time should be prepared
- * to rethrow it the second time. The value, of course, never actually changed.
- *
- * VetoableChangeListener
-
- * associating a name with the listener. This can be used to filter the
- * changes that one is interested in.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.4
- * @status udpated to 1.4
- */
-public class VetoableChangeListenerProxy extends EventListenerProxy
- implements VetoableChangeListener
-{
- /**
- * The name of the property to listen for. Package visible for use by
- * VetoableChangeSupport.
- */
- final String propertyName;
-
- /**
- * Create a new proxy which filters property change events and only passes
- * changes to the named property on to the delegate.
- *
- * @param propertyName the property's name to filter on
- * @param listener the delegate listener
- */
- public VetoableChangeListenerProxy(String propertyName,
- VetoableChangeListener listener)
- {
- super(listener);
- this.propertyName = propertyName;
- }
-
- /**
- * Forwards the event on to the delegate if the property name matches.
- *
- * @param event the event to pass on, if it meets the filter
- * @throws NullPointerException if the delegate this was created with is null
- * @throws PropertyVetoException if the change is vetoed by the listener
- */
- public void vetoableChange(PropertyChangeEvent event)
- throws PropertyVetoException
- {
- // Note: Sun does not filter, under the assumption that since
- // VetoableChangeSupport unwraps proxys, this method should never be
- // called by normal use of listeners.
- String name = event == null ? null : event.getPropertyName();
- if (name == null ? propertyName == null : name.equals(propertyName))
- ((VetoableChangeListener) getListener()).vetoableChange(event);
- }
-
- /**
- * Gets the name of the property this proxy is filtering on.
- *
- * @return the property name
- */
- public String getPropertyName()
- {
- return propertyName;
- }
-} // class VetoableChangeListenerProxy
diff --git a/libjava/java/beans/VetoableChangeSupport.java b/libjava/java/beans/VetoableChangeSupport.java
deleted file mode 100644
index dce8dffd341..00000000000
--- a/libjava/java/beans/VetoableChangeSupport.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/* VetoableChangeSupport.java -- support to manage vetoable change listeners
- Copyright (C) 1998, 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.Vector;
-
-/**
- * VetoableChangeSupport makes it easy to fire vetoable change events and
- * handle listeners. It allows chaining of listeners, as well as filtering
- * by property name. In addition, it will serialize only those listeners
- * which are serializable, ignoring the others without problem. This class
- * is thread-safe.
- *
- * @author John Keiser
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public class VetoableChangeSupport implements Serializable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -5090210921595982017L;
-
- /**
- * Maps property names (String) to named listeners (VetoableChangeSupport).
- * If this is a child instance, this field will be null.
- *
- * @serial the map of property names to named listener managers
- * @since 1.2
- */
- private Hashtable children;
-
- /**
- * The non-null source object for any generated events.
- *
- * @serial the event source
- */
- private final Object source;
-
- /**
- * A field to compare serialization versions - this class uses version 2.
- *
- * @serial the serialization format
- */
- private static final int vetoableChangeSupportSerializedDataVersion = 2;
-
- /**
- * The list of all registered vetoable listeners. If this instance was
- * created by user code, this only holds the global listeners (ie. not tied
- * to a name), and may be null. If it was created by this class, as a
- * helper for named properties, then this vector will be non-null, and this
- * instance appears as a value in the children
hashtable of
- * another instance, so that the listeners are tied to the key of that
- * hashtable entry.
- */
- private transient Vector listeners;
-
- /**
- * Create a VetoableChangeSupport to work with a specific source bean.
- *
- * @param source the source bean to use
- * @throws NullPointerException if source is null
- */
- public VetoableChangeSupport(Object source)
- {
- this.source = source;
- if (source == null)
- throw new NullPointerException();
- }
-
- /**
- * Adds a VetoableChangeListener to the list of global listeners. All
- * vetoable change events will be sent to this listener. The listener add
- * is not unique: that is, n adds with the same listener will
- * result in n events being sent to that listener for every
- * vetoable change. Adding a null listener may cause a NullPointerException
- * down the road. This method will unwrap a VetoableChangeListenerProxy,
- * registering the underlying delegate to the named property list.
- *
- * @param l the listener to add
- */
- public synchronized void addVetoableChangeListener(VetoableChangeListener l)
- {
- if (l instanceof VetoableChangeListenerProxy)
- {
- VetoableChangeListenerProxy p = (VetoableChangeListenerProxy) l;
- addVetoableChangeListener(p.propertyName,
- (VetoableChangeListener) p.getListener());
- }
- else
- {
- if (listeners == null)
- listeners = new Vector();
- listeners.add(l);
- }
- }
-
- /**
- * Removes a VetoableChangeListener from the list of global listeners. If
- * any specific properties are being listened on, they must be deregistered
- * by themselves; this will only remove the general listener to all
- * properties. If add()
has been called multiple times for a
- * particular listener, remove()
will have to be called the
- * same number of times to deregister it. This method will unwrap a
- * VetoableChangeListenerProxy, removing the underlying delegate from the
- * named property list.
- *
- * @param l the listener to remove
- */
- public synchronized void
- removeVetoableChangeListener(VetoableChangeListener l)
- {
- if (l instanceof VetoableChangeListenerProxy)
- {
- VetoableChangeListenerProxy p = (VetoableChangeListenerProxy) l;
- removeVetoableChangeListener(p.propertyName,
- (VetoableChangeListener) p.getListener());
- }
- else if (listeners != null)
- {
- listeners.remove(l);
- if (listeners.isEmpty())
- listeners = null;
- }
- }
-
- /**
- * Returns an array of all registered vetoable change listeners. Those that
- * were registered under a name will be wrapped in a
- * VetoableChangeListenerProxy
, so you must check whether the
- * listener is an instance of the proxy class in order to see what name the
- * real listener is registered under. If there are no registered listeners,
- * this returns an empty array.
- *
- * @return the array of registered listeners
- * @see VetoableChangeListenerProxy
- * @since 1.4
- */
- public synchronized VetoableChangeListener[] getVetoableChangeListeners()
- {
- ArrayList list = new ArrayList();
- if (listeners != null)
- list.addAll(listeners);
- if (children != null)
- {
- int i = children.size();
- Iterator iter = children.entrySet().iterator();
- while (--i >= 0)
- {
- Entry e = (Entry) iter.next();
- String name = (String) e.getKey();
- Vector v = ((VetoableChangeSupport) e.getValue()).listeners;
- int j = v.size();
- while (--j >= 0)
- list.add(new VetoableChangeListenerProxy
- (name, (VetoableChangeListener) v.get(j)));
- }
- }
- return (VetoableChangeListener[])
- list.toArray(new VetoableChangeListener[list.size()]);
- }
-
- /**
- * Adds a VetoableChangeListener listening on the specified property. Events
- * will be sent to the listener only if the property name matches. The
- * listener add is not unique; that is, n adds on a particular
- * property for a particular listener will result in n events
- * being sent to that listener when that property is changed. The effect is
- * cumulative, too; if you are registered to listen to receive events on
- * all vetoable changes, and then you register on a particular property,
- * you will receive change events for that property twice. Adding a null
- * listener may cause a NullPointerException down the road. This method
- * will unwrap a VetoableChangeListenerProxy, registering the underlying
- * delegate to the named property list if the names match, and discarding
- * it otherwise.
- *
- * @param propertyName the name of the property to listen on
- * @param l the listener to add
- * @throws NullPointerException if propertyName is null
- */
- public synchronized void addVetoableChangeListener(String propertyName,
- VetoableChangeListener l)
- {
- while (l instanceof VetoableChangeListenerProxy)
- {
- VetoableChangeListenerProxy p = (VetoableChangeListenerProxy) l;
- if (propertyName == null ? p.propertyName != null
- : ! propertyName.equals(p.propertyName))
- return;
- l = (VetoableChangeListener) p.getListener();
- }
- VetoableChangeSupport s = null;
- if (children == null)
- children = new Hashtable();
- else
- s = (VetoableChangeSupport) children.get(propertyName);
- if (s == null)
- {
- s = new VetoableChangeSupport(source);
- s.listeners = new Vector();
- children.put(propertyName, s);
- }
- s.listeners.add(l);
- }
-
- /**
- * Removes a VetoableChangeListener from listening to a specific property.
- * If add()
has been called multiple times for a particular
- * listener on a property, remove()
will have to be called the
- * same number of times to deregister it. This method will unwrap a
- * VetoableChangeListenerProxy, removing the underlying delegate from the
- * named property list if the names match.
- *
- * @param propertyName the property to stop listening on
- * @param l the listener to remove
- * @throws NullPointerException if propertyName is null
- */
- public synchronized void
- removeVetoableChangeListener(String propertyName, VetoableChangeListener l)
- {
- if (children == null)
- return;
- VetoableChangeSupport s
- = (VetoableChangeSupport) children.get(propertyName);
- if (s == null)
- return;
- while (l instanceof VetoableChangeListenerProxy)
- {
- VetoableChangeListenerProxy p = (VetoableChangeListenerProxy) l;
- if (propertyName == null ? p.propertyName != null
- : ! propertyName.equals(p.propertyName))
- return;
- l = (VetoableChangeListener) p.getListener();
- }
- s.listeners.remove(l);
- if (s.listeners.isEmpty())
- {
- children.remove(propertyName);
- if (children.isEmpty())
- children = null;
- }
- }
-
- /**
- * Returns an array of all vetoable change listeners registered under the
- * given property name. If there are no registered listeners, this returns
- * an empty array.
- *
- * @return the array of registered listeners
- * @throws NullPointerException if propertyName is null
- * @since 1.4
- */
- public synchronized VetoableChangeListener[]
- getVetoableChangeListeners(String propertyName)
- {
- if (children == null)
- return new VetoableChangeListener[0];
- VetoableChangeSupport s
- = (VetoableChangeSupport) children.get(propertyName);
- if (s == null)
- return new VetoableChangeListener[0];
- return (VetoableChangeListener[])
- s.listeners.toArray(new VetoableChangeListener[s.listeners.size()]);
- }
-
- /**
- * Fire a PropertyChangeEvent containing the old and new values of the
- * property to all the global listeners, and to all the listeners for the
- * specified property name. This does nothing if old and new are non-null
- * and equal. If the change is vetoed, a new event is fired to notify
- * listeners about the rollback before the exception is thrown.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value
- * @param newVal the new value
- * @throws PropertyVetoException if the change is vetoed by a listener
- */
- public void fireVetoableChange(String propertyName,
- Object oldVal, Object newVal)
- throws PropertyVetoException
- {
- fireVetoableChange(new PropertyChangeEvent(source, propertyName,
- oldVal, newVal));
- }
-
- /**
- * Fire a PropertyChangeEvent containing the old and new values of the
- * property to all the global listeners, and to all the listeners for the
- * specified property name. This does nothing if old and new are equal.
- * If the change is vetoed, a new event is fired to notify listeners about
- * the rollback before the exception is thrown.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value
- * @param newVal the new value
- * @throws PropertyVetoException if the change is vetoed by a listener
- */
- public void fireVetoableChange(String propertyName, int oldVal, int newVal)
- throws PropertyVetoException
- {
- if (oldVal != newVal)
- fireVetoableChange(new PropertyChangeEvent(source, propertyName,
- new Integer(oldVal),
- new Integer(newVal)));
- }
-
- /**
- * Fire a PropertyChangeEvent containing the old and new values of the
- * property to all the global listeners, and to all the listeners for the
- * specified property name. This does nothing if old and new are equal.
- * If the change is vetoed, a new event is fired to notify listeners about
- * the rollback before the exception is thrown.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value
- * @param newVal the new value
- * @throws PropertyVetoException if the change is vetoed by a listener
- */
- public void fireVetoableChange(String propertyName,
- boolean oldVal, boolean newVal)
- throws PropertyVetoException
- {
- if (oldVal != newVal)
- fireVetoableChange(new PropertyChangeEvent(source, propertyName,
- Boolean.valueOf(oldVal),
- Boolean.valueOf(newVal)));
- }
-
- /**
- * Fire a PropertyChangeEvent to all the global listeners, and to all the
- * listeners for the specified property name. This does nothing if old and
- * new values of the event are equal. If the change is vetoed, a new event
- * is fired to notify listeners about the rollback before the exception is
- * thrown.
- *
- * @param event the event to fire
- * @throws NullPointerException if event is null
- * @throws PropertyVetoException if the change is vetoed by a listener
- */
- public void fireVetoableChange(PropertyChangeEvent event)
- throws PropertyVetoException
- {
- if (event.oldValue != null && event.oldValue.equals(event.newValue))
- return;
- Vector v = listeners; // Be thread-safe.
- if (v != null)
- {
- int i = v.size();
- try
- {
- while (--i >= 0)
- ((VetoableChangeListener) v.get(i)).vetoableChange(event);
- }
- catch (PropertyVetoException e)
- {
- event = event.rollback();
- int limit = i;
- i = v.size();
- while (--i >= limit)
- ((VetoableChangeListener) v.get(i)).vetoableChange(event);
- throw e;
- }
- }
- Hashtable h = children; // Be thread-safe.
- if (h != null && event.propertyName != null)
- {
- VetoableChangeSupport s
- = (VetoableChangeSupport) h.get(event.propertyName);
- if (s != null)
- {
- Vector v1 = s.listeners; // Be thread-safe.
- int i = v1 == null ? 0 : v1.size();
- try
- {
- while (--i >= 0)
- ((VetoableChangeListener) v1.get(i)).vetoableChange(event);
- }
- catch (PropertyVetoException e)
- {
- event = event.rollback();
- int limit = i;
- i = v.size();
- while (--i >= 0)
- ((VetoableChangeListener) v.get(i)).vetoableChange(event);
- i = v1.size();
- while (--i >= limit)
- ((VetoableChangeListener) v1.get(i)).vetoableChange(event);
- throw e;
- }
- }
- }
- }
-
- /**
- * Tell whether the specified property is being listened on or not. This
- * will only return true
if there are listeners on all
- * properties or if there is a listener specifically on this property.
- *
- * @param propertyName the property that may be listened on
- * @return whether the property is being listened on
- * @throws NullPointerException if propertyName is null
- */
- public synchronized boolean hasListeners(String propertyName)
- {
- return listeners != null || (children != null
- && children.get(propertyName) != null);
- }
-
- /**
- * Saves the state of the object to the stream.
- *
- * @param s the stream to write to
- * @throws IOException if anything goes wrong
- * @serialData this writes out a null-terminated list of serializable
- * global vetoable change listeners (the listeners for a named
- * property are written out as the global listeners of the
- * children, when the children hashtable is saved)
- */
- private synchronized void writeObject(ObjectOutputStream s)
- throws IOException
- {
- s.defaultWriteObject();
- if (listeners != null)
- {
- int i = listeners.size();
- while (--i >= 0)
- if (listeners.get(i) instanceof Serializable)
- s.writeObject(listeners.get(i));
- }
- s.writeObject(null);
- }
-
- /**
- * Reads the object back from stream (deserialization).
- *
- * XXX Since serialization for 1.1 streams was not documented, this may
- * not work if vetoableChangeSupportSerializedDataVersion is 1.
- *
- * @param s the stream to read from
- * @throws IOException if reading the stream fails
- * @throws ClassNotFoundException if deserialization fails
- * @serialData this reads in a null-terminated list of serializable
- * global vetoable change listeners (the listeners for a named
- * property are written out as the global listeners of the
- * children, when the children hashtable is saved)
- */
- private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
- VetoableChangeListener l = (VetoableChangeListener) s.readObject();
- while (l != null)
- {
- addVetoableChangeListener(l);
- l = (VetoableChangeListener) s.readObject();
- }
- // Sun is not as careful with children as we are, and lets some proxys
- // in that can never receive events. So, we clean up anything that got
- // serialized, to make sure our invariants hold.
- if (children != null)
- {
- int i = children.size();
- Iterator iter = children.entrySet().iterator();
- while (--i >= 0)
- {
- Entry e = (Entry) iter.next();
- String name = (String) e.getKey();
- VetoableChangeSupport vcs = (VetoableChangeSupport) e.getValue();
- if (vcs.listeners == null)
- vcs.listeners = new Vector();
- if (vcs.children != null)
- vcs.listeners.addAll
- (Arrays.asList(vcs.getVetoableChangeListeners(name)));
- if (vcs.listeners.size() == 0)
- iter.remove();
- else
- vcs.children = null;
- }
- if (children.size() == 0)
- children = null;
- }
- }
-} // class VetoableChangeSupport
diff --git a/libjava/java/beans/Visibility.java b/libjava/java/beans/Visibility.java
deleted file mode 100644
index 428f3a2073b..00000000000
--- a/libjava/java/beans/Visibility.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* java.beans.Visibility
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans;
-
-/**
- * Visibility is an interface a Bean may implement so that the environment
- * can tell the Bean whether there is a GUI or not, and so that the Bean
- * can tell the environment whether it needs one or can run without one.
- *
- * <java>
- * <string>Hello World</string>
- * <int>200</int>
- * </java>
- *
- * String
and the Integer
instance the following can be used (assume
- * the XML data can be obtained from the InputStream):
- * XMLDecoder decoder = new XMLDecoder(inputStreamContainingXMLData);
- * String message = (String) decoder.readObject();
- * Integer number = (Integer) decoder.readObject();
- *
- * XMLDecoder
has some more features that might come
- * handy in certain situations:setOwner
method which can then be accessed when
- * decoding. This feature is only useful if the XML data is aware of the owner object. Such data may
- * look like this (assume that the owner object is a JFrame instance):
- * <java>
- * <void method="getOwner">
- * <void method="setVisible">
- * <boolean>true<boolean>
- * </void>
- * </void>
- * </java>
- *
- * This accesses the JFrame
and makes it visible using the setVisible
method.
- * XMLDecoder
is created with no {@link ExceptionListener} instance a default one
- * is used that prints an error message to System.err
whenever a recoverable exception
- * is thrown. Recovarable exceptions occur when the XML data cannot be interpreted correctly (e.g
- * unknown classes or methods, invocation on null, ...). In general be very careful when the
- * XMLDecoder
provoked such exceptions because the resulting object(s) may be in an
- * undesirable state.readObject
has been called
- * once has no effect because the decoding is completed then.ClassLoader
which is then used when Class
- * objects are accessed. See {@link java.lang.Class#forName(String, boolean, ClassLoader)} for details
- * on this.InputStream
instance given to any of the constructors is null
- * the resulting XMLDecoder
will be silently (without any exception) useless. Each call
- * to readObject
will return null
and never throws an
- * ArrayIndexOutOfBoundsException
.Class.forName(String, boolean, ClassLoader)
- * @since 1.5
- */
- public XMLDecoder(
- InputStream in,
- Object owner,
- ExceptionListener listener,
- ClassLoader cl)
- {
- // initially here was a check for the validity of the InputStream argument but some
- // great engineers decided that this API should silently discard this and behave rather
- // odd: readObject will always return null ...
- inputStream = in;
-
- setExceptionListener(listener);
-
- // validity of this object is checked in Class.forName() and therefore may be null
- classLoader = cl;
-
- this.owner = owner;
- }
-
- /** Closes the stream associated with this decoder. This should be done after having read all
- * decoded objects.
- * close
.close
method was already called a NoSuchElementException
- * is thrown.null
this method
- * will always return null
itself.BeanContext
s.
- * Collections
interface
- * documentation with special information for BeanContext
- * implementors, I'll have to document special requirements for
- * implementors of those functions here.
- * add()
or addAll()
:
- *
- *
- *
- * Object
into the hierarchy as well as a
- * BeanContextChild
, BeanContext
or
- * BeanContextProxy
object.
- * This way, any Bean can be in the hierarchy.
- * BeanContext.globalHierarchyLock
.
- * Object
if it's already there (only once
- * per BeanContext
).
- * BeanContextChild
implementor, call
- * setBeanContext()
on it. If it's a
- * BeanContextProxy
implementor, call
- * getBeanContextProxy().setBeanContext()
on it.
- * If setBeanContext()
vetoes the change, back out
- * all changes so far and throw IllegalStateException
.
- * Visibility
, call
- * dontUseGui()
or okToUseGui()
on it,
- * depending on whether you (the BeanContext
) feel like
- * allowing it to use the GUI or not.
- * BeanContextChild
or
- * BeanContextProxy
, register yourself (the
- * BeanContext
) as both a
- * PropertyChangeListener
and
- * VetoableChangeListener
on the "beanContext"
- * property (it may also add itself on any other properties it wishes
- * to).
- * BeanContext
) are interested in, you may register
- * yourself to it or register it to you.
- * java.beans.beancontext.BeanContextMembershipEvent
- * before exiting. addAll()
should wait until everything
- * is done changing before firing the event (or events) so that if a
- * failure occurs, the backing-out process can proceed without any
- * events being fired at all.
- * remove()
or removeAll()
:
- *
- *
- *
- * BeanContext.globalHierarchyLock
.
- * Object
is not a child of this
- * BeanContext
, just exit without performing any actions.
- * Object
from your collection of children.
- * BeanContextChild
implementor, call
- * setBeanContext(null)
on it. If it's a
- * BeanContextProxy
implementor, call
- * getBeanContextProxy().setBeanContext(null)
on it.
- * If setBeanContext()
vetoes the change, back out
- * all changes so far and throw IllegalStateException
.
- * Object
to listen to you or
- * registered yourself as a listener on the Object
during
- * add()
or addAll()
, undo the registration
- * bycalling the appropriate removeListener()
method.
- * java.beans.beancontext.BeanContextMembershipEvent
- * before exiting. removeAll()
should wait until
- * everything is done changing before firing the event (or events) so
- * that if a failure occurs, the backing-out process can proceed
- * without any events being fired at all.
- * addAll()
, removeAll()
,
- * retainAll()
and clear()
do not need to be
- * implemented, but may be if so desired.
- * Visibility
and DesignMode
methods
- * should propagate changed values to children that implement interfaces
- * of the same name.
- *
- *
- *
- * @fixme fill in the rest of the methods which use the global lock.
- */
- Object globalHierarchyLock = new Object();
-
- /**
- * Instantiate a Bean using this Bean's BeanContext.add()
and addAll()
- * ClassLoader
- * and this BeanContext
as the parent.
- * BeanContext
- * implementations can perform extra actions on Beans that are
- * created within them.
- *
- * @param beanName the name of the bean to instantiate
- * @return the created Bean
- *
- * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String)
- * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String,java.lang.BeanContext)
- * @exception IOException if there is an I/O problem during
- * instantiation.
- * @exception ClassNotFoundException if a serialized Bean's class
- * is not found.
- */
- Object instantiateChild(String beanName)
- throws IOException,
- ClassNotFoundException;
-
- /**
- * Get a resource. The BeanContext
will typically
- * call ClassLoader.getResource()
, but may do it any
- * way it wants to. This allows a BeanContext
to
- * have its own set of resources separate from the rest of the
- * system.
- * ClassLoader
method.
- * BeanContext
cannot find a resource, its
- * responsibility is to call the getResource
method
- * of its parent BeanContext
.
- *
- * @return a URL to the requested resource.
- * @param resourceName the name of the resource requested.
- * @param requestor a reference to the child requesting the resource.
- * @see java.lang.ClassLoader#getResource(java.lang.String)
- */
- URL getResource(String resourceName, BeanContextChild requestor);
-
- /**
- * Get a resource as a stream. The BeanContext
will
- * typically call ClassLoader.getResourceAsStream()
,
- * but may do it any way it wants to. This allows a
- * BeanContext
's children to have their own set of
- * resources separate from the rest of the system.
- * ClassLoader
method.
- * BeanContext
cannot find a resource, its
- * responsibility is to call the getResourceAsStream
- * method of its parent BeanContext
.
- *
- * @return the requested resource as a stream.
- * @param resourceName the name of the resource requested.
- * @param requestor a reference to the child requesting the resource.
- * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)
- */
- InputStream getResourceAsStream(String resourceName, BeanContextChild requestor);
-
- /**
- * Add a listener on changes to the membership of this
- * BeanContext
object.
- * @param listener the listener to add.
- */
- void addBeanContextMembershipListener(BeanContextMembershipListener listener);
-
- /**
- * Remove a listener on changes to the membership of this
- * BeanContext
object.
- * @param listener the listener to remove.
- */
- void removeBeanContextMembershipListener(BeanContextMembershipListener listener);
-}
diff --git a/libjava/java/beans/beancontext/BeanContextChild.java b/libjava/java/beans/beancontext/BeanContextChild.java
deleted file mode 100644
index d1115efac85..00000000000
--- a/libjava/java/beans/beancontext/BeanContextChild.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/* java.beans.beancontext.BeanContextChild
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyVetoException;
-import java.beans.VetoableChangeListener;
-
-/**
- * Beans implement this to get information about the execution environment and
- * its services and to be placed in the hierarchy.
- * BeanContext
and a
- * BeanContextChild
, mainly, is that a
- * BeanContext
may be a parent.
- * BeanContextChild
instances will be serialized at some
- * point in their life, but you need to make sure your bean context does
- * not contain a serializable reference (directly or indirectly) to the
- * parent BeanContext
, to any of the other
- * BeanContext
s in the tree, or to any resources obtained
- * via the BeanContextServices
interface. One way to do this
- * is to mark any fields that contain such references as
- * transient
. Another way is to use a custom serializer.
- * BeanContext
is serialized,
- * all the other BeanContext
s and other unnecessary things
- * will be serialized along with it.
- * BeanContextChild
should call
- * getBeanContext().remove(this)
to detach from the
- * hierarchy and exit cleanly.
- *
- * @author John Keiser
- * @since JDK1.2
- * @see java.beans.beancontext.BeanContext
- */
-
-public interface BeanContextChild {
- /**
- * Set the parent BeanContext
.
- * BeanContext.add()
and
- * should not be called directly.
- * BeanContext
, setBeanContext()
will
- * receive the parameter null
.
- * BeanContext
,
- * it is the BeanContextChild
's responsibility to
- * release all services it has obtained.
- * PropertyChangeEvent
- * and VetoableChangeEvent
s with the property name
- * "beanContext". If the change is vetoed, it must re-throw the
- * exception and not change anything. In this way, the parent
- * BeanContextChild
, who has registered himself with
- * you, will have a chance to remove this child from its
- * collection.
- * PropertyVetoException
.
- * If you veto a setBeanContext(null)
call, then you
- * should try your hardest to remedy whatever problem is keeping
- * you from being removed from the BeanContext
so
- * that you can not veto it the next time.
- * Otherwise, nasty pathological recursion stuff could occur in
- * certain situations.
- * BeanContext.add()
and
- * should not be called directly.
- *
- * @param parent the new parent for the BeanContextChild
,
- * or null
to signify removal from a tree.
- * @exception PropertyVetoException if the
- * BeanContextChild
implementor does not
- * wish to have its parent changed.
- */
- void setBeanContext(BeanContext parent)
- throws PropertyVetoException;
-
- /**
- * Get the parent BeanContext
.
- * @return the parent BeanContext
.
- */
- BeanContext getBeanContext();
-
- /**
- * Add a listener that will be notified when a specific property changes.
- * @param prop the name of the property to listen on
- * @param listener the listener to listen on the property.
- */
- void addPropertyChangeListener(String prop, PropertyChangeListener listener);
-
- /**
- * Remove a listener to a certain property.
- * @param prop the name of the property being listened on
- * @param listener the listener listening on the property.
- */
- void removePropertyChangeListener(String prop, PropertyChangeListener listener);
-
- /**
- * Add a listener that will be notified when a specific property
- * change is requested (a PropertyVetoException may be thrown) as
- * well as after the change is successfully made.
- *
- * @param prop the name of the property to listen on
- * @param listener the listener to listen on the property.
- */
- void addVetoableChangeListener(String prop, VetoableChangeListener listener);
-
- /**
- * Remove a listener to a certain property.
- * @param prop the name of the property being listened on
- * @param listener the listener listening on the property.
- */
- void removeVetoableChangeListener(String prop, VetoableChangeListener listener);
-}
diff --git a/libjava/java/beans/beancontext/BeanContextChildComponentProxy.java b/libjava/java/beans/beancontext/BeanContextChildComponentProxy.java
deleted file mode 100644
index a8d6e34045e..00000000000
--- a/libjava/java/beans/beancontext/BeanContextChildComponentProxy.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* java.beans.beancontext.BeanContextChildComponentProxy
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.awt.Component;
-
-/**
- * Interface for BeanContextChild
s which wish to associate an
- * AWT component with them. The proxy is provided because the
- * addPropertyChangeListener()
method would conflict with
- * Component
if you tried to extend.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContextChildComponentProxy {
- /**
- * Get the Component
associated with this BeanContextChild
.
- * @return the Component
associated with this
- * BeanContextChild
.
- */
- Component getComponent();
-}
diff --git a/libjava/java/beans/beancontext/BeanContextChildSupport.java b/libjava/java/beans/beancontext/BeanContextChildSupport.java
deleted file mode 100644
index 4444ad71377..00000000000
--- a/libjava/java/beans/beancontext/BeanContextChildSupport.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/* java.beans.beancontext.BeanContextChildSupport
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.beans.PropertyVetoException;
-import java.beans.VetoableChangeListener;
-import java.beans.VetoableChangeSupport;
-import java.io.Serializable;
-
-/**
- * Support for creating a BeanContextChild
.
- * This class contains the most common implementations of the methods in
- * the BeanContextChild
- *
- * @specnote This class is not very well specified. I had to "fill in the
- * blanks" in most places with what I thought was reasonable
- * behavior. If there are problems, let me know.
- *
- * @author John Keiser
- * @since 1.2
- * @see java.beans.beancontext.BeanContextChild
- */
-public class BeanContextChildSupport
- implements BeanContextChild, BeanContextServicesListener, Serializable
-{
- static final long serialVersionUID = 6328947014421475877L;
-
- /**
- * The peer on which to perform set
actions.
- * This is here so that this class can be used as a peer.
- * this
.
- */
- public BeanContextChild beanContextChildPeer;
-
- /**
- * The parent BeanContext
.
- */
- protected transient BeanContext beanContext;
-
- /**
- * If setBeanContext()
was vetoed once before, this
- * is set to true
so that the next time, vetoes will
- * be ignored.
- */
- protected transient boolean rejectedSetBCOnce;
-
- /**
- * Listeners are registered here and events are fired through here.
- */
- protected PropertyChangeSupport pcSupport;
-
- /**
- * Listeners are registered here and events are fired through here.
- */
- protected VetoableChangeSupport vcSupport;
-
- /**
- * Create a new BeanContextChildSupport
with itself as the peer.
- * This is meant to be used when you subclass
- * BeanContextChildSupport
to create your child.
- */
- public BeanContextChildSupport()
- {
- this (null);
- }
-
- /**
- * Create a new BeanContextChildSupport
with the specified peer.
- * @param peer the peer to use, or null
to specify
- * this
.
- */
- public BeanContextChildSupport (BeanContextChild peer)
- {
- if (peer == null)
- {
- peer = this;
- }
-
- beanContextChildPeer = peer;
- pcSupport = new PropertyChangeSupport (peer);
- vcSupport = new VetoableChangeSupport (peer);
- }
-
- /**
- * Set the parent BeanContext
.
- * BeanContext
, setBeanContext()
will
- * receive the parameter null
.
- *
- *
- * BeanContext
is the same as the old
- * one, nothing happens.
- * validatePendingSetBeanContext()
. If this call
- * returns false
, the change is rejected and a
- * PropertyVetoException
is thrown.
- * VetoableChangeEvent
s are fired with the name
- * "beanContext"
, using the
- * fireVetoableChange()
method. If a veto
- * occurs, reversion events are fired using the same method,
- * the change is rejected, and the veto is rethrown.
- * releaseBeanContextResources()
is called.
- * PropertyChangeEvent
s are fired using the
- * firePropertyChange()
method.
- * initializeBeanContextResources()
is called.
- * BeanContextChild
, or null
to
- * signify removal from a tree.
- * @exception PropertyVetoException if the
- * BeanContextChild
implementor does not
- * wish to have its parent changed.
- */
- public void setBeanContext(BeanContext newBeanContext)
- throws PropertyVetoException
- {
- synchronized (beanContextChildPeer)
- {
- if (newBeanContext == beanContext)
- return;
-
- if (!rejectedSetBCOnce)
- {
- if (!validatePendingSetBeanContext (newBeanContext))
- {
- rejectedSetBCOnce = true;
- throw new PropertyVetoException ("validatePendingSetBeanContext() rejected change",
- new PropertyChangeEvent(beanContextChildPeer, "beanContext", beanContext, newBeanContext));
- }
-
- try
- {
- fireVetoableChange ("beanContext", beanContext, newBeanContext);
- }
- catch (PropertyVetoException e)
- {
- rejectedSetBCOnce = true;
- throw e;
- }
- }
-
- releaseBeanContextResources ();
-
- beanContext = newBeanContext;
- rejectedSetBCOnce = false;
-
- firePropertyChange ("beanContext", beanContext, newBeanContext);
-
- initializeBeanContextResources ();
- }
- }
-
- /**
- * Get the parent BeanContext
.
- * @return the parent BeanContext
.
- */
- public BeanContext getBeanContext()
- {
- return beanContext;
- }
-
- /**
- * Get the peer (or this
if there is no peer).
- * @return the peer, or this
if there is no peer.
- */
- public BeanContextChild getBeanContextChildPeer() {
- return beanContextChildPeer;
- }
-
- /**
- * Determine whether there is a peer.
- * This is true iff getBeanContextChildPeer() == this
.
- * @return whether there is a peer.
- */
- public boolean isDelegated() {
- return beanContextChildPeer == this;
- }
-
- /**
- * Add a listener that will be notified when a specific property changes.
- * @param propertyName the name of the property to listen on.
- * @param listener the listener to listen on the property.
- */
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- pcSupport.addPropertyChangeListener(propertyName, listener);
- }
-
- /**
- * Remove a listener to a certain property.
- *
- * @param propertyName the name of the property being listened on.
- * @param listener the listener listening on the property.
- */
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- pcSupport.removePropertyChangeListener(propertyName, listener);
- }
-
- /**
- * Add a listener that will be notified when a specific property
- * change is requested (a PropertyVetoException may be thrown) as
- * well as after the change is successfully made.
- *
- * @param propertyName the name of the property to listen on.
- * @param listener the listener to listen on the property.
- */
- public void addVetoableChangeListener(String propertyName, VetoableChangeListener listener) {
- vcSupport.addVetoableChangeListener(propertyName, listener);
- }
-
- /**
- * Remove a listener to a certain property.
- *
- * @param propertyName the name of the property being listened on
- * @param listener the listener listening on the property.
- */
- public void removeVetoableChangeListener(String propertyName, VetoableChangeListener listener) {
- vcSupport.removeVetoableChangeListener(propertyName, listener);
- }
-
- /**
- * Fire a property change.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value of the property
- * @param newVal the new value of the property
- */
- public void firePropertyChange(String propertyName, Object oldVal, Object newVal) {
- pcSupport.firePropertyChange(propertyName, oldVal, newVal);
- }
-
- /**
- * Fire a vetoable property change.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value of the property
- * @param newVal the new value of the property
- * @exception PropertyVetoException if the change is vetoed.
- */
- public void fireVetoableChange(String propertyName, Object oldVal, Object newVal)
- throws PropertyVetoException {
- vcSupport.fireVetoableChange(propertyName, oldVal, newVal);
- }
-
- /**
- * Called by BeanContextServices.revokeService()
to indicate that a service has been revoked.
- * If you have a reference to such a service, it should be
- * discarded and may no longer function properly.
- * getService()
will no longer work on the specified
- * service class after this event has been fired.
- * BeanContextChildSupport
's implementation does
- * nothing.
- *
- * @param event the service revoked event.
- * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean)
- */
- public void serviceRevoked(BeanContextServiceRevokedEvent event) {
- }
-
- /**
- * Called by BeanContextServices
whenever a service is made available.
- * BeanContextChildSupport
's implementation does
- * nothing.
- *
- * @param event the service revoked event, with useful information
- * about the new service.
- */
- public void serviceAvailable(BeanContextServiceAvailableEvent event) {
- }
-
- /**
- * Called by setBeanContext()
to determine whether the set should be rejected.
- * BeanContextChildSupport
's implementation simply
- * returns true
.
- *
- * @param newBeanContext the new parent.
- * @return whether to allow the parent to be changed to the new
- * value.
- */
- public boolean validatePendingSetBeanContext(BeanContext newBeanContext) {
- return true;
- }
-
- /**
- * Called by setBeanContext()
to release resources of a what will soon no longer be the parent.
- * BeanContextChildSupport
's implementation does
- * nothing.
- */
- protected void releaseBeanContextResources() {
- }
-
- /**
- * Called by setBeanContext()
to grab resources when the parent has been set.
- * BeanContextChildSupport
's implementation does
- * nothing.
- */
- protected void initializeBeanContextResources() {
- }
-}
diff --git a/libjava/java/beans/beancontext/BeanContextContainerProxy.java b/libjava/java/beans/beancontext/BeanContextContainerProxy.java
deleted file mode 100644
index 3df91038bfe..00000000000
--- a/libjava/java/beans/beancontext/BeanContextContainerProxy.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* java.beans.beancontext.BeanContextContainerProxy
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.awt.Container;
-
-/**
- * Interface for BeanContext
s which wish to associate an
- * AWT container with them. The proxy is provided because the
- * addPropertyChangeListener()
and add()
methods
- * would conflict with Component
and Container
- * if you tried to extend.
- *
- * @specnote It is unclear whether anything besides BeanContext
s
- * are allowed to implement this interface.
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContextContainerProxy {
- /**
- * Get the Container
associated with this BeanContext
.
- * @return the Container
associated with this
- * BeanContext
.
- */
- Container getContainer();
-}
diff --git a/libjava/java/beans/beancontext/BeanContextEvent.java b/libjava/java/beans/beancontext/BeanContextEvent.java
deleted file mode 100644
index f326541b034..00000000000
--- a/libjava/java/beans/beancontext/BeanContextEvent.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/* java.beans.beancontext.BeanContextEvent
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.util.EventObject;
-
-/**
- * Generic superclass for events fired by BeanContext
s.
- *
- * @author John Keiser
- * @since 1.2
- */
-
-public abstract class BeanContextEvent extends EventObject
-{
- private static final long serialVersionUID = 7267998073569045052L;
-
- /**
- * The BeanContext
that most recently passed this
- * event on.
- */
- protected BeanContext propagatedFrom;
-
- /**
- * Create a new event, from the specified BeanContext
.
- * propagatedFrom
will be initialized to
- * null
.
- *
- * @param source the source of the event.
- */
- protected BeanContextEvent(BeanContext source)
- {
- super(source);
- }
-
- /**
- * Get the BeanContext
that originated this event.
- * @return the originator of this event.
- */
- public BeanContext getBeanContext()
- {
- return (BeanContext)getSource();
- }
-
- /**
- * Get the most recent propagator of this event.
- * If this value is null
, you have received the event
- * straight from the source.
- *
- * @return the most recent propagator of this event.
- */
- public BeanContext getPropagatedFrom()
- {
- return propagatedFrom;
- }
-
- /**
- * Tell whether this event has been propagated.
- * @return true
iff getPropagatedFrom() != null
.
- */
- public boolean isPropagated()
- {
- return propagatedFrom != null;
- }
-
- /**
- * Set the most recent propagator of this event.
- * @param propagator the most recent propagator of this event.
- */
- public void setPropagatedFrom(BeanContext propagator)
- {
- propagatedFrom = propagator;
- }
-}
diff --git a/libjava/java/beans/beancontext/BeanContextMembershipEvent.java b/libjava/java/beans/beancontext/BeanContextMembershipEvent.java
deleted file mode 100644
index 31765426622..00000000000
--- a/libjava/java/beans/beancontext/BeanContextMembershipEvent.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/* java.beans.beancontext.BeanContextMembershipEvent
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * Event fired when children are added to or removed from a BeanContext
.
- * Whether they were added or removed depends entirely on which method
- * of the listener interface was called.
- *
- * @author John Keiser
- * @since 1.2
- * @see java.beans.beancontext.BeanContextMembershipListener
- */
-public class BeanContextMembershipEvent extends BeanContextEvent {
- /**
- * The children that were added or removed.
- */
- protected Collection children;
-
- /**
- * Create a new membership event.
- * @param context the event source.
- * @param children the children added to or removed from the source.
- */
- public BeanContextMembershipEvent(BeanContext context, Collection children) {
- super(context);
- this.children = children;
- }
-
- /**
- * Create a new membership event.
- * @param context the event source.
- * @param children the children added to or removed from the source.
- */
- public BeanContextMembershipEvent(BeanContext context, Object[] children) {
- super(context);
- this.children = Arrays.asList(children);
- }
-
- /**
- * The number of children removed or added.
- * @return the number of children removed or added.
- */
- public int size() {
- return children.size();
- }
-
- /**
- * An iterator that will step through all the children.
- * @return an iterator over all the children.
- */
- public Iterator iterator() {
- return children.iterator();
- }
-
- /**
- * An array of the children.
- * @return an array of the children.
- */
- public Object[] toArray() {
- return children.toArray();
- }
-
- /**
- * Tell whether the Object
is one of the children added or removed.
- * @param child the child to check.
- * @return whether the Object
is added or removed.
- */
- public boolean contains(Object child) {
- return children.contains(child);
- }
-}
diff --git a/libjava/java/beans/beancontext/BeanContextMembershipListener.java b/libjava/java/beans/beancontext/BeanContextMembershipListener.java
deleted file mode 100644
index d39c36c4b12..00000000000
--- a/libjava/java/beans/beancontext/BeanContextMembershipListener.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* java.beans.beancontext.BeanContextMembershipListener
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.util.EventListener;
-
-/**
- * This is the interface to which BeanContextMembershipEvent
s are sent.
- * This happens when children are added to or removed from a
- * BeanContext
.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContextMembershipListener extends EventListener {
- /**
- * When beans are added to a BeanContext
,
- * this method is called to fire the event.
- *
- * @param event the event, including which children were added.
- * @see java.beans.beancontext.BeanContext#add(java.lang.Object)
- */
- void childrenAdded(BeanContextMembershipEvent event);
-
- /**
- * When beans are removed from a BeanContext
,
- * this method is called to fire the event.
- *
- * @param event the event, including which children were removed.
- * @see java.beans.beancontext.BeanContext#remove(java.lang.Object)
- */
- void childrenRemoved(BeanContextMembershipEvent event);
-}
diff --git a/libjava/java/beans/beancontext/BeanContextProxy.java b/libjava/java/beans/beancontext/BeanContextProxy.java
deleted file mode 100644
index 49dd7a77f30..00000000000
--- a/libjava/java/beans/beancontext/BeanContextProxy.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* java.beans.beancontext.BeanContextProxy
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-/**
- * Beans that wish to have a BeanContextChild
or BeanContext
associated with them
- * but do not wish to implement those interfaces directly, can implement this interface.
- * BeanContextChild
, directly or indirectly, the whole
- * workings of this package will be unpredictable because it is
- * indeterminate as to whether the BeanContextChild
is used
- * in preference to its proxy or vice versa.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContextProxy {
- /**
- * Return the BeanContextChild
associated with this
- * Object
.
- *
- * @return the BeanContextChild
associated with this
- * Object
.
- */
- BeanContextChild getBeanContextProxy();
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServiceAvailableEvent.java b/libjava/java/beans/beancontext/BeanContextServiceAvailableEvent.java
deleted file mode 100644
index eea10f261b6..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServiceAvailableEvent.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* java.beans.beancontext.BeanContextServiceAvailableEvent
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.util.Iterator;
-
-/**
- * Event fired when new services become available through a BeanContextServices
.
- *
- * @author John Keiser
- * @since JDK1.2
- * @see java.beans.beancontext.BeanContextServicesListener
- */
-
-public class BeanContextServiceAvailableEvent extends BeanContextEvent {
- /**
- * The Class
representing the service which is now
- * available.
- */
- protected Class serviceClass;
-
- /**
- * Create a new service available event.
- * @param services the BeanContextServices
through
- * which the service is available. This is also the source
- * of the event.
- * @param serviceClass the service class that is now available.
- */
- public BeanContextServiceAvailableEvent(BeanContextServices services, Class serviceClass) {
- super(services);
- this.serviceClass = serviceClass;
- }
-
- /**
- * Get the current service selectors of the service class.
- * This is identical to getSourceAsBeanContextServices().getCurrentServiceSelectors(getServiceClass())
- * @return the current service selectors of the service class.
- */
- public Iterator getCurrentServiceSelectors() {
- return getSourceAsBeanContextServices().getCurrentServiceSelectors(serviceClass);
- }
-
- /**
- * Get the newly available service class.
- * @return the service class.
- */
- public Class getServiceClass() {
- return serviceClass;
- }
-
- /**
- * Get the BeanContextServices
through which the new service is available.
- * @return the BeanContextServices
through which the
- * new service is available.
- */
- public BeanContextServices getSourceAsBeanContextServices() {
- return (BeanContextServices)getSource();
- }
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServiceProvider.java b/libjava/java/beans/beancontext/BeanContextServiceProvider.java
deleted file mode 100644
index c09b5815fd7..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServiceProvider.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/* java.beans.beancontext.BeanContextServiceProvider
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.util.Iterator;
-
-/**
- * An actual factory for services.
- * BeanContextServiceProvider
's responsibility to
- * register itself with whatever BeanContextServices
object
- * it wishes to provide services through using the
- * addService()
method.
- * BeanContextServices.revokeService(serviceClass,this,true)
- * for all the places it has registered the service.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContextServiceProvider {
- /**
- * Get a service.
- * Called from BeanContextServices.getService()
.
- *
- * BeanContextServiceProvider
chooses not honor the
- * request for some reason, then this method will return
- * null
.BeanContextServices
that wants
- * to get the service. Only weak references to this will
- * be retained, and it will never be changed, only queried
- * in a read-only manner.
- * @param requestor the actual requestor of the service. Only
- * weak references to this will be retained, and it will
- * never be changed, only queried in a read-only manner.
- * @param serviceClass the Class
of the service being
- * requested.
- * @param serviceSelector a parameter to customize the service
- * returned with.
- * @return an instance of serviceClass
(such that
- * instanceof
serviceClass is true), or
- * null
.
- * @see java.beans.beancontext.BeanContextServices#getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener)
- */
- Object getService(BeanContextServices services, Object requestor, Class serviceClass, Object serviceSelector);
-
- /**
- * Release the service.
- * BeanContextServices.releaseService()
.
- * BeanContextServiceProvider
s won't have to do
- * anything here.
- *
- * @param services the BeanContextServices
that wants
- * to release the service. Only weak references to this will
- * be retained, and it will never be changed, only queried
- * in a read-only manner.
- * @param requestor the original requestor of the service.
- * @param service the service to relinquish
- * @see java.beans.beancontext.BeanContextServices#releaseService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Object)
- */
- void releaseService(BeanContextServices services, Object requestor, Object service);
-
- /**
- * Get a list of valid service selectors for the specified service class.
- * This method is called from
- * BeanContextServices.getCurrentServiceSelectors()
.
- * null
.
- * If it takes a general Integer
parameter, for
- * example, you may as well return null
or the poor
- * soul who called this method will be iterating all day.
- * Iterator
.
- *
- * @param services the BeanContextServices
that wants
- * to get the service selectors. Only weak references to this will
- * be retained, and it will never be changed, only queried
- * in a read-only manner.
- * @param serviceClass the service class to get selectors for.
- * @return a list of valid service selectors for the service
- * class, or null
.
- * @see java.beans.beancontext.BeanContextServices#getCurrentServiceSelectors(java.lang.Class)
- */
- Iterator getCurrentServiceSelectors(BeanContextServices services, Class serviceClass);
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java b/libjava/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
deleted file mode 100644
index 690b94e2cc7..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* java.beans.beancontext.BeanContextServiceProviderBeanInfo
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.beans.BeanInfo;
-
-/**
- * BeanContextServiceProvider
s implement this to provide information about all of the services they provide.
- * BeanInfo
s for all of the service classes of this BeanInfoServiceProvider
.
- * @return BeanInfo
s for all provided service classes.
- */
- BeanInfo[] getServicesBeanInfo();
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServiceRevokedEvent.java b/libjava/java/beans/beancontext/BeanContextServiceRevokedEvent.java
deleted file mode 100644
index dfa2b89b3ae..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServiceRevokedEvent.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/* java.beans.beancontext.BeanContextServiceRevokedEvent
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-/**
- * Event fired when services are revoked from a BeanContextServices
.
- *
- * @author John Keiser
- * @since JDK1.2
- * @see java.beans.beancontext.BeanContextServiceRevokedListener
- */
-
-public class BeanContextServiceRevokedEvent extends BeanContextEvent {
- /**
- * The Class
representing the service which is now
- * available.
- */
- protected Class serviceClass;
- private boolean invalidateRefs;
-
- /**
- * Create a new service revoked event.
- * @param services the BeanContextServices
through
- * which the service was available. This is also the source
- * of the event.
- * @param serviceClass the service class that is now revoked.
- * @param revokeNow whether the revocation is immediate for all
- * classes or just a suggestion.
- */
- public BeanContextServiceRevokedEvent(BeanContextServices services, Class serviceClass, boolean revokeNow) {
- super(services);
- this.serviceClass = serviceClass;
- invalidateRefs = revokeNow;
- }
-
- /**
- * Get the revoked service class.
- * @return the service class.
- */
- public Class getServiceClass() {
- return serviceClass;
- }
-
- /**
- * Tell whether the revoked service class is the same as the specified class.
- * Identical to getServiceClass().equals(c)
.
- * @param c the class to compare.
- * @return whether the clases are equal.
- */
- public boolean isServiceClass(Class c) {
- return serviceClass.equals(c);
- }
-
- /**
- * Get the BeanContextServices
through which the service was available.
- * @return the BeanContextServices
through which the
- * service was available.
- */
- public BeanContextServices getSourceAsBeanContextServices() {
- return (BeanContextServices)getSource();
- }
-
- /**
- * Tell whether current instances of the revoked service are usable or not.
- * This is determined by whether the service was revoked
- * immediately.
- *
- * @return whether current instances of the revoked service are
- * usable.
- */
- public boolean isCurrentServiceInvalidNow() {
- return invalidateRefs;
- }
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServiceRevokedListener.java b/libjava/java/beans/beancontext/BeanContextServiceRevokedListener.java
deleted file mode 100644
index 101e6e191b0..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServiceRevokedListener.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* java.beans.beancontext.BeanContextServiceRevokedListener
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.util.EventListener;
-
-/**
- * Listens for service revoke events.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContextServiceRevokedListener extends EventListener {
- /**
- * Called by BeanContextServices.revokeService()
to indicate that a service has been revoked.
- * If you have a reference to such a service, it should be
- * discarded and may no longer function properly.
- * getService()
will no longer work on the specified
- * service class after this event has been fired.
- *
- * @param event the service revoked event.
- * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean)
- */
- void serviceRevoked(BeanContextServiceRevokedEvent event);
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServices.java b/libjava/java/beans/beancontext/BeanContextServices.java
deleted file mode 100644
index cb1950360af..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServices.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/* java.beans.beancontext.BeanContextServices
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.util.Iterator;
-import java.util.TooManyListenersException;
-
-/**
- * Allows a BeanContext
to provide services to its children.
- *
- * @specnote it is unclear whether a BeanContextServices
- * should delegate unhandled requests to parents. I assume so.
- * @author John Keiser
- * @since 1.2
- */
-
-public interface BeanContextServices
- extends BeanContext, BeanContextServicesListener
-{
- /**
- * Register a service to make it available to others.
- * This class may refuse to add the service based on whatever
- * information it can gather, including whether the service
- * provider is trusted.
- *
- * @param serviceClass the service class.
- * @param provider the factory that will actually provide the service.
- * @return whether the service was added or not.
- */
- boolean addService (Class serviceClass,
- BeanContextServiceProvider provider);
-
- /**
- * Make it so that no one else can use this service.
- * revokeNow
is false
, the only
- * effect of this method is to make all subsequent calls to
- * getService()
on this service class fail.
- * true
, a message is also sent out to all
- * listeners on the service and all references to it are released.
- *
- * @param serviceClass the service class to revoke.
- * @param provider the service provider providing the service class.
- * @param revokeNow whether to release all current references to
- * the service.
- */
- void revokeService (Class serviceClass,
- BeanContextServiceProvider provider,
- boolean revokeNow);
-
- /**
- * Release your copy of this service.
- * BeanContextServiceRevokedListener
- * previously registered by getService()
will be
- * unregistered.
- *
- * @param requestorChild the original BeanContextChild
- * requesting the service.
- * @param requestor the original requestor of the service.
- * @param service the service to relinquish
- * @see #getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener)
- */
- void releaseService (BeanContextChild requestorChild, Object requestor,
- Object service);
-
- /**
- * Get a service from this BeanContextServices
.
- * BeanContextServices
object chooses not honor the
- * request because the service class has been revoked or for some
- * other reason, then this method will return null
.
- * getService()
with the
- * same requestor object and service class but different
- * listeners. Which listener is to be notified?
- *
- * @param requestorChild the BeanContextChild
- * associated with the requestor. Typically this will be
- * the same as the requestor itself, but since any
- * Object
, even one outside the hierarchy, may
- * make a request, this parameter is necessary. Only weak
- * references to this will be retained, and it will never
- * be changed, only queried in a read-only manner.
- * @param requestor the actual requestor of the service. Only
- * weak references to this will be retained, and it will
- * never be changed, only queried in a read-only manner.
- * @param serviceClass the Class
of the service being
- * requested.
- * @param serviceSelector a parameter to customize the service
- * returned with.
- * @param listener a listener that will be notified if the service
- * being requested is revoked.
- * @return an instance of serviceClass
(such that
- * instanceof
serviceClass is true), or
- * null
.
- */
- Object getService (BeanContextChild requestorChild, Object requestor,
- Class serviceClass, Object serviceSelector,
- BeanContextServiceRevokedListener listener)
- throws TooManyListenersException;
-
- /**
- * Get a list of all service classes supported.
- * BeanContext.globalHierarchyLock
.
- *
- * @return a list of all service classes supported.
- * @see java.beans.beancontext.BeanContext#globalHierarchyLock
- */
- Iterator getCurrentServiceClasses ();
-
- /**
- * Get a list of valid service selectors for the specified service class.
- * null
.
- * If it takes a general Integer
parameter, for
- * example, you may as well return null
or the poor
- * soul who called this method will be iterating all day.
- * Iterator
.
- *
- * @param serviceClass the service class to get selectors for.
- * @return a list of valid service selectors for the service
- * class, or null
.
- */
- Iterator getCurrentServiceSelectors (Class serviceClass);
-
- /**
- * Tell whether the specified service class is available.
- * Iff getService() could return a non-null value for the
- * specified service, this method will return true
.
- *
- * @param serviceClass the service class to check on.
- * @return whether the specified service class is available.
- */
- boolean hasService (Class serviceClass);
-
- /**
- * Add a listener on all adds and removes of services.
- * @param listener the listener to add.
- */
- void addBeanContextServicesListener (BeanContextServicesListener listener);
-
- /**
- * Remove a listener on all adds and removes of services.
- * @specnote it is not certain whether this should remove this
- * listener if it was specified in
- * getService()
.
- * @param listener the listener to add.
- */
- void removeBeanContextServicesListener (BeanContextServicesListener listener);
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServicesListener.java b/libjava/java/beans/beancontext/BeanContextServicesListener.java
deleted file mode 100644
index becc7cdb6e4..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServicesListener.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/* java.beans.beancontext.BeanContextServicesListener
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-/**
- * Listens for service add and revoke events.
- *
- * @author John Keiser
- * @since JDK1.2
- */
-
-public interface BeanContextServicesListener extends BeanContextServiceRevokedListener {
- /**
- * Called by BeanContextServices
whenever a service is made available.
- *
- * @param event the service revoked event, with useful information
- * about the new service.
- */
- void serviceAvailable(BeanContextServiceAvailableEvent event);
-}
diff --git a/libjava/java/beans/beancontext/BeanContextServicesSupport.java b/libjava/java/beans/beancontext/BeanContextServicesSupport.java
deleted file mode 100644
index b7c4a49d8a9..00000000000
--- a/libjava/java/beans/beancontext/BeanContextServicesSupport.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/* BeanContextServicesSupport.java --
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.TooManyListenersException;
-
-/**
- * @author Michael Koch
- * @since 1.2
- */
-public class BeanContextServicesSupport
- extends BeanContextSupport
- implements BeanContextServices
-{
- private static final long serialVersionUID = -8494482757288719206L;
-
- protected class BCSSChild
- extends BeanContextSupport.BCSChild
- {
- private static final long serialVersionUID = -6848044915271367103L;
- }
-
- protected class BCSSProxyServiceProvider
- implements BeanContextServiceProvider,
- BeanContextServiceRevokedListener
- {
- private static final long serialVersionUID = 7078212910685744490L;
-
- public Iterator getCurrentServiceSelectors (BeanContextServices bcs,
- Class serviceClass)
- {
- throw new Error ("Not implemented");
- }
-
- public Object getService (BeanContextServices bcs,
- Object requestor,
- Class serviceClass,
- Object serviceSelector)
- {
- throw new Error ("Not implemented");
- }
-
- public void releaseService (BeanContextServices bcs,
- Object requestor,
- Object service)
- {
- throw new Error ("Not implemented");
- }
-
- public void serviceRevoked (BeanContextServiceRevokedEvent bcsre)
- {
- throw new Error ("Not implemented");
- }
- }
-
- protected static class BCSSServiceProvider
- implements Serializable
- {
- private static final long serialVersionUID = 861278251667444782L;
-
- protected BeanContextServiceProvider serviceProvider;
-
- protected BeanContextServiceProvider getServiceProvider()
- {
- return serviceProvider;
- }
- }
-
- protected transient ArrayList bcsListeners;
-
- protected transient BCSSProxyServiceProvider proxy;
-
- protected transient int serializable;
-
- protected transient HashMap services;
-
- public BeanContextServicesSupport ()
- {
- super();
- }
-
- public BeanContextServicesSupport (BeanContextServices peer)
- {
- super(peer);
- }
-
- public BeanContextServicesSupport(BeanContextServices peer, Locale locale)
- {
- super(peer, locale);
- }
-
- public BeanContextServicesSupport(BeanContextServices peer, Locale locale,
- boolean dtime)
- {
- super(peer, locale, dtime);
- }
-
- public BeanContextServicesSupport(BeanContextServices peer, Locale locale,
- boolean dtime, boolean visible)
- {
- super(peer, locale, dtime, visible);
- }
-
- public void addBeanContextServicesListener
- (BeanContextServicesListener listener)
- {
- if (! bcsListeners.contains(listener))
- bcsListeners.add(listener);
- }
-
- public boolean addService (Class serviceClass, BeanContextServiceProvider bcsp)
- {
- throw new Error ("Not implemented");
- }
-
- protected boolean addService (Class serviceClass,
- BeanContextServiceProvider bcsp,
- boolean fireEvent)
- {
- throw new Error ("Not implemented");
- }
-
- protected void bcsPreDeserializationHook (ObjectInputStream ois)
- throws ClassNotFoundException, IOException
- {
- throw new Error ("Not implemented");
- }
-
- protected void bcsPreSerializationHook (ObjectOutputStream oos)
- throws IOException
- {
- throw new Error ("Not implemented");
- }
-
- protected void childJustRemovedHook (Object child,
- BeanContextSupport.BCSChild bcsc)
- {
- throw new Error ("Not implemented");
- }
-
- protected BeanContextSupport.BCSChild createBCSChild (Object targetChild,
- Object peer)
- {
- throw new Error ("Not implemented");
- }
-
- protected BeanContextServicesSupport.BCSSServiceProvider
- createBCSSServiceProvider (Class sc, BeanContextServiceProvider bcsp)
- {
- throw new Error ("Not implemented");
- }
-
- protected final void fireServiceAdded (BeanContextServiceAvailableEvent bcssae)
- {
- throw new Error ("Not implemented");
- }
-
- protected final void fireServiceAdded (Class serviceClass)
- {
- throw new Error ("Not implemented");
- }
-
- protected final void fireServiceRevoked(BeanContextServiceRevokedEvent event)
- {
- throw new Error ("Not implemented");
- }
-
- protected final void fireServiceRevoked (Class serviceClass,
- boolean revokeNow)
- {
- throw new Error ("Not implemented");
- }
-
- public BeanContextServices getBeanContextServicesPeer ()
- {
- throw new Error ("Not implemented");
- }
-
- protected static final BeanContextServicesListener
- getChildBeanContextServicesListener (Object child)
- {
- throw new Error ("Not implemented");
- }
-
- public Iterator getCurrentServiceClasses ()
- {
- throw new Error ("Not implemented");
- }
-
- public Iterator getCurrentServiceSelectors (Class serviceClass)
- {
- throw new Error ("Not implemented");
- }
-
- public Object getService (BeanContextChild child, Object requestor,
- Class serviceClass, Object serviceSelector,
- BeanContextServiceRevokedListener bcsrl)
- throws TooManyListenersException
- {
- throw new Error ("Not implemented");
- }
-
- public boolean hasService (Class serviceClass)
- {
- throw new Error ("Not implemented");
- }
-
- public void initialize ()
- {
- super.initialize();
-
- bcsListeners = new ArrayList();
- services = new HashMap();
- }
-
- protected void initializeBeanContextResources ()
- {
- throw new Error ("Not implemented");
- }
-
- protected void releaseBeanContextResources ()
- {
- throw new Error ("Not implemented");
- }
-
- public void releaseService (BeanContextChild child, Object requestor,
- Object service)
- {
- throw new Error ("Not implemented");
- }
-
- public void removeBeanContextServicesListener
- (BeanContextServicesListener listener)
- {
- int index = bcsListeners.indexOf(listener);
-
- if (index > -1)
- bcsListeners.remove(index);
- }
-
- public void revokeService (Class serviceClass, BeanContextServiceProvider bcsp,
- boolean revokeCurrentServicesNow)
- {
- throw new Error ("Not implemented");
- }
-
- public void serviceAvailable (BeanContextServiceAvailableEvent bcssae)
- {
- throw new Error ("Not implemented");
- }
-
- public void serviceRevoked (BeanContextServiceRevokedEvent bcssre)
- {
- throw new Error ("Not implemented");
- }
-}
diff --git a/libjava/java/beans/beancontext/BeanContextSupport.java b/libjava/java/beans/beancontext/BeanContextSupport.java
deleted file mode 100644
index 7e024e23a13..00000000000
--- a/libjava/java/beans/beancontext/BeanContextSupport.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/* BeanContextSupport.java --
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.beans.beancontext;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyVetoException;
-import java.beans.VetoableChangeListener;
-import java.beans.Visibility;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-
-/**
- * @author Michael Koch
- * @since 1.2
- */
-public class BeanContextSupport extends BeanContextChildSupport
- implements BeanContext, Serializable, PropertyChangeListener,
- VetoableChangeListener
-{
- private static final long serialVersionUID = -4879613978649577204L;
-
- private void readObject (ObjectInputStream s)
- throws ClassNotFoundException, IOException
- {
- throw new Error ("Not implemented");
- }
-
- private void writeObject (ObjectOutputStream s)
- throws ClassNotFoundException, IOException
- {
- throw new Error ("Not implemented");
- }
-
- protected class BCSChild implements Serializable
- {
- private static final long serialVersionUID = 3289144128843950629L;
- }
-
- protected static final class BCSIterator implements Iterator
- {
- public boolean hasNext ()
- {
- throw new Error ("Not implemented");
- }
-
- public Object next ()
- {
- throw new Error ("Not implemented");
- }
-
- public void remove ()
- {
- // This must be a noop remove operation.
- }
- }
-
- protected transient ArrayList bcmListeners;
-
- protected transient HashMap children;
-
- protected transient boolean designTime;
-
- protected transient Locale locale;
-
- protected transient boolean okToUseGui;
-
- /**
- * Construct a BeanContextSupport instance.
- */
- public BeanContextSupport ()
- {
- this (null, null, true, true);
- }
-
- /**
- * Construct a BeanContextSupport instance.
- */
- public BeanContextSupport (BeanContext peer)
- {
- this (peer, null, true, true);
- }
-
- /**
- * Construct a BeanContextSupport instance.
- */
- public BeanContextSupport (BeanContext peer, Locale lcle)
- {
- this (peer, lcle, true, true);
- }
-
- /**
- * Construct a BeanContextSupport instance.
- */
- public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime)
- {
- this (peer, lcle, dtime, true);
- }
-
- /**
- * Construct a BeanContextSupport instance.
- */
- public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime,
- boolean visible)
- {
- locale = lcle;
- designTime = dtime;
- okToUseGui = visible;
-
- initialize ();
- }
-
- public boolean add (Object targetChild)
- {
- if (targetChild == null)
- throw new IllegalArgumentException();
-
- if (children.containsKey(targetChild))
- return false;
-
- // FIXME: The second argument is surely wrong.
- children.put(targetChild, targetChild);
- return true;
- }
-
- public boolean addAll (Collection c)
- {
- throw new UnsupportedOperationException();
- }
-
- public void addBeanContextMembershipListener
- (BeanContextMembershipListener listener)
- {
- if (! bcmListeners.contains(listener))
- bcmListeners.add(listener);
- }
-
- public boolean avoidingGui ()
- {
- throw new Error ("Not implemented");
- }
-
- protected Iterator bcsChildren ()
- {
- throw new Error ("Not implemented");
- }
-
- protected void bcsPreDeserializationHook (ObjectInputStream ois)
- throws ClassNotFoundException, IOException
- {
- throw new Error ("Not implemented");
- }
-
- protected void bcsPreSerializationHook (ObjectOutputStream oos)
- throws IOException
- {
- throw new Error ("Not implemented");
- }
-
- protected void childDeserializedHook (Object child, BeanContextSupport.BCSChild bcsc)
- {
- throw new Error ("Not implemented");
- }
-
- protected void childJustAddedHook (Object child, BeanContextSupport.BCSChild bcsc)
- {
- throw new Error ("Not implemented");
- }
-
- protected void childJustRemovedHook (Object child, BeanContextSupport.BCSChild bcsc)
- {
- throw new Error ("Not implemented");
- }
-
- protected static final boolean classEquals (Class first, Class second)
- {
- throw new Error ("Not implemented");
- }
-
- public void clear ()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean contains (Object o)
- {
- throw new Error ("Not implemented");
- }
-
- public boolean containsAll (Collection c)
- {
- throw new Error ("Not implemented");
- }
-
- public boolean containsKey (Object o)
- {
- throw new Error ("Not implemented");
- }
-
- protected final Object[] copyChildren ()
- {
- throw new Error ("Not implemented");
- }
-
- protected BeanContextSupport.BCSChild createBCSChild (Object targetChild, Object peer)
- {
- throw new Error ("Not implemented");
- }
-
- protected final void deserialize (ObjectInputStream ois, Collection coll)
- throws ClassNotFoundException, IOException
- {
- throw new Error ("Not implemented");
- }
-
- public void dontUseGui ()
- {
- throw new Error ("Not implemented");
- }
-
- protected final void fireChildrenAdded (BeanContextMembershipEvent bcme)
- {
- throw new Error ("Not implemented");
- }
-
- protected final void fireChildrenRemoved (BeanContextMembershipEvent bcme)
- {
- throw new Error ("Not implemented");
- }
-
- public BeanContext getBeanContextPeer ()
- {
- throw new Error ("Not implemented");
- }
-
- protected static final BeanContextChild getChildBeanContextChild (Object child)
- {
- throw new Error ("Not implemented");
- }
-
- protected static final BeanContextMembershipListener getChildBeanContextMembershipListener (Object child)
- {
- throw new Error ("Not implemented");
- }
-
- protected static final PropertyChangeListener getChildPropertyChangeListener (Object child)
- {
- throw new Error ("Not implemented");
- }
-
- protected static final Serializable getChildSerializable (Object child)
- {
- throw new Error ("Not implemented");
- }
-
- protected static final VetoableChangeListener getChildVetoableChangeListener (Object child)
- {
- throw new Error ("Not implemented");
- }
-
- protected static final Visibility getChildVisibility (Object child)
- {
- throw new Error ("Not implemented");
- }
-
- public Locale getLocale ()
- {
- return locale;
- }
-
- public URL getResource (String name, BeanContextChild bcc)
- {
- throw new Error ("Not implemented");
- }
-
- public InputStream getResourceAsStream (String name, BeanContextChild bcc)
- {
- throw new Error ("Not implemented");
- }
-
- protected void initialize ()
- {
- bcmListeners = new ArrayList();
- children = new HashMap();
- }
-
- public Object instantiateChild (String beanName)
- throws IOException, ClassNotFoundException
- {
- throw new Error ("Not implemented");
- }
-
- public boolean isDesignTime ()
- {
- throw new Error ("Not implemented");
- }
-
- public boolean isEmpty ()
- {
- throw new Error ("Not implemented");
- }
-
- public boolean isSerializing ()
- {
- throw new Error ("Not implemented");
- }
-
- public Iterator iterator ()
- {
- return children.keySet().iterator();
- }
-
- public boolean needsGui ()
- {
- throw new Error ("Not implemented");
- }
-
- public void okToUseGui ()
- {
- throw new Error ("Not implemented");
- }
-
- public void propertyChange (PropertyChangeEvent pce)
- {
- throw new Error ("Not implemented");
- }
-
- public final void readChildren (ObjectInputStream ois)
- throws IOException, ClassNotFoundException
- {
- throw new Error ("Not implemented");
- }
-
- public boolean remove (Object targetChild)
- {
- return remove(targetChild, true);
- }
-
- protected boolean remove (Object targetChild, boolean callChildSetBC)
- {
- if (targetChild == null)
- throw new IllegalArgumentException();
-
- throw new Error ("Not implemented");
- }
-
- public boolean removeAll (Collection c)
- {
- throw new UnsupportedOperationException();
- }
-
- public void removeBeanContextMembershipListener (BeanContextMembershipListener bcml)
- {
- throw new Error ("Not implemented");
- }
-
- public boolean retainAll (Collection c)
- {
- throw new UnsupportedOperationException();
- }
-
- protected final void serialize (ObjectOutputStream oos, Collection coll)
- throws IOException
- {
- throw new Error ("Not implemented");
- }
-
- public void setDesignTime (boolean dtime)
- {
- throw new Error ("Not implemented");
- }
-
- public void setLocale (Locale newLocale)
- throws PropertyVetoException
- {
- throw new Error ("Not implemented");
- }
-
- public int size ()
- {
- throw new Error ("Not implemented");
- }
-
- public Object[] toArray ()
- {
- return children.keySet().toArray();
- }
-
- public Object[] toArray(Object[] array)
- {
- return children.keySet().toArray(array);
- }
-
- protected boolean validatePendingAdd (Object targetChild)
- {
- throw new Error ("Not implemented");
- }
-
- protected boolean validatePendingRemove (Object targetChild)
- {
- throw new Error ("Not implemented");
- }
-
- public void vetoableChange (PropertyChangeEvent pce)
- throws PropertyVetoException
- {
- throw new Error ("Not implemented");
- }
-
- public final void writeChildren (ObjectOutputStream oos)
- throws IOException
- {
- throw new Error ("Not implemented");
- }
-}
diff --git a/libjava/java/io/BufferedOutputStream.java b/libjava/java/io/BufferedOutputStream.java
deleted file mode 100644
index ce7ebc7e938..00000000000
--- a/libjava/java/io/BufferedOutputStream.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/* BufferedOutputStream.java -- Buffer output into large blocks before writing
- Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class accumulates bytes written in a buffer instead of immediately
- * writing the data to the underlying output sink. The bytes are instead
- * as one large block when the buffer is filled, or when the stream is
- * closed or explicitly flushed. This mode operation can provide a more
- * efficient mechanism for writing versus doing numerous small unbuffered
- * writes.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class BufferedOutputStream extends FilterOutputStream
-{
- /**
- * This is the default buffer size
- */
- private static final int DEFAULT_BUFFER_SIZE = 512;
-
- /**
- * This is the internal byte array used for buffering output before
- * writing it.
- */
- protected byte[] buf;
-
- /**
- * This is the number of bytes that are currently in the buffer and
- * are waiting to be written to the underlying stream. It always points to
- * the index into the buffer where the next byte of data will be stored
- */
- protected int count;
-
- /**
- * This method initializes a new BufferedOutputStream
instance
- * that will write to the specified subordinate OutputStream
- * and which will use a default buffer size of 512 bytes.
- *
- * @param out The underlying OutputStream
to write data to
- */
- public BufferedOutputStream(OutputStream out)
- {
- this(out, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a new BufferedOutputStream
instance
- * that will write to the specified subordinate OutputStream
- * and which will use the specified buffer size
- *
- * @param out The underlying OutputStream
to write data to
- * @param size The size of the internal buffer
- */
- public BufferedOutputStream(OutputStream out, int size)
- {
- super(out);
-
- buf = new byte[size];
- }
-
- /**
- * This method causes any currently buffered bytes to be immediately
- * written to the underlying output stream.
- *
- * @exception IOException If an error occurs
- */
- public synchronized void flush() throws IOException
- {
- if (count == 0)
- return;
-
- out.write(buf, 0, count);
- count = 0;
- out.flush();
- }
-
- /**
- * This method flushes any remaining buffered bytes then closes the
- * underlying output stream. Any further attempts to write to this stream
- * may throw an exception
- *
- public synchronized void close() throws IOException
- {
- flush();
- out.close();
- }
- */
-
- /**
- * This method runs when the object is garbage collected. It is
- * responsible for ensuring that all buffered bytes are written and
- * for closing the underlying stream.
- *
- * @exception IOException If an error occurs (ignored by the Java runtime)
- *
- protected void finalize() throws IOException
- {
- close();
- }
- */
-
- /**
- * This method writes a single byte of data. This will be written to the
- * buffer instead of the underlying data source. However, if the buffer
- * is filled as a result of this write request, it will be flushed to the
- * underlying output stream.
- *
- * @param b The byte of data to be written, passed as an int
- *
- * @exception IOException If an error occurs
- */
- public synchronized void write(int b) throws IOException
- {
- if (count == buf.length)
- flush();
-
- buf[count] = (byte)(b & 0xFF);
- ++count;
- }
-
- /**
- * This method writes len
bytes from the byte array
- * buf
starting at position offset
in the buffer.
- * These bytes will be written to the internal buffer. However, if this
- * write operation fills the buffer, the buffer will be flushed to the
- * underlying output stream.
- *
- * @param buf The array of bytes to write.
- * @param offset The index into the byte array to start writing from.
- * @param len The number of bytes to write.
- *
- * @exception IOException If an error occurs
- */
- public synchronized void write(byte[] buf, int offset, int len)
- throws IOException
- {
- // Buffer can hold everything. Note that the case where LEN < 0
- // is automatically handled by the downstream write.
- if (len < (this.buf.length - count))
- {
- System.arraycopy(buf, offset, this.buf, count, len);
- count += len;
- }
- else
- {
- // The write was too big. So flush the buffer and write the new
- // bytes directly to the underlying stream, per the JDK 1.2
- // docs.
- flush();
- out.write (buf, offset, len);
- }
- }
-
-} // class BufferedOutputStream
-
diff --git a/libjava/java/io/BufferedReader.java b/libjava/java/io/BufferedReader.java
deleted file mode 100644
index 4849949c989..00000000000
--- a/libjava/java/io/BufferedReader.java
+++ /dev/null
@@ -1,581 +0,0 @@
-/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This subclass of FilterReader
buffers input from an
- * underlying implementation to provide a possibly more efficient read
- * mechanism. It maintains the buffer and buffer state in instance
- * variables that are available to subclasses. The default buffer size
- * of 8192 chars can be overridden by the creator of the stream.
- * Integer.MAX_VALUE
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class BufferedReader extends Reader
-{
- Reader in;
- char[] buffer;
- /* Index of current read position. Must be >= 0 and <= limit. */
- /* There is a special case where pos may be equal to limit+1; this
- * is used as an indicator that a readLine was done with a '\r' was
- * the very last char in the buffer. Since we don't want to read-ahead
- * and potentially block, we set pos this way to indicate the situation
- * and deal with it later. Doing it this way rather than having a
- * separate boolean field to indicate the condition has the advantage
- * that it is self-clearing on things like mark/reset.
- */
- int pos;
- /* Limit of valid data in buffer. Must be >= pos and <= buffer.length. */
- /* This can be < pos in the one special case described above. */
- int limit;
-
- /* The value -1 means there is no mark, or the mark has been invalidated.
- Otherwise, markPos is the index in the buffer of the marked position.
- Must be >= 0 and <= pos.
- Note we do not explicitly store the read-limit.
- The implicit read-limit is (buffer.length - markPos), which is
- guaranteed to be >= the read-limit requested in the call to mark. */
- int markPos = -1;
-
- // The JCL book specifies the default buffer size as 8K characters.
- // This is package-private because it is used by LineNumberReader.
- static final int DEFAULT_BUFFER_SIZE = 8192;
-
- /**
- * The line buffer for readLine
.
- */
- private StringBuffer sbuf = null;
-
- /**
- * Create a new BufferedReader
that will read from the
- * specified subordinate stream with a default buffer size of 8192 chars.
- *
- * @param in The subordinate stream to read from
- */
- public BufferedReader(Reader in)
- {
- this(in, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * Create a new BufferedReader
that will read from the
- * specified subordinate stream with a buffer size that is specified by the
- * caller.
- *
- * @param in The subordinate stream to read from
- * @param size The buffer size to use
- *
- * @exception IllegalArgumentException if size <= 0
- */
- public BufferedReader(Reader in, int size)
- {
- super(in.lock);
- if (size <= 0)
- throw new IllegalArgumentException("Illegal buffer size: " + size);
- this.in = in;
- buffer = new char[size];
- }
-
- /**
- * This method closes the underlying stream and frees any associated
- * resources.
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- synchronized (lock)
- {
- if (in != null)
- in.close();
- in = null;
- buffer = null;
- }
- }
-
- /**
- * Returns true
to indicate that this class supports mark/reset
- * functionality.
- *
- * @return true
- */
- public boolean markSupported()
- {
- return true;
- }
-
- /**
- * Mark a position in the input to which the stream can be
- * "reset" by calling the reset()
method. The parameter
- * readLimit
is the number of chars that can be read from the
- * stream after setting the mark before the mark becomes invalid. For
- * example, if mark()
is called with a read limit of 10, then
- * when 11 chars of data are read from the stream before the
- * reset()
method is called, then the mark is invalid and the
- * stream object instance is not required to remember the mark.
- * mark()
method
- * was called. Any chars that were read after the mark point was set will
- * be re-read during subsequent reads.
- * mark()
exceeds the mark limit
- * passed when establishing the mark.
- *
- * @exception IOException If an error occurs;
- */
- public void reset() throws IOException
- {
- synchronized (lock)
- {
- checkStatus();
- if (markPos < 0)
- throw new IOException("mark never set or invalidated");
-
- // Need to handle the extremely unlikely case where a readLine was
- // done with a '\r' as the last char in the buffer; which was then
- // immediately followed by a mark and a reset with NO intervening
- // read of any sort. In that case, setting pos to markPos would
- // lose that info and a subsequent read would thus not skip a '\n'
- // (if one exists). The value of limit in this rare case is zero.
- // We can assume that if limit is zero for other reasons, then
- // pos is already set to zero and doesn't need to be readjusted.
- if (limit > 0)
- pos = markPos;
- }
- }
-
- /**
- * This method determines whether or not a stream is ready to be read. If
- * this method returns false
then this stream could (but is
- * not guaranteed to) block on the next read attempt.
- *
- * @return true
if this stream is ready to be read,
- * false
otherwise
- *
- * @exception IOException If an error occurs
- */
- public boolean ready() throws IOException
- {
- synchronized (lock)
- {
- checkStatus();
- return pos < limit || in.ready();
- }
- }
-
- /**
- * This method read chars from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index
- * offset
into
- * the buffer and attempts to read len
chars. This method can
- * return before reading the number of chars requested. The actual number
- * of chars read is returned as an int. A -1 is returned to indicate the
- * end of the stream.
- * String
. A line is terminated by "\n", a "\r", or
- * an "\r\n" sequence. The system dependent line separator is not used.
- * The line termination characters are not returned in the resulting
- * String
.
- *
- * @return The line of text read, or null
if end of stream.
- *
- * @exception IOException If an error occurs
- */
- public String readLine() throws IOException
- {
- checkStatus();
- // Handle the special case where a previous readLine (with no intervening
- // reads/skips) had a '\r' at the end of the buffer.
- // In this case, we'll need to skip a '\n' if it's the next char to be read.
- // This special case is indicated by 'pos > limit'.
- if (pos > limit)
- {
- int ch = read();
- if (ch < 0)
- return null;
- if (ch != '\n')
- --pos;
- }
- int i = lineEnd(limit);
- if (i < limit)
- {
- String str = String.valueOf(buffer, pos, i - pos);
- pos = i + 1;
- // If the last char in the buffer is a '\r', we must remember
- // to check if the next char to be read after the buffer is refilled
- // is a '\n'. If so, skip it. To indicate this condition, we set pos
- // to be limit + 1, which normally is never possible.
- if (buffer[i] == '\r')
- if (pos == limit || buffer[pos] == '\n')
- pos++;
- return str;
- }
- if (sbuf == null)
- sbuf = new StringBuffer(200);
- else
- sbuf.setLength(0);
- sbuf.append(buffer, pos, i - pos);
- pos = i;
- // We only want to return null when no characters were read before
- // EOF. So we must keep track of this separately. Otherwise we
- // would treat an empty `sbuf' as an EOF condition, which is wrong
- // when there is just a newline.
- boolean eof = false;
- for (;;)
- {
- // readLine should block. So we must not return until a -1 is reached.
- if (pos >= limit)
- {
- // here count == 0 isn't sufficient to give a failure.
- int count = fill();
- if (count < 0)
- {
- eof = true;
- break;
- }
- continue;
- }
- int ch = buffer[pos++];
- if (ch == '\n' || ch == '\r')
- {
- // Check here if a '\r' was the last char in the buffer; if so,
- // mark it as in the comment above to indicate future reads
- // should skip a newline that is the next char read after
- // refilling the buffer.
- if (ch == '\r')
- if (pos == limit || buffer[pos] == '\n')
- pos++;
- break;
- }
- i = lineEnd(limit);
- sbuf.append(buffer, pos - 1, i - (pos - 1));
- pos = i;
- }
- return (sbuf.length() == 0 && eof) ? null : sbuf.toString();
- }
-
- /**
- * This method skips the specified number of chars in the stream. It
- * returns the actual number of chars skipped, which may be less than the
- * requested amount.
- * skip
method on the underlying stream to skip the
- * remaining chars.
- *
- * @param count The requested number of chars to skip
- *
- * @return The actual number of chars skipped.
- *
- * @exception IOException If an error occurs.
- * @exception IllegalArgumentException If count is negative.
- */
- public long skip(long count) throws IOException
- {
- synchronized (lock)
- {
- checkStatus();
- if (count < 0)
- throw new IllegalArgumentException("skip value is negative");
- if (count == 0)
- return 0;
- // Yet again, we need to handle the special case of a readLine
- // that has a '\r' at the end of the buffer. In this case, we need
- // to ignore a '\n' if it is the next char to be read.
- // This special case is indicated by 'pos > limit' (i.e. avail < 0).
- // To simplify things, if we're dealing with the special case for
- // readLine, just read the next char (since the fill method will
- // skip the '\n' for us). By doing this, we'll have to back up pos.
- // That's easier than trying to keep track of whether we've skipped
- // one element or not.
- if (pos > limit)
- {
- if (read() < 0)
- return 0;
- else
- --pos;
- }
-
- int avail = limit - pos;
-
- if (count < avail)
- {
- pos += count;
- return count;
- }
-
- pos = limit;
- long todo = count - avail;
- if (todo > buffer.length)
- {
- markPos = -1;
- todo -= in.skip(todo);
- }
- else
- {
- while (todo > 0)
- {
- avail = fill();
- if (avail <= 0)
- break;
- if (avail > todo)
- avail = (int) todo;
- pos += avail;
- todo -= avail;
- }
- }
- return count - todo;
- }
- }
-
- private void checkStatus() throws IOException
- {
- if (in == null)
- throw new IOException("Stream closed");
- }
-}
diff --git a/libjava/java/io/BufferedWriter.java b/libjava/java/io/BufferedWriter.java
deleted file mode 100644
index 185a5344062..00000000000
--- a/libjava/java/io/BufferedWriter.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/* BufferedWriter.java -- Buffer output into large blocks before writing
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.1.
- */
-
-/**
- * This class accumulates chars written in a buffer instead of immediately
- * writing the data to the underlying output sink. The chars are instead
- * as one large block when the buffer is filled, or when the stream is
- * closed or explicitly flushed. This mode operation can provide a more
- * efficient mechanism for writing versus doing numerous small unbuffered
- * writes.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @date September 25, 1998
- */
-public class BufferedWriter extends Writer
-{
- /**
- * This is the default buffer size
- */
- private static final int DEFAULT_BUFFER_SIZE = 8192;
-
- /**
- * This is the underlying Writer
to which this object
- * sends its output.
- */
- private Writer out;
-
- /**
- * This is the internal char array used for buffering output before
- * writing it.
- */
- char[] buffer;
-
- /**
- * This is the number of chars that are currently in the buffer and
- * are waiting to be written to the underlying stream. It always points to
- * the index into the buffer where the next char of data will be stored
- */
- int count;
-
- /**
- * This method initializes a new BufferedWriter
instance
- * that will write to the specified subordinate Writer
- * and which will use a default buffer size of 8192 chars.
- *
- * @param out The underlying Writer
to write data to
- */
- public BufferedWriter (Writer out)
- {
- this (out, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a new BufferedWriter
instance
- * that will write to the specified subordinate Writer
- * and which will use the specified buffer size
- *
- * @param out The underlying Writer
to write data to
- * @param size The size of the internal buffer
- */
- public BufferedWriter (Writer out, int size)
- {
- super(out.lock);
- this.out = out;
- this.buffer = new char[size];
- this.count = 0;
- }
-
- /**
- * This method flushes any remaining buffered chars then closes the
- * underlying output stream. Any further attempts to write to this stream
- * may throw an exception
- *
- * @exception IOException If an error occurs.
- */
- public void close () throws IOException
- {
- synchronized (lock)
- {
- // It is safe to call localFlush even if the stream is already
- // closed.
- localFlush ();
- out.close();
- buffer = null;
- }
- }
-
- /**
- * This method causes any currently buffered chars to be immediately
- * written to the underlying output stream.
- *
- * @exception IOException If an error occurs
- */
- public void flush () throws IOException
- {
- synchronized (lock)
- {
- if (buffer == null)
- throw new IOException ("Stream closed");
- localFlush ();
- out.flush();
- }
- }
-
- /**
- * This method writes out a system depedent line separator sequence. The
- * actual value written is detemined from the len
chars from the char array
- * buf
starting at position offset
in the buffer.
- * These chars will be written to the internal buffer. However, if this
- * write operation fills the buffer, the buffer will be flushed to the
- * underlying output stream.
- *
- * @param buf The array of chars to write.
- * @param offset The index into the char array to start writing from.
- * @param len The number of chars to write.
- *
- * @exception IOException If an error occurs
- */
- public void write (char[] buf, int offset, int len) throws IOException
- {
- synchronized (lock)
- {
- if (buffer == null)
- throw new IOException ("Stream closed");
-
- // Bypass buffering if there is too much incoming data.
- if (count + len > buffer.length)
- {
- localFlush ();
- out.write(buf, offset, len);
- }
- else
- {
- System.arraycopy(buf, offset, buffer, count, len);
- count += len;
- if (count == buffer.length)
- localFlush ();
- }
- }
- }
-
- /**
- * This method writes len
chars from the String
- * str
starting at position offset
in the string.
- * These chars will be written to the internal buffer. However, if this
- * write operation fills the buffer, the buffer will be flushed to the
- * underlying output stream.
- *
- * @param str The String
to write.
- * @param offset The index into the string to start writing from.
- * @param len The number of chars to write.
- *
- * @exception IOException If an error occurs
- */
- public void write (String str, int offset, int len) throws IOException
- {
- synchronized (lock)
- {
- if (buffer == null)
- throw new IOException ("Stream closed");
-
- if (count + len > buffer.length)
- {
- localFlush ();
- out.write(str, offset, len);
- }
- else
- {
- str.getChars(offset, offset + len, buffer, count);
- count += len;
- if (count == buffer.length)
- localFlush ();
- }
- }
- }
-
- // This should only be called with the lock held.
- private void localFlush () throws IOException
- {
- if (count > 0)
- {
- out.write(buffer, 0, count);
- count = 0;
- }
- }
-}
diff --git a/libjava/java/io/ByteArrayInputStream.java b/libjava/java/io/ByteArrayInputStream.java
deleted file mode 100644
index 2bbde95b724..00000000000
--- a/libjava/java/io/ByteArrayInputStream.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/* ByteArrayInputStream.java -- Read an array as a stream
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class permits an array of bytes to be read as an input stream.
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class ByteArrayInputStream extends InputStream
-{
- /**
- * The array that contains the data supplied during read operations
- */
- protected byte[] buf;
-
- /**
- * The array index of the next byte to be read from the buffer
- * buf
- */
- protected int pos;
-
- /**
- * The currently marked position in the stream. This defaults to 0, so a
- * reset operation on the stream resets it to read from array index 0 in
- * the buffer - even if the stream was initially created with an offset
- * greater than 0
- */
- protected int mark;
-
- /**
- * This indicates the maximum number of bytes that can be read from this
- * stream. It is the array index of the position after the last valid
- * byte in the buffer buf
- */
- protected int count;
-
- /**
- * Create a new ByteArrayInputStream that will read bytes from the passed
- * in byte array. This stream will read from the beginning to the end
- * of the array. It is identical to calling an overloaded constructor
- * as ByteArrayInputStream(buf, 0, buf.length)
.
- * offset
in the array for a length of
- * length
bytes past offset
. If the
- * stream is reset to a position before offset
then
- * more than length
bytes can be read from the stream.
- * The length
value should be viewed as the array index
- * one greater than the last position in the buffer to read.
- * count - pos
.
- *
- * @return The number of bytes that can be read from this stream
- * before blocking, which is all of them
- */
- public synchronized int available()
- {
- return count - pos;
- }
-
- /**
- * This method sets the mark position in this stream to the current
- * position. Note that the readlimit
parameter in this
- * method does nothing as this stream is always capable of
- * remembering all the bytes int it.
- * markSupported
method in
- * InputStream
in order to return true
-
- * indicating that this stream class supports mark/reset
- * functionality.
- *
- * @return true
to indicate that this class supports
- * mark/reset.
- */
- public boolean markSupported()
- {
- return true;
- }
-
- /**
- * This method reads one byte from the stream. The pos
- * counter is advanced to the next byte to be read. The byte read is
- * returned as an int in the range of 0-255. If the stream position
- * is already at the end of the buffer, no byte is read and a -1 is
- * returned in order to indicate the end of the stream.
- *
- * @return The byte read, or -1 if end of stream
- */
- public synchronized int read()
- {
- if (pos < count)
- return ((int) buf[pos++]) & 0xFF;
- return -1;
- }
-
- /**
- * This method reads bytes from the stream and stores them into a
- * caller supplied buffer. It starts storing the data at index
- * offset
into the buffer and attempts to read
- * len
bytes. This method can return before reading
- * the number of bytes requested if the end of the stream is
- * encountered first. The actual number of bytes read is returned.
- * If no bytes can be read because the stream is already at the end
- * of stream position, a -1 is returned.
- * pos
variable equal to the
- * mark
variable. Since a mark can be set anywhere in
- * the array, the mark/reset methods int this class can be used to
- * provide random search capabilities for this type of stream.
- */
- public synchronized void reset()
- {
- pos = mark;
- }
-
- /**
- * This method attempts to skip the requested number of bytes in the
- * input stream. It does this by advancing the pos
- * value by the specified number of bytes. It this would exceed the
- * length of the buffer, then only enough bytes are skipped to
- * position the stream at the end of the buffer. The actual number
- * of bytes skipped is returned.
- *
- * @param num The requested number of bytes to skip
- *
- * @return The actual number of bytes skipped.
- */
- public synchronized long skip(long num)
- {
- // Even though the var numBytes is a long, in reality it can never
- // be larger than an int since the result of subtracting 2 positive
- // ints will always fit in an int. Since we have to return a long
- // anyway, numBytes might as well just be a long.
- long numBytes = Math.min((long) (count - pos), num < 0 ? 0L : num);
- pos += numBytes;
- return numBytes;
- }
-}
diff --git a/libjava/java/io/ByteArrayOutputStream.java b/libjava/java/io/ByteArrayOutputStream.java
deleted file mode 100644
index e996ebbc70f..00000000000
--- a/libjava/java/io/ByteArrayOutputStream.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.1.
- */
-
-/**
- * This class allows data to be written to a byte array buffer and
- * and then retrieved by an application. The internal byte array
- * buffer is dynamically resized to hold all the data written. Please
- * be aware that writing large amounts to data to this stream will
- * cause large amounts of memory to be allocated.
- * gnu.java.io.ByteArrayOutputStream.initialBufferSize
- * property.
- * String
using either the system default or an
- * application specified character encoding. Thus it can handle
- * multibyte character encodings.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @date September 24, 1998
- */
-public class ByteArrayOutputStream extends OutputStream
-{
- /**
- * This method initializes a new ByteArrayOutputStream
- * with the default buffer size of 32 bytes. If a different initial
- * buffer size is desired, see the constructor
- * ByteArrayOutputStream(int size)
. For applications
- * where the source code is not available, the default buffer size
- * can be set using the system property
- * gnu.java.io.ByteArrayOutputStream.initialBufferSize
- */
- public ByteArrayOutputStream ()
- {
- this (initial_buffer_size);
- }
-
- /**
- * This method initializes a new ByteArrayOutputStream
with
- * a specified initial buffer size.
- *
- * @param size The initial buffer size in bytes
- */
- public ByteArrayOutputStream (int size)
- {
- buf = new byte[size];
- count = 0;
- }
-
- /**
- * This method discards all of the bytes that have been written to
- * the internal buffer so far by setting the count
- * variable to 0. The internal buffer remains at its currently
- * allocated size.
- */
- public synchronized void reset ()
- {
- count = 0;
- }
-
- /**
- * This method returns the number of bytes that have been written to
- * the buffer so far. This is the same as the value of the protected
- * count
variable. If the reset
method is
- * called, then this value is reset as well. Note that this method does
- * not return the length of the internal buffer, but only the number
- * of bytes that have been written to it.
- *
- * @return The number of bytes in the internal buffer
- *
- * @see #reset()
- */
- public int size ()
- {
- return count;
- }
-
- /**
- * This method returns a byte array containing the bytes that have been
- * written to this stream so far. This array is a copy of the valid
- * bytes in the internal buffer and its length is equal to the number of
- * valid bytes, not necessarily to the the length of the current
- * internal buffer. Note that since this method allocates a new array,
- * it should be used with caution when the internal buffer is very large.
- */
- public synchronized byte[] toByteArray ()
- {
- byte[] ret = new byte[count];
- System.arraycopy(buf, 0, ret, 0, count);
- return ret;
- }
-
- /**
- * Returns the bytes in the internal array as a String
. The
- * bytes in the buffer are converted to characters using the system default
- * encoding. There is an overloaded toString()
method that
- * allows an application specified character encoding to be used.
- *
- * @return A String
containing the data written to this
- * stream so far
- */
- public String toString ()
- {
- return new String (buf, 0, count);
- }
-
- /**
- * Returns the bytes in the internal array as a String
. The
- * bytes in the buffer are converted to characters using the specified
- * encoding.
- *
- * @param enc The name of the character encoding to use
- *
- * @return A String
containing the data written to this
- * stream so far
- *
- * @exception UnsupportedEncodingException If the named encoding is
- * not available
- */
- public String toString (String enc) throws UnsupportedEncodingException
- {
- return new String (buf, 0, count, enc);
- }
-
- /**
- * This method returns the bytes in the internal array as a
- * String
. It uses each byte in the array as the low
- * order eight bits of the Unicode character value and the passed in
- * parameter as the high eight bits.
- * toString
- * methods which use a true character encoding.
- *
- * @param hibyte The high eight bits to use for each character in
- * the String
- *
- * @return A String
containing the data written to this
- * stream so far
- *
- * @deprecated
- */
- public String toString (int hibyte)
- {
- return new String (buf, 0, count, hibyte);
- }
-
- // Resize buffer to accommodate new bytes.
- private void resize (int add)
- {
- if (count + add > buf.length)
- {
- int newlen = buf.length * 2;
- if (count + add > newlen)
- newlen = count + add;
- byte[] newbuf = new byte[newlen];
- System.arraycopy(buf, 0, newbuf, 0, count);
- buf = newbuf;
- }
- }
-
- /**
- * This method writes the writes the specified byte into the internal
- * buffer.
- *
- * @param oneByte The byte to be read passed as an int
- */
- public synchronized void write (int oneByte)
- {
- resize (1);
- buf[count++] = (byte) oneByte;
- }
-
- /**
- * This method writes len
bytes from the passed in array
- * buf
starting at index offset
into the
- * internal buffer.
- *
- * @param buffer The byte array to write data from
- * @param offset The index into the buffer to start writing data from
- * @param add The number of bytes to write
- */
- public synchronized void write (byte[] buffer, int offset, int add)
- {
- // If ADD < 0 then arraycopy will throw the appropriate error for
- // us.
- if (add >= 0)
- resize (add);
- System.arraycopy(buffer, offset, buf, count, add);
- count += add;
- }
-
- /**
- * This method writes all the bytes that have been written to this stream
- * from the internal buffer to the specified OutputStream
.
- *
- * @param out The OutputStream
to write to
- *
- * @exception IOException If an error occurs
- */
- public synchronized void writeTo (OutputStream out) throws IOException
- {
- out.write(buf, 0, count);
- }
-
- /**
- * The internal buffer where the data written is stored
- */
- protected byte[] buf;
-
- /**
- * The number of bytes that have been written to the buffer
- */
- protected int count;
-
- /**
- * The default initial buffer size. Specified by the JCL.
- */
- private static final int DEFAULT_INITIAL_BUFFER_SIZE = 32;
-
- // The default buffer size which can be overridden by the user.
- private static final int initial_buffer_size;
-
- static
- {
- int r
- = Integer.getInteger ("gnu.java.io.ByteArrayOutputStream.initialBufferSize",
- DEFAULT_INITIAL_BUFFER_SIZE).intValue ();
- if (r <= 0)
- r = DEFAULT_INITIAL_BUFFER_SIZE;
- initial_buffer_size = r;
- }
-}
diff --git a/libjava/java/io/CharArrayReader.java b/libjava/java/io/CharArrayReader.java
deleted file mode 100644
index c14fa077592..00000000000
--- a/libjava/java/io/CharArrayReader.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/* CharArrayReader.java -- Read an array of characters as a stream
- Copyright (C) 1998, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class permits an array of chars to be read as an input stream.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class CharArrayReader extends Reader
-{
- /**
- * The array that contains the data supplied during read operations
- */
- protected char[] buf;
-
- /**
- * The array index of the next char to be read from the buffer
- * buf
- */
- protected int pos;
-
- /**
- * The currently marked position in the stream. This defaults to 0, so a
- * reset operation on the stream resets it to read from array index 0 in
- * the buffer - even if the stream was initially created with an offset
- * greater than 0
- */
- protected int markedPos;
-
- /**
- * This indicates the maximum number of chars that can be read from this
- * stream. It is the array index of the position after the last valid
- * char in the buffer buf
- */
- protected int count;
-
- /**
- * Create a new CharArrayReader that will read chars from the passed
- * in char array. This stream will read from the beginning to the end
- * of the array. It is identical to calling an overloaded constructor
- * as CharArrayReader(buf, 0, buf.length)
.
- * offset
in the array for a length of
- * length
chars past offset
. If the
- * stream is reset to a position before offset
then
- * more than length
chars can be read from the stream.
- * The length
value should be viewed as the array index
- * one greater than the last position in the buffer to read.
- * readlimit
parameter in this
- * method does nothing as this stream is always capable of
- * remembering all the chars int it.
- * markSupported
method in
- * Reader
in order to return true
-
- * indicating that this stream class supports mark/reset
- * functionality.
- *
- * @return true
to indicate that this class supports
- * mark/reset.
- */
- public boolean markSupported()
- {
- return true;
- }
-
- /**
- * This method reads one char from the stream. The pos
- * counter is advanced to the next char to be read. The char read
- * is returned as an int in the range of 0-65535. If the stream
- * position is already at the end of the buffer, no char is read and
- * a -1 is returned in order to indicate the end of the stream.
- *
- * @return The char read, or -1 if end of stream
- */
- public int read() throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- if (pos < 0)
- throw new ArrayIndexOutOfBoundsException(pos);
-
- if (pos < count)
- return ((int) buf[pos++]) & 0xFFFF;
- return -1;
- }
- }
-
- /**
- * This method reads chars from the stream and stores them into a
- * caller supplied buffer. It starts storing the data at index
- * offset
into the buffer and attempts to read
- * len
chars. This method can return before reading
- * the number of chars requested if the end of the stream is
- * encountered first. The actual number of chars read is returned.
- * If no chars can be read because the stream is already at the end
- * of stream position, a -1 is returned.
- * true
to indicate that this stream is ready
- * to be read.
- *
- * @specnote The JDK 1.3 API docs are wrong here. This method will
- * return false if there are no more characters available.
- */
- public boolean ready() throws IOException
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- return (pos < count);
- }
-
- /**
- * This method sets the read position in the stream to the mark
- * point by setting the pos
variable equal to the
- * mark
variable. Since a mark can be set anywhere in
- * the array, the mark/reset methods int this class can be used to
- * provide random search capabilities for this type of stream.
- */
- public void reset() throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- pos = markedPos;
- }
- }
-
- /**
- * This method attempts to skip the requested number of chars in the
- * input stream. It does this by advancing the pos
value by the
- * specified number of chars. It this would exceed the length of the
- * buffer, then only enough chars are skipped to position the stream at
- * the end of the buffer. The actual number of chars skipped is returned.
- *
- * @param n The requested number of chars to skip
- *
- * @return The actual number of chars skipped.
- */
- public long skip(long n) throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- // Even though the var numChars is a long, in reality it can never
- // be larger than an int since the result of subtracting 2 positive
- // ints will always fit in an int. Since we have to return a long
- // anyway, numChars might as well just be a long.
- long numChars = Math.min((long) (count - pos), n < 0 ? 0L : n);
- pos += numChars;
- return numChars;
- }
- }
-}
diff --git a/libjava/java/io/CharArrayWriter.java b/libjava/java/io/CharArrayWriter.java
deleted file mode 100644
index f9b338fe0cc..00000000000
--- a/libjava/java/io/CharArrayWriter.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/* CharArrayWriter.java -- Write chars to a buffer
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class allows data to be written to a char array buffer and
- * and then retrieved by an application. The internal char array
- * buffer is dynamically resized to hold all the data written. Please
- * be aware that writing large amounts to data to this stream will
- * cause large amounts of memory to be allocated.
- *
- *
- * CharArrayWriter
with
- * the default buffer size of 32 chars. If a different initial
- * buffer size is desired, see the constructor
- * CharArrayWriter(int size)
.
- */
- public CharArrayWriter ()
- {
- this (DEFAULT_INITIAL_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a new CharArrayWriter
with
- * a specified initial buffer size.
- *
- * @param size The initial buffer size in chars
- */
- public CharArrayWriter (int size)
- {
- super ();
- buf = new char[size];
- }
-
- /**
- * Closes the stream. This method is guaranteed not to free the contents
- * of the internal buffer, which can still be retrieved.
- */
- public void close ()
- {
- }
-
- /**
- * This method flushes all buffered chars to the stream.
- */
- public void flush ()
- {
- }
-
- /**
- * This method discards all of the chars that have been written to the
- * internal buffer so far by setting the count
variable to
- * 0. The internal buffer remains at its currently allocated size.
- */
- public void reset ()
- {
- synchronized (lock)
- {
- count = 0;
- }
- }
-
- /**
- * This method returns the number of chars that have been written to
- * the buffer so far. This is the same as the value of the protected
- * count
variable. If the reset
method is
- * called, then this value is reset as well. Note that this method does
- * not return the length of the internal buffer, but only the number
- * of chars that have been written to it.
- *
- * @return The number of chars in the internal buffer
- *
- * @see #reset()
- */
- public int size ()
- {
- return count;
- }
-
- /**
- * This method returns a char array containing the chars that have been
- * written to this stream so far. This array is a copy of the valid
- * chars in the internal buffer and its length is equal to the number of
- * valid chars, not necessarily to the the length of the current
- * internal buffer. Note that since this method allocates a new array,
- * it should be used with caution when the internal buffer is very large.
- */
- public char[] toCharArray ()
- {
- synchronized (lock)
- {
- char[] nc = new char[count];
- System.arraycopy(buf, 0, nc, 0, count);
- return nc;
- }
- }
-
- /**
- * Returns the chars in the internal array as a String
. The
- * chars in the buffer are converted to characters using the system default
- * encoding. There is an overloaded toString()
method that
- * allows an application specified character encoding to be used.
- *
- * @return A String
containing the data written to this
- * stream so far
- */
- public String toString ()
- {
- synchronized (lock)
- {
- return new String (buf, 0, count);
- }
- }
-
- /**
- * This method writes the writes the specified char into the internal
- * buffer.
- *
- * @param oneChar The char to be read passed as an int
- */
- public void write (int oneChar)
- {
- synchronized (lock)
- {
- resize (1);
- buf[count++] = (char) oneChar;
- }
- }
-
- /**
- * This method writes len
chars from the passed in array
- * buf
starting at index offset
into that buffer
- *
- * @param buffer The char array to write data from
- * @param offset The index into the buffer to start writing data from
- * @param len The number of chars to write
- */
- public void write (char[] buffer, int offset, int len)
- {
- synchronized (lock)
- {
- if (len >= 0)
- resize (len);
- System.arraycopy(buffer, offset, buf, count, len);
- count += len;
- }
- }
-
- /**
- * This method writes len
chars from the passed in
- * String
buf
starting at index
- * offset
into the internal buffer.
- *
- * @param str The String
to write data from
- * @param offset The index into the string to start writing data from
- * @param len The number of chars to write
- */
- public void write (String str, int offset, int len)
- {
- synchronized (lock)
- {
- if (len >= 0)
- resize (len);
- str.getChars(offset, offset + len, buf, count);
- count += len;
- }
- }
-
- /**
- * This method writes all the chars that have been written to this stream
- * from the internal buffer to the specified Writer
.
- *
- * @param out The Writer
to write to
- *
- * @exception IOException If an error occurs
- */
- public void writeTo (Writer out) throws IOException
- {
- synchronized (lock)
- {
- out.write(buf, 0, count);
- }
- }
-
- /**
- * This private method makes the buffer bigger when we run out of room
- * by allocating a larger buffer and copying the valid chars from the
- * old array into it. This is obviously slow and should be avoided by
- * application programmers by setting their initial buffer size big
- * enough to hold everything if possible.
- */
- private void resize (int len)
- {
- if (count + len >= buf.length)
- {
- int newlen = buf.length * 2;
- if (count + len > newlen)
- newlen = count + len;
- char[] newbuf = new char[newlen];
- System.arraycopy(buf, 0, newbuf, 0, count);
- buf = newbuf;
- }
- }
-
- /**
- * The internal buffer where the data written is stored
- */
- protected char[] buf;
-
- /**
- * The number of chars that have been written to the buffer
- */
- protected int count;
-}
diff --git a/libjava/java/io/CharConversionException.java b/libjava/java/io/CharConversionException.java
deleted file mode 100644
index a7a608429ef..00000000000
--- a/libjava/java/io/CharConversionException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* CharConversionException.java -- Character conversion exceptions
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown to indicate that a problem occurred with
- * an attempted character conversion.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class CharConversionException extends IOException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -8680016352018427031L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public CharConversionException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public CharConversionException(String message)
- {
- super(message);
- }
-} // class CharConversionException
diff --git a/libjava/java/io/DataInput.java b/libjava/java/io/DataInput.java
deleted file mode 100644
index 45cb0c13025..00000000000
--- a/libjava/java/io/DataInput.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/* DataInput.java -- Interface for reading data from a stream
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct. */
-
-/**
- * This interface is implemented by classes that can data from streams
- * into Java primitive types.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public interface DataInput
-{
-
- /**
- * This method reads a Java boolean value from an input stream. It does
- * so by reading a single byte of data. If that byte is zero, then the
- * value returned is false
. If the byte is non-zero, then
- * the value returned is true
.
- * boolean
written by an object
- * implementing the writeBoolean()
method in the
- * DataOutput
interface.
- *
- * @return The boolean
value read
- *
- * @exception EOFException If end of file is reached before
- * reading the boolean
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeBoolean
- */
- boolean readBoolean() throws EOFException, IOException;
-
- /**
- * This method reads a Java byte value from an input stream. The value
- * is in the range of -128 to 127.
- * byte
written by an object
- * implementing the
- * writeByte()
method in the DataOutput
interface.
- * byte
value read
- *
- * @exception EOFException If end of file is reached before reading the byte
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeByte
- */
- byte readByte() throws EOFException, IOException;
-
- /**
- * This method reads 8 unsigned bits into a Java int
value from
- * the stream. The value returned is in the range of 0 to 255.
- * writeByte()
method in the DataOutput
- * interface.
- *
- * @return The unsigned bytes value read as a Java int
.
- *
- * @exception EOFException If end of file is reached before reading the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeByte
- */
- int readUnsignedByte() throws EOFException, IOException;
-
- /**
- * This method reads a Java char
value from an input stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single 16-bit Java char
. The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
and byte2
represent the
- * first and second byte read from the stream respectively, they will be
- * transformed to a char
in the following manner:
- * (char)((byte1 << 8) + byte2)
- * char
written by an object implementing
- * the
- * writeChar()
method in the DataOutput
interface.
- *
- * @return The char
value read
- *
- * @exception EOFException If end of file is reached before reading the char
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeChar
- */
- char readChar() throws EOFException, IOException;
-
- /**
- * This method reads a signed 16-bit value into a Java in from the stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single 16-bit Java short
. The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
and byte2
represent the
- * first and second byte read from the stream respectively, they will be
- * transformed to a short
in the following manner:
- * (short)(((byte1 & 0xFF) << 8) + (byte2 & 0xFF))
- * short
written by an object
- * implementing
- * the writeShort()
method in the DataOutput
- * interface.
- *
- * @return The short
value read
- *
- * @exception EOFException If end of file is reached before reading the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeShort
- */
- short readShort() throws EOFException, IOException;
-
- /**
- * This method reads 16 unsigned bits into a Java int value from the stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single Java int
. The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
and byte2
represent the
- * first and second byte read from the stream respectively, they will be
- * transformed to an int
in the following manner:
- * (int)(((byte1 0xFF) << 8) + (byte2 & 0xFF))
- * writeShort()
method in the
- * DataOutput
- * interface.
- *
- * @return The unsigned short value read as a Java int
.
- *
- * @exception EOFException If end of file is reached before reading
- * the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeShort
- */
- int readUnsignedShort() throws EOFException, IOException;
-
- /**
- * This method reads a Java int
value from an input stream
- * It operates by reading four bytes from the stream and converting them to
- * a single Java int
. The bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
through byte4
represent
- * the first four bytes read from the stream, they will be
- * transformed to an int
in the following manner:
- * (int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) +
- * ((byte3 & 0xFF)<< 8) + (byte4 & 0xFF)))
- * int
written by an object
- * implementing the writeInt()
method in the
- * DataOutput
interface.
- *
- * @return The int
value read
- *
- * @exception EOFException If end of file is reached before reading the int
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeInt
- */
- int readInt() throws EOFException, IOException;
-
- /**
- * This method reads a Java long
value from an input stream
- * It operates by reading eight bytes from the stream and converting them to
- * a single Java long
. The bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
through byte8
represent
- * the first eight bytes read from the stream, they will be
- * transformed to an long
in the following manner:
- * (long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) +
- * ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) +
- * ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) +
- * ((byte7 & 0xFF) << 8) + (byte8 & 0xFF)))
- *
- * long
written by an object
- * implementing the writeLong()
method in the
- * DataOutput
interface.
- *
- * @return The long
value read
- *
- * @exception EOFException If end of file is reached before reading the long
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeLong
- */
- long readLong() throws EOFException, IOException;
-
- /**
- * This method reads a Java float value from an input stream. It operates
- * by first reading an int
value from the stream by calling the
- * readInt()
method in this interface, then converts that
- * int
to a float
using the
- * intBitsToFloat
method in the class
- * java.lang.Float
.
- * float
written by an object
- * implementing
- * the writeFloat()
method in the DataOutput
- * interface.
- *
- * @return The float
value read
- *
- * @exception EOFException If end of file is reached before reading the
- * float
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeFloat
- * @see java.lang.Float#intBitsToFloat
- */
- float readFloat() throws EOFException, IOException;
-
- /**
- * This method reads a Java double value from an input stream. It operates
- * by first reading a long
value from the stream by calling the
- * readLong()
method in this interface, then converts that
- * long
to a double
using the
- * longBitsToDouble
method in the class
- * java.lang.Double
.
- * double
written by an object
- * implementing the writeDouble()
method in the
- * DataOutput
interface.
- *
- * @return The double
value read
- *
- * @exception EOFException If end of file is reached before reading the
- * double
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeDouble
- * @see java.lang.Double#longBitsToDouble
- */
- double readDouble() throws EOFException, IOException;
-
- /**
- * This method reads the next line of text data from an input stream.
- * It operates by reading bytes and converting those bytes to
- * char
- * values by treating the byte read as the low eight bits of the
- * char
and using 0 as the high eight bits. Because of this,
- * it does not support the full 16-bit Unicode character set.
- * String
.
- * A line terminator is a byte sequence consisting of either
- * \r
, \n
or \r\n
. These termination
- * charaters are discarded and are not returned as part of the string.
- * A line is also terminated by an end of file condition.
- * String
- *
- * @exception IOException If an error occurs
- */
- String readLine() throws IOException;
-
- /**
- * This method reads a String
from an input stream that is
- * encoded in a modified UTF-8 format. This format has a leading two byte
- * sequence that contains the remaining number of bytes to read.
- * This two byte
- * sequence is read using the readUnsignedShort()
method of this
- * interface.
- *
- * After the number of remaining bytes have been determined, these bytes
- * are read an transformed into char
values. These
- * char
values are encoded in the stream using either a one,
- * two, or three byte format.
- * The particular format in use can be determined by examining the first
- * byte read.
- * byte1
is the byte read from the stream, it would
- * be converted to a char
like so:
- * (char)byte1
- * byte1
and byte2
are the first
- * two bytes read respectively, and the high order bits of them match the
- * patterns which indicate a two byte character encoding, then they would be
- * converted to a Java char
like so:
- * (char)(((byte1 & 0x1F) << 6) + (byte2 & 0x3F))
- * byte1
, byte2
, and
- * byte3
are the three bytes read, and the high order bits of
- * them match the patterns which indicate a three byte character encoding,
- * then they would be converted to a Java char
like so:
- *
- *
- * (char)(((byte1 & 0x0F) << 12) + ((byte2 & 0x3F) + (byte3 & 0x3F))
- *
- *
- * Note that all characters are encoded in the method that requires the
- * fewest number of bytes with the exception of the character with the
- * value of \<llll>u0000
which is encoded as two bytes.
- * This is a modification of the UTF standard used to prevent C language
- * style NUL
values from appearing in the byte stream.
- * writeUTF()
method in DataOutput
.
- *
- * @return The String
read
- *
- * @exception EOFException If end of file is reached before reading the
- * String
- * @exception UTFDataFormatException If the data is not in UTF-8 format
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeUTF
- */
- String readUTF() throws EOFException, UTFDataFormatException, IOException;
-
- /**
- * This method reads raw bytes into the passed array until the array is
- * full. Note that this method blocks until the data is available and
- * throws an exception if there is not enough data left in the stream to
- * fill the buffer. Note also that zero length buffers are permitted.
- * In this case, the method will return immediately without reading any
- * bytes from the stream.
- *
- * @param buf The buffer into which to read the data
- *
- * @exception EOFException If end of file is reached before filling the
- * buffer
- * @exception IOException If any other error occurs
- */
- void readFully(byte[] buf) throws EOFException, IOException;
-
- /**
- * This method reads raw bytes into the passed array buf
- * starting
- * offset
bytes into the buffer. The number of bytes read
- * will be
- * exactly len
. Note that this method blocks until the data is
- * available and throws an exception if there is not enough data left in
- * the stream to read len
bytes. Note also that zero length
- * buffers are permitted. In this case, the method will return immediately
- * without reading any bytes from the stream.
- *
- * @param buf The buffer into which to read the data
- * @param offset The offset into the buffer to start storing data
- * @param len The number of bytes to read into the buffer
- *
- * @exception EOFException If end of file is reached before filling the
- * buffer
- * @exception IOException If any other error occurs
- */
- void readFully(byte[] buf, int offset, int len)
- throws EOFException, IOException;
-
- /**
- * This method skips and discards the specified number of bytes in an
- * input stream. Note that this method may skip less than the requested
- * number of bytes. The actual number of bytes skipped is returned.
- * No bytes are skipped if a negative number is passed to this method.
- *
- * @param numBytes The number of bytes to skip
- *
- * @return The number of bytes actually skipped, which will always be
- * numBytes
- *
- * @exception EOFException If end of file is reached before all bytes can be
- * skipped
- * @exception IOException If any other error occurs
- */
- int skipBytes(int numBytes) throws EOFException, IOException;
-
-} // interface DataInput
diff --git a/libjava/java/io/DataInputStream.java b/libjava/java/io/DataInputStream.java
deleted file mode 100644
index da60a8e8c68..00000000000
--- a/libjava/java/io/DataInputStream.java
+++ /dev/null
@@ -1,739 +0,0 @@
-/* DataInputStream.java -- FilteredInputStream that implements DataInput
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This subclass of FilteredInputStream
implements the
- * DataInput
interface that provides method for reading primitive
- * Java data types from a stream.
- *
- * @see DataInput
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @date October 20, 1998.
- */
-public class DataInputStream extends FilterInputStream implements DataInput
-{
- // Byte buffer, used to make primitive read calls more efficient.
- byte[] buf = new byte [8];
-
- /**
- * This constructor initializes a new DataInputStream
- * to read from the specified subordinate stream.
- *
- * @param in The subordinate InputStream
to read from
- */
- public DataInputStream (InputStream in)
- {
- super (in);
- }
-
- /**
- * This method reads bytes from the underlying stream into the specified
- * byte array buffer. It will attempt to fill the buffer completely, but
- * may return a short count if there is insufficient data remaining to be
- * read to fill the buffer.
- *
- * @param b The buffer into which bytes will be read.
- *
- * @return The actual number of bytes read, or -1 if end of stream reached
- * before reading any bytes.
- *
- * @exception IOException If an error occurs.
- */
- public final int read (byte[] b) throws IOException
- {
- return in.read (b, 0, b.length);
- }
-
- /**
- * This method reads bytes from the underlying stream into the specified
- * byte array buffer. It will attempt to read len
bytes and
- * will start storing them at position off
into the buffer.
- * This method can return a short count if there is insufficient data
- * remaining to be read to complete the desired read length.
- *
- * @param b The buffer into which bytes will be read.
- * @param off The offset into the buffer to start storing bytes.
- * @param len The requested number of bytes to read.
- *
- * @return The actual number of bytes read, or -1 if end of stream reached
- * before reading any bytes.
- *
- * @exception IOException If an error occurs.
- */
- public final int read (byte[] b, int off, int len) throws IOException
- {
- return in.read (b, off, len);
- }
-
- /**
- * This method reads a Java boolean value from an input stream. It does
- * so by reading a single byte of data. If that byte is zero, then the
- * value returned is false
. If the byte is non-zero, then
- * the value returned is true
.
- * boolean
written by an object
- * implementing the writeBoolean()
method in the
- * DataOutput
interface.
- *
- * @return The boolean
value read
- *
- * @exception EOFException If end of file is reached before reading
- * the boolean
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeBoolean
- */
- public final boolean readBoolean () throws IOException
- {
- return convertToBoolean (in.read ());
- }
-
- /**
- * This method reads a Java byte value from an input stream. The value
- * is in the range of -128 to 127.
- * byte
written by an object
- * implementing the writeByte()
method in the
- * DataOutput
interface.
- *
- * @return The byte
value read
- *
- * @exception EOFException If end of file is reached before reading the byte
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeByte
- */
- public final byte readByte () throws IOException
- {
- return convertToByte (in.read ());
- }
-
- /**
- * This method reads a Java char
value from an input stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single 16-bit Java char
. The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
and byte2
- * represent the first and second byte read from the stream
- * respectively, they will be transformed to a char
in
- * the following manner:
- * (char)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF)
- * char
written by an object
- * implementing the writeChar()
method in the
- * DataOutput
interface.
- *
- * @return The char
value read
- *
- * @exception EOFException If end of file is reached before reading the char
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeChar
- */
- public final char readChar () throws IOException
- {
- readFully (buf, 0, 2);
- return convertToChar (buf);
- }
-
- /**
- * This method reads a Java double value from an input stream. It operates
- * by first reading a long
value from the stream by calling the
- * readLong()
method in this interface, then converts
- * that long
to a double
using the
- * longBitsToDouble
method in the class
- * java.lang.Double
- * double
written by an object
- * implementing the writeDouble()
method in the
- * DataOutput
interface.
- *
- * @return The double
value read
- *
- * @exception EOFException If end of file is reached before reading
- * the double
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeDouble
- * @see java.lang.Double#longBitsToDouble
- */
- public final double readDouble () throws IOException
- {
- return Double.longBitsToDouble (readLong ());
- }
-
- /**
- * This method reads a Java float value from an input stream. It
- * operates by first reading an int
value from the
- * stream by calling the readInt()
method in this
- * interface, then converts that int
to a
- * float
using the intBitsToFloat
method
- * in the class java.lang.Float
- * float
written by an object
- * implementing the writeFloat()
method in the
- * DataOutput
interface.
- *
- * @return The float
value read
- *
- * @exception EOFException If end of file is reached before reading the float
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeFloat
- * @see java.lang.Float#intBitsToFloat
- */
- public final float readFloat () throws IOException
- {
- return Float.intBitsToFloat (readInt ());
- }
-
- /**
- * This method reads raw bytes into the passed array until the array is
- * full. Note that this method blocks until the data is available and
- * throws an exception if there is not enough data left in the stream to
- * fill the buffer. Note also that zero length buffers are permitted.
- * In this case, the method will return immediately without reading any
- * bytes from the stream.
- *
- * @param b The buffer into which to read the data
- *
- * @exception EOFException If end of file is reached before filling the
- * buffer
- * @exception IOException If any other error occurs
- */
- public final void readFully (byte[] b) throws IOException
- {
- readFully (b, 0, b.length);
- }
-
- /**
- * This method reads raw bytes into the passed array buf
- * starting
- * offset
bytes into the buffer. The number of bytes read
- * will be
- * exactly len
. Note that this method blocks until the data is
- * available and throws an exception if there is not enough data left in
- * the stream to read len
bytes. Note also that zero length
- * buffers are permitted. In this case, the method will return immediately
- * without reading any bytes from the stream.
- *
- * @param buf The buffer into which to read the data
- * @param offset The offset into the buffer to start storing data
- * @param len The number of bytes to read into the buffer
- *
- * @exception EOFException If end of file is reached before filling the
- * buffer
- * @exception IOException If any other error occurs
- */
- public final void readFully (byte[] buf, int offset, int len) throws IOException
- {
- if (len < 0)
- throw new IndexOutOfBoundsException("Negative length: " + len);
-
- while (len > 0)
- {
- // in.read will block until some data is available.
- int numread = in.read (buf, offset, len);
- if (numread < 0)
- throw new EOFException ();
- len -= numread;
- offset += numread;
- }
- }
-
- /**
- * This method reads a Java int
value from an input stream
- * It operates by reading four bytes from the stream and converting them to
- * a single Java int
. The bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
through byte4
represent
- * the first four bytes read from the stream, they will be
- * transformed to an int
in the following manner:
- * (int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) +
- * ((byte3 & 0xFF)<< 8) + (byte4 & 0xFF)))
- * int
written by an object
- * implementing the writeInt()
method in the
- * DataOutput
interface.
- *
- * @return The int
value read
- *
- * @exception EOFException If end of file is reached before reading the int
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeInt
- */
- public final int readInt () throws IOException
- {
- readFully (buf, 0, 4);
- return convertToInt (buf);
- }
-
- /**
- * This method reads the next line of text data from an input
- * stream. It operates by reading bytes and converting those bytes
- * to char
values by treating the byte read as the low
- * eight bits of the char
and using 0 as the high eight
- * bits. Because of this, it does not support the full 16-bit
- * Unicode character set.
- * String
A line terminator is a byte sequence
- * consisting of either \r
, \n
or
- * \r\n
. These termination charaters are discarded and
- * are not returned as part of the string.
- * writeLine()
method in DataOutput
.
- *
- * @return The line read as a String
- *
- * @exception IOException If an error occurs
- *
- * @see DataOutput
- *
- * @deprecated
- */
- public final String readLine() throws IOException
- {
- StringBuffer strb = new StringBuffer();
-
- while (true)
- {
- int c = in.read();
- if (c == -1) // got an EOF
- return strb.length() > 0 ? strb.toString() : null;
- if (c == '\r')
- {
- int next_c = in.read();
- if (next_c != '\n' && next_c != -1)
- {
- if (! (in instanceof PushbackInputStream))
- in = new PushbackInputStream(in);
- ((PushbackInputStream) in).unread(next_c);
- }
- break;
- }
- if (c == '\n')
- break;
- strb.append((char) c);
- }
-
- return strb.length() > 0 ? strb.toString() : "";
- }
-
- /**
- * This method reads a Java long
value from an input stream
- * It operates by reading eight bytes from the stream and converting them to
- * a single Java long
. The bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
through byte8
represent
- * the first eight bytes read from the stream, they will be
- * transformed to an long
in the following manner:
- * (long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) +
- * ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) +
- * ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) +
- * ((byte7 & 0xFF) << 8) + (byte8 & 0xFF)))
- *
- * long
written by an object
- * implementing the writeLong()
method in the
- * DataOutput
interface.
- *
- * @return The long
value read
- *
- * @exception EOFException If end of file is reached before reading the long
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeLong
- */
- public final long readLong () throws IOException
- {
- readFully (buf, 0, 8);
- return convertToLong (buf);
- }
-
- /**
- * This method reads a signed 16-bit value into a Java in from the
- * stream. It operates by reading two bytes from the stream and
- * converting them to a single 16-bit Java short
. The
- * two bytes are stored most significant byte first (i.e., "big
- * endian") regardless of the native host byte ordering.
- * byte1
and byte2
- * represent the first and second byte read from the stream
- * respectively, they will be transformed to a short
. in
- * the following manner:
- * (short)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF))
- * short
written by an object
- * implementing the writeShort()
method in the
- * DataOutput
interface.
- *
- * @return The short
value read
- *
- * @exception EOFException If end of file is reached before reading the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeShort
- */
- public final short readShort () throws IOException
- {
- readFully (buf, 0, 2);
- return convertToShort (buf);
- }
-
- /**
- * This method reads 8 unsigned bits into a Java int
- * value from the stream. The value returned is in the range of 0 to
- * 255.
- * writeUnsignedByte()
method in the
- * DataOutput
interface.
- *
- * @return The unsigned bytes value read as a Java int
.
- *
- * @exception EOFException If end of file is reached before reading the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeByte
- */
- public final int readUnsignedByte () throws IOException
- {
- return convertToUnsignedByte (in.read ());
- }
-
- /**
- * This method reads 16 unsigned bits into a Java int value from the stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single Java int
The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * byte1
and byte2
- * represent the first and second byte read from the stream
- * respectively, they will be transformed to an int
in
- * the following manner:
- * (int)(((byte1 & 0xFF) << 8) + (byte2 & 0xFF))
- * writeUnsignedShort()
method in the
- * DataOutput
interface.
- *
- * @return The unsigned short value read as a Java int
- *
- * @exception EOFException If end of file is reached before reading the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeShort
- */
- public final int readUnsignedShort () throws IOException
- {
- readFully (buf, 0, 2);
- return convertToUnsignedShort (buf);
- }
-
- /**
- * This method reads a String
from an input stream that
- * is encoded in a modified UTF-8 format. This format has a leading
- * two byte sequence that contains the remaining number of bytes to
- * read. This two byte sequence is read using the
- * readUnsignedShort()
method of this interface.
- * char
values.
- * These char
values are encoded in the stream using
- * either a one, two, or three byte format. The particular format
- * in use can be determined by examining the first byte read.
- * byte1
is the byte read from the stream,
- * it would be converted to a char
like so:
- * (char)byte1
- * byte1
and byte2
are
- * the first two bytes read respectively, and the high order bits of
- * them match the patterns which indicate a two byte character
- * encoding, then they would be converted to a Java
- * char
like so:
- * (char)(((byte1 & 0x1F) << 6) | (byte2 & 0x3F))
- * byte1
byte2
and
- * byte3
are the three bytes read, and the high order
- * bits of them match the patterns which indicate a three byte
- * character encoding, then they would be converted to a Java
- * char
like so:
- * (char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
- * (byte3 & 0x3F))
- * \u0000
which is encoded as two
- * bytes. This is a modification of the UTF standard used to
- * prevent C language style NUL
values from appearing
- * in the byte stream.
- * writeUTF()
method in DataOutput
- *
- * @return The String
read
- *
- * @exception EOFException If end of file is reached before reading
- * the String
- * @exception UTFDataFormatException If the data is not in UTF-8 format
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeUTF
- */
- public final String readUTF () throws IOException
- {
- return readUTF (this);
- }
-
- /**
- * This method reads a String encoded in UTF-8 format from the
- * specified DataInput
source.
- *
- * @param in The DataInput
source to read from
- *
- * @return The String read from the source
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readUTF
- */
- public static final String readUTF(DataInput in) throws IOException
- {
- final int UTFlen = in.readUnsignedShort ();
- byte[] buf = new byte [UTFlen];
-
- // This blocks until the entire string is available rather than
- // doing partial processing on the bytes that are available and then
- // blocking. An advantage of the latter is that Exceptions
- // could be thrown earlier. The former is a bit cleaner.
- in.readFully (buf, 0, UTFlen);
-
- return convertFromUTF (buf);
- }
-
- /**
- * This method attempts to skip and discard the specified number of bytes
- * in the input stream. It may actually skip fewer bytes than requested.
- * This method will not skip any bytes if passed a negative number of bytes
- * to skip.
- *
- * @param n The requested number of bytes to skip.
- *
- * @return The requested number of bytes to skip.
- *
- * @exception IOException If an error occurs.
- * @specnote The JDK docs claim that this returns the number of bytes
- * actually skipped. The JCL claims that this method can throw an
- * EOFException. Neither of these appear to be true in the JDK 1.3's
- * implementation. This tries to implement the actual JDK behaviour.
- */
- public final int skipBytes (int n) throws IOException
- {
- if (n <= 0)
- return 0;
- try
- {
- return (int) in.skip (n);
- }
- catch (EOFException x)
- {
- // do nothing.
- }
- return n;
- }
-
- static boolean convertToBoolean (int b) throws EOFException
- {
- if (b < 0)
- throw new EOFException ();
-
- return (b != 0);
- }
-
- static byte convertToByte (int i) throws EOFException
- {
- if (i < 0)
- throw new EOFException ();
-
- return (byte) i;
- }
-
- static int convertToUnsignedByte (int i) throws EOFException
- {
- if (i < 0)
- throw new EOFException ();
-
- return (i & 0xFF);
- }
-
- static char convertToChar (byte[] buf)
- {
- return (char) ((buf [0] << 8)
- | (buf [1] & 0xff));
- }
-
- static short convertToShort (byte[] buf)
- {
- return (short) ((buf [0] << 8)
- | (buf [1] & 0xff));
- }
-
- static int convertToUnsignedShort (byte[] buf)
- {
- return (((buf [0] & 0xff) << 8)
- | (buf [1] & 0xff));
- }
-
- static int convertToInt (byte[] buf)
- {
- return (((buf [0] & 0xff) << 24)
- | ((buf [1] & 0xff) << 16)
- | ((buf [2] & 0xff) << 8)
- | (buf [3] & 0xff));
- }
-
- static long convertToLong (byte[] buf)
- {
- return (((long)(buf [0] & 0xff) << 56) |
- ((long)(buf [1] & 0xff) << 48) |
- ((long)(buf [2] & 0xff) << 40) |
- ((long)(buf [3] & 0xff) << 32) |
- ((long)(buf [4] & 0xff) << 24) |
- ((long)(buf [5] & 0xff) << 16) |
- ((long)(buf [6] & 0xff) << 8) |
- ((long)(buf [7] & 0xff)));
- }
-
- // FIXME: This method should be re-thought. I suspect we have multiple
- // UTF-8 decoders floating around. We should use the standard charset
- // converters, maybe and adding a direct call into one of the new
- // NIO converters for a super-fast UTF8 decode.
- static String convertFromUTF (byte[] buf)
- throws EOFException, UTFDataFormatException
- {
- // Give StringBuffer an initial estimated size to avoid
- // enlarge buffer frequently
- StringBuffer strbuf = new StringBuffer (buf.length / 2 + 2);
-
- for (int i = 0; i < buf.length; )
- {
- if ((buf [i] & 0x80) == 0) // bit pattern 0xxxxxxx
- strbuf.append ((char) (buf [i++] & 0xFF));
- else if ((buf [i] & 0xE0) == 0xC0) // bit pattern 110xxxxx
- {
- if (i + 1 >= buf.length
- || (buf [i + 1] & 0xC0) != 0x80)
- throw new UTFDataFormatException ();
-
- strbuf.append((char) (((buf [i++] & 0x1F) << 6)
- | (buf [i++] & 0x3F)));
- }
- else if ((buf [i] & 0xF0) == 0xE0) // bit pattern 1110xxxx
- {
- if (i + 2 >= buf.length
- || (buf [i + 1] & 0xC0) != 0x80
- || (buf [i + 2] & 0xC0) != 0x80)
- throw new UTFDataFormatException ();
-
- strbuf.append ((char) (((buf [i++] & 0x0F) << 12)
- | ((buf [i++] & 0x3F) << 6)
- | (buf [i++] & 0x3F)));
- }
- else // must be ((buf [i] & 0xF0) == 0xF0 || (buf [i] & 0xC0) == 0x80)
- throw new UTFDataFormatException (); // bit patterns 1111xxxx or
- // 10xxxxxx
- }
-
- return strbuf.toString ();
- }
-}
diff --git a/libjava/java/io/DataOutput.java b/libjava/java/io/DataOutput.java
deleted file mode 100644
index 2eccc552b8e..00000000000
--- a/libjava/java/io/DataOutput.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/* DataOutput.java -- Interface for writing data from a stream
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.1.
- */
-
-/**
- * This interface is implemented by classes that can wrte data to streams
- * from Java primitive types. This data can subsequently be read back
- * by classes implementing the DataInput
interface.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- *
- * @see DataInput
- */
-public interface DataOutput
-{
- /**
- * This method writes a Java boolean value to an output stream. If
- * value
is true
, a byte with the value of
- * 1 will be written, otherwise a byte with the value of 0 will be
- * written.
- *
- * The value written can be read using the readBoolean
- * method in DataInput
.
- *
- * @param value The boolean value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readBoolean
- */
- void writeBoolean(boolean value) throws IOException;
-
- /**
- * This method writes a Java byte value to an output stream. The
- * byte to be written will be in the lowest 8 bits of the
- * int
value passed.
- *
- * The value written can be read using the readByte
or
- * readUnsignedByte
methods in DataInput
.
- *
- * @param value The int value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readByte
- * @see DataInput#readUnsignedByte
- */
- void writeByte(int value) throws IOException;
-
- /**
- * This method writes a Java char value to an output stream. The
- * char to be written will be in the lowest 16 bits of the int
- * value passed. These bytes will be written "big endian". That is,
- * with the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF00) >> 8);
- *
- * byte1 = (byte)(value & 0x00FF);readChar
- * method in DataInput
.
- *
- * @param value The char value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readChar
- */
- void writeChar(int value) throws IOException;
-
- /**
- * This method writes a Java short value to an output stream. The
- * char to be written will be in the lowest 16 bits of the int
- * value passed. These bytes will be written "big endian". That is,
- * with the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF00) >> 8);
- *
- * byte1 = (byte)(value & 0x00FF);readShort
and
- * readUnsignedShort
methods in DataInput
.
- *
- * @param value The int value to write as a 16-bit value
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readShort
- * @see DataInput#readUnsignedShort
- */
- void writeShort(int value) throws IOException;
-
- /**
- * This method writes a Java int value to an output stream. The 4 bytes
- * of the passed value will be written "big endian". That is, with
- * the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF000000) >> 24);
- *
- * byte1 = (byte)((value & 0x00FF0000) >> 16);
- * byte2 = (byte)((value & 0x0000FF00) >> 8);
- * byte3 = (byte)(value & 0x000000FF);readInt
- * method in DataInput
.
- *
- * @param value The int value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readInt
- */
- void writeInt(int value) throws IOException;
-
- /**
- * This method writes a Java long value to an output stream. The 8 bytes
- * of the passed value will be written "big endian". That is, with
- * the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF00000000000000L) >> 56);
- *
- * byte1 = (byte)((value & 0x00FF000000000000L) >> 48);
- * byte2 = (byte)((value & 0x0000FF0000000000L) >> 40);
- * byte3 = (byte)((value & 0x000000FF00000000L) >> 32);
- * byte4 = (byte)((value & 0x00000000FF000000L) >> 24);
- * byte5 = (byte)((value & 0x0000000000FF0000L) >> 16);
- * byte6 = (byte)((value & 0x000000000000FF00L) >> 8);
- * byte7 = (byte)(value & 0x00000000000000FFL);readLong
- * method in DataInput
.
- *
- * @param value The long value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readLong
- */
- void writeLong(long value) throws IOException;
-
- /**
- * This method writes a Java float
value to the stream. This
- * value is written by first calling the method
- * Float.floatToIntBits
- * to retrieve an int
representing the floating point number,
- * then writing this int
value to the stream exactly the same
- * as the writeInt()
method does.
- *
- * The value written can be read using the readFloat
- * method in DataInput
.
- *
- * @param value The float value to write
- *
- * @exception IOException If an error occurs
- *
- * @see writeInt
- * @see DataInput#readFloat
- * @see Float#floatToIntBits
- */
- void writeFloat(float value) throws IOException;
-
- /**
- * This method writes a Java double
value to the stream. This
- * value is written by first calling the method
- * Double.doubleToLongBits
- * to retrieve an long
representing the floating point number,
- * then writing this long
value to the stream exactly the same
- * as the writeLong()
method does.
- *
- * The value written can be read using the readDouble
- * method in DataInput
.
- *
- * @param value The double value to write
- *
- * @exception IOException If any other error occurs
- *
- * @see writeLong
- * @see DataInput#readDouble
- * @see Double#doubleToLongBits
- */
- void writeDouble(double value) throws IOException;
-
- /**
- * This method writes all the bytes in a String
out to the
- * stream. One byte is written for each character in the
- * String
.
- * The high eight bits of each character are discarded, thus this
- * method is inappropriate for completely representing Unicode characters.
- *
- * @param value The String
to write
- *
- * @exception IOException If an error occurs
- */
- void writeBytes(String value) throws IOException;
-
- /**
- * This method writes all the characters of a String
to an
- * output stream as an array of char
's. Each character
- * is written using the method specified in the writeChar
- * method.
- *
- * @param value The String to write
- *
- * @exception IOException If an error occurs
- *
- * @see writeChar
- */
- void writeChars(String value) throws IOException;
-
- /**
- * This method writes a Java String
to the stream in a modified
- * UTF-8 format. First, two bytes are written to the stream indicating the
- * number of bytes to follow. This is written in the form of a Java
- * short
value in the same manner used by the
- * writeShort
method. Note that this is the number of
- * bytes in the
- * encoded String
not the String
length. Next
- * come the encoded characters. Each character in the String
- * is encoded as either one, two or three bytes. For characters in the
- * range of \u0001
to \u007F
, one byte is used.
- * The character
- * value goes into bits 0-7 and bit eight is 0. For characters in the range
- * of \u0080
to \u007FF
, two bytes are used. Bits
- * 6-10 of the character value are encoded bits 0-4 of the first byte, with
- * the high bytes having a value of "110". Bits 0-5 of the character value
- * are stored in bits 0-5 of the second byte, with the high bits set to
- * "10". This type of encoding is also done for the null character
- * \u0000
. This eliminates any C style NUL character values
- * in the output. All remaining characters are stored as three bytes.
- * Bits 12-15 of the character value are stored in bits 0-3 of the first
- * byte. The high bits of the first bytes are set to "1110". Bits 6-11
- * of the character value are stored in bits 0-5 of the second byte. The
- * high bits of the second byte are set to "10". And bits 0-5 of the
- * character value are stored in bits 0-5 of byte three, with the high bits
- * of that byte set to "10".
- *
- * The value written can be read using the readUTF
- * method in DataInput
.
- *
- * @param value The String
to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readUTF
- */
- void writeUTF(String value) throws IOException;
-
- /**
- * This method writes an 8-bit value (passed into the method as a Java
- * int
) to an output stream. The low 8 bits of the
- * passed value are written.
- *
- * @param value The byte
to write to the output stream
- *
- * @exception IOException If an error occurs
- */
- void write(int value) throws IOException;
-
- /**
- * This method writes the raw byte array passed in to the output stream.
- *
- * @param buf The byte array to write
- *
- * @exception IOException If an error occurs
- */
- void write(byte[] buf) throws IOException;
-
- /**
- * This method writes raw bytes from the passed array buf
- * starting
- * offset
bytes into the buffer. The number of bytes
- * written will be exactly len
.
- *
- * @param buf The buffer from which to write the data
- * @param offset The offset into the buffer to start writing data from
- * @param len The number of bytes to write from the buffer to the output
- * stream
- *
- * @exception IOException If any other error occurs
- */
- void write(byte[] buf, int offset, int len) throws IOException;
-
-} // interface DataOutput
-
diff --git a/libjava/java/io/DataOutputStream.java b/libjava/java/io/DataOutputStream.java
deleted file mode 100644
index 39f7ed1ff24..00000000000
--- a/libjava/java/io/DataOutputStream.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/* DataOutputStream.java -- Writes primitive Java datatypes to streams
- Copyright (C) 1998, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.1.
- */
-
-/**
- * This class provides a mechanism for writing primitive Java datatypes
- * to an OutputStream
in a portable way. Data written to
- * a stream using this class can be read back in using the
- * DataInputStream
class on any platform.
- *
- * @see DataInputStream
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class DataOutputStream extends FilterOutputStream implements DataOutput
-{
- /**
- * This is the total number of bytes that have been written to the
- * stream by this object instance.
- */
- protected int written;
-
- /**
- * This method initializes an instance of DataOutputStream
to
- * write its data to the specified underlying OutputStream
- *
- * @param out The subordinate OutputStream
to which this
- * object will write
- */
- public DataOutputStream (OutputStream out)
- {
- super (out);
- written = 0;
- }
-
- /**
- * This method flushes any unwritten bytes to the underlying stream.
- *
- * @exception IOException If an error occurs.
- */
- public void flush () throws IOException
- {
- out.flush();
- }
-
- /**
- * This method returns the total number of bytes that have been written to
- * the underlying output stream so far. This is the value of the
- * written
instance variable
- *
- * @return The number of bytes written to the stream.
- */
- public final int size ()
- {
- return written;
- }
-
- /**
- * This method writes the specified byte (passed as an int
)
- * to the underlying output stream.
- *
- * @param value The byte
to write, passed as an int
.
- *
- * @exception IOException If an error occurs.
- */
- public synchronized void write (int value) throws IOException
- {
- out.write (value);
- ++written;
- }
-
- /**
- * This method writes len
bytes from the specified byte array
- * buf
starting at position offset
into the
- * buffer to the underlying output stream.
- *
- * @param buf The byte array to write from.
- * @param offset The index into the byte array to start writing from.
- * @param len The number of bytes to write.
- *
- * @exception IOException If an error occurs.
- */
- public synchronized void write (byte[] buf, int offset, int len)
- throws IOException
- {
- out.write(buf, offset, len);
- written += len;
- }
-
- /**
- * This method writes a Java boolean value to an output stream. If
- * value
is true
, a byte with the value of
- * 1 will be written, otherwise a byte with the value of 0 will be
- * written.
- *
- * The value written can be read using the readBoolean
- * method in DataInput
.
- *
- * @param value The boolean
value to write to the stream
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readBoolean
- */
- public final void writeBoolean (boolean value) throws IOException
- {
- write (value ? 1 : 0);
- }
-
- /**
- * This method writes a Java byte value to an output stream. The
- * byte to be written will be in the lowest 8 bits of the
- * int
value passed.
- *
- * The value written can be read using the readByte
or
- * readUnsignedByte
methods in DataInput
.
- *
- * @param value The byte
to write to the stream, passed as
- * the low eight bits of an int
.
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readByte
- * @see DataInput#readUnsignedByte
- */
- public final void writeByte (int value) throws IOException
- {
- write (value & 0xff);
- }
-
- /**
- * This method writes a Java short value to an output stream. The
- * char to be written will be in the lowest 16 bits of the int
- * value passed. These bytes will be written "big endian". That is,
- * with the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF00) >> 8);
- *
- * byte1 = (byte)(value & 0x00FF);readShort
and
- * readUnsignedShort
methods in DataInput
.
- *
- * @param value The short
value to write to the stream,
- * passed as an int
.
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readShort
- * @see DataInput#readUnsignedShort
- */
- public final synchronized void writeShort (int value) throws IOException
- {
- write ((byte) (0xff & (value >> 8)));
- write ((byte) (0xff & value));
- }
-
- /**
- * This method writes a Java char value to an output stream. The
- * char to be written will be in the lowest 16 bits of the int
- * value passed. These bytes will be written "big endian". That is,
- * with the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF00) >> 8);
- *
- * byte1 = (byte)(value & 0x00FF);readChar
- * method in DataInput
.
- *
- * @param value The char
value to write,
- * passed as an int
.
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readChar
- */
- public final synchronized void writeChar (int value) throws IOException
- {
- write ((byte) (0xff & (value >> 8)));
- write ((byte) (0xff & value));
- }
-
- /**
- * This method writes a Java int value to an output stream. The 4 bytes
- * of the passed value will be written "big endian". That is, with
- * the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF000000) >> 24);
- *
- * byte1 = (byte)((value & 0x00FF0000) >> 16);
- * byte2 = (byte)((value & 0x0000FF00) >> 8);
- * byte3 = (byte)(value & 0x000000FF);readInt
- * method in DataInput
.
- *
- * @param value The int
value to write to the stream
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readInt
- */
- public final synchronized void writeInt (int value) throws IOException
- {
- write ((byte) (0xff & (value >> 24)));
- write ((byte) (0xff & (value >> 16)));
- write ((byte) (0xff & (value >> 8)));
- write ((byte) (0xff & value));
- }
-
- /**
- * This method writes a Java long value to an output stream. The 8 bytes
- * of the passed value will be written "big endian". That is, with
- * the high byte written first in the following manner:
- * byte0 = (byte)((value & 0xFF00000000000000L) >> 56);
- *
- * byte1 = (byte)((value & 0x00FF000000000000L) >> 48);
- * byte2 = (byte)((value & 0x0000FF0000000000L) >> 40);
- * byte3 = (byte)((value & 0x000000FF00000000L) >> 32);
- * byte4 = (byte)((value & 0x00000000FF000000L) >> 24);
- * byte5 = (byte)((value & 0x0000000000FF0000L) >> 16);
- * byte6 = (byte)((value & 0x000000000000FF00L) >> 8);
- * byte7 = (byte)(value & 0x00000000000000FFL);readLong
- * method in DataInput
.
- *
- * @param value The long
value to write to the stream
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readLong
- */
- public final synchronized void writeLong (long value) throws IOException
- {
- write ((byte) (0xff & (value >> 56)));
- write ((byte) (0xff & (value>> 48)));
- write ((byte) (0xff & (value>> 40)));
- write ((byte) (0xff & (value>> 32)));
- write ((byte) (0xff & (value>> 24)));
- write ((byte) (0xff & (value>> 16)));
- write ((byte) (0xff & (value>> 8)));
- write ((byte) (0xff & value));
- }
-
- /**
- * This method writes a Java float
value to the stream. This
- * value is written by first calling the method
- * Float.floatToIntBits
- * to retrieve an int
representing the floating point number,
- * then writing this int
value to the stream exactly the same
- * as the writeInt()
method does.
- *
- * The value written can be read using the readFloat
- * method in DataInput
.
- *
- * @param value The float
value to write to the stream
- *
- * @exception IOException If an error occurs
- *
- * @see writeInt
- * @see DataInput#readFloat
- * @see Float#floatToIntBits
- */
- public final void writeFloat (float value) throws IOException
- {
- writeInt (Float.floatToIntBits (value));
- }
-
- /**
- * This method writes a Java double
value to the stream. This
- * value is written by first calling the method
- * Double.doubleToLongBits
- * to retrieve an long
representing the floating point number,
- * then writing this long
value to the stream exactly the same
- * as the writeLong()
method does.
- *
- * The value written can be read using the readDouble
- * method in DataInput
.
- *
- * @param value The double
value to write to the stream
- *
- * @exception IOException If an error occurs
- *
- * @see writeLong
- * @see DataInput#readDouble
- * @see Double#doubleToLongBits
- */
- public final void writeDouble (double value) throws IOException
- {
- writeLong (Double.doubleToLongBits (value));
- }
-
- /**
- * This method writes all the bytes in a String
out to the
- * stream. One byte is written for each character in the
- * String
.
- * The high eight bits of each character are discarded, thus this
- * method is inappropriate for completely representing Unicode characters.
- *
- * @param value The String
to write to the stream
- *
- * @exception IOException If an error occurs
- */
- public final void writeBytes (String value) throws IOException
- {
- int len = value.length();
- for (int i = 0; i < len; ++i)
- writeByte (value.charAt(i));
- }
-
- /**
- * This method writes all the characters of a String
to an
- * output stream as an array of char
's. Each character
- * is written using the method specified in the writeChar
- * method.
- *
- * @param value The String
to write to the stream
- *
- * @exception IOException If an error occurs
- *
- * @see writeChar
- */
- public final void writeChars (String value) throws IOException
- {
- int len = value.length();
- for (int i = 0; i < len; ++i)
- writeChar (value.charAt(i));
- }
-
- /**
- * This method writes a Java String
to the stream in a modified
- * UTF-8 format. First, two bytes are written to the stream indicating the
- * number of bytes to follow. Note that this is the number of bytes in the
- * encoded String
not the String
length. Next
- * come the encoded characters. Each character in the String
- * is encoded as either one, two or three bytes. For characters in the
- * range of \u0001
to <\u007F>, one byte is used. The character
- * value goes into bits 0-7 and bit eight is 0. For characters in the range
- * of \u0080
to \u007FF
, two bytes are used. Bits
- * 6-10 of the character value are encoded bits 0-4 of the first byte, with
- * the high bytes having a value of "110". Bits 0-5 of the character value
- * are stored in bits 0-5 of the second byte, with the high bits set to
- * "10". This type of encoding is also done for the null character
- * \u0000
. This eliminates any C style NUL character values
- * in the output. All remaining characters are stored as three bytes.
- * Bits 12-15 of the character value are stored in bits 0-3 of the first
- * byte. The high bits of the first bytes are set to "1110". Bits 6-11
- * of the character value are stored in bits 0-5 of the second byte. The
- * high bits of the second byte are set to "10". And bits 0-5 of the
- * character value are stored in bits 0-5 of byte three, with the high bits
- * of that byte set to "10".
- *
- * The value written can be read using the readUTF
- * method in DataInput
.
- *
- * @param value The String
to write to the output in UTF format
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readUTF
- */
- public final synchronized void writeUTF(String value) throws IOException
- {
- int len = value.length();
- int sum = 0;
-
- for (int i = 0; i < len && sum <= 65535; ++i)
- {
- char c = value.charAt(i);
- if (c >= '\u0001' && c <= '\u007f')
- sum += 1;
- else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
- sum += 2;
- else
- sum += 3;
- }
-
- if (sum > 65535)
- throw new UTFDataFormatException ();
-
- int pos = 0;
- byte[] buf = new byte[sum];
-
- for (int i = 0; i < len; ++i)
- {
- char c = value.charAt(i);
- if (c >= '\u0001' && c <= '\u007f')
- buf[pos++] = (byte) c;
- else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
- {
- buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6)));
- buf[pos++] = (byte) (0x80 | (0x3f & c));
- }
- else
- {
- // JSL says the first byte should be or'd with 0xc0, but
- // that is a typo. Unicode says 0xe0, and that is what is
- // consistent with DataInputStream.
- buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12)));
- buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6)));
- buf[pos++] = (byte) (0x80 | (0x3f & c));
- }
- }
-
- writeShort (sum);
- write(buf, 0, sum);
- }
-
-} // class DataOutputStream
-
diff --git a/libjava/java/io/EOFException.java b/libjava/java/io/EOFException.java
deleted file mode 100644
index cfedb7d9eb0..00000000000
--- a/libjava/java/io/EOFException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* EOFException.java -- unexpected end of file exception
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when the end of the file or stream was
- * encountered unexpectedly. This is not the normal way that an EOF
- * condition is reported; such as a special value like -1 being returned.
- * However, certain types of streams expecting certain data in a certain
- * format might reach EOF before reading their expected data pattern and
- * thus throw this exception.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class EOFException extends IOException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 6433858223774886977L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public EOFException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public EOFException(String message)
- {
- super(message);
- }
-} // class EOFException
diff --git a/libjava/java/io/Externalizable.java b/libjava/java/io/Externalizable.java
deleted file mode 100644
index 113c19ff60f..00000000000
--- a/libjava/java/io/Externalizable.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Externalizable.java -- Interface for saving and restoring object data
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This interface provides a way that classes can completely control how
- * the data of their object instances are written and read to and from
- * streams. It has two methods which are used to write the data to a stream
- * and to read the data from a stream. The read method must read the data
- * in exactly the way it was written by the write method.
- * writeExternal
method is
- * called to save state. When the object is restored, an instance is
- * created using the default no-argument constructor and the
- * readExternal
method is used to restore the state.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public interface Externalizable extends Serializable
-{
- /**
- * This method restores an object's state by reading in the instance data
- * for the object from the passed in stream. Note that this stream is not
- * a subclass of InputStream
, but rather is a class that
- * implements
- * the ObjectInput
interface. That interface provides a
- * mechanism for
- * reading in Java data types from a stream.
- * writeExternal
.
- * It must read back the exact same types that were written by that
- * method in the exact order they were written.
- * ClassNotFoundException
- *
- * @param in An ObjectInput
instance for reading in the object
- * state
- *
- * @exception ClassNotFoundException If the class of an object being
- * restored cannot be found
- * @exception IOException If any other error occurs
- */
- void readExternal(ObjectInput in)
- throws ClassNotFoundException, IOException;
-
- /**
- * This method is responsible for writing the instance data of an object
- * to the passed in stream. Note that this stream is not a subclass of
- * OutputStream
, but rather is a class that implements the
- * ObjectOutput
interface. That interface provides a
- * number of methods
- * for writing Java data values to a stream.
- * readExternal
.
- *
- * @param out An ObjectOutput
instance for writing the
- * object state
- *
- * @exception IOException If an error occurs
- */
- void writeExternal(ObjectOutput out) throws IOException;
-}
diff --git a/libjava/java/io/FileDescriptor.java b/libjava/java/io/FileDescriptor.java
deleted file mode 100644
index d300c9cb617..00000000000
--- a/libjava/java/io/FileDescriptor.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/* FileDescriptor.java -- Opaque file handle class
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import gnu.java.nio.channels.FileChannelImpl;
-
-import java.nio.channels.ByteChannel;
-import java.nio.channels.FileChannel;
-
-/**
- * This class represents an opaque file handle as a Java class. It should
- * be used only to pass to other methods that expect an object of this
- * type. No system specific information can be obtained from this object.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @date September 24, 1998
- */
-public final class FileDescriptor
-{
- /**
- * A FileDescriptor
representing the system standard input
- * stream. This will usually be accessed through the
- * System.in
variable.
- */
- public static final FileDescriptor in
- = new FileDescriptor (FileChannelImpl.in);
-
- /**
- * A FileDescriptor
representing the system standard output
- * stream. This will usually be accessed through the
- * System.out
variable.
- */
- public static final FileDescriptor out
- = new FileDescriptor (FileChannelImpl.out);
-
- /**
- * A FileDescriptor
representing the system standard error
- * stream. This will usually be accessed through the
- * System.err
variable.
- */
- public static final FileDescriptor err
- = new FileDescriptor (FileChannelImpl.err);
-
- final ByteChannel channel;
-
- /**
- * This method is used to initialize an invalid FileDescriptor object.
- */
- public FileDescriptor()
- {
- channel = null;
- }
-
- /**
- * This method is used to initialize a FileDescriptor object.
- */
- FileDescriptor(ByteChannel channel)
- {
- this.channel = channel;
- }
-
-
- /**
- * This method forces all data that has not yet been physically written to
- * the underlying storage medium associated with this
- * FileDescriptor
- * to be written out. This method will not return until all data has
- * been fully written to the underlying device. If the device does not
- * support this functionality or if an error occurs, then an exception
- * will be thrown.
- */
- public void sync () throws SyncFailedException
- {
- if (channel instanceof FileChannel)
- {
- try
- {
- ((FileChannel) channel).force(true);
- }
- catch (IOException ex)
- {
- if (ex instanceof SyncFailedException)
- throw (SyncFailedException) ex;
- else
- throw new SyncFailedException(ex.toString());
- }
- }
- }
-
- /**
- * This methods tests whether or not this object represents a valid open
- * native file handle.
- *
- * @return true
if this object represents a valid
- * native file handle, false
otherwise
- */
- public boolean valid ()
- {
- return channel != null && channel.isOpen();
- }
-}
diff --git a/libjava/java/io/FileFilter.java b/libjava/java/io/FileFilter.java
deleted file mode 100644
index e57ac9fd060..00000000000
--- a/libjava/java/io/FileFilter.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* FileFilter.java -- Filter a list of pathnames
- Copyright (C) 1998,2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This interface has one method which is used for filtering pathnames
- * returned in a pathname listing. It is currently used by the
- * File.listFiles(FileFilter)
method.
- * true
if the path should be included in the list,
- * false
otherwise.
- */
- boolean accept(File pathname);
-}
diff --git a/libjava/java/io/FileNotFoundException.java b/libjava/java/io/FileNotFoundException.java
deleted file mode 100644
index 3c11e296072..00000000000
--- a/libjava/java/io/FileNotFoundException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* FileNotFoundException.java -- the requested file could not be found
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when an attempt is made to access a file that
- * does not exist, or is inaccessible for some other reason (such as writing
- * a read-only file).
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class FileNotFoundException extends IOException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -897856973823710492L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public FileNotFoundException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public FileNotFoundException(String message)
- {
- super(message);
- }
-} // class FileNotFoundException
diff --git a/libjava/java/io/FilePermission.java b/libjava/java/io/FilePermission.java
deleted file mode 100644
index 356787bfa72..00000000000
--- a/libjava/java/io/FilePermission.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/* FilePermission.java --
- Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import java.security.Permission;
-
-public final class FilePermission extends Permission implements Serializable
-{
- private static final long serialVersionUID = 7930732926638008763L;
-
- private static final String CURRENT_DIRECTORY =
- System.getProperty("user.dir");
-
- private static final String ALL_FILES = "<
- *
- * @param p the Permission to compare against.
- * @return whether this Permission implies p
- */
- public boolean implies(Permission p)
- {
- if (! (p instanceof FilePermission))
- return false;
-
- String f1 = getName();
-
- if (f1.equals(ALL_FILES))
- return true;
-
- FilePermission fp = (FilePermission) p;
- String f2 = fp.getName();
-
- if (f1.charAt(0) != File.separatorChar)
- f1 = CURRENT_DIRECTORY + f1;
- if (f2.charAt(0) != File.separatorChar)
- f2 = CURRENT_DIRECTORY + f2;
-
- String sub1;
-
- switch (f1.charAt(f1.length() - 1))
- {
- case '*':
- sub1 = f1.substring(0, f1.length() - 1); // chop off "*"
- if (f2.length() <= sub1.length())
- {
- // If it's smaller, there is no way it could be part of
- // this directory. If it's the same (or length - 1), it
- // could be the same directory but specifies access to
- // the directory rather than the files in it.
- return false;
- }
- else if (f2.charAt(sub1.length() - 1) == File.separatorChar)
- {
- // Make sure the part before the "/" is the same.
- if (! f2.substring(0, sub1.length()).equals(sub1))
- return false;
- // Make sure there are no subdirectories specified
- // underneath this one.
- if (f2.substring(sub1.length() + 1).indexOf(File.separatorChar)
- != -1)
- return false;
- }
- else
- {
- // Obviously not equal: f2 is either not a directory or
- // is not the same directory (its name continues further
- // than we want).
- return false;
- }
- break;
- case '-':
- // Chop off "/-".
- sub1 = f1.substring(0, f1.length() - 2);
- if (f2.length() < sub1.length())
- {
- // If it's smaller, there is no way it could be part of
- // this directory.
- return false;
- }
- else if (f2.length() > sub1.length()
- && f2.charAt(sub1.length()) != File.separatorChar)
- return false;
- else if (! f2.substring(0, sub1.length()).equals(sub1))
- return false;
- break;
-
- default:
- if (f2.charAt(f2.length() - 1) == File.separatorChar)
- {
- if (! f1.equals(f2.substring(0, f2.length() - 1)))
- return false;
- }
- else if (!f1.equals(f2))
- return false;
- break;
- }
-
- if (readPerm && ! fp.readPerm)
- return false;
- if (writePerm && ! fp.writePerm)
- return false;
- if (executePerm && ! fp.executePerm)
- return false;
- if (deletePerm && ! fp.deletePerm)
- return false;
-
- return true;
- }
-}
diff --git a/libjava/java/io/FileReader.java b/libjava/java/io/FileReader.java
deleted file mode 100644
index 4a1dd5ff4ce..00000000000
--- a/libjava/java/io/FileReader.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* FileReader.java -- Convenience class for reading characters from a file
- Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class provides a convenient way to set up a Reader
- * to read from a file. It opens the specified file for reading and creates
- * the InputStreamReader
to read from the
- * resulting FileInputStream
. This class can only be used
- * to read from files using the default character encoding. Use
- * InputStreamReader
directly to use a non-default encoding.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class FileReader extends InputStreamReader
-{
- /**
- * This method initializes a FileReader
instance to read from
- * the specified File
object.
- *
- * @param file The File
object representing the file to read from
- *
- * @exception FileNotFoundException If the file is not found or some other
- * error occurs
- */
- public FileReader(File file) throws FileNotFoundException
- {
- super(new FileInputStream(file));
- }
-
- /**
- * This method initializes a FileReader
instance to read from
- * this specified FileDescriptor
object.
- *
- * @param fd The FileDescriptor
to read from.
- */
- public FileReader(FileDescriptor fd)
- {
- super(new FileInputStream(fd));
- }
-
- /**
- * This method initializes a FileReader
instance to read from
- * the specified named file.
- *
- * @param name The name of the file to read from
- *
- * @exception FileNotFoundException If the file is not found or some other
- * error occurs
- */
- public FileReader(String name) throws FileNotFoundException
- {
- super(new FileInputStream(name));
- }
-} // class FileReader
-
diff --git a/libjava/java/io/FileWriter.java b/libjava/java/io/FileWriter.java
deleted file mode 100644
index b34db83231e..00000000000
--- a/libjava/java/io/FileWriter.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/* FileWriter.java -- Convenience class for writing to files.
- Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.1.
- */
-
-/**
- * This is a convenience class for writing to files. It creates an
- * FileOutputStream
and initializes an
- * OutputStreamWriter
to write to it.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class FileWriter extends OutputStreamWriter
-{
- /**
- * This method initializes a new FileWriter
object to write
- * to the specified File
object.
- *
- * @param file The File
object to write to.
- *
- * @throws SecurityException If writing to this file is forbidden by the
- * SecurityManager
.
- * @throws IOException If any other error occurs
- */
- public FileWriter(File file) throws SecurityException, IOException
- {
- super(new FileOutputStream(file));
- }
-
- /**
- * This method initializes a new FileWriter
object to write
- * to the specified File
object.
- *
- * @param file The File
object to write to.
- * @param append true
to start adding data at the end of the
- * file, false
otherwise.
- *
- * @throws SecurityException If writing to this file is forbidden by the
- * SecurityManager
.
- * @throws IOException If any other error occurs
- */
- public FileWriter(File file, boolean append) throws IOException
- {
- super(new FileOutputStream(file, append));
- }
-
- /**
- * This method initializes a new FileWriter
object to write
- * to the specified FileDescriptor
object.
- *
- * @param fd The FileDescriptor
object to write to
- *
- * @throws SecurityException If writing to this file is forbidden by the
- * SecurityManager
.
- */
- public FileWriter(FileDescriptor fd) throws SecurityException
- {
- super(new FileOutputStream(fd));
- }
-
- /**
- * This method intializes a new FileWriter
object to
- * write to the
- * specified named file.
- *
- * @param name The name of the file to write to
- *
- * @throws SecurityException If writing to this file is forbidden by the
- * SecurityManager
.
- * @throws IOException If any other error occurs
- */
- public FileWriter(String name) throws IOException
- {
- super(new FileOutputStream(name));
- }
-
- /**
- * This method intializes a new FileWriter
object to
- * write to the
- * specified named file. This form of the constructor allows the caller
- * to determin whether data should be written starting at the beginning or
- * the end of the file.
- *
- * @param name The name of the file to write to
- * @param append true
to start adding data at the end of the
- * file, false
otherwise.
- *
- * @throws SecurityException If writing to this file is forbidden by the
- * SecurityManager
.
- * @throws IOException If any other error occurs
- */
- public FileWriter(String name, boolean append) throws IOException
- {
- super(new FileOutputStream(name, append));
- }
-}
diff --git a/libjava/java/io/FilenameFilter.java b/libjava/java/io/FilenameFilter.java
deleted file mode 100644
index 57b4d3b182c..00000000000
--- a/libjava/java/io/FilenameFilter.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* FilenameFilter.java -- Filter a list of filenames
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to 1.1.
- */
-
-/**
- * This interface has one method which is used for filtering filenames
- * returned in a directory listing. It is currently used by the
- * File.list(FilenameFilter)
method and by the filename
- * dialog in AWT.
- * File
instance for the directory being read
- * @param name The name of the file to test
- *
- * @return true
if the file should be included in the list,
- * false
otherwise.
- */
- boolean accept(File dir, String name);
-
-} // interface FilenameFilter
-
diff --git a/libjava/java/io/FilterInputStream.java b/libjava/java/io/FilterInputStream.java
deleted file mode 100644
index d3cb9e4f71f..00000000000
--- a/libjava/java/io/FilterInputStream.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/* FilterInputStream.java -- Base class for classes that filter input
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This is the common superclass of all standard classes that filter
- * input. It acts as a layer on top of an underlying InputStream
- * and simply redirects calls made to it to the subordinate InputStream
- * instead. Subclasses of this class perform additional filtering
- * functions in addition to simply redirecting the call.
- * InputStream
without adding any functionality
- * on top of it, this class should not be used directly. Instead, various
- * subclasses of this class should be used. This is enforced with a
- * protected constructor. Do not try to hack around it.
- * FilterInputStream
, override the
- * appropriate methods to implement the desired filtering. However, note
- * that the read(byte[])
method does not need to be overridden
- * as this class redirects calls to that method to
- * read(byte[], int, int)
instead of to the subordinate
- * InputStream read(byte[])
method.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class FilterInputStream extends InputStream
-{
- /**
- * This is the subordinate InputStream
to which method calls
- * are redirected
- */
- protected InputStream in;
-
- /**
- * Create a FilterInputStream
with the specified subordinate
- * InputStream
.
- *
- * @param in The subordinate InputStream
- */
- protected FilterInputStream(InputStream in)
- {
- this.in = in;
- }
-
- /**
- * Calls the in.mark(int)
method.
- *
- * @param readlimit The parameter passed to in.mark(int)
- */
- public void mark(int readlimit)
- {
- in.mark(readlimit);
- }
-
- /**
- * Calls the in.markSupported()
method.
- *
- * @return true
if mark/reset is supported, false
- * otherwise
- */
- public boolean markSupported()
- {
- return in.markSupported();
- }
-
- /**
- * Calls the in.reset()
method.
- *
- * @exception IOException If an error occurs
- */
- public void reset() throws IOException
- {
- in.reset();
- }
-
- /**
- * Calls the in.available()
method.
- *
- * @return The value returned from in.available()
- *
- * @exception IOException If an error occurs
- */
- public int available() throws IOException
- {
- return in.available();
- }
-
- /**
- * Calls the in.skip(long)
method
- *
- * @param numBytes The requested number of bytes to skip.
- *
- * @return The value returned from in.skip(long)
- *
- * @exception IOException If an error occurs
- */
- public long skip(long numBytes) throws IOException
- {
- return in.skip(numBytes);
- }
-
- /**
- * Calls the in.read()
method
- *
- * @return The value returned from in.read()
- *
- * @exception IOException If an error occurs
- */
- public int read() throws IOException
- {
- return in.read();
- }
-
- /**
- * Calls the read(byte[], int, int)
overloaded method.
- * Note that
- * this method does not redirect its call directly to a corresponding
- * method in in
. This allows subclasses to override only the
- * three argument version of read
.
- *
- * @param buf The buffer to read bytes into
- *
- * @return The value retured from in.read(byte[], int, int)
- *
- * @exception IOException If an error occurs
- */
- public int read(byte[] buf) throws IOException
- {
- return read(buf, 0, buf.length);
- }
-
- /**
- * Calls the in.read(byte[], int, int)
method.
- *
- * @param buf The buffer to read bytes into
- * @param offset The index into the buffer to start storing bytes
- * @param len The maximum number of bytes to read.
- *
- * @return The value retured from in.read(byte[], int, int)
- *
- * @exception IOException If an error occurs
- */
- public int read(byte[] buf, int offset, int len) throws IOException
- {
- return in.read(buf, offset, len);
- }
-
- /**
- * This method closes the input stream by closing the input stream that
- * this object is filtering. Future attempts to access this stream may
- * throw an exception.
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- in.close();
- }
-}
diff --git a/libjava/java/io/FilterOutputStream.java b/libjava/java/io/FilterOutputStream.java
deleted file mode 100644
index 4c2dfc04a65..00000000000
--- a/libjava/java/io/FilterOutputStream.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/* FilterOutputStream.java -- Parent class for output streams that filter
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.1.
- */
-
-/**
- * This class is the common superclass of output stream classes that
- * filter the output they write. These classes typically transform the
- * data in some way prior to writing it out to another underlying
- * OutputStream
. This class simply overrides all the
- * methods in OutputStream
to redirect them to the
- * underlying stream. Subclasses provide actual filtering.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class FilterOutputStream extends OutputStream
-{
- /**
- * This is the subordinate OutputStream
that this class
- * redirects its method calls to.
- */
- protected OutputStream out;
-
- /**
- * This method initializes an instance of FilterOutputStream
- * to write to the specified subordinate OutputStream
.
- *
- * @param out The OutputStream
to write to
- */
- public FilterOutputStream(OutputStream out)
- {
- this.out = out;
- }
-
- /**
- * This method closes the underlying OutputStream
. Any
- * further attempts to write to this stream may throw an exception.
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- flush();
- out.close();
- }
-
- /**
- * This method attempt to flush all buffered output to be written to the
- * underlying output sink.
- *
- * @exception IOException If an error occurs
- */
- public void flush() throws IOException
- {
- out.flush();
- }
-
- /**
- * This method writes a single byte of output to the underlying
- * OutputStream
.
- *
- * @param b The byte to write, passed as an int.
- *
- * @exception IOException If an error occurs
- */
- public void write(int b) throws IOException
- {
- out.write(b);
- }
-
- /**
- * This method writes all the bytes in the specified array to the underlying
- * OutputStream
. It does this by calling the three parameter
- * version of this method - write(byte[], int, int)
in this
- * class instead of writing to the underlying OutputStream
- * directly. This allows most subclasses to avoid overriding this method.
- *
- * @param buf The byte array to write bytes from
- *
- * @exception IOException If an error occurs
- */
- public void write(byte[] buf) throws IOException
- {
- // Don't do checking here, per Java Lang Spec.
- write(buf, 0, buf.length);
- }
-
- /**
- * This method calls the write(int)
method len
- * times for all bytes from the array buf
starting at index
- * offset
. Subclasses should overwrite this method to get a
- * more efficient implementation.
- *
- * @param buf The byte array to write bytes from
- * @param offset The index into the array to start writing bytes from
- * @param len The number of bytes to write
- *
- * @exception IOException If an error occurs
- */
- public void write(byte[] buf, int offset, int len) throws IOException
- {
- // Don't do checking here, per Java Lang Spec.
- for (int i=0; i < len; i++)
- write(buf[offset + i]);
-
- }
-
-} // class FilterOutputStream
-
diff --git a/libjava/java/io/FilterReader.java b/libjava/java/io/FilterReader.java
deleted file mode 100644
index 2bd040a7f72..00000000000
--- a/libjava/java/io/FilterReader.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/* FilterReader.java -- Base class for char stream classes that filter input
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This is the common superclass of all standard classes that filter
- * input. It acts as a layer on top of an underlying Reader
- * and simply redirects calls made to it to the subordinate Reader
- * instead. Subclasses of this class perform additional filtering
- * functions in addition to simply redirecting the call.
- * FilterReader
, override the
- * appropriate methods to implement the desired filtering. However, note
- * that the read(char[])
method does not need to be overridden
- * as this class redirects calls to that method to
- * read(yte[], int, int)
instead of to the subordinate
- * Reader} read(yte[])
method.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public abstract class FilterReader extends Reader
-{
- /**
- * This is the subordinate Reader
to which method calls
- * are redirected
- */
- protected Reader in;
-
- /**
- * Create a FilterReader
with the specified subordinate
- * Reader
.
- * The lock
of the new FilterReader
will be set
- * to in.lock
.
- *
- * @param in The subordinate Reader
- */
- protected FilterReader(Reader in)
- {
- super(in.lock);
- this.in = in;
- }
-
- /**
- * Calls the in.mark(int)
method.
- *
- * @param readlimit The parameter passed to in.mark(int)
- *
- * @exception IOException If an error occurs
- */
- public void mark(int readlimit) throws IOException
- {
- in.mark(readlimit);
- }
-
- /**
- * Calls the in.markSupported()
method.
- *
- * @return true
if mark/reset is supported,
- * false
otherwise
- */
- public boolean markSupported()
- {
- return(in.markSupported());
- }
-
- /**
- * Calls the in.reset()
method.
- *
- * @exception IOException If an error occurs
- */
- public void reset() throws IOException
- {
- in.reset();
- }
-
- /**
- * Calls the in.read()
method.
- *
- * @return The value returned from in.available()
- *
- * @exception IOException If an error occurs
- */
- public boolean ready() throws IOException
- {
- return(in.ready());
- }
-
- /**
- * Calls the in.skip(long)
method
- *
- * @param numBytes The requested number of chars to skip.
- *
- * @return The value returned from in.skip(long)
- *
- * @exception IOException If an error occurs
- */
- public long skip(long num_chars) throws IOException
- {
- return(in.skip(num_chars));
- }
-
- /**
- * Calls the in.read()
method
- *
- * @return The value returned from in.read()
- *
- * @exception IOException If an error occurs
- */
- public int read() throws IOException
- {
- return(in.read());
- }
-
- /**
- * Calls the in.read(char[], int, int)
method.
- *
- * @param buf The buffer to read chars into
- * @param offset The index into the buffer to start storing chars
- * @param len The maximum number of chars to read.
- *
- * @return The value retured from in.read(char[], int, int)
- *
- * @exception IOException If an error occurs
- */
- public int read(char[] buf, int offset, int len) throws IOException
- {
- return(in.read(buf, offset, len));
- }
-
- /**
- * This method closes the stream by calling the close()
method
- * of the underlying stream.
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- in.close();
- }
-
-} // class FilterReader
-
diff --git a/libjava/java/io/FilterWriter.java b/libjava/java/io/FilterWriter.java
deleted file mode 100644
index 9b9ce33f9f6..00000000000
--- a/libjava/java/io/FilterWriter.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/* FilterWriter.java -- Parent class for output streams that filter
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Complete to version 1.1.
- */
-
-/**
- * This class is the common superclass of output character stream classes
- * that filter the output they write. These classes typically transform the
- * data in some way prior to writing it out to another underlying
- * Writer
. This class simply overrides all the
- * methods in Writer
to redirect them to the
- * underlying stream. Subclasses provide actual filtering.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public abstract class FilterWriter extends Writer
-{
- /**
- * This is the subordinate Writer
that this class
- * redirects its method calls to.
- */
- protected Writer out;
-
- /**
- * This method initializes an instance of FilterWriter
- * to write to the specified subordinate Writer
.
- * The given Writer
will be used as lock
for
- * the newly created FilterWriter
.
- *
- * @param out The Writer
to write to
- */
- protected FilterWriter(Writer out)
- {
- super(out.lock);
- this.out = out;
- }
-
- /**
- * This method closes the underlying Writer
. Any
- * further attempts to write to this stream may throw an exception.
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- out.close();
- }
-
- /**
- * This method attempt to flush all buffered output to be written to the
- * underlying output sink.
- *
- * @exception IOException If an error occurs
- */
- public void flush() throws IOException
- {
- out.flush();
- }
-
- /**
- * This method writes a single char of output to the underlying
- * Writer
.
- *
- * @param b The char to write, passed as an int.
- *
- * @exception IOException If an error occurs
- */
- public void write(int b) throws IOException
- {
- out.write(b);
- }
-
- /**
- * This method writes len
chars from the array buf
- * starting at index offset
to the underlying
- * Writer
.
- *
- * @param buf The char array to write chars from
- * @param offset The index into the array to start writing chars from
- * @param len The number of chars to write
- *
- * @exception IOException If an error occurs
- */
- public void write(char[] buf, int offset, int len) throws IOException
- {
- out.write(buf, offset, len);
- }
-
- /**
- * This method writes len
chars from the String
- * starting at position offset
.
- *
- * @param str The String
that is to be written
- * @param offset The character offset into the String
- * to start writing from
- * @param len The number of chars to write
- *
- * @exception IOException If an error occurs
- */
- public void write(String str, int offset, int len) throws IOException
- {
- out.write(str, offset, len);
- }
-
-} // class FilterWriter
-
diff --git a/libjava/java/io/IOException.java b/libjava/java/io/IOException.java
deleted file mode 100644
index cf3ad194633..00000000000
--- a/libjava/java/io/IOException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* IOException.java -- Generic input/output exception
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown to indicate an I/O problem of some sort
- * occurred. Since this is a fairly generic exception, often a subclass
- * of IOException will actually be thrown in order to provide a more
- * detailed indication of what happened.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class IOException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 7818375828146090155L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public IOException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public IOException(String message)
- {
- super(message);
- }
-} // class IOException
diff --git a/libjava/java/io/InputStream.java b/libjava/java/io/InputStream.java
deleted file mode 100644
index 86d1cd74914..00000000000
--- a/libjava/java/io/InputStream.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/* InputStream.java -- Base class for input
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This abstract class forms the base of the hierarchy of classes that read
- * input as a stream of bytes. It provides a common set of methods for
- * reading bytes from streams. Subclasses implement and extend these
- * methods to read bytes from a particular input source such as a file
- * or network connection.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public abstract class InputStream
-{
- /**
- * Default, no-arg, public constructor
- */
- public InputStream()
- {
- }
-
- /**
- * This method returns the number of bytes that can be read from this
- * stream before a read can block. A return of 0 indicates that blocking
- * might (or might not) occur on the very next read attempt.
- * IOException
- * reset()
method. The
- * parameter @code{readlimit} is the number of bytes that can be read
- * from the stream after setting the mark before the mark becomes
- * invalid. For example, if mark()
is called with a
- * read limit of 10, then when 11 bytes of data are read from the
- * stream before the reset()
method is called, then the
- * mark is invalid and the stream object instance is not required to
- * remember the mark.
- * false
in this class, but
- * subclasses can override this method to return true
- * if they support mark/reset functionality.
- *
- * @return true
if mark/reset functionality is
- * supported, false
otherwise
- */
- public boolean markSupported()
- {
- return false;
- }
-
- /**
- * This method reads an unsigned byte from the input stream and returns it
- * as an int in the range of 0-255. This method also will return -1 if
- * the end of the stream has been reached.
- * read(b, 0, b.length)
- *
- * @param b The buffer into which the bytes read will be stored.
- *
- * @return The number of bytes read or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- */
- public int read(byte[] b) throws IOException
- {
- return read(b, 0, b.length);
- }
-
- /**
- * This method read bytes from a stream and stores them into a
- * caller supplied buffer. It starts storing the data at index
- * off
into the buffer and attempts to read
- * len
bytes. This method can return before reading the
- * number of bytes requested. The actual number of bytes read is
- * returned as an int. A -1 is returned to indicate the end of the
- * stream.
- * read()
method
- * in a loop until the desired number of bytes are read. The read loop
- * stops short if the end of the stream is encountered or if an IOException
- * is encountered on any read operation except the first. If the first
- * attempt to read a bytes fails, the IOException is allowed to propagate
- * upward. And subsequent IOException is caught and treated identically
- * to an end of stream condition. Subclasses can (and should if possible)
- * override this method to provide a more efficient implementation.
- *
- * @param b The array into which the bytes read should be stored
- * @param off The offset into the array to start storing bytes
- * @param len The requested number of bytes to read
- *
- * @return The actual number of bytes read, or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- */
- public int read(byte[] b, int off, int len) throws IOException
- {
- if (off < 0 || len < 0 || off + len > b.length)
- throw new IndexOutOfBoundsException();
- if (b.length == 0)
- return 0;
-
- int i, ch;
-
- for (i = 0; i < len; ++i)
- try
- {
- if ((ch = read()) < 0)
- return i == 0 ? -1 : i; // EOF
- b[off + i] = (byte) ch;
- }
- catch (IOException ex)
- {
- // Only reading the first byte should cause an IOException.
- if (i == 0)
- throw ex;
- return i;
- }
-
- return i;
- }
-
- /**
- * This method resets a stream to the point where the
- * mark()
method was called. Any bytes that were read
- * after the mark point was set will be re-read during subsequent
- * reads.
- *
- *
.
- *
- * classname
will contain the name of the
- * class that caused the problem if known. The getMessage() method
- * for this exception will always include the name of that class
- * if known.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class InvalidClassException extends ObjectStreamException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -4333316296251054416L;
-
- /**
- * The name of the class which encountered the error.
- *
- * @serial the classname causing the error
- */
- public String classname;
-
- /**
- * Create an exception with a descriptive error message, but a null
- * classname.
- *
- * @param message the descriptive error message
- */
- public InvalidClassException(String message)
- {
- super(message);
- }
-
- /**
- * Create an exception with a descriptive error message, and the name of
- * the class that caused the problem.
- *
- * @param classname the name of the faulty class
- * @param message the descriptive error message
- */
- public InvalidClassException(String classname, String message)
- {
- super(message);
- this.classname = classname;
- }
-
- /**
- * Returns the descriptive error message for this exception. It will
- * include the class name that caused the problem if known, in the format:
- * [classname][; ][super.getMessage()]
.
- *
- * @return A descriptive error message, may be null
- */
- public String getMessage()
- {
- String msg = super.getMessage();
- if (msg == null)
- return classname;
- return (classname == null ? "" : classname + "; ") + msg;
- }
-}
-
diff --git a/libjava/java/io/InvalidObjectException.java b/libjava/java/io/InvalidObjectException.java
deleted file mode 100644
index deee876db27..00000000000
--- a/libjava/java/io/InvalidObjectException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* InvalidObjectException.java -- deserialization failed verification
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when an object fails a validation test
- * during serialization.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class InvalidObjectException extends ObjectStreamException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 3233174318281839583L;
-
- /**
- * Create an exception with a descriptive error message String. This should
- * be the cause of the verification failure.
- *
- * @param message the descriptive error message
- */
- public InvalidObjectException(String message)
- {
- super(message);
- }
-} // class InvalidObjectException
diff --git a/libjava/java/io/LineNumberInputStream.java b/libjava/java/io/LineNumberInputStream.java
deleted file mode 100644
index 2552e467994..00000000000
--- a/libjava/java/io/LineNumberInputStream.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/* LineNumberInputStream.java -- An input stream which counts line numbers
- Copyright (C) 1998, 1999, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class functions like a standard InputStream
- * except that it counts line numbers, and canonicalizes newline
- * characters. As data is read, whenever the byte sequences "\r",
- * "\n", or "\r\n" are encountered, the running line count is
- * incremeted by one. Additionally, the whatever line termination
- * sequence was encountered will be converted to a "\n" byte. Note
- * that this class numbers lines from 0. When the first line
- * terminator is encountered, the line number is incremented to 1, and
- * so on.
- * mark()
and reset()
methods
- * in this class handle line numbers correctly. Calling
- * reset()
resets the line number to the point at which
- * mark()
was called if the subordinate stream supports
- * that functionality.
- * LineNumberReader
because it operates on ASCII bytes
- * instead of an encoded character stream. This class is for backward
- * compatibility only and should not be used in new applications.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class LineNumberInputStream extends FilterInputStream
-{
- /** The current line number. */
- private int lineNumber = 0;
-
- /** The line number when the stream was marked. */
- private int markLineNumber = 0;
-
- /** Flag to indicate a '\r' was just read so that an immediately
- * subsequent '\n' can be ignored. */
- private boolean justReadReturnChar = false;
-
- /**
- * Create a new LineNumberInputStream
that reads from the
- * specified subordinate InputStream
- *
- * @param in The subordinate InputStream
to read from
- */
- public LineNumberInputStream(InputStream in)
- {
- super(in);
- }
-
- /**
- * This method returns the number of bytes that can be read from the
- * stream before the stream can block. This method is tricky
- * because the subordinate InputStream
might return
- * only "\r\n" characters, which are replaced by a single "\n"
- * character by the read()
method of this class. So
- * this method can only guarantee that in.available() /
- * 2
bytes can actually be read before blocking. In
- * practice, considerably more bytes might be read before blocking
- * reset()
method. The
- * parameter readlimit
is the number of bytes that can
- * be read from the stream after setting the mark before the mark
- * becomes invalid. For example, if mark()
is called
- * with a read limit of 10, then when 11 bytes of data are read from
- * the stream before the reset()
method is called, then
- * the mark is invalid and the stream object instance is not
- * required to remember the mark.
- * reset()
method is called, the line number will be
- * restored to the saved line number in addition to the stream
- * position.
- * offset
into
- * the buffer and attemps to read len
bytes. This method can
- * return before reading the number of bytes requested. The actual number
- * of bytes read is returned as an int. A -1 is returned to indicated the
- * end of the stream.
- * mark()
method was called. Any bytes that were read
- * after the mark point was set will be re-read during subsequent
- * reads.
- * mark()
method was called.
- * Reader
except that it
- * counts line numbers, and canonicalizes newline characters. As data
- * is read, whenever the char sequences "\r", "\n", or "\r\n" are encountered,
- * the running line count is incremeted by one. Additionally, the whatever
- * line termination sequence was encountered will be converted to a "\n"
- * char. Note that this class numbers lines from 0. When the first
- * line terminator is encountered, the line number is incremented to 1, and
- * so on. Also note that actual "\r" and "\n" characters are looked for.
- * The system dependent line separator sequence is ignored.
- * LineNumberReader
that reads from the
- * specified subordinate Reader
. A default 8K char sized
- * buffer will be used for reads.
- *
- * @param in The subordinate Reader
to read from
- */
- public LineNumberReader(Reader in)
- {
- super(in, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a new LineNumberReader
to read
- * from the specified subordinate Reader
using the specified
- * read buffer size.
- *
- * @param in The subordinate Reader
to read from
- * @param size The buffer size to use for reading
- */
- public LineNumberReader(Reader in, int size)
- {
- super(in, size);
- }
-
- /**
- * This method returns the current line number
- *
- * @return The current line number
- */
- public int getLineNumber()
- {
- return lineNumber;
- }
-
- /**
- * This method sets the current line number to the specified value.
- *
- * @param line_number The new line number
- */
- public void setLineNumber(int lineNumber)
- {
- this.lineNumber = lineNumber;
- }
-
- /**
- * This method marks a position in the input to which the stream can be
- * "reset" char calling the reset()
method. The parameter
- * readlimit
is the number of chars that can be read from the
- * stream after setting the mark before the mark becomes invalid. For
- * example, if mark()
is called with a read limit of 10,
- * then when
- * 11 chars of data are read from the stream before the reset()
- * method is called, then the mark is invalid and the stream object
- * instance is not required to remember the mark.
- * reset()
- * method
- * is called, the line number will be restored to the saved line number in
- * addition to the stream position.
- *
- * @param readlimit The number of chars that can be read before the
- * mark becomes invalid
- *
- * @exception IOException If an error occurs
- */
- public void mark(int readLimit) throws IOException
- {
- if (readLimit < 0)
- throw new IllegalArgumentException("Read-ahead limit is negative");
-
- synchronized (lock)
- {
- // This is basically the same as BufferedReader.mark.
- // However, if the previous character was a '\r', we need to
- // save that 'r', in case the next character is a '\n'.
- if (pos + readLimit > limit)
- {
- int saveCR = matchedNewLine ? 1 : 0;
- char[] old_buffer = buffer;
- if (readLimit > limit)
- buffer = new char[saveCR + readLimit];
- int copy_start = pos - saveCR;
- savedLineNumber = lineNumber;
- limit -= copy_start;
- System.arraycopy(old_buffer, copy_start, buffer, 0, limit);
- pos = saveCR;
- }
- markPos = pos;
- }
- }
-
- /**
- * This method resets a stream to the point where the mark()
- * method
- * was called. Any chars that were read after the mark point was set will
- * be re-read during subsequent reads.
- * mark()
method was called.
- *
- * @exception IOException If an error occurs
- */
- public void reset() throws IOException
- {
- synchronized (lock)
- {
- if (markPos < 0)
- throw new IOException("mark never set or invalidated");
- lineNumber = savedLineNumber;
- pos = markPos;
- matchedNewLine = (markPos > 0 && buffer[markPos-1] == '\r');
- }
- }
-
- /**
- * This private method fills the input buffer whatever pos is.
- * Consequently pos should be checked before calling this method.
- *
- * @return the number of bytes actually read from the input stream or
- * -1 if end of stream.
- * @exception IOException If an error occurs.
- */
- private int fill() throws IOException
- {
- if (markPos >= 0 && limit == buffer.length)
- markPos = -1;
- if (markPos < 0)
- pos = limit = 0;
- int count = in.read(buffer, limit, buffer.length - limit);
- if (count <= 0)
- return -1;
- limit += count;
-
- return count;
- }
-
- /**
- * This method reads an unsigned char from the input stream and returns it
- * as an int in the range of 0-65535. This method will return -1 if the
- * end of the stream has been reached.
- * offset
into
- * the buffer and attemps to read len
chars. This method can
- * return before reading the number of chars requested. The actual number
- * of chars read is returned as an int. A -1 is returned to indicated the
- * end of the stream.
- * String
. A line is considered to be terminated
- * by a "\r", "\n", or "\r\n" sequence, not by the system dependent line
- * separator.
- *
- * @return The line read as a String
or null
- * if end of stream.
- *
- * @exception IOException If an error occurs
- */
- public String readLine() throws IOException
- {
- // BufferedReader.readLine already does this. Shouldn't need to keep
- // track of newlines (since the read method deals with this for us).
- // But if the buffer is large, we may not call the read method at all
- // and super.readLine can't increment lineNumber itself.
- // Though it may seem kludgy, the safest thing to do is to save off
- // lineNumber and increment it explicitly when we're done (iff we
- // ended with a '\n' or '\r' as opposed to EOF).
- //
- // Also, we need to undo the special casing done by BufferedReader.readLine
- // when a '\r' is the last char in the buffer. That situation is marked
- // by 'pos > limit'.
- int tmpLineNumber = lineNumber;
- skipRedundantLF();
- String str = super.readLine();
- if (pos > limit)
- --pos;
-
- // The only case where you mustn't increment the line number is you are
- // at the EOS.
- if (str != null)
- lineNumber = tmpLineNumber + 1;
-
- return str;
- }
-
- /**
- * This method skips over characters in the stream. This method will
- * skip the specified number of characters if possible, but is not required
- * to skip them all. The actual number of characters skipped is returned.
- * This method returns 0 if the specified number of chars is less than 1.
- *
- * @param count The specified number of chars to skip.
- *
- * @return The actual number of chars skipped.
- *
- * @exception IOException If an error occurs
- */
- public long skip (long count) throws IOException
- {
- if (count < 0)
- throw new IllegalArgumentException("skip() value is negative");
- if (count == 0)
- return 0;
-
- int skipped;
- char[] buf = new char[1];
-
- for (skipped = 0; skipped < count; skipped++)
- {
- int ch = read(buf, 0, 1);
-
- if (ch < 0)
- break;
- }
-
- return skipped;
- }
-}
-
diff --git a/libjava/java/io/NotActiveException.java b/libjava/java/io/NotActiveException.java
deleted file mode 100644
index 949ba8eca52..00000000000
--- a/libjava/java/io/NotActiveException.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* NotActiveException.java -- thrown when serialization is not active
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when a problem occurs due to the fact that
- * serialization is not active.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class NotActiveException extends ObjectStreamException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -3893467273049808895L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public NotActiveException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public NotActiveException(String message)
- {
- super(message);
- }
-} // class NotActiveException
diff --git a/libjava/java/io/NotSerializableException.java b/libjava/java/io/NotSerializableException.java
deleted file mode 100644
index d49c939e31d..00000000000
--- a/libjava/java/io/NotSerializableException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* NotSerializableException.java -- a Serializable class that isn't
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when a class implements Serializable because
- * of a superclass, but should not be serialized. The descriptive message
- * will consist of the name of the class in question.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class NotSerializableException extends ObjectStreamException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 2906642554793891381L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public NotSerializableException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message, which should
- * be the name of the class.
- *
- * @param message the descriptive error message
- */
- public NotSerializableException(String message)
- {
- super(message);
- }
-} // class NotSerializableException
diff --git a/libjava/java/io/ObjectInput.java b/libjava/java/io/ObjectInput.java
deleted file mode 100644
index 175b60f9dc0..00000000000
--- a/libjava/java/io/ObjectInput.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* ObjectInput.java -- Read object data from a stream
- Copyright (C) 1998,2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This interface extends the DataInput
interface to provide a
- * facility to read objects as well as primitive types from a stream. It
- * also has methods that allow input to be done in a manner similar to
- * InputStream
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- *
- * @see DataInput
- */
-public interface ObjectInput extends DataInput
-{
- /**
- * This method returns the number of bytes that can be read without
- * blocking.
- *
- * @return The number of bytes available before blocking
- *
- * @exception IOException If an error occurs
- */
- int available() throws IOException;
-
- /**
- * This method reading a byte of data from a stream. It returns that byte
- * as an int
. This method blocks if no data is available
- * to be read.
- *
- * @return The byte of data read
- *
- * @exception IOException If an error occurs
- */
- int read() throws IOException;
-
- /**
- * This method reads raw bytes and stores them them a byte array buffer.
- * Note that this method will block if no data is available. However,
- * it will not necessarily block until it fills the entire buffer. That is,
- * a "short count" is possible.
- *
- * @param buf The byte array to receive the data read
- *
- * @return The actual number of bytes read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- int read(byte[] buf) throws IOException;
-
- /**
- * This method reads raw bytes and stores them in a byte array buffer
- * buf
starting at position offset
into the
- * buffer. A
- * maximum of len
bytes will be read. Note that this method
- * blocks if no data is available, but will not necessarily block until
- * it can read len
bytes of data. That is, a "short count" is
- * possible.
- *
- * @param buf The byte array to receive the data read
- * @param offset The offset into buf
to start storing data
- * @param len The maximum number of bytes to read
- *
- * @return The actual number of bytes read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- int read(byte[] buf, int offset, int len) throws IOException;
-
- /**
- * Reads an object instance and returns it. If the class for the object
- * being read cannot be found, then a ClassNotFoundException
- * will be thrown.
- *
- * @return The object instance that was read
- *
- * @exception ClassNotFoundException If a class for the object cannot be
- * found
- * @exception IOException If any other error occurs
- */
- Object readObject()
- throws ClassNotFoundException, IOException;
-
- /**
- * This method causes the specified number of bytes to be read and
- * discarded. It is possible that fewer than the requested number of bytes
- * will actually be skipped.
- *
- * @param numBytes The number of bytes to skip
- *
- * @return The actual number of bytes skipped
- *
- * @exception IOException If an error occurs
- */
- long skip(long numBytes) throws IOException;
-
- /**
- * This method closes the input source
- *
- * @exception IOException If an error occurs
- */
- void close() throws IOException;
-}
diff --git a/libjava/java/io/ObjectInputValidation.java b/libjava/java/io/ObjectInputValidation.java
deleted file mode 100644
index 4fdb8414f63..00000000000
--- a/libjava/java/io/ObjectInputValidation.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ObjectInputValidation.java -- Validate an object
- Copyright (C) 1998, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class allows an object to validate that it is valid after
- * deserialization has run completely for it and all dependent objects.
- * This allows an object to determine if it is invalid even if all
- * state data was correctly deserialized from the stream. It can also
- * be used to perform re-initialization type activities on an object
- * after it has been completely deserialized.
- *
- * Since this method functions as a type of callback, it must be
- * registered through ObjectInputStream.registerValidation
- * in order to be invoked. This is typically done in the
- * readObject
method.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- *
- * @see ObjectInputStream#registerValidation
- */
-public interface ObjectInputValidation
-{
- /**
- * This method is called to validate an object after serialization
- * is complete. If the object is invalid an exception is thrown.
- *
- * @exception InvalidObjectException If the object is invalid
- */
- void validateObject() throws InvalidObjectException;
-}
diff --git a/libjava/java/io/ObjectOutput.java b/libjava/java/io/ObjectOutput.java
deleted file mode 100644
index d35a09c3acb..00000000000
--- a/libjava/java/io/ObjectOutput.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/* ObjectOutput.java -- Interface for writing objects to a stream
- Copyright (C) 1998, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This interface extends DataOutput
to provide the additional
- * facility of writing object instances to a stream. It also adds some
- * additional methods to make the interface more
- * OutputStream
like.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- *
- * @see DataOutput
- */
-public interface ObjectOutput extends DataOutput
-{
- /**
- * This method writes the specified byte to the output stream.
- *
- * @param b The byte to write.
- *
- * @exception IOException If an error occurs.
- */
- void write(int b) throws IOException;
-
- /**
- * This method writes all the bytes in the specified byte array to the
- * output stream.
- *
- * @param buf The array of bytes to write.
- *
- * @exception IOException If an error occurs.
- */
- void write(byte[] buf) throws IOException;
-
- /**
- * This method writes len
bytes from the specified array
- * starting at index offset
into that array.
- *
- * @param buf The byte array to write from.
- * @param offset The index into the byte array to start writing from.
- * @param len The number of bytes to write.
- *
- * @exception IOException If an error occurs.
- */
- void write(byte[] buf, int offset, int len)
- throws IOException;
-
- /**
- * This method writes a object instance to a stream. The format of the
- * data written is determined by the actual implementation of this method
- *
- * @param obj The object to write
- *
- * @exception IOException If an error occurs
- */
- void writeObject(Object obj) throws IOException;
-
- /**
- * This method causes any buffered data to be flushed out to the underlying
- * stream
- *
- * @exception IOException If an error occurs
- */
- void flush() throws IOException;
-
- /**
- * This method closes the underlying stream.
- *
- * @exception IOException If an error occurs
- */
- void close() throws IOException;
-
-} // interface ObjectOutput
-
diff --git a/libjava/java/io/ObjectOutputStream.java b/libjava/java/io/ObjectOutputStream.java
deleted file mode 100644
index e7f1fc84b93..00000000000
--- a/libjava/java/io/ObjectOutputStream.java
+++ /dev/null
@@ -1,1570 +0,0 @@
-/* ObjectOutputStream.java -- Class used to write serialized objects
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import gnu.classpath.Configuration;
-import gnu.java.io.ObjectIdentityWrapper;
-import gnu.java.lang.reflect.TypeSignature;
-import gnu.java.security.action.SetAccessibleAction;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.util.Hashtable;
-
-/**
- * An ObjectOutputStream
can be used to write objects
- * as well as primitive data in a platform-independent manner to an
- * OutputStream
.
- *
- * The data produced by an ObjectOutputStream
can be read
- * and reconstituted by an ObjectInputStream
.
- *
- * writeObject (Object)
is used to write Objects, the
- * write<type>
methods are used to write primitive
- * data (as in DataOutputStream
). Strings can be written
- * as objects or as primitive data.
- *
- * Not all objects can be written out using an
- * ObjectOutputStream
. Only those objects that are an
- * instance of java.io.Serializable
can be written.
- *
- * Using default serialization, information about the class of an
- * object is written, all of the non-transient, non-static fields of
- * the object are written, if any of these fields are objects, they are
- * written out in the same manner.
- *
- * An object is only written out the first time it is encountered. If
- * the object is encountered later, a reference to it is written to
- * the underlying stream. Thus writing circular object graphs
- * does not present a problem, nor are relationships between objects
- * in a graph lost.
- *
- * Example usage:
- *
- * Hashtable map = new Hashtable ();
- * map.put ("one", new Integer (1));
- * map.put ("two", new Integer (2));
- *
- * ObjectOutputStream oos =
- * new ObjectOutputStream (new FileOutputStream ("numbers"));
- * oos.writeObject (map);
- * oos.close ();
- *
- * ObjectInputStream ois =
- * new ObjectInputStream (new FileInputStream ("numbers"));
- * Hashtable newmap = (Hashtable)ois.readObject ();
- *
- * System.out.println (newmap);
- *
- *
- * The default serialization can be overriden in two ways.
- *
- * By defining a method private void
- * writeObject (ObjectOutputStream)
, a class can dictate exactly
- * how information about itself is written.
- * defaultWriteObject ()
may be called from this method to
- * carry out default serialization. This method is not
- * responsible for dealing with fields of super-classes or subclasses.
- *
- * By implementing java.io.Externalizable
. This gives
- * the class complete control over the way it is written to the
- * stream. If this approach is used the burden of writing superclass
- * and subclass data is transfered to the class implementing
- * java.io.Externalizable
.
- *
- * @see java.io.DataOutputStream
- * @see java.io.Externalizable
- * @see java.io.ObjectInputStream
- * @see java.io.Serializable
- */
-public class ObjectOutputStream extends OutputStream
- implements ObjectOutput, ObjectStreamConstants
-{
- /**
- * Creates a new ObjectOutputStream
that will do all of
- * its writing onto out
. This method also initializes
- * the stream by writing the header information (stream magic number
- * and stream version).
- *
- * @exception IOException Writing stream header to underlying
- * stream cannot be completed.
- *
- * @see #writeStreamHeader()
- */
- public ObjectOutputStream (OutputStream out) throws IOException
- {
- realOutput = new DataOutputStream(out);
- blockData = new byte[ BUFFER_SIZE ];
- blockDataCount = 0;
- blockDataOutput = new DataOutputStream(this);
- setBlockDataMode(true);
- replacementEnabled = false;
- isSerializing = false;
- nextOID = baseWireHandle;
- OIDLookupTable = new Hashtable();
- protocolVersion = defaultProtocolVersion;
- useSubclassMethod = false;
- writeStreamHeader();
-
- if (Configuration.DEBUG)
- {
- String val = System.getProperty("gcj.dumpobjects");
- if (val != null && !val.equals(""))
- dump = true;
- }
- }
-
- /**
- * Writes a representation of obj
to the underlying
- * output stream by writing out information about its class, then
- * writing out each of the objects non-transient, non-static
- * fields. If any of these fields are other objects,
- * they are written out in the same manner.
- *
- * This method can be overriden by a class by implementing
- * private void writeObject (ObjectOutputStream)
.
- *
- * If an exception is thrown from this method, the stream is left in
- * an undefined state.
- *
- * @exception NotSerializableException An attempt was made to
- * serialize an Object
that is not serializable.
- *
- * @exception InvalidClassException Somebody tried to serialize
- * an object which is wrongly formatted.
- *
- * @exception IOException Exception from underlying
- * OutputStream
.
- */
- public final void writeObject(Object obj) throws IOException
- {
- if (useSubclassMethod)
- {
- if (dump)
- dumpElementln ("WRITE OVERRIDE: " + obj);
-
- writeObjectOverride(obj);
- return;
- }
-
- if (dump)
- dumpElementln ("WRITE: " + obj);
-
- depth += 2;
-
- boolean was_serializing = isSerializing;
- boolean old_mode = setBlockDataMode(false);
- try
- {
- isSerializing = true;
- boolean replaceDone = false;
- Object replacedObject = null;
-
- while (true)
- {
- if (obj == null)
- {
- realOutput.writeByte(TC_NULL);
- break;
- }
-
- Integer handle = findHandle(obj);
- if (handle != null)
- {
- realOutput.writeByte(TC_REFERENCE);
- realOutput.writeInt(handle.intValue());
- break;
- }
-
- if (obj instanceof Class)
- {
- Class cl = (Class)obj;
- ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(cl);
- realOutput.writeByte(TC_CLASS);
- if (!osc.isProxyClass)
- {
- writeObject (osc);
- }
- else
- {
- realOutput.writeByte(TC_PROXYCLASSDESC);
- Class[] intfs = cl.getInterfaces();
- realOutput.writeInt(intfs.length);
- for (int i = 0; i < intfs.length; i++)
- realOutput.writeUTF(intfs[i].getName());
-
- boolean oldmode = setBlockDataMode(true);
- annotateProxyClass(cl);
- setBlockDataMode(oldmode);
- realOutput.writeByte(TC_ENDBLOCKDATA);
-
- writeObject(osc.getSuper());
- }
- assignNewHandle(obj);
- break;
- }
-
- if (obj instanceof ObjectStreamClass)
- {
- writeClassDescriptor((ObjectStreamClass) obj);
- break;
- }
-
- Class clazz = obj.getClass();
- ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(clazz);
- if (osc == null)
- throw new NotSerializableException(clazz.getName());
-
- if ((replacementEnabled || obj instanceof Serializable)
- && ! replaceDone)
- {
- replacedObject = obj;
-
- if (obj instanceof Serializable)
- {
- try
- {
- Method m = osc.writeReplaceMethod;
- if (m != null)
- obj = m.invoke(obj, new Object[0]);
- }
- catch (IllegalAccessException ignore)
- {
- }
- catch (InvocationTargetException ignore)
- {
- }
- }
-
- if (replacementEnabled)
- obj = replaceObject(obj);
-
- replaceDone = true;
- continue;
- }
-
- if (obj instanceof String)
- {
- realOutput.writeByte(TC_STRING);
- assignNewHandle(obj);
- realOutput.writeUTF((String)obj);
- break;
- }
-
- if (clazz.isArray ())
- {
- realOutput.writeByte(TC_ARRAY);
- writeObject(osc);
- assignNewHandle(obj);
- writeArraySizeAndElements(obj, clazz.getComponentType());
- break;
- }
-
- realOutput.writeByte(TC_OBJECT);
- writeObject(osc);
-
- if (replaceDone)
- assignNewHandle(replacedObject);
- else
- assignNewHandle(obj);
-
- if (obj instanceof Externalizable)
- {
- if (protocolVersion == PROTOCOL_VERSION_2)
- setBlockDataMode(true);
-
- ((Externalizable)obj).writeExternal(this);
-
- if (protocolVersion == PROTOCOL_VERSION_2)
- {
- setBlockDataMode(false);
- realOutput.writeByte(TC_ENDBLOCKDATA);
- }
-
- break;
- }
-
- if (obj instanceof Serializable)
- {
- Object prevObject = this.currentObject;
- ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
- currentObject = obj;
- ObjectStreamClass[] hierarchy =
- ObjectStreamClass.getObjectStreamClasses(clazz);
-
- for (int i = 0; i < hierarchy.length; i++)
- {
- currentObjectStreamClass = hierarchy[i];
-
- fieldsAlreadyWritten = false;
- if (currentObjectStreamClass.hasWriteMethod())
- {
- if (dump)
- dumpElementln ("WRITE METHOD CALLED FOR: " + obj);
- setBlockDataMode(true);
- callWriteMethod(obj, currentObjectStreamClass);
- setBlockDataMode(false);
- realOutput.writeByte(TC_ENDBLOCKDATA);
- if (dump)
- dumpElementln ("WRITE ENDBLOCKDATA FOR: " + obj);
- }
- else
- {
- if (dump)
- dumpElementln ("WRITE FIELDS CALLED FOR: " + obj);
- writeFields(obj, currentObjectStreamClass);
- }
- }
-
- this.currentObject = prevObject;
- this.currentObjectStreamClass = prevObjectStreamClass;
- currentPutField = null;
- break;
- }
-
- throw new NotSerializableException(clazz.getName ());
- } // end pseudo-loop
- }
- catch (ObjectStreamException ose)
- {
- // Rethrow these are fatal.
- throw ose;
- }
- catch (IOException e)
- {
- realOutput.writeByte(TC_EXCEPTION);
- reset(true);
-
- setBlockDataMode(false);
- try
- {
- if (Configuration.DEBUG)
- {
- e.printStackTrace(System.out);
- }
- writeObject(e);
- }
- catch (IOException ioe)
- {
- StreamCorruptedException ex =
- new StreamCorruptedException
- (ioe + " thrown while exception was being written to stream.");
- if (Configuration.DEBUG)
- {
- ex.printStackTrace(System.out);
- }
- throw ex;
- }
-
- reset (true);
-
- }
- finally
- {
- isSerializing = was_serializing;
- setBlockDataMode(old_mode);
- depth -= 2;
-
- if (dump)
- dumpElementln ("END: " + obj);
- }
- }
-
- protected void writeClassDescriptor(ObjectStreamClass osc) throws IOException
- {
- realOutput.writeByte(TC_CLASSDESC);
- realOutput.writeUTF(osc.getName());
- realOutput.writeLong(osc.getSerialVersionUID());
- assignNewHandle(osc);
-
- int flags = osc.getFlags();
-
- if (protocolVersion == PROTOCOL_VERSION_2
- && osc.isExternalizable())
- flags |= SC_BLOCK_DATA;
-
- realOutput.writeByte(flags);
-
- ObjectStreamField[] fields = osc.fields;
- realOutput.writeShort(fields.length);
-
- ObjectStreamField field;
- for (int i = 0; i < fields.length; i++)
- {
- field = fields[i];
- realOutput.writeByte(field.getTypeCode ());
- realOutput.writeUTF(field.getName ());
-
- if (! field.isPrimitive())
- writeObject(field.getTypeString());
- }
-
- boolean oldmode = setBlockDataMode(true);
- annotateClass(osc.forClass());
- setBlockDataMode(oldmode);
- realOutput.writeByte(TC_ENDBLOCKDATA);
-
- if (osc.isSerializable() || osc.isExternalizable())
- writeObject(osc.getSuper());
- else
- writeObject(null);
- }
-
- /**
- * Writes the current objects non-transient, non-static fields from
- * the current class to the underlying output stream.
- *
- * This method is intended to be called from within a object's
- * private void writeObject (ObjectOutputStream)
- * method.
- *
- * @exception NotActiveException This method was called from a
- * context other than from the current object's and current class's
- * private void writeObject (ObjectOutputStream)
- * method.
- *
- * @exception IOException Exception from underlying
- * OutputStream
.
- */
- public void defaultWriteObject()
- throws IOException, NotActiveException
- {
- markFieldsWritten();
- writeFields(currentObject, currentObjectStreamClass);
- }
-
-
- private void markFieldsWritten() throws IOException
- {
- if (currentObject == null || currentObjectStreamClass == null)
- throw new NotActiveException
- ("defaultWriteObject called by non-active class and/or object");
-
- if (fieldsAlreadyWritten)
- throw new IOException
- ("Only one of writeFields and defaultWriteObject may be called, and it may only be called once");
-
- fieldsAlreadyWritten = true;
- }
-
- /**
- * Resets stream to state equivalent to the state just after it was
- * constructed.
- *
- * Causes all objects previously written to the stream to be
- * forgotten. A notification of this reset is also written to the
- * underlying stream.
- *
- * @exception IOException Exception from underlying
- * OutputStream
or reset called while serialization is
- * in progress.
- */
- public void reset() throws IOException
- {
- reset(false);
- }
-
-
- private void reset(boolean internal) throws IOException
- {
- if (!internal)
- {
- if (isSerializing)
- throw new IOException("Reset called while serialization in progress");
-
- realOutput.writeByte(TC_RESET);
- }
-
- clearHandles();
- }
-
-
- /**
- * Informs this ObjectOutputStream
to write data
- * according to the specified protocol. There are currently two
- * different protocols, specified by PROTOCOL_VERSION_1
- * and PROTOCOL_VERSION_2
. This implementation writes
- * data using PROTOCOL_VERSION_2
by default, as is done
- * by the JDK 1.2.
- *
- * A non-portable method, setDefaultProtocolVersion (int
- * version)
is provided to change the default protocol
- * version.
- *
- * For an explination of the differences beween the two protocols
- * see XXX: the Java ObjectSerialization Specification.
- *
- * @exception IOException if version
is not a valid
- * protocol
- *
- * @see #setDefaultProtocolVersion(int)
- */
- public void useProtocolVersion(int version) throws IOException
- {
- if (version != PROTOCOL_VERSION_1 && version != PROTOCOL_VERSION_2)
- throw new IOException("Invalid protocol version requested.");
-
- protocolVersion = version;
- }
-
-
- /**
- * GNU $classpath specific
- *
- * Changes the default stream protocol used by all
- * ObjectOutputStream
s. There are currently two
- * different protocols, specified by PROTOCOL_VERSION_1
- * and PROTOCOL_VERSION_2
. The default default is
- * PROTOCOL_VERSION_1
.
- *
- * @exception IOException if version
is not a valid
- * protocol
- *
- * @see #useProtocolVersion(int)
- */
- public static void setDefaultProtocolVersion(int version)
- throws IOException
- {
- if (version != PROTOCOL_VERSION_1 && version != PROTOCOL_VERSION_2)
- throw new IOException("Invalid protocol version requested.");
-
- defaultProtocolVersion = version;
- }
-
-
- /**
- * An empty hook that allows subclasses to write extra information
- * about classes to the stream. This method is called the first
- * time each class is seen, and after all of the standard
- * information about the class has been written.
- *
- * @exception IOException Exception from underlying
- * OutputStream
.
- *
- * @see ObjectInputStream#resolveClass(java.io.ObjectStreamClass)
- */
- protected void annotateClass(Class cl) throws IOException
- {
- }
-
- protected void annotateProxyClass(Class cl) throws IOException
- {
- }
-
- /**
- * Allows subclasses to replace objects that are written to the
- * stream with other objects to be written in their place. This
- * method is called the first time each object is encountered
- * (modulo reseting of the stream).
- *
- * This method must be enabled before it will be called in the
- * serialization process.
- *
- * @exception IOException Exception from underlying
- * OutputStream
.
- *
- * @see #enableReplaceObject(boolean)
- */
- protected Object replaceObject(Object obj) throws IOException
- {
- return obj;
- }
-
-
- /**
- * If enable
is true
and this object is
- * trusted, then replaceObject (Object)
will be called
- * in subsequent calls to writeObject (Object)
.
- * Otherwise, replaceObject (Object)
will not be called.
- *
- * @exception SecurityException This class is not trusted.
- */
- protected boolean enableReplaceObject(boolean enable)
- throws SecurityException
- {
- if (enable)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new SerializablePermission("enableSubstitution"));
- }
-
- boolean old_val = replacementEnabled;
- replacementEnabled = enable;
- return old_val;
- }
-
-
- /**
- * Writes stream magic and stream version information to the
- * underlying stream.
- *
- * @exception IOException Exception from underlying
- * OutputStream
.
- */
- protected void writeStreamHeader() throws IOException
- {
- realOutput.writeShort(STREAM_MAGIC);
- realOutput.writeShort(STREAM_VERSION);
- }
-
- /**
- * Protected constructor that allows subclasses to override
- * serialization. This constructor should be called by subclasses
- * that wish to override writeObject (Object)
. This
- * method does a security check NOTE: currently not
- * implemented, then sets a flag that informs
- * writeObject (Object)
to call the subclasses
- * writeObjectOverride (Object)
method.
- *
- * @see #writeObjectOverride(Object)
- */
- protected ObjectOutputStream() throws IOException, SecurityException
- {
- SecurityManager sec_man = System.getSecurityManager ();
- if (sec_man != null)
- sec_man.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
- useSubclassMethod = true;
- }
-
-
- /**
- * This method allows subclasses to override the default
- * serialization mechanism provided by
- * ObjectOutputStream
. To make this method be used for
- * writing objects, subclasses must invoke the 0-argument
- * constructor on this class from there constructor.
- *
- * @see #ObjectOutputStream()
- *
- * @exception NotActiveException Subclass has arranged for this
- * method to be called, but did not implement this method.
- */
- protected void writeObjectOverride(Object obj) throws NotActiveException,
- IOException
- {
- throw new NotActiveException
- ("Subclass of ObjectOutputStream must implement writeObjectOverride");
- }
-
-
- /**
- * @see DataOutputStream#write(int)
- */
- public void write (int data) throws IOException
- {
- if (writeDataAsBlocks)
- {
- if (blockDataCount == BUFFER_SIZE)
- drain();
-
- blockData[ blockDataCount++ ] = (byte)data;
- }
- else
- realOutput.write(data);
- }
-
-
- /**
- * @see DataOutputStream#write(byte[])
- */
- public void write(byte[] b) throws IOException
- {
- write(b, 0, b.length);
- }
-
-
- /**
- * @see DataOutputStream#write(byte[],int,int)
- */
- public void write(byte[] b, int off, int len) throws IOException
- {
- if (writeDataAsBlocks)
- {
- if (len < 0)
- throw new IndexOutOfBoundsException();
-
- if (blockDataCount + len < BUFFER_SIZE)
- {
- System.arraycopy(b, off, blockData, blockDataCount, len);
- blockDataCount += len;
- }
- else
- {
- drain();
- writeBlockDataHeader(len);
- realOutput.write(b, off, len);
- }
- }
- else
- realOutput.write(b, off, len);
- }
-
-
- /**
- * @see DataOutputStream#flush()
- */
- public void flush () throws IOException
- {
- drain();
- realOutput.flush();
- }
-
-
- /**
- * Causes the block-data buffer to be written to the underlying
- * stream, but does not flush underlying stream.
- *
- * @exception IOException Exception from underlying
- * OutputStream
.
- */
- protected void drain() throws IOException
- {
- if (blockDataCount == 0)
- return;
-
- if (writeDataAsBlocks)
- writeBlockDataHeader(blockDataCount);
- realOutput.write(blockData, 0, blockDataCount);
- blockDataCount = 0;
- }
-
-
- /**
- * @see java.io.DataOutputStream#close ()
- */
- public void close() throws IOException
- {
- flush();
- realOutput.close();
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeBoolean (boolean)
- */
- public void writeBoolean(boolean data) throws IOException
- {
- blockDataOutput.writeBoolean(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeByte (int)
- */
- public void writeByte(int data) throws IOException
- {
- blockDataOutput.writeByte(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeShort (int)
- */
- public void writeShort (int data) throws IOException
- {
- blockDataOutput.writeShort(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeChar (int)
- */
- public void writeChar(int data) throws IOException
- {
- blockDataOutput.writeChar(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeInt (int)
- */
- public void writeInt(int data) throws IOException
- {
- blockDataOutput.writeInt(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeLong (long)
- */
- public void writeLong(long data) throws IOException
- {
- blockDataOutput.writeLong(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeFloat (float)
- */
- public void writeFloat(float data) throws IOException
- {
- blockDataOutput.writeFloat(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeDouble (double)
- */
- public void writeDouble(double data) throws IOException
- {
- blockDataOutput.writeDouble(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeBytes (java.lang.String)
- */
- public void writeBytes(String data) throws IOException
- {
- blockDataOutput.writeBytes(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeChars (java.lang.String)
- */
- public void writeChars(String data) throws IOException
- {
- dataOutput.writeChars(data);
- }
-
-
- /**
- * @see java.io.DataOutputStream#writeUTF (java.lang.String)
- */
- public void writeUTF(String data) throws IOException
- {
- dataOutput.writeUTF(data);
- }
-
-
- /**
- * This class allows a class to specify exactly which fields should
- * be written, and what values should be written for these fields.
- *
- * XXX: finish up comments
- */
- public abstract static class PutField
- {
- public abstract void put (String name, boolean value);
- public abstract void put (String name, byte value);
- public abstract void put (String name, char value);
- public abstract void put (String name, double value);
- public abstract void put (String name, float value);
- public abstract void put (String name, int value);
- public abstract void put (String name, long value);
- public abstract void put (String name, short value);
- public abstract void put (String name, Object value);
-
- /**
- * @deprecated
- */
- public abstract void write (ObjectOutput out) throws IOException;
- }
-
- public PutField putFields() throws IOException
- {
- if (currentPutField != null)
- return currentPutField;
-
- currentPutField = new PutField()
- {
- private byte[] prim_field_data
- = new byte[currentObjectStreamClass.primFieldSize];
- private Object[] objs
- = new Object[currentObjectStreamClass.objectFieldCount];
-
- private ObjectStreamField getField (String name)
- {
- ObjectStreamField field
- = currentObjectStreamClass.getField(name);
-
- if (field == null)
- throw new IllegalArgumentException("no such serializable field " + name);
-
- return field;
- }
-
- public void put(String name, boolean value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'Z');
- prim_field_data[field.getOffset ()] = (byte)(value ? 1 : 0);
- }
-
- public void put(String name, byte value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'B');
- prim_field_data[field.getOffset()] = value;
- }
-
- public void put(String name, char value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'C');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, double value)
- {
- ObjectStreamField field = getField (name);
-
- checkType(field, 'D');
- int off = field.getOffset();
- long l_value = Double.doubleToLongBits (value);
- prim_field_data[off++] = (byte)(l_value >>> 52);
- prim_field_data[off++] = (byte)(l_value >>> 48);
- prim_field_data[off++] = (byte)(l_value >>> 40);
- prim_field_data[off++] = (byte)(l_value >>> 32);
- prim_field_data[off++] = (byte)(l_value >>> 24);
- prim_field_data[off++] = (byte)(l_value >>> 16);
- prim_field_data[off++] = (byte)(l_value >>> 8);
- prim_field_data[off] = (byte)l_value;
- }
-
- public void put(String name, float value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'F');
- int off = field.getOffset();
- int i_value = Float.floatToIntBits(value);
- prim_field_data[off++] = (byte)(i_value >>> 24);
- prim_field_data[off++] = (byte)(i_value >>> 16);
- prim_field_data[off++] = (byte)(i_value >>> 8);
- prim_field_data[off] = (byte)i_value;
- }
-
- public void put(String name, int value)
- {
- ObjectStreamField field = getField(name);
- checkType(field, 'I');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 24);
- prim_field_data[off++] = (byte)(value >>> 16);
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, long value)
- {
- ObjectStreamField field = getField(name);
- checkType(field, 'J');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 52);
- prim_field_data[off++] = (byte)(value >>> 48);
- prim_field_data[off++] = (byte)(value >>> 40);
- prim_field_data[off++] = (byte)(value >>> 32);
- prim_field_data[off++] = (byte)(value >>> 24);
- prim_field_data[off++] = (byte)(value >>> 16);
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, short value)
- {
- ObjectStreamField field = getField(name);
- checkType(field, 'S');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, Object value)
- {
- ObjectStreamField field = getField(name);
-
- if (value != null &&
- ! field.getType().isAssignableFrom(value.getClass ()))
- throw new IllegalArgumentException("Class " + value.getClass() +
- " cannot be cast to " + field.getType());
- objs[field.getOffset()] = value;
- }
-
- public void write(ObjectOutput out) throws IOException
- {
- // Apparently Block data is not used with PutField as per
- // empirical evidence against JDK 1.2. Also see Mauve test
- // java.io.ObjectInputOutput.Test.GetPutField.
- boolean oldmode = setBlockDataMode(false);
- out.write(prim_field_data);
- for (int i = 0; i < objs.length; ++ i)
- out.writeObject(objs[i]);
- setBlockDataMode(oldmode);
- }
-
- private void checkType(ObjectStreamField field, char type)
- throws IllegalArgumentException
- {
- if (TypeSignature.getEncodingOfClass(field.getType()).charAt(0)
- != type)
- throw new IllegalArgumentException();
- }
- };
- // end PutFieldImpl
-
- return currentPutField;
- }
-
-
- public void writeFields() throws IOException
- {
- if (currentPutField == null)
- throw new NotActiveException("writeFields can only be called after putFields has been called");
-
- markFieldsWritten();
- currentPutField.write(this);
- }
-
-
- // write out the block-data buffer, picking the correct header
- // depending on the size of the buffer
- private void writeBlockDataHeader(int size) throws IOException
- {
- if (size < 256)
- {
- realOutput.writeByte(TC_BLOCKDATA);
- realOutput.write(size);
- }
- else
- {
- realOutput.writeByte(TC_BLOCKDATALONG);
- realOutput.writeInt(size);
- }
- }
-
-
- // lookup the handle for OBJ, return null if OBJ doesn't have a
- // handle yet
- private Integer findHandle(Object obj)
- {
- return (Integer)OIDLookupTable.get(new ObjectIdentityWrapper(obj));
- }
-
-
- // assigns the next availible handle to OBJ
- private int assignNewHandle(Object obj)
- {
- OIDLookupTable.put(new ObjectIdentityWrapper(obj),
- new Integer(nextOID));
- return nextOID++;
- }
-
-
- // resets mapping from objects to handles
- private void clearHandles()
- {
- nextOID = baseWireHandle;
- OIDLookupTable.clear();
- }
-
-
- // write out array size followed by each element of the array
- private void writeArraySizeAndElements(Object array, Class clazz)
- throws IOException
- {
- int length = Array.getLength(array);
-
- if (clazz.isPrimitive())
- {
- if (clazz == Boolean.TYPE)
- {
- boolean[] cast_array = (boolean[])array;
- realOutput.writeInt (length);
- for (int i = 0; i < length; i++)
- realOutput.writeBoolean(cast_array[i]);
- return;
- }
- if (clazz == Byte.TYPE)
- {
- byte[] cast_array = (byte[])array;
- realOutput.writeInt(length);
- realOutput.write(cast_array, 0, length);
- return;
- }
- if (clazz == Character.TYPE)
- {
- char[] cast_array = (char[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeChar(cast_array[i]);
- return;
- }
- if (clazz == Double.TYPE)
- {
- double[] cast_array = (double[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeDouble(cast_array[i]);
- return;
- }
- if (clazz == Float.TYPE)
- {
- float[] cast_array = (float[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeFloat(cast_array[i]);
- return;
- }
- if (clazz == Integer.TYPE)
- {
- int[] cast_array = (int[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeInt(cast_array[i]);
- return;
- }
- if (clazz == Long.TYPE)
- {
- long[] cast_array = (long[])array;
- realOutput.writeInt (length);
- for (int i = 0; i < length; i++)
- realOutput.writeLong(cast_array[i]);
- return;
- }
- if (clazz == Short.TYPE)
- {
- short[] cast_array = (short[])array;
- realOutput.writeInt (length);
- for (int i = 0; i < length; i++)
- realOutput.writeShort(cast_array[i]);
- return;
- }
- }
- else
- {
- Object[] cast_array = (Object[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- writeObject(cast_array[i]);
- }
- }
-
-
- // writes out FIELDS of OBJECT for the specified ObjectStreamClass.
- // FIELDS are already in canonical order.
- private void writeFields(Object obj, ObjectStreamClass osc)
- throws IOException
- {
- ObjectStreamField[] fields = osc.fields;
- boolean oldmode = setBlockDataMode(false);
- String field_name;
- Class type;
-
- for (int i = 0; i < fields.length; i++)
- {
- field_name = fields[i].getName();
- type = fields[i].getType();
-
- if (dump)
- dumpElementln ("WRITE FIELD: " + field_name + " type=" + type);
-
- if (type == Boolean.TYPE)
- realOutput.writeBoolean(getBooleanField(obj, osc.forClass(), field_name));
- else if (type == Byte.TYPE)
- realOutput.writeByte(getByteField(obj, osc.forClass(), field_name));
- else if (type == Character.TYPE)
- realOutput.writeChar(getCharField(obj, osc.forClass(), field_name));
- else if (type == Double.TYPE)
- realOutput.writeDouble(getDoubleField(obj, osc.forClass(), field_name));
- else if (type == Float.TYPE)
- realOutput.writeFloat(getFloatField(obj, osc.forClass(), field_name));
- else if (type == Integer.TYPE)
- realOutput.writeInt(getIntField(obj, osc.forClass(), field_name));
- else if (type == Long.TYPE)
- realOutput.writeLong(getLongField(obj, osc.forClass(), field_name));
- else if (type == Short.TYPE)
- realOutput.writeShort(getShortField(obj, osc.forClass(), field_name));
- else
- writeObject(getObjectField(obj, osc.forClass(), field_name,
- fields[i].getTypeString ()));
- }
- setBlockDataMode(oldmode);
- }
-
-
- // Toggles writing primitive data to block-data buffer.
- // Package-private to avoid a trampoline constructor.
- boolean setBlockDataMode(boolean on) throws IOException
- {
- if (on == writeDataAsBlocks)
- return on;
-
- drain();
- boolean oldmode = writeDataAsBlocks;
- writeDataAsBlocks = on;
-
- if (on)
- dataOutput = blockDataOutput;
- else
- dataOutput = realOutput;
-
- return oldmode;
- }
-
-
- private void callWriteMethod(Object obj, ObjectStreamClass osc)
- throws IOException
- {
- currentPutField = null;
- try
- {
- Object args[] = {this};
- osc.writeObjectMethod.invoke(obj, args);
- }
- catch (InvocationTargetException x)
- {
- /* Rethrow if possible. */
- Throwable exception = x.getTargetException();
- if (exception instanceof RuntimeException)
- throw (RuntimeException) exception;
- if (exception instanceof IOException)
- throw (IOException) exception;
-
- IOException ioe
- = new IOException("Exception thrown from writeObject() on " +
- osc.forClass().getName() + ": " +
- exception.getClass().getName());
- ioe.initCause(exception);
- throw ioe;
- }
- catch (Exception x)
- {
- IOException ioe
- = new IOException("Failure invoking writeObject() on " +
- osc.forClass().getName() + ": " +
- x.getClass().getName());
- ioe.initCause(x);
- throw ioe;
- }
- }
-
- private boolean getBooleanField(Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField(klass, field_name);
- boolean b = f.getBoolean(obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private byte getByteField (Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- byte b = f.getByte (obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private char getCharField (Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- char b = f.getChar (obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private double getDoubleField (Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- double b = f.getDouble (obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private float getFloatField (Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- float b = f.getFloat (obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private int getIntField (Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- int b = f.getInt (obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private long getLongField (Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- long b = f.getLong (obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private short getShortField (Object obj, Class klass, String field_name)
- throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- short b = f.getShort (obj);
- return b;
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException
- ("invalid requested type for field " + field_name + " in class " + klass.getName());
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- throw new IOException("Unexpected exception " + _);
- }
- }
-
- private Object getObjectField (Object obj, Class klass, String field_name,
- String type_code) throws IOException
- {
- try
- {
- Field f = getField (klass, field_name);
- ObjectStreamField of = new ObjectStreamField(f.getName(), f.getType());
-
- if (of.getTypeString() == null ||
- !of.getTypeString().equals(type_code))
- throw new InvalidClassException
- ("invalid type code for " + field_name + " in class " + klass.getName());
-
- Object o = f.get (obj);
- // FIXME: We should check the type_code here
- return o;
- }
- catch (IOException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new IOException ();
- }
- }
-
- private Field getField (Class klass, String name)
- throws java.io.InvalidClassException
- {
- try
- {
- final Field f = klass.getDeclaredField(name);
- setAccessible.setMember(f);
- AccessController.doPrivileged(setAccessible);
- return f;
- }
- catch (java.lang.NoSuchFieldException e)
- {
- throw new InvalidClassException
- ("no field called " + name + " in class " + klass.getName());
- }
- }
-
- private void dumpElementln (String msg)
- {
- for (int i = 0; i < depth; i++)
- System.out.print (" ");
- System.out.print (Thread.currentThread() + ": ");
- System.out.println(msg);
- }
-
- // this value comes from 1.2 spec, but is used in 1.1 as well
- private static final int BUFFER_SIZE = 1024;
-
- private static int defaultProtocolVersion = PROTOCOL_VERSION_2;
-
- private DataOutputStream dataOutput;
- private boolean writeDataAsBlocks;
- private DataOutputStream realOutput;
- private DataOutputStream blockDataOutput;
- private byte[] blockData;
- private int blockDataCount;
- private Object currentObject;
- // Package-private to avoid a trampoline.
- ObjectStreamClass currentObjectStreamClass;
- private PutField currentPutField;
- private boolean fieldsAlreadyWritten;
- private boolean replacementEnabled;
- private boolean isSerializing;
- private int nextOID;
- private Hashtable OIDLookupTable;
- private int protocolVersion;
- private boolean useSubclassMethod;
- private SetAccessibleAction setAccessible = new SetAccessibleAction();
-
- // The nesting depth for debugging output
- private int depth = 0;
-
- // Set if we're generating debugging dumps
- private boolean dump = false;
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("javaio");
- }
- }
-}
diff --git a/libjava/java/io/ObjectStreamConstants.java b/libjava/java/io/ObjectStreamConstants.java
deleted file mode 100644
index f1a4af724e7..00000000000
--- a/libjava/java/io/ObjectStreamConstants.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/* ObjectStreamConstants.java -- Interface containing constant values
- used in reading and writing serialized objects
- Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This interface contains constants that are used in object
- * serialization. This interface is used by ObjectOutputStream
,
- * ObjectInputStream
, and ObjectStreamClass
.
- * The values for these constants are specified by the Java library
- * specification.
- */
-public interface ObjectStreamConstants
-{
- // FIXME: Javadoc comment these values.
- int PROTOCOL_VERSION_1 = 1;
- int PROTOCOL_VERSION_2 = 2;
-
- short STREAM_MAGIC = (short)0xaced;
- short STREAM_VERSION = 5;
-
- byte TC_NULL = (byte)112; //0x70
- byte TC_REFERENCE = (byte)113; //0x71
- byte TC_CLASSDESC = (byte)114; //0x72
- byte TC_OBJECT = (byte)115; //0x73
- byte TC_STRING = (byte)116; //0x74
- byte TC_ARRAY = (byte)117; //0x75
- byte TC_CLASS = (byte)118; //0x76
- byte TC_BLOCKDATA = (byte)119; //0x77
- byte TC_ENDBLOCKDATA = (byte)120; //0x78
- byte TC_RESET = (byte)121; //0x79
- byte TC_BLOCKDATALONG = (byte)122; //0x7A
- byte TC_EXCEPTION = (byte)123; //0x7B
- byte TC_LONGSTRING = (byte)124; //0x7C
- byte TC_PROXYCLASSDESC = (byte)125; //0x7D
-
- byte TC_BASE = TC_NULL;
- byte TC_MAX = TC_PROXYCLASSDESC;
-
- int baseWireHandle = 0x7e0000;
-
- byte SC_WRITE_METHOD = 0x01;
- byte SC_SERIALIZABLE = 0x02;
- byte SC_EXTERNALIZABLE = 0x04;
- byte SC_BLOCK_DATA = 0x08;
-
- SerializablePermission SUBSTITUTION_PERMISSION
- = new SerializablePermission("enableSubstitution");
-
- SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION
- = new SerializablePermission("enableSubclassImplementation");
-}
-
diff --git a/libjava/java/io/ObjectStreamException.java b/libjava/java/io/ObjectStreamException.java
deleted file mode 100644
index 61d4dd09e52..00000000000
--- a/libjava/java/io/ObjectStreamException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ObjectStreamException.java -- Superclass of all serialization exceptions
- Copyright (C) 1998, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when a problem occurs during serialization.
- * There are more specific subclasses that give more fine grained
- * indications of the precise failure.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class ObjectStreamException extends IOException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 7260898174833392607L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- protected ObjectStreamException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- protected ObjectStreamException(String message)
- {
- super(message);
- }
-} // class ObjectStreamException
diff --git a/libjava/java/io/ObjectStreamField.java b/libjava/java/io/ObjectStreamField.java
deleted file mode 100644
index 611457b3cfb..00000000000
--- a/libjava/java/io/ObjectStreamField.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/* ObjectStreamField.java -- Class used to store name and class of fields
- Copyright (C) 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import gnu.java.lang.reflect.TypeSignature;
-
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * This class intends to describe the field of a class for the serialization
- * subsystem. Serializable fields in a serializable class can be explicitly
- * exported using an array of ObjectStreamFields.
- */
-public class ObjectStreamField implements Comparable
-{
- private String name;
- private Class type;
- private String typename;
- private int offset = -1; // XXX make sure this is correct
- private boolean unshared;
- private boolean persistent = false;
- private boolean toset = true;
- private Field field;
-
- ObjectStreamField (Field field)
- {
- this (field.getName(), field.getType());
- this.field = field;
- }
-
- /**
- * This constructor creates an ObjectStreamField instance
- * which represents a field named name
and is
- * of the type type
.
- *
- * @param name Name of the field to export.
- * @param type Type of the field in the concerned class.
- */
- public ObjectStreamField (String name, Class type)
- {
- this (name, type, false);
- }
-
- /**
- * This constructor creates an ObjectStreamField instance
- * which represents a field named name
and is
- * of the type type
.
- *
- * @param name Name of the field to export.
- * @param type Type of the field in the concerned class.
- * @param unshared true if field will be unshared, false otherwise.
- */
- public ObjectStreamField (String name, Class type, boolean unshared)
- {
- if (name == null)
- throw new NullPointerException();
-
- this.name = name;
- this.type = type;
- this.typename = TypeSignature.getEncodingOfClass(type);
- this.unshared = unshared;
- }
-
- /**
- * There are many cases you can not get java.lang.Class from typename
- * if your context class loader cannot load it, then use typename to
- * construct the field.
- *
- * @param name Name of the field to export.
- * @param typename The coded name of the type for this field.
- */
- ObjectStreamField (String name, String typename)
- {
- this.name = name;
- this.typename = typename;
- try
- {
- type = TypeSignature.getClassForEncoding(typename);
- }
- catch(ClassNotFoundException e)
- {
- }
- }
-
- /**
- * There are many cases you can not get java.lang.Class from typename
- * if your context class loader cann not load it, then use typename to
- * construct the field.
- *
- * @param name Name of the field to export.
- * @param typename The coded name of the type for this field.
- * @param loader The class loader to use to resolve class names.
- */
- ObjectStreamField (String name, String typename, ClassLoader loader)
- {
- this.name = name;
- this.typename = typename;
- try
- {
- type = TypeSignature.getClassForEncoding(typename, true, loader);
- }
- catch(ClassNotFoundException e)
- {
- }
- }
-
- /**
- * This method returns the name of the field represented by the
- * ObjectStreamField instance.
- *
- * @return A string containing the name of the field.
- */
- public String getName ()
- {
- return name;
- }
-
- /**
- * This method returns the class representing the type of the
- * field which is represented by this instance of ObjectStreamField.
- *
- * @return A class representing the type of the field.
- */
- public Class getType ()
- {
- return type;
- }
-
- /**
- * This method returns the char encoded type of the field which
- * is represented by this instance of ObjectStreamField.
- *
- * @return A char representing the type of the field.
- */
- public char getTypeCode ()
- {
- return typename.charAt (0);
- }
-
- /**
- * This method returns a more explicit type name than
- * {@link #getTypeCode()} in the case the type is a real
- * class (and not a primitive).
- *
- * @return The name of the type (class name) if it is not a
- * primitive, in the other case null is returned.
- */
- public String getTypeString ()
- {
- // use intern()
- if (isPrimitive())
- return null;
- return typename.intern();
- }
-
- /**
- * This method returns the current offset of the field in
- * the serialization stream relatively to the other fields.
- * The offset is expressed in bytes.
- *
- * @return The offset of the field in bytes.
- * @see #setOffset(int)
- */
- public int getOffset ()
- {
- return offset;
- }
-
- /**
- * This method sets the current offset of the field.
- *
- * @param off The offset of the field in bytes.
- * @see getOffset()
- */
- protected void setOffset (int off)
- {
- offset = off;
- }
-
- /**
- * This method returns whether the field represented by this object is
- * unshared or not.
- *
- * @return Tells if this field is unshared or not.
- */
- public boolean isUnshared ()
- {
- return unshared;
- }
-
- /**
- * This method returns true if the type of the field
- * represented by this instance is a primitive.
- *
- * @return true if the type is a primitive, false
- * in the other case.
- */
- public boolean isPrimitive ()
- {
- return typename.length() == 1;
- }
-
- /**
- * Compares this object to the given object.
- *
- * @param obj the object to compare to.
- *
- * @return -1, 0 or 1.
- */
- public int compareTo (Object obj)
- {
- ObjectStreamField f = (ObjectStreamField) obj;
- boolean this_is_primitive = isPrimitive ();
- boolean f_is_primitive = f.isPrimitive ();
-
- if (this_is_primitive && !f_is_primitive)
- return -1;
-
- if (!this_is_primitive && f_is_primitive)
- return 1;
-
- return getName ().compareTo (f.getName ());
- }
-
- /**
- * This method is specific to classpath's implementation and so has the default
- * access. It changes the state of this field to "persistent". It means that
- * the field should not be changed when the stream is read (if it is not
- * explicitly specified using serialPersistentFields).
- *
- * @param persistent True if the field is persistent, false in the
- * other cases.
- * @see #isPersistent()
- */
- void setPersistent(boolean persistent)
- {
- this.persistent = persistent;
- }
-
- /**
- * This method returns true if the field is marked as persistent.
- *
- * @return True if persistent, false in the other cases.
- * @see #setPersistent(boolean)
- */
- boolean isPersistent()
- {
- return persistent;
- }
-
- /**
- * This method is specific to classpath's implementation and so
- * has the default access. It changes the state of this field as
- * to be set by ObjectInputStream.
- *
- * @param toset True if this field should be set, false in the other
- * cases.
- * @see #isToSet()
- */
- void setToSet(boolean toset)
- {
- this.toset = toset;
- }
-
- /**
- * This method returns true if the field is marked as to be
- * set.
- *
- * @return True if it is to be set, false in the other cases.
- * @see #setToSet(boolean)
- */
- boolean isToSet()
- {
- return toset;
- }
-
- /**
- * This method searches for its field reference in the specified class
- * object. It requests privileges. If an error occurs the internal field
- * reference is not modified.
- *
- * @throws NoSuchFieldException if the field name does not exist in this class.
- * @throws SecurityException if there was an error requesting the privileges.
- */
- void lookupField(Class clazz) throws NoSuchFieldException, SecurityException
- {
- final Field f = clazz.getDeclaredField(name);
-
- AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
- {
- f.setAccessible(true);
- return null;
- }
- });
-
- this.field = f;
- }
-
- /**
- * This method check whether the field described by this
- * instance of ObjectStreamField is compatible with the
- * actual implementation of this field.
- *
- * @throws NullPointerException if this field does not exist
- * in the real class.
- * @throws InvalidClassException if the types are incompatible.
- */
- void checkFieldType() throws InvalidClassException
- {
- Class ftype = field.getType();
-
- if (!ftype.isAssignableFrom(type))
- throw new InvalidClassException
- ("invalid field type for " + name +
- " in class " + field.getDeclaringClass());
- }
-
- /**
- * Returns a string representing this object.
- *
- * @return the string.
- */
- public String toString ()
- {
- return "ObjectStreamField< " + type + " " + name + " >";
- }
-
- final void setBooleanField(Object obj, boolean val)
- {
- VMObjectStreamClass.setBooleanNative(field, obj, val);
- }
-
- final void setByteField(Object obj, byte val)
- {
- VMObjectStreamClass.setByteNative(field, obj, val);
- }
-
- final void setCharField(Object obj, char val)
- {
- VMObjectStreamClass.setCharNative(field, obj, val);
- }
-
- final void setShortField(Object obj, short val)
- {
- VMObjectStreamClass.setShortNative(field, obj, val);
- }
-
- final void setIntField(Object obj, int val)
- {
- VMObjectStreamClass.setIntNative(field, obj, val);
- }
-
- final void setLongField(Object obj, long val)
- {
- VMObjectStreamClass.setLongNative(field, obj, val);
- }
-
- final void setFloatField(Object obj, float val)
- {
- VMObjectStreamClass.setFloatNative(field, obj, val);
- }
-
- final void setDoubleField(Object obj, double val)
- {
- VMObjectStreamClass.setDoubleNative(field, obj, val);
- }
-
- final void setObjectField(Object obj, Object val)
- {
- VMObjectStreamClass.setObjectNative(field, obj, val);
- }
-}
diff --git a/libjava/java/io/OptionalDataException.java b/libjava/java/io/OptionalDataException.java
deleted file mode 100644
index 8d8b1bda0e3..00000000000
--- a/libjava/java/io/OptionalDataException.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* OptionalDataException.java -- indicates unexpected data in serialized stream
- Copyright (C) 1998, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when unexpected data appears in the input
- * stream from which a serialized object is being read. There are two
- * cases:
- *
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class OptionalDataException extends ObjectStreamException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -8011121865681257820L;
-
- /**
- * Whether or not the end of the stream has been reached.
- *
- * @serial the end of the buffer was reached
- */
- public boolean eof;
-
- /**
- * The number of valid bytes that can be read.
- *
- * @serial the bytes of the buffer remaining
- */
- public int length;
-
- /**
- * Create a new OptionalDataException with an eof parameter indicating
- * whether or not the end of stream is reached and the number of valid
- * bytes that may be read.
- *
- * @param eof 'true' if end of stream reached, 'false' otherwise
- * @param count The number of valid bytes to be read
- */
- OptionalDataException(boolean eof, int count)
- {
- this.eof = eof;
- this.length = count;
- }
-} // class OptionalDataException
diff --git a/libjava/java/io/OutputStream.java b/libjava/java/io/OutputStream.java
deleted file mode 100644
index 8608daaa161..00000000000
--- a/libjava/java/io/OutputStream.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* OutputStream.java -- Base class for byte output streams
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This abstract class forms the base of the hierarchy of classes that
- * write output as a stream of bytes. It provides a common set of methods
- * for writing bytes to stream. Subclasses implement and/or extend these
- * methods to write bytes in a particular manner or to a particular
- * destination such as a file on disk or network connection.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public abstract class OutputStream
-{
- /**
- * This is the default no-argument constructor for this class. This method
- * does nothing in this class.
- */
- public OutputStream ()
- {
- }
-
- /**
- * This method writes a single byte to the output stream. The byte written
- * is the low eight bits of the eof
will
- * be false, and count
is the number of bytes of primitive
- * data available.eof
is true, and count
is 0.int
passed and a argument.
- * int
- *
- * @exception IOException If an error occurs
- */
- public abstract void write (int b) throws IOException;
-
- /**
- * This method all the writes bytes from the passed array to the
- * output stream. This method is equivalent to write(b, 0,
- * buf.length)
which is exactly how it is implemented in this
- * class.
- *
- * @param b The array of bytes to write
- *
- * @exception IOException If an error occurs
- */
- public void write (byte[] b) throws IOException, NullPointerException
- {
- write (b, 0, b.length);
- }
-
- /**
- * This method writes len
bytes from the specified array
- * b
starting at index off
into the array.
- * write()
- * method in a loop until all bytes have been written. Subclasses should
- * override this method if possible in order to provide a more efficent
- * implementation.
- *
- * @param b The array of bytes to write from
- * @param off The index into the array to start writing from
- * @param len The number of bytes to write
- *
- * @exception IOException If an error occurs
- */
- public void write (byte[] b, int off, int len)
- throws IOException, NullPointerException, IndexOutOfBoundsException
- {
- if (off < 0 || len < 0 || off + len > b.length)
- throw new ArrayIndexOutOfBoundsException ();
- for (int i = 0; i < len; ++i)
- write (b[off + i]);
- }
-
- /**
- * This method forces any data that may have been buffered to be written
- * to the underlying output device. Please note that the host environment
- * might perform its own buffering unbeknowst to Java. In that case, a
- * write made (for example, to a disk drive) might be cached in OS
- * buffers instead of actually being written to disk.
- * PipedInputStream
and connected
- * PipedOutputStream
- * be part of different threads. If they are not, the read and write
- * operations could deadlock their thread.
- *
- * @specnote The JDK implementation appears to have some undocumented
- * functionality where it keeps track of what thread is writing
- * to pipe and throws an IOException if that thread susequently
- * dies. This behaviour seems dubious and unreliable - we don't
- * implement it.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class PipedInputStream extends InputStream
-{
- /** PipedOutputStream to which this is connected. Null only if this
- * InputStream hasn't been connected yet. */
- PipedOutputStream source;
-
- /** Set to true if close() has been called on this InputStream. */
- boolean closed;
-
-
- /**
- * The size of the internal buffer used for input/output.
- */
- /* The "Constant Field Values" Javadoc of the Sun J2SE 1.4
- * specifies 1024.
- */
- protected static final int PIPE_SIZE = 1024;
-
-
- /**
- * This is the internal circular buffer used for storing bytes written
- * to the pipe and from which bytes are read by this stream
- */
- protected byte[] buffer = new byte[PIPE_SIZE];
-
- /**
- * The index into buffer where the next byte from the connected
- * PipedOutputStream
will be written. If this variable is
- * equal to out
, then the buffer is full. If set to < 0,
- * the buffer is empty.
- */
- protected int in = -1;
-
- /**
- * This index into the buffer where bytes will be read from.
- */
- protected int out = 0;
-
- /** Buffer used to implement single-argument read/receive */
- private byte[] read_buf = new byte[1];
-
- /**
- * Creates a new PipedInputStream
that is not connected to a
- * PipedOutputStream
. It must be connected before bytes can
- * be read from this stream.
- */
- public PipedInputStream()
- {
- }
-
- /**
- * This constructor creates a new PipedInputStream
and connects
- * it to the passed in PipedOutputStream
. The stream is then
- * ready for reading.
- *
- * @param source The PipedOutputStream
to connect this
- * stream to
- *
- * @exception IOException If source
is already connected.
- */
- public PipedInputStream(PipedOutputStream source) throws IOException
- {
- connect(source);
- }
-
- /**
- * This method connects this stream to the passed in
- * PipedOutputStream
.
- * This stream is then ready for reading. If this stream is already
- * connected or has been previously closed, then an exception is thrown
- *
- * @param src The PipedOutputStream
to connect this stream to
- *
- * @exception IOException If this PipedInputStream or source
- * has been connected already.
- */
- public void connect(PipedOutputStream source) throws IOException
- {
- // The JDK (1.3) does not appear to check for a previously closed
- // connection here.
-
- if (this.source != null || source.sink != null)
- throw new IOException ("Already connected");
-
- source.sink = this;
- this.source = source;
- }
-
- /**
- * This method receives a byte of input from the source PipedOutputStream.
- * If the internal circular buffer is full, this method blocks.
- *
- * @param val The byte to write to this stream
- *
- * @exception IOException if error occurs
- * @specnote Weird. This method must be some sort of accident.
- */
- protected synchronized void receive(int val) throws IOException
- {
- read_buf[0] = (byte) (val & 0xff);
- receive (read_buf, 0, 1);
- }
-
- /**
- * This method is used by the connected PipedOutputStream
to
- * write bytes into the buffer.
- *
- * @param buf The array containing bytes to write to this stream
- * @param offset The offset into the array to start writing from
- * @param len The number of bytes to write.
- *
- * @exception IOException If an error occurs
- * @specnote This code should be in PipedOutputStream.write, but we
- * put it here in order to support that bizarre recieve(int)
- * method.
- */
- synchronized void receive(byte[] buf, int offset, int len)
- throws IOException
- {
- if (closed)
- throw new IOException ("Pipe closed");
-
- int bufpos = offset;
- int copylen;
-
- while (len > 0)
- {
- try
- {
- while (in == out)
- {
- // The pipe is full. Wake up any readers and wait for them.
- notifyAll();
- wait();
- // The pipe could have been closed while we were waiting.
- if (closed)
- throw new IOException ("Pipe closed");
- }
- }
- catch (InterruptedException ix)
- {
- throw new InterruptedIOException ();
- }
-
- if (in < 0) // The pipe is empty.
- in = 0;
-
- // Figure out how many bytes from buf can be copied without
- // overrunning out or going past the length of the buffer.
- if (in < out)
- copylen = Math.min (len, out - in);
- else
- copylen = Math.min (len, buffer.length - in);
-
- // Copy bytes until the pipe is filled, wrapping if necessary.
- System.arraycopy(buf, bufpos, buffer, in, copylen);
- len -= copylen;
- bufpos += copylen;
- in += copylen;
- if (in == buffer.length)
- in = 0;
- }
- // Notify readers that new data is in the pipe.
- notifyAll();
- }
-
- /**
- * This method reads one byte from the stream.
- * -1 is returned to indicated that no bytes can be read
- * because the end of the stream was reached. If the stream is already
- * closed, a -1 will again be returned to indicate the end of the stream.
- *
- * offset
into the
- * buffer and
- * reads a maximum of len
bytes. Note that this method
- * can actually
- * read fewer than len
bytes. The actual number of bytes
- * read is
- * returned. A -1 is returned to indicated that no bytes can be read
- * because the end of the stream was reached - ie close() was called on the
- * connected PipedOutputStream.
- * close()
was called on this Piped
- * InputStream.
- */
- public synchronized int read(byte[] buf, int offset, int len)
- throws IOException
- {
- if (source == null)
- throw new IOException ("Not connected");
- if (closed)
- throw new IOException ("Pipe closed");
-
- // If the buffer is empty, wait until there is something in the pipe
- // to read.
- try
- {
- while (in < 0)
- {
- if (source.closed)
- return -1;
- wait();
- }
- }
- catch (InterruptedException ix)
- {
- throw new InterruptedIOException();
- }
-
- int total = 0;
- int copylen;
-
- while (true)
- {
- // Figure out how many bytes from the pipe can be copied without
- // overrunning in or going past the length of buf.
- if (out < in)
- copylen = Math.min (len, in - out);
- else
- copylen = Math.min (len, buffer.length - out);
-
- System.arraycopy (buffer, out, buf, offset, copylen);
- offset += copylen;
- len -= copylen;
- out += copylen;
- total += copylen;
-
- if (out == buffer.length)
- out = 0;
-
- if (out == in)
- {
- // Pipe is now empty.
- in = -1;
- out = 0;
- }
-
- // If output buffer is filled or the pipe is empty, we're done.
- if (len == 0 || in == -1)
- {
- // Notify any waiting outputstream that there is now space
- // to write.
- notifyAll();
- return total;
- }
- }
- }
-
- /**
- * This method returns the number of bytes that can be read from this stream
- * before blocking could occur. This is the number of bytes that are
- * currently unread in the internal circular buffer. Note that once this
- * many additional bytes are read, the stream may block on a subsequent
- * read, but it not guaranteed to block.
- *
- * @return The number of bytes that can be read before blocking might occur
- *
- * @exception IOException If an error occurs
- */
- public synchronized int available() throws IOException
- {
- // The JDK 1.3 implementation does not appear to check for the closed or
- // unconnected stream conditions here.
-
- if (in < 0)
- return 0;
- else if (out < in)
- return in - out;
- else
- return (buffer.length - out) + in;
- }
-
- /**
- * This methods closes the stream so that no more data can be read
- * from it.
- *
- * @exception IOException If an error occurs
- */
- public synchronized void close() throws IOException
- {
- closed = true;
- // Wake any thread which may be in receive() waiting to write data.
- notifyAll();
- }
-}
-
diff --git a/libjava/java/io/PipedOutputStream.java b/libjava/java/io/PipedOutputStream.java
deleted file mode 100644
index 81881050d1b..00000000000
--- a/libjava/java/io/PipedOutputStream.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/* PipedOutputStream.java -- Write portion of piped streams.
- Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-// NOTE: This implementation is very similar to that of PipedWriter. If you
-// fix a bug in here, chances are you should make a similar change to the
-// PipedWriter code.
-
-/**
- * This class writes its bytes to a PipedInputStream
to
- * which it is connected.
- * PipedOutputStream
and its
- * connected PipedInputStream
be in different threads. If
- * they are in the same thread, read and write operations could deadlock
- * the thread.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class PipedOutputStream extends OutputStream
-{
- /** Target PipedInputStream to which this is connected. Null only if this
- * OutputStream hasn't been connected yet. */
- PipedInputStream sink;
-
- /** Set to true if close() has been called on this OutputStream. */
- boolean closed;
-
- /**
- * Create an unconnected PipedOutputStream. It must be connected
- * to a PipedInputStream
using the connect
- * method prior to writing any data or an exception will be thrown.
- */
- public PipedOutputStream()
- {
- }
-
- /**
- * Create a new PipedOutputStream
instance
- * to write to the specified PipedInputStream
. This stream
- * is then ready for writing.
- *
- * @param sink The PipedInputStream
to connect this stream to.
- *
- * @exception IOException If sink
has already been connected
- * to a different PipedOutputStream.
- */
- public PipedOutputStream(PipedInputStream sink) throws IOException
- {
- sink.connect(this);
- }
-
- /**
- * Connects this object to the specified PipedInputStream
- * object. This stream will then be ready for writing.
- *
- * @param sink The PipedInputStream
to connect this stream to
- *
- * @exception IOException If the stream has not been connected or has
- * been closed.
- */
- public void connect(PipedInputStream sink) throws IOException
- {
- if (this.sink != null || sink.source != null)
- throw new IOException ("Already connected");
- sink.connect(this);
- }
-
- /**
- * Write a single byte of date to the stream. Note that this method will
- * block if the PipedInputStream
to which this object is
- * connected has a full buffer.
- *
- * @param b The byte of data to be written, passed as an int
.
- *
- * @exception IOException If the stream has not been connected or has
- * been closed.
- */
- public void write(int b) throws IOException
- {
- if (sink == null)
- throw new IOException ("Not connected");
- if (closed)
- throw new IOException ("Pipe closed");
-
- sink.receive (b);
- }
-
- /**
- * This method writes len
bytes of data from the byte array
- * buf
starting at index offset
in the array
- * to the stream. Note that this method will block if the
- * PipedInputStream
to which this object is connected has
- * a buffer that cannot hold all of the bytes to be written.
- *
- * @param buffer The array containing bytes to write to the stream.
- * @param offset The index into the array to start writing bytes from.
- * @param len The number of bytes to write.
- *
- * @exception IOException If the stream has not been connected or has
- * been closed.
- */
- public void write(byte[] buffer, int offset, int len) throws IOException
- {
- if (sink == null)
- throw new IOException ("Not connected");
- if (closed)
- throw new IOException ("Pipe closed");
-
- sink.receive(buffer, offset, len);
- }
-
- /**
- * This method does nothing.
- *
- * @exception IOException If the stream is closed.
- * @specnote You'd think that this method would block until the sink
- * had read all available data. Thats not the case - this method
- * appears to be a no-op?
- */
- public void flush() throws IOException
- {
- }
-
- /**
- * This method closes this stream so that no more data can be written
- * to it. Any further attempts to write to this stream may throw an
- * exception
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- // A close call on an unconnected PipedOutputStream has no effect.
- if (sink != null)
- {
- closed = true;
- // Notify any waiting readers that the stream is now closed.
- synchronized (sink)
- {
- sink.notifyAll();
- }
- }
- }
-}
diff --git a/libjava/java/io/PipedReader.java b/libjava/java/io/PipedReader.java
deleted file mode 100644
index 90fc10f672d..00000000000
--- a/libjava/java/io/PipedReader.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/* PipedReader.java -- Read portion of piped character streams.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-// NOTE: This implementation is very similar to that of PipedInputStream.
-// If you fix a bug in here, chances are you should make a similar change to
-// the PipedInputStream code.
-
-/**
- * An input stream that reads characters from a piped writer to which it is
- * connected.
- * PipedReader
and connected PipedWriter
- * be part of different threads. If they are not, there is a possibility
- * that the read and write operations could deadlock their thread.
- *
- * @specnote The JDK implementation appears to have some undocumented
- * functionality where it keeps track of what thread is writing
- * to pipe and throws an IOException if that thread susequently
- * dies. This behaviour seems dubious and unreliable - we don't
- * implement it.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class PipedReader extends Reader
-{
- /** PipedWriter to which this is connected. Null only if this
- * Reader hasn't been connected yet. */
- PipedWriter source;
-
- /** Set to true if close() has been called on this Reader. */
- boolean closed;
-
- /**
- * The size of the internal buffer used for input/output.
- */
- static final int PIPE_SIZE = 2048;
-
- /**
- * This is the internal circular buffer used for storing chars written
- * to the pipe and from which chars are read by this stream
- */
- char[] buffer = new char[PIPE_SIZE];
-
- /**
- * The index into buffer where the next char from the connected
- * PipedWriter
will be written. If this variable is
- * equal to out
, then the buffer is full. If set to < 0,
- * the buffer is empty.
- */
- int in = -1;
-
- /**
- * This index into the buffer where chars will be read from.
- */
- int out = 0;
-
- /** Buffer used to implement single-argument read/receive */
- char[] read_buf = new char[1];
-
- /**
- * Creates a new PipedReader
that is not connected to a
- * PipedWriter
. It must be connected before chars can
- * be read from this stream.
- */
- public PipedReader()
- {
- }
-
- /**
- * This constructor creates a new PipedReader
and connects
- * it to the passed in PipedWriter
. The stream is then
- * ready for reading.
- *
- * @param source The PipedWriter
to connect this stream to
- *
- * @exception IOException If source
is already connected.
- */
- public PipedReader(PipedWriter source) throws IOException
- {
- connect(source);
- }
-
- /**
- * This method connects this stream to the passed in
- * PipedWriter
.
- * This stream is then ready for reading. If this stream is already
- * connected or has been previously closed, then an exception is thrown
- *
- * @param source The PipedWriter
to connect this stream to
- *
- * @exception IOException If this PipedReader or source
- * has been connected already.
- */
- public void connect(PipedWriter source) throws IOException
- {
- // The JDK (1.3) does not appear to check for a previously closed
- // connection here.
-
- if (this.source != null || source.sink != null)
- throw new IOException ("Already connected");
-
- source.sink = this;
- this.source = source;
- }
-
- /**
- * This method is used by the connected PipedWriter
to
- * write chars into the buffer.
- *
- * @param buf The array containing chars to write to this stream
- * @param offset The offset into the array to start writing from
- * @param len The number of chars to write.
- *
- * @exception IOException If an error occurs
- * @specnote This code should be in PipedWriter.write, but we
- * put it here in order to support that bizarre recieve(int)
- * method.
- */
- void receive(char[] buf, int offset, int len)
- throws IOException
- {
- synchronized (lock)
- {
- if (closed)
- throw new IOException ("Pipe closed");
-
- int bufpos = offset;
- int copylen;
-
- while (len > 0)
- {
- try
- {
- while (in == out)
- {
- // The pipe is full. Wake up any readers and wait for them.
- lock.notifyAll();
- lock.wait();
- // The pipe could have been closed while we were waiting.
- if (closed)
- throw new IOException ("Pipe closed");
- }
- }
- catch (InterruptedException ix)
- {
- throw new InterruptedIOException ();
- }
-
- if (in < 0) // The pipe is empty.
- in = 0;
-
- // Figure out how many chars from buf can be copied without
- // overrunning out or going past the length of the buffer.
- if (in < out)
- copylen = Math.min (len, out - in);
- else
- copylen = Math.min (len, buffer.length - in);
-
- // Copy chars until the pipe is filled, wrapping if necessary.
- System.arraycopy(buf, bufpos, buffer, in, copylen);
- len -= copylen;
- bufpos += copylen;
- in += copylen;
- if (in == buffer.length)
- in = 0;
- }
- // Notify readers that new data is in the pipe.
- lock.notifyAll();
- }
- }
-
- /**
- * This method reads chars from the stream into a caller supplied buffer.
- * It starts storing chars at position offset
into the
- * buffer and
- * reads a maximum of len
chars. Note that this method
- * can actually
- * read fewer than len
chars. The actual number of chars
- * read is
- * returned. A -1 is returned to indicated that no chars can be read
- * because the end of the stream was reached. If the stream is already
- * closed, a -1 will again be returned to indicate the end of the stream.
- * offset
into
- * the buffer and reads a maximum of len
chars. Note that
- * this method can actually read fewer than len
chars.
- * The actual number of chars read is
- * returned. A -1 is returned to indicated that no chars can be read
- * because the end of the stream was reached - ie close() was called on the
- * connected PipedWriter.
- * close()
was called on this Piped
- * Reader.
- */
- public int read(char[] buf, int offset, int len)
- throws IOException
- {
- synchronized (lock)
- {
- if (source == null)
- throw new IOException ("Not connected");
- if (closed)
- throw new IOException ("Pipe closed");
-
- // If the buffer is empty, wait until there is something in the pipe
- // to read.
- try
- {
- while (in < 0)
- {
- if (source.closed)
- return -1;
- lock.wait();
- }
- }
- catch (InterruptedException ix)
- {
- throw new InterruptedIOException();
- }
-
- int total = 0;
- int copylen;
-
- while (true)
- {
- // Figure out how many chars from the pipe can be copied without
- // overrunning in or going past the length of buf.
- if (out < in)
- copylen = Math.min (len, in - out);
- else
- copylen = Math.min (len, buffer.length - out);
-
- System.arraycopy (buffer, out, buf, offset, copylen);
- offset += copylen;
- len -= copylen;
- out += copylen;
- total += copylen;
-
- if (out == buffer.length)
- out = 0;
-
- if (out == in)
- {
- // Pipe is now empty.
- in = -1;
- out = 0;
- }
-
- // If output buffer is filled or the pipe is empty, we're done.
- if (len == 0 || in == -1)
- {
- // Notify any waiting Writer that there is now space
- // to write.
- lock.notifyAll();
- return total;
- }
- }
- }
- }
-
- public boolean ready() throws IOException
- {
- // The JDK 1.3 implementation does not appear to check for the closed or
- // unconnected stream conditions here. However, checking for a
- // closed stream is explicitly required by the JDK 1.2 and 1.3
- // documentation (for Reader.close()), so we do it.
-
- synchronized (lock)
- {
- if (closed)
- throw new IOException("Pipe closed");
-
- if (in < 0)
- return false;
-
- int count;
- if (out < in)
- count = in - out;
- else
- count = (buffer.length - out) - in;
-
- return (count > 0);
- }
- }
-
- /**
- * This methods closes the stream so that no more data can be read
- * from it.
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- synchronized (lock)
- {
- closed = true;
- // Wake any thread which may be in receive() waiting to write data.
- lock.notifyAll();
- }
- }
-}
-
diff --git a/libjava/java/io/PipedWriter.java b/libjava/java/io/PipedWriter.java
deleted file mode 100644
index 92786e5de7d..00000000000
--- a/libjava/java/io/PipedWriter.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/* PipedWriter.java -- Write portion of piped character streams.
- Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-// NOTE: This implementation is very similar to that of PipedOutputStream.
-// If you fix a bug in here, chances are you should make a similar change to
-// the PipedOutputStream code.
-
-/**
- * This class writes its chars to a PipedReader
to
- * which it is connected.
- * PipedWriter
and its
- * connected PipedReader
be in different threads. If
- * they are in the same thread, read and write operations could deadlock
- * the thread.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class PipedWriter extends Writer
-{
- /** Target PipedReader to which this is connected. Null only if this
- * Writer hasn't been connected yet. */
- PipedReader sink;
-
- /** Set to true if close() has been called on this Writer. */
- boolean closed;
-
- /** Buffer used to implement single-argument write */
- char[] read_buf = new char[1];
-
- /**
- * Create an unconnected PipedWriter. It must be connected
- * to a PipedReader
using the connect
- * method prior to writing any data or an exception will be thrown.
- */
- public PipedWriter()
- {
- }
-
- /**
- * Create a new PipedWriter
instance
- * to write to the specified PipedReader
. This stream
- * is then ready for writing.
- *
- * @param sink The PipedReader
to connect this stream to.
- *
- * @exception IOException If sink
has already been connected
- * to a different PipedWriter.
- */
- public PipedWriter(PipedReader sink) throws IOException
- {
- sink.connect(this);
- }
-
- /**
- * Connects this object to the specified PipedReader
- * object. This stream will then be ready for writing.
- *
- * @param sink The PipedReader
to connect this stream to
- *
- * @exception IOException If the stream has not been connected or has
- * been closed.
- */
- public void connect(PipedReader sink) throws IOException
- {
- if (this.sink != null || sink.source != null)
- throw new IOException ("Already connected");
- sink.connect(this);
- }
-
- /**
- * Write a single char of date to the stream. Note that this method will
- * block if the PipedReader
to which this object is
- * connected has a full buffer.
- *
- * @param b The char of data to be written, passed as an int
.
- *
- * @exception IOException If the stream has not been connected or has
- * been closed.
- */
- public void write(int b) throws IOException
- {
- read_buf[0] = (char) (b & 0xffff);
- sink.receive (read_buf, 0, 1);
- }
-
- /**
- * This method writes len
chars of data from the char array
- * buf
starting at index offset
in the array
- * to the stream. Note that this method will block if the
- * PipedReader
to which this object is connected has
- * a buffer that cannot hold all of the chars to be written.
- *
- * @param buffer The array containing chars to write to the stream.
- * @param offset The index into the array to start writing chars from.
- * @param len The number of chars to write.
- *
- * @exception IOException If the stream has not been connected or has
- * been closed.
- */
- public void write(char[] buffer, int offset, int len) throws IOException
- {
- if (sink == null)
- throw new IOException ("Not connected");
- if (closed)
- throw new IOException ("Pipe closed");
-
- sink.receive(buffer, offset, len);
- }
-
- /**
- * This method does nothing.
- *
- * @exception IOException If the stream is closed.
- * @specnote You'd think that this method would block until the sink
- * had read all available data. Thats not the case - this method
- * appears to be a no-op?
- */
- public void flush() throws IOException
- {
- if (closed)
- throw new IOException ("Pipe closed");
- }
-
- /**
- * This method closes this stream so that no more data can be written
- * to it. Any further attempts to write to this stream may throw an
- * exception
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- // A close call on an unconnected PipedWriter has no effect.
- if (sink != null)
- {
- closed = true;
- // Notify any waiting readers that the stream is now closed.
- synchronized (sink)
- {
- sink.notifyAll();
- }
- }
- }
-}
diff --git a/libjava/java/io/PrintWriter.java b/libjava/java/io/PrintWriter.java
deleted file mode 100644
index 5fd0b162f31..00000000000
--- a/libjava/java/io/PrintWriter.java
+++ /dev/null
@@ -1,571 +0,0 @@
-/* PrintWriter.java -- prints primitive values and objects to a stream as text
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- * However, should use native methods for conversion.
- */
-
-/**
- * This class prints Java primitive values and objects to a stream as
- * text. None of the methods in this class throw an exception. However,
- * errors can be detected by calling the checkError()
method.
- * Additionally, this stream can be designated as "autoflush" when
- * created so that any writes are automatically flushed to the underlying
- * output sink whenever one of the println
methods is
- * called. (Note that this differs from the PrintStream
- * class which also auto-flushes when it encounters a newline character
- * in the chars written).
- *
- * @author Per Bothner (bothner@cygnus.com)
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @date April 17, 1998.
- */
-public class PrintWriter extends Writer
-{
- /**
- * true
if auto-flush is enabled, false
otherwise
- */
- private boolean autoflush;
-
- /**
- * This boolean indicates whether or not an error has ever occurred
- * on this stream.
- */
- private boolean error;
-
- /**
- * This is the underlying Writer
we are sending output
- * to
- */
- protected Writer out;
-
- /**
- * This method intializes a new PrintWriter
object to write
- * to the specified output sink. The form of the constructor does not
- * enable auto-flush functionality.
- *
- * @param wr The Writer
to write to.
- */
- public PrintWriter(Writer wr)
- {
- super(wr.lock);
- this.out = wr;
- }
-
- /**
- * This method intializes a new PrintWriter
object to write
- * to the specified output sink. This constructor also allows "auto-flush"
- * functionality to be specified where the stream will be flushed after
- * every line is terminated or newline character is written.
- *
- * @param wr The Writer
to write to.
- * @param autoflush true
to flush the stream after every
- * line, false
otherwise
- */
- public PrintWriter(Writer wr, boolean autoflush)
- {
- super(wr.lock);
- this.out = wr;
- this.autoflush = autoflush;
- }
-
- /**
- * This method initializes a new PrintWriter
object to write
- * to the specified OutputStream
. Characters will be converted
- * to chars using the system default encoding. Auto-flush functionality
- * will not be enabled.
- *
- * @param out The OutputStream
to write to
- */
- public PrintWriter(OutputStream out)
- {
- super();
- this.out = new OutputStreamWriter(out);
- this.lock = this.out;
- }
-
- /**
- * This method initializes a new PrintWriter
object to write
- * to the specified OutputStream
. Characters will be converted
- * to chars using the system default encoding. This form of the
- * constructor allows auto-flush functionality to be enabled if desired
- *
- * @param out The OutputStream
to write to
- * @param autoflush true
to flush the stream after every
- * println
call, false
otherwise.
- */
- public PrintWriter(OutputStream out, boolean autoflush)
- {
- this(out);
- this.autoflush = autoflush;
- }
-
- /**
- * This method can be called by subclasses to indicate that an error
- * has occurred and should be reported by checkError
.
- */
- protected void setError()
- {
- error = true;
- }
-
- /**
- * This method checks to see if an error has occurred on this stream. Note
- * that once an error has occurred, this method will continue to report
- * true
forever for this stream. Before checking for an
- * error condition, this method flushes the stream.
- *
- * @return true
if an error has occurred,
- * false
otherwise
- */
- public boolean checkError()
- {
- flush();
- return error;
- }
-
- /**
- * This method flushes any buffered chars to the underlying stream and
- * then flushes that stream as well.
- */
- public void flush()
- {
- try
- {
- out.flush();
- }
- catch (IOException ex)
- {
- error = true;
- }
- }
-
- /**
- * This method closes this stream and all underlying streams.
- */
- public void close()
- {
- try
- {
- out.close();
- }
- catch (IOException ex)
- {
- error = true;
- }
- }
-
- /**
- * This method prints a String
to the stream. The actual
- * value printed depends on the system default encoding.
- *
- * @param str The String
to print.
- */
- public void print(String str)
- {
- write(str == null ? "null" : str);
- }
-
- /**
- * This method prints a char to the stream. The actual value printed is
- * determined by the character encoding in use.
- *
- * @param ch The char
value to be printed
- */
- public void print(char ch)
- {
- write((int) ch);
- }
-
- /**
- * This method prints an array of characters to the stream. The actual
- * value printed depends on the system default encoding.
- *
- * @param charArray The array of characters to print.
- */
- public void print(char[] charArray)
- {
- write(charArray, 0, charArray.length);
- }
-
- /**
- * This methods prints a boolean value to the stream. true
- * values are printed as "true" and false
values are printed
- * as "false".
- *
- * @param bool The boolean
value to print
- */
- public void print(boolean bool)
- {
- // We purposely call write() and not print() here. This preserves
- // compatibility with JDK 1.2.
- write (bool ? "true" : "false");
- }
-
- /**
- * This method prints an integer to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * @param inum The int
value to be printed
- */
- public void print(int inum)
- {
- // We purposely call write() and not print() here. This preserves
- // compatibility with JDK 1.2.
- write(Integer.toString(inum));
- }
-
- /**
- * This method prints a long to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * @param lnum The long
value to be printed
- */
- public void print(long lnum)
- {
- // We purposely call write() and not print() here. This preserves
- // compatibility with JDK 1.2.
- write(Long.toString(lnum));
- }
-
- /**
- * This method prints a float to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * @param fnum The float
value to be printed
- */
- public void print(float fnum)
- {
- // We purposely call write() and not print() here. This preserves
- // compatibility with JDK 1.2.
- write(Float.toString(fnum));
- }
-
- /**
- * This method prints a double to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * @param dnum The double
value to be printed
- */
- public void print(double dnum)
- {
- // We purposely call write() and not print() here. This preserves
- // compatibility with JDK 1.2.
- write(Double.toString(dnum));
- }
-
- /**
- * This method prints an Object
to the stream. The actual
- * value printed is determined by calling the String.valueOf()
- * method.
- *
- * @param obj The Object
to print.
- */
- public void print(Object obj)
- {
- // We purposely call write() and not print() here. This preserves
- // compatibility with JDK 1.2.
- write(obj == null ? "null" : obj.toString());
- }
-
- /**
- * This is the system dependent line separator
- */
- private static final char[] line_separator
- = System.getProperty("line.separator").toCharArray();
-
- /**
- * This method prints a line separator sequence to the stream. The value
- * printed is determined by the system property true
- * values are printed as "true" and false
values are printed
- * as "false".
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param bool The boolean
value to print
- */
- public void println(boolean bool)
- {
- synchronized (lock)
- {
- print(bool);
- println();
- }
- }
-
- /**
- * This method prints an integer to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param inum The int
value to be printed
- */
- public void println(int inum)
- {
- synchronized (lock)
- {
- print(inum);
- println();
- }
- }
-
- /**
- * This method prints a long to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param lnum The long
value to be printed
- */
- public void println(long lnum)
- {
- synchronized (lock)
- {
- print(lnum);
- println();
- }
- }
-
- /**
- * This method prints a float to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param fnum The float
value to be printed
- */
- public void println(float fnum)
- {
- synchronized (lock)
- {
- print(fnum);
- println();
- }
- }
-
- /**
- * This method prints a double to the stream. The value printed is
- * determined using the String.valueOf()
method.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param dnum The double
value to be printed
- */
- public void println(double dnum)
- {
- synchronized (lock)
- {
- print(dnum);
- println();
- }
- }
-
- /**
- * This method prints an Object
to the stream. The actual
- * value printed is determined by calling the String.valueOf()
- * method.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param obj The Object
to print.
- */
- public void println(Object obj)
- {
- synchronized (lock)
- {
- print(obj);
- println();
- }
- }
-
- /**
- * This method prints a String
to the stream. The actual
- * value printed depends on the system default encoding.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param str The String
to print.
- */
- public void println(String str)
- {
- synchronized (lock)
- {
- print(str);
- println();
- }
- }
-
- /**
- * This method prints a char to the stream. The actual value printed is
- * determined by the character encoding in use.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param ch The char
value to be printed
- */
- public void println(char ch)
- {
- synchronized (lock)
- {
- print(ch);
- println();
- }
- }
-
- /**
- * This method prints an array of characters to the stream. The actual
- * value printed depends on the system default encoding.
- *
- * This method prints a line termination sequence after printing the value.
- *
- * @param charArray The array of characters to print.
- */
- public void println(char[] charArray)
- {
- synchronized (lock)
- {
- print(charArray);
- println();
- }
- }
-
- /**
- * This method writes a single char to the stream.
- *
- * @param ch The char to be written, passed as a int
- */
- public void write(int ch)
- {
- try
- {
- out.write(ch);
- }
- catch (IOException ex)
- {
- error = true;
- }
- }
-
- /**
- * This method writes count
chars from the specified array
- * starting at index offset
into the array.
- *
- * @param charArray The array of chars to write
- * @param offset The index into the array to start writing from
- * @param count The number of chars to write
- */
- public void write(char[] charArray, int offset, int count)
- {
- try
- {
- out.write(charArray, offset, count);
- }
- catch (IOException ex)
- {
- error = true;
- }
- }
-
- /**
- * This method writes count
chars from the specified
- * String
to the output starting at character position
- * offset
into the String
- *
- * @param str The String
to write chars from
- * @param offset The offset into the String
to start writing from
- * @param count The number of chars to write.
- */
- public void write(String str, int offset, int count)
- {
- try
- {
- out.write(str, offset, count);
- }
- catch (IOException ex)
- {
- error = true;
- }
- }
-
- /**
- * This method write all the chars in the specified array to the output.
- *
- * @param charArray The array of characters to write
- */
- public void write(char[] charArray)
- {
- write(charArray, 0, charArray.length);
- }
-
- /**
- * This method writes the contents of the specified String
- * to the underlying stream.
- *
- * @param str The String
to write
- */
- public void write(String str)
- {
- write(str, 0, str.length());
- }
-}
-
diff --git a/libjava/java/io/PushbackInputStream.java b/libjava/java/io/PushbackInputStream.java
deleted file mode 100644
index 71cf244274e..00000000000
--- a/libjava/java/io/PushbackInputStream.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/* PushbackInputStream.java -- An input stream that can unread bytes
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/**
- * This subclass of FilterInputStream
provides the ability to
- * unread data from a stream. It maintains an internal buffer of unread
- * data that is supplied to the next read operation. This is conceptually
- * similar to mark/reset functionality, except that in this case the
- * position to reset the stream to does not need to be known in advance.
- * buf[buf.length - 1]
to buf[0]
. Thus when
- * pos
is 0 the buffer is full and buf.length
when
- * it is empty
- */
- protected int pos;
-
- /**
- * This method initializes a PushbackInputStream
to
- * read from the specified subordinate InputStream
- * with a default pushback buffer size of 1.
- *
- * @param in The subordinate stream to read from
- */
- public PushbackInputStream(InputStream in)
- {
- this(in, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a PushbackInputStream
to
- * read from the specified subordinate InputStream
with
- * the specified buffer size
- *
- * @param in The subordinate InputStream
to read from
- * @param size The pushback buffer size to use
- */
- public PushbackInputStream(InputStream in, int size)
- {
- super(in);
- if (size < 0)
- throw new IllegalArgumentException();
- buf = new byte[size];
- pos = buf.length;
- }
-
- /**
- * This method returns the number of bytes that can be read from this
- * stream before a read can block. A return of 0 indicates that blocking
- * might (or might not) occur on the very next read attempt.
- * false
to indicate that it does
- * not support mark/reset functionality.
- *
- * @return This method returns false
to indicate that
- * this class does not support mark/reset functionality
- */
- public boolean markSupported()
- {
- return false;
- }
-
- /**
- * This method always throws an IOException in this class because
- * mark/reset functionality is not supported.
- *
- * @exception IOException Always thrown for this class
- */
- public void reset() throws IOException
- {
- throw new IOException("Mark not supported in this class");
- }
-
- /**
- * This method reads an unsigned byte from the input stream and returns it
- * as an int in the range of 0-255. This method also will return -1 if
- * the end of the stream has been reached. The byte returned will be read
- * from the pushback buffer, unless the buffer is empty, in which case
- * the byte will be read from the underlying stream.
- * offset
into the buffer and attempts to read
- * len
bytes. This method can return before reading the
- * number of bytes requested. The actual number of bytes read is
- * returned as an int. A -1 is returned to indicate the end of the
- * stream.
- * int
. Only the low
- * eight bits of this value are pushed back.
- *
- * @param b The byte to be pushed back, passed as an int
- *
- * @exception IOException If the pushback buffer is full.
- */
- public synchronized void unread(int b) throws IOException
- {
- if (pos <= 0)
- throw new IOException("Insufficient space in pushback buffer");
-
- buf[--pos] = (byte) b;
- }
-
- /**
- * This method pushes all of the bytes in the passed byte array into
- * the pushback bfer. These bytes are pushed in reverse order so that
- * the next byte read from the stream after this operation will be
- * b[0]
followed by b[1]
, etc.
- * b[offset]
to
- * b[offset + len]
are pushed in reverse order so that
- * the next byte read from the stream after this operation will be
- * b[offset]
followed by b[offset + 1]
,
- * etc.
- * skip
method on the underlying InputStream
to
- * skip additional bytes if necessary.
- *
- * @param n The requested number of bytes to skip
- *
- * @return The actual number of bytes skipped.
- *
- * @exception IOException If an error occurs
- *
- * @since 1.2
- */
- public synchronized long skip(long n) throws IOException
- {
- final long origN = n;
-
- if (n > 0L)
- {
- int numread = (int) Math.min((long) (buf.length - pos), n);
- pos += numread;
- n -= numread;
- if (n > 0)
- n -= super.skip(n);
- }
-
- return origN - n;
- }
-}
diff --git a/libjava/java/io/PushbackReader.java b/libjava/java/io/PushbackReader.java
deleted file mode 100644
index 04bccc70fc5..00000000000
--- a/libjava/java/io/PushbackReader.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/* PushbackReader.java -- An character stream that can unread chars
- Copyright (C) 1998, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This subclass of FilterReader
provides the ability to
- * unread data from a stream. It maintains an internal buffer of unread
- * data that is supplied to the next read operation. This is conceptually
- * similar to mark/reset functionality, except that in this case the
- * position to reset the stream to does not need to be known in advance.
- * buf[buf.length - 1]
to buf[0]
. Thus when
- * pos
is 0 the buffer is full and buf.length
when
- * it is empty
- */
- private int pos;
-
- /**
- * This method initializes a PushbackReader
to read from the
- * specified subordinate Reader
with a default pushback buffer
- * size of 1.
- *
- * @param in The subordinate stream to read from
- */
- public PushbackReader(Reader in)
- {
- this(in, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a PushbackReader
to read from the
- * specified subordinate Reader
with the specified buffer
- * size
- *
- * @param in The subordinate Reader
to read from
- * @param bufsize The pushback buffer size to use
- */
- public PushbackReader(Reader in, int bufsize)
- {
- super(in);
-
- if (bufsize < 0)
- throw new IllegalArgumentException("buffer size must be positive");
-
- buf = new char[bufsize];
- pos = bufsize;
- }
-
- /**
- * This method closes the stream and frees any associated resources.
- *
- * @exception IOException If an error occurs.
- */
- public void close() throws IOException
- {
- synchronized (lock)
- {
- buf = null;
- super.close();
- }
- }
-
- /**
- * This method throws an exception when called since this class does
- * not support mark/reset.
- *
- * @param read_limit Not used.
- *
- * @exception IOException Always thrown to indicate mark/reset not supported.
- */
- public void mark(int read_limit) throws IOException
- {
- throw new IOException("mark not supported in this class");
- }
-
- /**
- * This method returns false
to indicate that it does not support
- * mark/reset functionality.
- *
- * @return This method returns false
to indicate that this
- * class does not support mark/reset functionality
- *
- */
- public boolean markSupported()
- {
- return(false);
- }
-
- /**
- * This method always throws an IOException in this class because
- * mark/reset functionality is not supported.
- *
- * @exception IOException Always thrown for this class
- */
- public void reset() throws IOException
- {
- throw new IOException("reset not supported in this class");
- }
-
- /**
- * This method determines whether or not this stream is ready to be read.
- * If it returns false
to indicate that the stream is not
- * ready, any attempt to read from the stream could (but is not
- * guaranteed to) block.
- * true
if this stream is ready to be read,
- * false
otherwise
- *
- * @exception IOException If an error occurs
- */
- public boolean ready() throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException ("stream closed");
-
- if (((buf.length - pos) > 0) || super.ready())
- return(true);
- else
- return(false);
- }
- }
-
- // Don't delete this method just because the spec says it shouldn't be there!
- // See the CVS log for details.
- /**
- * This method skips the specified number of chars in the stream. It
- * returns the actual number of chars skipped, which may be less than the
- * requested amount.
- * skip
method on the underlying Reader
to
- * skip additional chars if necessary.
- *
- * @param num_chars The requested number of chars to skip
- *
- * @return The actual number of chars skipped.
- *
- * @exception IOException If an error occurs
- */
- public long skip(long num_chars) throws IOException
- {
- synchronized (lock)
- {
- if (num_chars <= 0)
- return(0);
-
- if ((buf.length - pos) >= num_chars)
- {
- pos += num_chars;
- return(num_chars);
- }
-
- int chars_discarded = buf.length - pos;
- pos = buf.length;
-
- long chars_skipped = in.skip(num_chars - chars_discarded);
-
- return(chars_discarded + chars_skipped);
- }
- }
-
- /**
- * This method reads an unsigned char from the input stream and returns it
- * as an int in the range of 0-65535. This method also will return -1 if
- * the end of the stream has been reached. The char returned will be read
- * from the pushback buffer, unless the buffer is empty, in which case
- * the char will be read from the underlying stream.
- * offset
- * into
- * the buffer and attempts to read len
chars. This method can
- * return before reading the number of chars requested. The actual number
- * of chars read is returned as an int. A -1 is returned to indicate the
- * end of the stream.
- * int
. Only the low eight
- * bits of this value are pushed back.
- *
- * @param b The char to be pushed back, passed as an int
- *
- * @exception IOException If the pushback buffer is full.
- */
- public void unread(int b) throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("stream closed");
- if (pos == 0)
- throw new IOException("Pushback buffer is full");
-
- --pos;
- buf[pos] = (char)(b & 0xFFFF);
- }
- }
-
- /**
- * This method pushes all of the chars in the passed char array into
- * the pushback buffer. These chars are pushed in reverse order so that
- * the next char read from the stream after this operation will be
- * buf[0]
followed by buf[1]
, etc.
- * buf[offset]
to
- * buf[offset + len]
- * are pushed in reverse order so that the next char read from the stream
- * after this operation will be buf[offset]
followed by
- * buf[offset + 1]
, etc.
- * Object
used for synchronizing critical code
- * sections. Subclasses should use this variable instead of a
- * synchronized method or an explicit synchronization on this
- */
- protected Object lock;
-
- /**
- * Unitializes a Reader
that will use the object
- * itself for synchronization of critical code sections.
- */
- protected Reader()
- {
- this.lock = this;
- }
-
- /**
- * Initializes a Reader
that will use the specified
- * Object
for synchronization of critical code sections.
- *
- * @param lock The Object
to use for synchronization
- */
- protected Reader(Object lock)
- {
- this.lock = lock;
- }
-
- /**
- * Read chars from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index offset
- * into the buffer and attempts to read len
chars. This method
- * can return before reading the number of chars requested. The actual
- * number of chars read is returned as an int. A -1 is returned to indicate
- * the end of the stream.
- * read()
method
- * in a loop until the desired number of chars are read. The read loop
- * stops short if the end of the stream is encountered or if an IOException
- * is encountered on any read operation except the first. If the first
- * attempt to read a chars fails, the IOException is allowed to propagate
- * upward. And subsequent IOException is caught and treated identically
- * to an end of stream condition. Subclasses can (and should if possible)
- * override this method to provide a more efficient implementation.
- *
- * @param buf The array into which the chars read should be stored
- * @param offset The offset into the array to start storing chars
- * @param count The requested number of chars to read
- *
- * @return The actual number of chars read, or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- */
- public abstract int read(char buf[], int offset, int count)
- throws IOException;
-
- /**
- * Reads chars from a stream and stores them into a caller
- * supplied buffer. This method attempts to completely fill the buffer,
- * but can return before doing so. The actual number of chars read is
- * returned as an int. A -1 is returned to indicate the end of the stream.
- * read(buf, 0, buf.length)
- *
- * @param buf The buffer into which the chars read will be stored.
- *
- * @return The number of chars read or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- */
- public int read(char buf[]) throws IOException
- {
- return read(buf, 0, buf.length);
- }
-
- /**
- * Reads an char from the input stream and returns it
- * as an int in the range of 0-65535. This method also will return -1 if
- * the end of the stream has been reached.
- * IOException
.
- *
- * @exception IOException If an error occurs
- */
- public abstract void close() throws IOException;
-
- /**
- * Returns a boolean that indicates whether the mark/reset
- * methods are supported in this class. Those methods can be used to
- * remember a specific point in the stream and reset the stream to that
- * point.
- * false
in this class, but
- * subclasses can override this method to return true
if they
- * support mark/reset functionality.
- *
- * @return true
if mark/reset functionality is supported,
- * false
otherwise
- *
- */
- public boolean markSupported()
- {
- return false;
- }
-
- /**
- * Marks a position in the input to which the stream can be
- * "reset" by calling the reset()
method. The parameter
- * readlimit
is the number of chars that can be read from the
- * stream after setting the mark before the mark becomes invalid. For
- * example, if mark()
is called with a read limit of 10, then
- * when 11 chars of data are read from the stream before the
- * reset()
method is called, then the mark is invalid and the
- * stream object instance is not required to remember the mark.
- *
- * @param readLimit The number of chars that can be read before the mark
- * becomes invalid
- *
- * @exception IOException If an error occurs such as mark not being
- * supported for this class
- */
- public void mark(int readLimit) throws IOException
- {
- throw new IOException("mark not supported");
- }
-
- /**
- * Resets a stream to the point where the mark()
- * method was called. Any chars that were read after the mark point was
- * set will be re-read during subsequent reads.
- * false
the stream may block if a
- * read is attempted, but it is not guaranteed to do so.
- * false
in this class
- *
- * @return true
if the stream is ready to be read,
- * false
otherwise.
- *
- * @exception IOException If an error occurs
- */
- public boolean ready() throws IOException
- {
- return false;
- }
-
- /**
- * Skips the specified number of chars in the stream. It
- * returns the actual number of chars skipped, which may be less than the
- * requested amount.
- * InputStream
's in
- * order to form a single logical stream that can be read by applications
- * that expect only one stream.
- * SequenceInputStream
that obtains
- * its list of subordinate InputStream
s from the specified
- * Enumeration
- *
- * @param e An Enumeration
that will return a list of
- * InputStream
s to read in sequence
- */
- public SequenceInputStream(Enumeration e)
- {
- this.e = e;
- in = (InputStream) e.nextElement();
- in2 = null;
- }
-
- /**
- * This method creates a new SequenceInputStream
that will read
- * the two specified subordinate InputStream
s in sequence.
- *
- * @param s1 The first InputStream
to read
- * @param s2 The second InputStream
to read
- */
- public SequenceInputStream(InputStream s1, InputStream s2)
- {
- in = s1;
- in2 = s2;
- }
-
- /**
- * This method returns the number of bytes than can be read from the
- * currently being read subordinate stream before that stream could
- * block. Note that it is possible more bytes than this can actually
- * be read without the stream blocking. If a 0 is returned, then the
- * stream could block on the very next read.
- *
- * @return The number of bytes that can be read before blocking could occur
- *
- * @exception IOException If an error occurs
- */
- public int available() throws IOException
- {
- if (in == null)
- return 0;
-
- return in.available();
- }
-
- /**
- * Closes this stream. This will cause any remaining unclosed subordinate
- * InputStream
's to be closed as well. Subsequent attempts to
- * read from this stream may cause an exception.
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- while (in != null)
- {
- in.close();
- in = getNextStream ();
- }
- }
-
- /**
- * This method reads an unsigned byte from the input stream and returns it
- * as an int in the range of 0-255. This method also will return -1 if
- * the end of the stream has been reached. This will only happen when
- * all of the subordinate streams have been read.
- * offset
- * into the buffer and attempts to read len
bytes. This method
- * can return before reading the number of bytes requested. The actual number
- * of bytes read is returned as an int. A -1 is returend to indicate the
- * end of the stream. This will only happen when all of the subordinate
- * streams have been read.
- * InputStream
to
- * read from. Returns null when no more streams are available.
- */
- private InputStream getNextStream()
- {
- InputStream nextIn = null;
-
- if (e != null)
- {
- if (e.hasMoreElements())
- nextIn = (InputStream) e.nextElement();
- }
- else
- if (in2 != null)
- {
- nextIn = in2;
- in2 = null;
- }
-
- return nextIn;
- }
-}
diff --git a/libjava/java/io/Serializable.java b/libjava/java/io/Serializable.java
deleted file mode 100644
index a6d99f6d522..00000000000
--- a/libjava/java/io/Serializable.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Serializable.java -- Interface to indicate a class may be serialized
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * Status: Believed complete
- */
-
-/**
- * This interface has no methods. It simply serves to indicate that
- * the implementing class may be serialized.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public interface Serializable
-{
-} // interface Serializable
diff --git a/libjava/java/io/SerializablePermission.java b/libjava/java/io/SerializablePermission.java
deleted file mode 100644
index b5c07e4ec2c..00000000000
--- a/libjava/java/io/SerializablePermission.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* SerializablePermission.java -- Basic permissions related to serialization.
- Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import java.security.BasicPermission;
-
-/**
- * This class models permissions related to serialization. As a subclass
- * of BasicPermission
, this class has permissions that have
- * a name only. There is no associated action list.
- *
- *
- *
- * @see java.security.BasicPermission
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public final class SerializablePermission extends BasicPermission
-{
- static final long serialVersionUID = 8537212141160296410L;
-
- /*
- * Class Variables
- */
-
- private static final String[] legal_names = { "enableSubclassImplementation",
- "enableSubstitution" };
- /*
- * Constructors
- */
-
- /**
- * This method initializes a new instance of
- * enableSubclassImplementation
- Allows a subclass to
- * override the default serialization behavior of objects.enableSubstitution
- Allows substitution of one object
- * for another during serialization or deserialization.SerializablePermission
- * that has the specified name.
- *
- * @param name The name of the permission.
- *
- * @exception IllegalArgumentException If the name is not valid for
- * this class.
- */
- public SerializablePermission(String name)
- {
- this(name, null);
- }
-
- /**
- * This method initializes a new instance of
- * SerializablePermission
- * that has the specified name and action list. Note that the action list
- * is unused in this class.
- *
- * @param name The name of the permission.
- * @param actions The action list (unused).
- *
- * @exception IllegalArgumentException If the name is not valid for
- * this class.
- */
- public SerializablePermission(String name, String actions)
- {
- super(name, actions);
-
- for (int i = 0; i < legal_names.length; i++)
- if (legal_names[i].equals(name))
- return;
-
- throw new IllegalArgumentException("Bad permission name: " + name);
- }
-
-} // class SerializablePermission
-
diff --git a/libjava/java/io/StreamCorruptedException.java b/libjava/java/io/StreamCorruptedException.java
deleted file mode 100644
index d24d12150c5..00000000000
--- a/libjava/java/io/StreamCorruptedException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* StreamCorruptedException.java -- Error in stream during serialization
- Copyright (C) 1998, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when there is an error in the data that is
- * read from a stream during de-serialization.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class StreamCorruptedException extends ObjectStreamException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 8983558202217591746L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public StreamCorruptedException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public StreamCorruptedException(String message)
- {
- super(message);
- }
-} // class StreamCorruptedException
diff --git a/libjava/java/io/StreamTokenizer.java b/libjava/java/io/StreamTokenizer.java
deleted file mode 100644
index bd7773b1990..00000000000
--- a/libjava/java/io/StreamTokenizer.java
+++ /dev/null
@@ -1,708 +0,0 @@
-/* StreamTokenizer.java -- parses streams of characters into tokens
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/**
- * This class parses streams of characters into tokens. There are a
- * million-zillion flags that can be set to control the parsing, as
- * described under the various method headings.
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @date October 25, 1998.
- */
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-public class StreamTokenizer
-{
- /** A constant indicating that the end of the stream has been read. */
- public static final int TT_EOF = -1;
-
- /** A constant indicating that the end of the line has been read. */
- public static final int TT_EOL = '\n';
-
- /** A constant indicating that a number token has been read. */
- public static final int TT_NUMBER = -2;
-
- /** A constant indicating that a word token has been read. */
- public static final int TT_WORD = -3;
-
- /** A constant indicating that no tokens have been read yet. */
- private static final int TT_NONE = -4;
-
- /**
- * Contains the type of the token read resulting from a call to nextToken
- * The rules are as follows:
- *
- *
- */
- public int ttype = TT_NONE;
-
- /** The String associated with word and string tokens. */
- public String sval;
-
- /** The numeric value associated with number tokens. */
- public double nval;
-
- /* Indicates whether end-of-line is recognized as a token. */
- private boolean eolSignificant = false;
-
- /* Indicates whether word tokens are automatically made lower case. */
- private boolean lowerCase = false;
-
- /* Indicates whether C++ style comments are recognized and skipped. */
- private boolean slashSlash = false;
-
- /* Indicates whether C style comments are recognized and skipped. */
- private boolean slashStar = false;
-
- /* Attribute tables of each byte from 0x00 to 0xFF. */
- private boolean[] whitespace = new boolean[256];
- private boolean[] alphabetic = new boolean[256];
- private boolean[] numeric = new boolean[256];
- private boolean[] quote = new boolean[256];
- private boolean[] comment = new boolean[256];
-
- /* The Reader associated with this class. */
- private PushbackReader in;
-
- /* Indicates if a token has been pushed back. */
- private boolean pushedBack = false;
-
- /* Contains the current line number of the reader. */
- private int lineNumber = 1;
-
- /**
- * This method reads bytes from an InputStream
and tokenizes
- * them. For details on how this method operates by default, see
- * StreamTokenizer(Reader)
.
- *
- * @param is The InputStream
to read from
- *
- * @deprecated Since JDK 1.1.
- */
- public StreamTokenizer(InputStream is)
- {
- this(new InputStreamReader(is));
- }
-
- /**
- * This method initializes a new StreamTokenizer
to read
- * characters from a Reader
and parse them. The char values
- * have their hight bits masked so that the value is treated a character
- * in the range of 0x0000 to 0x00FF.
- *
- *
- *
- * @param r The Reader
to read chars from
- */
- public StreamTokenizer(Reader r)
- {
- in = new PushbackReader(r);
-
- whitespaceChars(0x00, 0x20);
- wordChars('A', 'Z');
- wordChars('a', 'z');
- wordChars(0xA0, 0xFF);
- commentChar('/');
- quoteChar('\'');
- quoteChar('"');
- parseNumbers();
- }
-
- /**
- * This method sets the comment attribute on the specified
- * character. Other attributes for the character are cleared.
- *
- * @param ch The character to set the comment attribute for, passed as an int
- */
- public void commentChar(int ch)
- {
- if (ch >= 0 && ch <= 255)
- {
- comment[ch] = true;
- whitespace[ch] = false;
- alphabetic[ch] = false;
- numeric[ch] = false;
- quote[ch] = false;
- }
- }
-
- /**
- * This method sets a flag that indicates whether or not the end of line
- * sequence terminates and is a token. The defaults to false
- *
- * @param flag true
if EOF is significant, false
- * otherwise
- */
- public void eolIsSignificant(boolean flag)
- {
- eolSignificant = flag;
- }
-
- /**
- * This method returns the current line number. Note that if the
- * pushBack()
method is called, it has no effect on the
- * line number returned by this method.
- *
- * @return The current line number
- */
- public int lineno()
- {
- return lineNumber;
- }
-
- /**
- * This method sets a flag that indicates whether or not alphabetic
- * tokens that are returned should be converted to lower case.
- *
- * @param flag true
to convert to lower case,
- * false
otherwise
- */
- public void lowerCaseMode(boolean flag)
- {
- lowerCase = flag;
- }
-
- private boolean isWhitespace(int ch)
- {
- return (ch >= 0 && ch <= 255 && whitespace[ch]);
- }
-
- private boolean isAlphabetic(int ch)
- {
- return ((ch > 255) || (ch >= 0 && alphabetic[ch]));
- }
-
- private boolean isNumeric(int ch)
- {
- return (ch >= 0 && ch <= 255 && numeric[ch]);
- }
-
- private boolean isQuote(int ch)
- {
- return (ch >= 0 && ch <= 255 && quote[ch]);
- }
-
- private boolean isComment(int ch)
- {
- return (ch >= 0 && ch <= 255 && comment[ch]);
- }
-
- /**
- * This method reads the next token from the stream. It sets the
- * ttype
variable to the appropriate token type and
- * returns it. It also can set sval
or nval
- * as described below. The parsing strategy is as follows:
- *
- *
- *
- * @return The token type
- * @exception IOException If an I/O error occurs
- */
- public int nextToken() throws IOException
- {
- if (pushedBack)
- {
- pushedBack = false;
- if (ttype != TT_NONE)
- return ttype;
- }
-
- sval = null;
- int ch;
-
- // Skip whitespace. Deal with EOL along the way.
- while (isWhitespace(ch = in.read()))
- if (ch == '\n' || ch == '\r')
- {
- lineNumber++;
-
- // Throw away \n if in combination with \r.
- if (ch == '\r' && (ch = in.read()) != '\n')
- {
- if (ch != TT_EOF)
- in.unread(ch);
- }
- if (eolSignificant)
- return (ttype = TT_EOL);
- }
-
- if (ch == '/')
- if ((ch = in.read()) == '/' && slashSlash)
- {
- while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
- ;
- if (ch != TT_EOF)
- in.unread(ch);
- return nextToken(); // Recursive, but not too deep in normal cases
- }
- else if (ch == '*' && slashStar)
- {
- while (true)
- {
- ch = in.read();
- if (ch == '*')
- {
- if ((ch = in.read()) == '/')
- break;
- else if (ch != TT_EOF)
- in.unread(ch);
- }
- else if (ch == '\n' || ch == '\r')
- {
- lineNumber++;
- if (ch == '\r' && (ch = in.read()) != '\n')
- {
- if (ch != TT_EOF)
- in.unread(ch);
- }
- }
- else if (ch == TT_EOF)
- {
- break;
- }
- }
- return nextToken(); // Recursive, but not too deep in normal cases
- }
- else
- {
- if (ch != TT_EOF)
- in.unread(ch);
- ch = '/';
- }
-
- if (ch == TT_EOF)
- ttype = TT_EOF;
- else if (isNumeric(ch))
- {
- boolean isNegative = false;
- if (ch == '-')
- {
- // Read ahead to see if this is an ordinary '-' rather than numeric.
- ch = in.read();
- if (isNumeric(ch) && ch != '-')
- {
- isNegative = true;
- }
- else
- {
- if (ch != TT_EOF)
- in.unread(ch);
- return (ttype = '-');
- }
- }
-
- StringBuffer tokbuf = new StringBuffer();
- tokbuf.append((char) ch);
-
- int decCount = 0;
- while (isNumeric(ch = in.read()) && ch != '-')
- if (ch == '.' && decCount++ > 0)
- break;
- else
- tokbuf.append((char) ch);
-
- if (ch != TT_EOF)
- in.unread(ch);
- ttype = TT_NUMBER;
- try
- {
- nval = Double.valueOf(tokbuf.toString()).doubleValue();
- }
- catch (NumberFormatException _)
- {
- nval = 0.0;
- }
- if (isNegative)
- nval = -nval;
- }
- else if (isAlphabetic(ch))
- {
- StringBuffer tokbuf = new StringBuffer();
- tokbuf.append((char) ch);
- while (isAlphabetic(ch = in.read()) || isNumeric(ch))
- tokbuf.append((char) ch);
- if (ch != TT_EOF)
- in.unread(ch);
- ttype = TT_WORD;
- sval = tokbuf.toString();
- if (lowerCase)
- sval = sval.toLowerCase();
- }
- else if (isComment(ch))
- {
- while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
- ;
- if (ch != TT_EOF)
- in.unread(ch);
- return nextToken(); // Recursive, but not too deep in normal cases.
- }
- else if (isQuote(ch))
- {
- ttype = ch;
- StringBuffer tokbuf = new StringBuffer();
- while ((ch = in.read()) != ttype && ch != '\n' && ch != '\r' &&
- ch != TT_EOF)
- {
- if (ch == '\\')
- switch (ch = in.read())
- {
- case 'a': ch = 0x7;
- break;
- case 'b': ch = '\b';
- break;
- case 'f': ch = 0xC;
- break;
- case 'n': ch = '\n';
- break;
- case 'r': ch = '\r';
- break;
- case 't': ch = '\t';
- break;
- case 'v': ch = 0xB;
- break;
- case '\n': ch = '\n';
- break;
- case '\r': ch = '\r';
- break;
- case '\"':
- case '\'':
- case '\\':
- break;
- default:
- int ch1, nextch;
- if ((nextch = ch1 = ch) >= '0' && ch <= '7')
- {
- ch -= '0';
- if ((nextch = in.read()) >= '0' && nextch <= '7')
- {
- ch = ch * 8 + nextch - '0';
- if ((nextch = in.read()) >= '0' && nextch <= '7' &&
- ch1 >= '0' && ch1 <= '3')
- {
- ch = ch * 8 + nextch - '0';
- nextch = in.read();
- }
- }
- }
-
- if (nextch != TT_EOF)
- in.unread(nextch);
- }
-
- tokbuf.append((char) ch);
- }
-
- // Throw away matching quote char.
- if (ch != ttype && ch != TT_EOF)
- in.unread(ch);
-
- sval = tokbuf.toString();
- }
- else
- {
- ttype = ch;
- }
-
- return ttype;
- }
-
- private void resetChar(int ch)
- {
- whitespace[ch] = alphabetic[ch] = numeric[ch] = quote[ch] = comment[ch] =
- false;
- }
-
- /**
- * This method makes the specified character an ordinary character. This
- * means that none of the attributes (whitespace, alphabetic, numeric,
- * quote, or comment) will be set on this character. This character will
- * parse as its own token.
- *
- * @param ch The character to make ordinary, passed as an int
- */
- public void ordinaryChar(int ch)
- {
- if (ch >= 0 && ch <= 255)
- resetChar(ch);
- }
-
- /**
- * This method makes all the characters in the specified range, range
- * terminators included, ordinary. This means the none of the attributes
- * (whitespace, alphabetic, numeric, quote, or comment) will be set on
- * any of the characters in the range. This makes each character in this
- * range parse as its own token.
- *
- * @param low The low end of the range of values to set the whitespace
- * attribute for
- * @param hi The high end of the range of values to set the whitespace
- * attribute for
- */
- public void ordinaryChars(int low, int hi)
- {
- if (low < 0)
- low = 0;
- if (hi > 255)
- hi = 255;
- for (int i = low; i <= hi; i++)
- resetChar(i);
- }
-
- /**
- * This method sets the numeric attribute on the characters '0' - '9' and
- * the characters '.' and '-'.
- */
- public void parseNumbers()
- {
- for (int i = 0; i <= 9; i++)
- numeric['0' + i] = true;
-
- numeric['.'] = true;
- numeric['-'] = true;
- }
-
- /**
- * Puts the current token back into the StreamTokenizer so
- * nval
- * is set to the value parsed.sval
. If lower case mode is set, the token
- * stored in sval
is converted to lower case. The end of line
- * sequence terminates a word only if EOL signficance has been turned on.
- * The start of a comment also terminates a word. Any character with a
- * non-alphabetic and non-numeric attribute (such as white space, a quote,
- * or a commet) are treated as non-alphabetic and terminate the word.String
. This String
is stored as
- * sval
, but is not converted to lower case, even if lower case
- * mode is enabled. The token type returned is the value of the quote
- * character encountered. Any escape sequences
- * (\b (backspace), \t (HTAB), \n (linefeed), \f (form feed), \r
- * (carriage return), \" (double quote), \' (single quote), \\
- * (backslash), \XXX (octal esacpe)) are converted to the appropriate
- * char values. Invalid esacape sequences are left in untranslated.
- * Unicode characters like ('\ u0000') are not recognized. nextToken
will return the same value on the next call.
- * May cause the lineno method to return an incorrect value
- * if lineno is called before the next call to nextToken.
- */
- public void pushBack()
- {
- pushedBack = true;
- }
-
- /**
- * This method sets the quote attribute on the specified character.
- * Other attributes for the character are cleared.
- *
- * @param ch The character to set the quote attribute for, passed as an int.
- */
- public void quoteChar(int ch)
- {
- if (ch >= 0 && ch <= 255)
- {
- quote[ch] = true;
- comment[ch] = false;
- whitespace[ch] = false;
- alphabetic[ch] = false;
- numeric[ch] = false;
- }
- }
-
- /**
- * This method removes all attributes (whitespace, alphabetic, numeric,
- * quote, and comment) from all characters. It is equivalent to calling
- * ordinaryChars(0x00, 0xFF)
.
- *
- * @see #ordinaryChars(int, int)
- */
- public void resetSyntax()
- {
- ordinaryChars(0x00, 0xFF);
- }
-
- /**
- * This method sets a flag that indicates whether or not "C++" language style
- * comments ("//" comments through EOL ) are handled by the parser.
- * If this is true
commented out sequences are skipped and
- * ignored by the parser. This defaults to false
.
- *
- * @param flag true
to recognized and handle "C++" style
- * comments, false
otherwise
- */
- public void slashSlashComments(boolean flag)
- {
- slashSlash = flag;
- }
-
- /**
- * This method sets a flag that indicates whether or not "C" language style
- * comments (with nesting not allowed) are handled by the parser.
- * If this is true
commented out sequences are skipped and
- * ignored by the parser. This defaults to false
.
- *
- * @param flag true
to recognized and handle "C" style comments,
- * false
otherwise
- */
- public void slashStarComments(boolean flag)
- {
- slashStar = flag;
- }
-
- /**
- * This method returns the current token value as a String
in
- * the form "Token[x], line n", where 'n' is the current line numbers and
- * 'x' is determined as follows.
- *
- *
- */
- public String toString()
- {
- String tempstr;
- if (ttype == TT_EOF)
- tempstr = "EOF";
- else if (ttype == TT_EOL)
- tempstr = "EOL";
- else if (ttype == TT_WORD)
- tempstr = sval;
- else if (ttype == TT_NUMBER)
- tempstr = "n=" + nval;
- else if (ttype == TT_NONE)
- tempstr = "NOTHING";
- else // must be an ordinary char.
- tempstr = "\'" + (char) ttype + "\'";
-
- return "Token[" + tempstr + "], line " + lineno();
- }
-
- /**
- * This method sets the whitespace attribute for all characters in the
- * specified range, range terminators included.
- *
- * @param low The low end of the range of values to set the whitespace
- * attribute for
- * @param hi The high end of the range of values to set the whitespace
- * attribute for
- */
- public void whitespaceChars(int low, int hi)
- {
- if (low < 0)
- low = 0;
- if (hi > 255)
- hi = 255;
- for (int i = low; i <= hi; i++)
- {
- resetChar(i);
- whitespace[i] = true;
- }
- }
-
- /**
- * This method sets the alphabetic attribute for all characters in the
- * specified range, range terminators included.
- *
- * @param low The low end of the range of values to set the alphabetic
- * attribute for
- * @param hi The high end of the range of values to set the alphabetic
- * attribute for
- */
- public void wordChars(int low, int hi)
- {
- if (low < 0)
- low = 0;
- if (hi > 255)
- hi = 255;
- for (int i = low; i <= hi; i++)
- alphabetic[i] = true;
- }
-}
diff --git a/libjava/java/io/StringBufferInputStream.java b/libjava/java/io/StringBufferInputStream.java
deleted file mode 100644
index 090881985b8..00000000000
--- a/libjava/java/io/StringBufferInputStream.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/* StringBufferInputStream.java -- Read an String as a stream
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct. Deprecated in JDK 1.1.
- */
-
-/**
- * This class permits a ttype
is TT_EOF, then 'x' is "EOF"ttype
is TT_EOL, then 'x' is "EOL"ttype
is TT_WORD, then 'x' is sval
ttype
is TT_NUMBER, then 'x' is "n=strnval" where
- * 'strnval' is String.valueOf(nval)
.ttype
is a quote character, then 'x' is
- * sval
ttype
String
to be read as an input stream.
- * The low eight bits of each character in the String
are the
- * bytes that are returned. The high eight bits of each character are
- * discarded.
- * mark()
method is always ignored and the
- * reset()
method always resets in stream to start reading from
- * position 0 in the String. Note that since this method does not override
- * markSupported()
in InputStream
, calling that
- * method will return false
.
- * StringReader
- * class should be used instead.
- *
- * @deprecated
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class StringBufferInputStream extends InputStream
-{
- /** The String which is the input to this stream. */
- protected String buffer;
-
- /** Position of the next byte in buffer to be read. */
- protected int pos = 0;
-
- /** The length of the String buffer. */
- protected int count;
-
- /**
- * Create a new StringBufferInputStream
that will read bytes
- * from the passed in String
. This stream will read from the
- * beginning to the end of the String
.
- *
- * @param s The String
this stream will read from.
- */
- public StringBufferInputStream(String s)
- {
- buffer = s;
- count = s.length();
- }
-
- /**
- * This method returns the number of bytes available to be read from this
- * stream. The value returned will be equal to count - pos
.
- *
- * @return The number of bytes that can be read from this stream before
- * blocking, which is all of them
- */
- public int available()
- {
- return count - pos;
- }
-
- /**
- * This method reads one byte from the stream. The pos
counter
- * is advanced to the next byte to be read. The byte read is returned as
- * an int in the range of 0-255. If the stream position is already at the
- * end of the buffer, no byte is read and a -1 is returned in order to
- * indicate the end of the stream.
- *
- * @return The byte read, or -1 if end of stream
- */
- public int read()
- {
- if (pos >= count)
- return -1; // EOF
-
- return ((int) buffer.charAt(pos++)) & 0xFF;
- }
-
-/**
- * This method reads bytes from the stream and stores them into a caller
- * supplied buffer. It starts storing the data at index offset
- * into the buffer and attempts to read len
bytes. This method
- * can return before reading the number of bytes requested if the end of the
- * stream is encountered first. The actual number of bytes read is
- * returned. If no bytes can be read because the stream is already at
- * the end of stream position, a -1 is returned.
- * pos
variable equal to 0. Note that this differs
- * from the common implementation of the reset()
method.
- */
- public void reset()
- {
- pos = 0;
- }
-
- /**
- * This method attempts to skip the requested number of bytes in the
- * input stream. It does this by advancing the pos
value by the
- * specified number of bytes. It this would exceed the length of the
- * buffer, then only enough bytes are skipped to position the stream at
- * the end of the buffer. The actual number of bytes skipped is returned.
- *
- * @param n The requested number of bytes to skip
- *
- * @return The actual number of bytes skipped.
- */
- public long skip(long n)
- {
- if (n < 0)
- return 0L;
-
- long actualSkip = Math.min(n, count - pos);
- pos += actualSkip;
- return actualSkip;
- }
-}
diff --git a/libjava/java/io/StringReader.java b/libjava/java/io/StringReader.java
deleted file mode 100644
index 7e4e7d84f62..00000000000
--- a/libjava/java/io/StringReader.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/* StringReader.java -- permits a String to be read as a character input stream
- Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct
- */
-
-/**
- * This class permits a String
to be read as a character
- * input stream.
- * reset()
- * method rewinds the read pointer to the beginning of the String
.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- * @date October 19, 1998.
- */
-public class StringReader extends Reader
-{
- /* A String provided by the creator of the stream. */
- private String buf;
-
- /* Position of the next char in buf to be read. */
- private int pos;
-
- /* The currently marked position in the stream. */
- private int markedPos;
-
- /* The index in buf one greater than the last valid character. */
- private int count;
-
- /**
- * Create a new StringReader
that will read chars from the
- * passed in String
. This stream will read from the beginning
- * to the end of the String
.
- *
- * @param buffer The String
this stream will read from.
- */
- public StringReader(String buffer)
- {
- super();
- buf = buffer;
-
- count = buffer.length();
- markedPos = pos = 0;
- }
-
- public void close()
- {
- synchronized (lock)
- {
- buf = null;
- }
- }
-
- public void mark(int readAheadLimit) throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- // readAheadLimit is ignored per Java Class Lib. book, p. 1692.
- markedPos = pos;
- }
- }
-
- public boolean markSupported()
- {
- return true;
- }
-
- public int read() throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- if (pos < count)
- return ((int) buf.charAt(pos++)) & 0xFFFF;
- return -1;
- }
- }
-
- public int read(char[] b, int off, int len) throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- /* Don't need to check pos value, arraycopy will check it. */
- if (off < 0 || len < 0 || off + len > b.length)
- throw new ArrayIndexOutOfBoundsException();
-
- if (pos >= count)
- return -1;
-
- int lastChar = Math.min(count, pos + len);
- buf.getChars(pos, lastChar, b, off);
- int numChars = lastChar - pos;
- pos = lastChar;
- return numChars;
- }
- }
-
- /**
- * This method determines if the stream is ready to be read. This class
- * is always ready to read and so always returns true
, unless
- * close() has previously been called in which case an IOException is
- * thrown.
- *
- * @return true
to indicate that this object is ready to be read.
- * @exception IOException If the stream is closed.
- */
- public boolean ready() throws IOException
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- return true;
- }
-
- /**
- * Sets the read position in the stream to the previously
- * marked position or to 0 (i.e., the beginning of the stream) if the mark
- * has not already been set.
- */
- public void reset() throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- pos = markedPos;
- }
- }
-
- /**
- * This method attempts to skip the requested number of chars in the
- * input stream. It does this by advancing the pos
value by
- * the specified number of chars. It this would exceed the length of the
- * buffer, then only enough chars are skipped to position the stream at
- * the end of the buffer. The actual number of chars skipped is returned.
- *
- * @param n The requested number of chars to skip
- *
- * @return The actual number of chars skipped.
- */
- public long skip(long n) throws IOException
- {
- synchronized (lock)
- {
- if (buf == null)
- throw new IOException("Stream closed");
-
- // Even though the var numChars is a long, in reality it can never
- // be larger than an int since the result of subtracting 2 positive
- // ints will always fit in an int. Since we have to return a long
- // anyway, numChars might as well just be a long.
- long numChars = Math.min((long) (count - pos), n < 0 ? 0L : n);
- pos += numChars;
- return numChars;
- }
- }
-}
-
diff --git a/libjava/java/io/StringWriter.java b/libjava/java/io/StringWriter.java
deleted file mode 100644
index a1e9aeb6bd2..00000000000
--- a/libjava/java/io/StringWriter.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/* StringWriter.java -- Writes bytes to a StringBuffer
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-// Wow is this a dumb class. CharArrayWriter can do all this and
-// more. I would redirect all calls to one in fact, but the javadocs say
-// use a StringBuffer so I will comply.
-
-/**
- * This class writes chars to an internal StringBuffer
that
- * can then be used to retrieve a String
.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class StringWriter extends Writer
-{
- /**
- * This is the default size of the buffer if the user doesn't specify it.
- * @specnote The JCL Volume 1 says that 16 is the default size.
- */
- private static final int DEFAULT_BUFFER_SIZE = 16;
-
- /**
- * This method closes the stream. The contents of the internal buffer
- * can still be retrieved, but future writes are not guaranteed to work.
- *
- * @exception IOException If an error orrurs.
- */
- public void close () throws IOException
- {
- // JCL says this does nothing. This seems to violate the Writer
- // contract, in that other methods should still throw an
- // IOException after a close. Still, we just follow JCL.
- }
-
- /**
- * This method flushes any buffered characters to the underlying output.
- * It does nothing in this class.
- */
- public void flush ()
- {
- }
-
- /**
- * This method returns the StringBuffer
object that this
- * object is writing to. Note that this is the actual internal buffer, so
- * any operations performed on it will affect this stream object.
- *
- * @return The StringBuffer
object being written to
- */
- public StringBuffer getBuffer ()
- {
- return buffer;
- }
-
- /**
- * This method initializes a new StringWriter
to write to a
- * StringBuffer
initially sized to a default size of 16
- * chars.
- */
- public StringWriter ()
- {
- this (DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a new StringWriter
to write to a
- * StringBuffer
with the specified initial size.
- *
- * @param size The initial size to make the StringBuffer
- */
- public StringWriter (int size)
- {
- super ();
- buffer = new StringBuffer (size);
- lock = buffer;
- }
-
- /**
- * This method returns the contents of the internal StringBuffer
- * as a String
.
- *
- * @return A String
representing the chars written to
- * this stream.
- */
- public String toString ()
- {
- return buffer.toString();
- }
-
- /**
- * This method writes a single character to the output, storing it in
- * the internal buffer.
- *
- * @param oneChar The char
to write, passed as an int.
- */
- public void write (int oneChar)
- {
- buffer.append((char) (oneChar & 0xFFFF));
- }
-
- /**
- * This method writes len
chars from the specified
- * array starting at index offset
in that array to this
- * stream by appending the chars to the end of the internal buffer.
- *
- * @param chars The array of chars to write
- * @param offset The index into the array to start writing from
- * @param len The number of chars to write
- */
- public void write (char[] chars, int offset, int len)
- {
- buffer.append(chars, offset, len);
- }
-
- /**
- * This method writes the characters in the specified String
- * to the stream by appending them to the end of the internal buffer.
- *
- * @param str The String
to write to the stream.
- */
- public void write (String str)
- {
- buffer.append(str);
- }
-
- /**
- * This method writes out len
characters of the specified
- * String
to the stream starting at character position
- * offset
into the stream. This is done by appending the
- * characters to the internal buffer.
- *
- * @param str The String
to write characters from
- * @param offset The character position to start writing from
- * @param len The number of characters to write.
- */
- public void write (String str, int offset, int len)
- {
-// char[] tmpbuf = new char[len];
-// str.getChars(offset, offset+len, tmpbuf, 0);
-// buf.append(tmpbuf, 0, tmpbuf.length);
- // This implementation assumes that String.substring is more
- // efficient than using String.getChars and copying the data
- // twice. For libgcj, this is true. For Classpath, it is not.
- // FIXME.
- buffer.append(str.substring(offset, offset + len));
- }
-
- /**
- * This is the StringBuffer
that we use to store bytes that
- * are written.
- */
- private StringBuffer buffer;
-}
diff --git a/libjava/java/io/SyncFailedException.java b/libjava/java/io/SyncFailedException.java
deleted file mode 100644
index c514c44f23f..00000000000
--- a/libjava/java/io/SyncFailedException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* SyncFailedException.java -- a file sync failed
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * Thrown when a file synchronization fails.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @see FileDescriptor#sync()
- * @since 1.1
- * @status updated to 1.4
- */
-public class SyncFailedException extends IOException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -2353342684412443330L;
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public SyncFailedException(String message)
- {
- super(message);
- }
-} // class SyncFailedException
diff --git a/libjava/java/io/UTFDataFormatException.java b/libjava/java/io/UTFDataFormatException.java
deleted file mode 100644
index 6bb76aebdfe..00000000000
--- a/libjava/java/io/UTFDataFormatException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* UTFDataFormatException.java -- thrown on bad format in UTF data
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * When reading a UTF string from an input stream, this exception is thrown
- * to indicate that the data read is invalid.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- * @see DataInput
- * @see DataInputStream#readUTF(DataInput)
- * @status updated to 1.4
- */
-public class UTFDataFormatException extends IOException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 420743449228280612L;
-
- /**
- * Create a new UTFDataFormatException without a descriptive error message.
- */
- public UTFDataFormatException()
- {
- }
-
- /**
- * Create a new UTFDataFormatException with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public UTFDataFormatException(String message)
- {
- super(message);
- }
-} // class UTFDataFormatException
diff --git a/libjava/java/io/UnsupportedEncodingException.java b/libjava/java/io/UnsupportedEncodingException.java
deleted file mode 100644
index cf0ab64cb89..00000000000
--- a/libjava/java/io/UnsupportedEncodingException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* UnsupportedEncodingException.java -- the requested encoding isn't supported
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when the requested character encoding is
- * not supported.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner (bothner@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class UnsupportedEncodingException extends IOException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -4274276298326136670L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public UnsupportedEncodingException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public UnsupportedEncodingException(String message)
- {
- super(message);
- }
-} // class UnsupportedEncodingException
diff --git a/libjava/java/io/WriteAbortedException.java b/libjava/java/io/WriteAbortedException.java
deleted file mode 100644
index f051dc975c8..00000000000
--- a/libjava/java/io/WriteAbortedException.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/* WriteAbortedException.java -- wraps an exception thrown while writing
- Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown when another ObjectStreamException occurs during
- * a serialization read or write. The stream is reset, and deserialized
- * objects are discarded.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public class WriteAbortedException extends ObjectStreamException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -3326426625597282442L;
-
- /**
- * The cause of this exception. This pre-dates the exception chaining
- * of Throwable; and although you can change this field, you are wiser
- * to leave it alone.
- *
- * @serial the exception cause
- */
- public Exception detail;
-
- /**
- * Create a new WriteAbortedException with a specified message and
- * cause.
- *
- * @param msg the message
- * @param detail the cause
- */
- public WriteAbortedException(String msg, Exception detail)
- {
- super(msg);
- initCause(detail);
- this.detail = detail;
- }
-
- /**
- * This method returns a message indicating what went wrong, in this
- * format:
- * super.getMessage() + (detail == null ? "" : "; " + detail)
.
- *
- * @return the chained message
- */
- public String getMessage()
- {
- if (detail == this || detail == null)
- return super.getMessage();
- return super.getMessage() + "; " + detail;
- }
-
- /**
- * Returns the cause of this exception. Note that this may not be the
- * original cause, thanks to the detail
field being public
- * and non-final (yuck). However, to avoid violating the contract of
- * Throwable.getCause(), this returns null if detail == this
,
- * as no exception can be its own cause.
- *
- * @return the cause
- * @since 1.4
- */
- public Throwable getCause()
- {
- return detail == this ? null : detail;
- }
-} // class WriteAbortedException
diff --git a/libjava/java/io/Writer.java b/libjava/java/io/Writer.java
deleted file mode 100644
index f153e31cfed..00000000000
--- a/libjava/java/io/Writer.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Writer.java -- Base class for character output streams
- Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This abstract class forms the base of the hierarchy of classes that
- * write output as a stream of chars. It provides a common set of methods
- * for writing chars to stream. Subclasses implement and/or extend these
- * methods to write chars in a particular manner or to a particular
- * destination such as a file on disk or network connection.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner (bothner@cygnus.com)
- */
-public abstract class Writer
-{
- /**
- * This is the object used to synchronize criticial code sections for
- * thread safety. Subclasses should use this field instead of using
- * synchronized methods or explicity synchronizations on this
- */
- protected Object lock;
-
- /**
- * This is the default no-argument constructor for this class. This method
- * will set up the class to synchronize criticial sections on itself.
- */
- protected Writer()
- {
- lock = this;
- }
-
- /**
- * This method initializes a Writer
that will synchronize
- * on the specified Object
.
- *
- * @param lock The Object
to use for synchronizing critical
- * sections. Must not be null.
- */
- protected Writer(Object lock)
- {
- if (lock == null)
- throw new NullPointerException();
-
- this.lock = lock;
- }
-
- /**
- * This method forces any data that may have been buffered to be written
- * to the underlying output device. Please note that the host environment
- * might perform its own buffering unbeknowst to Java. In that case, a
- * write made (for example, to a disk drive) might be cached in OS
- * buffers instead of actually being written to disk.
- *
- * @exception IOException If an error occurs
- */
- public abstract void flush() throws IOException;
-
- /**
- * This method closes the stream. Any internal or native resources
- * associated
- * with this stream are freed. Any subsequent attempt to access the stream
- * might throw an exception.
- * write(buf, 0, buf.length)
which
- * is exactly how it is implemented in this class.
- *
- * @param buf The array of char to write
- *
- * @exception IOException If an error occurs
- */
- public void write(char[] buf) throws IOException
- {
- write(buf, 0, buf.length);
- }
-
- /**
- * This method writes len
char from the specified array
- * buf
starting at index offset
into the array.
- * String
to the
- * output.
- *
- * @param str The String
whose chars are to be written.
- *
- * @exception IOException If an error occurs
- */
- public void write(String str) throws IOException
- {
- write(str, 0, str.length());
- }
-
- /**
- * This method writes len
chars from the String
- * starting at position offset
.
- *
- * @param str The String
that is to be written
- * @param offset The character offset into the String
to start
- * writing from
- * @param len The number of chars to write
- *
- * @exception IOException If an error occurs
- */
- public void write(String str, int offset, int len) throws IOException
- {
- // FIXME - for libgcj re-write using native code to not require
- // copied buffer.
- char[] buf = new char[len];
-
- str.getChars(offset, offset + len, buf, 0);
- write(buf, 0, len);
- }
-
-} // class Writer
-
diff --git a/libjava/java/lang/AbstractMethodError.java b/libjava/java/lang/AbstractMethodError.java
deleted file mode 100644
index b9eb622ee8e..00000000000
--- a/libjava/java/lang/AbstractMethodError.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* AbstractMethodError.java -- thrown if an abstract method is invoked
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An AbstractMethodError
is thrown when an application attempts
- * to access an abstract method. Compilers typically detect this error, but
- * it can be thrown at run time if the definition of a class has changed
- * since the application was last compiled. This can also occur when
- * reflecting on methods.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class AbstractMethodError extends IncompatibleClassChangeError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -1654391082989018462L;
-
- /**
- * Create an error without a message.
- */
- public AbstractMethodError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public AbstractMethodError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/ArithmeticException.java b/libjava/java/lang/ArithmeticException.java
deleted file mode 100644
index 5acea43533b..00000000000
--- a/libjava/java/lang/ArithmeticException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* ArithmeticException.java -- exception thrown to indicate conditions
- like divide by zero.
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when a math error has occured, such as trying to divide an
- * integer by zero. For example:
- *
- * int i = 0;
- * int j = 2 / i;
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class ArithmeticException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 2256477558314496007L;
-
- /**
- * Create an exception without a message.
- */
- public ArithmeticException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public ArithmeticException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/ArrayIndexOutOfBoundsException.java b/libjava/java/lang/ArrayIndexOutOfBoundsException.java
deleted file mode 100644
index 371623bdaaa..00000000000
--- a/libjava/java/lang/ArrayIndexOutOfBoundsException.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* ArrayIndexOutOfBoundsException.java -- exception thrown when accessing
- an illegal index.
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when attempting to access a position outside the valid range of
- * an array. For example:
- *
- * int[] i = { 1 };
- * i[1] = 2;
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -5116101128118950844L;
-
- /**
- * Create an exception without a message.
- */
- public ArrayIndexOutOfBoundsException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public ArrayIndexOutOfBoundsException(String s)
- {
- super(s);
- }
-
- /**
- * Create an exception indicating the illegal index.
- *
- * @param index the invalid index
- */
- public ArrayIndexOutOfBoundsException(int index)
- {
- super("Array index out of range: " + index);
- }
-}
diff --git a/libjava/java/lang/ArrayStoreException.java b/libjava/java/lang/ArrayStoreException.java
deleted file mode 100644
index 042e78c5515..00000000000
--- a/libjava/java/lang/ArrayStoreException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* ArrayStoreException.java -- exception thrown to when trying to store an
- object into an array of a different type.
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when trying to store an object of the wrong runtime type in an
- * array. For example:
- *
- * Object[] o = new Integer[1];
- * o[0] = "oops";
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class ArrayStoreException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -4522193890499838241L;
-
- /**
- * Create an exception without a message.
- */
- public ArrayStoreException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public ArrayStoreException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/AssertionError.java b/libjava/java/lang/AssertionError.java
deleted file mode 100644
index 778eb583051..00000000000
--- a/libjava/java/lang/AssertionError.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/* AssertionError.java -- indication of a failed assertion
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An assertion error normally occurs as a result of the assert
- * statement added in JDK 1.4, to indicate that an assertion failed. There
- * are enough constructors to ensure that
- * new AssertionError(expression)
will work for all
- * expressions, regardless of type, as if the error message were given by
- * the string "" + expression
. This extends Error,
- * because you usually do not want to inadvertently trap an assertion failure.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.4
- * @status updated to 1.4
- */
-public class AssertionError extends Error
-{
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = -5013299493970297370L;
-
- /**
- * Construct an AssertionError with no detail message.
- */
- public AssertionError()
- {
- }
-
- /**
- * Construct an AssertionError with the string conversion of the given
- * object as its error message. If the object is a Throwable, it is also
- * set as the cause of this error.
- *
- * @param msg the source of the error message
- * @see Throwable#getCause()
- */
- public AssertionError(Object msg)
- {
- super("" + msg);
- if (msg instanceof Throwable)
- initCause((Throwable) msg);
- }
-
- /**
- * Construct an AssertionError with the string conversion of the given
- * boolean as its error message.
- *
- * @param msg the source of the error message
- */
- public AssertionError(boolean msg)
- {
- super(msg ? "true" : "false");
- }
-
- /**
- * Construct an AssertionError with the string conversion of the given
- * char as its error message.
- *
- * @param msg the source of the error message
- */
- public AssertionError(char msg)
- {
- super(String.valueOf(msg));
- }
-
- /**
- * Construct an AssertionError with the string conversion of the given
- * int as its error message.
- *
- * @param msg the source of the error message
- */
- public AssertionError(int msg)
- {
- super(Integer.toString(msg, 10));
- }
-
- /**
- * Construct an AssertionError with the string conversion of the given
- * long as its error message.
- *
- * @param msg the source of the error message
- */
- public AssertionError(long msg)
- {
- super(Long.toString(msg));
- }
-
- /**
- * Construct an AssertionError with the string conversion of the given
- * float as its error message.
- *
- * @param msg the source of the error message
- */
- public AssertionError(float msg)
- {
- super(Float.toString(msg));
- }
-
- /**
- * Construct an AssertionError with the string conversion of the given
- * double as its error message.
- *
- * @param msg the source of the error message
- */
- public AssertionError(double msg)
- {
- super(Double.toString(msg));
- }
-}
diff --git a/libjava/java/lang/Boolean.java b/libjava/java/lang/Boolean.java
deleted file mode 100644
index b6910280e6b..00000000000
--- a/libjava/java/lang/Boolean.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/* Boolean.java -- object wrapper for boolean
- Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-import java.io.Serializable;
-
-/**
- * Instances of class Boolean
represent primitive
- * boolean
values.
- *
- * @author Paul Fisher
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public final class Boolean implements Serializable
-{
- /**
- * Compatible with JDK 1.0.2+.
- */
- private static final long serialVersionUID = -3665804199014368530L;
-
- /**
- * This field is a Boolean
object representing the
- * primitive value true
. This instance is returned
- * by the static valueOf()
methods if they return
- * a Boolean
representing true
.
- */
- public static final Boolean TRUE = new Boolean(true);
-
- /**
- * This field is a Boolean
object representing the
- * primitive value false
. This instance is returned
- * by the static valueOf()
methods if they return
- * a Boolean
representing false
.
- */
- public static final Boolean FALSE = new Boolean(false);
-
- /**
- * The primitive type boolean
is represented by this
- * Class
object.
- *
- * @since 1.1
- */
- public static final Class TYPE = VMClassLoader.getPrimitiveClass('Z');
-
- /**
- * The immutable value of this Boolean.
- * @serial the wrapped value
- */
- private final boolean value;
-
- /**
- * Create a Boolean
object representing the value of the
- * argument value
. In general the use of the static
- * method valueof(boolean)
is more efficient since it will
- * not create a new object.
- *
- * @param value the primitive value of this Boolean
- * @see #valueOf(boolean)
- */
- public Boolean(boolean value)
- {
- this.value = value;
- }
-
- /**
- * Creates a Boolean
object representing the primitive
- * true
if and only if s
matches
- * the string "true" ignoring case, otherwise the object will represent
- * the primitive false
. In general the use of the static
- * method valueof(String)
is more efficient since it will
- * not create a new object.
- *
- * @param s the String
representation of true
- * or false
- */
- public Boolean(String s)
- {
- value = "true".equalsIgnoreCase(s);
- }
-
- /**
- * Return the primitive boolean
value of this
- * Boolean
object.
- *
- * @return true or false, depending on the value of this Boolean
- */
- public boolean booleanValue()
- {
- return value;
- }
-
- /**
- * Returns the Boolean TRUE
if the given boolean is
- * true
, otherwise it will return the Boolean
- * FALSE
.
- *
- * @param b the boolean to wrap
- * @return the wrapper object
- * @see #TRUE
- * @see #FALSE
- * @since 1.4
- */
- public static Boolean valueOf(boolean b)
- {
- return b ? TRUE : FALSE;
- }
-
- /**
- * Returns the Boolean TRUE
if and only if the given
- * String is equal, ignoring case, to the the String "true", otherwise
- * it will return the Boolean FALSE
.
- *
- * @param s the string to convert
- * @return a wrapped boolean from the string
- */
- public static Boolean valueOf(String s)
- {
- return "true".equalsIgnoreCase(s) ? TRUE : FALSE;
- }
-
- /**
- * Returns "true" if the value of the give boolean is true
and
- * returns "false" if the value of the given boolean is false
.
- *
- * @param b the boolean to convert
- * @return the string representation of the boolean
- * @since 1.4
- */
- public static String toString(boolean b)
- {
- return b ? "true" : "false";
- }
-
- /**
- * Returns "true" if the value of this object is true
and
- * returns "false" if the value of this object is false
.
- *
- * @return the string representation of this
- */
- public String toString()
- {
- return value ? "true" : "false";
- }
-
- /**
- * Returns the integer 1231
if this object represents
- * the primitive true
and the integer 1237
- * otherwise.
- *
- * @return the hash code
- */
- public int hashCode()
- {
- return value ? 1231 : 1237;
- }
-
- /**
- * If the obj
is an instance of Boolean
and
- * has the same primitive value as this object then true
- * is returned. In all other cases, including if the obj
- * is null
, false
is returned.
- *
- * @param obj possibly an instance of any Class
- * @return true if obj
equals this
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Boolean && value == ((Boolean) obj).value;
- }
-
- /**
- * If the value of the system property name
matches
- * "true" ignoring case then the function returns true
.
- *
- * @param name the property name to look up
- * @return true if the property resulted in "true"
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- */
- public static boolean getBoolean(String name)
- {
- if (name == null || "".equals(name))
- return false;
- return "true".equalsIgnoreCase(System.getProperty(name));
- }
-}
diff --git a/libjava/java/lang/Byte.java b/libjava/java/lang/Byte.java
deleted file mode 100644
index 338e2167aa1..00000000000
--- a/libjava/java/lang/Byte.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/* Byte.java -- object wrapper for byte
- Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Instances of class Byte
represent primitive byte
- * values.
- *
- * Additionally, this class provides various helper functions and variables
- * useful to bytes.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Per Bothner
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public final class Byte extends Number implements Comparable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -7183698231559129828L;
-
- /**
- * The minimum value a byte
can represent is -128 (or
- * -27).
- */
- public static final byte MIN_VALUE = -128;
-
- /**
- * The maximum value a byte
can represent is 127 (or
- * 27 - 1).
- */
- public static final byte MAX_VALUE = 127;
-
- /**
- * The primitive type byte
is represented by this
- * Class
object.
- */
- public static final Class TYPE = VMClassLoader.getPrimitiveClass('B');
-
- /**
- * The immutable value of this Byte.
- *
- * @serial the wrapped byte
- */
- private final byte value;
-
- /**
- * Create a Byte
object representing the value of the
- * byte
argument.
- *
- * @param value the value to use
- */
- public Byte(byte value)
- {
- this.value = value;
- }
-
- /**
- * Create a Byte
object representing the value specified
- * by the String
argument
- *
- * @param s the string to convert
- * @throws NumberFormatException if the String does not contain a byte
- * @see #valueOf(String)
- */
- public Byte(String s)
- {
- value = parseByte(s, 10);
- }
-
- /**
- * Converts the byte
to a String
and assumes
- * a radix of 10.
- *
- * @param b the byte
to convert to String
- * @return the String
representation of the argument
- */
- public static String toString(byte b)
- {
- return String.valueOf(b);
- }
-
- /**
- * Converts the specified String
into a byte
.
- * This function assumes a radix of 10.
- *
- * @param s the String
to convert
- * @return the byte
value of s
- * @throws NumberFormatException if s
cannot be parsed as a
- * byte
- * @see #parseByte(String)
- */
- public static byte parseByte(String s)
- {
- return parseByte(s, 10);
- }
-
- /**
- * Converts the specified String
into an int
- * using the specified radix (base). The string must not be null
- * or empty. It may begin with an optional '-', which will negate the answer,
- * provided that there are also valid digits. Each digit is parsed as if by
- * Character.digit(d, radix)
, and must be in the range
- * 0
to radix - 1
. Finally, the result must be
- * within MIN_VALUE
to MAX_VALUE
, inclusive.
- * Unlike Double.parseDouble, you may not have a leading '+'.
- *
- * @param s the String
to convert
- * @param radix the radix (base) to use in the conversion
- * @return the String
argument converted to byte
- * @throws NumberFormatException if s
cannot be parsed as a
- * byte
- */
- public static byte parseByte(String s, int radix)
- {
- int i = Integer.parseInt(s, radix, false);
- if ((byte) i != i)
- throw new NumberFormatException();
- return (byte) i;
- }
-
- /**
- * Creates a new Byte
object using the String
- * and specified radix (base).
- *
- * @param s the String
to convert
- * @param radix the radix (base) to convert with
- * @return the new Byte
- * @throws NumberFormatException if s
cannot be parsed as a
- * byte
- * @see #parseByte(String, int)
- */
- public static Byte valueOf(String s, int radix)
- {
- return new Byte(parseByte(s, radix));
- }
-
- /**
- * Creates a new Byte
object using the String
,
- * assuming a radix of 10.
- *
- * @param s the String
to convert
- * @return the new Byte
- * @throws NumberFormatException if s
cannot be parsed as a
- * byte
- * @see #Byte(String)
- * @see #parseByte(String)
- */
- public static Byte valueOf(String s)
- {
- return new Byte(parseByte(s, 10));
- }
-
- /**
- * Convert the specified String
into a Byte
.
- * The String
may represent decimal, hexadecimal, or
- * octal numbers.
- *
- *
- *
- * DecodableString:
- * ( [
- * Finally, the value must be in the range -
] DecimalNumber )
- * | ( [ -
] ( 0x
| 0X
- * | #
) { HexDigit }+ )
- * | ( [ -
] 0
{ OctalDigit } )
- * DecimalNumber:
- * DecimalDigit except '0' { DecimalDigit }
- * DecimalDigit:
- * Character.digit(d, 10) has value 0 to 9
- * OctalDigit:
- * Character.digit(d, 8) has value 0 to 7
- * DecimalDigit:
- * Character.digit(d, 16) has value 0 to 15
- * MIN_VALUE
to
- * MAX_VALUE
, or an exception is thrown.
- *
- * @param s the String
to interpret
- * @return the value of the String as a Byte
- * @throws NumberFormatException if s
cannot be parsed as a
- * byte
- * @throws NullPointerException if s
is null
- * @see Integer#decode(String)
- */
- public static Byte decode(String s)
- {
- int i = Integer.parseInt(s, 10, true);
- if ((byte) i != i)
- throw new NumberFormatException();
- return new Byte((byte) i);
- }
-
- /**
- * Return the value of this Byte
.
- *
- * @return the byte value
- */
- public byte byteValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Byte
as a short
.
- *
- * @return the short value
- */
- public short shortValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Byte
as an int
.
- *
- * @return the int value
- */
- public int intValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Byte
as a long
.
- *
- * @return the long value
- */
- public long longValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Byte
as a float
.
- *
- * @return the float value
- */
- public float floatValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Byte
as a double
.
- *
- * @return the double value
- */
- public double doubleValue()
- {
- return value;
- }
-
- /**
- * Converts the Byte
value to a String
and
- * assumes a radix of 10.
- *
- * @return the String
representation of this Byte
- * @see Integer#toString()
- */
- public String toString()
- {
- return String.valueOf(value);
- }
-
- /**
- * Return a hashcode representing this Object. Byte
's hash
- * code is simply its value.
- *
- * @return this Object's hash code
- */
- public int hashCode()
- {
- return value;
- }
-
- /**
- * Returns true
if obj
is an instance of
- * Byte
and represents the same byte value.
- *
- * @param obj the object to compare
- * @return whether these Objects are semantically equal
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Byte && value == ((Byte) obj).value;
- }
-
- /**
- * Compare two Bytes numerically by comparing their byte
values.
- * The result is positive if the first is greater, negative if the second
- * is greater, and 0 if the two are equal.
- *
- * @param b the Byte to compare
- * @return the comparison
- * @since 1.2
- */
- public int compareTo(Byte b)
- {
- return value - b.value;
- }
-
- /**
- * Behaves like compareTo(Byte)
unless the Object
- * is not a Byte
.
- *
- * @param o the object to compare
- * @return the comparison
- * @throws ClassCastException if the argument is not a Byte
- * @see #compareTo(Byte)
- * @see Comparable
- * @since 1.2
- */
- public int compareTo(Object o)
- {
- return compareTo((Byte) o);
- }
-}
diff --git a/libjava/java/lang/CharSequence.java b/libjava/java/lang/CharSequence.java
deleted file mode 100644
index 5c014e173a8..00000000000
--- a/libjava/java/lang/CharSequence.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* CharSequence.java -- Anything that has an indexed sequence of chars
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * General functions on a sequence of chars. This interface is implemented
- * by String
, StringBuffer
and
- * CharBuffer
to give a uniform way to get chars at a certain
- * index, the number of characters in the sequence and a subrange of the
- * chars. Indexes start at 0 and the last index is length()-1
.
- *
- * CharSequence
as keys in collections since two sequences
- * with the same chars at the same indexes with the same length might not
- * have the same hash code, be equal or be comparable since the are
- * represented by different classes.
- *
- * @author Mark Wielaard (mark@klomp.org)
- * @since 1.4
- * @status updated to 1.4
- */
-public interface CharSequence
-{
- /**
- * Returns the character at the given index.
- *
- * @param i the index to retrieve from
- * @return the character at that location
- * @throws IndexOutOfBoundsException if i < 0 || i >= length() - 1
- */
- char charAt(int i);
-
- /**
- * Returns the length of the sequence. This is the number of 16-bit
- * characters in the sequence, which may differ from the length of the
- * underlying encoding.
- *
- * @return the sequence length
- */
- int length();
-
- /**
- * Returns a new CharSequence
of the indicated range.
- *
- * @param begin the start index (inclusive)
- * @param end the end index (exclusive)
- * @return a subsequence of this
- * @throws IndexOutOfBoundsException if begin > end || begin < 0 ||
- * end > length()
- */
- CharSequence subSequence(int begin, int end);
-
- /**
- * Returns the complete CharSequence
as a String
.
- * Classes that implement this interface should return a String
- * which contains only the characters in the sequence in the correct order.
- *
- * @return the character sequence as a String
- */
- String toString();
-}
diff --git a/libjava/java/lang/ClassCastException.java b/libjava/java/lang/ClassCastException.java
deleted file mode 100644
index c490f42aaa8..00000000000
--- a/libjava/java/lang/ClassCastException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ClassCastException.java -- exception thrown on bad cast
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when an attempt is made to cast an object which is not of the
- * appropriate runtime type. For example:
- *
- * Object o = new Vector();
- * String s = (String) o;
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class ClassCastException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -9223365651070458532L;
-
- /**
- * Create an exception without a message.
- */
- public ClassCastException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public ClassCastException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/ClassCircularityError.java b/libjava/java/lang/ClassCircularityError.java
deleted file mode 100644
index ecdfb7aaf3a..00000000000
--- a/libjava/java/lang/ClassCircularityError.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ClassCircularityError.java -- thrown when linking circular classes
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A ClassCircularityError
is thrown when a circular dependency
- * has been detected while initializing a class. This signals binary
- * incompatible versions of class files, as the compiler normally catches this.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class ClassCircularityError extends LinkageError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 1054362542914539689L;
-
- /**
- * Create an error without a message.
- */
- public ClassCircularityError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public ClassCircularityError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/ClassFormatError.java b/libjava/java/lang/ClassFormatError.java
deleted file mode 100644
index 7f90f5cd83e..00000000000
--- a/libjava/java/lang/ClassFormatError.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ClassFormatError.java -- thrown if a class file is invalid
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A ClassFormatError
is thrown when a Java Virtual Machine
- * unable to read a class file because the file is corrupted or cannot be
- * interpreted as a class file.
- *
- * @author Brian Jones
- * @status updated to 1.4
- */
-public class ClassFormatError extends LinkageError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -8420114879011949195L;
-
- /**
- * Create an error without a message.
- */
- public ClassFormatError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public ClassFormatError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/ClassNotFoundException.java b/libjava/java/lang/ClassNotFoundException.java
deleted file mode 100644
index 6b6ae949dd2..00000000000
--- a/libjava/java/lang/ClassNotFoundException.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/* ClassNotFoundException.java -- thrown when class definition cannot be found
- Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when a class is requested by reflection, but the class definition
- * cannot be found. This exception is often chained from another Throwable.
- *
- * @author Brian Jones
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Class#forName(String)
- * @see ClassLoader#findSystemClass(String)
- * @see ClassLoader#loadClass(String, boolean)
- * @status updated to 1.4
- */
-public class ClassNotFoundException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 9176873029745254542L;
-
- /**
- * The cause of this exception (duplicates the one stored in Throwable).
- *
- * @serial the exception cause
- * @since 1.2
- */
- private final Throwable ex;
-
- /**
- * Create an exception without a message. Note that this initializes the
- * cause to null.
- */
- public ClassNotFoundException()
- {
- this(null, null);
- }
-
- /**
- * Create an exception with a message. Note that this initializes the
- * cause to null.
- *
- * @param s the message
- */
- public ClassNotFoundException(String s)
- {
- this(s, null);
- }
-
- /**
- * Create an exception with a message and chain it to the exception
- * which occurred while loading the class.
- *
- * @param s the message
- * @param ex the chained exception
- * @since 1.2
- */
- public ClassNotFoundException(String s, Throwable ex)
- {
- super(s, ex);
- this.ex = ex;
- }
-
- /**
- * Returns the exception which occurred while loading the class,
- * otherwise returns null. This is a legacy method; the preferred choice
- * now is {@link Throwable#getCause()}.
- *
- * @return the cause of this exception
- * @since 1.2
- */
- public Throwable getException()
- {
- return ex;
- }
-
- /**
- * Returns the exception which occurred while loading the class,
- * otherwise returns null.
- *
- * @return the cause of this exception
- * @since 1.4
- */
- public Throwable getCause()
- {
- return ex;
- }
-}
diff --git a/libjava/java/lang/CloneNotSupportedException.java b/libjava/java/lang/CloneNotSupportedException.java
deleted file mode 100644
index 9d10cf389f9..00000000000
--- a/libjava/java/lang/CloneNotSupportedException.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* CloneNotSupportedException.java -- thrown when an object cannot be cloned
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown to indicate an object should not or could not be cloned. This
- * includes the case when {@link Object#clone()} is called on an object
- * which does not implement the {@link Cloneable} interface. For example:
- *
- * void m() throws CloneNotSupportedException
- * {
- * clone();
- * }
- *
- *
- * clone()
on an array will never produce
- * this exception, as the VM will always succeed in copying the array, or
- * cause an OutOfMemoryError first. For example:
- *
- * void m(int[] array)
- * {
- * int[] copy = (int[]) array.clone();
- * }
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Cloneable
- * @see Object#clone()
- * @status updated to 1.4
- */
-public class CloneNotSupportedException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 5195511250079656443L;
-
- /**
- * Create an exception without a message.
- */
- public CloneNotSupportedException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the error message
- */
- public CloneNotSupportedException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/Cloneable.java b/libjava/java/lang/Cloneable.java
deleted file mode 100644
index 10f20ce3b6e..00000000000
--- a/libjava/java/lang/Cloneable.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Cloneable.java -- Interface for marking objects cloneable by Object.clone()
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * This interface should be implemented by classes wishing to
- * support of override Object.clone()
. The default
- * behaviour of clone()
performs a shallow copy, but
- * subclasses often change this to perform a deep copy. Therefore,
- * it is a good idea to document how deep your clone will go.
- * If clone()
is called on an object which does not
- * implement this interface, a CloneNotSupportedException
- * will be thrown.
- *
- * equals
,
- * hashCode
, and clone
, sometimes
- * increasing the accessibility of clone to be public. The typical
- * implementation of clone
invokes super.clone()
- * rather than a constructor, but this is not a requirement.
- *
- * clone
method to throw a
- * CloneNotSupportedException
.
- *
- * clone
method that will never fail with a
- * CloneNotSupportedException
.
- *
- * @author Paul Fisher
- * @author Eric Blake (ebb9@email.byu.edu)
- * @author Warren Levy (warrenl@cygnus.com)
- * @see Object#clone()
- * @see CloneNotSupportedException
- * @since 1.0
- * @status updated to 1.4
- */
-public interface Cloneable
-{
- // Tagging interface only.
-}
diff --git a/libjava/java/lang/Comparable.java b/libjava/java/lang/Comparable.java
deleted file mode 100644
index a8afe1ec33e..00000000000
--- a/libjava/java/lang/Comparable.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Comparable.java -- Interface for comparaing objects to obtain an ordering
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Interface for objects that can be ordering among other objects. The
- * ordering can be total, such that two objects only compare equal
- * if they are also equal by the equals method, or partial such
- * that this is not necessarily true. For example, a case-sensitive
- * dictionary order comparison of Strings is total, but if it is
- * case-insensitive it is partial, because "abc" and "ABC" compare as
- * equal even though "abc".equals("ABC") returns false. However, if you use
- * a partial ordering, it is a good idea to document your class as
- * "inconsistent with equals", because the behavior of your class in a
- * SortedMap will be different than in a HashMap.
- *
- * e1.compareTo(null)
- * should throw an Exception; as should comparison between incompatible
- * classes.
- *
- * @author Geoff Berry
- * @author Warren Levy (warrenl@cygnus.com)
- * @see java.util.Comparator
- * @see java.util.Collections#sort(java.util.List)
- * @see java.util.Arrays#sort(Object[])
- * @see java.util.SortedSet
- * @see java.util.SortedMap
- * @see java.util.TreeSet
- * @see java.util.TreeMap
- * @since 1.2
- * @status updated to 1.4
- */
-public interface Comparable
-{
- /**
- * Compares this object with another, and returns a numerical result based
- * on the comparison. If the result is negative, this object sorts less
- * than the other; if 0, the two are equal, and if positive, this object
- * sorts greater than the other. To translate this into boolean, simply
- * perform o1.compareTo(o2) <op> 0
, where op
- * is one of <, <=, =, !=, >, or >=.
- *
- * sgn(x.compareTo(y)) == -sgn(y.compareTo(x))
(where sgn() is
- * defined as -1, 0, or 1 based on the sign). This includes throwing an
- * exception in either direction if the two are not comparable; hence,
- * compareTo(null)
should always throw an Exception.
- *
- * x.compareTo(y) > 0 && y.compareTo(z) > 0
implies
- * x.compareTo(z) > 0
; and x.compareTo(y) == 0
- * implies x.compareTo(z) == y.compareTo(z)
.
- *
- * @param o the object to be compared
- * @return an integer describing the comparison
- * @throws NullPointerException if o is null
- * @throws ClassCastException if o cannot be compared
- */
- int compareTo(Object o);
-}
diff --git a/libjava/java/lang/Compiler.java b/libjava/java/lang/Compiler.java
deleted file mode 100644
index 56fb951bbd9..00000000000
--- a/libjava/java/lang/Compiler.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Compiler.java -- placeholder for Java-to-native runtime compilers
- Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * The Compiler
class is a placeholder for a JIT compiler
- * implementation, and does nothing unless there is such a compiler.
- *
- * java.compiler
may contain the name
- * of a library to load with System.loadLibrary
when the
- * virtual machine first starts. If so, and loading the library succeeds,
- * then a function by the name of java_lang_Compiler_start()
- * in that library is called.
- *
- * oneClass
.
- *
- * @param oneClass the class to compile
- * @return false
if no compiler is available or
- * compilation failed, true
if compilation succeeded
- * @throws NullPointerException if oneClass is null
- */
- public static boolean compileClass(Class oneClass)
- {
- return VMCompiler.compileClass(oneClass);
- }
-
- /**
- * Compile the classes whose name matches classNames
.
- *
- * @param classNames the name of classes to compile
- * @return false
if no compiler is available or
- * compilation failed, true
if compilation succeeded
- * @throws NullPointerException if classNames is null
- */
- public static boolean compileClasses(String classNames)
- {
- return VMCompiler.compileClasses(classNames);
- }
-
- /**
- * This method examines the argument and performs an operation
- * according to the compilers documentation. No specific operation
- * is required.
- *
- * @param arg a compiler-specific argument
- * @return a compiler-specific value, including null
- * @throws NullPointerException if the compiler doesn't like a null arg
- */
- public static Object command(Object arg)
- {
- return VMCompiler.command(arg);
- }
-
- /**
- * Calling Compiler.enable()
will cause the compiler
- * to resume operation if it was previously disabled; provided that a
- * compiler even exists.
- */
- public static void enable()
- {
- VMCompiler.enable();
- }
-
- /**
- * Calling Compiler.disable()
will cause the compiler
- * to be suspended; provided that a compiler even exists.
- */
- public static void disable()
- {
- VMCompiler.disable();
- }
-}
diff --git a/libjava/java/lang/Error.java b/libjava/java/lang/Error.java
deleted file mode 100644
index f66c7548b33..00000000000
--- a/libjava/java/lang/Error.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Error.java -- Indication of fatal abnormal conditions
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Applications should not try to catch errors since they indicate
- * abnormal conditions. An abnormal condition is something which should not
- * occur, or which should not be recovered from. This latter category
- * includes ThreadDeath
and AssertionError
.
- *
- * Error
in
- * its throws
clause which might be thrown but not caught while
- * executing the method.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public class Error extends Throwable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 4980196508277280342L;
-
- /**
- * Create an error without a message. The cause remains uninitialized.
- *
- * @see #initCause(Throwable)
- */
- public Error()
- {
- }
-
- /**
- * Create an error with a message. The cause remains uninitialized.
- *
- * @param s the message string
- * @see #initCause(Throwable)
- */
- public Error(String s)
- {
- super(s);
- }
-
- /**
- * Create an error with a message and a cause.
- *
- * @param s the message string
- * @param cause the cause of this error
- * @since 1.4
- */
- public Error(String s, Throwable cause)
- {
- super(s, cause);
- }
-
- /**
- * Create an error with a given cause, and a message of
- * cause == null ? null : cause.toString()
.
- *
- * @param cause the cause of this error
- * @since 1.4
- */
- public Error(Throwable cause)
- {
- super(cause);
- }
-}
diff --git a/libjava/java/lang/Exception.java b/libjava/java/lang/Exception.java
deleted file mode 100644
index 42f7c640dd3..00000000000
--- a/libjava/java/lang/Exception.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Exception.java -- generic exception thrown to indicate an exceptional
- condition has occurred.
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * The root class of all exceptions worth catching in a program. This
- * includes the special category of RuntimeException
, which
- * does not need to be declared in a throws clause. Exceptions can be used
- * to represent almost any exceptional behavior, such as programming errors,
- * mouse movements, keyboard clicking, etc.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @status updated to 1.4
- */
-public class Exception extends Throwable
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -3387516993124229948L;
-
- /**
- * Create an exception without a message. The cause remains uninitialized.
- *
- * @see #initCause(Throwable)
- */
- public Exception()
- {
- }
-
- /**
- * Create an exception with a message. The cause remains uninitialized.
- *
- * @param s the message
- * @see #initCause(Throwable)
- */
- public Exception(String s)
- {
- super(s);
- }
-
- /**
- * Create an exception with a message and a cause.
- *
- * @param s the message string
- * @param cause the cause of this error
- * @since 1.4
- */
- public Exception(String s, Throwable cause)
- {
- super(s, cause);
- }
-
- /**
- * Create an exception with a given cause, and a message of
- * cause == null ? null : cause.toString()
.
- *
- * @param cause the cause of this exception
- * @since 1.4
- */
- public Exception(Throwable cause)
- {
- super(cause);
- }
-}
diff --git a/libjava/java/lang/ExceptionInInitializerError.java b/libjava/java/lang/ExceptionInInitializerError.java
deleted file mode 100644
index 1e580958054..00000000000
--- a/libjava/java/lang/ExceptionInInitializerError.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* ExceptionInInitializerError.java -- thrown when class initialization fails
- with an uncaught exception
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An ExceptionInInitializerError
is thrown when an uncaught
- * exception has occurred in a static initializer or the initializer for a
- * static variable. In general, this wraps only RuntimeExceptions, since the
- * compiler does not allow a checked exception to be uncaught in an
- * initializer. This exception only occurs during reflection, when a class
- * is initialized as part of another action.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public class ExceptionInInitializerError extends LinkageError
-{
- /**
- * Compatible with JDK 1.1+.
- */
- static final long serialVersionUID = 1521711792217232256L;
-
- /**
- * The cause of this exception (duplicates the one stored in Throwable).
- *
- * @serial the exception cause
- */
- private final Throwable exception;
-
- /**
- * Create an error without a message. The cause is initialized as null.
- */
- public ExceptionInInitializerError()
- {
- this((String) null);
- }
-
- /**
- * Create an error with a message. The cause is initialized as null.
- *
- * @param s the message
- */
- public ExceptionInInitializerError(String s)
- {
- super(s);
- exception = null;
- }
-
- /**
- * Creates an error an saves a reference to the Throwable
- * object. The message string is null.
- *
- * @param t the exception thrown
- */
- public ExceptionInInitializerError(Throwable t)
- {
- super(null);
- initCause(t);
- exception = t;
- }
-
- /**
- * Return the exception that caused this error to be created. This is a
- * legacy method; the preferred choice now is {@link Throwable#getCause()}.
- *
- * @return the cause, or null if unknown
- */
- public Throwable getException()
- {
- return exception;
- }
-
- /**
- * Return the exception that cause this error to be created.
- *
- * @return the cause, or null if unknown
- * @since 1.4
- */
- public Throwable getCause()
- {
- return exception;
- }
-}
diff --git a/libjava/java/lang/IllegalAccessError.java b/libjava/java/lang/IllegalAccessError.java
deleted file mode 100644
index e4821606a41..00000000000
--- a/libjava/java/lang/IllegalAccessError.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* IllegalAccessError.java -- thrown when linking to an inaccessible member
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An IllegalAccessError
is thrown when an attempt is made to
- * call a method, or access or modify a field that the application does not
- * have access to. Because this error is usually caught by a compiler,
- * the error only occurs at runtime when the definition of a class has
- * changed in a way that is incompatible with the previously compiled
- * application.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class IllegalAccessError extends IncompatibleClassChangeError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -8988904074992417891L;
-
- /**
- * Create an error without a message.
- */
- public IllegalAccessError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public IllegalAccessError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/IllegalAccessException.java b/libjava/java/lang/IllegalAccessException.java
deleted file mode 100644
index 3fe83b5c716..00000000000
--- a/libjava/java/lang/IllegalAccessException.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* IllegalAccessException.java -- thrown on attempt to reflect on
- inaccessible data
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown whenever a reflective method tries to do something that the
- * compiler would not allow. For example, using reflection to set a private
- * variable that belongs to a class in another package is bad.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @see Class#newInstance()
- * @see Field#set(Object, Object)
- * @see Field#setBoolean(Object, boolean)
- * @see Field#setByte(Object, byte)
- * @see Field#setShort(Object, short)
- * @see Field#setChar(Object, char)
- * @see Field#setInt(Object, int)
- * @see Field#setLong(Object, long)
- * @see Field#setFloat(Object, float)
- * @see Field#setDouble(Object, double)
- * @see Field#get(Object)
- * @see Field#getBoolean(Object)
- * @see Field#getByte(Object)
- * @see Field#getShort(Object)
- * @see Field#getChar(Object)
- * @see Field#getInt(Object)
- * @see Field#getLong(Object)
- * @see Field#getFloat(Object)
- * @see Field#getDouble(Object)
- * @see Method#invoke(Object, Object[])
- * @see Constructor#newInstance(Object[])
- * @status updated to 1.4
- */
-public class IllegalAccessException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 6616958222490762034L;
-
- /**
- * Create an exception without a message.
- */
- public IllegalAccessException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public IllegalAccessException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/IllegalArgumentException.java b/libjava/java/lang/IllegalArgumentException.java
deleted file mode 100644
index 7b822b91665..00000000000
--- a/libjava/java/lang/IllegalArgumentException.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* IllegalArgumentException.java -- thrown when a method is passed an
- illegal or inappropriate argument
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.lang;
-
-/**
- * Thrown when a method is passed an illegal or inappropriate argument. For
- * example:
- *
- * wait(-1);
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class IllegalArgumentException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -5365630128856068164L;
-
- /**
- * Create an exception without a message.
- */
- public IllegalArgumentException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public IllegalArgumentException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/IllegalMonitorStateException.java b/libjava/java/lang/IllegalMonitorStateException.java
deleted file mode 100644
index 13b3f952bb5..00000000000
--- a/libjava/java/lang/IllegalMonitorStateException.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/* IllegalMonitorStateException.java -- thrown when trying to wait or
- notify a monitor that is not owned
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when a thread attempts to wait or notify on a monitor that it
- * does not own (ie. it has not synchronized on the object). For example:
- *
- * void m() {
- * notify();
- * }
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class IllegalMonitorStateException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 3713306369498869069L;
-
- /**
- * Create an exception without a message.
- */
- public IllegalMonitorStateException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public IllegalMonitorStateException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/IllegalStateException.java b/libjava/java/lang/IllegalStateException.java
deleted file mode 100644
index 5c2bbad37a2..00000000000
--- a/libjava/java/lang/IllegalStateException.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* IllegalStateException.java -- thrown when invoking a method at
- an illegal or inappropriate time
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when a method is invoked at an illegal or inappropriate time. For
- * example:
- *
- * void m(Collecion c)
- * {
- * c.iterator().remove();
- * }
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class IllegalStateException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -1848914673093119416L;
-
- /**
- * Create an exception without a message.
- */
- public IllegalStateException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public IllegalStateException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/IllegalThreadStateException.java b/libjava/java/lang/IllegalThreadStateException.java
deleted file mode 100644
index e14385a3e83..00000000000
--- a/libjava/java/lang/IllegalThreadStateException.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* IllegalThreadStateException.java -- thrown when trying to manipulate a
- Thread when it is not in an appropriate state
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown When trying to manipulate a Thread which is in an inappropriate
- * state. Since the documentation suggests that this can happen with
- * Thread.suspend
or Thread.resume
, but these
- * two methods are deprecated, this exception is likely very rare.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class IllegalThreadStateException extends IllegalArgumentException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -7626246362397460174L;
-
- /**
- * Create an exception without a message.
- */
- public IllegalThreadStateException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public IllegalThreadStateException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/IncompatibleClassChangeError.java b/libjava/java/lang/IncompatibleClassChangeError.java
deleted file mode 100644
index 637410a9009..00000000000
--- a/libjava/java/lang/IncompatibleClassChangeError.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* IncompatibleClassChangeError.java -- thrown for binary incompatible classes
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An IncompatibleClassChangeError
is thrown when the definition
- * of a class used by the currently executing method has changed in an
- * incompatible way.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class IncompatibleClassChangeError extends LinkageError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -4914975503642802119L;
-
- /**
- * Create an error without a message.
- */
- public IncompatibleClassChangeError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public IncompatibleClassChangeError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/IndexOutOfBoundsException.java b/libjava/java/lang/IndexOutOfBoundsException.java
deleted file mode 100644
index c53c67e5574..00000000000
--- a/libjava/java/lang/IndexOutOfBoundsException.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* IndexOutOfBoundsException.java -- thrown for an invalid index
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * This exception can be thrown to indicate an attempt to access an
- * index which is out of bounds on objects like String, Array, or Vector.
- * Usually any negative integer less than or equal to -1 and positive
- * integer greater than or equal to the size of the object is an index
- * which would be out of bounds.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class IndexOutOfBoundsException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 234122996006267687L;
-
- /**
- * Create an exception without a message.
- */
- public IndexOutOfBoundsException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public IndexOutOfBoundsException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/InstantiationError.java b/libjava/java/lang/InstantiationError.java
deleted file mode 100644
index dd12b513a22..00000000000
--- a/libjava/java/lang/InstantiationError.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* InstantiationError.java -- thrown when the linker cannot create an instance
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An InstantiationError
is thrown when an attempt is made to
- * create an instance of an abstract class or an interface. Because this
- * error is usually caught by a compiler, the error only occurs at runtime
- * when the definition of a class has changed in a way that is incompatible
- * with the previously compiled application.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class InstantiationError extends IncompatibleClassChangeError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -4885810657349421204L;
-
- /**
- * Create an error without a message.
- */
- public InstantiationError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public InstantiationError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/InstantiationException.java b/libjava/java/lang/InstantiationException.java
deleted file mode 100644
index 367b14bd278..00000000000
--- a/libjava/java/lang/InstantiationException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* InstantiationException.java -- thrown when reflection cannot create an
- instance
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when an attempt is made to use reflection to build a
- * non-instantiable class (an interface or abstract class).
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @see Class#newInstance()
- * @status updated to 1.4
- */
-public class InstantiationException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -8441929162975509110L;
-
- /**
- * Create an exception without a message.
- */
- public InstantiationException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public InstantiationException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/Integer.java b/libjava/java/lang/Integer.java
deleted file mode 100644
index 61d7ef0f7e2..00000000000
--- a/libjava/java/lang/Integer.java
+++ /dev/null
@@ -1,606 +0,0 @@
-/* Integer.java -- object wrapper for int
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Instances of class Integer
represent primitive
- * int
values.
- *
- * Additionally, this class provides various helper functions and variables
- * related to ints.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Warren Levy
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public final class Integer extends Number implements Comparable
-{
- /**
- * Compatible with JDK 1.0.2+.
- */
- private static final long serialVersionUID = 1360826667806852920L;
-
- /**
- * The minimum value an int
can represent is -2147483648 (or
- * -231).
- */
- public static final int MIN_VALUE = 0x80000000;
-
- /**
- * The maximum value an int
can represent is 2147483647 (or
- * 231 - 1).
- */
- public static final int MAX_VALUE = 0x7fffffff;
-
- /**
- * The primitive type int
is represented by this
- * Class
object.
- * @since 1.1
- */
- public static final Class TYPE = VMClassLoader.getPrimitiveClass('I');
-
- /**
- * The immutable value of this Integer.
- *
- * @serial the wrapped int
- */
- private final int value;
-
- /**
- * Create an Integer
object representing the value of the
- * int
argument.
- *
- * @param value the value to use
- */
- public Integer(int value)
- {
- this.value = value;
- }
-
- /**
- * Create an Integer
object representing the value of the
- * argument after conversion to an int
.
- *
- * @param s the string to convert
- * @throws NumberFormatException if the String does not contain an int
- * @see #valueOf(String)
- */
- public Integer(String s)
- {
- value = parseInt(s, 10, false);
- }
-
- /**
- * Converts the int
to a String
using
- * the specified radix (base). If the radix exceeds
- * Character.MIN_RADIX
or Character.MAX_RADIX
, 10
- * is used instead. If the result is negative, the leading character is
- * '-' ('\\u002D'). The remaining characters come from
- * Character.forDigit(digit, radix)
('0'-'9','a'-'z').
- *
- * @param num the int
to convert to String
- * @param radix the radix (base) to use in the conversion
- * @return the String
representation of the argument
- */
- public static String toString(int num, int radix)
- {
- if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
- radix = 10;
-
- // For negative numbers, print out the absolute value w/ a leading '-'.
- // Use an array large enough for a binary number.
- char[] buffer = new char[33];
- int i = 33;
- boolean isNeg = false;
- if (num < 0)
- {
- isNeg = true;
- num = -num;
-
- // When the value is MIN_VALUE, it overflows when made positive
- if (num < 0)
- {
- buffer[--i] = digits[(int) (-(num + radix) % radix)];
- num = -(num / radix);
- }
- }
-
- do
- {
- buffer[--i] = digits[num % radix];
- num /= radix;
- }
- while (num > 0);
-
- if (isNeg)
- buffer[--i] = '-';
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 33 - i, true);
- }
-
- /**
- * Converts the int
to a String
assuming it is
- * unsigned in base 16.
- *
- * @param i the int
to convert to String
- * @return the String
representation of the argument
- */
- public static String toHexString(int i)
- {
- return toUnsignedString(i, 4);
- }
-
- /**
- * Converts the int
to a String
assuming it is
- * unsigned in base 8.
- *
- * @param i the int
to convert to String
- * @return the String
representation of the argument
- */
- public static String toOctalString(int i)
- {
- return toUnsignedString(i, 3);
- }
-
- /**
- * Converts the int
to a String
assuming it is
- * unsigned in base 2.
- *
- * @param i the int
to convert to String
- * @return the String
representation of the argument
- */
- public static String toBinaryString(int i)
- {
- return toUnsignedString(i, 1);
- }
-
- /**
- * Converts the int
to a String
and assumes
- * a radix of 10.
- *
- * @param i the int
to convert to String
- * @return the String
representation of the argument
- * @see #toString(int, int)
- */
- public static String toString(int i)
- {
- // This is tricky: in libgcj, String.valueOf(int) is a fast native
- // implementation. In Classpath it just calls back to
- // Integer.toString(int, int).
- return String.valueOf(i);
- }
-
- /**
- * Converts the specified String
into an int
- * using the specified radix (base). The string must not be null
- * or empty. It may begin with an optional '-', which will negate the answer,
- * provided that there are also valid digits. Each digit is parsed as if by
- * Character.digit(d, radix)
, and must be in the range
- * 0
to radix - 1
. Finally, the result must be
- * within MIN_VALUE
to MAX_VALUE
, inclusive.
- * Unlike Double.parseDouble, you may not have a leading '+'.
- *
- * @param str the String
to convert
- * @param radix the radix (base) to use in the conversion
- * @return the String
argument converted to int
- * @throws NumberFormatException if s
cannot be parsed as an
- * int
- */
- public static int parseInt(String str, int radix)
- {
- return parseInt(str, radix, false);
- }
-
- /**
- * Converts the specified String
into an int
.
- * This function assumes a radix of 10.
- *
- * @param s the String
to convert
- * @return the int
value of s
- * @throws NumberFormatException if s
cannot be parsed as an
- * int
- * @see #parseInt(String, int)
- */
- public static int parseInt(String s)
- {
- return parseInt(s, 10, false);
- }
-
- /**
- * Creates a new Integer
object using the String
- * and specified radix (base).
- *
- * @param s the String
to convert
- * @param radix the radix (base) to convert with
- * @return the new Integer
- * @throws NumberFormatException if s
cannot be parsed as an
- * int
- * @see #parseInt(String, int)
- */
- public static Integer valueOf(String s, int radix)
- {
- return new Integer(parseInt(s, radix, false));
- }
-
- /**
- * Creates a new Integer
object using the String
,
- * assuming a radix of 10.
- *
- * @param s the String
to convert
- * @return the new Integer
- * @throws NumberFormatException if s
cannot be parsed as an
- * int
- * @see #Integer(String)
- * @see #parseInt(String)
- */
- public static Integer valueOf(String s)
- {
- return new Integer(parseInt(s, 10, false));
- }
-
- /**
- * Return the value of this Integer
as a byte
.
- *
- * @return the byte value
- */
- public byte byteValue()
- {
- return (byte) value;
- }
-
- /**
- * Return the value of this Integer
as a short
.
- *
- * @return the short value
- */
- public short shortValue()
- {
- return (short) value;
- }
-
- /**
- * Return the value of this Integer
.
- * @return the int value
- */
- public int intValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Integer
as a long
.
- *
- * @return the long value
- */
- public long longValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Integer
as a float
.
- *
- * @return the float value
- */
- public float floatValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Integer
as a double
.
- *
- * @return the double value
- */
- public double doubleValue()
- {
- return value;
- }
-
- /**
- * Converts the Integer
value to a String
and
- * assumes a radix of 10.
- *
- * @return the String
representation
- */
- public String toString()
- {
- return String.valueOf(value);
- }
-
- /**
- * Return a hashcode representing this Object. Integer
's hash
- * code is simply its value.
- *
- * @return this Object's hash code
- */
- public int hashCode()
- {
- return value;
- }
-
- /**
- * Returns true
if obj
is an instance of
- * Integer
and represents the same int value.
- *
- * @param obj the object to compare
- * @return whether these Objects are semantically equal
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Integer && value == ((Integer) obj).value;
- }
-
- /**
- * Get the specified system property as an Integer
. The
- * decode()
method will be used to interpret the value of
- * the property.
- *
- * @param nm the name of the system property
- * @return the system property as an Integer
, or null if the
- * property is not found or cannot be decoded
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Integer getInteger(String nm)
- {
- return getInteger(nm, null);
- }
-
- /**
- * Get the specified system property as an Integer
, or use a
- * default int
value if the property is not found or is not
- * decodable. The decode()
method will be used to interpret
- * the value of the property.
- *
- * @param nm the name of the system property
- * @param val the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Integer getInteger(String nm, int val)
- {
- Integer result = getInteger(nm, null);
- return result == null ? new Integer(val) : result;
- }
-
- /**
- * Get the specified system property as an Integer
, or use a
- * default Integer
value if the property is not found or is
- * not decodable. The decode()
method will be used to
- * interpret the value of the property.
- *
- * @param nm the name of the system property
- * @param def the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Integer getInteger(String nm, Integer def)
- {
- if (nm == null || "".equals(nm))
- return def;
- nm = System.getProperty(nm);
- if (nm == null)
- return def;
- try
- {
- return decode(nm);
- }
- catch (NumberFormatException e)
- {
- return def;
- }
- }
-
- /**
- * Convert the specified String
into an Integer
.
- * The String
may represent decimal, hexadecimal, or
- * octal numbers.
- *
- *
- *
- * DecodableString:
- * ( [
- * Finally, the value must be in the range -
] DecimalNumber )
- * | ( [ -
] ( 0x
| 0X
- * | #
) HexDigit { HexDigit } )
- * | ( [ -
] 0
{ OctalDigit } )
- * DecimalNumber:
- * DecimalDigit except '0' { DecimalDigit }
- * DecimalDigit:
- * Character.digit(d, 10) has value 0 to 9
- * OctalDigit:
- * Character.digit(d, 8) has value 0 to 7
- * DecimalDigit:
- * Character.digit(d, 16) has value 0 to 15
- * MIN_VALUE
to
- * MAX_VALUE
, or an exception is thrown.
- *
- * @param str the String
to interpret
- * @return the value of the String as an Integer
- * @throws NumberFormatException if s
cannot be parsed as a
- * int
- * @throws NullPointerException if s
is null
- * @since 1.2
- */
- public static Integer decode(String str)
- {
- return new Integer(parseInt(str, 10, true));
- }
-
- /**
- * Compare two Integers numerically by comparing their int
- * values. The result is positive if the first is greater, negative if the
- * second is greater, and 0 if the two are equal.
- *
- * @param i the Integer to compare
- * @return the comparison
- * @since 1.2
- */
- public int compareTo(Integer i)
- {
- if (value == i.value)
- return 0;
- // Returns just -1 or 1 on inequality; doing math might overflow.
- return value > i.value ? 1 : -1;
- }
-
- /**
- * Behaves like compareTo(Integer)
unless the Object
- * is not an Integer
.
- *
- * @param o the object to compare
- * @return the comparison
- * @throws ClassCastException if the argument is not an Integer
- * @see #compareTo(Integer)
- * @see Comparable
- * @since 1.2
- */
- public int compareTo(Object o)
- {
- return compareTo((Integer) o);
- }
-
- /**
- * Helper for converting unsigned numbers to String.
- *
- * @param num the number
- * @param exp log2(digit) (ie. 1, 3, or 4 for binary, oct, hex)
- */
- // Package visible for use by Long.
- static String toUnsignedString(int num, int exp)
- {
- // Use an array large enough for a binary number.
- int mask = (1 << exp) - 1;
- char[] buffer = new char[32];
- int i = 32;
- do
- {
- buffer[--i] = digits[num & mask];
- num >>>= exp;
- }
- while (num != 0);
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 32 - i, true);
- }
-
- /**
- * Helper for parsing ints, used by Integer, Short, and Byte.
- *
- * @param str the string to parse
- * @param radix the radix to use, must be 10 if decode is true
- * @param decode if called from decode
- * @return the parsed int value
- * @throws NumberFormatException if there is an error
- * @throws NullPointerException if decode is true and str if null
- * @see #parseInt(String, int)
- * @see #decode(String)
- * @see Byte#parseInt(String, int)
- * @see Short#parseInt(String, int)
- */
- static int parseInt(String str, int radix, boolean decode)
- {
- if (! decode && str == null)
- throw new NumberFormatException();
- int index = 0;
- int len = str.length();
- boolean isNeg = false;
- if (len == 0)
- throw new NumberFormatException();
- int ch = str.charAt(index);
- if (ch == '-')
- {
- if (len == 1)
- throw new NumberFormatException();
- isNeg = true;
- ch = str.charAt(++index);
- }
- if (decode)
- {
- if (ch == '0')
- {
- if (++index == len)
- return 0;
- if ((str.charAt(index) & ~('x' ^ 'X')) == 'X')
- {
- radix = 16;
- index++;
- }
- else
- radix = 8;
- }
- else if (ch == '#')
- {
- radix = 16;
- index++;
- }
- }
- if (index == len)
- throw new NumberFormatException();
-
- int max = MAX_VALUE / radix;
- // We can't directly write `max = (MAX_VALUE + 1) / radix'.
- // So instead we fake it.
- if (isNeg && MAX_VALUE % radix == radix - 1)
- ++max;
-
- int val = 0;
- while (index < len)
- {
- if (val < 0 || val > max)
- throw new NumberFormatException();
-
- ch = Character.digit(str.charAt(index++), radix);
- val = val * radix + ch;
- if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE)))
- throw new NumberFormatException();
- }
- return isNeg ? -val : val;
- }
-}
diff --git a/libjava/java/lang/InternalError.java b/libjava/java/lang/InternalError.java
deleted file mode 100644
index 3a95bbeaf57..00000000000
--- a/libjava/java/lang/InternalError.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* InternalError.java -- thrown when the VM encounters an internal error
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An InternalError
is thrown when a mystical error has
- * occurred in the Java Virtual Machine.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class InternalError extends VirtualMachineError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -9062593416125562365L;
-
- /**
- * Create an error without a message.
- */
- public InternalError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public InternalError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/InterruptedException.java b/libjava/java/lang/InterruptedException.java
deleted file mode 100644
index da2173c8b4e..00000000000
--- a/libjava/java/lang/InterruptedException.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/* InterruptedException.java -- thrown when a thread is interrupted
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when a thread interrupts another thread which was previously
- * sleeping, waiting, or paused in some other way. See the
- * interrupt
method of class Thread
.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @see Object#wait()
- * @see Object#wait(long)
- * @see Object#wait(long, int)
- * @see Thread#sleep(long)
- * @see Thread#interrupt()
- * @see Thread#interrupted()
- * @status updated to 1.4
- */
-public class InterruptedException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 6700697376100628473L;
-
- /**
- * Create an exception without a message.
- */
- public InterruptedException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- *
- * @param s the message
- */
- public InterruptedException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/LinkageError.java b/libjava/java/lang/LinkageError.java
deleted file mode 100644
index 028702081ba..00000000000
--- a/libjava/java/lang/LinkageError.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* LinkageError.java -- thrown when classes valid at separate compile times
- cannot be linked to each other
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Subclasses of LinkageError
are thrown to indicate that two
- * classes which were compatible at separate compilation times cannot be
- * linked to one another.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class LinkageError extends Error
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 3579600108157160122L;
-
- /**
- * Create an error without a message.
- */
- public LinkageError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public LinkageError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/Long.java b/libjava/java/lang/Long.java
deleted file mode 100644
index 703eab8a0f3..00000000000
--- a/libjava/java/lang/Long.java
+++ /dev/null
@@ -1,614 +0,0 @@
-/* Long.java -- object wrapper for long
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Instances of class Long
represent primitive
- * long
values.
- *
- * Additionally, this class provides various helper functions and variables
- * related to longs.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Warren Levy
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public final class Long extends Number implements Comparable
-{
- /**
- * Compatible with JDK 1.0.2+.
- */
- private static final long serialVersionUID = 4290774380558885855L;
-
- /**
- * The minimum value a long
can represent is
- * -9223372036854775808L (or -263).
- */
- public static final long MIN_VALUE = 0x8000000000000000L;
-
- /**
- * The maximum value a long
can represent is
- * 9223372036854775807 (or 263 - 1).
- */
- public static final long MAX_VALUE = 0x7fffffffffffffffL;
-
- /**
- * The primitive type long
is represented by this
- * Class
object.
- * @since 1.1
- */
- public static final Class TYPE = VMClassLoader.getPrimitiveClass ('J');
-
- /**
- * The immutable value of this Long.
- *
- * @serial the wrapped long
- */
- private final long value;
-
- /**
- * Create a Long
object representing the value of the
- * long
argument.
- *
- * @param value the value to use
- */
- public Long(long value)
- {
- this.value = value;
- }
-
- /**
- * Create a Long
object representing the value of the
- * argument after conversion to a long
.
- *
- * @param s the string to convert
- * @throws NumberFormatException if the String does not contain a long
- * @see #valueOf(String)
- */
- public Long(String s)
- {
- value = parseLong(s, 10, false);
- }
-
- /**
- * Converts the long
to a String
using
- * the specified radix (base). If the radix exceeds
- * Character.MIN_RADIX
or Character.MAX_RADIX
, 10
- * is used instead. If the result is negative, the leading character is
- * '-' ('\\u002D'). The remaining characters come from
- * Character.forDigit(digit, radix)
('0'-'9','a'-'z').
- *
- * @param num the long
to convert to String
- * @param radix the radix (base) to use in the conversion
- * @return the String
representation of the argument
- */
- public static String toString(long num, int radix)
- {
- // Use the Integer toString for efficiency if possible.
- if ((int) num == num)
- return Integer.toString((int) num, radix);
-
- if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
- radix = 10;
-
- // For negative numbers, print out the absolute value w/ a leading '-'.
- // Use an array large enough for a binary number.
- char[] buffer = new char[65];
- int i = 65;
- boolean isNeg = false;
- if (num < 0)
- {
- isNeg = true;
- num = -num;
-
- // When the value is MIN_VALUE, it overflows when made positive
- if (num < 0)
- {
- buffer[--i] = digits[(int) (-(num + radix) % radix)];
- num = -(num / radix);
- }
- }
-
- do
- {
- buffer[--i] = digits[(int) (num % radix)];
- num /= radix;
- }
- while (num > 0);
-
- if (isNeg)
- buffer[--i] = '-';
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 65 - i, true);
- }
-
- /**
- * Converts the long
to a String
assuming it is
- * unsigned in base 16.
- *
- * @param l the long
to convert to String
- * @return the String
representation of the argument
- */
- public static String toHexString(long l)
- {
- return toUnsignedString(l, 4);
- }
-
- /**
- * Converts the long
to a String
assuming it is
- * unsigned in base 8.
- *
- * @param l the long
to convert to String
- * @return the String
representation of the argument
- */
- public static String toOctalString(long l)
- {
- return toUnsignedString(l, 3);
- }
-
- /**
- * Converts the long
to a String
assuming it is
- * unsigned in base 2.
- *
- * @param l the long
to convert to String
- * @return the String
representation of the argument
- */
- public static String toBinaryString(long l)
- {
- return toUnsignedString(l, 1);
- }
-
- /**
- * Converts the long
to a String
and assumes
- * a radix of 10.
- *
- * @param num the long
to convert to String
- * @return the String
representation of the argument
- * @see #toString(long, int)
- */
- public static String toString(long num)
- {
- return toString(num, 10);
- }
-
- /**
- * Converts the specified String
into an int
- * using the specified radix (base). The string must not be null
- * or empty. It may begin with an optional '-', which will negate the answer,
- * provided that there are also valid digits. Each digit is parsed as if by
- * Character.digit(d, radix)
, and must be in the range
- * 0
to radix - 1
. Finally, the result must be
- * within MIN_VALUE
to MAX_VALUE
, inclusive.
- * Unlike Double.parseDouble, you may not have a leading '+'; and 'l' or
- * 'L' as the last character is only valid in radices 22 or greater, where
- * it is a digit and not a type indicator.
- *
- * @param str the String
to convert
- * @param radix the radix (base) to use in the conversion
- * @return the String
argument converted to long
- * @throws NumberFormatException if s
cannot be parsed as a
- * long
- */
- public static long parseLong(String str, int radix)
- {
- return parseLong(str, radix, false);
- }
-
- /**
- * Converts the specified String
into a long
.
- * This function assumes a radix of 10.
- *
- * @param s the String
to convert
- * @return the int
value of s
- * @throws NumberFormatException if s
cannot be parsed as a
- * long
- * @see #parseLong(String, int)
- */
- public static long parseLong(String s)
- {
- return parseLong(s, 10, false);
- }
-
- /**
- * Creates a new Long
object using the String
- * and specified radix (base).
- *
- * @param s the String
to convert
- * @param radix the radix (base) to convert with
- * @return the new Long
- * @throws NumberFormatException if s
cannot be parsed as a
- * long
- * @see #parseLong(String, int)
- */
- public static Long valueOf(String s, int radix)
- {
- return new Long(parseLong(s, radix, false));
- }
-
- /**
- * Creates a new Long
object using the String
,
- * assuming a radix of 10.
- *
- * @param s the String
to convert
- * @return the new Long
- * @throws NumberFormatException if s
cannot be parsed as a
- * long
- * @see #Long(String)
- * @see #parseLong(String)
- */
- public static Long valueOf(String s)
- {
- return new Long(parseLong(s, 10, false));
- }
-
- /**
- * Convert the specified String
into a Long
.
- * The String
may represent decimal, hexadecimal, or
- * octal numbers.
- *
- *
- *
- * DecodableString:
- * ( [
- * Finally, the value must be in the range -
] DecimalNumber )
- * | ( [ -
] ( 0x
| 0X
- * | #
) HexDigit { HexDigit } )
- * | ( [ -
] 0
{ OctalDigit } )
- * DecimalNumber:
- * DecimalDigit except '0' { DecimalDigit }
- * DecimalDigit:
- * Character.digit(d, 10) has value 0 to 9
- * OctalDigit:
- * Character.digit(d, 8) has value 0 to 7
- * DecimalDigit:
- * Character.digit(d, 16) has value 0 to 15
- * MIN_VALUE
to
- * MAX_VALUE
, or an exception is thrown. Note that you cannot
- * use a trailing 'l' or 'L', unlike in Java source code.
- *
- * @param str the String
to interpret
- * @return the value of the String as a Long
- * @throws NumberFormatException if s
cannot be parsed as a
- * long
- * @throws NullPointerException if s
is null
- * @since 1.2
- */
- public static Long decode(String str)
- {
- return new Long(parseLong(str, 10, true));
- }
-
- /**
- * Return the value of this Long
as a byte
.
- *
- * @return the byte value
- */
- public byte byteValue()
- {
- return (byte) value;
- }
-
- /**
- * Return the value of this Long
as a short
.
- *
- * @return the short value
- */
- public short shortValue()
- {
- return (short) value;
- }
-
- /**
- * Return the value of this Long
as an int
.
- *
- * @return the int value
- */
- public int intValue()
- {
- return (int) value;
- }
-
- /**
- * Return the value of this Long
.
- *
- * @return the long value
- */
- public long longValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Long
as a float
.
- *
- * @return the float value
- */
- public float floatValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Long
as a double
.
- *
- * @return the double value
- */
- public double doubleValue()
- {
- return value;
- }
-
- /**
- * Converts the Long
value to a String
and
- * assumes a radix of 10.
- *
- * @return the String
representation
- */
- public String toString()
- {
- return toString(value, 10);
- }
-
- /**
- * Return a hashcode representing this Object. Long
's hash
- * code is calculated by (int) (value ^ (value >> 32))
.
- *
- * @return this Object's hash code
- */
- public int hashCode()
- {
- return (int) (value ^ (value >>> 32));
- }
-
- /**
- * Returns true
if obj
is an instance of
- * Long
and represents the same long value.
- *
- * @param obj the object to compare
- * @return whether these Objects are semantically equal
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Long && value == ((Long) obj).value;
- }
-
- /**
- * Get the specified system property as a Long
. The
- * decode()
method will be used to interpret the value of
- * the property.
- *
- * @param nm the name of the system property
- * @return the system property as a Long
, or null if the
- * property is not found or cannot be decoded
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Long getLong(String nm)
- {
- return getLong(nm, null);
- }
-
- /**
- * Get the specified system property as a Long
, or use a
- * default long
value if the property is not found or is not
- * decodable. The decode()
method will be used to interpret
- * the value of the property.
- *
- * @param nm the name of the system property
- * @param val the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Long getLong(String nm, long val)
- {
- Long result = getLong(nm, null);
- return result == null ? new Long(val) : result;
- }
-
- /**
- * Get the specified system property as a Long
, or use a
- * default Long
value if the property is not found or is
- * not decodable. The decode()
method will be used to
- * interpret the value of the property.
- *
- * @param nm the name of the system property
- * @param def the default value
- * @return the value of the system property, or the default
- * @throws SecurityException if accessing the system property is forbidden
- * @see System#getProperty(String)
- * @see #decode(String)
- */
- public static Long getLong(String nm, Long def)
- {
- if (nm == null || "".equals(nm))
- return def;
- nm = System.getProperty(nm);
- if (nm == null)
- return def;
- try
- {
- return decode(nm);
- }
- catch (NumberFormatException e)
- {
- return def;
- }
- }
-
- /**
- * Compare two Longs numerically by comparing their long
- * values. The result is positive if the first is greater, negative if the
- * second is greater, and 0 if the two are equal.
- *
- * @param l the Long to compare
- * @return the comparison
- * @since 1.2
- */
- public int compareTo(Long l)
- {
- if (value == l.value)
- return 0;
- // Returns just -1 or 1 on inequality; doing math might overflow the long.
- return value > l.value ? 1 : -1;
- }
-
- /**
- * Behaves like compareTo(Long)
unless the Object
- * is not a Long
.
- *
- * @param o the object to compare
- * @return the comparison
- * @throws ClassCastException if the argument is not a Long
- * @see #compareTo(Long)
- * @see Comparable
- * @since 1.2
- */
- public int compareTo(Object o)
- {
- return compareTo((Long) o);
- }
-
- /**
- * Helper for converting unsigned numbers to String.
- *
- * @param num the number
- * @param exp log2(digit) (ie. 1, 3, or 4 for binary, oct, hex)
- */
- private static String toUnsignedString(long num, int exp)
- {
- // Use the Integer toUnsignedString for efficiency if possible.
- // If NUM<0 then this particular optimization doesn't work
- // properly.
- if (num >= 0 && (int) num == num)
- return Integer.toUnsignedString((int) num, exp);
-
- // Use an array large enough for a binary number.
- int mask = (1 << exp) - 1;
- char[] buffer = new char[64];
- int i = 64;
- do
- {
- buffer[--i] = digits[(int) num & mask];
- num >>>= exp;
- }
- while (num != 0);
-
- // Package constructor avoids an array copy.
- return new String(buffer, i, 64 - i, true);
- }
-
- /**
- * Helper for parsing longs.
- *
- * @param str the string to parse
- * @param radix the radix to use, must be 10 if decode is true
- * @param decode if called from decode
- * @return the parsed long value
- * @throws NumberFormatException if there is an error
- * @throws NullPointerException if decode is true and str is null
- * @see #parseLong(String, int)
- * @see #decode(String)
- */
- private static long parseLong(String str, int radix, boolean decode)
- {
- if (! decode && str == null)
- throw new NumberFormatException();
- int index = 0;
- int len = str.length();
- boolean isNeg = false;
- if (len == 0)
- throw new NumberFormatException();
- int ch = str.charAt(index);
- if (ch == '-')
- {
- if (len == 1)
- throw new NumberFormatException();
- isNeg = true;
- ch = str.charAt(++index);
- }
- if (decode)
- {
- if (ch == '0')
- {
- if (++index == len)
- return 0;
- if ((str.charAt(index) & ~('x' ^ 'X')) == 'X')
- {
- radix = 16;
- index++;
- }
- else
- radix = 8;
- }
- else if (ch == '#')
- {
- radix = 16;
- index++;
- }
- }
- if (index == len)
- throw new NumberFormatException();
-
- long max = MAX_VALUE / radix;
- // We can't directly write `max = (MAX_VALUE + 1) / radix'.
- // So instead we fake it.
- if (isNeg && MAX_VALUE % radix == radix - 1)
- ++max;
-
- long val = 0;
- while (index < len)
- {
- if (val < 0 || val > max)
- throw new NumberFormatException();
-
- ch = Character.digit(str.charAt(index++), radix);
- val = val * radix + ch;
- if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE)))
- throw new NumberFormatException();
- }
- return isNeg ? -val : val;
- }
-}
diff --git a/libjava/java/lang/Math.java b/libjava/java/lang/Math.java
deleted file mode 100644
index 08081e2523a..00000000000
--- a/libjava/java/lang/Math.java
+++ /dev/null
@@ -1,650 +0,0 @@
-/* java.lang.Math -- common mathematical functions, native allowed
- Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-import gnu.classpath.Configuration;
-
-import java.util.Random;
-
-/**
- * Helper class containing useful mathematical functions and constants.
- * 2.718281828459045
. Used in natural log and exp.
- *
- * @see #log(double)
- * @see #exp(double)
- */
- public static final double E = 2.718281828459045;
-
- /**
- * The most accurate approximation to the mathematical constant pi:
- * 3.141592653589793
. This is the ratio of a circle's diameter
- * to its circumference.
- */
- public static final double PI = 3.141592653589793;
-
- /**
- * Take the absolute value of the argument.
- * (Absolute value means make it positive.)
- * Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
.
- *
- * @param f the number to take the absolute value of
- * @return the absolute value
- */
- public static float abs(float f)
- {
- return (f <= 0) ? 0 - f : f;
- }
-
- /**
- * Take the absolute value of the argument.
- * (Absolute value means make it positive.)
- *
- * This is equivalent, but faster than, calling
- * Double.longBitsToDouble(Double.doubleToLongBits(a)
- * << 1) >>> 1);
.
- *
- * @param d the number to take the absolute value of
- * @return the absolute value
- */
- public static double abs(double d)
- {
- return (d <= 0) ? 0 - d : d;
- }
-
- /**
- * Return whichever argument is smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static int min(int a, int b)
- {
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static long min(long a, long b)
- {
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is smaller. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, -0 is always smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static float min(float a, float b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; < will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return -(-a - b);
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is smaller. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, -0 is always smaller.
- *
- * @param a the first number
- * @param b a second number
- * @return the smaller of the two numbers
- */
- public static double min(double a, double b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; < will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return -(-a - b);
- return (a < b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static int max(int a, int b)
- {
- return (a > b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static long max(long a, long b)
- {
- return (a > b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, 0 is always larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static float max(float a, float b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; > will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return a - -b;
- return (a > b) ? a : b;
- }
-
- /**
- * Return whichever argument is larger. If either argument is NaN, the
- * result is NaN, and when comparing 0 and -0, 0 is always larger.
- *
- * @param a the first number
- * @param b a second number
- * @return the larger of the two numbers
- */
- public static double max(double a, double b)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return a;
- // no need to check if b is NaN; > will work correctly
- // recall that -0.0 == 0.0, but [+-]0.0 - [+-]0.0 behaves special
- if (a == 0 && b == 0)
- return a - -b;
- return (a > b) ? a : b;
- }
-
- /**
- * The trigonometric function sin. The sine of NaN or infinity is
- * NaN, and the sine of 0 retains its sign. This is accurate within 1 ulp,
- * and is semi-monotonic.
- *
- * @param a the angle (in radians)
- * @return sin(a)
- */
- public static native double sin(double a);
-
- /**
- * The trigonometric function cos. The cosine of NaN or infinity is
- * NaN. This is accurate within 1 ulp, and is semi-monotonic.
- *
- * @param a the angle (in radians)
- * @return cos(a)
- */
- public static native double cos(double a);
-
- /**
- * The trigonometric function tan. The tangent of NaN or infinity
- * is NaN, and the tangent of 0 retains its sign. This is accurate within 1
- * ulp, and is semi-monotonic.
- *
- * @param a the angle (in radians)
- * @return tan(a)
- */
- public static native double tan(double a);
-
- /**
- * The trigonometric function arcsin. The range of angles returned
- * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN or
- * its absolute value is beyond 1, the result is NaN; and the arcsine of
- * 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic.
- *
- * @param a the sin to turn back into an angle
- * @return arcsin(a)
- */
- public static native double asin(double a);
-
- /**
- * The trigonometric function arccos. The range of angles returned
- * is 0 to pi radians (0 to 180 degrees). If the argument is NaN or
- * its absolute value is beyond 1, the result is NaN. This is accurate
- * within 1 ulp, and is semi-monotonic.
- *
- * @param a the cos to turn back into an angle
- * @return arccos(a)
- */
- public static native double acos(double a);
-
- /**
- * The trigonometric function arcsin. The range of angles returned
- * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN, the
- * result is NaN; and the arctangent of 0 retains its sign. This is accurate
- * within 1 ulp, and is semi-monotonic.
- *
- * @param a the tan to turn back into an angle
- * @return arcsin(a)
- * @see #atan2(double, double)
- */
- public static native double atan(double a);
-
- /**
- * A special version of the trigonometric function arctan, for
- * converting rectangular coordinates (x, y) to polar
- * (r, theta). This computes the arctangent of x/y in the range
- * of -pi to pi radians (-180 to 180 degrees). Special cases:
- *
log()
. If the
- * argument is NaN, the result is NaN; if the argument is positive infinity,
- * the result is positive infinity; and if the argument is negative
- * infinity, the result is positive zero. This is accurate within 1 ulp,
- * and is semi-monotonic.
- *
- * @param a the number to raise to the power
- * @return the number raised to the power of e
- * @see #log(double)
- * @see #pow(double, double)
- */
- public static native double exp(double a);
-
- /**
- * Take ln(a) (the natural log). The opposite of exp()
. If the
- * argument is NaN or negative, the result is NaN; if the argument is
- * positive infinity, the result is positive infinity; and if the argument
- * is either zero, the result is negative infinity. This is accurate within
- * 1 ulp, and is semi-monotonic.
- *
- * ln(a) / ln(b)
.
- *
- * @param a the number to take the natural log of
- * @return the natural log of a
- * @see #exp(double)
- */
- public static native double log(double a);
-
- /**
- * Take a square root. If the argument is NaN or negative, the result is
- * NaN; if the argument is positive infinity, the result is positive
- * infinity; and if the result is either zero, the result is the same.
- * This is accurate within the limits of doubles.
- *
- *
- *
x - y * n
, where n is the closest
- * double to x / y
(ties go to the even n); for a zero
- * remainder, the sign is that of x
. If either argument is NaN,
- * the first argument is infinite, or the second argument is zero, the result
- * is NaN; if x is finite but y is infinite, the result is x. This is
- * accurate within the limits of doubles.
- *
- * @param x the dividend (the top half)
- * @param y the divisor (the bottom half)
- * @return the IEEE 754-defined floating point remainder of x/y
- * @see #rint(double)
- */
- public static native double IEEEremainder(double x, double y);
-
- /**
- * Take the nearest integer that is that is greater than or equal to the
- * argument. If the argument is NaN, infinite, or zero, the result is the
- * same; if the argument is between -1 and 0, the result is negative zero.
- * Note that Math.ceil(x) == -Math.floor(-x)
.
- *
- * @param a the value to act upon
- * @return the nearest integer >= a
- */
- public static native double ceil(double a);
-
- /**
- * Take the nearest integer that is that is less than or equal to the
- * argument. If the argument is NaN, infinite, or zero, the result is the
- * same. Note that Math.ceil(x) == -Math.floor(-x)
.
- *
- * @param a the value to act upon
- * @return the nearest integer <= a
- */
- public static native double floor(double a);
-
- /**
- * Take the nearest integer to the argument. If it is exactly between
- * two integers, the even integer is taken. If the argument is NaN,
- * infinite, or zero, the result is the same.
- *
- * @param a the value to act upon
- * @return the nearest integer to a
- */
- public static native double rint(double a);
-
- /**
- * Take the nearest integer to the argument. This is equivalent to
- * (int) Math.floor(a + 0.5f)
. If the argument is NaN, the result
- * is 0; otherwise if the argument is outside the range of int, the result
- * will be Integer.MIN_VALUE or Integer.MAX_VALUE, as appropriate.
- *
- * @param a the argument to round
- * @return the nearest integer to the argument
- * @see Integer#MIN_VALUE
- * @see Integer#MAX_VALUE
- */
- public static int round(float a)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return 0;
- return (int) floor(a + 0.5f);
- }
-
- /**
- * Take the nearest long to the argument. This is equivalent to
- * (long) Math.floor(a + 0.5)
. If the argument is NaN, the
- * result is 0; otherwise if the argument is outside the range of long, the
- * result will be Long.MIN_VALUE or Long.MAX_VALUE, as appropriate.
- *
- * @param a the argument to round
- * @return the nearest long to the argument
- * @see Long#MIN_VALUE
- * @see Long#MAX_VALUE
- */
- public static long round(double a)
- {
- // this check for NaN, from JLS 15.21.1, saves a method call
- if (a != a)
- return 0;
- return (long) floor(a + 0.5d);
- }
-
- /**
- * Get a random number. This behaves like Random.nextDouble(), seeded by
- * System.currentTimeMillis() when first called. In other words, the number
- * is from a pseudorandom sequence, and lies in the range [+0.0, 1.0).
- * This random sequence is only used by this method, and is threadsafe,
- * although you may want your own random number generator if it is shared
- * among threads.
- *
- * @return a random number
- * @see Random#nextDouble()
- * @see System#currentTimeMillis()
- */
- public static synchronized double random()
- {
- if (rand == null)
- rand = new Random();
- return rand.nextDouble();
- }
-
- /**
- * Convert from degrees to radians. The formula for this is
- * radians = degrees * (pi/180); however it is not always exact given the
- * limitations of floating point numbers.
- *
- * @param degrees an angle in degrees
- * @return the angle in radians
- * @since 1.2
- */
- public static double toRadians(double degrees)
- {
- return (degrees * PI) / 180;
- }
-
- /**
- * Convert from radians to degrees. The formula for this is
- * degrees = radians * (180/pi); however it is not always exact given the
- * limitations of floating point numbers.
- *
- * @param rads an angle in radians
- * @return the angle in degrees
- * @since 1.2
- */
- public static double toDegrees(double rads)
- {
- return (rads * 180) / PI;
- }
-}
diff --git a/libjava/java/lang/NegativeArraySizeException.java b/libjava/java/lang/NegativeArraySizeException.java
deleted file mode 100644
index fcfa52e475c..00000000000
--- a/libjava/java/lang/NegativeArraySizeException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* NegativeArraySizeException.java -- thrown on attempt to create array
- with a negative size
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when an attempt is made to create an array with a negative
- * size. For example:
- *
- * int i = -1;
- * int[] array = new int[i];
- *
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class NegativeArraySizeException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -8960118058596991861L;
-
- /**
- * Create an exception without a message.
- */
- public NegativeArraySizeException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public NegativeArraySizeException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/NoClassDefFoundError.java b/libjava/java/lang/NoClassDefFoundError.java
deleted file mode 100644
index 7e8e6caff80..00000000000
--- a/libjava/java/lang/NoClassDefFoundError.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* NoClassDefFoundError.java -- thrown when a ClassLoader cannot find a class
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A NoClassDefFoundError
is thrown when a classloader or the
- * Java Virtual Machine tries to load a class and no definition of the class
- * can be found. This could happen when using the new
expression
- * or during a normal method call. The reason this would occur at runtime is
- * because the missing class definition existed when the currently executing
- * class was compiled, but now that definition cannot be found.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class NoClassDefFoundError extends LinkageError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 9095859863287012458L;
-
- /**
- * Create an error without a message.
- */
- public NoClassDefFoundError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public NoClassDefFoundError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/NoSuchFieldError.java b/libjava/java/lang/NoSuchFieldError.java
deleted file mode 100644
index af42e35dcf2..00000000000
--- a/libjava/java/lang/NoSuchFieldError.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* NoSuchFieldError.java -- thrown when the linker does not find a field
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A NoSuchFieldError
is thrown if an application attempts
- * to access a field of a class, and that class no longer has that field.
- * This is normally detected by the compiler, so it signals that you are
- * using binary incompatible class versions.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class NoSuchFieldError extends IncompatibleClassChangeError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -3456430195886129035L;
-
- /**
- * Create an error without a message.
- */
- public NoSuchFieldError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public NoSuchFieldError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/NoSuchFieldException.java b/libjava/java/lang/NoSuchFieldException.java
deleted file mode 100644
index 74d52d137c4..00000000000
--- a/libjava/java/lang/NoSuchFieldException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* NoSuchFieldException.java -- thrown when reflecting a non-existant field
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown to indicate the class does not have the specified field. This is
- * caused by a variety of reflection methods, when looking up a field by name.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @since 1.1
- * @status updated to 1.4
- */
-public class NoSuchFieldException extends Exception
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -6143714805279938260L;
-
- /**
- * Create an exception without a message.
- */
- public NoSuchFieldException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public NoSuchFieldException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/NoSuchMethodError.java b/libjava/java/lang/NoSuchMethodError.java
deleted file mode 100644
index 2bda776e8e9..00000000000
--- a/libjava/java/lang/NoSuchMethodError.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* NoSuchMethodError.java -- thrown when the linker does not find a method
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A NoSuchMethodError
is thrown if an application attempts
- * to access a method of a class, and that class no longer has that method.
- * This is normally detected by the compiler, so it signals that you are
- * using binary incompatible class versions.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class NoSuchMethodError extends IncompatibleClassChangeError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- static final long serialVersionUID = -3765521442372831335L;
-
- /**
- * Create an error without a message.
- */
- public NoSuchMethodError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public NoSuchMethodError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/NoSuchMethodException.java b/libjava/java/lang/NoSuchMethodException.java
deleted file mode 100644
index e423efb79f6..00000000000
--- a/libjava/java/lang/NoSuchMethodException.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* NoSuchMethodException.java -- thrown when reflecting a non-existant method
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown to indicate the class does not have the specified method. This is
- * caused by a variety of reflection methods, when looking up a method by name.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class NoSuchMethodException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 5034388446362600923L;
-
- /**
- * Create an exception without a message.
- */
- public NoSuchMethodException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public NoSuchMethodException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/NullPointerException.java b/libjava/java/lang/NullPointerException.java
deleted file mode 100644
index 29a4ee086c5..00000000000
--- a/libjava/java/lang/NullPointerException.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* NullPointerException.java -- thrown when using null instead of an object
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when attempting to use null
where an object
- * is required. The Virtual Machine automatically throws this exception
- * for the following:
- *
- * null
is an inappropriate parameter to a method.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class NullPointerException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 5162710183389028792L;
-
- /**
- * Create an exception without a message.
- */
- public NullPointerException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public NullPointerException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/Number.java b/libjava/java/lang/Number.java
deleted file mode 100644
index eb81f78c86e..00000000000
--- a/libjava/java/lang/Number.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Number.java =- abstract superclass of numeric objects
- Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-import java.io.Serializable;
-
-/**
- * Number is a generic superclass of all the numeric classes, including
- * the wrapper classes {@link Byte}, {@link Short}, {@link Integer},
- * {@link Long}, {@link Float}, and {@link Double}. Also worth mentioning
- * are the classes in {@link java.math}.
- *
- * It provides ways to convert numeric objects to any primitive.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Warren Levy
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.0
- * @status updated to 1.4
- */
-public abstract class Number implements Serializable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -8742448824652078965L;
-
- /**
- * Table for calculating digits, used in Character, Long, and Integer.
- */
- static final char[] digits = {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
- 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z',
- };
-
- /**
- * The basic constructor (often called implicitly).
- */
- public Number()
- {
- }
-
- /**
- * Return the value of this Number
as an int
.
- *
- * @return the int value
- */
- public abstract int intValue();
-
- /**
- * Return the value of this Number
as a long
.
- *
- * @return the long value
- */
- public abstract long longValue();
-
- /**
- * Return the value of this Number
as a float
.
- *
- * @return the float value
- */
- public abstract float floatValue();
-
- /**
- * Return the value of this Number
as a float
.
- *
- * @return the double value
- */
- public abstract double doubleValue();
-
- /**
- * Return the value of this Number
as a byte
.
- *
- * @return the byte value
- * @since 1.1
- */
- public byte byteValue()
- {
- return (byte) intValue();
- }
-
- /**
- * Return the value of this Number
as a short
.
- *
- * @return the short value
- * @since 1.1
- */
- public short shortValue()
- {
- return (short) intValue();
- }
-}
diff --git a/libjava/java/lang/NumberFormatException.java b/libjava/java/lang/NumberFormatException.java
deleted file mode 100644
index bf98156d13c..00000000000
--- a/libjava/java/lang/NumberFormatException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* NumberFormatException.java -- thrown when parsing a bad string as a number
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Can be thrown when attempting to convert a String
to
- * one of the numeric types, but the operation fails because the string
- * has the wrong format.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class NumberFormatException extends IllegalArgumentException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -2848938806368998894L;
-
- /**
- * Create an exception without a message.
- */
- public NumberFormatException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public NumberFormatException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/OutOfMemoryError.java b/libjava/java/lang/OutOfMemoryError.java
deleted file mode 100644
index 66da563a0fb..00000000000
--- a/libjava/java/lang/OutOfMemoryError.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* OutOfMemoryError.java -- thrown when a memory allocation fails
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Thrown when the Java Virtual Machine is unable to allocate an object
- * because it is out of memory and no more memory could be made available
- * by the garbage collector.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class OutOfMemoryError extends VirtualMachineError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 8228564086184010517L;
-
- /**
- * Create an error without a message.
- */
- public OutOfMemoryError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public OutOfMemoryError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/Process.java b/libjava/java/lang/Process.java
deleted file mode 100644
index b6e18ca4df3..00000000000
--- a/libjava/java/lang/Process.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Process.java - Represent spawned system process
- Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * An instance of a subclass of Process
is created by the
- * Runtime.exec
methods. Methods in Process
- * provide a means to send input to a process, obtain the output from a
- * subprocess, destroy a subprocess, obtain the exit value from a
- * subprocess, and wait for a subprocess to complete.
- *
- * waitFor
will block until the subprocess
- * has terminated. If the process has already terminated then the method
- * immediately returns with the exit value of the subprocess.
- *
- * @return the subprocess exit value; 0 conventionally denotes success
- * @throws InterruptedException if another thread interrupts the blocked one
- */
- public abstract int waitFor() throws InterruptedException;
-
- /**
- * When a process terminates there is associated with that termination
- * an exit value for the process to indicate why it terminated. A return
- * of 0
denotes normal process termination by convention.
- *
- * @return the exit value of the subprocess
- * @throws IllegalThreadStateException if the subprocess has not terminated
- */
- public abstract int exitValue();
-
- /**
- * Kills the subprocess and all of its children forcibly.
- */
- public abstract void destroy();
-} // class Process
diff --git a/libjava/java/lang/Runnable.java b/libjava/java/lang/Runnable.java
deleted file mode 100644
index 32c52b94a05..00000000000
--- a/libjava/java/lang/Runnable.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Runnable -- interface for a method tied to an Object; often for Threads
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Runnable is an interface you implement to indicate that your class can be
- * executed as the main part of a Thread, among other places. When you want
- * an entry point to run a piece of code, implement this interface and
- * override run.
- *
- * @author Paul Fisher
- * @author Tom Tromey (tromey@cygnus.com)
- * @see Thread
- * @since 1.0
- * @status updated to 1.4
- */
-public interface Runnable
-{
- /**
- * This method will be called by whoever wishes to run your class
- * implementing Runnable. Note that there are no restrictions on what
- * you are allowed to do in the run method, except that you cannot
- * throw a checked exception.
- */
- void run();
-}
diff --git a/libjava/java/lang/RuntimeException.java b/libjava/java/lang/RuntimeException.java
deleted file mode 100644
index 72cf0872bc7..00000000000
--- a/libjava/java/lang/RuntimeException.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/* RuntimeException.java -- root of all unchecked exceptions
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * All exceptions which are subclasses of RuntimeException
- * can be thrown at any time during the execution of a Java virtual machine.
- * Methods which throw these exceptions are not required to declare them
- * in their throws clause.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @status updated to 1.4
- */
-public class RuntimeException extends Exception
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -7034897190745766939L;
-
- /**
- * Create an exception without a message. The cause remains uninitialized.
- *
- * @see #initCause(Throwable)
- */
- public RuntimeException()
- {
- }
-
- /**
- * Create an exception with a message. The cause remains uninitialized.
- *
- * @param s the message string
- * @see #initCause(Throwable)
- */
- public RuntimeException(String s)
- {
- super(s);
- }
-
- /**
- * Create an exception with a message and a cause.
- *
- * @param s the message string
- * @param cause the cause of this exception
- * @since 1.4
- */
- public RuntimeException(String s, Throwable cause)
- {
- super(s, cause);
- }
-
- /**
- * Create an exception with the given cause, and a message of
- * cause == null ? null : cause.toString()
.
- *
- * @param cause the cause of this exception
- * @since 1.4
- */
- public RuntimeException(Throwable cause)
- {
- super(cause);
- }
-}
diff --git a/libjava/java/lang/RuntimePermission.java b/libjava/java/lang/RuntimePermission.java
deleted file mode 100644
index ca33307d12b..00000000000
--- a/libjava/java/lang/RuntimePermission.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/* RuntimePermission.java -- permission for a secure runtime action
- Copyright (C) 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-import java.security.BasicPermission;
-
-/**
- * A RuntimePermission
contains a permission name, but no
- * actions list. This means you either have the permission or you don't.
- *
- * Permission names have the follow the hierarchial property naming
- * convention. In addition, an asterisk may appear at the end of a
- * name if following a period or by itself.
- *
- *
- *
- *
- * Valid names Invalid names
- * "accessClassInPackage.*","*"
- * "**", "*x", "*.a"
- *
- * The following table provides a list of all the possible RuntimePermission
- * permission names with a description of what that permission allows.
- *
- *
- *
- * @author Brian Jones
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see BasicPermission
- * @see Permission
- * @see SecurityManager
- * @since 1.2
- * @status updated to 1.4
- */
-public final class RuntimePermission extends BasicPermission
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = 7399184964622342223L;
-
- /**
- * Create a new permission with the specified name.
- *
- * @param permissionName the name of the granted permission
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException thrown if name is empty or invalid
- */
- public RuntimePermission(String permissionName)
- {
- super(permissionName);
- }
-
- /**
- * Create a new permission with the specified name. The actions argument
- * is ignored, as runtime permissions have no actions.
- *
- * @param permissionName the name of the granted permission
- * @param actions ignored
- * @throws NullPointerException if name is null
- * @throws IllegalArgumentException thrown if name is empty or invalid
- */
- public RuntimePermission(String permissionName, String actions)
- {
- super(permissionName);
- }
-}
diff --git a/libjava/java/lang/SecurityException.java b/libjava/java/lang/SecurityException.java
deleted file mode 100644
index a95d797054f..00000000000
--- a/libjava/java/lang/SecurityException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* SecurityException.java -- thrown to indicate a security violation
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * The security manager will throw this exception to indicate a security
- * violation. This can occur any time an operation is attempted which is
- * deemed unsafe by the current security policies.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @see SecurityManager
- * @status updated to 1.4
- */
-public class SecurityException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 6878364983674394167L;
-
- /**
- * Create an exception without a message.
- */
- public SecurityException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public SecurityException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/Short.java b/libjava/java/lang/Short.java
deleted file mode 100644
index fbeea915bd3..00000000000
--- a/libjava/java/lang/Short.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/* Short.java -- object wrapper for short
- Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * Instances of class Permission Name Permission Allows Risks
- *
- *
- *
- * createClassLoader
creation of a class loader
- * a class loader can load rogue classes which bypass all security
- * permissions
- *
- *
- * getClassLoader
retrieval of the class loader for the calling class
- * rogue code could load classes not otherwise available
- *
- *
- * setContextClassLoader
allows the setting of the context class loader used by a thread
- * rogue code could change the context class loader needed by system
- * threads
- *
- *
- * setSecurityManager
allows the application to replace the security manager
- * the new manager may be less restrictive, so that rogue code can
- * bypass existing security checks
- *
- *
- * createSecurityManager
allows the application to create a new security manager
- * rogue code can use the new security manager to discover information
- * about the execution stack
- *
- *
- * exitVM
allows the application to halt the virtual machine
- * rogue code can mount a denial-of-service attack by killing the
- * virtual machine
- *
- *
- * shutdownHooks
allows registration and modification of shutdown hooks
- * rogue code can add a hook that interferes with clean
- * virtual machine shutdown
- *
- *
- * setFactory
allows the application to set the socket factory for socket,
- * server socket, stream handler, or RMI socket factory.
- * rogue code can create a rogue network object which mangles or
- * intercepts data
- *
- *
- * setIO
allows the application to set System.out, System.in, and
- * System.err
- * rogue code could sniff user input and intercept or mangle
- * output
- *
- *
- * modifyThread
allows the application to modify any thread in the virtual machine
- * using any of the methods
- * stop
, resume
,
- * suspend
, setPriority
, and
- * setName
of classs Thread
rogue code could adversely modify system or user threads
- *
- *
- * stopThread
allows the application to
- * stop
any thread it has
- * access to in the systemrogue code can stop arbitrary threads
- *
- *
- * modifyThreadGroup
allows the application to modify thread groups using any of the
- * methods
- * destroy
, resume
,
- * setDaemon
, setMaxPriority
,
- * stop
, and suspend
of the class
- * ThreadGroup
rogue code can mount a denial-of-service attack by changing run
- * priorities
- *
- *
- * getProtectionDomain
retrieve a class's ProtectionDomain
- * rogue code can gain information about the security policy, to
- * prepare a better attack
- *
- *
- * readFileDescriptor
read a file descriptor
- * rogue code can read sensitive information
- *
- *
- * writeFileDescriptor
write a file descriptor
- * rogue code can write files, including viruses, and can modify the
- * virtual machine binary; if not just fill up the disk
- *
- *
- * loadLibrary.
library namedynamic linking of the named library
- * native code can bypass many security checks of pure Java
- *
- *
- * accessClassInPackage.
package nameaccess to a package via a ClassLoader
- * rogue code can access classes not normally available
- *
- *
- * defineClassInPackage.
package namedefine a class inside a given package
- * rogue code can install rogue classes, including in trusted packages
- * like java.security or java.lang
- *
- *
- * accessDeclaredMembers
access declared class members via reflection
- * rogue code can discover information, invoke methods, or modify fields
- * that are not otherwise available
- *
- *
- * queuePrintJob
initiate a print job
- * rogue code could make a hard copy of sensitive information, or
- * simply waste paper Short
represent primitive
- * short
values.
- *
- * Additionally, this class provides various helper functions and variables
- * related to shorts.
- *
- * @author Paul Fisher
- * @author John Keiser
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.1
- * @status updated to 1.4
- */
-public final class Short extends Number implements Comparable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 7515723908773894738L;
-
- /**
- * The minimum value a short
can represent is -32768 (or
- * -215).
- */
- public static final short MIN_VALUE = -32768;
-
- /**
- * The minimum value a short
can represent is 32767 (or
- * 215).
- */
- public static final short MAX_VALUE = 32767;
-
- /**
- * The primitive type short
is represented by this
- * Class
object.
- */
- public static final Class TYPE = VMClassLoader.getPrimitiveClass('S');
-
- /**
- * The immutable value of this Short.
- *
- * @serial the wrapped short
- */
- private final short value;
-
- /**
- * Create a Short
object representing the value of the
- * short
argument.
- *
- * @param value the value to use
- */
- public Short(short value)
- {
- this.value = value;
- }
-
- /**
- * Create a Short
object representing the value of the
- * argument after conversion to a short
.
- *
- * @param s the string to convert
- * @throws NumberFormatException if the String cannot be parsed
- */
- public Short(String s)
- {
- value = parseShort(s, 10);
- }
-
- /**
- * Converts the short
to a String
and assumes
- * a radix of 10.
- *
- * @param s the short
to convert to String
- * @return the String
representation of the argument
- */
- public static String toString(short s)
- {
- return String.valueOf(s);
- }
-
- /**
- * Converts the specified String
into a short
.
- * This function assumes a radix of 10.
- *
- * @param s the String
to convert
- * @return the short
value of s
- * @throws NumberFormatException if s
cannot be parsed as a
- * short
- */
- public static short parseShort(String s)
- {
- return parseShort(s, 10);
- }
-
- /**
- * Converts the specified String
into a short
- * using the specified radix (base). The string must not be null
- * or empty. It may begin with an optional '-', which will negate the answer,
- * provided that there are also valid digits. Each digit is parsed as if by
- * Character.digit(d, radix)
, and must be in the range
- * 0
to radix - 1
. Finally, the result must be
- * within MIN_VALUE
to MAX_VALUE
, inclusive.
- * Unlike Double.parseDouble, you may not have a leading '+'.
- *
- * @param s the String
to convert
- * @param radix the radix (base) to use in the conversion
- * @return the String
argument converted to short
- * @throws NumberFormatException if s
cannot be parsed as a
- * short
- */
- public static short parseShort(String s, int radix)
- {
- int i = Integer.parseInt(s, radix, false);
- if ((short) i != i)
- throw new NumberFormatException();
- return (short) i;
- }
-
- /**
- * Creates a new Short
object using the String
- * and specified radix (base).
- *
- * @param s the String
to convert
- * @param radix the radix (base) to convert with
- * @return the new Short
- * @throws NumberFormatException if s
cannot be parsed as a
- * short
- * @see #parseShort(String, int)
- */
- public static Short valueOf(String s, int radix)
- {
- return new Short(parseShort(s, radix));
- }
-
- /**
- * Creates a new Short
object using the String
,
- * assuming a radix of 10.
- *
- * @param s the String
to convert
- * @return the new Short
- * @throws NumberFormatException if s
cannot be parsed as a
- * short
- * @see #Short(String)
- * @see #parseShort(String)
- */
- public static Short valueOf(String s)
- {
- return new Short(parseShort(s, 10));
- }
-
- /**
- * Convert the specified String
into a Short
.
- * The String
may represent decimal, hexadecimal, or
- * octal numbers.
- *
- *
- *
- * DecodableString:
- * ( [
- * Finally, the value must be in the range -
] DecimalNumber )
- * | ( [ -
] ( 0x
| 0X
- * | #
) HexDigit { HexDigit } )
- * | ( [ -
] 0
{ OctalDigit } )
- * DecimalNumber:
- * DecimalDigit except '0' { DecimalDigit }
- * DecimalDigit:
- * Character.digit(d, 10) has value 0 to 9
- * OctalDigit:
- * Character.digit(d, 8) has value 0 to 7
- * DecimalDigit:
- * Character.digit(d, 16) has value 0 to 15
- * MIN_VALUE
to
- * MAX_VALUE
, or an exception is thrown.
- *
- * @param s the String
to interpret
- * @return the value of the String as a Short
- * @throws NumberFormatException if s
cannot be parsed as a
- * short
- * @throws NullPointerException if s
is null
- * @see Integer#decode(String)
- */
- public static Short decode(String s)
- {
- int i = Integer.parseInt(s, 10, true);
- if ((short) i != i)
- throw new NumberFormatException();
- return new Short((short) i);
- }
-
- /**
- * Return the value of this Short
as a byte
.
- *
- * @return the byte value
- */
- public byte byteValue()
- {
- return (byte) value;
- }
-
- /**
- * Return the value of this Short
.
- *
- * @return the short value
- */
- public short shortValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Short
as an int
.
- *
- * @return the int value
- */
- public int intValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Short
as a long
.
- *
- * @return the long value
- */
- public long longValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Short
as a float
.
- *
- * @return the float value
- */
- public float floatValue()
- {
- return value;
- }
-
- /**
- * Return the value of this Short
as a double
.
- *
- * @return the double value
- */
- public double doubleValue()
- {
- return value;
- }
-
- /**
- * Converts the Short
value to a String
and
- * assumes a radix of 10.
- *
- * @return the String
representation of this Short
- */
- public String toString()
- {
- return String.valueOf(value);
- }
-
- /**
- * Return a hashcode representing this Object. Short
's hash
- * code is simply its value.
- *
- * @return this Object's hash code
- */
- public int hashCode()
- {
- return value;
- }
-
- /**
- * Returns true
if obj
is an instance of
- * Short
and represents the same short value.
- *
- * @param obj the object to compare
- * @return whether these Objects are semantically equal
- */
- public boolean equals(Object obj)
- {
- return obj instanceof Short && value == ((Short) obj).value;
- }
-
- /**
- * Compare two Shorts numerically by comparing their short
- * values. The result is positive if the first is greater, negative if the
- * second is greater, and 0 if the two are equal.
- *
- * @param s the Short to compare
- * @return the comparison
- * @since 1.2
- */
- public int compareTo(Short s)
- {
- return value - s.value;
- }
-
- /**
- * Behaves like compareTo(Short)
unless the Object
- * is not a Short
.
- *
- * @param o the object to compare
- * @return the comparison
- * @throws ClassCastException if the argument is not a Short
- * @see #compareTo(Short)
- * @see Comparable
- * @since 1.2
- */
- public int compareTo(Object o)
- {
- return compareTo((Short)o);
- }
-}
diff --git a/libjava/java/lang/StackOverflowError.java b/libjava/java/lang/StackOverflowError.java
deleted file mode 100644
index 5188ddda159..00000000000
--- a/libjava/java/lang/StackOverflowError.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* StackOverflowError.java -- thrown when the stack depth is exceeded
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A StackOverflowError
is thrown when the execution stack
- * overflow occurs. This often occurs when a method enters infinit recursion.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class StackOverflowError extends VirtualMachineError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 8609175038441759607L;
-
- /**
- * Create an error without a message.
- */
- public StackOverflowError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public StackOverflowError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/StackTraceElement.java b/libjava/java/lang/StackTraceElement.java
deleted file mode 100644
index 6dd4d8532e8..00000000000
--- a/libjava/java/lang/StackTraceElement.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/* StackTraceElement.java -- One function call or call stack element
- Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-import java.io.Serializable;
-
-/**
- * One function call or stack trace element. Gives information about
- * the execution point such as the source file name, the line number,
- * the fully qualified class name, the method name and whether this method
- * is native, if this information is known.
- *
- * @author Mark Wielaard (mark@klomp.org)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.4
- * @status updated to 1.4
- */
-public final class StackTraceElement implements Serializable
-{
- /**
- * Compatible with JDK 1.4+.
- */
- private static final long serialVersionUID = 6992337162326171013L;
-
- /**
- * The name of the file, null if unknown.
- *
- * @serial the source code filename, if known
- */
- private final String fileName;
-
- /**
- * The line number in the file, negative if unknown.
- *
- * @serial the source code line number, if known
- */
- private final int lineNumber;
-
- /**
- * The fully qualified class name, null if unknown.
- *
- * @serial the enclosing class, if known
- */
- private final String declaringClass;
-
- /**
- * The method name in the class, null if unknown.
- *
- * @serial the enclosing method, if known
- */
- private final String methodName;
-
- /** Whether the method is native. */
- private final transient boolean isNative;
-
- /**
- * A package local constructor for the StackTraceElement class, to be
- * called by the Virtual Machine as part of Throwable.fillInStackTrace.
- * There are no public constructors defined for this class. Creation
- * of new elements is implementation specific.
- *
- * @param fileName the name of the file, null if unknown
- * @param lineNumber the line in the file, negative if unknown
- * @param className the fully qualified name of the class, null if unknown
- * @param methodName the name of the method, null if unknown
- * @param isNative true if native, false otherwise
- */
- StackTraceElement(String fileName, int lineNumber, String className,
- String methodName, boolean isNative)
- {
- this.fileName = fileName;
- this.lineNumber = lineNumber;
- this.declaringClass = className;
- this.methodName = methodName;
- this.isNative = isNative;
- }
-
- /**
- * Returns the name of the file, or null if unknown. This is usually
- * obtained from the SourceFile
attribute of the class file
- * format, if present.
- *
- * @return the file name
- */
- public String getFileName()
- {
- return fileName;
- }
-
- /**
- * Returns the line number in the file, or a negative number if unknown.
- * This is usually obtained from the LineNumberTable
attribute
- * of the method in the class file format, if present.
- *
- * @return the line number
- */
- public int getLineNumber()
- {
- return lineNumber;
- }
-
- /**
- * Returns the fully qualified class name, or null if unknown.
- *
- * @return the class name
- */
- public String getClassName()
- {
- return declaringClass;
- }
-
- /**
- * Returns the method name in the class, or null if unknown. If the
- * execution point is in a constructor, the name is
- * <init>
; if the execution point is in the class
- * initializer, the name is <clinit>
.
- *
- * @return the method name
- */
- public String getMethodName()
- {
- return methodName;
- }
-
- /**
- * Returns true if the method is native, or false if it is not or unknown.
- *
- * @return whether the method is native
- */
- public boolean isNativeMethod()
- {
- return isNative;
- }
-
- /**
- * Returns a string representation of this stack trace element. The
- * returned String is implementation specific. This implementation
- * returns the following String: "[class][.][method]([file][:line])".
- * If the fully qualified class name or the method is unknown it is
- * omitted including the point seperator. If the source file name is
- * unknown it is replaced by "Unknown Source" if the method is not native
- * or by "Native Method" if the method is native. If the line number
- * is unknown it and the colon are omitted.
- *
- * @return a string representation of this execution point
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- if (declaringClass != null)
- {
- sb.append(declaringClass);
- if (methodName != null)
- sb.append('.');
- }
- if (methodName != null)
- sb.append(methodName);
- sb.append(" (");
- if (fileName != null)
- sb.append(fileName);
- else
- sb.append(isNative ? "Native Method" : "Unknown Source");
- if (lineNumber >= 0)
- sb.append(':').append(lineNumber);
- sb.append(')');
- return sb.toString();
- }
-
- /**
- * Returns true if the given object is also a StackTraceElement and all
- * attributes, except the native flag, are equal (either the same attribute
- * between the two elments are null, or both satisfy Object.equals).
- *
- * @param o the object to compare
- * @return true if the two are equal
- */
- public boolean equals(Object o)
- {
- if (! (o instanceof StackTraceElement))
- return false;
- StackTraceElement e = (StackTraceElement) o;
- return equals(fileName, e.fileName)
- && lineNumber == e.lineNumber
- && equals(declaringClass, e.declaringClass)
- && equals(methodName, e.methodName);
- }
-
- /**
- * Returns the hashCode of this StackTraceElement. This implementation
- * computes the hashcode by xor-ing the hashcode of all attributes except
- * the native flag.
- *
- * @return the hashcode
- */
- public int hashCode()
- {
- return hashCode(fileName) ^ lineNumber ^ hashCode(declaringClass)
- ^ hashCode(methodName);
- }
-
- /**
- * Compare two objects according to Collection semantics.
- *
- * @param o1 the first object
- * @param o2 the second object
- * @return o1 == null ? o2 == null : o1.equals(o2)
- */
- private static boolean equals(Object o1, Object o2)
- {
- return o1 == null ? o2 == null : o1.equals(o2);
- }
-
- /**
- * Hash an object according to Collection semantics.
- *
- * @param o the object to hash
- * @return o1 == null ? 0 : o1.hashCode()
- */
- private static int hashCode(Object o)
- {
- return o == null ? 0 : o.hashCode();
- }
-}
diff --git a/libjava/java/lang/StrictMath.java b/libjava/java/lang/StrictMath.java
deleted file mode 100644
index 32bd3540d80..00000000000
--- a/libjava/java/lang/StrictMath.java
+++ /dev/null
@@ -1,1844 +0,0 @@
-/* java.lang.StrictMath -- common mathematical functions, strict Java
- Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-/*
- * Some of the algorithms in this class are in the public domain, as part
- * of fdlibm (freely-distributable math library), available at
- * http://www.netlib.org/fdlibm/, and carry the following copyright:
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-package java.lang;
-
-import gnu.classpath.Configuration;
-
-import java.util.Random;
-
-/**
- * Helper class containing useful mathematical functions and constants.
- * This class mirrors {@link Math}, but is 100% portable, because it uses
- * no native methods whatsoever. Also, these algorithms are all accurate
- * to less than 1 ulp, and execute in strictfp
mode, while
- * Math is allowed to vary in its results for some functions. Unfortunately,
- * this usually means StrictMath has less efficiency and speed, as Math can
- * use native methods.
- *
- *
- * http://www.netlib.org/fdlibm/
- *
- * Note that angles are specified in radians. Conversion functions are
- * provided for your convenience.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.3
- */
-public final strictfp class StrictMath
-{
- /**
- * StrictMath is non-instantiable.
- */
- private StrictMath()
- {
- }
-
- /**
- * A random number generator, initialized on first use.
- *
- * @see #random()
- */
- private static Random rand;
-
- /**
- * The most accurate approximation to the mathematical constant e:
- * 2.718281828459045
. Used in natural log and exp.
- *
- * @see #log(double)
- * @see #exp(double)
- */
- public static final double E
- = 2.718281828459045; // Long bits 0x4005bf0z8b145769L.
-
- /**
- * The most accurate approximation to the mathematical constant pi:
- * 3.141592653589793
. This is the ratio of a circle's diameter
- * to its circumference.
- */
- public static final double PI
- = 3.141592653589793; // Long bits 0x400921fb54442d18L.
-
- /**
- * Take the absolute value of the argument. (Absolute value means make
- * it positive.)
- *
- *
- *
log()
. If the
- * argument is NaN, the result is NaN; if the argument is positive infinity,
- * the result is positive infinity; and if the argument is negative
- * infinity, the result is positive zero.
- *
- * @param x the number to raise to the power
- * @return the number raised to the power of e
- * @see #log(double)
- * @see #pow(double, double)
- */
- public static double exp(double x)
- {
- if (x != x)
- return x;
- if (x > EXP_LIMIT_H)
- return Double.POSITIVE_INFINITY;
- if (x < EXP_LIMIT_L)
- return 0;
-
- // Argument reduction.
- double hi;
- double lo;
- int k;
- double t = abs(x);
- if (t > 0.5 * LN2)
- {
- if (t < 1.5 * LN2)
- {
- hi = t - LN2_H;
- lo = LN2_L;
- k = 1;
- }
- else
- {
- k = (int) (INV_LN2 * t + 0.5);
- hi = t - k * LN2_H;
- lo = k * LN2_L;
- }
- if (x < 0)
- {
- hi = -hi;
- lo = -lo;
- k = -k;
- }
- x = hi - lo;
- }
- else if (t < 1 / TWO_28)
- return 1;
- else
- lo = hi = k = 0;
-
- // Now x is in primary range.
- t = x * x;
- double c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));
- if (k == 0)
- return 1 - (x * c / (c - 2) - x);
- double y = 1 - (lo - x * c / (2 - c) - hi);
- return scale(y, k);
- }
-
- /**
- * Take ln(a) (the natural log). The opposite of exp()
. If the
- * argument is NaN or negative, the result is NaN; if the argument is
- * positive infinity, the result is positive infinity; and if the argument
- * is either zero, the result is negative infinity.
- *
- * ln(a) / ln(b)
.
- *
- * @param x the number to take the natural log of
- * @return the natural log of a
- * @see #exp(double)
- */
- public static double log(double x)
- {
- if (x == 0)
- return Double.NEGATIVE_INFINITY;
- if (x < 0)
- return Double.NaN;
- if (! (x < Double.POSITIVE_INFINITY))
- return x;
-
- // Normalize x.
- long bits = Double.doubleToLongBits(x);
- int exp = (int) (bits >> 52);
- if (exp == 0) // Subnormal x.
- {
- x *= TWO_54;
- bits = Double.doubleToLongBits(x);
- exp = (int) (bits >> 52) - 54;
- }
- exp -= 1023; // Unbias exponent.
- bits = (bits & 0x000fffffffffffffL) | 0x3ff0000000000000L;
- x = Double.longBitsToDouble(bits);
- if (x >= SQRT_2)
- {
- x *= 0.5;
- exp++;
- }
- x--;
- if (abs(x) < 1 / TWO_20)
- {
- if (x == 0)
- return exp * LN2_H + exp * LN2_L;
- double r = x * x * (0.5 - 1 / 3.0 * x);
- if (exp == 0)
- return x - r;
- return exp * LN2_H - ((r - exp * LN2_L) - x);
- }
- double s = x / (2 + x);
- double z = s * s;
- double w = z * z;
- double t1 = w * (LG2 + w * (LG4 + w * LG6));
- double t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7)));
- double r = t2 + t1;
- if (bits >= 0x3ff6174a00000000L && bits < 0x3ff6b85200000000L)
- {
- double h = 0.5 * x * x; // Need more accuracy for x near sqrt(2).
- if (exp == 0)
- return x - (h - s * (h + r));
- return exp * LN2_H - ((h - (s * (h + r) + exp * LN2_L)) - x);
- }
- if (exp == 0)
- return x - s * (x - r);
- return exp * LN2_H - ((s * (x - r) - exp * LN2_L) - x);
- }
-
- /**
- * Take a square root. If the argument is NaN or negative, the result is
- * NaN; if the argument is positive infinity, the result is positive
- * infinity; and if the result is either zero, the result is the same.
- *
- *
- *
x - y * n
, where n is the closest
- * double to x / y
(ties go to the even n); for a zero
- * remainder, the sign is that of x
. If either argument is NaN,
- * the first argument is infinite, or the second argument is zero, the result
- * is NaN; if x is finite but y is infinite, the result is x.
- *
- * @param x the dividend (the top half)
- * @param y the divisor (the bottom half)
- * @return the IEEE 754-defined floating point remainder of x/y
- * @see #rint(double)
- */
- public static double IEEEremainder(double x, double y)
- {
- // Purge off exception values.
- if (x == Double.NEGATIVE_INFINITY || ! (x < Double.POSITIVE_INFINITY)
- || y == 0 || y != y)
- return Double.NaN;
-
- boolean negative = x < 0;
- x = abs(x);
- y = abs(y);
- if (x == y || x == 0)
- return 0 * x; // Get correct sign.
-
- // Achieve x < 2y, then take first shot at remainder.
- if (y < TWO_1023)
- x %= y + y;
-
- // Now adjust x to get correct precision.
- if (y < 4 / TWO_1023)
- {
- if (x + x > y)
- {
- x -= y;
- if (x + x >= y)
- x -= y;
- }
- }
- else
- {
- y *= 0.5;
- if (x > y)
- {
- x -= y;
- if (x >= y)
- x -= y;
- }
- }
- return negative ? -x : x;
- }
-
- /**
- * Take the nearest integer that is that is greater than or equal to the
- * argument. If the argument is NaN, infinite, or zero, the result is the
- * same; if the argument is between -1 and 0, the result is negative zero.
- * Note that Math.ceil(x) == -Math.floor(-x)
.
- *
- * @param a the value to act upon
- * @return the nearest integer >= a
- */
- public static double ceil(double a)
- {
- return -floor(-a);
- }
-
- /**
- * Take the nearest integer that is that is less than or equal to the
- * argument. If the argument is NaN, infinite, or zero, the result is the
- * same. Note that Math.ceil(x) == -Math.floor(-x)
.
- *
- * @param a the value to act upon
- * @return the nearest integer <= a
- */
- public static double floor(double a)
- {
- double x = abs(a);
- if (! (x < TWO_52) || (long) a == a)
- return a; // No fraction bits; includes NaN and infinity.
- if (x < 1)
- return a >= 0 ? 0 * a : -1; // Worry about signed zero.
- return a < 0 ? (long) a - 1.0 : (long) a; // Cast to long truncates.
- }
-
- /**
- * Take the nearest integer to the argument. If it is exactly between
- * two integers, the even integer is taken. If the argument is NaN,
- * infinite, or zero, the result is the same.
- *
- * @param a the value to act upon
- * @return the nearest integer to a
- */
- public static double rint(double a)
- {
- double x = abs(a);
- if (! (x < TWO_52))
- return a; // No fraction bits; includes NaN and infinity.
- if (x <= 0.5)
- return 0 * a; // Worry about signed zero.
- if (x % 2 <= 0.5)
- return (long) a; // Catch round down to even.
- return (long) (a + (a < 0 ? -0.5 : 0.5)); // Cast to long truncates.
- }
-
- /**
- * Take the nearest integer to the argument. This is equivalent to
- * (int) Math.floor(f + 0.5f)
. If the argument is NaN, the
- * result is 0; otherwise if the argument is outside the range of int, the
- * result will be Integer.MIN_VALUE or Integer.MAX_VALUE, as appropriate.
- *
- * @param f the argument to round
- * @return the nearest integer to the argument
- * @see Integer#MIN_VALUE
- * @see Integer#MAX_VALUE
- */
- public static int round(float f)
- {
- return (int) floor(f + 0.5f);
- }
-
- /**
- * Take the nearest long to the argument. This is equivalent to
- * (long) Math.floor(d + 0.5)
. If the argument is NaN, the
- * result is 0; otherwise if the argument is outside the range of long, the
- * result will be Long.MIN_VALUE or Long.MAX_VALUE, as appropriate.
- *
- * @param d the argument to round
- * @return the nearest long to the argument
- * @see Long#MIN_VALUE
- * @see Long#MAX_VALUE
- */
- public static long round(double d)
- {
- return (long) floor(d + 0.5);
- }
-
- /**
- * Get a random number. This behaves like Random.nextDouble(), seeded by
- * System.currentTimeMillis() when first called. In other words, the number
- * is from a pseudorandom sequence, and lies in the range [+0.0, 1.0).
- * This random sequence is only used by this method, and is threadsafe,
- * although you may want your own random number generator if it is shared
- * among threads.
- *
- * @return a random number
- * @see Random#nextDouble()
- * @see System#currentTimeMillis()
- */
- public static synchronized double random()
- {
- if (rand == null)
- rand = new Random();
- return rand.nextDouble();
- }
-
- /**
- * Convert from degrees to radians. The formula for this is
- * radians = degrees * (pi/180); however it is not always exact given the
- * limitations of floating point numbers.
- *
- * @param degrees an angle in degrees
- * @return the angle in radians
- */
- public static double toRadians(double degrees)
- {
- return (degrees * PI) / 180;
- }
-
- /**
- * Convert from radians to degrees. The formula for this is
- * degrees = radians * (180/pi); however it is not always exact given the
- * limitations of floating point numbers.
- *
- * @param rads an angle in radians
- * @return the angle in degrees
- */
- public static double toDegrees(double rads)
- {
- return (rads * 180) / PI;
- }
-
- /**
- * Constants for scaling and comparing doubles by powers of 2. The compiler
- * must automatically inline constructs like (1/TWO_54), so we don't list
- * negative powers of two here.
- */
- private static final double
- TWO_16 = 0x10000, // Long bits 0x40f0000000000000L.
- TWO_20 = 0x100000, // Long bits 0x4130000000000000L.
- TWO_24 = 0x1000000, // Long bits 0x4170000000000000L.
- TWO_27 = 0x8000000, // Long bits 0x41a0000000000000L.
- TWO_28 = 0x10000000, // Long bits 0x41b0000000000000L.
- TWO_29 = 0x20000000, // Long bits 0x41c0000000000000L.
- TWO_31 = 0x80000000L, // Long bits 0x41e0000000000000L.
- TWO_49 = 0x2000000000000L, // Long bits 0x4300000000000000L.
- TWO_52 = 0x10000000000000L, // Long bits 0x4330000000000000L.
- TWO_54 = 0x40000000000000L, // Long bits 0x4350000000000000L.
- TWO_57 = 0x200000000000000L, // Long bits 0x4380000000000000L.
- TWO_60 = 0x1000000000000000L, // Long bits 0x43b0000000000000L.
- TWO_64 = 1.8446744073709552e19, // Long bits 0x43f0000000000000L.
- TWO_66 = 7.378697629483821e19, // Long bits 0x4410000000000000L.
- TWO_1023 = 8.98846567431158e307; // Long bits 0x7fe0000000000000L.
-
- /**
- * Super precision for 2/pi in 24-bit chunks, for use in
- * {@link #remPiOver2()}.
- */
- private static final int TWO_OVER_PI[] = {
- 0xa2f983, 0x6e4e44, 0x1529fc, 0x2757d1, 0xf534dd, 0xc0db62,
- 0x95993c, 0x439041, 0xfe5163, 0xabdebb, 0xc561b7, 0x246e3a,
- 0x424dd2, 0xe00649, 0x2eea09, 0xd1921c, 0xfe1deb, 0x1cb129,
- 0xa73ee8, 0x8235f5, 0x2ebb44, 0x84e99c, 0x7026b4, 0x5f7e41,
- 0x3991d6, 0x398353, 0x39f49c, 0x845f8b, 0xbdf928, 0x3b1ff8,
- 0x97ffde, 0x05980f, 0xef2f11, 0x8b5a0a, 0x6d1f6d, 0x367ecf,
- 0x27cb09, 0xb74f46, 0x3f669e, 0x5fea2d, 0x7527ba, 0xc7ebe5,
- 0xf17b3d, 0x0739f7, 0x8a5292, 0xea6bfb, 0x5fb11f, 0x8d5d08,
- 0x560330, 0x46fc7b, 0x6babf0, 0xcfbc20, 0x9af436, 0x1da9e3,
- 0x91615e, 0xe61b08, 0x659985, 0x5f14a0, 0x68408d, 0xffd880,
- 0x4d7327, 0x310606, 0x1556ca, 0x73a8c9, 0x60e27b, 0xc08c6b,
- };
-
- /**
- * Super precision for pi/2 in 24-bit chunks, for use in
- * {@link #remPiOver2()}.
- */
- private static final double PI_OVER_TWO[] = {
- 1.570796251296997, // Long bits 0x3ff921fb40000000L.
- 7.549789415861596e-8, // Long bits 0x3e74442d00000000L.
- 5.390302529957765e-15, // Long bits 0x3cf8469880000000L.
- 3.282003415807913e-22, // Long bits 0x3b78cc5160000000L.
- 1.270655753080676e-29, // Long bits 0x39f01b8380000000L.
- 1.2293330898111133e-36, // Long bits 0x387a252040000000L.
- 2.7337005381646456e-44, // Long bits 0x36e3822280000000L.
- 2.1674168387780482e-51, // Long bits 0x3569f31d00000000L.
- };
-
- /**
- * More constants related to pi, used in {@link #remPiOver2()} and
- * elsewhere.
- */
- private static final double
- PI_L = 1.2246467991473532e-16, // Long bits 0x3ca1a62633145c07L.
- PIO2_1 = 1.5707963267341256, // Long bits 0x3ff921fb54400000L.
- PIO2_1L = 6.077100506506192e-11, // Long bits 0x3dd0b4611a626331L.
- PIO2_2 = 6.077100506303966e-11, // Long bits 0x3dd0b4611a600000L.
- PIO2_2L = 2.0222662487959506e-21, // Long bits 0x3ba3198a2e037073L.
- PIO2_3 = 2.0222662487111665e-21, // Long bits 0x3ba3198a2e000000L.
- PIO2_3L = 8.4784276603689e-32; // Long bits 0x397b839a252049c1L.
-
- /**
- * Natural log and square root constants, for calculation of
- * {@link #exp(double)}, {@link #log(double)} and
- * {@link #power(double, double)}. CP is 2/(3*ln(2)).
- */
- private static final double
- SQRT_1_5 = 1.224744871391589, // Long bits 0x3ff3988e1409212eL.
- SQRT_2 = 1.4142135623730951, // Long bits 0x3ff6a09e667f3bcdL.
- SQRT_3 = 1.7320508075688772, // Long bits 0x3ffbb67ae8584caaL.
- EXP_LIMIT_H = 709.782712893384, // Long bits 0x40862e42fefa39efL.
- EXP_LIMIT_L = -745.1332191019411, // Long bits 0xc0874910d52d3051L.
- CP = 0.9617966939259756, // Long bits 0x3feec709dc3a03fdL.
- CP_H = 0.9617967009544373, // Long bits 0x3feec709e0000000L.
- CP_L = -7.028461650952758e-9, // Long bits 0xbe3e2fe0145b01f5L.
- LN2 = 0.6931471805599453, // Long bits 0x3fe62e42fefa39efL.
- LN2_H = 0.6931471803691238, // Long bits 0x3fe62e42fee00000L.
- LN2_L = 1.9082149292705877e-10, // Long bits 0x3dea39ef35793c76L.
- INV_LN2 = 1.4426950408889634, // Long bits 0x3ff71547652b82feL.
- INV_LN2_H = 1.4426950216293335, // Long bits 0x3ff7154760000000L.
- INV_LN2_L = 1.9259629911266175e-8; // Long bits 0x3e54ae0bf85ddf44L.
-
- /**
- * Constants for computing {@link #log(double)}.
- */
- private static final double
- LG1 = 0.6666666666666735, // Long bits 0x3fe5555555555593L.
- LG2 = 0.3999999999940942, // Long bits 0x3fd999999997fa04L.
- LG3 = 0.2857142874366239, // Long bits 0x3fd2492494229359L.
- LG4 = 0.22222198432149784, // Long bits 0x3fcc71c51d8e78afL.
- LG5 = 0.1818357216161805, // Long bits 0x3fc7466496cb03deL.
- LG6 = 0.15313837699209373, // Long bits 0x3fc39a09d078c69fL.
- LG7 = 0.14798198605116586; // Long bits 0x3fc2f112df3e5244L.
-
- /**
- * Constants for computing {@link #pow(double, double)}. L and P are
- * coefficients for series; OVT is -(1024-log2(ovfl+.5ulp)); and DP is ???.
- * The P coefficients also calculate {@link #exp(double)}.
- */
- private static final double
- L1 = 0.5999999999999946, // Long bits 0x3fe3333333333303L.
- L2 = 0.4285714285785502, // Long bits 0x3fdb6db6db6fabffL.
- L3 = 0.33333332981837743, // Long bits 0x3fd55555518f264dL.
- L4 = 0.272728123808534, // Long bits 0x3fd17460a91d4101L.
- L5 = 0.23066074577556175, // Long bits 0x3fcd864a93c9db65L.
- L6 = 0.20697501780033842, // Long bits 0x3fca7e284a454eefL.
- P1 = 0.16666666666666602, // Long bits 0x3fc555555555553eL.
- P2 = -2.7777777777015593e-3, // Long bits 0xbf66c16c16bebd93L.
- P3 = 6.613756321437934e-5, // Long bits 0x3f11566aaf25de2cL.
- P4 = -1.6533902205465252e-6, // Long bits 0xbebbbd41c5d26bf1L.
- P5 = 4.1381367970572385e-8, // Long bits 0x3e66376972bea4d0L.
- DP_H = 0.5849624872207642, // Long bits 0x3fe2b80340000000L.
- DP_L = 1.350039202129749e-8, // Long bits 0x3e4cfdeb43cfd006L.
- OVT = 8.008566259537294e-17; // Long bits 0x3c971547652b82feL.
-
- /**
- * Coefficients for computing {@link #sin(double)}.
- */
- private static final double
- S1 = -0.16666666666666632, // Long bits 0xbfc5555555555549L.
- S2 = 8.33333333332249e-3, // Long bits 0x3f8111111110f8a6L.
- S3 = -1.984126982985795e-4, // Long bits 0xbf2a01a019c161d5L.
- S4 = 2.7557313707070068e-6, // Long bits 0x3ec71de357b1fe7dL.
- S5 = -2.5050760253406863e-8, // Long bits 0xbe5ae5e68a2b9cebL.
- S6 = 1.58969099521155e-10; // Long bits 0x3de5d93a5acfd57cL.
-
- /**
- * Coefficients for computing {@link #cos(double)}.
- */
- private static final double
- C1 = 0.0416666666666666, // Long bits 0x3fa555555555554cL.
- C2 = -1.388888888887411e-3, // Long bits 0xbf56c16c16c15177L.
- C3 = 2.480158728947673e-5, // Long bits 0x3efa01a019cb1590L.
- C4 = -2.7557314351390663e-7, // Long bits 0xbe927e4f809c52adL.
- C5 = 2.087572321298175e-9, // Long bits 0x3e21ee9ebdb4b1c4L.
- C6 = -1.1359647557788195e-11; // Long bits 0xbda8fae9be8838d4L.
-
- /**
- * Coefficients for computing {@link #tan(double)}.
- */
- private static final double
- T0 = 0.3333333333333341, // Long bits 0x3fd5555555555563L.
- T1 = 0.13333333333320124, // Long bits 0x3fc111111110fe7aL.
- T2 = 0.05396825397622605, // Long bits 0x3faba1ba1bb341feL.
- T3 = 0.021869488294859542, // Long bits 0x3f9664f48406d637L.
- T4 = 8.8632398235993e-3, // Long bits 0x3f8226e3e96e8493L.
- T5 = 3.5920791075913124e-3, // Long bits 0x3f6d6d22c9560328L.
- T6 = 1.4562094543252903e-3, // Long bits 0x3f57dbc8fee08315L.
- T7 = 5.880412408202641e-4, // Long bits 0x3f4344d8f2f26501L.
- T8 = 2.464631348184699e-4, // Long bits 0x3f3026f71a8d1068L.
- T9 = 7.817944429395571e-5, // Long bits 0x3f147e88a03792a6L.
- T10 = 7.140724913826082e-5, // Long bits 0x3f12b80f32f0a7e9L.
- T11 = -1.8558637485527546e-5, // Long bits 0xbef375cbdb605373L.
- T12 = 2.590730518636337e-5; // Long bits 0x3efb2a7074bf7ad4L.
-
- /**
- * Coefficients for computing {@link #asin(double)} and
- * {@link #acos(double)}.
- */
- private static final double
- PS0 = 0.16666666666666666, // Long bits 0x3fc5555555555555L.
- PS1 = -0.3255658186224009, // Long bits 0xbfd4d61203eb6f7dL.
- PS2 = 0.20121253213486293, // Long bits 0x3fc9c1550e884455L.
- PS3 = -0.04005553450067941, // Long bits 0xbfa48228b5688f3bL.
- PS4 = 7.915349942898145e-4, // Long bits 0x3f49efe07501b288L.
- PS5 = 3.479331075960212e-5, // Long bits 0x3f023de10dfdf709L.
- QS1 = -2.403394911734414, // Long bits 0xc0033a271c8a2d4bL.
- QS2 = 2.0209457602335057, // Long bits 0x40002ae59c598ac8L.
- QS3 = -0.6882839716054533, // Long bits 0xbfe6066c1b8d0159L.
- QS4 = 0.07703815055590194; // Long bits 0x3fb3b8c5b12e9282L.
-
- /**
- * Coefficients for computing {@link #atan(double)}.
- */
- private static final double
- ATAN_0_5H = 0.4636476090008061, // Long bits 0x3fddac670561bb4fL.
- ATAN_0_5L = 2.2698777452961687e-17, // Long bits 0x3c7a2b7f222f65e2L.
- ATAN_1_5H = 0.982793723247329, // Long bits 0x3fef730bd281f69bL.
- ATAN_1_5L = 1.3903311031230998e-17, // Long bits 0x3c7007887af0cbbdL.
- AT0 = 0.3333333333333293, // Long bits 0x3fd555555555550dL.
- AT1 = -0.19999999999876483, // Long bits 0xbfc999999998ebc4L.
- AT2 = 0.14285714272503466, // Long bits 0x3fc24924920083ffL.
- AT3 = -0.11111110405462356, // Long bits 0xbfbc71c6fe231671L.
- AT4 = 0.09090887133436507, // Long bits 0x3fb745cdc54c206eL.
- AT5 = -0.0769187620504483, // Long bits 0xbfb3b0f2af749a6dL.
- AT6 = 0.06661073137387531, // Long bits 0x3fb10d66a0d03d51L.
- AT7 = -0.058335701337905735, // Long bits 0xbfadde2d52defd9aL.
- AT8 = 0.049768779946159324, // Long bits 0x3fa97b4b24760debL.
- AT9 = -0.036531572744216916, // Long bits 0xbfa2b4442c6a6c2fL.
- AT10 = 0.016285820115365782; // Long bits 0x3f90ad3ae322da11L.
-
- /**
- * Helper function for reducing an angle to a multiple of pi/2 within
- * [-pi/4, pi/4].
- *
- * @param x the angle; not infinity or NaN, and outside pi/4
- * @param y an array of 2 doubles modified to hold the remander x % pi/2
- * @return the quadrant of the result, mod 4: 0: [-pi/4, pi/4],
- * 1: [pi/4, 3*pi/4], 2: [3*pi/4, 5*pi/4], 3: [-3*pi/4, -pi/4]
- */
- private static int remPiOver2(double x, double[] y)
- {
- boolean negative = x < 0;
- x = abs(x);
- double z;
- int n;
- if (Configuration.DEBUG && (x <= PI / 4 || x != x
- || x == Double.POSITIVE_INFINITY))
- throw new InternalError("Assertion failure");
- if (x < 3 * PI / 4) // If |x| is small.
- {
- z = x - PIO2_1;
- if ((float) x != (float) (PI / 2)) // 33+53 bit pi is good enough.
- {
- y[0] = z - PIO2_1L;
- y[1] = z - y[0] - PIO2_1L;
- }
- else // Near pi/2, use 33+33+53 bit pi.
- {
- z -= PIO2_2;
- y[0] = z - PIO2_2L;
- y[1] = z - y[0] - PIO2_2L;
- }
- n = 1;
- }
- else if (x <= TWO_20 * PI / 2) // Medium size.
- {
- n = (int) (2 / PI * x + 0.5);
- z = x - n * PIO2_1;
- double w = n * PIO2_1L; // First round good to 85 bits.
- y[0] = z - w;
- if (n >= 32 || (float) x == (float) (w))
- {
- if (x / y[0] >= TWO_16) // Second iteration, good to 118 bits.
- {
- double t = z;
- w = n * PIO2_2;
- z = t - w;
- w = n * PIO2_2L - (t - z - w);
- y[0] = z - w;
- if (x / y[0] >= TWO_49) // Third iteration, 151 bits accuracy.
- {
- t = z;
- w = n * PIO2_3;
- z = t - w;
- w = n * PIO2_3L - (t - z - w);
- y[0] = z - w;
- }
- }
- }
- y[1] = z - y[0] - w;
- }
- else
- {
- // All other (large) arguments.
- int e0 = (int) (Double.doubleToLongBits(x) >> 52) - 1046;
- z = scale(x, -e0); // e0 = ilogb(z) - 23.
- double[] tx = new double[3];
- for (int i = 0; i < 2; i++)
- {
- tx[i] = (int) z;
- z = (z - tx[i]) * TWO_24;
- }
- tx[2] = z;
- int nx = 2;
- while (tx[nx] == 0)
- nx--;
- n = remPiOver2(tx, y, e0, nx);
- }
- if (negative)
- {
- y[0] = -y[0];
- y[1] = -y[1];
- return -n;
- }
- return n;
- }
-
- /**
- * Helper function for reducing an angle to a multiple of pi/2 within
- * [-pi/4, pi/4].
- *
- * @param x the positive angle, broken into 24-bit chunks
- * @param y an array of 2 doubles modified to hold the remander x % pi/2
- * @param e0 the exponent of x[0]
- * @param nx the last index used in x
- * @return the quadrant of the result, mod 4: 0: [-pi/4, pi/4],
- * 1: [pi/4, 3*pi/4], 2: [3*pi/4, 5*pi/4], 3: [-3*pi/4, -pi/4]
- */
- private static int remPiOver2(double[] x, double[] y, int e0, int nx)
- {
- int i;
- int ih;
- int n;
- double fw;
- double z;
- int[] iq = new int[20];
- double[] f = new double[20];
- double[] q = new double[20];
- boolean recompute = false;
-
- // Initialize jk, jz, jv, q0; note that 3>q0.
- int jk = 4;
- int jz = jk;
- int jv = max((e0 - 3) / 24, 0);
- int q0 = e0 - 24 * (jv + 1);
-
- // Set up f[0] to f[nx+jk] where f[nx+jk] = TWO_OVER_PI[jv+jk].
- int j = jv - nx;
- int m = nx + jk;
- for (i = 0; i <= m; i++, j++)
- f[i] = (j < 0) ? 0 : TWO_OVER_PI[j];
-
- // Compute q[0],q[1],...q[jk].
- for (i = 0; i <= jk; i++)
- {
- for (j = 0, fw = 0; j <= nx; j++)
- fw += x[j] * f[nx + i - j];
- q[i] = fw;
- }
-
- do
- {
- // Distill q[] into iq[] reversingly.
- for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--)
- {
- fw = (int) (1 / TWO_24 * z);
- iq[i] = (int) (z - TWO_24 * fw);
- z = q[j - 1] + fw;
- }
-
- // Compute n.
- z = scale(z, q0);
- z -= 8 * floor(z * 0.125); // Trim off integer >= 8.
- n = (int) z;
- z -= n;
- ih = 0;
- if (q0 > 0) // Need iq[jz-1] to determine n.
- {
- i = iq[jz - 1] >> (24 - q0);
- n += i;
- iq[jz - 1] -= i << (24 - q0);
- ih = iq[jz - 1] >> (23 - q0);
- }
- else if (q0 == 0)
- ih = iq[jz - 1] >> 23;
- else if (z >= 0.5)
- ih = 2;
-
- if (ih > 0) // If q > 0.5.
- {
- n += 1;
- int carry = 0;
- for (i = 0; i < jz; i++) // Compute 1-q.
- {
- j = iq[i];
- if (carry == 0)
- {
- if (j != 0)
- {
- carry = 1;
- iq[i] = 0x1000000 - j;
- }
- }
- else
- iq[i] = 0xffffff - j;
- }
- switch (q0)
- {
- case 1: // Rare case: chance is 1 in 12 for non-default.
- iq[jz - 1] &= 0x7fffff;
- break;
- case 2:
- iq[jz - 1] &= 0x3fffff;
- }
- if (ih == 2)
- {
- z = 1 - z;
- if (carry != 0)
- z -= scale(1, q0);
- }
- }
-
- // Check if recomputation is needed.
- if (z == 0)
- {
- j = 0;
- for (i = jz - 1; i >= jk; i--)
- j |= iq[i];
- if (j == 0) // Need recomputation.
- {
- int k;
- for (k = 1; iq[jk - k] == 0; k++); // k = no. of terms needed.
-
- for (i = jz + 1; i <= jz + k; i++) // Add q[jz+1] to q[jz+k].
- {
- f[nx + i] = TWO_OVER_PI[jv + i];
- for (j = 0, fw = 0; j <= nx; j++)
- fw += x[j] * f[nx + i - j];
- q[i] = fw;
- }
- jz += k;
- recompute = true;
- }
- }
- }
- while (recompute);
-
- // Chop off zero terms.
- if (z == 0)
- {
- jz--;
- q0 -= 24;
- while (iq[jz] == 0)
- {
- jz--;
- q0 -= 24;
- }
- }
- else // Break z into 24-bit if necessary.
- {
- z = scale(z, -q0);
- if (z >= TWO_24)
- {
- fw = (int) (1 / TWO_24 * z);
- iq[jz] = (int) (z - TWO_24 * fw);
- jz++;
- q0 += 24;
- iq[jz] = (int) fw;
- }
- else
- iq[jz] = (int) z;
- }
-
- // Convert integer "bit" chunk to floating-point value.
- fw = scale(1, q0);
- for (i = jz; i >= 0; i--)
- {
- q[i] = fw * iq[i];
- fw *= 1 / TWO_24;
- }
-
- // Compute PI_OVER_TWO[0,...,jk]*q[jz,...,0].
- double[] fq = new double[20];
- for (i = jz; i >= 0; i--)
- {
- fw = 0;
- for (int k = 0; k <= jk && k <= jz - i; k++)
- fw += PI_OVER_TWO[k] * q[i + k];
- fq[jz - i] = fw;
- }
-
- // Compress fq[] into y[].
- fw = 0;
- for (i = jz; i >= 0; i--)
- fw += fq[i];
- y[0] = (ih == 0) ? fw : -fw;
- fw = fq[0] - fw;
- for (i = 1; i <= jz; i++)
- fw += fq[i];
- y[1] = (ih == 0) ? fw : -fw;
- return n;
- }
-
- /**
- * Helper method for scaling a double by a power of 2.
- *
- * @param x the double
- * @param n the scale; |n| < 2048
- * @return x * 2**n
- */
- private static double scale(double x, int n)
- {
- if (Configuration.DEBUG && abs(n) >= 2048)
- throw new InternalError("Assertion failure");
- if (x == 0 || x == Double.NEGATIVE_INFINITY
- || ! (x < Double.POSITIVE_INFINITY) || n == 0)
- return x;
- long bits = Double.doubleToLongBits(x);
- int exp = (int) (bits >> 52) & 0x7ff;
- if (exp == 0) // Subnormal x.
- {
- x *= TWO_54;
- exp = ((int) (Double.doubleToLongBits(x) >> 52) & 0x7ff) - 54;
- }
- exp += n;
- if (exp > 0x7fe) // Overflow.
- return Double.POSITIVE_INFINITY * x;
- if (exp > 0) // Normal.
- return Double.longBitsToDouble((bits & 0x800fffffffffffffL)
- | ((long) exp << 52));
- if (exp <= -54)
- return 0 * x; // Underflow.
- exp += 54; // Subnormal result.
- x = Double.longBitsToDouble((bits & 0x800fffffffffffffL)
- | ((long) exp << 52));
- return x * (1 / TWO_54);
- }
-
- /**
- * Helper trig function; computes sin in range [-pi/4, pi/4].
- *
- * @param x angle within about pi/4
- * @param y tail of x, created by remPiOver2
- * @return sin(x+y)
- */
- private static double sin(double x, double y)
- {
- if (Configuration.DEBUG && abs(x + y) > 0.7854)
- throw new InternalError("Assertion failure");
- if (abs(x) < 1 / TWO_27)
- return x; // If |x| ~< 2**-27, already know answer.
-
- double z = x * x;
- double v = z * x;
- double r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6)));
- if (y == 0)
- return x + v * (S1 + z * r);
- return x - ((z * (0.5 * y - v * r) - y) - v * S1);
- }
-
- /**
- * Helper trig function; computes cos in range [-pi/4, pi/4].
- *
- * @param x angle within about pi/4
- * @param y tail of x, created by remPiOver2
- * @return cos(x+y)
- */
- private static double cos(double x, double y)
- {
- if (Configuration.DEBUG && abs(x + y) > 0.7854)
- throw new InternalError("Assertion failure");
- x = abs(x);
- if (x < 1 / TWO_27)
- return 1; // If |x| ~< 2**-27, already know answer.
-
- double z = x * x;
- double r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));
-
- if (x < 0.3)
- return 1 - (0.5 * z - (z * r - x * y));
-
- double qx = (x > 0.78125) ? 0.28125 : (x * 0.25);
- return 1 - qx - ((0.5 * z - qx) - (z * r - x * y));
- }
-
- /**
- * Helper trig function; computes tan in range [-pi/4, pi/4].
- *
- * @param x angle within about pi/4
- * @param y tail of x, created by remPiOver2
- * @param invert true iff -1/tan should be returned instead
- * @return tan(x+y)
- */
- private static double tan(double x, double y, boolean invert)
- {
- // PI/2 is irrational, so no double is a perfect multiple of it.
- if (Configuration.DEBUG && (abs(x + y) > 0.7854 || (x == 0 && invert)))
- throw new InternalError("Assertion failure");
- boolean negative = x < 0;
- if (negative)
- {
- x = -x;
- y = -y;
- }
- if (x < 1 / TWO_28) // If |x| ~< 2**-28, already know answer.
- return (negative ? -1 : 1) * (invert ? -1 / x : x);
-
- double z;
- double w;
- boolean large = x >= 0.6744;
- if (large)
- {
- z = PI / 4 - x;
- w = PI_L / 4 - y;
- x = z + w;
- y = 0;
- }
- z = x * x;
- w = z * z;
- // Break x**5*(T1+x**2*T2+...) into
- // x**5(T1+x**4*T3+...+x**20*T11)
- // + x**5(x**2*(T2+x**4*T4+...+x**22*T12)).
- double r = T1 + w * (T3 + w * (T5 + w * (T7 + w * (T9 + w * T11))));
- double v = z * (T2 + w * (T4 + w * (T6 + w * (T8 + w * (T10 + w * T12)))));
- double s = z * x;
- r = y + z * (s * (r + v) + y);
- r += T0 * s;
- w = x + r;
- if (large)
- {
- v = invert ? -1 : 1;
- return (negative ? -1 : 1) * (v - 2 * (x - (w * w / (w + v) - r)));
- }
- if (! invert)
- return w;
-
- // Compute -1.0/(x+r) accurately.
- z = (float) w;
- v = r - (z - x);
- double a = -1 / w;
- double t = (float) a;
- return t + a * (1 + t * z + t * v);
- }
-}
diff --git a/libjava/java/lang/StringIndexOutOfBoundsException.java b/libjava/java/lang/StringIndexOutOfBoundsException.java
deleted file mode 100644
index ebc4a04a391..00000000000
--- a/libjava/java/lang/StringIndexOutOfBoundsException.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* StringIndexOutOfBoundsException.java -- thrown to indicate attempt to
- exceed string bounds
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * This exception can be thrown to indicate an attempt to access an index
- * which is out of bounds of a String. Any negative integer, and a positive
- * integer greater than or equal to the size of the string, is an index
- * which would be out of bounds.
- *
- * @author Brian Jones
- * @author Warren Levy (warrenl@cygnus.com)
- * @status updated to 1.4
- */
-public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -6762910422159637258L;
-
- /**
- * Create an exception without a message.
- */
- public StringIndexOutOfBoundsException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public StringIndexOutOfBoundsException(String s)
- {
- super(s);
- }
-
- /**
- * Create an exception noting the illegal index.
- *
- * @param index the invalid index
- */
- public StringIndexOutOfBoundsException(int index)
- {
- super("String index out of range: " + index);
- }
-}
diff --git a/libjava/java/lang/ThreadDeath.java b/libjava/java/lang/ThreadDeath.java
deleted file mode 100644
index c7d88fb2a25..00000000000
--- a/libjava/java/lang/ThreadDeath.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ThreadDeath.java - special exception registering Thread death
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * ThreadDeath is thrown in a thread when someone calls stop()
- * on that thread. Important: Make sure you rethrow this exception
- * if you catch it. If you don't, the thread will not die.
- *
- * checkAccess
.
- *
- * @param name the name to use for the ThreadGroup
- * @throws SecurityException if the current thread cannot create a group
- * @see #checkAccess()
- */
- public ThreadGroup(String name)
- {
- this(Thread.currentThread().group, name);
- }
-
- /**
- * Create a new ThreadGroup using the given name and parent group. The new
- * group inherits the maximum priority and daemon status of its parent
- * group. There may be a security check, checkAccess
.
- *
- * @param name the name to use for the ThreadGroup
- * @param parent the ThreadGroup to use as a parent
- * @throws NullPointerException if parent is null
- * @throws SecurityException if the current thread cannot create a group
- * @throws IllegalThreadStateException if the parent is destroyed
- * @see #checkAccess()
- */
- public ThreadGroup(ThreadGroup parent, String name)
- {
- parent.checkAccess();
- this.parent = parent;
- this.name = name;
- maxpri = parent.maxpri;
- daemon_flag = parent.daemon_flag;
- synchronized (parent)
- {
- if (parent.groups == null)
- throw new IllegalThreadStateException();
- parent.groups.add(this);
- }
- }
-
- /**
- * Get the name of this ThreadGroup.
- *
- * @return the name of this ThreadGroup
- */
- public final String getName()
- {
- return name;
- }
-
- /**
- * Get the parent of this ThreadGroup. If the parent is not null, there
- * may be a security check, checkAccess
.
- *
- * @return the parent of this ThreadGroup
- * @throws SecurityException if permission is denied
- */
- public final ThreadGroup getParent()
- {
- if (parent != null)
- parent.checkAccess();
- return parent;
- }
-
- /**
- * Get the maximum priority of Threads in this ThreadGroup. Threads created
- * after this call in this group may not exceed this priority.
- *
- * @return the maximum priority of Threads in this ThreadGroup
- */
- public final int getMaxPriority()
- {
- return maxpri;
- }
-
- /**
- * Tell whether this ThreadGroup is a daemon group. A daemon group will
- * be automatically destroyed when its last thread is stopped and
- * its last thread group is destroyed.
- *
- * @return whether this ThreadGroup is a daemon group
- */
- public final boolean isDaemon()
- {
- return daemon_flag;
- }
-
- /**
- * Tell whether this ThreadGroup has been destroyed or not.
- *
- * @return whether this ThreadGroup has been destroyed or not
- * @since 1.1
- */
- public synchronized boolean isDestroyed()
- {
- return groups == null;
- }
-
- /**
- * Set whether this ThreadGroup is a daemon group. A daemon group will be
- * destroyed when its last thread is stopped and its last thread group is
- * destroyed. There may be a security check, checkAccess
.
- *
- * @param daemon whether this ThreadGroup should be a daemon group
- * @throws SecurityException if you cannot modify this ThreadGroup
- * @see #checkAccess()
- */
- public final void setDaemon(boolean daemon)
- {
- checkAccess();
- daemon_flag = daemon;
- }
-
- /**
- * Set the maximum priority for Threads in this ThreadGroup. setMaxPriority
- * can only be used to reduce the current maximum. If maxpri is greater
- * than the current Maximum of the parent group, the current value is not
- * changed. Otherwise, all groups which belong to this have their priority
- * adjusted as well. Calling this does not affect threads already in this
- * ThreadGroup. There may be a security check, checkAccess
.
- *
- * @param maxpri the new maximum priority for this ThreadGroup
- * @throws SecurityException if you cannot modify this ThreadGroup
- * @see #getMaxPriority()
- * @see #checkAccess()
- */
- public final synchronized void setMaxPriority(int maxpri)
- {
- checkAccess();
- if (maxpri < Thread.MIN_PRIORITY || maxpri > Thread.MAX_PRIORITY)
- return;
- if (parent != null && maxpri > parent.maxpri)
- maxpri = parent.maxpri;
- this.maxpri = maxpri;
- if (groups == null)
- return;
- int i = groups.size();
- while (--i >= 0)
- ((ThreadGroup) groups.get(i)).setMaxPriority(maxpri);
- }
-
- /**
- * Check whether this ThreadGroup is an ancestor of the specified
- * ThreadGroup, or if they are the same.
- *
- * @param group the group to test on
- * @return whether this ThreadGroup is a parent of the specified group
- */
- public final boolean parentOf(ThreadGroup group)
- {
- while (group != null)
- {
- if (group == this)
- return true;
- group = group.parent;
- }
- return false;
- }
-
- /**
- * Find out if the current Thread can modify this ThreadGroup. This passes
- * the check on to SecurityManager.checkAccess(this)
.
- *
- * @throws SecurityException if the current Thread cannot modify this
- * ThreadGroup
- * @see SecurityManager#checkAccess(ThreadGroup)
- */
- public final void checkAccess()
- {
- // Bypass System.getSecurityManager, for bootstrap efficiency.
- SecurityManager sm = SecurityManager.current;
- if (sm != null)
- sm.checkAccess(this);
- }
-
- /**
- * Return an estimate of the total number of active threads in this
- * ThreadGroup and all its descendants. This cannot return an exact number,
- * since the status of threads may change after they were counted; but it
- * should be pretty close. Based on a JDC bug,
- *
- * 4089701, we take active to mean isAlive().
- *
- * @return count of active threads in this ThreadGroup and its descendants
- */
- public int activeCount()
- {
- int total = 0;
- if (groups == null)
- return total;
- int i = threads.size();
- while (--i >= 0)
- if (((Thread) threads.get(i)).isAlive())
- total++;
- i = groups.size();
- while (--i >= 0)
- total += ((ThreadGroup) groups.get(i)).activeCount();
- return total;
- }
-
- /**
- * Copy all of the active Threads from this ThreadGroup and its descendants
- * into the specified array. If the array is not big enough to hold all
- * the Threads, extra Threads will simply not be copied. There may be a
- * security check, checkAccess
.
- *
- * @param array the array to put the threads into
- * @return the number of threads put into the array
- * @throws SecurityException if permission was denied
- * @throws NullPointerException if array is null
- * @throws ArrayStoreException if a thread does not fit in the array
- * @see #activeCount()
- * @see #checkAccess()
- * @see #enumerate(Thread[], boolean)
- */
- public int enumerate(Thread[] array)
- {
- return enumerate(array, 0, true);
- }
-
- /**
- * Copy all of the active Threads from this ThreadGroup and, if desired,
- * from its descendants, into the specified array. If the array is not big
- * enough to hold all the Threads, extra Threads will simply not be copied.
- * There may be a security check, checkAccess
.
- *
- * @param array the array to put the threads into
- * @param recurse whether to recurse into descendent ThreadGroups
- * @return the number of threads put into the array
- * @throws SecurityException if permission was denied
- * @throws NullPointerException if array is null
- * @throws ArrayStoreException if a thread does not fit in the array
- * @see #activeCount()
- * @see #checkAccess()
- */
- public int enumerate(Thread[] array, boolean recurse)
- {
- return enumerate(array, 0, recurse);
- }
-
- /**
- * Get the number of active groups in this ThreadGroup. This group itself
- * is not included in the count. A sub-group is active if it has not been
- * destroyed. This cannot return an exact number, since the status of
- * threads may change after they were counted; but it should be pretty close.
- *
- * @return the number of active groups in this ThreadGroup
- */
- public int activeGroupCount()
- {
- if (groups == null)
- return 0;
- int total = groups.size();
- int i = total;
- while (--i >= 0)
- total += ((ThreadGroup) groups.get(i)).activeGroupCount();
- return total;
- }
-
- /**
- * Copy all active ThreadGroups that are descendants of this ThreadGroup
- * into the specified array. If the array is not large enough to hold all
- * active ThreadGroups, extra ThreadGroups simply will not be copied. There
- * may be a security check, checkAccess
.
- *
- * @param array the array to put the ThreadGroups into
- * @return the number of ThreadGroups copied into the array
- * @throws SecurityException if permission was denied
- * @throws NullPointerException if array is null
- * @throws ArrayStoreException if a group does not fit in the array
- * @see #activeCount()
- * @see #checkAccess()
- * @see #enumerate(ThreadGroup[], boolean)
- */
- public int enumerate(ThreadGroup[] array)
- {
- return enumerate(array, 0, true);
- }
-
- /**
- * Copy all active ThreadGroups that are children of this ThreadGroup into
- * the specified array, and if desired, also all descendents. If the array
- * is not large enough to hold all active ThreadGroups, extra ThreadGroups
- * simply will not be copied. There may be a security check,
- * checkAccess
.
- *
- * @param array the array to put the ThreadGroups into
- * @param recurse whether to recurse into descendent ThreadGroups
- * @return the number of ThreadGroups copied into the array
- * @throws SecurityException if permission was denied
- * @throws NullPointerException if array is null
- * @throws ArrayStoreException if a group does not fit in the array
- * @see #activeCount()
- * @see #checkAccess()
- */
- public int enumerate(ThreadGroup[] array, boolean recurse)
- {
- return enumerate(array, 0, recurse);
- }
-
- /**
- * Stop all Threads in this ThreadGroup and its descendants.
- *
- * checkAccess()
, followed by further checks on each thread
- * being stopped.
- *
- * @throws SecurityException if permission is denied
- * @see #checkAccess()
- * @see Thread#stop(Throwable)
- * @deprecated unsafe operation, try not to use
- */
- public final synchronized void stop()
- {
- checkAccess();
- if (groups == null)
- return;
- int i = threads.size();
- while (--i >= 0)
- ((Thread) threads.get(i)).stop();
- i = groups.size();
- while (--i >= 0)
- ((ThreadGroup) groups.get(i)).stop();
- }
-
- /**
- * Interrupt all Threads in this ThreadGroup and its sub-groups. There may
- * be a security check, checkAccess
.
- *
- * @throws SecurityException if permission is denied
- * @see #checkAccess()
- * @see Thread#interrupt()
- * @since 1.2
- */
- public final synchronized void interrupt()
- {
- checkAccess();
- if (groups == null)
- return;
- int i = threads.size();
- while (--i >= 0)
- ((Thread) threads.get(i)).interrupt();
- i = groups.size();
- while (--i >= 0)
- ((ThreadGroup) groups.get(i)).interrupt();
- }
-
- /**
- * Suspend all Threads in this ThreadGroup and its descendants.
- *
- * checkAccess()
, followed by further checks on each thread
- * being suspended.
- *
- * @throws SecurityException if permission is denied
- * @see #checkAccess()
- * @see Thread#suspend()
- * @deprecated unsafe operation, try not to use
- */
- public final synchronized void suspend()
- {
- checkAccess();
- if (groups == null)
- return;
- int i = threads.size();
- while (--i >= 0)
- ((Thread) threads.get(i)).suspend();
- i = groups.size();
- while (--i >= 0)
- ((ThreadGroup) groups.get(i)).suspend();
- }
-
- /**
- * Resume all suspended Threads in this ThreadGroup and its descendants.
- * To mirror suspend(), there is a security check:
- * checkAccess()
, followed by further checks on each thread
- * being resumed.
- *
- * @throws SecurityException if permission is denied
- * @see #checkAccess()
- * @see Thread#suspend()
- * @deprecated pointless, since suspend is deprecated
- */
- public final synchronized void resume()
- {
- checkAccess();
- if (groups == null)
- return;
- int i = threads.size();
- while (--i >= 0)
- ((Thread) threads.get(i)).resume();
- i = groups.size();
- while (--i >= 0)
- ((ThreadGroup) groups.get(i)).resume();
- }
-
- /**
- * Destroy this ThreadGroup. The group must be empty, meaning that all
- * threads and sub-groups have completed execution. Daemon groups are
- * destroyed automatically. There may be a security check,
- * checkAccess
.
- *
- * @throws IllegalThreadStateException if the ThreadGroup is not empty, or
- * was previously destroyed
- * @throws SecurityException if permission is denied
- * @see #checkAccess()
- */
- public final synchronized void destroy()
- {
- checkAccess();
- if (! threads.isEmpty() || groups == null)
- throw new IllegalThreadStateException();
- int i = groups.size();
- while (--i >= 0)
- ((ThreadGroup) groups.get(i)).destroy();
- groups = null;
- if (parent != null)
- parent.removeGroup(this);
- }
-
- /**
- * Print out information about this ThreadGroup to System.out. This is
- * meant for debugging purposes. WARNING: This method is not secure,
- * and can print the name of threads to standard out even when you cannot
- * otherwise get at such threads.
- */
- public void list()
- {
- list("");
- }
-
- /**
- * When a Thread in this ThreadGroup does not catch an exception, the
- * virtual machine calls this method. The default implementation simply
- * passes the call to the parent; then in top ThreadGroup, it will
- * ignore ThreadDeath and print the stack trace of any other throwable.
- * Override this method if you want to handle the exception in a different
- * manner.
- *
- * @param thread the thread that exited
- * @param t the uncaught throwable
- * @throws NullPointerException if t is null
- * @see ThreadDeath
- * @see System#err
- * @see Throwable#printStackTrace()
- */
- public void uncaughtException(Thread thread, Throwable t)
- {
- if (parent != null)
- parent.uncaughtException(thread, t);
- else if (! (t instanceof ThreadDeath))
- {
- if (t == null)
- throw new NullPointerException();
- had_uncaught_exception = true;
- try
- {
- if (thread != null)
- System.err.print("Exception in thread \"" + thread.name + "\" ");
- t.printStackTrace(System.err);
- }
- catch (Throwable x)
- {
- // This means that something is badly screwed up with the runtime,
- // or perhaps someone overloaded the Throwable.printStackTrace to
- // die. In any case, try to deal with it gracefully.
- try
- {
- System.err.println(t);
- System.err.println("*** Got " + x
- + " while trying to print stack trace.");
- }
- catch (Throwable x2)
- {
- // Here, someone may have overloaded t.toString() or
- // x.toString() to die. Give up all hope; we can't even chain
- // the exception, because the chain would likewise die.
- System.err.println("*** Catastrophic failure while handling "
- + "uncaught exception.");
- throw new InternalError();
- }
- }
- }
- }
-
- /**
- * Originally intended to tell the VM whether it may suspend Threads in
- * low memory situations, this method was never implemented by Sun, and
- * is hence a no-op.
- *
- * @param allow whether to allow low-memory thread suspension; ignored
- * @return false
- * @since 1.1
- * @deprecated pointless, since suspend is deprecated
- */
- public boolean allowThreadSuspension(boolean allow)
- {
- return false;
- }
-
- /**
- * Return a human-readable String representing this ThreadGroup. The format
- * of the string is:
- * getClass().getName() + "[name=" + getName() + ",maxpri="
- * + getMaxPriority() + ']'
.
- *
- * @return a human-readable String representing this ThreadGroup
- */
- public String toString()
- {
- return getClass().getName() + "[name=" + name + ",maxpri=" + maxpri + ']';
- }
-
- /**
- * Implements enumerate.
- *
- * @param list the array to put the threads into
- * @param next the next open slot in the array
- * @param recurse whether to recurse into descendent ThreadGroups
- * @return the number of threads put into the array
- * @throws SecurityException if permission was denied
- * @throws NullPointerException if list is null
- * @throws ArrayStoreException if a thread does not fit in the array
- * @see #enumerate(Thread[])
- * @see #enumerate(Thread[], boolean)
- */
- private int enumerate(Thread[] list, int next, boolean recurse)
- {
- checkAccess();
- if (groups == null)
- return next;
- int i = threads.size();
- while (--i >= 0 && next < list.length)
- {
- Thread t = (Thread) threads.get(i);
- if (t.isAlive())
- list[next++] = t;
- }
- if (recurse)
- {
- i = groups.size();
- while (--i >= 0 && next < list.length)
- {
- ThreadGroup g = (ThreadGroup) groups.get(i);
- next = g.enumerate(list, next, true);
- }
- }
- return next;
- }
-
- /**
- * Implements enumerate.
- *
- * @param list the array to put the groups into
- * @param next the next open slot in the array
- * @param recurse whether to recurse into descendent ThreadGroups
- * @return the number of groups put into the array
- * @throws SecurityException if permission was denied
- * @throws NullPointerException if list is null
- * @throws ArrayStoreException if a group does not fit in the array
- * @see #enumerate(ThreadGroup[])
- * @see #enumerate(ThreadGroup[], boolean)
- */
- private int enumerate(ThreadGroup[] list, int next, boolean recurse)
- {
- checkAccess();
- if (groups == null)
- return next;
- int i = groups.size();
- while (--i >= 0 && next < list.length)
- {
- ThreadGroup g = (ThreadGroup) groups.get(i);
- list[next++] = g;
- if (recurse && next != list.length)
- next = g.enumerate(list, next, true);
- }
- return next;
- }
-
- /**
- * Implements list.
- *
- * @param indentation the current level of indentation
- * @see #list()
- */
- private void list(String indentation)
- {
- if (groups == null)
- return;
- System.out.println(indentation + this);
- indentation += " ";
- int i = threads.size();
- while (--i >= 0)
- System.out.println(indentation + threads.get(i));
- i = groups.size();
- while (--i >= 0)
- ((ThreadGroup) groups.get(i)).list(indentation);
- }
-
- /**
- * Add a thread to the group. Called by Thread constructors.
- *
- * @param t the thread to add, non-null
- * @throws IllegalThreadStateException if the group is destroyed
- */
- final synchronized void addThread(Thread t)
- {
- if (groups == null)
- throw new IllegalThreadStateException("ThreadGroup is destroyed");
- threads.add(t);
- }
-
- /**
- * Called by the VM to remove a thread that has died.
- *
- * @param t the thread to remove, non-null
- * @XXX A ThreadListener to call this might be nice.
- */
- final synchronized void removeThread(Thread t)
- {
- if (groups == null)
- return;
- threads.remove(t);
- t.group = null;
- // Daemon groups are automatically destroyed when all their threads die.
- if (daemon_flag && groups.size() == 0 && threads.size() == 0)
- {
- // We inline destroy to avoid the access check.
- groups = null;
- if (parent != null)
- parent.removeGroup(this);
- }
- }
-
- /**
- * Called when a group is destroyed, to remove it from its parent.
- *
- * @param g the destroyed group, non-null
- */
- final synchronized void removeGroup(ThreadGroup g)
- {
- groups.remove(g);
- // Daemon groups are automatically destroyed when all their threads die.
- if (daemon_flag && groups.size() == 0 && threads.size() == 0)
- {
- // We inline destroy to avoid the access check.
- groups = null;
- if (parent != null)
- parent.removeGroup(this);
- }
- }
-} // class ThreadGroup
diff --git a/libjava/java/lang/Throwable.java b/libjava/java/lang/Throwable.java
deleted file mode 100644
index c47a14bf040..00000000000
--- a/libjava/java/lang/Throwable.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/* java.lang.Throwable -- Root class for all Exceptions and Errors
- Copyright (C) 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.lang;
-
-import gnu.classpath.SystemProperties;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-
-/**
- * Throwable is the superclass of all exceptions that can be raised.
- *
- * throws
clauses. Everything
- * else is a checked exception, and is ususally a subclass of
- * {@link Exception}; these exceptions have to be handled or declared.
- *
- * initCause
method. This second
- * method is especially useful if the superclass has not been retrofitted
- * with new constructors:
- *
- * try
- * {
- * lowLevelOp();
- * }
- * catch (LowLevelException lle)
- * {
- * throw (HighLevelException) new HighLevelException().initCause(lle);
- * }
- *
- * Notice the cast in the above example; without it, your method would need
- * a throws clase that declared Throwable, defeating the purpose of chainig
- * your exceptions.
- *
- * this
until initialized.
- *
- * @serial the cause, or null if unknown, or this if not yet set
- * @since 1.4
- */
- private Throwable cause = this;
-
- /**
- * The stack trace, in a serialized form.
- *
- * @serial the elements of the stack trace; this is non-null, and has
- * no null entries
- * @since 1.4
- */
- private StackTraceElement[] stackTrace;
-
- /**
- * Instantiate this Throwable with an empty message. The cause remains
- * uninitialized. {@link #fillInStackTrace()} will be called to set
- * up the stack trace.
- */
- public Throwable()
- {
- this((String) null);
- }
-
- /**
- * Instantiate this Throwable with the given message. The cause remains
- * uninitialized. {@link #fillInStackTrace()} will be called to set
- * up the stack trace.
- *
- * @param message the message to associate with the Throwable
- */
- public Throwable(String message)
- {
- fillInStackTrace();
- detailMessage = message;
- }
-
- /**
- * Instantiate this Throwable with the given message and cause. Note that
- * the message is unrelated to the message of the cause.
- * {@link #fillInStackTrace()} will be called to set up the stack trace.
- *
- * @param message the message to associate with the Throwable
- * @param cause the cause, may be null
- * @since 1.4
- */
- public Throwable(String message, Throwable cause)
- {
- this(message);
- this.cause = cause;
- }
-
- /**
- * Instantiate this Throwable with the given cause. The message is then
- * built as cause == null ? null : cause.toString()
.
- * {@link #fillInStackTrace()} will be called to set up the stack trace.
- *
- * @param cause the cause, may be null
- * @since 1.4
- */
- public Throwable(Throwable cause)
- {
- this(cause == null ? null : cause.toString(), cause);
- }
-
- /**
- * Get the message associated with this Throwable.
- *
- * @return the error message associated with this Throwable, may be null
- */
- public String getMessage()
- {
- return detailMessage;
- }
-
- /**
- * Get a localized version of this Throwable's error message.
- * This method must be overridden in a subclass of Throwable
- * to actually produce locale-specific methods. The Throwable
- * implementation just returns getMessage().
- *
- * @return a localized version of this error message
- * @see #getMessage()
- * @since 1.1
- */
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- /**
- * Returns the cause of this exception, or null if the cause is not known
- * or non-existant. This cause is initialized by the new constructors,
- * or by calling initCause.
- *
- * @return the cause of this Throwable
- * @since 1.4
- */
- public Throwable getCause()
- {
- return cause == this ? null : cause;
- }
-
- /**
- * Initialize the cause of this Throwable. This may only be called once
- * during the object lifetime, including implicitly by chaining
- * constructors.
- *
- * @param cause the cause of this Throwable, may be null
- * @return this
- * @throws IllegalArgumentException if cause is this (a Throwable can't be
- * its own cause!)
- * @throws IllegalStateException if the cause has already been set
- * @since 1.4
- */
- public Throwable initCause(Throwable cause)
- {
- if (cause == this)
- throw new IllegalArgumentException();
- if (this.cause != this)
- throw new IllegalStateException();
- this.cause = cause;
- return this;
- }
-
- /**
- * Get a human-readable representation of this Throwable. The detail message
- * is retrieved by getLocalizedMessage(). Then, with a null detail
- * message, this string is simply the object's class name; otherwise
- * the string is getClass().getName() + ": " + message
.
- *
- * @return a human-readable String represting this Throwable
- */
- public String toString()
- {
- String msg = getLocalizedMessage();
- return getClass().getName() + (msg == null ? "" : ": " + msg);
- }
-
- /**
- * Print a stack trace to the standard error stream. This stream is the
- * current contents of System.err
. The first line of output
- * is the result of {@link #toString()}, and the remaining lines represent
- * the data created by {@link #fillInStackTrace()}. While the format is
- * unspecified, this implementation uses the suggested format, demonstrated
- * by this example:
- *
- * public class Junk
- * {
- * public static void main(String args[])
- * {
- * try
- * {
- * a();
- * }
- * catch(HighLevelException e)
- * {
- * e.printStackTrace();
- * }
- * }
- * static void a() throws HighLevelException
- * {
- * try
- * {
- * b();
- * }
- * catch(MidLevelException e)
- * {
- * throw new HighLevelException(e);
- * }
- * }
- * static void b() throws MidLevelException
- * {
- * c();
- * }
- * static void c() throws MidLevelException
- * {
- * try
- * {
- * d();
- * }
- * catch(LowLevelException e)
- * {
- * throw new MidLevelException(e);
- * }
- * }
- * static void d() throws LowLevelException
- * {
- * e();
- * }
- * static void e() throws LowLevelException
- * {
- * throw new LowLevelException();
- * }
- * }
- * class HighLevelException extends Exception
- * {
- * HighLevelException(Throwable cause) { super(cause); }
- * }
- * class MidLevelException extends Exception
- * {
- * MidLevelException(Throwable cause) { super(cause); }
- * }
- * class LowLevelException extends Exception
- * {
- * }
- *
- *
- * HighLevelException: MidLevelException: LowLevelException
- * at Junk.a(Junk.java:13)
- * at Junk.main(Junk.java:4)
- * Caused by: MidLevelException: LowLevelException
- * at Junk.c(Junk.java:23)
- * at Junk.b(Junk.java:17)
- * at Junk.a(Junk.java:11)
- * ... 1 more
- * Caused by: LowLevelException
- * at Junk.e(Junk.java:30)
- * at Junk.d(Junk.java:27)
- * at Junk.c(Junk.java:21)
- * ... 3 more
- *
- */
- public void printStackTrace()
- {
- printStackTrace(System.err);
- }
-
- /**
- * Print a stack trace to the specified PrintStream. See
- * {@link #printStackTrace()} for the sample format.
- *
- * @param s the PrintStream to write the trace to
- */
- public void printStackTrace(PrintStream s)
- {
- s.print(stackTraceString());
- }
-
- /**
- * Prints the exception, the detailed message and the stack trace
- * associated with this Throwable to the given PrintWriter
.
- * The actual output written is implemention specific. Use the result of
- * getStackTrace()
when more precise information is needed.
- *
- * toString()
method.
- *
- * Then for all elements given by getStackTrace
it prints
- * a line containing three spaces, the string "at " and the result of calling
- * the toString()
method on the StackTraceElement
- * object. If getStackTrace()
returns an empty array it prints
- * a line containing three spaces and the string
- * "<<No stacktrace available>>".
- *
- * Then if getCause()
doesn't return null it adds a line
- * starting with "Caused by: " and the result of calling
- * toString()
on the cause.
- *
- * Then for every cause (of a cause, etc) the stacktrace is printed the
- * same as for the top level Throwable
except that as soon
- * as all the remaining stack frames of the cause are the same as the
- * the last stack frames of the throwable that the cause is wrapped in
- * then a line starting with three spaces and the string "... X more" is
- * printed, where X is the number of remaining stackframes.
- *
- * @param pw the PrintWriter to write the trace to
- * @since 1.1
- */
- public void printStackTrace (PrintWriter pw)
- {
- pw.print(stackTraceString());
- }
-
- /*
- * We use inner class to avoid a static initializer in this basic class.
- */
- private static class StaticData
- {
- static final String nl = SystemProperties.getProperty("line.separator");
- }
-
- // Create whole stack trace in a stringbuffer so we don't have to print
- // it line by line. This prevents printing multiple stack traces from
- // different threads to get mixed up when written to the same PrintWriter.
- private String stackTraceString()
- {
- StringBuffer sb = new StringBuffer();
-
- // Main stacktrace
- StackTraceElement[] stack = getStackTrace();
- stackTraceStringBuffer(sb, this.toString(), stack, 0);
-
- // The cause(s)
- Throwable cause = getCause();
- while (cause != null)
- {
- // Cause start first line
- sb.append("Caused by: ");
-
- // Cause stacktrace
- StackTraceElement[] parentStack = stack;
- stack = cause.getStackTrace();
- if (parentStack == null || parentStack.length == 0)
- stackTraceStringBuffer(sb, cause.toString(), stack, 0);
- else
- {
- int equal = 0; // Count how many of the last stack frames are equal
- int frame = stack.length-1;
- int parentFrame = parentStack.length-1;
- while (frame > 0 && parentFrame > 0)
- {
- if (stack[frame].equals(parentStack[parentFrame]))
- {
- equal++;
- frame--;
- parentFrame--;
- }
- else
- break;
- }
- stackTraceStringBuffer(sb, cause.toString(), stack, equal);
- }
- cause = cause.getCause();
- }
-
- return sb.toString();
- }
-
- // Adds to the given StringBuffer a line containing the name and
- // all stacktrace elements minus the last equal ones.
- private static void stackTraceStringBuffer(StringBuffer sb, String name,
- StackTraceElement[] stack, int equal)
- {
- String nl = StaticData.nl;
- // (finish) first line
- sb.append(name);
- sb.append(nl);
-
- // The stacktrace
- if (stack == null || stack.length == 0)
- {
- sb.append(" <fillInStackTrace()
was
- * called).
- *
- * @return an array of stack trace information, as available from the VM
- * @since 1.4
- */
- public StackTraceElement[] getStackTrace()
- {
- if (stackTrace == null)
- if (vmState == null)
- stackTrace = new StackTraceElement[0];
- else
- {
- stackTrace = vmState.getStackTrace(this);
- vmState = null; // No longer needed
- }
-
- return stackTrace;
- }
-
- /**
- * Change the stack trace manually. This method is designed for remote
- * procedure calls, which intend to alter the stack trace before or after
- * serialization according to the context of the remote call.
- * UnknownError
is thrown when a serious but unknown
- * problem has occurred in the Java Virtual Machine.
- *
- * @author Brian Jones
- * @status updated to 1.4
- */
-public class UnknownError extends VirtualMachineError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 2524784860676771849L;
-
- /**
- * Create an error without a message.
- */
- public UnknownError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public UnknownError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/UnsatisfiedLinkError.java b/libjava/java/lang/UnsatisfiedLinkError.java
deleted file mode 100644
index 0d513d8e0ca..00000000000
--- a/libjava/java/lang/UnsatisfiedLinkError.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* UnsatisfiedLinkError.java -- thrown when a native method cannot be loaded
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A UnsatisfiedLinkError
is thrown if an appropriate
- * native language definition of a method declared native
- * cannot be found by the Java Virtual Machine.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @see Runtime
- * @status updated to 1.4
- */
-public class UnsatisfiedLinkError extends LinkageError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -4019343241616879428L;
-
- /**
- * Create an error without a message.
- */
- public UnsatisfiedLinkError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public UnsatisfiedLinkError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/UnsupportedClassVersionError.java b/libjava/java/lang/UnsupportedClassVersionError.java
deleted file mode 100644
index d6974b7694d..00000000000
--- a/libjava/java/lang/UnsupportedClassVersionError.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* UnsupportedClassVersionError.java -- thrown when a class file version
- exceeds the capability of the virtual machine
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * An UnsupportedClassVersionError
is thrown when the
- * Java Virtual Machine determines it does not support the major and minor
- * version numbers in the class file it is attempting to read.
- *
- * @author Brian Jones
- * @since 1.2
- * @status updated to 1.4
- */
-public class UnsupportedClassVersionError extends ClassFormatError
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -7123279212883497373L;
-
- /**
- * Create an error without a message.
- */
- public UnsupportedClassVersionError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public UnsupportedClassVersionError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/UnsupportedOperationException.java b/libjava/java/lang/UnsupportedOperationException.java
deleted file mode 100644
index 0387d0ee29d..00000000000
--- a/libjava/java/lang/UnsupportedOperationException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* UnsupportedOperationException.java -- thrown when an operation is not
- supported
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * This exception is thrown by an object when an operation is
- * requested of it that it does not support.
- *
- * @author Warren Levy (warrenl@cygnus.com)
- * @since 1.2
- * @status updated to 1.4
- */
-public class UnsupportedOperationException extends RuntimeException
-{
- /**
- * Compatible with JDK 1.2+.
- */
- private static final long serialVersionUID = -1242599979055084673L;
-
- /**
- * Create an exception without a message.
- */
- public UnsupportedOperationException()
- {
- }
-
- /**
- * Create an exception with a message.
- *
- * @param s the message
- */
- public UnsupportedOperationException(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/VerifyError.java b/libjava/java/lang/VerifyError.java
deleted file mode 100644
index 350ceaa5e95..00000000000
--- a/libjava/java/lang/VerifyError.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* VerifyError.java -- thrown when a class fails verification
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A VerifyError
is thrown if there is a security problem or
- * internal inconsistency in a class file as detected by the "verifier."
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public class VerifyError extends LinkageError
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 7001962396098498785L;
-
- /**
- * Create an error without a message.
- */
- public VerifyError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public VerifyError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/VirtualMachineError.java b/libjava/java/lang/VirtualMachineError.java
deleted file mode 100644
index 3062c4fe800..00000000000
--- a/libjava/java/lang/VirtualMachineError.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* VirtualMachineError.java -- thrown when the Virtual Machine has a problem
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang;
-
-/**
- * A VirtualMachineError
or its subclasses are thrown to
- * indicate there is something wrong with the Java Virtual Machine or that
- * it does not have the resources needed for it to continue execution.
- *
- * @author Brian Jones
- * @author Tom Tromey (tromey@cygnus.com)
- * @status updated to 1.4
- */
-public abstract class VirtualMachineError extends Error
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = 4161983926571568670L;
-
- /**
- * Create an error without a message.
- */
- public VirtualMachineError()
- {
- }
-
- /**
- * Create an error with a message.
- *
- * @param s the message
- */
- public VirtualMachineError(String s)
- {
- super(s);
- }
-}
diff --git a/libjava/java/lang/Void.java b/libjava/java/lang/Void.java
deleted file mode 100644
index 15035426830..00000000000
--- a/libjava/java/lang/Void.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Void.class - defines void.class
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.lang;
-
-
-/**
- * Void is a placeholder class so that the variable Void.TYPE
- * (also available as void.class
) can be supported for
- * reflection return types.
- *
- * void
is represented by this
- * Class
object.
- */
- public static final Class TYPE = VMClassLoader.getPrimitiveClass('V');
-
- /**
- * Void is non-instantiable.
- */
- private Void()
- {
- }
-}
diff --git a/libjava/java/lang/dtoa.c b/libjava/java/lang/dtoa.c
deleted file mode 100644
index 6d5ad3b422e..00000000000
--- a/libjava/java/lang/dtoa.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/****************************************************************
- *
- * The author of this software is David M. Gay.
- *
- * Copyright (c) 1991 by AT&T.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose without fee is hereby granted, provided that this entire notice
- * is included in all copies of any software which is or includes a copy
- * or modification of this software and in all copies of the supporting
- * documentation for such software.
- *
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY
- * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
- * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
- *
- ***************************************************************/
-
-/* Please send bug reports to
- David M. Gay
- AT&T Bell Laboratories, Room 2C-463
- 600 Mountain Avenue
- Murray Hill, NJ 07974-2070
- U.S.A.
- dmg@research.att.com or research!dmg
- */
-
-#include "mprec.h"
-#include get()
always
- * returns null.
- *
- * @author Jochen Hoenicke
- */
-public class PhantomReference
- extends Reference
-{
- /**
- * Creates a new phantom reference.
- * @param referent the object that should be watched.
- * @param q the queue that should be notified, if the referent was
- * finalized. This mustn't be null
.
- * @exception NullPointerException if q is null.
- */
- public PhantomReference(Object referent, ReferenceQueue q)
- {
- super(referent, q);
- }
-
- /**
- * Returns the object, this reference refers to.
- * @return null
, since the refered object may be
- * finalized and thus not accessible.
- */
- public Object get()
- {
- return null;
- }
-}
diff --git a/libjava/java/lang/ref/ReferenceQueue.java b/libjava/java/lang/ref/ReferenceQueue.java
deleted file mode 100644
index f4729f282be..00000000000
--- a/libjava/java/lang/ref/ReferenceQueue.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/* java.lang.ref.ReferenceQueue
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.ref;
-
-/**
- * This is the queue, where references can enqueue themselve on. Each
- * reference may be registered to a queue at initialization time and
- * will be appended to the queue, when the enqueue method is called.
- *
- * The enqueue method may be automatically called by the garbage
- * collector if it detects, that the object is only reachable through
- * the Reference objects.
- *
- * @author Jochen Hoenicke
- * @see Reference#enqueue()
- */
-public class ReferenceQueue
-{
- /**
- * This is a linked list of references. If this is null, the list is
- * empty. Otherwise this points to the first reference on the queue.
- * The first reference will point to the next reference via the
- * nextOnQueue
field. The last reference will point to
- * itself (not to null, since nextOnQueue
is used to
- * determine if a reference is enqueued).
- */
- private Reference first;
-
- /**
- * Creates a new empty reference queue.
- */
- public ReferenceQueue()
- {
- }
-
- /**
- * Checks if there is a reference on the queue, returning it
- * immediately. The reference will be dequeued.
- *
- * @return a reference on the queue, if there is one,
- * null
otherwise.
- */
- public synchronized Reference poll()
- {
- return dequeue();
- }
-
- /**
- * This is called by reference to enqueue itself on this queue.
- * @param ref the reference that should be enqueued.
- */
- synchronized void enqueue(Reference ref)
- {
- /* last reference will point to itself */
- ref.nextOnQueue = first == null ? ref : first;
- first = ref;
- /* this wakes only one remove thread. */
- notify();
- }
-
- /**
- * Remove a reference from the queue, if there is one.
- * @return the first element of the queue, or null if there isn't any.
- */
- private Reference dequeue()
- {
- if (first == null)
- return null;
-
- Reference result = first;
- first = (first == first.nextOnQueue) ? null : first.nextOnQueue;
- result.nextOnQueue = null;
- return result;
- }
-
- /**
- * Removes a reference from the queue, blocking for timeout
- * until a reference is enqueued.
- * @param timeout the timeout period in milliseconds, 0
means
- * wait forever.
- * @return the reference removed from the queue, or
- * null
if timeout period expired.
- * @exception InterruptedException if the wait was interrupted.
- */
- public synchronized Reference remove(long timeout)
- throws InterruptedException
- {
- if (first == null)
- {
- wait(timeout);
- }
-
- return dequeue();
- }
-
-
- /**
- * Removes a reference from the queue, blocking until a reference is
- * enqueued.
- *
- * @return the reference removed from the queue.
- * @exception InterruptedException if the wait was interrupted.
- */
- public Reference remove()
- throws InterruptedException
- {
- return remove(0L);
- }
-}
diff --git a/libjava/java/lang/ref/SoftReference.java b/libjava/java/lang/ref/SoftReference.java
deleted file mode 100644
index 97395eacdfa..00000000000
--- a/libjava/java/lang/ref/SoftReference.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* java.lang.ref.SoftReference
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.ref;
-
-/**
- * A soft reference will be cleared, if the object is only softly
- * reachable and the garbage collection needs more memory. The garbage
- * collection will use an intelligent strategy to determine which soft
- * references it should clear. This makes a soft reference ideal for
- * caches.
- *
- * @author Jochen Hoenicke
- */
-public class SoftReference
- extends Reference
-{
- /**
- * Create a new soft reference, that is not registered to any queue.
- * @param referent the object we refer to.
- */
- public SoftReference(Object referent)
- {
- super(referent);
- }
-
- /**
- * Create a new soft reference.
- * @param referent the object we refer to.
- * @param q the reference queue to register on.
- * @exception NullPointerException if q is null.
- */
- public SoftReference(Object referent, ReferenceQueue q)
- {
- super(referent, q);
- }
-
- /**
- * Returns the object, this reference refers to.
- * @return the object, this reference refers to, or null if the
- * reference was cleared.
- */
- public Object get()
- {
- /* Why is this overloaded???
- * Maybe for a kind of LRU strategy. */
- return super.get();
- }
-}
diff --git a/libjava/java/lang/ref/WeakReference.java b/libjava/java/lang/ref/WeakReference.java
deleted file mode 100644
index 9f758ca1eab..00000000000
--- a/libjava/java/lang/ref/WeakReference.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* java.lang.ref.WeakReference
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.ref;
-
-/**
- * A weak reference will be cleared, if the object is only weakly
- * reachable. It is useful for lookup tables, where you aren't
- * interested in an entry, if the key isn't reachable anymore.
- * WeakHashtable
is a complete implementation of such a
- * table.
- *
- * It is also useful to make objects unique: You create a set of weak
- * references to those objects, and when you create a new object you
- * look in this set, if the object already exists and return it. If
- * an object is not referenced anymore, the reference will
- * automatically cleared, and you may remove it from the set.
- *
- * @author Jochen Hoenicke
- * @see java.util.WeakHashtable
- */
-public class WeakReference
- extends Reference
-{
- /**
- * Create a new weak reference, that is not registered to any queue.
- * @param referent the object we refer to.
- */
- public WeakReference(Object referent)
- {
- super(referent);
- }
-
- /**
- * Create a new weak reference.
- * @param referent the object we refer to.
- * @param q the reference queue to register on.
- * @exception NullPointerException if q is null.
- */
- public WeakReference(Object referent, ReferenceQueue q)
- {
- super(referent, q);
- }
-}
diff --git a/libjava/java/lang/reflect/AccessibleObject.java b/libjava/java/lang/reflect/AccessibleObject.java
deleted file mode 100644
index 24418c971c7..00000000000
--- a/libjava/java/lang/reflect/AccessibleObject.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/* java.lang.reflect.AccessibleObject
- Copyright (C) 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-/**
- * This class is the superclass of various reflection classes, and
- * allows sufficiently trusted code to bypass normal restrictions to
- * do necessary things like invoke private methods outside of the
- * class during Serialization. If you don't have a good reason
- * to mess with this, don't try. Fortunately, there are adequate
- * security checks before you can set a reflection object as accessible.
- *
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Field
- * @see Constructor
- * @see Method
- * @see ReflectPermission
- * @since 1.2
- * @status updated to 1.4
- */
-public class AccessibleObject
-{
- /**
- * True if this object is marked accessible, which means the reflected
- * object bypasses normal security checks.
- */
- // default visibility for use by inherited classes
- boolean flag = false;
-
- /**
- * Only the three reflection classes that extend this can create an
- * accessible object. This is not serializable for security reasons.
- */
- protected AccessibleObject()
- {
- }
-
- /**
- * Return the accessibility status of this object.
- *
- * @return true if this object bypasses security checks
- */
- public boolean isAccessible()
- {
- return flag;
- }
-
- /**
- * Convenience method to set the flag on a number of objects with a single
- * security check. If a security manager exists, it is checked for
- * ReflectPermission("suppressAccessChecks")
.ReflectPermission("suppressAccessChecks")
.ReflectPermission("suppressAccessChecks")
.
- *
- * @throws SecurityException if permission is denied
- */
- private static void checkPermission()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new ReflectPermission("suppressAccessChecks"));
- }
-
- /**
- * Performs the actual accessibility change, this must always be invoked
- * after calling checkPermission.
- *
- * @param flag the desired status
- * @throws SecurityException if flag is true and this is a constructor
- * for java.lang.Class
.
- */
- private void secureSetAccessible(boolean flag)
- {
- if (flag &&
- (this instanceof Constructor
- && ((Constructor) this).getDeclaringClass() == Class.class))
- throw new SecurityException("Cannot make object accessible: " + this);
- this.flag = flag;
- }
-}
diff --git a/libjava/java/lang/reflect/InvocationHandler.java b/libjava/java/lang/reflect/InvocationHandler.java
deleted file mode 100644
index 208e621eedc..00000000000
--- a/libjava/java/lang/reflect/InvocationHandler.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/* java.lang.reflect.InvocationHandler - dynamically executes methods in
- proxy instances
- Copyright (C) 2001 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-/**
- * This interface defines an invocation handler. Suppose you are using
- * reflection, and found a method that requires that its parameter
- * be an object of a given interface. You want to call this method,
- * but have no idea what classes implement that interface. So, you can
- * create a {@link Proxy} instance, a convenient way to dynamically
- * generate a class that meets all the necessary properties of that
- * interface. But in order for the proxy instance to do any good, it
- * needs to know what to do when interface methods are invoked! So,
- * this interface is basically a cool wrapper that provides runtime
- * code generation needed by proxy instances.
- *
- *
- *
- *
- * Proxy.getInvocationHandler(proxy)
will return
- * this
!
- * @param method the reflected method to invoke on the proxy.
- * When this method is called by a Proxy object, 'method'
- * will be the reflection object owned by the declaring
- * class or interface, which may be a supertype of the
- * interfaces the proxy directly implements.
- * @param args the arguments passed to the original method, or
- * null
if the method takes no arguments.
- * (But also be prepared to handle a 0-length array).
- * Arguments of primitive type, such as boolean
- * or int
, are wrapped in the appropriate
- * class such as {@link Boolean} or {@link Integer}.
- * @return whatever is necessary to return from the wrapped method.
- * If the wrapped method is void
, the proxy
- * instance will ignore it. If the wrapped method returns
- * a primitive, this must be the correct wrapper type whose value
- * is exactly assignable to the appropriate type (no widening
- * will be performed); a null object in this case causes a
- * {@link NullPointerException}. In all remaining cases, if
- * the returned object is not assignment compatible to the
- * declared type of the original method, the proxy instance
- * will generate a {@link ClassCastException}.
- * @throws Throwable this interface is listed as throwing anything,
- * but the implementation should only throw unchecked
- * exceptions and exceptions listed in the throws clause of
- * all methods being overridden by the proxy instance. If
- * something is thrown that is not compatible with the throws
- * clause of all overridden methods, the proxy instance will
- * wrap the exception in an UndeclaredThrowableException.
- * Note that an exception listed in the throws clause of the
- * `method' parameter might not be declared in additional
- * interfaces also implemented by the proxy object.
- *
- * @see Proxy
- * @see UndeclaredThrowableException
- */
- Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable;
-
-}
diff --git a/libjava/java/lang/reflect/InvocationTargetException.java b/libjava/java/lang/reflect/InvocationTargetException.java
deleted file mode 100644
index af79d3a199d..00000000000
--- a/libjava/java/lang/reflect/InvocationTargetException.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* InvocationTargetException.java -- Wrapper exception for reflection
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-/**
- * InvocationTargetException is sort of a way to "wrap" whatever exception
- * comes up when a method or constructor is called via Reflection. As of
- * JDK 1.4, it was retrofitted to match the exception chaining of all other
- * exceptions, but getTargetException()
still works.
- *
- * @author John Keiser
- * @author Tom Tromey (tromey@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Method#invoke(Object,Object[])
- * @see Constructor#newInstance(Object[])
- * @since 1.1
- * @status updated to 1.4
- */
-public class InvocationTargetException extends Exception
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 4085088731926701167L;
-
- /**
- * The chained exception. This field is only around for serial compatibility.
- *
- * @serial the chained exception
- */
- private final Throwable target;
-
- /**
- * Construct an exception with null as the cause. The cause is initialized
- * to null.
- */
- protected InvocationTargetException()
- {
- this(null, null);
- }
-
- /**
- * Create an InvocationTargetException
using another
- * exception.
- *
- * @param targetException the exception to wrap
- */
- public InvocationTargetException(Throwable targetException)
- {
- this(targetException, null);
- }
-
- /**
- * Create an InvocationTargetException
using another
- * exception and an error message.
- *
- * @param targetException the exception to wrap
- * @param err an extra reason for the exception-throwing
- */
- public InvocationTargetException(Throwable targetException, String err)
- {
- super(err, targetException);
- target = targetException;
- }
-
- /**
- * Get the wrapped (targeted) exception.
- *
- * @return the targeted exception
- * @see #getCause()
- */
- public Throwable getTargetException()
- {
- return target;
- }
-
- /**
- * Returns the cause of this exception (which may be null).
- *
- * @return the cause
- * @since 1.4
- */
- public Throwable getCause()
- {
- return target;
- }
-}
diff --git a/libjava/java/lang/reflect/Member.java b/libjava/java/lang/reflect/Member.java
deleted file mode 100644
index 9983b275a94..00000000000
--- a/libjava/java/lang/reflect/Member.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* java.lang.reflect.Member - common query methods in reflection
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-/**
- * Member is an interface that represents any member of a class (field or
- * method) or a constructor. You can get information about the declaring
- * class, name or modifiers of the member with this interface.
- *
- * @author John Keiser
- * @author Per Bothner (bothner@cygnus.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Class
- * @see Field
- * @see Method
- * @see Constructor
- * @since 1.1
- * @status updated to 1.4
- */
-public interface Member
-{
- /**
- * Represents all members, whether public, private, protected or
- * package-protected, but only which are declared in this class.
- * Used in SecurityManager.checkMemberAccess() to determine the
- * type of members to access.
- * @see SecurityManager#checkMemberAccess()
- */
- int DECLARED = 1;
-
- /**
- * Represents public members only, but includes all inherited members.
- * Used in SecurityManager.checkMemberAccess() to determine the type of
- * members to access.
- * @see SecurityManager#checkMemberAccess()
- */
- int PUBLIC = 0;
-
- /**
- * Gets the class that declared this member. This is not the class where
- * this method was called, or even the class where this Member object
- * came to life, but the class that declares the member this represents.
- *
- * @return the class that declared this member
- */
- Class getDeclaringClass();
-
- /**
- * Gets the simple name of this member. This will be a valid Java
- * identifier, with no qualification.
- *
- * @return the name of this member
- */
- String getName();
-
- /**
- * Gets the modifiers this member uses. Use the Modifier
- * class to interpret the values.
- *
- * @return an integer representing the modifiers to this Member
- * @see Modifier
- */
- int getModifiers();
-}
diff --git a/libjava/java/lang/reflect/Proxy.java b/libjava/java/lang/reflect/Proxy.java
deleted file mode 100644
index dc1ac87e4e1..00000000000
--- a/libjava/java/lang/reflect/Proxy.java
+++ /dev/null
@@ -1,1615 +0,0 @@
-/* Proxy.java -- build a proxy class that implements reflected interfaces
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-import gnu.classpath.Configuration;
-import gnu.java.lang.reflect.TypeSignature;
-
-import java.io.Serializable;
-import java.security.ProtectionDomain;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class allows you to dynamically create an instance of any (or
- * even multiple) interfaces by reflection, and decide at runtime
- * how that instance will behave by giving it an appropriate
- * {@link InvocationHandler}. Proxy classes serialize specially, so
- * that the proxy object can be reused between VMs, without requiring
- * a persistent copy of the generated class code.
- *
- * Creation
- * To create a proxy for some interface Foo:
- *
- *
- * InvocationHandler handler = new MyInvocationHandler(...);
- * Class proxyClass = Proxy.getProxyClass(
- * Foo.class.getClassLoader(), new Class[] { Foo.class });
- * Foo f = (Foo) proxyClass
- * .getConstructor(new Class[] { InvocationHandler.class })
- * .newInstance(new Object[] { handler });
- *
- * or more simply:
- *
- * Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
- * new Class[] { Foo.class },
- * handler);
- *
- *
- * Dynamic Proxy Classes
- * A dynamic proxy class is created at runtime, and has the following
- * properties:
- *
- *
- *
- * public
and final
,
- * and is neither abstract
nor an inner class.Proxy Instances
- * A proxy instance is an instance of a proxy class. It has the
- * following properties, many of which follow from the properties of a
- * proxy class listed above:
- *
- *
- *
- * proxy instanceof Foo
will return true,
- * and the expression (Foo) proxy
will succeed without
- * a {@link ClassCastException}.Inheritance Issues
- * A proxy class may inherit a method from more than one interface.
- * The order in which interfaces are listed matters, because it determines
- * which reflected {@link Method} object will be passed to the invocation
- * handler. This means that the dynamically generated class cannot
- * determine through which interface a method is being invoked.
- *
- *
- * Class.forName(i.getName(), false, loader) == i
- * must be true.
- * Proxy.getProxyClass(loader, interfaces)
- * .getConstructor(new Class[] {InvocationHandler.class})
- * .newInstance(new Object[] {handler});
- *
- * except that it will not fail with the normal problems caused
- * by reflection. It can still fail for the same reasons documented
- * in getProxyClass, or if handler is null.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param interfaces the array of interfaces the proxy class implements,
- * may be empty, but not null
- * @param handler the invocation handler, may not be null
- * @return a proxy instance implementing the specified interfaces
- * @throws IllegalArgumentException if the constraints for getProxyClass
- * were violated, except for problems with null
- * @throws NullPointerException if `interfaces' is null or contains
- * a null entry, or if handler is null
- * @see #getProxyClass(ClassLoader, Class[])
- * @see Class#getConstructor(Class[])
- * @see Constructor#newInstance(Object[])
- */
- public static Object newProxyInstance(ClassLoader loader,
- Class[] interfaces,
- InvocationHandler handler)
- {
- try
- {
- // getProxyClass() and Proxy() throw the necessary exceptions
- return getProxyClass(loader, interfaces)
- .getConstructor(new Class[] {InvocationHandler.class})
- .newInstance(new Object[] {handler});
- }
- catch (RuntimeException e)
- {
- // Let IllegalArgumentException, NullPointerException escape.
- // assert e instanceof IllegalArgumentException
- // || e instanceof NullPointerException;
- throw e;
- }
- catch (InvocationTargetException e)
- {
- // Let wrapped NullPointerException escape.
- // assert e.getTargetException() instanceof NullPointerException
- throw (NullPointerException) e.getCause();
- }
- catch (Exception e)
- {
- // Covers InstantiationException, IllegalAccessException,
- // NoSuchMethodException, none of which should be generated
- // if the proxy class was generated correctly.
- // assert false;
- throw (Error) new InternalError("Unexpected: " + e).initCause(e);
- }
- }
-
- /**
- * Returns true if and only if the Class object is a dynamically created
- * proxy class (created by getProxyClass
or by the
- * syntactic sugar of newProxyInstance
).
- *
- * clazz.getSuperclass() == Proxy.class
), it will not
- * be spoofed by non-proxy classes that extend Proxy.
- *
- * @param clazz the class to check, must not be null
- * @return true if the class represents a proxy class
- * @throws NullPointerException if clazz is null
- */
- // This is synchronized on the off chance that another thread is
- // trying to add a class to the map at the same time we read it.
- public static synchronized boolean isProxyClass(Class clazz)
- {
- if (! Proxy.class.isAssignableFrom(clazz))
- return false;
- // This is a linear search, even though we could do an O(1) search
- // using new ProxyType(clazz.getClassLoader(), clazz.getInterfaces()).
- return proxyClasses.containsValue(clazz);
- }
-
- /**
- * Returns the invocation handler for the given proxy instance.Proxy.isProxyClass(proxy.getClass())
returns false.
- * @throws NullPointerException if proxy is null
- */
- public static InvocationHandler getInvocationHandler(Object proxy)
- {
- if (! isProxyClass(proxy.getClass()))
- throw new IllegalArgumentException("not a proxy instance");
- return ((Proxy) proxy).h;
- }
-
- /**
- * Optional native method to replace (and speed up) the pure Java
- * implementation of getProxyClass. Only needed if
- * Configuration.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the
- * work of both getProxyData0 and generateProxyClass0 with no
- * intermediate form in Java. The native code may safely assume that
- * this class must be created, and does not already exist.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param interfaces the interfaces the class will extend
- * @return the generated proxy class
- * @throws IllegalArgumentException if the constraints for getProxyClass
- * were violated, except for problems with null
- * @throws NullPointerException if `interfaces' is null or contains
- * a null entry, or if handler is null
- * @see Configuration#HAVE_NATIVE_GET_PROXY_CLASS
- * @see #getProxyClass(ClassLoader, Class[])
- * @see #getProxyData0(ClassLoader, Class[])
- * @see #generateProxyClass0(ProxyData)
- */
- private static native Class getProxyClass0(ClassLoader loader,
- Class[] interfaces);
-
- /**
- * Optional native method to replace (and speed up) the pure Java
- * implementation of getProxyData. Only needed if
- * Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code
- * may safely assume that a new ProxyData object must be created which
- * does not duplicate any existing ones.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param interfaces the interfaces the class will extend
- * @return all data that is required to make this proxy class
- * @throws IllegalArgumentException if the constraints for getProxyClass
- * were violated, except for problems with null
- * @throws NullPointerException if `interfaces' is null or contains
- * a null entry, or if handler is null
- * @see Configuration.HAVE_NATIVE_GET_PROXY_DATA
- * @see #getProxyClass(ClassLoader, Class[])
- * @see #getProxyClass0(ClassLoader, Class[])
- * @see ProxyType#getProxyData()
- */
- private static native ProxyData getProxyData0(ClassLoader loader,
- Class[] interfaces);
-
- /**
- * Optional native method to replace (and speed up) the pure Java
- * implementation of generateProxyClass. Only needed if
- * Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native
- * code may safely assume that a new Class must be created, and that
- * the ProxyData object does not describe any existing class.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param data the struct of information to convert to a Class. This
- * has already been verified for all problems except exceeding
- * VM limitations
- * @return the newly generated class
- * @throws IllegalArgumentException if VM limitations are exceeded
- * @see #getProxyClass(ClassLoader, Class[])
- * @see #getProxyClass0(ClassLoader, Class[])
- * @see ProxyData#generateProxyClass(ClassLoader)
- */
- private static native Class generateProxyClass0(ClassLoader loader,
- ProxyData data);
-
- /**
- * Helper class for mapping unique ClassLoader and interface combinations
- * to proxy classes.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
- private static final class ProxyType
- {
- /**
- * Store the class loader (may be null)
- */
- final ClassLoader loader;
-
- /**
- * Store the interfaces (never null, all elements are interfaces)
- */
- final Class[] interfaces;
-
- /**
- * Construct the helper object.
- *
- * @param loader the class loader to define the proxy class in; null
- * implies the bootstrap class loader
- * @param interfaces an array of interfaces
- */
- ProxyType(ClassLoader loader, Class[] interfaces)
- {
- if (loader == null)
- loader = ClassLoader.getSystemClassLoader();
- this.loader = loader;
- this.interfaces = interfaces;
- }
-
- /**
- * Calculates the hash code.
- *
- * @return a combination of the classloader and interfaces hashcodes.
- */
- public int hashCode()
- {
- //loader is always not null
- int hash = loader.hashCode();
- for (int i = 0; i < interfaces.length; i++)
- hash = hash * 31 + interfaces[i].hashCode();
- return hash;
- }
-
- // A more comprehensive comparison of two arrays,
- // ignore array element order, and
- // ignore redundant elements
- private static boolean sameTypes(Class arr1[], Class arr2[]) {
- if (arr1.length == 1 && arr2.length == 1) {
- return arr1[0] == arr2[0];
- }
-
- // total occurrance of elements of arr1 in arr2
- int total_occ_of_arr1_in_arr2 = 0;
- each_type:
- for (int i = arr1.length; --i >= 0; )
- {
- Class t = arr1[i];
- for (int j = i; --j >= 0; )
- {
- if (t == arr1[j])
- { //found duplicate type
- continue each_type;
- }
- }
-
- // count c(a unique element of arr1)'s
- // occurrences in arr2
- int occ_in_arr2 = 0;
- for (int j = arr2.length; --j >= 0; )
- {
- if (t == arr2[j])
- {
- ++occ_in_arr2;
- }
- }
- if (occ_in_arr2 == 0)
- { // t does not occur in arr2
- return false;
- }
-
- total_occ_of_arr1_in_arr2 += occ_in_arr2;
- }
- // now, each element of arr2 must have been visited
- return total_occ_of_arr1_in_arr2 == arr2.length;
- }
-
- /**
- * Calculates equality.
- *
- * @param the object to compare to
- * @return true if it is a ProxyType with same data
- */
- public boolean equals(Object other)
- {
- ProxyType pt = (ProxyType) other;
- if (loader != pt.loader || interfaces.length != pt.interfaces.length)
- return false;
- return sameTypes(interfaces, pt.interfaces);
- }
- } // class ProxyType
-
- /**
- * Helper class which allows hashing of a method name and signature
- * without worrying about return type, declaring class, or throws clause,
- * and which reduces the maximally common throws clause between two methods
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
- private static final class ProxySignature
- {
- /**
- * The core signatures which all Proxy instances handle.
- */
- static final HashMap coreMethods = new HashMap();
- static
- {
- try
- {
- ProxySignature sig
- = new ProxySignature(Object.class
- .getMethod("equals",
- new Class[] {Object.class}));
- coreMethods.put(sig, sig);
- sig = new ProxySignature(Object.class.getMethod("hashCode", null));
- coreMethods.put(sig, sig);
- sig = new ProxySignature(Object.class.getMethod("toString", null));
- coreMethods.put(sig, sig);
- }
- catch (Exception e)
- {
- // assert false;
- throw (Error) new InternalError("Unexpected: " + e).initCause(e);
- }
- }
-
- /**
- * The underlying Method object, never null
- */
- final Method method;
-
- /**
- * The set of compatible thrown exceptions, may be empty
- */
- final Set exceptions = new HashSet();
-
- /**
- * Construct a signature
- *
- * @param method the Method this signature is based on, never null
- */
- ProxySignature(Method method)
- {
- this.method = method;
- Class[] exc = method.getExceptionTypes();
- int i = exc.length;
- while (--i >= 0)
- {
- // discard unchecked exceptions
- if (Error.class.isAssignableFrom(exc[i])
- || RuntimeException.class.isAssignableFrom(exc[i]))
- continue;
- exceptions.add(exc[i]);
- }
- }
-
- /**
- * Given a method, make sure it's return type is identical
- * to this, and adjust this signature's throws clause appropriately
- *
- * @param other the signature to merge in
- * @throws IllegalArgumentException if the return types conflict
- */
- void checkCompatibility(ProxySignature other)
- {
- if (method.getReturnType() != other.method.getReturnType())
- throw new IllegalArgumentException("incompatible return types: "
- + method + ", " + other.method);
-
- // if you can think of a more efficient way than this O(n^2) search,
- // implement it!
- int size1 = exceptions.size();
- int size2 = other.exceptions.size();
- boolean[] valid1 = new boolean[size1];
- boolean[] valid2 = new boolean[size2];
- Iterator itr = exceptions.iterator();
- int pos = size1;
- while (--pos >= 0)
- {
- Class c1 = (Class) itr.next();
- Iterator itr2 = other.exceptions.iterator();
- int pos2 = size2;
- while (--pos2 >= 0)
- {
- Class c2 = (Class) itr2.next();
- if (c2.isAssignableFrom(c1))
- valid1[pos] = true;
- if (c1.isAssignableFrom(c2))
- valid2[pos2] = true;
- }
- }
- pos = size1;
- itr = exceptions.iterator();
- while (--pos >= 0)
- {
- itr.next();
- if (! valid1[pos])
- itr.remove();
- }
- pos = size2;
- itr = other.exceptions.iterator();
- while (--pos >= 0)
- {
- itr.next();
- if (! valid2[pos])
- itr.remove();
- }
- exceptions.addAll(other.exceptions);
- }
-
- /**
- * Calculates the hash code.
- *
- * @return a combination of name and parameter types
- */
- public int hashCode()
- {
- int hash = method.getName().hashCode();
- Class[] types = method.getParameterTypes();
- for (int i = 0; i < types.length; i++)
- hash = hash * 31 + types[i].hashCode();
- return hash;
- }
-
- /**
- * Calculates equality.
- *
- * @param the object to compare to
- * @return true if it is a ProxySignature with same data
- */
- public boolean equals(Object other)
- {
- ProxySignature ps = (ProxySignature) other;
- Class[] types1 = method.getParameterTypes();
- Class[] types2 = ps.method.getParameterTypes();
- if (! method.getName().equals(ps.method.getName())
- || types1.length != types2.length)
- return false;
- int i = types1.length;
- while (--i >= 0)
- if (types1[i] != types2[i])
- return false;
- return true;
- }
- } // class ProxySignature
-
- /**
- * A flat representation of all data needed to generate bytecode/instantiate
- * a proxy class. This is basically a struct.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
- private static final class ProxyData
- {
- /**
- * The package this class is in including the trailing dot
- * or an empty string for the unnamed (aka default) package.
- */
- String pack;
-
- /**
- * The interfaces this class implements. Non-null, but possibly empty.
- */
- Class[] interfaces;
-
- /**
- * The Method objects this class must pass as the second argument to
- * invoke (also useful for determining what methods this class has).
- * Non-null, non-empty (includes at least Object.hashCode, Object.equals,
- * and Object.toString).
- */
- Method[] methods;
-
- /**
- * The exceptions that do not need to be wrapped in
- * UndeclaredThrowableException. exceptions[i] is the same as, or a
- * subset of subclasses, of methods[i].getExceptionTypes(), depending on
- * compatible throws clauses with multiple inheritance. It is unspecified
- * if these lists include or exclude subclasses of Error and
- * RuntimeException, but excluding them is harmless and generates a
- * smaller class.
- */
- Class[][] exceptions;
-
- /**
- * For unique id's
- */
- private static int count;
-
- /**
- * The id of this proxy class
- */
- final int id = count++;
-
- /**
- * Construct a ProxyData with uninitialized data members.
- */
- ProxyData()
- {
- }
-
- /**
- * Return the name of a package (including the trailing dot)
- * given the name of a class.
- * Returns an empty string if no package. We use this in preference to
- * using Class.getPackage() to avoid problems with ClassLoaders
- * that don't set the package.
- */
- private static String getPackage(Class k)
- {
- String name = k.getName();
- int idx = name.lastIndexOf('.');
- return name.substring(0, idx + 1);
- }
-
- /**
- * Verifies that the arguments are legal, and sets up remaining data
- * This should only be called when a class must be generated, as
- * it is expensive.
- *
- * @param pt the ProxyType to convert to ProxyData
- * @return the flattened, verified ProxyData structure for use in
- * class generation
- * @throws IllegalArgumentException if `interfaces' contains
- * non-interfaces or incompatible combinations, and verify is true
- * @throws NullPointerException if interfaces is null or contains null
- */
- static ProxyData getProxyData(ProxyType pt)
- {
- Map method_set = (Map) ProxySignature.coreMethods.clone();
- boolean in_package = false; // true if we encounter non-public interface
-
- ProxyData data = new ProxyData();
- data.interfaces = pt.interfaces;
-
- // if interfaces is too large, we croak later on when the constant
- // pool overflows
- int i = data.interfaces.length;
- while (--i >= 0)
- {
- Class inter = data.interfaces[i];
- if (! inter.isInterface())
- throw new IllegalArgumentException("not an interface: " + inter);
- try
- {
- if (Class.forName(inter.getName(), false, pt.loader) != inter)
- throw new IllegalArgumentException("not accessible in "
- + "classloader: " + inter);
- }
- catch (ClassNotFoundException e)
- {
- throw new IllegalArgumentException("not accessible in "
- + "classloader: " + inter);
- }
- if (! Modifier.isPublic(inter.getModifiers()))
- if (in_package)
- {
- String p = getPackage(inter);
- if (! data.pack.equals(p))
- throw new IllegalArgumentException("non-public interfaces "
- + "from different "
- + "packages");
- }
- else
- {
- in_package = true;
- data.pack = getPackage(inter);
- }
- for (int j = i-1; j >= 0; j--)
- if (data.interfaces[j] == inter)
- throw new IllegalArgumentException("duplicate interface: "
- + inter);
- Method[] methods = inter.getMethods();
- int j = methods.length;
- while (--j >= 0)
- {
- ProxySignature sig = new ProxySignature(methods[j]);
- ProxySignature old = (ProxySignature) method_set.put(sig, sig);
- if (old != null)
- sig.checkCompatibility(old);
- }
- }
-
- i = method_set.size();
- data.methods = new Method[i];
- data.exceptions = new Class[i][];
- Iterator itr = method_set.values().iterator();
- while (--i >= 0)
- {
- ProxySignature sig = (ProxySignature) itr.next();
- data.methods[i] = sig.method;
- data.exceptions[i] = (Class[]) sig.exceptions
- .toArray(new Class[sig.exceptions.size()]);
- }
- return data;
- }
- } // class ProxyData
-
- /**
- * Does all the work of building a class. By making this a nested class,
- * this code is not loaded in memory if the VM has a native
- * implementation instead.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- */
- private static final class ClassFactory
- {
- /** Constants for assisting the compilation */
- private static final byte POOL = 0;
- private static final byte FIELD = 1;
- private static final byte METHOD = 2;
- private static final byte INTERFACE = 3;
- private static final String CTOR_SIG
- = "(Ljava/lang/reflect/InvocationHandler;)V";
- private static final String INVOKE_SIG = "(Ljava/lang/Object;"
- + "Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;";
-
- /** Bytecodes for insertion in the class definition byte[] */
- private static final char ACONST_NULL = 1;
- private static final char ICONST_0 = 3;
- private static final char BIPUSH = 16;
- private static final char SIPUSH = 17;
- private static final char ILOAD = 21;
- private static final char ILOAD_0 = 26;
- private static final char ALOAD_0 = 42;
- private static final char ALOAD_1 = 43;
- private static final char AALOAD = 50;
- private static final char AASTORE = 83;
- private static final char DUP = 89;
- private static final char DUP_X1 = 90;
- private static final char SWAP = 95;
- private static final char IRETURN = 172;
- private static final char LRETURN = 173;
- private static final char FRETURN = 174;
- private static final char DRETURN = 175;
- private static final char ARETURN = 176;
- private static final char RETURN = 177;
- private static final char GETSTATIC = 178;
- private static final char GETFIELD = 180;
- private static final char INVOKEVIRTUAL = 182;
- private static final char INVOKESPECIAL = 183;
- private static final char INVOKESTATIC = 184;
- private static final char INVOKEINTERFACE = 185;
- private static final char NEW = 187;
- private static final char ANEWARRAY = 189;
- private static final char ATHROW = 191;
- private static final char CHECKCAST = 192;
-
- // Implementation note: we use StringBuffers to hold the byte data, since
- // they automatically grow. However, we only use the low 8 bits of
- // every char in the array, so we are using twice the necessary memory
- // for the ease StringBuffer provides.
-
- /** The constant pool. */
- private final StringBuffer pool = new StringBuffer();
- /** The rest of the class data. */
- private final StringBuffer stream = new StringBuffer();
-
- /** Map of strings to byte sequences, to minimize size of pool. */
- private final Map poolEntries = new HashMap();
-
- /** The VM name of this proxy class. */
- private final String qualName;
-
- /**
- * The Method objects the proxy class refers to when calling the
- * invocation handler.
- */
- private final Method[] methods;
-
- /**
- * Initializes the buffers with the bytecode contents for a proxy class.
- *
- * @param data the remainder of the class data
- * @throws IllegalArgumentException if anything else goes wrong this
- * late in the game; as far as I can tell, this will only happen
- * if the constant pool overflows, which is possible even when
- * the user doesn't exceed the 65535 interface limit
- */
- ClassFactory(ProxyData data)
- {
- methods = data.methods;
-
- // magic = 0xcafebabe
- // minor_version = 0
- // major_version = 46
- // constant_pool_count: place-holder for now
- pool.append("\u00ca\u00fe\u00ba\u00be\0\0\0\56\0\0");
- // constant_pool[], filled in as we go
-
- // access_flags
- putU2(Modifier.SUPER | Modifier.FINAL | Modifier.PUBLIC);
- // this_class
- qualName = (data.pack + "$Proxy" + data.id);
- putU2(classInfo(TypeSignature.getEncodingOfClass(qualName, false)));
- // super_class
- putU2(classInfo("java/lang/reflect/Proxy"));
-
- // interfaces_count
- putU2(data.interfaces.length);
- // interfaces[]
- for (int i = 0; i < data.interfaces.length; i++)
- putU2(classInfo(data.interfaces[i]));
-
- // Recall that Proxy classes serialize specially, so we do not need
- // to worry about a
- *
- *
- * @author Tom Tromey (tromey@redhat.com)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public final class ReflectPermission
- extends BasicPermission
-{
- /**
- * Compatible with JDK 1.2.
- */
- private static final long serialVersionUID = 7412737110241507485L;
-
- /**
- * Construct a ReflectPermission with the given name.
- *
- * @param name The permission name
- */
- public ReflectPermission(String name)
- {
- super(name);
- }
-
- /**
- * Construct a ReflectPermission with the given name.
- *
- * @param name The permission name
- * @param actions The actions; this is ignored and should be null
- */
- public ReflectPermission(String name, String actions)
- {
- super(name, actions);
- }
-}
diff --git a/libjava/java/lang/reflect/UndeclaredThrowableException.java b/libjava/java/lang/reflect/UndeclaredThrowableException.java
deleted file mode 100644
index 6d5a8008459..00000000000
--- a/libjava/java/lang/reflect/UndeclaredThrowableException.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/* UndeclaredThrowableException.java -- wraps an undeclared checked exception
- thrown by a Proxy invocation handler
- Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.lang.reflect;
-
-/**
- * This exception class is thrown by a {@link Proxy} instance if
- * the {@link InvocationHandler#invoke(Object, Method, Object[]) invoke}
- * method of that instance's InvocationHandler attempts to throw an
- * exception that not declared by the throws clauses of all of the
- * interface methods that the proxy instance is implementing.
- *
- *
- *
- * Permission Target Name
- * What Permission Allows
- * Risk of Allowing Permission
- *
- *
- *
- * suppressAccessChecks
Ability to access fields, invoke methods, and construct objects
- * via reflection, including non-public members in contexts where
- * such access is not legal at compile-time.
- * This is dangerous. It exposes possibly confidential information,
- * and malicious code could interfere with the internals of the Virtual
- * Machine by corrupting private data.
- * getCause()
.
- *
- * @return the cause of this exception, may be null
- * @see #getCause()
- */
- public Throwable getUndeclaredThrowable()
- {
- return undeclaredThrowable;
- }
-
- /**
- * Returns the cause of this exception. If this exception was created
- * by a {@link Proxy} instance, it will be a non-null checked
- * exception.
- *
- * @return the cause of this exception, may be null
- * @since 1.4
- */
- public Throwable getCause()
- {
- return undeclaredThrowable;
- }
-}
diff --git a/libjava/java/lang/s_atan.c b/libjava/java/lang/s_atan.c
deleted file mode 100644
index 2ee74585423..00000000000
--- a/libjava/java/lang/s_atan.c
+++ /dev/null
@@ -1,181 +0,0 @@
-
-/* @(#)s_atan.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- *
- */
-
-/*
-FUNCTION
- <